Parcourir la source

1. 保留目前未用到的rt_usbd_ep_unassign函数,暂时移除static属性,消除警告.
2. 修改一处存在多余括号问题. armclang有警告发出.

liruncong il y a 6 ans
Parent
commit
d3c08afd75

+ 14 - 0
components/drivers/usb/usbdevice/core/core.c

@@ -36,6 +36,7 @@ static rt_list_t device_list;
 static rt_size_t rt_usbd_ep_write(udevice_t device, uep_t ep, void *buffer, rt_size_t size);
 static rt_size_t rt_usbd_ep_read_prepare(udevice_t device, uep_t ep, void *buffer, rt_size_t size);
 static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep);
+rt_err_t rt_usbd_ep_unassign(udevice_t device, uep_t ep);
 
 /**
  * This function will handle get_device_descriptor bRequest.
@@ -1864,6 +1865,19 @@ static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep)
     return -RT_ERROR;
 }
 
+rt_err_t rt_usbd_ep_unassign(udevice_t device, uep_t ep)
+{
+    RT_ASSERT(device != RT_NULL);
+    RT_ASSERT(device->dcd != RT_NULL);    
+    RT_ASSERT(device->dcd->ep_pool != RT_NULL);        
+    RT_ASSERT(ep != RT_NULL);
+    RT_ASSERT(ep->ep_desc != RT_NULL);
+
+    ep->id->status = ID_UNASSIGNED;
+
+    return RT_EOK;
+}
+
 rt_err_t rt_usbd_ep0_setup_handler(udcd_t dcd, struct urequest* setup)
 {
     struct udev_msg msg;

+ 1 - 1
components/drivers/usb/usbhost/core/hub.c

@@ -413,7 +413,7 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub)
         RT_DEBUG_LOG(RT_DEBUG_USB, ("port %d status 0x%x\n", i + 1, pstatus));
 
         /* check port status change */
-        if ((pstatus & PORT_CCSC)) 
+        if (pstatus & PORT_CCSC) 
         {        
             /* clear port status change feature */
             rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_CONNECTION);