From 0825cbc68a6dfd2ce892ba578f76169da80e1ec4 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Mon, 14 Feb 2022 22:38:50 +0800 Subject: [PATCH] wakeup sem for all error transfer channel --- port/synopsys/usb_hc_synopsys.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/port/synopsys/usb_hc_synopsys.c b/port/synopsys/usb_hc_synopsys.c index c0a9e248..3a76ff30 100644 --- a/port/synopsys/usb_hc_synopsys.c +++ b/port/synopsys/usb_hc_synopsys.c @@ -832,18 +832,18 @@ void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd) g_usbhost.connected = false; usb_synopsys_chan_freeall(&g_usbhost); - if (g_usbhost.chan[0].waiter) { - /* Wake'em up! */ - g_usbhost.chan[0].waiter = false; - usb_osal_sem_give(g_usbhost.chan[0].waitsem); + for (uint8_t chnum = 0; chnum < CONFIG_USBHOST_CHANNELS; chnum++) { + { + if (g_usbhost.chan[chnum].waiter) { + /* Wake'em up! */ + g_usbhost.chan[chnum].waiter = false; + usb_osal_sem_give(g_usbhost.chan[chnum].waitsem); + } + } + + extern void usbh_event_notify_handler(uint8_t event, uint8_t rhport); + usbh_event_notify_handler(USBH_EVENT_REMOVED, 1); } - if (g_usbhost.chan[1].waiter) { - /* Wake'em up! */ - g_usbhost.chan[1].waiter = false; - usb_osal_sem_give(g_usbhost.chan[1].waitsem); - } - extern void usbh_event_notify_handler(uint8_t event, uint8_t rhport); - usbh_event_notify_handler(USBH_EVENT_REMOVED, 1); } }