47#ifndef USBD_MAX_NUM_INTERFACES
48#define USBD_MAX_NUM_INTERFACES 1U
51#ifndef USBD_MAX_NUM_CONFIGURATION
52#define USBD_MAX_NUM_CONFIGURATION 1U
55#ifdef USE_USBD_COMPOSITE
56#ifndef USBD_MAX_SUPPORTED_CLASS
57#define USBD_MAX_SUPPORTED_CLASS 4U
60#ifndef USBD_MAX_SUPPORTED_CLASS
61#define USBD_MAX_SUPPORTED_CLASS 1U
65#ifndef USBD_MAX_CLASS_ENDPOINTS
66#define USBD_MAX_CLASS_ENDPOINTS 5U
69#ifndef USBD_MAX_CLASS_INTERFACES
70#define USBD_MAX_CLASS_INTERFACES 5U
73#ifndef USBD_LPM_ENABLED
74#define USBD_LPM_ENABLED 0U
77#ifndef USBD_SELF_POWERED
78#define USBD_SELF_POWERED 1U
82#define USBD_MAX_POWER 0x32U
85#ifndef USBD_SUPPORT_USER_STRING_DESC
86#define USBD_SUPPORT_USER_STRING_DESC 0U
89#ifndef USBD_CLASS_USER_STRING_DESC
90#define USBD_CLASS_USER_STRING_DESC 0U
93#define USB_LEN_DEV_QUALIFIER_DESC 0x0AU
94#define USB_LEN_DEV_DESC 0x12U
95#define USB_LEN_CFG_DESC 0x09U
96#define USB_LEN_IF_DESC 0x09U
97#define USB_LEN_EP_DESC 0x07U
98#define USB_LEN_OTG_DESC 0x03U
99#define USB_LEN_LANGID_STR_DESC 0x04U
100#define USB_LEN_OTHER_SPEED_DESC_SIZ 0x09U
102#define USBD_IDX_LANGID_STR 0x00U
103#define USBD_IDX_MFC_STR 0x01U
104#define USBD_IDX_PRODUCT_STR 0x02U
105#define USBD_IDX_SERIAL_STR 0x03U
106#define USBD_IDX_CONFIG_STR 0x04U
107#define USBD_IDX_INTERFACE_STR 0x05U
109#define USB_REQ_TYPE_STANDARD 0x00U
110#define USB_REQ_TYPE_CLASS 0x20U
111#define USB_REQ_TYPE_VENDOR 0x40U
112#define USB_REQ_TYPE_MASK 0x60U
114#define USB_REQ_RECIPIENT_DEVICE 0x00U
115#define USB_REQ_RECIPIENT_INTERFACE 0x01U
116#define USB_REQ_RECIPIENT_ENDPOINT 0x02U
117#define USB_REQ_RECIPIENT_MASK 0x03U
119#define USB_REQ_GET_STATUS 0x00U
120#define USB_REQ_CLEAR_FEATURE 0x01U
121#define USB_REQ_SET_FEATURE 0x03U
122#define USB_REQ_SET_ADDRESS 0x05U
123#define USB_REQ_GET_DESCRIPTOR 0x06U
124#define USB_REQ_SET_DESCRIPTOR 0x07U
125#define USB_REQ_GET_CONFIGURATION 0x08U
126#define USB_REQ_SET_CONFIGURATION 0x09U
127#define USB_REQ_GET_INTERFACE 0x0AU
128#define USB_REQ_SET_INTERFACE 0x0BU
129#define USB_REQ_SYNCH_FRAME 0x0CU
131#define USB_DESC_TYPE_DEVICE 0x01U
132#define USB_DESC_TYPE_CONFIGURATION 0x02U
133#define USB_DESC_TYPE_STRING 0x03U
134#define USB_DESC_TYPE_INTERFACE 0x04U
135#define USB_DESC_TYPE_ENDPOINT 0x05U
136#define USB_DESC_TYPE_DEVICE_QUALIFIER 0x06U
137#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 0x07U
138#define USB_DESC_TYPE_IAD 0x0BU
139#define USB_DESC_TYPE_BOS 0x0FU
141#define USB_CONFIG_REMOTE_WAKEUP 0x02U
142#define USB_CONFIG_SELF_POWERED 0x01U
144#define USB_FEATURE_EP_HALT 0x00U
145#define USB_FEATURE_REMOTE_WAKEUP 0x01U
146#define USB_FEATURE_TEST_MODE 0x02U
148#define USB_DEVICE_CAPABITY_TYPE 0x10U
150#define USB_CONF_DESC_SIZE 0x09U
151#define USB_IF_DESC_SIZE 0x09U
152#define USB_EP_DESC_SIZE 0x07U
153#define USB_IAD_DESC_SIZE 0x08U
155#define USB_HS_MAX_PACKET_SIZE 512U
156#define USB_FS_MAX_PACKET_SIZE 64U
157#define USB_MAX_EP0_SIZE 64U
160#define USBD_STATE_DEFAULT 0x01U
161#define USBD_STATE_ADDRESSED 0x02U
162#define USBD_STATE_CONFIGURED 0x03U
163#define USBD_STATE_SUSPENDED 0x04U
167#define USBD_EP0_IDLE 0x00U
168#define USBD_EP0_SETUP 0x01U
169#define USBD_EP0_DATA_IN 0x02U
170#define USBD_EP0_DATA_OUT 0x03U
171#define USBD_EP0_STATUS_IN 0x04U
172#define USBD_EP0_STATUS_OUT 0x05U
173#define USBD_EP0_STALL 0x06U
175#define USBD_EP_TYPE_CTRL 0x00U
176#define USBD_EP_TYPE_ISOC 0x01U
177#define USBD_EP_TYPE_BULK 0x02U
178#define USBD_EP_TYPE_INTR 0x03U
180#ifdef USE_USBD_COMPOSITE
181#define USBD_EP_IN 0x80U
182#define USBD_EP_OUT 0x00U
183#define USBD_FUNC_DESCRIPTOR_TYPE 0x24U
184#define USBD_DESC_SUBTYPE_ACM 0x0FU
185#define USBD_DESC_ECM_BCD_LOW 0x00U
186#define USBD_DESC_ECM_BCD_HIGH 0x10U
229 uint8_t bDescriptorType;
260 uint8_t *(*GetHSConfigDescriptor)(uint16_t *length);
261 uint8_t *(*GetFSConfigDescriptor)(uint16_t *length);
262 uint8_t *(*GetOtherSpeedConfigDescriptor)(uint16_t *length);
263 uint8_t *(*GetDeviceQualifierDescriptor)(uint16_t *length);
264#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
265 uint8_t *(*GetUsrStrDescriptor)(
struct _USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length);
297#if (USBD_CLASS_USER_STRING_DESC == 1)
298 uint8_t *(*GetUserStrDescriptor)(
USBD_SpeedTypeDef speed, uint8_t idx, uint16_t *length);
300#if ((USBD_LPM_ENABLED == 1U) || (USBD_CLASS_BOS_ENABLED == 1))
317#ifdef USE_USBD_COMPOSITE
326 CLASS_TYPE_AUDIO = 6,
328 CLASS_TYPE_RNDIS = 8,
330 CLASS_TYPE_VIDEO = 10,
331 CLASS_TYPE_PRINTER = 11,
332 CLASS_TYPE_CCID = 12,
333} USBD_CompositeClassTypeDef;
348 USBD_CompositeClassTypeDef ClassType;
356 uint32_t CurrPcktSze;
357} USBD_CompositeElementTypeDef;
391#ifdef USE_USBD_COMPOSITE
394#if (USBD_USER_REGISTER_CALLBACK == 1U)
395 void (* DevStateCallback)(uint8_t
dev_state, uint8_t cfgidx);
399#if (USBD_USER_REGISTER_CALLBACK == 1U)
400typedef void (*USBD_DevStateCallbackTypeDef)(uint8_t dev_state, uint8_t cfgidx);
430 uint8_t *_pbuff = addr;
432 _Byte1 = *(uint8_t *)_pbuff;
434 _Byte2 = *(uint8_t *)_pbuff;
436 _SwapVal = (_Byte2 << 8) | _Byte1;
442#define LOBYTE(x) ((uint8_t)((x) & 0x00FFU))
446#define HIBYTE(x) ((uint8_t)(((x) & 0xFF00U) >> 8U))
450#define MIN(a, b) (((a) < (b)) ? (a) : (b))
454#define MAX(a, b) (((a) > (b)) ? (a) : (b))
457#if defined ( __GNUC__ )
459#define __weak __attribute__((weak))
462#define __packed __attribute__((__packed__))
470#if defined ( __GNUC__ ) && !defined (__CC_ARM)
472#define __ALIGN_END __attribute__ ((aligned (4U)))
482#if defined (__CC_ARM)
483#define __ALIGN_BEGIN __align(4U)
484#elif defined (__ICCARM__)
#define __IO
Defines 'read / write' permissions.
__STATIC_INLINE uint16_t SWAPBYTE(uint8_t *addr)
struct _USBD_HandleTypeDef USBD_HandleTypeDef
struct usb_setup_req USBD_SetupReqTypedef
USBD_CDC_NotifCodeTypeDef
struct _Device_cb USBD_ClassTypeDef
@ CONNECTION_SPEED_CHANGE
#define USBD_MAX_SUPPORTED_CLASS
#define USBD_MAX_CLASS_ENDPOINTS
#define USBD_MAX_CLASS_INTERFACES
uint8_t(* IsoINIncomplete)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum)
uint8_t(* EP0_RxReady)(struct _USBD_HandleTypeDef *pdev)
uint8_t(* DataIn)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum)
uint8_t(* Init)(struct _USBD_HandleTypeDef *pdev, uint8_t cfgidx)
uint8_t(* IsoOUTIncomplete)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum)
uint8_t(* DeInit)(struct _USBD_HandleTypeDef *pdev, uint8_t cfgidx)
uint8_t(* Setup)(struct _USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
uint8_t(* DataOut)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum)
uint8_t(* EP0_TxSent)(struct _USBD_HandleTypeDef *pdev)
uint8_t(* SOF)(struct _USBD_HandleTypeDef *pdev)
uint32_t dev_default_config
uint32_t dev_config_status
__IO uint8_t dev_old_state
USBD_EndpointTypeDef ep_in[16]
USBD_EndpointTypeDef ep_out[16]
uint32_t dev_remote_wakeup
USBD_DescriptorsTypeDef * pDesc
void * pClassDataCmsit[USBD_MAX_SUPPORTED_CLASS]
uint8_t dev_connection_status
USBD_SpeedTypeDef dev_speed
USBD_ClassTypeDef * pClass[USBD_MAX_SUPPORTED_CLASS]
USBD_SetupReqTypedef request
void * pUserData[USBD_MAX_SUPPORTED_CLASS]
uint8_t bConfigurationValue
: Header for usbd_conf.c file.