From 8e6e3dd699279f7883f457781653dcc4880e2446 Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Fri, 12 Jan 2024 13:12:13 +0000 Subject: [PATCH 1/7] Update TinyUSB to head of main --- modules/sw_services/usb/CMakeLists.txt | 1 + modules/sw_services/usb/portable/dcd_xcore.c | 7 +++++++ .../sw_services/usb/portable/tusb_os_custom.h | 18 ++++++++++++++++-- modules/sw_services/usb/thirdparty/tinyusb_src | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/modules/sw_services/usb/CMakeLists.txt b/modules/sw_services/usb/CMakeLists.txt index 26c0be9a7..5cac29f4b 100644 --- a/modules/sw_services/usb/CMakeLists.txt +++ b/modules/sw_services/usb/CMakeLists.txt @@ -10,6 +10,7 @@ if((${CMAKE_SYSTEM_NAME} STREQUAL XCORE_XS3A) OR (${CMAKE_SYSTEM_NAME} STREQUAL target_sources(framework_rtos_sw_services_usb INTERFACE portable/dcd_xcore.c + portable/tusb_nstackwords.S FreeRTOS/usb_support.c ${TUSB_ROOT_SOURCES} ${TUSB_CLASS_SOURCES} diff --git a/modules/sw_services/usb/portable/dcd_xcore.c b/modules/sw_services/usb/portable/dcd_xcore.c index ab46bbac4..293da031b 100644 --- a/modules/sw_services/usb/portable/dcd_xcore.c +++ b/modules/sw_services/usb/portable/dcd_xcore.c @@ -218,6 +218,7 @@ static void dcd_xcore_int_handler(rtos_usb_t *ctx, } } + /*------------------------------------------------------------------*/ /* Device API *------------------------------------------------------------------*/ @@ -541,3 +542,9 @@ void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr) rtos_printf("STALL EP %02x: Clear\n", ep_addr); rtos_usb_endpoint_stall_clear(&usb_ctx, ep_addr); } + +void dcd_sof_enable(uint8_t rhport, bool en) +{ + (void) rhport; + (void) en; +} diff --git a/modules/sw_services/usb/portable/tusb_os_custom.h b/modules/sw_services/usb/portable/tusb_os_custom.h index 3223f86a4..170baa29f 100644 --- a/modules/sw_services/usb/portable/tusb_os_custom.h +++ b/modules/sw_services/usb/portable/tusb_os_custom.h @@ -126,9 +126,23 @@ static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) return xQueueCreate(qdef->depth, qdef->item_sz); } -static inline bool osal_queue_receive(osal_queue_t qhdl, void* data) +static inline bool osal_queue_receive(osal_queue_t qhdl, void* data, uint32_t msec) { - return xQueueReceive(qhdl, data, portMAX_DELAY); + uint32_t ticks = 0; + if ( msec == OSAL_TIMEOUT_WAIT_FOREVER ) + { + ticks = portMAX_DELAY; + } + else if( msec == 0 ) + { + ticks = 0; + } + else + { + ticks = pdMS_TO_TICKS(msec); + } + + return xQueueReceive(qhdl, data, ticks); } static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr) diff --git a/modules/sw_services/usb/thirdparty/tinyusb_src b/modules/sw_services/usb/thirdparty/tinyusb_src index 20fac3203..d86ce4789 160000 --- a/modules/sw_services/usb/thirdparty/tinyusb_src +++ b/modules/sw_services/usb/thirdparty/tinyusb_src @@ -1 +1 @@ -Subproject commit 20fac3203e252fcbbcbc06ab1d6f1aca5ad47aad +Subproject commit d86ce478998dc71e6fd3ea32d1e94d58ca3e4fa5 From 55998cd4ba5bc7737705f87a9a02af3d88adb816 Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Fri, 12 Jan 2024 13:31:29 +0000 Subject: [PATCH 2/7] Add missing file --- modules/sw_services/usb/portable/tusb_nstackwords.S | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 modules/sw_services/usb/portable/tusb_nstackwords.S diff --git a/modules/sw_services/usb/portable/tusb_nstackwords.S b/modules/sw_services/usb/portable/tusb_nstackwords.S new file mode 100644 index 000000000..b575d4ef5 --- /dev/null +++ b/modules/sw_services/usb/portable/tusb_nstackwords.S @@ -0,0 +1,2 @@ +.global dcd_event_handler.nstackwords +.set dcd_event_handler.nstackwords, 100 From 346f84bbc36068c4f1ada8a11cf769df53451731 Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Fri, 12 Jan 2024 14:58:08 +0000 Subject: [PATCH 3/7] Disabled WIFI test --- Jenkinsfile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6334cce6b..3e2e8d060 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -106,20 +106,20 @@ pipeline { sh "rm -f ~/.xtag/status.lock ~/.xtag/acquired" } } - stage('Run RTOS Drivers WiFi test') { - steps { - withTools(params.TOOLS_VERSION) { - withVenv { - script { - withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs -> - sh "test/rtos_drivers/wifi/check_wifi.sh " + adapterIDs[0] - } - sh "pytest test/rtos_drivers/wifi" - } - } - } - } - } + //stage('Run RTOS Drivers WiFi test') { + // steps { + // withTools(params.TOOLS_VERSION) { + // withVenv { + // script { + // withXTAG(["$RTOS_TEST_RIG_TARGET"]) { adapterIDs -> + // sh "test/rtos_drivers/wifi/check_wifi.sh " + adapterIDs[0] + // } + // sh "pytest test/rtos_drivers/wifi" + // } + // } + // } + // } + //} stage('Run RTOS Drivers HIL test') { steps { withTools(params.TOOLS_VERSION) { From 08dd360817391498b14ce6469f519b7049d81e2a Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Tue, 16 Jan 2024 16:15:38 +0000 Subject: [PATCH 4/7] Add test mode support --- modules/drivers/usb/api/rtos_usb.h | 3 +++ modules/drivers/usb/src/rtos_usb.c | 6 ++++++ modules/sw_services/usb/portable/dcd_xcore.c | 10 ++++++++++ modules/sw_services/usb/thirdparty/tinyusb_src | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/drivers/usb/api/rtos_usb.h b/modules/drivers/usb/api/rtos_usb.h index b6ecfe172..6be81d3c6 100644 --- a/modules/drivers/usb/api/rtos_usb.h +++ b/modules/drivers/usb/api/rtos_usb.h @@ -250,6 +250,9 @@ static inline void rtos_usb_endpoint_stall_clear(rtos_usb_t *ctx, XUD_ClearStallByAddr(endpoint_addr); } +void rtos_usb_enter_test_mode(rtos_usb_t *ctx, + unsigned test_mode); + /** * Starts the USB driver instance's low level USB I/O thread and enables its interrupts * on the requested core. This must only be called by the tile that owns the driver instance. diff --git a/modules/drivers/usb/src/rtos_usb.c b/modules/drivers/usb/src/rtos_usb.c index d2d4bb4f3..2807a89c5 100644 --- a/modules/drivers/usb/src/rtos_usb.c +++ b/modules/drivers/usb/src/rtos_usb.c @@ -243,6 +243,12 @@ XUD_BusSpeed_t rtos_usb_endpoint_reset(rtos_usb_t *ctx, return XUD_ResetEndpoint(one, two); } +void rtos_usb_enter_test_mode(rtos_usb_t *ctx, + unsigned test_mode) +{ + XUD_SetTestMode(ctx->ep[0][RTOS_USB_OUT_EP], test_mode); +} + static void ep_cfg(rtos_usb_t *ctx, int ep_num, int direction) diff --git a/modules/sw_services/usb/portable/dcd_xcore.c b/modules/sw_services/usb/portable/dcd_xcore.c index 293da031b..44e54d946 100644 --- a/modules/sw_services/usb/portable/dcd_xcore.c +++ b/modules/sw_services/usb/portable/dcd_xcore.c @@ -548,3 +548,13 @@ void dcd_sof_enable(uint8_t rhport, bool en) (void) rhport; (void) en; } + +bool dcd_check_test_mode_support(test_mode_t test_selector) +{ + return true; +} + +void dcd_enter_test_mode(uint8_t rhport, test_mode_t test_selector) +{ + rtos_usb_enter_test_mode(&usb_ctx, ((unsigned)test_selector) << 8); +} diff --git a/modules/sw_services/usb/thirdparty/tinyusb_src b/modules/sw_services/usb/thirdparty/tinyusb_src index d86ce4789..cb01a8f3c 160000 --- a/modules/sw_services/usb/thirdparty/tinyusb_src +++ b/modules/sw_services/usb/thirdparty/tinyusb_src @@ -1 +1 @@ -Subproject commit d86ce478998dc71e6fd3ea32d1e94d58ca3e4fa5 +Subproject commit cb01a8f3c4fbd0adec5e6be8368ca3e2d5282194 From 90d86aac028bd3f7b4b06e676fadadd8e19698e5 Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Wed, 17 Jan 2024 09:45:13 +0000 Subject: [PATCH 5/7] test mode support --- modules/sw_services/usb/thirdparty/tinyusb_src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sw_services/usb/thirdparty/tinyusb_src b/modules/sw_services/usb/thirdparty/tinyusb_src index cb01a8f3c..c2a61c46e 160000 --- a/modules/sw_services/usb/thirdparty/tinyusb_src +++ b/modules/sw_services/usb/thirdparty/tinyusb_src @@ -1 +1 @@ -Subproject commit cb01a8f3c4fbd0adec5e6be8368ca3e2d5282194 +Subproject commit c2a61c46eb0801963f6d8de5e8d277bdecd3c1a7 From 02722f99e07b622a192c8cfb634f2e01da1f7d4a Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Mon, 22 Jan 2024 16:32:04 +0000 Subject: [PATCH 6/7] Changelog --- CHANGELOG.rst | 6 ++++++ modules/sw_services/usb/thirdparty/tinyusb_src | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a58be9640..e6b17a93c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ RTOS Framework change log ========================= +3.1.0 +----- + + * UPDATED: To latest tinyusb_src + * ADDED: Support for transitioning to USB test mode in tinyusb_src + 3.0.5 ----- diff --git a/modules/sw_services/usb/thirdparty/tinyusb_src b/modules/sw_services/usb/thirdparty/tinyusb_src index c2a61c46e..5bda8e876 160000 --- a/modules/sw_services/usb/thirdparty/tinyusb_src +++ b/modules/sw_services/usb/thirdparty/tinyusb_src @@ -1 +1 @@ -Subproject commit c2a61c46eb0801963f6d8de5e8d277bdecd3c1a7 +Subproject commit 5bda8e876293ab281caedd34d0deeb62cca71d17 From 1dbab007a0fc9ac64fca54e9412636b13ecea68b Mon Sep 17 00:00:00 2001 From: Shuchita Khare Date: Tue, 23 Jan 2024 14:20:22 +0000 Subject: [PATCH 7/7] Add comment to Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3e2e8d060..ae6ec84e6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -106,6 +106,7 @@ pipeline { sh "rm -f ~/.xtag/status.lock ~/.xtag/acquired" } } + // TODO Disabled till https://xmosjira.atlassian.net/browse/AP-353 is fixed //stage('Run RTOS Drivers WiFi test') { // steps { // withTools(params.TOOLS_VERSION) {