feat(class): add usb_osal_thread_schedule_other to allow the applications which use the struct usbh_xxx to exit properly before free struct usbh_xxx

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-06-03 17:31:31 +08:00
parent a8bf2687bd
commit bff8a632a9
25 changed files with 111 additions and 0 deletions

View File

@@ -25,6 +25,18 @@ void usb_osal_thread_delete(usb_osal_thread_t thread)
vTaskDelete(thread);
}
void usb_osal_thread_schedule_other(void)
{
TaskHandle_t xCurrentTask = xTaskGetCurrentTaskHandle();
const UBaseType_t old_priority = uxTaskPriorityGet(xCurrentTask);
vTaskPrioritySet(xCurrentTask, tskIDLE_PRIORITY);
taskYIELD();
vTaskPrioritySet(xCurrentTask, old_priority);
}
usb_osal_sem_t usb_osal_sem_create(uint32_t initial_count)
{
return (usb_osal_sem_t)xSemaphoreCreateCounting(1, initial_count);