From 5f1bf849417fe2c6bf4aa331fba3e017cbfce7dc Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 2 Jul 2018 11:09:00 +0700 Subject: [PATCH] upgrade tusb --- lib/tinyusb | 2 +- src/main.c | 4 ---- src/usb/tusb_config.h | 13 ++++++++++--- src/usb/tusb_descriptors.c | 12 ++++++------ src/usb/tusb_descriptors.h | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/tinyusb b/lib/tinyusb index cfd5e1e..142300c 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit cfd5e1e6d19d94481ef84b4a16b41b2fae6c252e +Subproject commit 142300ca60d4c08d3d05df77c943e76b4336b21f diff --git a/src/main.c b/src/main.c index 7c35838..aec4877 100644 --- a/src/main.c +++ b/src/main.c @@ -60,7 +60,6 @@ #include "nrf_usbd.h" #include "tusb.h" -#include "usb/tusb_descriptors.h" #include "usb/msc_uf2.h" @@ -357,9 +356,6 @@ int main(void) // Init usb stack tusb_init(); - // Set usb descriptors - tud_set_descriptors(&usb_desc_init); - /*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/ /* For metro52 LED_BLUE is muxed with FRESET. We only init FRESET BUTTON diff --git a/src/usb/tusb_config.h b/src/usb/tusb_config.h index a84cefb..e9d9aaa 100644 --- a/src/usb/tusb_config.h +++ b/src/usb/tusb_config.h @@ -49,15 +49,22 @@ #define CFG_TUSB_MCU OPT_MCU_NRF5X #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE -#define CFG_TUSB_OS OPT_OS_NONE -//#define CFG_TUD_TASK_PRIO 0 - #define CFG_TUSB_DEBUG 0 +/*------------- RTOS -------------*/ +#define CFG_TUSB_OS OPT_OS_NONE +//#define CFG_TUD_TASK_PRIO 0 +//#define CFG_TUD_TASK_QUEUE_SZ 16 +//#define CFG_TUD_TASK_STACK_SZ 150 + + //--------------------------------------------------------------------+ // DEVICE CONFIGURATION // Note: TUD Stand for Tiny Usb Device //--------------------------------------------------------------------+ + +/*------------- Core -------------*/ +#define CFG_TUD_DESC_AUTO 0 #define CFG_TUD_ENDOINT0_SIZE 64 //------------- Class enabled -------------// diff --git a/src/usb/tusb_descriptors.c b/src/usb/tusb_descriptors.c index 13f3ce0..2e148f7 100644 --- a/src/usb/tusb_descriptors.c +++ b/src/usb/tusb_descriptors.c @@ -283,7 +283,7 @@ app_descriptor_configuration_t const desc_configuration = #define ENDIAN_BE16_FROM( high, low) ENDIAN_BE16(high << 8 | low) // array of pointer to string descriptors -uint16_t const * const string_descriptor_arr [] = +uint16_t const * const string_desc_arr [] = { [0] = (uint16_t []) { // supported language ENDIAN_BE16_FROM( STRING_LEN_UNICODE(1), TUSB_DESC_STRING ), @@ -322,10 +322,10 @@ uint16_t const * const string_descriptor_arr [] = }; -/*------------- Variable used by tud_set_descriptors -------------*/ -tud_desc_init_t usb_desc_init = +/*------------- Variable used by tusb stack -------------*/ +tud_desc_set_t tud_desc_set = { - .device = (uint8_t const * ) &desc_device, - .configuration = (uint8_t const * ) &desc_configuration, - .string_arr = (uint8_t const **) string_descriptor_arr, + .device = (uint8_t const * ) &desc_device, + .config = (uint8_t const * ) &desc_configuration, + .string_arr = (uint8_t const **) string_desc_arr, }; diff --git a/src/usb/tusb_descriptors.h b/src/usb/tusb_descriptors.h index 7fe3adb..2b66f79 100644 --- a/src/usb/tusb_descriptors.h +++ b/src/usb/tusb_descriptors.h @@ -125,6 +125,6 @@ typedef struct ATTR_PACKED } app_descriptor_configuration_t; -extern tud_desc_init_t usb_desc_init; +extern tud_desc_set_t tud_desc_set; #endif