diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/class/hub/usbh_hub.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/class/hub/usbh_hub.c index c948ac3db..b3edd9419 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/class/hub/usbh_hub.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/class/hub/usbh_hub.c @@ -43,6 +43,7 @@ extern int usbh_enumerate(struct usbh_hubport *hport); static void usbh_hub_thread_wakeup(struct usbh_hub *hub); static const char *speed_table[] = { "error-speed", "low-speed", "full-speed", "high-speed", "wireless-speed", "super-speed", "superplus-speed" }; +struct usbh_bus *g_usb_debug; struct usbh_hubport *usbh_get_roothub_port (struct usbh_bus *bus, unsigned int address) { @@ -689,6 +690,8 @@ static void usbh_hub_thread(void *argument) int ret = 0; struct usbh_bus *usb = (struct usbh_bus *)argument; + USB_LOG_DBG("usbh_hub_thread usb pointer=%08x\r\n", usb); + usb = g_usb_debug; USB_LOG_DBG("usbh_hub_thread usb pointer=%08x\r\n", usb); usb_hc_init(usb->id); while (1) { @@ -763,7 +766,7 @@ int usbh_hub_initialize(struct usbh_bus *usb) if (usb->hub_mq == NULL) { return -1; } - + g_usb_debug = usb; USB_LOG_DBG("usbh_hub_initialize usb pointer=%08x\r\n", usb); char thread_name[12]; snprintf(thread_name, 12, "usb%d_hub", usb->id); @@ -771,6 +774,9 @@ int usbh_hub_initialize(struct usbh_bus *usb) if (usb->hub_thread == NULL) { return -1; } +#if 1 + usb_osal_msleep(10); //Avoid log character confusion after usb_osal_thread_create +#endif return 0; } diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c index 537472983..53ecae633 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/usb_hc_xhci.c @@ -52,6 +52,7 @@ Modification: Modify USB Device Initialization in xHCI code to apply to XiZi AIO /************************** Constant Definitions *****************************/ /************************** Variable Definitions *****************************/ +struct xhci_host *g_xhci_debug; /***************** Macros (Inline Functions) Definitions *********************/ @@ -1068,8 +1069,10 @@ int IPC_DO_SERVE_FUNC(Ipc_xhci_intr)(void* ignore) { printf("TEST_SW_HDLR: In %s()\n", __func__); intptr_t id; + struct xhci_host *xhci = g_xhci_debug; - id = 0; + id = xhci->bus->id; + USB_LOG_DBG("Ipc_xhci_intr id=%d\n", id); XHCI_USBH_IRQHandler((void *)id); return 0; @@ -1083,6 +1086,8 @@ int bind_xhci_intr(void *para){ int irq_no = USB3_0_INTERRUPT_NO; struct xhci_host *xhci = (struct xhci_host *)para; + USB_LOG_DBG("bind_xhci_intr xhci pointer=%08x\n", xhci); + xhci = g_xhci_debug; USB_LOG_DBG("bind_xhci_intr xhci pointer=%08x\n", xhci); if (USB3_0_ID == xhci->bus->id) { irq_no = USB3_0_INTERRUPT_NO; @@ -1111,7 +1116,7 @@ int bind_xhci_intr(void *para){ int create_xhci_intr_service(void *para){ struct xhci_host *xhci; int tid; - + char *task_param[] = { para, NULL }; xhci = (struct xhci_host *)para; @@ -1119,8 +1124,9 @@ int create_xhci_intr_service(void *para){ return -1; } + g_xhci_debug = xhci; USB_LOG_DBG("create_xhci_intr_service xhci pointer=%08x\n", xhci); - tid = thread(bind_xhci_intr, "xhci_intr_procedure", para); + tid = thread(bind_xhci_intr, "xhci_intr_procedure", task_param); /* Create thread error! */ if(tid < 0){ @@ -1130,7 +1136,9 @@ int create_xhci_intr_service(void *para){ }else{ /* Child thread. do nothing except for the interrupt processing function. */ } - +#if 1 + usb_osal_msleep(10); //Avoid log character confusion after usb_osal_thread_create +#endif return 0; }