Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 9 | ||
---|---|---|---|
Line 93... | Line 93... | ||
93 | /* USER CODE END PRIVATE_MACRO */ |
93 | /* USER CODE END PRIVATE_MACRO */ |
94 | 94 | ||
95 | /** |
95 | /** |
96 | * @} |
96 | * @} |
97 | */ |
97 | */ |
98 | 98 | ||
99 | /** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes |
99 | /** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes |
100 | * @brief Private functions declaration. |
100 | * @brief Private functions declaration. |
101 | * @{ |
101 | * @{ |
102 | */ |
102 | */ |
103 | 103 | ||
104 | static void Get_SerialNum(void); |
104 | static void Get_SerialNum(void); |
105 | static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len); |
105 | static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len); |
106 | 106 | ||
107 | /** |
107 | /** |
108 | * @} |
108 | * @} |
109 | */ |
109 | */ |
110 | - | ||
111 | 110 | ||
112 | /** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes |
111 | /** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes |
113 | * @brief Private functions declaration for FS. |
112 | * @brief Private functions declaration for FS. |
114 | * @{ |
113 | * @{ |
115 | */ |
114 | */ |
Line 120... | Line 119... | ||
120 | uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
119 | uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
121 | uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
120 | uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
122 | uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
121 | uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
123 | uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
122 | uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); |
124 | 123 | ||
125 | #ifdef USBD_SUPPORT_USER_STRING_DESC |
- | |
126 | uint8_t * USBD_FS_USRStringDesc(USBD_SpeedTypeDef speed, uint8_t idx, uint16_t *length); |
- | |
127 | #endif /* USBD_SUPPORT_USER_STRING_DESC */ |
- | |
128 | - | ||
129 | /** |
124 | /** |
130 | * @} |
125 | * @} |
131 | */ |
126 | */ |
132 | 127 | ||
133 | /** @defgroup USBD_DESC_Private_Variables USBD_DESC_Private_Variables |
128 | /** @defgroup USBD_DESC_Private_Variables USBD_DESC_Private_Variables |
Line 201... | Line 196... | ||
201 | #endif /* defined ( __ICCARM__ ) */ |
196 | #endif /* defined ( __ICCARM__ ) */ |
202 | /* Internal string descriptor. */ |
197 | /* Internal string descriptor. */ |
203 | __ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END; |
198 | __ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END; |
204 | 199 | ||
205 | #if defined ( __ICCARM__ ) /*!< IAR Compiler */ |
200 | #if defined ( __ICCARM__ ) /*!< IAR Compiler */ |
206 | #pragma data_alignment=4 |
201 | #pragma data_alignment=4 |
207 | #endif |
202 | #endif |
208 | __ALIGN_BEGIN uint8_t USBD_StringSerial[USB_SIZ_STRING_SERIAL] __ALIGN_END = { |
203 | __ALIGN_BEGIN uint8_t USBD_StringSerial[USB_SIZ_STRING_SERIAL] __ALIGN_END = { |
209 | USB_SIZ_STRING_SERIAL, |
204 | USB_SIZ_STRING_SERIAL, |
210 | USB_DESC_TYPE_STRING, |
205 | USB_DESC_TYPE_STRING, |
211 | }; |
206 | }; |
Line 289... | Line 284... | ||
289 | *length = USB_SIZ_STRING_SERIAL; |
284 | *length = USB_SIZ_STRING_SERIAL; |
290 | 285 | ||
291 | /* Update the serial number string descriptor with the data from the unique |
286 | /* Update the serial number string descriptor with the data from the unique |
292 | * ID */ |
287 | * ID */ |
293 | Get_SerialNum(); |
288 | Get_SerialNum(); |
- | 289 | /* USER CODE BEGIN USBD_FS_SerialStrDescriptor */ |
|
294 | 290 | ||
- | 291 | /* USER CODE END USBD_FS_SerialStrDescriptor */ |
|
295 | return (uint8_t *) USBD_StringSerial; |
292 | return (uint8_t *) USBD_StringSerial; |
296 | } |
293 | } |
297 | 294 | ||
298 | /** |
295 | /** |
299 | * @brief Return the configuration string descriptor |
296 | * @brief Return the configuration string descriptor |
Line 332... | Line 329... | ||
332 | } |
329 | } |
333 | return USBD_StrDesc; |
330 | return USBD_StrDesc; |
334 | } |
331 | } |
335 | 332 | ||
336 | /** |
333 | /** |
337 | * @brief Create the serial number string descriptor |
334 | * @brief Create the serial number string descriptor |
338 | * @param None |
335 | * @param None |
339 | * @retval None |
336 | * @retval None |
340 | */ |
337 | */ |
341 | static void Get_SerialNum(void) |
338 | static void Get_SerialNum(void) |
342 | { |
339 | { |
343 | uint32_t deviceserial0, deviceserial1, deviceserial2; |
340 | uint32_t deviceserial0, deviceserial1, deviceserial2; |
Line 354... | Line 351... | ||
354 | IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4); |
351 | IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4); |
355 | } |
352 | } |
356 | } |
353 | } |
357 | 354 | ||
358 | /** |
355 | /** |
359 | * @brief Convert Hex 32Bits value into char |
356 | * @brief Convert Hex 32Bits value into char |
360 | * @param value: value to convert |
357 | * @param value: value to convert |
361 | * @param pbuf: pointer to the buffer |
358 | * @param pbuf: pointer to the buffer |
362 | * @param len: buffer length |
359 | * @param len: buffer length |
363 | * @retval None |
360 | * @retval None |
364 | */ |
361 | */ |
365 | static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len) |
362 | static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len) |
366 | { |
363 | { |