Преглед изворни кода

fix usb_osal_enter_critical_section in usbh_submit_urb

sakimisu пре 3 година
родитељ
комит
82596cea4b
2 измењених фајлова са 5 додато и 4 уклоњено
  1. 3 2
      port/dwc2/usb_hc_dwc2.c
  2. 2 2
      port/musb/usb_hc_musb.c

+ 3 - 2
port/dwc2/usb_hc_dwc2.c

@@ -769,8 +769,6 @@ int usbh_submit_urb(struct usbh_urb *urb)
         return -EINVAL;
         return -EINVAL;
     }
     }
 
 
-    flags = usb_osal_enter_critical_section();
-
     if (!chan->hport->connected) {
     if (!chan->hport->connected) {
         return -ENODEV;
         return -ENODEV;
     }
     }
@@ -779,6 +777,8 @@ int usbh_submit_urb(struct usbh_urb *urb)
         return -EBUSY;
         return -EBUSY;
     }
     }
 
 
+    flags = usb_osal_enter_critical_section();
+
     chan->waiter = false;
     chan->waiter = false;
     chan->xfrd = 0;
     chan->xfrd = 0;
     chan->urb = urb;
     chan->urb = urb;
@@ -836,6 +836,7 @@ int usbh_kill_urb(struct usbh_urb *urb)
     flags = usb_osal_enter_critical_section();
     flags = usb_osal_enter_critical_section();
 
 
     dwc2_halt(pipe->chidx);
     dwc2_halt(pipe->chidx);
+    CLEAR_HC_INT(pipe->chidx, USB_OTG_HCINT_CHH);
     pipe->urb = NULL;
     pipe->urb = NULL;
 
 
     usb_osal_leave_critical_section(flags);
     usb_osal_leave_critical_section(flags);

+ 2 - 2
port/musb/usb_hc_musb.c

@@ -650,8 +650,6 @@ int usbh_submit_urb(struct usbh_urb *urb)
         return -EINVAL;
         return -EINVAL;
     }
     }
 
 
-    flags = usb_osal_enter_critical_section();
-
     if (!pipe->hport->connected) {
     if (!pipe->hport->connected) {
         return -ENODEV;
         return -ENODEV;
     }
     }
@@ -660,6 +658,8 @@ int usbh_submit_urb(struct usbh_urb *urb)
         return -EBUSY;
         return -EBUSY;
     }
     }
 
 
+    flags = usb_osal_enter_critical_section();
+
     pipe->waiter = false;
     pipe->waiter = false;
     pipe->xfrd = 0;
     pipe->xfrd = 0;
     pipe->urb = urb;
     pipe->urb = urb;