Skip to content

Commit b7d7fbf

Browse files
committed
Use char16_t for UTF-16 strings in the USB driver
Signed-off-by: Peter Collingbourne <[email protected]>
1 parent 038c2d3 commit b7d7fbf

File tree

16 files changed

+175
-177
lines changed

16 files changed

+175
-177
lines changed

source/hic_hal/atmel/sam3u2c/usb_config.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@
9090
// </e>
9191
// </h>
9292
#define USBD_STRDESC_LANGID 0x0409
93-
#define USBD_STRDESC_MAN L"Arm"
93+
#define USBD_STRDESC_MAN u"Arm"
9494
#ifndef USB_PROD_STR
95-
#define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP"
95+
#define USBD_STRDESC_PROD u"DAPLink CMSIS-DAP"
9696
#else
97-
#define _TOWIDE(x) L ## #x
97+
#define _TOWIDE(x) u ## #x
9898
#define TOWIDE(x) _TOWIDE(x)
9999
#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR)
100100
#endif
101101
#define USBD_STRDESC_SER_ENABLE 1
102-
#define USBD_STRDESC_SER L"0001A0000000"
102+
#define USBD_STRDESC_SER u"0001A0000000"
103103

104104
// <e0> Class Support
105105
// <i> Enables USB Device Class specific Requests
@@ -169,8 +169,8 @@
169169
#define USBD_HID_HS_ENABLE 1
170170
#define USBD_HID_HS_WMAXPACKETSIZE 64
171171
#define USBD_HID_HS_BINTERVAL 1
172-
#define USBD_HID_STRDESC L"CMSIS-DAP v1"
173-
#define USBD_WEBUSB_STRDESC L"WebUSB: CMSIS-DAP"
172+
#define USBD_HID_STRDESC u"CMSIS-DAP v1"
173+
#define USBD_WEBUSB_STRDESC u"WebUSB: CMSIS-DAP"
174174
#define USBD_HID_INREPORT_NUM 1
175175
#define USBD_HID_OUTREPORT_NUM 1
176176
#define USBD_HID_INREPORT_MAX_SZ 64
@@ -221,7 +221,7 @@
221221
#define USBD_MSC_HS_ENABLE 1
222222
#define USBD_MSC_HS_WMAXPACKETSIZE 512
223223
#define USBD_MSC_HS_BINTERVAL 0
224-
#define USBD_MSC_STRDESC L"USB_MSC"
224+
#define USBD_MSC_STRDESC u"USB_MSC"
225225
// Make sure changes to USBD_MSC_INQUIRY_DATA are coordinated with mbed-ls
226226
// since this is used to detect DAPLink drives
227227
#define USBD_MSC_INQUIRY_DATA "MBED " \
@@ -266,9 +266,9 @@
266266
#define USBD_ADC_BINTERVAL 1
267267
#define USBD_ADC_HS_ENABLE 0
268268
#define USBD_ADC_HS_WMAXPACKETSIZE 64
269-
#define USBD_ADC_CIF_STRDESC L"USB_ADC"
270-
#define USBD_ADC_SIF1_STRDESC L"USB_ADC1"
271-
#define USBD_ADC_SIF2_STRDESC L"USB_ADC2"
269+
#define USBD_ADC_CIF_STRDESC u"USB_ADC"
270+
#define USBD_ADC_SIF1_STRDESC u"USB_ADC1"
271+
#define USBD_ADC_SIF2_STRDESC u"USB_ADC2"
272272
#define USBD_ADC_BSUBFRAMESIZE 2
273273
#define USBD_ADC_BBITRESOLUTION 16
274274
#define USBD_ADC_TSAMFREQ 32000
@@ -349,8 +349,8 @@
349349
#define USBD_CDC_ACM_HS_ENABLE1 1
350350
#define USBD_CDC_ACM_HS_WMAXPACKETSIZE1 512
351351
#define USBD_CDC_ACM_HS_BINTERVAL1 1
352-
#define USBD_CDC_ACM_CIF_STRDESC L"mbed Serial Port"
353-
#define USBD_CDC_ACM_DIF_STRDESC L"mbed Serial Port"
352+
#define USBD_CDC_ACM_CIF_STRDESC u"mbed Serial Port"
353+
#define USBD_CDC_ACM_DIF_STRDESC u"mbed Serial Port"
354354
#define USBD_CDC_ACM_SENDBUF_SIZE USBD_CDC_ACM_HS_WMAXPACKETSIZE1
355355
#define USBD_CDC_ACM_RECEIVEBUF_SIZE USBD_CDC_ACM_HS_WMAXPACKETSIZE1
356356
#if (((USBD_CDC_ACM_HS_ENABLE1) && (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_HS_WMAXPACKETSIZE1)) || (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_WMAXPACKETSIZE1))
@@ -401,7 +401,7 @@
401401
#define USBD_BULK_WMAXPACKETSIZE 64
402402
#define USBD_BULK_HS_ENABLE 1
403403
#define USBD_BULK_HS_WMAXPACKETSIZE 512
404-
#define USBD_BULK_STRDESC L"CMSIS-DAP v2"
404+
#define USBD_BULK_STRDESC u"CMSIS-DAP v2"
405405

406406

407407
/* USB Device Calculations ---------------------------------------------------*/

source/hic_hal/freescale/k20dx/usb_config.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@
9090
// </e>
9191
// </h>
9292
#define USBD_STRDESC_LANGID 0x0409
93-
#define USBD_STRDESC_MAN L"Arm"
93+
#define USBD_STRDESC_MAN u"Arm"
9494
#ifndef USB_PROD_STR
95-
#define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP"
95+
#define USBD_STRDESC_PROD u"DAPLink CMSIS-DAP"
9696
#else
97-
#define _TOWIDE(x) L ## #x
97+
#define _TOWIDE(x) u ## #x
9898
#define TOWIDE(x) _TOWIDE(x)
9999
#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR)
100100
#endif
101101
#define USBD_STRDESC_SER_ENABLE 1
102-
#define USBD_STRDESC_SER L"0001A0000000"
102+
#define USBD_STRDESC_SER u"0001A0000000"
103103

104104
// <e0> Class Support
105105
// <i> Enables USB Device Class specific Requests
@@ -169,8 +169,8 @@
169169
#define USBD_HID_HS_ENABLE 0
170170
#define USBD_HID_HS_WMAXPACKETSIZE 64
171171
#define USBD_HID_HS_BINTERVAL 6
172-
#define USBD_HID_STRDESC L"CMSIS-DAP v1"
173-
#define USBD_WEBUSB_STRDESC L"WebUSB: CMSIS-DAP"
172+
#define USBD_HID_STRDESC u"CMSIS-DAP v1"
173+
#define USBD_WEBUSB_STRDESC u"WebUSB: CMSIS-DAP"
174174
#define USBD_HID_INREPORT_NUM 1
175175
#define USBD_HID_OUTREPORT_NUM 1
176176
#define USBD_HID_INREPORT_MAX_SZ 64
@@ -220,7 +220,7 @@
220220
#define USBD_MSC_HS_ENABLE 0
221221
#define USBD_MSC_HS_WMAXPACKETSIZE 512
222222
#define USBD_MSC_HS_BINTERVAL 0
223-
#define USBD_MSC_STRDESC L"USB_MSC"
223+
#define USBD_MSC_STRDESC u"USB_MSC"
224224
// Make sure changes to USBD_MSC_INQUIRY_DATA are coordinated with mbed-ls
225225
// since this is used to detect DAPLink drives
226226
#define USBD_MSC_INQUIRY_DATA "MBED " \
@@ -265,9 +265,9 @@
265265
#define USBD_ADC_BINTERVAL 1
266266
#define USBD_ADC_HS_ENABLE 0
267267
#define USBD_ADC_HS_WMAXPACKETSIZE 64
268-
#define USBD_ADC_CIF_STRDESC L"USB_ADC"
269-
#define USBD_ADC_SIF1_STRDESC L"USB_ADC1"
270-
#define USBD_ADC_SIF2_STRDESC L"USB_ADC2"
268+
#define USBD_ADC_CIF_STRDESC u"USB_ADC"
269+
#define USBD_ADC_SIF1_STRDESC u"USB_ADC1"
270+
#define USBD_ADC_SIF2_STRDESC u"USB_ADC2"
271271
#define USBD_ADC_BSUBFRAMESIZE 2
272272
#define USBD_ADC_BBITRESOLUTION 16
273273
#define USBD_ADC_TSAMFREQ 32000
@@ -347,8 +347,8 @@
347347
#define USBD_CDC_ACM_HS_ENABLE1 0
348348
#define USBD_CDC_ACM_HS_WMAXPACKETSIZE1 64
349349
#define USBD_CDC_ACM_HS_BINTERVAL1 0
350-
#define USBD_CDC_ACM_CIF_STRDESC L"mbed Serial Port"
351-
#define USBD_CDC_ACM_DIF_STRDESC L"mbed Serial Port"
350+
#define USBD_CDC_ACM_CIF_STRDESC u"mbed Serial Port"
351+
#define USBD_CDC_ACM_DIF_STRDESC u"mbed Serial Port"
352352
#define USBD_CDC_ACM_SENDBUF_SIZE 64
353353
#define USBD_CDC_ACM_RECEIVEBUF_SIZE 64
354354
#if (((USBD_CDC_ACM_HS_ENABLE1) && (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_HS_WMAXPACKETSIZE1)) || (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_WMAXPACKETSIZE1))
@@ -399,7 +399,7 @@
399399
#define USBD_BULK_WMAXPACKETSIZE 64
400400
#define USBD_BULK_HS_ENABLE 0
401401
#define USBD_BULK_HS_WMAXPACKETSIZE 512
402-
#define USBD_BULK_STRDESC L"CMSIS-DAP v2"
402+
#define USBD_BULK_STRDESC u"CMSIS-DAP v2"
403403

404404

405405
/* USB Device Calculations ---------------------------------------------------*/

source/hic_hal/freescale/k26f/usb_config.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@
9999
// </e>
100100
// </h>
101101
#define USBD_STRDESC_LANGID 0x0409
102-
#define USBD_STRDESC_MAN L"Arm"
102+
#define USBD_STRDESC_MAN u"Arm"
103103
#ifndef USB_PROD_STR
104-
#define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP"
104+
#define USBD_STRDESC_PROD u"DAPLink CMSIS-DAP"
105105
#else
106-
#define _TOWIDE(x) L ## #x
106+
#define _TOWIDE(x) u ## #x
107107
#define TOWIDE(x) _TOWIDE(x)
108108
#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR)
109109
#endif
110110
#define USBD_STRDESC_SER_ENABLE 1
111-
#define USBD_STRDESC_SER L"0001A0000000"
111+
#define USBD_STRDESC_SER u"0001A0000000"
112112

113113
// <e0> Class Support
114114
// <i> Enables USB Device Class specific Requests
@@ -178,8 +178,8 @@
178178
#define USBD_HID_HS_ENABLE 1
179179
#define USBD_HID_HS_WMAXPACKETSIZE 64 //| (2<<11)
180180
#define USBD_HID_HS_BINTERVAL 1
181-
#define USBD_HID_STRDESC L"CMSIS-DAP v1"
182-
#define USBD_WEBUSB_STRDESC L"WebUSB: CMSIS-DAP"
181+
#define USBD_HID_STRDESC u"CMSIS-DAP v1"
182+
#define USBD_WEBUSB_STRDESC u"WebUSB: CMSIS-DAP"
183183
#define USBD_HID_INREPORT_NUM 1
184184
#define USBD_HID_OUTREPORT_NUM 1
185185
#define USBD_HID_INREPORT_MAX_SZ 64
@@ -229,7 +229,7 @@
229229
#define USBD_MSC_HS_ENABLE 1
230230
#define USBD_MSC_HS_WMAXPACKETSIZE 512
231231
#define USBD_MSC_HS_BINTERVAL 0
232-
#define USBD_MSC_STRDESC L"USB_MSC"
232+
#define USBD_MSC_STRDESC u"USB_MSC"
233233
// Make sure changes to USBD_MSC_INQUIRY_DATA are coordinated with mbed-ls
234234
// since this is used to detect DAPLink drives
235235
#define USBD_MSC_INQUIRY_DATA "MBED " \
@@ -274,9 +274,9 @@
274274
#define USBD_ADC_BINTERVAL 1
275275
#define USBD_ADC_HS_ENABLE 0
276276
#define USBD_ADC_HS_WMAXPACKETSIZE 64
277-
#define USBD_ADC_CIF_STRDESC L"USB_ADC"
278-
#define USBD_ADC_SIF1_STRDESC L"USB_ADC1"
279-
#define USBD_ADC_SIF2_STRDESC L"USB_ADC2"
277+
#define USBD_ADC_CIF_STRDESC u"USB_ADC"
278+
#define USBD_ADC_SIF1_STRDESC u"USB_ADC1"
279+
#define USBD_ADC_SIF2_STRDESC u"USB_ADC2"
280280
#define USBD_ADC_BSUBFRAMESIZE 2
281281
#define USBD_ADC_BBITRESOLUTION 16
282282
#define USBD_ADC_TSAMFREQ 32000
@@ -356,8 +356,8 @@
356356
#define USBD_CDC_ACM_HS_ENABLE1 1
357357
#define USBD_CDC_ACM_HS_WMAXPACKETSIZE1 512
358358
#define USBD_CDC_ACM_HS_BINTERVAL1 1
359-
#define USBD_CDC_ACM_CIF_STRDESC L"mbed Serial Port"
360-
#define USBD_CDC_ACM_DIF_STRDESC L"mbed Serial Port"
359+
#define USBD_CDC_ACM_CIF_STRDESC u"mbed Serial Port"
360+
#define USBD_CDC_ACM_DIF_STRDESC u"mbed Serial Port"
361361
#define USBD_CDC_ACM_SENDBUF_SIZE USBD_CDC_ACM_HS_WMAXPACKETSIZE1
362362
#define USBD_CDC_ACM_RECEIVEBUF_SIZE USBD_CDC_ACM_HS_WMAXPACKETSIZE1
363363
#if (((USBD_CDC_ACM_HS_ENABLE1) && (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_HS_WMAXPACKETSIZE1)) || (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_WMAXPACKETSIZE1))
@@ -408,7 +408,7 @@
408408
#define USBD_BULK_WMAXPACKETSIZE 64
409409
#define USBD_BULK_HS_ENABLE 1
410410
#define USBD_BULK_HS_WMAXPACKETSIZE 512
411-
#define USBD_BULK_STRDESC L"CMSIS-DAP v2"
411+
#define USBD_BULK_STRDESC u"CMSIS-DAP v2"
412412

413413

414414
/* USB Device Calculations ---------------------------------------------------*/

source/hic_hal/freescale/kl26z/usb_config.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@
9090
// </e>
9191
// </h>
9292
#define USBD_STRDESC_LANGID 0x0409
93-
#define USBD_STRDESC_MAN L"Arm"
93+
#define USBD_STRDESC_MAN u"Arm"
9494
#ifndef USB_PROD_STR
95-
#define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP"
95+
#define USBD_STRDESC_PROD u"DAPLink CMSIS-DAP"
9696
#else
97-
#define _TOWIDE(x) L ## #x
97+
#define _TOWIDE(x) u ## #x
9898
#define TOWIDE(x) _TOWIDE(x)
9999
#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR)
100100
#endif
101101
#define USBD_STRDESC_SER_ENABLE 1
102-
#define USBD_STRDESC_SER L"0001A0000000"
102+
#define USBD_STRDESC_SER u"0001A0000000"
103103

104104
// <e0> Class Support
105105
// <i> Enables USB Device Class specific Requests
@@ -169,8 +169,8 @@
169169
#define USBD_HID_HS_ENABLE 0
170170
#define USBD_HID_HS_WMAXPACKETSIZE 64
171171
#define USBD_HID_HS_BINTERVAL 6
172-
#define USBD_HID_STRDESC L"CMSIS-DAP v1"
173-
#define USBD_WEBUSB_STRDESC L"WebUSB: CMSIS-DAP"
172+
#define USBD_HID_STRDESC u"CMSIS-DAP v1"
173+
#define USBD_WEBUSB_STRDESC u"WebUSB: CMSIS-DAP"
174174
#define USBD_HID_INREPORT_NUM 1
175175
#define USBD_HID_OUTREPORT_NUM 1
176176
#define USBD_HID_INREPORT_MAX_SZ 64
@@ -220,7 +220,7 @@
220220
#define USBD_MSC_HS_ENABLE 0
221221
#define USBD_MSC_HS_WMAXPACKETSIZE 512
222222
#define USBD_MSC_HS_BINTERVAL 0
223-
#define USBD_MSC_STRDESC L"USB_MSC"
223+
#define USBD_MSC_STRDESC u"USB_MSC"
224224
// Make sure changes to USBD_MSC_INQUIRY_DATA are coordinated with mbed-ls
225225
// since this is used to detect DAPLink drives
226226
#define USBD_MSC_INQUIRY_DATA "MBED " \
@@ -265,9 +265,9 @@
265265
#define USBD_ADC_BINTERVAL 1
266266
#define USBD_ADC_HS_ENABLE 0
267267
#define USBD_ADC_HS_WMAXPACKETSIZE 64
268-
#define USBD_ADC_CIF_STRDESC L"USB_ADC"
269-
#define USBD_ADC_SIF1_STRDESC L"USB_ADC1"
270-
#define USBD_ADC_SIF2_STRDESC L"USB_ADC2"
268+
#define USBD_ADC_CIF_STRDESC u"USB_ADC"
269+
#define USBD_ADC_SIF1_STRDESC u"USB_ADC1"
270+
#define USBD_ADC_SIF2_STRDESC u"USB_ADC2"
271271
#define USBD_ADC_BSUBFRAMESIZE 2
272272
#define USBD_ADC_BBITRESOLUTION 16
273273
#define USBD_ADC_TSAMFREQ 32000
@@ -347,8 +347,8 @@
347347
#define USBD_CDC_ACM_HS_ENABLE1 0
348348
#define USBD_CDC_ACM_HS_WMAXPACKETSIZE1 64
349349
#define USBD_CDC_ACM_HS_BINTERVAL1 0
350-
#define USBD_CDC_ACM_CIF_STRDESC L"mbed Serial Port"
351-
#define USBD_CDC_ACM_DIF_STRDESC L"mbed Serial Port"
350+
#define USBD_CDC_ACM_CIF_STRDESC u"mbed Serial Port"
351+
#define USBD_CDC_ACM_DIF_STRDESC u"mbed Serial Port"
352352
#define USBD_CDC_ACM_SENDBUF_SIZE 64
353353
#define USBD_CDC_ACM_RECEIVEBUF_SIZE 64
354354
#if (((USBD_CDC_ACM_HS_ENABLE1) && (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_HS_WMAXPACKETSIZE1)) || (USBD_CDC_ACM_SENDBUF_SIZE < USBD_CDC_ACM_WMAXPACKETSIZE1))
@@ -399,7 +399,7 @@
399399
#define USBD_BULK_WMAXPACKETSIZE 64
400400
#define USBD_BULK_HS_ENABLE 0
401401
#define USBD_BULK_HS_WMAXPACKETSIZE 512
402-
#define USBD_BULK_STRDESC L"CMSIS-DAP v2"
402+
#define USBD_BULK_STRDESC u"CMSIS-DAP v2"
403403

404404

405405
/* USB Device Calculations ---------------------------------------------------*/

source/hic_hal/freescale/kl27z/fsl_adc16.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void ADC16_SetHardwareCompareConfig(ADC_Type *base, const adc16_hardware_compare
227227
{
228228
uint32_t tmp32 = base->SC2 & ~(ADC_SC2_ACFE_MASK | ADC_SC2_ACFGT_MASK | ADC_SC2_ACREN_MASK);
229229

230-
if (!config) /* Pass "NULL" to disable the feature. */
230+
if (!config) /* Pass "NULu" to disable the feature. */
231231
{
232232
base->SC2 = tmp32;
233233
return;
@@ -277,7 +277,7 @@ void ADC16_SetPGAConfig(ADC_Type *base, const adc16_pga_config_t *config)
277277
{
278278
uint32_t tmp32;
279279

280-
if (!config) /* Passing "NULL" is to disable the feature. */
280+
if (!config) /* Passing "NULu" is to disable the feature. */
281281
{
282282
base->PGA = 0U;
283283
return;

source/hic_hal/freescale/kl27z/fsl_adc16.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ void ADC16_SetChannelMuxMode(ADC_Type *base, adc16_channel_mux_mode_t mode);
413413
* manual for more information.
414414
*
415415
* @param base ADC16 peripheral base address.
416-
* @param config Pointer to the "adc16_hardware_compare_config_t" structure. Passing "NULL" disables the feature.
416+
* @param config Pointer to the "adc16_hardware_compare_config_t" structure. Passing "NULu" disables the feature.
417417
*/
418418
void ADC16_SetHardwareCompareConfig(ADC_Type *base, const adc16_hardware_compare_config_t *config);
419419

@@ -435,7 +435,7 @@ void ADC16_SetHardwareAverage(ADC_Type *base, adc16_hardware_average_mode_t mode
435435
* @brief Configures the PGA for the converter's front end.
436436
*
437437
* @param base ADC16 peripheral base address.
438-
* @param config Pointer to the "adc16_pga_config_t" structure. Passing "NULL" disables the feature.
438+
* @param config Pointer to the "adc16_pga_config_t" structure. Passing "NULu" disables the feature.
439439
*/
440440
void ADC16_SetPGAConfig(ADC_Type *base, const adc16_pga_config_t *config);
441441
#endif /* FSL_FEATURE_ADC16_HAS_PGA */

0 commit comments

Comments
 (0)