Fixed a bug in using usb_osal_mq_recv

This commit is contained in:
songyanguang 2024-08-30 10:20:35 +08:00
parent 137247d918
commit ab8ba67a83
2 changed files with 6 additions and 4 deletions

View File

@ -689,11 +689,12 @@ 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_hc_init(usb->id);
while (1) {
USB_LOG_DBG("wait event of mq@%p \r\n", usb->hub_mq);
ret = usb_osal_mq_recv(usb->hub_mq, (void *)&hub, 0xffffffff);
if (ret < 0) {
ret = usb_osal_mq_recv(usb->hub_mq, (void *)&hub, 0x7fffffff);
if (ret <= 0) {
continue;
}
USB_LOG_DBG("handle event of hub@%p \r\n", hub);
@ -763,6 +764,7 @@ int usbh_hub_initialize(struct usbh_bus *usb)
return -1;
}
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);
usb->hub_thread = usb_osal_thread_create(thread_name, CONFIG_USBHOST_PSC_STACKSIZE, CONFIG_USBHOST_PSC_PRIO, usbh_hub_thread, usb);

View File

@ -99,9 +99,9 @@ static void usb_check_phymode(int id)
}
pipe_phymode = readl ( base_vir + PIPE_PHY_GRF_PIPE_CON0 );
USB_LOG_DBG("usbh_initialize PIPE_PHY_GRF_PIPE_CON0=%08X\n", pipe_phymode);
USB_LOG_DBG("usb_check_phy PIPE_PHY_GRF_PIPE_CON0=%08X\n", pipe_phymode);
if ( (pipe_phymode & 0x000C) != 0x0004) {
USB_LOG_ERR("usbh_initialize PIPE_PHY_GRF_PIPE_CON0=%08X is not USB3 mode\n", pipe_phymode);
USB_LOG_ERR("usb_check_phy PIPE_PHY_GRF_PIPE_CON0=%08X is not USB3 mode\n", pipe_phymode);
}
}