update(core): change assert with USB_ASSERT_MSG

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-11-24 20:34:16 +08:00
parent 510b34aa3c
commit 47cc574730
2 changed files with 7 additions and 24 deletions

View File

@@ -1544,11 +1544,7 @@ int usbd_initialize(uint8_t busid, uintptr_t reg_base, void (*event_handler)(uin
int ret; int ret;
struct usbd_bus *bus; struct usbd_bus *bus;
if (busid >= CONFIG_USBDEV_MAX_BUS) { USB_ASSERT_MSG(busid < CONFIG_USBDEV_MAX_BUS, "bus overflow\r\n");
USB_LOG_ERR("bus overflow\r\n");
while (1) {
}
}
bus = &g_usbdev_bus[busid]; bus = &g_usbdev_bus[busid];
bus->reg_base = reg_base; bus->reg_base = reg_base;
@@ -1577,23 +1573,18 @@ int usbd_initialize(uint8_t busid, uintptr_t reg_base, void (*event_handler)(uin
int usbd_deinitialize(uint8_t busid) int usbd_deinitialize(uint8_t busid)
{ {
if (busid >= CONFIG_USBDEV_MAX_BUS) { USB_ASSERT_MSG(busid < CONFIG_USBDEV_MAX_BUS, "bus overflow\r\n");
USB_LOG_ERR("bus overflow\r\n");
while (1) {
}
}
g_usbd_core[busid].event_handler(busid, USBD_EVENT_DEINIT); g_usbd_core[busid].event_handler(busid, USBD_EVENT_DEINIT);
usbd_class_event_notify_handler(busid, USBD_EVENT_DEINIT, NULL); usbd_class_event_notify_handler(busid, USBD_EVENT_DEINIT, NULL);
usb_dc_deinit(busid); usb_dc_deinit(busid);
g_usbd_core[busid].intf_offset = 0;
#ifdef CONFIG_USBDEV_EP0_THREAD #ifdef CONFIG_USBDEV_EP0_THREAD
if (g_usbd_core[busid].usbd_ep0_mq) {
usb_osal_mq_delete(g_usbd_core[busid].usbd_ep0_mq);
}
if (g_usbd_core[busid].usbd_ep0_thread) { if (g_usbd_core[busid].usbd_ep0_thread) {
usb_osal_thread_delete(g_usbd_core[busid].usbd_ep0_thread); usb_osal_thread_delete(g_usbd_core[busid].usbd_ep0_thread);
} }
if (g_usbd_core[busid].usbd_ep0_mq) {
usb_osal_mq_delete(g_usbd_core[busid].usbd_ep0_mq);
}
#endif #endif
return 0; return 0;

View File

@@ -628,11 +628,7 @@ int usbh_initialize(uint8_t busid, uintptr_t reg_base, usbh_event_handler_t even
{ {
struct usbh_bus *bus; struct usbh_bus *bus;
if (busid >= CONFIG_USBHOST_MAX_BUS) { USB_ASSERT_MSG(busid < CONFIG_USBHOST_MAX_BUS, "bus overflow\r\n");
USB_LOG_ERR("bus overflow\r\n");
while (1) {
}
}
bus = &g_usbhost_bus[busid]; bus = &g_usbhost_bus[busid];
@@ -666,11 +662,7 @@ int usbh_deinitialize(uint8_t busid)
{ {
struct usbh_bus *bus; struct usbh_bus *bus;
if (busid >= CONFIG_USBHOST_MAX_BUS) { USB_ASSERT_MSG(busid < CONFIG_USBHOST_MAX_BUS, "bus overflow\r\n");
USB_LOG_ERR("bus overflow\r\n");
while (1) {
}
}
bus = &g_usbhost_bus[busid]; bus = &g_usbhost_bus[busid];