mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
refactor(ext_hub): Device release (allows to run usb_host test with ext hub)
754d357frefactor(ext_hub): Fixed device release, optimized the order of closing usbh devicefc61875arefactor(ext_hub): Pospone the device release, if device is not IDLE3fd17b8brefactor(hub): Applied new ext_hub api, refactor func names3003362brefactor(usb_host): Cancel hub porpagation to the user, rename non-critical func19ce9ed6refactor(test_usb_host_async): Added host_lib_task finish notificationf238d75brefactor(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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user