Răsfoiți Sursa

feat(port): add urb->complete in usbh_kill_urb

Signed-off-by: sakumisu <1203593632@qq.com>
sakumisu 5 luni în urmă
părinte
comite
3ab47e0295

+ 4 - 0
port/dwc2/usb_hc_dwc2.c

@@ -1139,6 +1139,10 @@ int usbh_kill_urb(struct usbh_urb *urb)
         dwc2_chan_free(chan);
     }
 
+    if (urb->complete) {
+        urb->complete(urb->arg, urb->errorcode);
+    }
+
     usb_osal_leave_critical_section(flags);
 
     return 0;

+ 6 - 1
port/ehci/usb_hc_ehci.c

@@ -1350,7 +1350,8 @@ int usbh_kill_urb(struct usbh_urb *urb)
         EHCI_HCOR->usbcmd |= EHCI_USBCMD_IAAD;
         while (!(EHCI_HCOR->usbsts & EHCI_USBSTS_IAA)) {
             timeout++;
-            if (timeout > 20000) {
+            if (timeout > 200000) {
+                USB_LOG_ERR("iaad timeout\r\n");
                 usb_osal_leave_critical_section(flags);
                 return -USB_ERR_TIMEOUT;
             }
@@ -1358,6 +1359,10 @@ int usbh_kill_urb(struct usbh_urb *urb)
         EHCI_HCOR->usbsts = EHCI_USBSTS_IAA;
     }
 
+    if (urb->complete) {
+        urb->complete(urb->arg, urb->errorcode);
+    }
+
     usb_osal_leave_critical_section(flags);
 
     return 0;

+ 4 - 0
port/musb/usb_hc_musb.c

@@ -820,6 +820,10 @@ int usbh_kill_urb(struct usbh_urb *urb)
         musb_pipe_free(pipe);
     }
 
+    if (urb->complete) {
+        urb->complete(urb->arg, urb->errorcode);
+    }
+
     usb_osal_leave_critical_section(flags);
     return 0;
 }

+ 4 - 0
port/rp2040/usb_hc_rp2040.c

@@ -605,6 +605,10 @@ int usbh_kill_urb(struct usbh_urb *urb)
         rp2040_pipe_free(pipe);
     }
 
+    if (urb->complete) {
+        urb->complete(urb->arg, urb->errorcode);
+    }
+
     usb_osal_leave_critical_section(flags);
 
     return 0;