From ab8ba67a839fef2e7c31be0faf531323ba63496e Mon Sep 17 00:00:00 2001 From: songyanguang <345810377@qq.com> Date: Fri, 30 Aug 2024 10:20:35 +0800 Subject: [PATCH] Fixed a bug in using usb_osal_mq_recv --- .../services/drivers/usb/components/class/hub/usbh_hub.c | 6 ++++-- .../XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) 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 b98c3b7f9..c948ac3db 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 @@ -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); diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c index e0b7cd6b9..9939dcb78 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/usb_service/usb_host.c @@ -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); } }