Skip to content

Commit 8a6271b

Browse files
roma-jamespressif-bot
authored andcommitted
feat(test_ext_port): Added test cases for the external port driver testing
1 parent 4ea1fac commit 8a6271b

File tree

14 files changed

+1698
-0
lines changed

14 files changed

+1698
-0
lines changed

components/usb/test_apps/common/hcd_common.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ uint8_t test_hcd_enum_device(hcd_pipe_handle_t default_pipe)
313313
// Update address of default pipe
314314
TEST_ASSERT_EQUAL(ESP_OK, hcd_pipe_update_dev_addr(default_pipe, ENUM_ADDR));
315315

316+
// Some high-speed Hubs need some time before being able to process SetConfiguration request
317+
// Full-speed devices doesn't require that time
318+
vTaskDelay(pdMS_TO_TICKS(10));
319+
316320
// Send a set configuration request
317321
USB_SETUP_PACKET_INIT_SET_CONFIG(setup_pkt, ENUM_CONFIG);
318322
urb->transfer.num_bytes = sizeof(usb_setup_packet_t);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This is the project CMakeLists.txt file for the test subproject
2+
cmake_minimum_required(VERSION 3.16)
3+
4+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
5+
6+
set(EXTRA_COMPONENT_DIRS "../common")
7+
8+
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
9+
idf_build_set_property(MINIMAL_BUILD ON)
10+
11+
project(test_app_hub)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 |
2+
| ----------------- | -------- | -------- | -------- |
3+
4+
# USB: External Port test application
5+
6+
Testing the External Port Driver logic.
7+
8+
## Requirements
9+
10+
USB external Hub should be attached to the root port (USB OTG peripheral).
11+
12+
Ports could be configured via menuconfig.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
2+
# the component can be registered as WHOLE_ARCHIVE
3+
set(srcs)
4+
5+
list(APPEND srcs "test_app_main.c"
6+
"test_ext_port.c"
7+
# Internal common test files
8+
"hub_common.c"
9+
"ext_port_common.c"
10+
)
11+
12+
idf_component_register(SRCS ${srcs}
13+
INCLUDE_DIRS "."
14+
PRIV_INCLUDE_DIRS "."
15+
REQUIRES usb unity common
16+
WHOLE_ARCHIVE)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
source "$IDF_PATH/components/usb/test_apps/common/Kconfig.common"
2+
3+
menu "USB Host External Port test"
4+
5+
config USB_HOST_TEST_HUB_PORT_NUM_DEVICE_FSHS
6+
int "Port number with Full-/High-speed device"
7+
default 1
8+
help
9+
Configure the number of the port, with a Full-/High-speed USB device.
10+
11+
config USB_HOST_TEST_HUB_PORT_NUM_DEVICE_LS
12+
int "Port number with Low-speed device"
13+
default 2
14+
help
15+
Configure the number of the port, with a Low-speed USB device.
16+
17+
config USB_HOST_TEST_HUB_PORT_NUM_EMPTY
18+
int "Empty Port number"
19+
default 3
20+
help
21+
Configure the number of the port, without device.
22+
23+
endmenu

0 commit comments

Comments
 (0)