refactor(ext_hub): Device release (allows to run usb_host test with ext hub)

754d357f refactor(ext_hub): Fixed device release, optimized the order of closing usbh device
fc61875a refactor(ext_hub): Pospone the device release, if device is not IDLE
3fd17b8b refactor(hub): Applied new ext_hub api, refactor func names
3003362b refactor(usb_host): Cancel hub porpagation to the user, rename non-critical func
19ce9ed6 refactor(test_usb_host_async): Added host_lib_task finish notification
f238d75b refactor(ext_port): Remove the error verification, as error will be handled in ext hub driver

Co-authored-by: Roman Leonov <roman.leonov@espressif.com>
This commit is contained in:
Roman Leonov
2025-06-02 11:44:22 +02:00
parent 28980b62c9
commit 628d7ad77d
7 changed files with 113 additions and 146 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -297,6 +297,7 @@ Procedure:
*/
static void host_lib_task(void *arg)
{
TaskHandle_t pending_task = (TaskHandle_t)arg;
while (1) {
// Start handling system events
uint32_t event_flags;
@@ -306,10 +307,12 @@ static void host_lib_task(void *arg)
TEST_ASSERT_EQUAL(ESP_ERR_NOT_FINISHED, usb_host_device_free_all());
}
if (event_flags & USB_HOST_LIB_EVENT_FLAGS_ALL_FREE) {
printf("All devices freed\n");
break;
}
}
// Notify the main task that the host library task is done
xTaskNotifyGive(pending_task);
printf("Deleting host_lib_task\n");
vTaskDelete(NULL);
}
@@ -330,13 +333,16 @@ TEST_CASE("Test USB Host multiconfig client (single client)", "[usb_host][full_s
xTaskNotifyGive(client_task);
TaskHandle_t host_lib_task_hdl;
xTaskCreatePinnedToCore(host_lib_task, "host lib", 4096, NULL, 2, &host_lib_task_hdl, 0);
// Get Current task handle
TaskHandle_t pending_task = xTaskGetCurrentTaskHandle();
xTaskCreatePinnedToCore(host_lib_task, "host lib", 4096, (void*)pending_task, 2, &host_lib_task_hdl, 0);
TEST_ASSERT_NOT_NULL_MESSAGE(host_lib_task_hdl, "Failed to create host lib task");
// Wait for the device to be open
xSemaphoreTake(dev_open_smp, portMAX_DELAY);
multiconf_client_get_conf_desc();
// Wait for the host library task to finish
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
// Cleanup
vSemaphoreDelete(dev_open_smp);
}