diff options
| author | sakumisu <[email protected]> | 2026-04-03 18:45:51 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2026-04-03 18:45:51 +0800 |
| commit | 3d97aeebdef5d8a8ec3907d3f4f44816d49cd76e (patch) | |
| tree | 7938d3b35d8e8e4abf8320f151e1b3452030be5b /core/usbd_core.c | |
| parent | 03c6bfed39a4dbdb0b342172b5ece6d9435c4b5b (diff) | |
fix(core): adjust init&deinit event callback position
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'core/usbd_core.c')
| -rw-r--r-- | core/usbd_core.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/usbd_core.c b/core/usbd_core.c index bdbcfd07..a9ad67c4 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -1364,9 +1364,9 @@ int usbd_initialize(uint8_t busid, uintptr_t reg_base, void (*event_handler)(uin #endif g_usbd_core[busid].event_handler = event_handler; - ret = usb_dc_init(busid); usbd_class_event_notify_handler(busid, USBD_EVENT_INIT, NULL); g_usbd_core[busid].event_handler(busid, USBD_EVENT_INIT); + ret = usb_dc_init(busid); return ret; } @@ -1374,8 +1374,6 @@ int usbd_deinitialize(uint8_t busid) { USB_ASSERT_MSG(busid < CONFIG_USBDEV_MAX_BUS, "bus overflow\r\n"); - g_usbd_core[busid].event_handler(busid, USBD_EVENT_DEINIT); - usbd_class_event_notify_handler(busid, USBD_EVENT_DEINIT, NULL); usb_dc_deinit(busid); #ifdef CONFIG_USBDEV_EP0_THREAD if (g_usbd_core[busid].usbd_ep0_thread) { @@ -1385,6 +1383,7 @@ int usbd_deinitialize(uint8_t busid) usb_osal_mq_delete(g_usbd_core[busid].usbd_ep0_mq); } #endif - + g_usbd_core[busid].event_handler(busid, USBD_EVENT_DEINIT); + usbd_class_event_notify_handler(busid, USBD_EVENT_DEINIT, NULL); return 0; } |
