From a360bcc0b4a98d7e092565982ffa866fd50678d3 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 12 Apr 2018 18:11:45 +0700 Subject: [PATCH] update tinyusb config --- lib/tinyusb | 2 +- src/msc_device_app.c | 2 +- src/msc_device_app.h | 4 ++-- src/msc_device_ramdisk.c | 2 +- src/tusb_config.h | 31 ++++++++++++++++++++----------- src/tusb_descriptors.c | 6 +++--- src/tusb_descriptors.h | 8 ++++---- 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/lib/tinyusb b/lib/tinyusb index a74b2d3..a24615b 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit a74b2d34e5467d913d86abf3331eab2ccd2def92 +Subproject commit a24615bffcba2272af9d0d75bdefb6a8a6180e89 diff --git a/src/msc_device_app.c b/src/msc_device_app.c index 6609257..1730975 100644 --- a/src/msc_device_app.c +++ b/src/msc_device_app.c @@ -38,7 +38,7 @@ #include "msc_device_app.h" -#if CFG_TUSB_DEVICE_MSC +#if CFG_TUD_MSC //--------------------------------------------------------------------+ // INCLUDE //--------------------------------------------------------------------+ diff --git a/src/msc_device_app.h b/src/msc_device_app.h index 20d8056..de2f036 100644 --- a/src/msc_device_app.h +++ b/src/msc_device_app.h @@ -49,7 +49,7 @@ extern "C" { #endif -#if CFG_TUSB_DEVICE_MSC +#if CFG_TUD_MSC enum { @@ -62,7 +62,7 @@ enum If you find any bugs or get any questions, feel free to file an\r\n\ issue at github.com/hathach/tinyusb" -#if CFG_TUSB_MCU==MCU_LPC11UXX || CFG_TUSB_MCU==MCU_LPC13UXX +#if CFG_TUSB_MCU==OPT_MCU_LPC11UXX || CFG_TUSB_MCU==OPT_MCU_LPC13UXX #define MSCD_APP_ROMDISK #else // defaults is ram disk #define MSCD_APP_RAMDISK diff --git a/src/msc_device_ramdisk.c b/src/msc_device_ramdisk.c index 45932e0..bb9c53e 100644 --- a/src/msc_device_ramdisk.c +++ b/src/msc_device_ramdisk.c @@ -38,7 +38,7 @@ #include "msc_device_app.h" -#if CFG_TUSB_DEVICE_MSC && defined (MSCD_APP_RAMDISK) +#if CFG_TUD_MSC && defined (MSCD_APP_RAMDISK) //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF diff --git a/src/tusb_config.h b/src/tusb_config.h index 9b1c48b..298d47f 100644 --- a/src/tusb_config.h +++ b/src/tusb_config.h @@ -46,29 +46,30 @@ //--------------------------------------------------------------------+ // COMMON CONFIGURATION //--------------------------------------------------------------------+ -#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE) +#define CFG_TUSB_MCU OPT_MCU_NRF5X +#define CFG_TUSB_CONTROLLER_0_MODE (OPT_MODE_DEVICE) #define CFG_TUSB_DEBUG 2 -#define CFG_TUSB_OS TUSB_OS_NONE +#define CFG_TUSB_OS OPT_OS_NONE //#define CFG_TUSB_OS_TASK_PRIO 0 //--------------------------------------------------------------------+ // DEVICE CONFIGURATION +// Note: TUD Stand for Tiny Usb Device //--------------------------------------------------------------------+ -#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64 +#define CFG_TUD_ENDOINT0_SIZE 64 -//------------- CLASS -------------// -#define CFG_TUSB_DEVICE_HID_KEYBOARD 0 -#define CFG_TUSB_DEVICE_HID_MOUSE 0 -#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet -#define CFG_TUSB_DEVICE_MSC 0 -#define CFG_TUSB_DEVICE_CDC 1 +//------------- Class enabled -------------// +#define CFG_TUD_HID_KEYBOARD 0 +#define CFG_TUD_HID_MOUSE 0 +#define CFG_TUD_HID_GENERIC 0 // not supported yet +#define CFG_TUD_MSC 0 +#define CFG_TUD_CDC 1 /*------------------------------------------------------------------*/ -/* CLASS - * TUD Stand for Tiny Usb Device +/* CLASS DRIVER *------------------------------------------------------------------*/ // FIFO size of CDC TX and RX @@ -84,6 +85,14 @@ #define CFG_TUSB_ATTR_USBRAM #define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4) + +#define BREAKPOINT_IGNORE_COUNT(n) \ + do {\ + static uint8_t ignore_count = 0;\ + ignore_count++;\ + if ( ignore_count > n ) verify_breakpoint();\ + }while(0) + #ifdef __cplusplus } #endif diff --git a/src/tusb_descriptors.c b/src/tusb_descriptors.c index 4bf3ee2..18f22d6 100644 --- a/src/tusb_descriptors.c +++ b/src/tusb_descriptors.c @@ -53,7 +53,7 @@ tusb_desc_device_t const desc_device = .bDeviceSubClass = MISC_SUBCLASS_COMMON, .bDeviceProtocol = MISC_PROTOCOL_IAD, - .bMaxPacketSize0 = CFG_TUSB_DEVICE_ENDOINT0_SIZE, + .bMaxPacketSize0 = CFG_TUD_ENDOINT0_SIZE, .idVendor = CFG_VENDORID, .idProduct = CFG_PRODUCTID, @@ -85,7 +85,7 @@ app_descriptor_configuration_t const desc_configuration = .bMaxPower = TUSB_DESC_CONFIG_POWER_MA(500) }, -#if CFG_TUSB_DEVICE_CDC +#if CFG_TUD_CDC // IAD points to CDC Interfaces .cdc = { @@ -199,7 +199,7 @@ app_descriptor_configuration_t const desc_configuration = }, #endif -#if CFG_TUSB_DEVICE_MSC +#if CFG_TUD_MSC .msc = { .interface = diff --git a/src/tusb_descriptors.h b/src/tusb_descriptors.h index 7a140c3..7359ec9 100644 --- a/src/tusb_descriptors.h +++ b/src/tusb_descriptors.h @@ -50,7 +50,7 @@ // each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug. // Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB) #ifndef CFG_PRODUCTID - #define PRODUCTID_BITMAP(interface, n) ( (CFG_TUSB_DEVICE_##interface) << (n) ) + #define PRODUCTID_BITMAP(interface, n) ( (CFG_TUD_##interface) << (n) ) #define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \ PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \ PRODUCTID_BITMAP(MSC, 4) ) ) @@ -60,7 +60,7 @@ #define ITF_NUM_MSC 2 // total number of interfaces -#define ITF_TOTAL (CFG_TUSB_DEVICE_CDC*2 + CFG_TUSB_DEVICE_MSC) +#define ITF_TOTAL (CFG_TUD_CDC*2 + CFG_TUD_MSC) //--------------------------------------------------------------------+ // Endpoints Address & Max Packet Size @@ -87,7 +87,7 @@ typedef struct ATTR_PACKED { tusb_desc_configuration_t configuration; -#if CFG_TUSB_DEVICE_CDC +#if CFG_TUD_CDC struct ATTR_PACKED { tusb_desc_interface_assoc_t iad; @@ -107,7 +107,7 @@ typedef struct ATTR_PACKED }cdc; #endif -#if CFG_TUSB_DEVICE_MSC +#if CFG_TUD_MSC struct ATTR_PACKED { tusb_desc_interface_t interface;