mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(usb/host): Enable USB Host tests on P4
This commit is contained in:
parent
3857f779cc
commit
19bf686d5e
@ -62,7 +62,7 @@
|
|||||||
// FS: Must be 2-64. HS: Must be 8-256. See USB-OTG databook Table 5-47
|
// FS: Must be 2-64. HS: Must be 8-256. See USB-OTG databook Table 5-47
|
||||||
#define XFER_LIST_LEN_INTR FRAME_LIST_LEN
|
#define XFER_LIST_LEN_INTR FRAME_LIST_LEN
|
||||||
#define XFER_LIST_LEN_ISOC 64 // Implement longer ISOC transfer list to give us enough space for additional timing margin
|
#define XFER_LIST_LEN_ISOC 64 // Implement longer ISOC transfer list to give us enough space for additional timing margin
|
||||||
#define XFER_LIST_ISOC_MARGIN 2 // The 1st ISOC transfer is scheduled 2 (micro)frames later so we have enough timing margin
|
#define XFER_LIST_ISOC_MARGIN 3 // The 1st ISOC transfer is scheduled 3 (micro)frames later so we have enough timing margin
|
||||||
|
|
||||||
// ------------------------ Flags --------------------------
|
// ------------------------ Flags --------------------------
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ Procedure:
|
|||||||
#define TEST_NUM_SECTORS_TOTAL 10
|
#define TEST_NUM_SECTORS_TOTAL 10
|
||||||
#define TEST_NUM_SECTORS_PER_XFER 2
|
#define TEST_NUM_SECTORS_PER_XFER 2
|
||||||
|
|
||||||
TEST_CASE("Test HCD bulk pipe URBs", "[bulk][full_speed]")
|
TEST_CASE("Test HCD bulk pipe URBs", "[bulk][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -33,7 +33,7 @@ Procedure:
|
|||||||
- Expect URB to be USB_TRANSFER_STATUS_CANCELED or USB_TRANSFER_STATUS_COMPLETED
|
- Expect URB to be USB_TRANSFER_STATUS_CANCELED or USB_TRANSFER_STATUS_COMPLETED
|
||||||
- Teardown
|
- Teardown
|
||||||
*/
|
*/
|
||||||
TEST_CASE("Test HCD control pipe URBs", "[ctrl][low_speed][full_speed]")
|
TEST_CASE("Test HCD control pipe URBs", "[ctrl][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||||
@ -110,7 +110,7 @@ TEST_CASE("Test HCD control pipe URBs", "[ctrl][low_speed][full_speed]")
|
|||||||
/*
|
/*
|
||||||
Test HCD control pipe STALL condition, abort, and clear
|
Test HCD control pipe STALL condition, abort, and clear
|
||||||
|
|
||||||
@todo this test is not passing with low-speed: test with bus analyzer
|
@todo this test is not passing with low-speed: test with bus analyzer IDF-10995
|
||||||
|
|
||||||
Purpose:
|
Purpose:
|
||||||
- Test that a control pipe can react to a STALL (i.e., a HCD_PIPE_EVENT_ERROR_STALL event)
|
- Test that a control pipe can react to a STALL (i.e., a HCD_PIPE_EVENT_ERROR_STALL event)
|
||||||
@ -128,7 +128,7 @@ Procedure:
|
|||||||
- Dequeue URBs
|
- Dequeue URBs
|
||||||
- Teardown
|
- Teardown
|
||||||
*/
|
*/
|
||||||
TEST_CASE("Test HCD control pipe STALL", "[ctrl][full_speed]")
|
TEST_CASE("Test HCD control pipe STALL", "[ctrl][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||||
@ -217,6 +217,8 @@ TEST_CASE("Test HCD control pipe STALL", "[ctrl][full_speed]")
|
|||||||
/*
|
/*
|
||||||
Test control pipe run-time halt and clear
|
Test control pipe run-time halt and clear
|
||||||
|
|
||||||
|
@todo this test is not passing on P4: test with bus analyzer IDF-10996
|
||||||
|
|
||||||
Purpose:
|
Purpose:
|
||||||
- Test that a control pipe can be halted with HCD_PIPE_CMD_HALT whilst there are ongoing URBs
|
- Test that a control pipe can be halted with HCD_PIPE_CMD_HALT whilst there are ongoing URBs
|
||||||
- Test that a control pipe can be un-halted with a HCD_PIPE_CMD_CLEAR
|
- Test that a control pipe can be un-halted with a HCD_PIPE_CMD_CLEAR
|
||||||
|
@ -39,7 +39,7 @@ Procedure:
|
|||||||
- Teardown
|
- Teardown
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TEST_CASE("Test HCD isochronous pipe URBs", "[isoc][full_speed]")
|
TEST_CASE("Test HCD isochronous pipe URBs", "[isoc][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
// The MPS of the ISOC OUT pipe is quite large, so we need to bias the FIFO sizing
|
// The MPS of the ISOC OUT pipe is quite large, so we need to bias the FIFO sizing
|
||||||
@ -114,7 +114,7 @@ Procedure:
|
|||||||
- Deallocate URBs
|
- Deallocate URBs
|
||||||
- Teardown
|
- Teardown
|
||||||
*/
|
*/
|
||||||
TEST_CASE("Test HCD isochronous pipe URBs all", "[isoc][full_speed]")
|
TEST_CASE("Test HCD isochronous pipe URBs all", "[isoc][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
// The MPS of the ISOC OUT pipe is quite large, so we need to bias the FIFO sizing
|
// The MPS of the ISOC OUT pipe is quite large, so we need to bias the FIFO sizing
|
||||||
@ -163,7 +163,7 @@ TEST_CASE("Test HCD isochronous pipe URBs all", "[isoc][full_speed]")
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a delay so we start scheduling the transactions at different time in USB frame
|
// Add a delay so we start scheduling the transactions at different time in USB frame
|
||||||
esp_rom_delay_us(ENQUEUE_DELAY * interval + ENQUEUE_DELAY * channel);
|
esp_rom_delay_us(ENQUEUE_DELAY * (interval - 1) + ENQUEUE_DELAY * channel);
|
||||||
|
|
||||||
// Enqueue URBs
|
// Enqueue URBs
|
||||||
for (int i = 0; i < NUM_URBS; i++) {
|
for (int i = 0; i < NUM_URBS; i++) {
|
||||||
@ -226,7 +226,7 @@ Procedure:
|
|||||||
- Free both pipes
|
- Free both pipes
|
||||||
- Teardown
|
- Teardown
|
||||||
*/
|
*/
|
||||||
TEST_CASE("Test HCD isochronous pipe sudden disconnect", "[isoc][full_speed]")
|
TEST_CASE("Test HCD isochronous pipe sudden disconnect", "[isoc][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
// The MPS of the ISOC OUT pipe is quite large, so we need to bias the FIFO sizing
|
// The MPS of the ISOC OUT pipe is quite large, so we need to bias the FIFO sizing
|
||||||
|
@ -30,7 +30,7 @@ Procedure:
|
|||||||
- Trigger the port disconnection event
|
- Trigger the port disconnection event
|
||||||
- Teardown port and HCD
|
- Teardown port and HCD
|
||||||
*/
|
*/
|
||||||
TEST_CASE("Test HCD port disconnect event, port enabled", "[port][low_speed][full_speed]")
|
TEST_CASE("Test HCD port disconnect event, port enabled", "[port][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
printf("Connected %s speed device \n", (char*[]) {
|
printf("Connected %s speed device \n", (char*[]) {
|
||||||
@ -63,7 +63,7 @@ Procedure:
|
|||||||
- Teardown port and HCD
|
- Teardown port and HCD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TEST_CASE("Test HCD port sudden disconnect", "[port][low_speed][full_speed]")
|
TEST_CASE("Test HCD port sudden disconnect", "[port][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||||
@ -153,7 +153,7 @@ Procedure:
|
|||||||
- Cleanup default pipe
|
- Cleanup default pipe
|
||||||
- Trigger disconnection and teardown
|
- Trigger disconnection and teardown
|
||||||
*/
|
*/
|
||||||
TEST_CASE("Test HCD port suspend and resume", "[port][low_speed][full_speed]")
|
TEST_CASE("Test HCD port suspend and resume", "[port][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||||
@ -207,7 +207,7 @@ Procedure:
|
|||||||
- Check that a disconnection still works after disable
|
- Check that a disconnection still works after disable
|
||||||
- Teardown
|
- Teardown
|
||||||
*/
|
*/
|
||||||
TEST_CASE("Test HCD port disable", "[port][low_speed][full_speed]")
|
TEST_CASE("Test HCD port disable", "[port][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
usb_speed_t port_speed = test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||||
@ -295,7 +295,7 @@ static void concurrent_task(void *arg)
|
|||||||
vTaskDelay(portMAX_DELAY); // Block forever and wait to be deleted
|
vTaskDelay(portMAX_DELAY); // Block forever and wait to be deleted
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Test HCD port command bailout", "[port][low_speed][full_speed]")
|
TEST_CASE("Test HCD port command bailout", "[port][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
test_hcd_wait_for_conn(port_hdl); // Trigger a connection
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
vTaskDelay(pdMS_TO_TICKS(100)); // Short delay send of SOF (for FS) or EOPs (for LS)
|
||||||
|
@ -181,7 +181,7 @@ static void test_async_client_cb(const usb_host_client_event_msg_t *event_msg, v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Test USB Host async API", "[usb_host][full_speed][low_speed]")
|
TEST_CASE("Test USB Host async API", "[usb_host][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
// Register two clients
|
// Register two clients
|
||||||
client_test_stage_t client0_stage = CLIENT_TEST_STAGE_NONE;
|
client_test_stage_t client0_stage = CLIENT_TEST_STAGE_NONE;
|
||||||
|
@ -33,7 +33,7 @@ Procedure:
|
|||||||
|
|
||||||
#define TEST_DCONN_NO_CLIENT_ITERATIONS 3
|
#define TEST_DCONN_NO_CLIENT_ITERATIONS 3
|
||||||
|
|
||||||
TEST_CASE("Test USB Host sudden disconnection (no client)", "[usb_host][full_speed][low_speed]")
|
TEST_CASE("Test USB Host sudden disconnection (no client)", "[usb_host][low_speed][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
int dconn_iter = 0;
|
int dconn_iter = 0;
|
||||||
@ -83,7 +83,7 @@ Procedure:
|
|||||||
#define TEST_FORCE_DCONN_NUM_TRANSFERS 3
|
#define TEST_FORCE_DCONN_NUM_TRANSFERS 3
|
||||||
#define TEST_MSC_SCSI_TAG 0xDEADBEEF
|
#define TEST_MSC_SCSI_TAG 0xDEADBEEF
|
||||||
|
|
||||||
TEST_CASE("Test USB Host sudden disconnection (single client)", "[usb_host][full_speed]")
|
TEST_CASE("Test USB Host sudden disconnection (single client)", "[usb_host][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
// Create task to run client that communicates with MSC SCSI interface
|
// Create task to run client that communicates with MSC SCSI interface
|
||||||
const dev_msc_info_t *dev_info = dev_msc_get_info();
|
const dev_msc_info_t *dev_info = dev_msc_get_info();
|
||||||
@ -132,7 +132,7 @@ Procedure:
|
|||||||
|
|
||||||
#define TEST_ENUM_ITERATIONS 3
|
#define TEST_ENUM_ITERATIONS 3
|
||||||
|
|
||||||
TEST_CASE("Test USB Host enumeration", "[usb_host][full_speed]")
|
TEST_CASE("Test USB Host enumeration", "[usb_host][full_speed][high_speed]")
|
||||||
{
|
{
|
||||||
// Create task to run client that checks the enumeration of the device
|
// Create task to run client that checks the enumeration of the device
|
||||||
TaskHandle_t task_hdl;
|
TaskHandle_t task_hdl;
|
||||||
|
Loading…
Reference in New Issue
Block a user