diff options
| author | sakumisu <[email protected]> | 2025-08-01 21:13:46 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-08-01 21:13:46 +0800 |
| commit | 9ddcbf58caab13b7b4bcfaa19d2a9f4d5072c658 (patch) | |
| tree | e61b62d2fb1d579011e3ad893873684a6beb6655 | |
| parent | 6e9e769e1037795d9890992c702deef0f3ca6eb6 (diff) | |
update(port/dwc2/usb_hc_dwc2): only set errorcode before urb waitup because split transfer will do many times
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | port/dwc2/usb_hc_dwc2.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index 78e0d521..eda503bc 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/port/dwc2/usb_hc_dwc2.c @@ -1166,8 +1166,6 @@ static void dwc2_inchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num) if (chan_intstatus & USB_OTG_HCINT_CHH) { USB_OTG_HC(ch_num)->HCINT = chan_intstatus; if (chan_intstatus & USB_OTG_HCINT_XFRC) { - urb->errorcode = 0; - uint32_t count = chan->xferlen - (USB_OTG_HC(ch_num)->HCTSIZ & USB_OTG_HCTSIZ_XFRSIZ); /* how many size has received */ uint8_t data_toggle = ((USB_OTG_HC(ch_num)->HCTSIZ & USB_OTG_HCTSIZ_DPID) >> USB_OTG_HCTSIZ_DPID_Pos); @@ -1195,6 +1193,7 @@ static void dwc2_inchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num) } } else if (chan->ep0_state == DWC2_EP0_STATE_INSTATUS) { chan->ep0_state = DWC2_EP0_STATE_SETUP; + urb->errorcode = 0; dwc2_urb_waitup(urb); } } else if (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes) == USB_ENDPOINT_TYPE_ISOCHRONOUS) { @@ -1203,6 +1202,7 @@ static void dwc2_inchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num) dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length); } else { usb_dcache_invalidate((uintptr_t)urb->transfer_buffer, USB_ALIGN_UP(urb->actual_length, CONFIG_USB_ALIGN_SIZE)); + urb->errorcode = 0; dwc2_urb_waitup(urb); } } @@ -1283,8 +1283,6 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num) if (chan_intstatus & USB_OTG_HCINT_CHH) { USB_OTG_HC(ch_num)->HCINT = chan_intstatus; if (chan_intstatus & USB_OTG_HCINT_XFRC) { - urb->errorcode = 0; - uint32_t count = USB_OTG_HC(ch_num)->HCTSIZ & USB_OTG_HCTSIZ_XFRSIZ; /* last packet size */ uint32_t has_used_packets = chan->num_packets - ((USB_OTG_HC(ch_num)->HCTSIZ & USB_OTG_HCTSIZ_PKTCNT) >> 19); /* how many packets have used */ uint32_t olen = (has_used_packets - 1) * USB_GET_MAXPACKETSIZE(urb->ep->wMaxPacketSize) + count; /* the same with urb->actual_length += chan->xferlen; */ @@ -1333,6 +1331,7 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num) } else if (chan->ep0_state == DWC2_EP0_STATE_OUTSTATUS) { usb_dcache_invalidate((uintptr_t)urb->transfer_buffer, USB_ALIGN_UP(urb->actual_length - 8, CONFIG_USB_ALIGN_SIZE)); chan->ep0_state = DWC2_EP0_STATE_SETUP; + urb->errorcode = 0; dwc2_urb_waitup(urb); } } else if (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes) == USB_ENDPOINT_TYPE_ISOCHRONOUS) { @@ -1340,6 +1339,7 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num) if (chan->do_ssplit && urb->transfer_buffer_length > 0) { dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length); } else { + urb->errorcode = 0; dwc2_urb_waitup(urb); } } |
