hcd/ehci: hcd_edpt_open() return false if ep is already opened. implement hcd_edpt_close()

This commit is contained in:
hathach
2025-03-26 21:13:01 +07:00
parent 1615120bca
commit 901ce2ad93
6 changed files with 284 additions and 273 deletions

View File

@@ -561,8 +561,7 @@ static void usbd_reset(uint8_t rhport) {
}
bool tud_task_event_ready(void) {
// Skip if stack is not initialized
if (!tud_inited()) return false;
TU_VERIFY(tud_inited()); // Skip if stack is not initialized
return !osal_queue_empty(_usbd_q);
}
@@ -684,7 +683,9 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr) {
case USBD_EVENT_FUNC_CALL:
TU_LOG_USBD("\r\n");
if (event.func_call.func) event.func_call.func(event.func_call.param);
if (event.func_call.func) {
event.func_call.func(event.func_call.param);
}
break;
case DCD_EVENT_SOF:
@@ -701,7 +702,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr) {
#if CFG_TUSB_OS != OPT_OS_NONE && CFG_TUSB_OS != OPT_OS_PICO
// return if there is no more events, for application to run other background
if (osal_queue_empty(_usbd_q)) return;
if (osal_queue_empty(_usbd_q)) { return; }
#endif
}
}