From 57aa55443092b8e25598d90ea593f68b9f49f77c Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 22 Feb 2019 14:46:16 +0700 Subject: [PATCH] update tinyusb to latest for scsi write10 complete fix --- .gitmodules | 1 - .../libraries/bootloader_dfu/bootloader.c | 4 ++-- lib/tinyusb | 2 +- src/usb/usb.c | 13 ----------- src/usb/usb_desc.c | 22 ++++++++++--------- 5 files changed, 15 insertions(+), 27 deletions(-) diff --git a/.gitmodules b/.gitmodules index 74acdd6..8acbe85 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,6 @@ [submodule "tinyusb"] path = lib/tinyusb url = https://github.com/hathach/tinyusb.git - branch = develop [submodule "lib/nrfx"] path = lib/nrfx url = https://github.com/NordicSemiconductor/nrfx.git diff --git a/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c b/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c index cf9072e..c3342b8 100644 --- a/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c +++ b/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c @@ -130,9 +130,9 @@ static void wait_for_events(void) #ifdef NRF52840_XXAA // skip if usb is not inited ( e.g OTA / finializing sd/bootloader ) extern bool usb_inited(void); - if ( usb_inited() ) + if ( tusb_inited() ) { - tusb_task(); + tud_task(); tud_cdc_write_flush(); } #endif diff --git a/lib/tinyusb b/lib/tinyusb index a1c5964..5587481 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit a1c596490aa40863cd5f1e36a821157ffeab2af6 +Subproject commit 55874813f82157b7509729b1a0c66e68f86e2d07 diff --git a/src/usb/usb.c b/src/usb/usb.c index 2ba83e4..b5baee6 100644 --- a/src/usb/usb.c +++ b/src/usb/usb.c @@ -63,22 +63,9 @@ extern uint16_t usb_desc_str_serial[1+16]; * We must call it within SD's SOC event handler, or set it as power event handler if SD is not enabled. */ extern void tusb_hal_nrf_power_event(uint32_t event); - //------------- IMPLEMENTATION -------------// -static bool _inited = false; - -bool usb_inited(void) -{ - return _inited; -} - void usb_init(bool cdc_only) { - // skipped if already inited - if ( _inited ) return; - - _inited = true; - NVIC_SetPriority(USBD_IRQn, 2); // USB power may already be ready at this time -> no event generated diff --git a/src/usb/usb_desc.c b/src/usb/usb_desc.c index 630a369..4e5f5a3 100644 --- a/src/usb/usb_desc.c +++ b/src/usb/usb_desc.c @@ -59,19 +59,21 @@ enum { }; /*------------- Endpoint Numbering & Size -------------*/ -#define _EP_IN(x) (0x80 | (x)) -#define _EP_OUT(x) (x) +#define _EP_IN(x) (0x80 | (x)) +#define _EP_OUT(x) (x) // CDC -#define EP_CDC_NOTIF _EP_IN ( ITF_NUM_CDC+1 ) -#define EP_CDC_NOTIF_SIZE 8 +#define EP_CDC_NOTIF _EP_IN ( ITF_NUM_CDC+1 ) +#define EP_CDC_NOTIF_SIZE 8 -#define EP_CDC_OUT _EP_OUT( ITF_NUM_CDC+2 ) -#define EP_CDC_IN _EP_IN ( ITF_NUM_CDC+2 ) +#define EP_CDC_OUT _EP_OUT( ITF_NUM_CDC+2 ) +#define EP_CDC_IN _EP_IN ( ITF_NUM_CDC+2 ) // Mass Storage -#define EP_MSC_OUT _EP_OUT( ITF_NUM_MSC+1 ) -#define EP_MSC_IN _EP_IN ( ITF_NUM_MSC+1 ) +#define EP_MSC_OUT _EP_OUT( ITF_NUM_MSC+1 ) +#define EP_MSC_IN _EP_IN ( ITF_NUM_MSC+1 ) + +#define EP_MSC_SIZE 64 //--------------------------------------------------------------------+ // STRING DESCRIPTORS @@ -280,7 +282,7 @@ usb_desc_cfg_t usb_desc_cfg = .bDescriptorType = TUSB_DESC_ENDPOINT, .bEndpointAddress = EP_MSC_OUT, .bmAttributes = { .xfer = TUSB_XFER_BULK }, - .wMaxPacketSize = { .size = CFG_TUD_MSC_EPSIZE}, + .wMaxPacketSize = { .size = EP_MSC_SIZE}, .bInterval = 1 }, @@ -290,7 +292,7 @@ usb_desc_cfg_t usb_desc_cfg = .bDescriptorType = TUSB_DESC_ENDPOINT, .bEndpointAddress = EP_MSC_IN, .bmAttributes = { .xfer = TUSB_XFER_BULK }, - .wMaxPacketSize = { .size = CFG_TUD_MSC_EPSIZE}, + .wMaxPacketSize = { .size = EP_MSC_SIZE }, .bInterval = 1 } }