Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest TinyUSB + test_mode support #227

Merged
merged 11 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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
-----

Expand Down
29 changes: 15 additions & 14 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,21 @@ 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"
}
}
}
}
}
// TODO Disabled till https://xmosjira.atlassian.net/browse/AP-353 is fixed
//stage('Run RTOS Drivers WiFi test') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment to explain why these tests are disabled? I wonder if there is an issue, so we can mention it in the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// 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) {
Expand Down
3 changes: 3 additions & 0 deletions modules/drivers/usb/api/rtos_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions modules/drivers/usb/src/rtos_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions modules/sw_services/usb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
17 changes: 17 additions & 0 deletions modules/sw_services/usb/portable/dcd_xcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ static void dcd_xcore_int_handler(rtos_usb_t *ctx,
}
}


/*------------------------------------------------------------------*/
/* Device API
*------------------------------------------------------------------*/
Expand Down Expand Up @@ -541,3 +542,19 @@ 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;
}

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);
}
2 changes: 2 additions & 0 deletions modules/sw_services/usb/portable/tusb_nstackwords.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.global dcd_event_handler.nstackwords
.set dcd_event_handler.nstackwords, 100
18 changes: 16 additions & 2 deletions modules/sw_services/usb/portable/tusb_os_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion modules/sw_services/usb/thirdparty/tinyusb_src
Submodule tinyusb_src updated 161 files