summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2024-03-28 20:59:46 +0800
committersakumisu <[email protected]>2024-03-28 21:00:18 +0800
commit078e21066cd7ff683846a069888360babc506b6a (patch)
tree8b4d07a685995377d70efaf2fd263aed6612d975
parent2335e08ef2e2480b3f91cc5dc63abea871fecd44 (diff)
mark errorcode with USB_ERR_SHUTDOWN when kill urb
-rw-r--r--port/dwc2/usb_hc_dwc2.c4
-rw-r--r--port/ehci/usb_hc_ehci.c2
-rw-r--r--port/musb/usb_hc_musb.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c
index cafe36cf..51c08644 100644
--- a/port/dwc2/usb_hc_dwc2.c
+++ b/port/dwc2/usb_hc_dwc2.c
@@ -808,10 +808,10 @@ int usbh_kill_urb(struct usbh_urb *urb)
chan->urb = NULL;
urb->hcpriv = NULL;
+ urb->errorcode = -USB_ERR_SHUTDOWN;
if (urb->timeout) {
urb->timeout = 0;
- urb->errorcode = -USB_ERR_SHUTDOWN;
usb_osal_sem_give(chan->waitsem);
} else {
dwc2_chan_free(chan);
@@ -936,7 +936,7 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
uint32_t has_used_packets = chan->num_packets - ((USB_OTG_HC(ch_num)->HCTSIZ & USB_OTG_HCTSIZ_PKTCNT) >> 19); /* how many packets have used */
urb->actual_length += (has_used_packets - 1) * USB_GET_MAXPACKETSIZE(urb->ep->wMaxPacketSize) + count; //the same with urb->actual_length += chan->xferlen;
-
+
uint8_t data_toggle = ((USB_OTG_HC(ch_num)->HCTSIZ & USB_OTG_HCTSIZ_DPID) >> USB_OTG_HCTSIZ_DPID_Pos);
if (data_toggle == HC_PID_DATA0) {
diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c
index eab31e59..8d39dc6e 100644
--- a/port/ehci/usb_hc_ehci.c
+++ b/port/ehci/usb_hc_ehci.c
@@ -1177,11 +1177,11 @@ int usbh_kill_urb(struct usbh_urb *urb)
qh = (struct ehci_qh_hw *)urb->hcpriv;
urb->hcpriv = NULL;
+ urb->errorcode = -USB_ERR_SHUTDOWN;
qh->urb = NULL;
if (urb->timeout) {
urb->timeout = 0;
- urb->errorcode = -USB_ERR_SHUTDOWN;
usb_osal_sem_give(qh->waitsem);
} else {
ehci_qh_free(bus, qh);
diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c
index 907ce048..bddbf344 100644
--- a/port/musb/usb_hc_musb.c
+++ b/port/musb/usb_hc_musb.c
@@ -701,11 +701,11 @@ int usbh_kill_urb(struct usbh_urb *urb)
pipe = (struct musb_pipe *)urb->hcpriv;
urb->hcpriv = NULL;
+ urb->errorcode = -USB_ERR_SHUTDOWN;
pipe->urb = NULL;
if (urb->timeout) {
urb->timeout = 0;
- urb->errorcode = -USB_ERR_SHUTDOWN;
usb_osal_sem_give(pipe->waitsem);
} else {
musb_pipe_free(pipe);