From 4e3436129b4594256ea63eb7ae295a034db9aa37 Mon Sep 17 00:00:00 2001 From: Brian Esquilona Date: Wed, 22 Aug 2018 17:21:20 -0500 Subject: [PATCH] Added option to customize usb product string --- records/board/microbit.yaml | 1 + source/hic_hal/atmel/sam3u2c/usb_config.c | 6 ++++++ source/hic_hal/freescale/k20dx/usb_config.c | 6 ++++++ source/hic_hal/freescale/kl26z/usb_config.c | 6 ++++++ source/hic_hal/nxp/lpc11u35/usb_config.c | 6 ++++++ source/hic_hal/nxp/lpc4322/usb_config.c | 6 ++++++ 6 files changed, 31 insertions(+) diff --git a/records/board/microbit.yaml b/records/board/microbit.yaml index 8137a6d22..8d6073998 100644 --- a/records/board/microbit.yaml +++ b/records/board/microbit.yaml @@ -3,6 +3,7 @@ common: - HID_LED_DEF=GPIO_LED_ON - CDC_LED_DEF=GPIO_LED_ON - MSC_LED_DEF=GPIO_LED_ON + - USB_PROD_STR="BBC micro:bit CMSIS-DAP" sources: board: - source/board/microbit.c diff --git a/source/hic_hal/atmel/sam3u2c/usb_config.c b/source/hic_hal/atmel/sam3u2c/usb_config.c index 33a6a5015..3c96e8c07 100644 --- a/source/hic_hal/atmel/sam3u2c/usb_config.c +++ b/source/hic_hal/atmel/sam3u2c/usb_config.c @@ -85,7 +85,13 @@ // #define USBD_STRDESC_LANGID 0x0409 #define USBD_STRDESC_MAN L"ARM" +#ifndef USB_PROD_STR #define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP" +#else +#define _TOWIDE(x) L ## #x +#define TOWIDE(x) _TOWIDE(x) +#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR) +#endif #define USBD_STRDESC_SER_ENABLE 1 #define USBD_STRDESC_SER L"0001A0000000" diff --git a/source/hic_hal/freescale/k20dx/usb_config.c b/source/hic_hal/freescale/k20dx/usb_config.c index 935704e34..081641e58 100644 --- a/source/hic_hal/freescale/k20dx/usb_config.c +++ b/source/hic_hal/freescale/k20dx/usb_config.c @@ -85,7 +85,13 @@ // #define USBD_STRDESC_LANGID 0x0409 #define USBD_STRDESC_MAN L"ARM" +#ifndef USB_PROD_STR #define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP" +#else +#define _TOWIDE(x) L ## #x +#define TOWIDE(x) _TOWIDE(x) +#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR) +#endif #define USBD_STRDESC_SER_ENABLE 1 #define USBD_STRDESC_SER L"0001A0000000" diff --git a/source/hic_hal/freescale/kl26z/usb_config.c b/source/hic_hal/freescale/kl26z/usb_config.c index 22e373b2a..3665124bc 100644 --- a/source/hic_hal/freescale/kl26z/usb_config.c +++ b/source/hic_hal/freescale/kl26z/usb_config.c @@ -85,7 +85,13 @@ // #define USBD_STRDESC_LANGID 0x0409 #define USBD_STRDESC_MAN L"ARM" +#ifndef USB_PROD_STR #define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP" +#else +#define _TOWIDE(x) L ## #x +#define TOWIDE(x) _TOWIDE(x) +#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR) +#endif #define USBD_STRDESC_SER_ENABLE 1 #define USBD_STRDESC_SER L"0001A0000000" diff --git a/source/hic_hal/nxp/lpc11u35/usb_config.c b/source/hic_hal/nxp/lpc11u35/usb_config.c index 91d986707..74134e079 100644 --- a/source/hic_hal/nxp/lpc11u35/usb_config.c +++ b/source/hic_hal/nxp/lpc11u35/usb_config.c @@ -85,7 +85,13 @@ // #define USBD_STRDESC_LANGID 0x0409 #define USBD_STRDESC_MAN L"ARM" +#ifndef USB_PROD_STR #define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP" +#else +#define _TOWIDE(x) L ## #x +#define TOWIDE(x) _TOWIDE(x) +#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR) +#endif #define USBD_STRDESC_SER_ENABLE 1 #define USBD_STRDESC_SER L"0001A0000000" diff --git a/source/hic_hal/nxp/lpc4322/usb_config.c b/source/hic_hal/nxp/lpc4322/usb_config.c index f1af3b89b..2613e869e 100644 --- a/source/hic_hal/nxp/lpc4322/usb_config.c +++ b/source/hic_hal/nxp/lpc4322/usb_config.c @@ -85,7 +85,13 @@ // #define USBD_STRDESC_LANGID 0x0409 #define USBD_STRDESC_MAN L"ARM" +#ifndef USB_PROD_STR #define USBD_STRDESC_PROD L"DAPLink CMSIS-DAP" +#else +#define _TOWIDE(x) L ## #x +#define TOWIDE(x) _TOWIDE(x) +#define USBD_STRDESC_PROD TOWIDE(USB_PROD_STR) +#endif #define USBD_STRDESC_SER_ENABLE 1 #define USBD_STRDESC_SER L"0001A0000000"