usbd_desc.c
Go to the documentation of this file.
1 
22 /* Includes ------------------------------------------------------------------*/
23 #include "usbd_core.h"
24 #include "usbd_desc.h"
25 #include "usbd_req.h"
26 #include "usbd_conf.h"
27 #include "usb_regs.h"
28 
51 #define USBD_VID 0x0483
52 
53 #ifdef USE_USB_CDC_HID
54 #define USBD_PID_COMPOSITE 0x3256
55 #endif
56 #define USBD_PID 0x5740
57 
61 #define USBD_LANGID_STRING 0x409
62 #define USBD_MANUFACTURER_STRING "JAMES JACKSON"
63 
64 #ifdef USBD_PRODUCT_STRING
65  #define USBD_PRODUCT_HS_STRING USBD_PRODUCT_STRING
66  #define USBD_PRODUCT_FS_STRING USBD_PRODUCT_STRING
67 #else
68  #define USBD_PRODUCT_HS_STRING "STM32 Virtual ComPort in HS mode"
69  #define USBD_PRODUCT_FS_STRING "STM32 Virtual ComPort in FS Mode"
70 #endif /* USBD_PRODUCT_STRING */
71 
72 #ifdef USBD_SERIALNUMBER_STRING
73  #define USBD_SERIALNUMBER_HS_STRING USBD_SERIALNUMBER_STRING
74  #define USBD_SERIALNUMBER_FS_STRING USBD_SERIALNUMBER_STRING
75 #else
76  // start of STM32 flash
77  #define USBD_SERIALNUMBER_HS_STRING "0x8000000"
78  #define USBD_SERIALNUMBER_FS_STRING "0x8000000"
79 #endif /* USBD_SERIALNUMBER_STRING */
80 
81 #define USBD_CONFIGURATION_HS_STRING "VCP Config"
82 #define USBD_INTERFACE_HS_STRING "VCP Interface"
83 
84 #define USBD_CONFIGURATION_FS_STRING "VCP Config"
85 #define USBD_INTERFACE_FS_STRING "VCP Interface"
86 
104 {
112 
113 };
114 
115 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
116  #if defined ( __ICCARM__ )
117  #pragma data_alignment=4
118  #endif
119 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
120 #ifdef USE_USB_CDC_HID
121 /* USB Standard Device Descriptor */
122 __ALIGN_BEGIN uint8_t USBD_DeviceDesc_Composite[USB_SIZ_DEVICE_DESC] __ALIGN_END =
123  {
124  0x12, /*bLength */
125  USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
126  0x00, 0x02, /*bcdUSB */
127  0xEF, /*bDeviceClass*/
128  0x02, /*bDeviceSubClass*/
129  0x01, /*bDeviceProtocol*/
130  USB_OTG_MAX_EP0_SIZE, /*bMaxPacketSize*/
131  LOBYTE(USBD_VID), HIBYTE(USBD_VID), /*idVendor*/
132  LOBYTE(USBD_PID_COMPOSITE),
133  HIBYTE(USBD_PID_COMPOSITE), /*idProduct*/
134  0x00, 0x02, /*bcdDevice rel. 2.00*/
135  USBD_IDX_MFC_STR, /*Index of manufacturer string*/
136  USBD_IDX_PRODUCT_STR, /*Index of product string*/
137  USBD_IDX_SERIAL_STR, /*Index of serial number string*/
138  USBD_CFG_MAX_NUM /*bNumConfigurations*/
139  } ; /* USB_DeviceDescriptor */
140 #endif
141 /* USB Standard Device Descriptor */
143  {
144  0x12, /*bLength */
145  USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
146  0x00, 0x02, /*bcdUSB */
147  0x02, /*bDeviceClass*/
148  0x02, /*bDeviceSubClass*/
149  0x00, /*bDeviceProtocol*/
150  USB_OTG_MAX_EP0_SIZE, /*bMaxPacketSize*/
151  LOBYTE(USBD_VID), HIBYTE(USBD_VID), /*idVendor*/
152  LOBYTE(USBD_PID), HIBYTE(USBD_PID), /*idProduct*/
153  0x00, 0x02, /*bcdDevice rel. 2.00*/
154  USBD_IDX_MFC_STR, /*Index of manufacturer string*/
155  USBD_IDX_PRODUCT_STR, /*Index of product string*/
156  USBD_IDX_SERIAL_STR, /*Index of serial number string*/
157  USBD_CFG_MAX_NUM /*bNumConfigurations*/
158  } ; /* USB_DeviceDescriptor */
159 
160 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
161  #if defined ( __ICCARM__ )
162  #pragma data_alignment=4
163  #endif
164 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
165 /* USB Standard Device Descriptor */
167 {
170  0x00,
171  0x02,
172  0x00,
173  0x00,
174  0x00,
175  0x40,
176  0x01,
177  0x00,
178 };
179 
180 #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
181  #if defined ( __ICCARM__ )
182  #pragma data_alignment=4
183  #endif
184 #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
185 /* USB Standard Device Descriptor */
187 {
192 };
217 uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length)
218 {
219  (void)speed;
220 #ifdef USE_USB_CDC_HID
221  if (usbDevConfig()->type == COMPOSITE) {
222  *length = sizeof(USBD_DeviceDesc_Composite);
223  return USBD_DeviceDesc_Composite;
224  }
225 #endif
226  *length = sizeof(USBD_DeviceDesc);
227  return USBD_DeviceDesc;
228 }
229 
237 uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length)
238 {
239  (void)speed;
240  *length = sizeof(USBD_LangIDDesc);
241  return USBD_LangIDDesc;
242 }
243 
244 
252 uint8_t * USBD_USR_ProductStrDescriptor( uint8_t speed , uint16_t *length)
253 {
254 
255 
256  if (speed == 0)
258  else
260 
261  return USBD_StrDesc;
262 }
263 
271 uint8_t * USBD_USR_ManufacturerStrDescriptor( uint8_t speed , uint16_t *length)
272 {
273  (void)speed;
275  return USBD_StrDesc;
276 }
277 
285 uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length)
286 {
287  if (speed == USB_OTG_SPEED_HIGH)
289  else
291 
292  return USBD_StrDesc;
293 }
294 
302 uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length)
303 {
304  if (speed == USB_OTG_SPEED_HIGH)
306  else
308 
309  return USBD_StrDesc;
310 }
311 
312 
320 uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length)
321 {
322  if (speed == 0)
324  else
326 
327  return USBD_StrDesc;
328 }
329 
344 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
header file for the usbd_req.c file
#define USB_LEN_DEV_QUALIFIER_DESC
Definition: usbd_def.h:53
void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len)
USBD_GetString Convert Ascii string into unicode one.
Definition: usbd_req.c:831
uint8_t * USBD_USR_ConfigStrDescriptor(uint8_t speed, uint16_t *length)
USBD_USR_ConfigStrDescriptor return the configuration string descriptor.
Definition: usbd_desc.c:302
#define USBD_PID
Definition: usbd_desc.c:56
#define USB_DESC_TYPE_DEVICE_QUALIFIER
Definition: usbd_def.h:94
uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC]
#define USBD_CFG_MAX_NUM
uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC]
Definition: usbd_desc.c:166
#define USBD_SERIALNUMBER_FS_STRING
Definition: usbd_desc.c:78
#define USBD_IDX_PRODUCT_STR
Definition: usbd_def.h:62
#define USBD_IDX_SERIAL_STR
Definition: usbd_def.h:63
#define USB_OTG_MAX_EP0_SIZE
Definition: usb_regs.h:71
__ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END
Definition: usbd_desc.c:142
uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID]
Definition: usbd_desc.c:186
#define USB_OTG_SPEED_HIGH
Definition: usb_defines.h:61
#define USBD_PRODUCT_HS_STRING
Definition: usbd_desc.c:68
hardware registers
uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ]
Definition: usbd_req.c:95
#define __ALIGN_BEGIN
uint8_t * USBD_USR_DeviceDescriptor(uint8_t speed, uint16_t *length)
USBD_USR_DeviceDescriptor return the device descriptor.
Definition: usbd_desc.c:217
uint8_t * USBD_USR_ManufacturerStrDescriptor(uint8_t speed, uint16_t *length)
USBD_USR_ManufacturerStrDescriptor return the manufacturer string descriptor.
Definition: usbd_desc.c:271
#define USB_SIZ_DEVICE_DESC
Definition: usbd_desc.h:47
#define USBD_INTERFACE_FS_STRING
Definition: usbd_desc.c:85
#define USBD_CONFIGURATION_FS_STRING
Definition: usbd_desc.c:84
#define USBD_SERIALNUMBER_HS_STRING
Definition: usbd_desc.c:77
#define USBD_CONFIGURATION_HS_STRING
Definition: usbd_desc.c:81
#define USBD_INTERFACE_HS_STRING
Definition: usbd_desc.c:82
uint8_t * USBD_USR_ProductStrDescriptor(uint8_t speed, uint16_t *length)
USBD_USR_ProductStrDescriptor return the product string descriptor.
Definition: usbd_desc.c:252
#define USBD_LANGID_STRING
Definition: usbd_desc.c:61
#define USBD_PRODUCT_FS_STRING
Definition: usbd_desc.c:69
USBD_DEVICE USR_desc
Definition: usbd_desc.c:103
uint8_t * USBD_USR_InterfaceStrDescriptor(uint8_t speed, uint16_t *length)
USBD_USR_InterfaceStrDescriptor return the interface string descriptor.
Definition: usbd_desc.c:320
#define USB_DEVICE_DESCRIPTOR_TYPE
Definition: usbd_cdc_core.h:55
#define HIBYTE(x)
Definition: usbd_def.h:126
#define LOBYTE(x)
Definition: usbd_def.h:125
#define USB_SIZ_STRING_LANGID
Definition: usbd_desc.h:48
uint8_t * USBD_USR_SerialStrDescriptor(uint8_t speed, uint16_t *length)
USBD_USR_SerialStrDescriptor return the serial number string descriptor.
Definition: usbd_desc.c:285
USB Device configuration file.
#define USBD_VID
Definition: usbd_desc.c:51
#define USBD_IDX_MFC_STR
Definition: usbd_def.h:61
#define USB_DESC_TYPE_STRING
Definition: usbd_def.h:91
Header file for usbd_core.c.
uint8_t * USBD_USR_LangIDStrDescriptor(uint8_t speed, uint16_t *length)
USBD_USR_LangIDStrDescriptor return the LangID string descriptor.
Definition: usbd_desc.c:237
#define USBD_MANUFACTURER_STRING
Definition: usbd_desc.c:62
header file for the usbd_desc.c file


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:26