summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2025-08-06 21:20:05 +0800
committersakumisu <[email protected]>2025-08-06 21:24:59 +0800
commit3ab47e02958a04db3fc39052ff7fcde05bdf954d (patch)
tree380291f14871780fee0f9b0f9cab9bc8b7085463
parent2081360f2ccd2c3eb54ff0a8cae2ec21881ade3a (diff)
feat(port): add urb->complete in usbh_kill_urb
Signed-off-by: sakumisu <[email protected]>
-rw-r--r--port/dwc2/usb_hc_dwc2.c4
-rw-r--r--port/ehci/usb_hc_ehci.c7
-rw-r--r--port/musb/usb_hc_musb.c4
-rw-r--r--port/rp2040/usb_hc_rp2040.c4
4 files changed, 18 insertions, 1 deletions
diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c
index 681a6d75..df706eda 100644
--- a/port/dwc2/usb_hc_dwc2.c
+++ b/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;
diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c
index 398d2430..2ebe1134 100644
--- a/port/ehci/usb_hc_ehci.c
+++ b/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;
diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c
index 2862f854..04798afb 100644
--- a/port/musb/usb_hc_musb.c
+++ b/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;
}
diff --git a/port/rp2040/usb_hc_rp2040.c b/port/rp2040/usb_hc_rp2040.c
index 14764fb3..e9751b88 100644
--- a/port/rp2040/usb_hc_rp2040.c
+++ b/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;