44#define USB_DIR_MASK 0x80
45#define USB_DIR_OUT 0x00
46#define USB_DIR_IN 0x80
49#define USB_EP0_MAX_PACKET_SIZE 64
50#define USB_EP1_MAX_PACKET_SIZE 64
51#define USB_EP2_MAX_PACKET_SIZE 64
52#define USB_EP3_MAX_PACKET_SIZE 64
55#define USB_SELF_POWERED 0xC0
56#define USB_BUS_POWERED 0x80
57#define USB_REMOTE_WAKEUP 0xA0
58#define USB_NO_REMOTE_WAKEUP 0x80
61#define USB_ENDPOINT_TYPE_MASK 0x03
62#define USB_ENDPOINT_TYPE_CONTROL 0x00
63#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
64#define USB_ENDPOINT_TYPE_BULK 0x02
65#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
68#define USB_DEVICE_CLASS_CDC 0x02
70#define USB_DEVICE_SUBCLASS_CDC 0x00
72#define USB_DEVICE_PROTOCOL_CDC 0x00
75#define CDC_INTERFACE_CLASS_COMMUNICATION 0x02
76#define CDC_INTERFACE_CLASS_RNDIS 0xEF
78#define CDC_INTERFACE_SUBCLASS_ACM 0x02
79#define CDC_INTERFACE_SUBCLASS_RNDIS 0x04
81#define CDC_INTERFACE_PROTOCOL_RNDIS 0x01
82#define CDC_INTERFACE_PROTOCOL_VENDOR_SPECIFIC 0xFF
85#define CDC_INTERFACE_CLASS_DATA 0x0A
87#define CDC_INTERFACE_SUBCLASS_DATA 0x00
89#define CDC_INTERFACE_PROTOCOL_DATA 0x00
92#define CDC_CS_INTERFACE 0x24
93#define CDC_CS_ENDPOINT 0x25
96#define CDC_HEADER_DESC_SUBTYPE 0x00
97#define CDC_CALL_MANAGEMENT_DESC_SUBTYPE 0x01
98#define CDC_ACM_DESC_SUBTYPE 0x02
99#define CDC_UNION_DESC_SUBTYPE 0x06
109 uint8_t bDescriptorType;
111 uint8_t bDeviceClass;
112 uint8_t bDeviceSubClass;
113 uint8_t bDeviceProtocol;
114 uint8_t bMaxPacketSize0;
118 uint8_t iManufacturer;
120 uint8_t iSerialNumber;
121 uint8_t bNumConfigurations;
122} UsbDeviceDescriptor;
132 uint8_t bDescriptorType;
133 uint16_t wTotalLength;
134 uint8_t bNumInterfaces;
135 uint8_t bConfigurationValue;
136 uint8_t iConfiguration;
137 uint8_t bmAttributes;
139} UsbConfigDescriptor;
149 uint8_t bDescriptorType;
150 uint8_t bInterfaceNumber;
151 uint8_t bAlternateSetting;
152 uint8_t bNumEndpoints;
153 uint8_t bInterfaceClass;
154 uint8_t bInterfaceSubClass;
155 uint8_t bInterfaceProtocol;
157} UsbInterfaceDescriptor;
167 uint8_t bDescriptorType;
168 uint8_t bEndpointAddress;
169 uint8_t bmAttributes;
170 uint16_t wMaxPacketSize;
172} UsbEndpointDescriptor;
182 uint8_t bDescriptorType;
184} UsbStringDescriptor;
193 uint8_t bFunctionLength;
194 uint8_t bDescriptorType;
195 uint8_t bDescriptorSubtype;
197} CdcHeaderDescriptor;
206 uint8_t bFunctionLength;
207 uint8_t bDescriptorType;
208 uint8_t bDescriptorSubtype;
209 uint8_t bmCapabilities;
210 uint8_t bDataInterface;
211} CdcCallManagementDescriptor;
220 uint8_t bFunctionLength;
221 uint8_t bDescriptorType;
222 uint8_t bDescriptorSubtype;
223 uint8_t bmCapabilities;
233 uint8_t bFunctionLength;
234 uint8_t bDescriptorType;
235 uint8_t bDescriptorSubtype;
236 uint8_t bMasterInterface;
237 uint8_t bSlaveInterface0;
248 UsbConfigDescriptor configDescriptor;
250 UsbInterfaceDescriptor communicationInterfaceDescriptor;
252 CdcHeaderDescriptor cdcHeaderDescriptor;
254 CdcCallManagementDescriptor cdcCallManagementDescriptor;
256 CdcAcmDescriptor cdcAcmDescriptor;
258 CdcUnionDescriptor cdcUnionDescriptor;
260 UsbEndpointDescriptor notificationEndpointDescriptor;
262 UsbInterfaceDescriptor dataInterfaceDescriptor;
264 UsbEndpointDescriptor dataOutEndpointDescriptor;
266 UsbEndpointDescriptor dataInEndpointDescriptor;
267} UsbConfigDescriptors;
271extern USBD_DescriptorsTypeDef usbdRndisDescriptors;
272extern const UsbDeviceDescriptor usbdDeviceDescriptor;
273extern const UsbConfigDescriptors usbdConfigDescriptors;
276uint8_t *usbdGetDeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
277uint8_t *usbdGetLangIdStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
278uint8_t *usbdGetManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
279uint8_t *usbdGetProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
280uint8_t *usbdGetSerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
281uint8_t *usbdGetConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
282uint8_t *usbdGetInterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length);
typedef __packed_struct
Device descriptor.
Definition usbd_desc.h:107