diff options
| author | sakumisu <[email protected]> | 2023-12-28 20:57:50 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2023-12-28 20:57:50 +0800 |
| commit | 019c9cff6e3f054cdcf0a6373c829fdbdc747506 (patch) | |
| tree | ffc33b0fa24b355a778678d4adc3b7daa68838f4 | |
| parent | 2662a3497da30325e3fa3ff1d6d6175aa9f9d6b1 (diff) | |
fix dwc2 out chan actual len
| -rw-r--r-- | port/dwc2/usb_hc_dwc2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index 8fa9ce15..f8412b96 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/port/dwc2/usb_hc_dwc2.c @@ -1021,11 +1021,11 @@ static void dwc2_outchan_irq_handler(uint8_t ch_num) CLEAR_HC_INT(ch_num, USB_OTG_HCINT_CHH); if (urb->errorcode == 0) { - uint32_t count = USB_OTG_HC(ch_num)->HCTSIZ & USB_OTG_HCTSIZ_XFRSIZ; /* how many size has sent */ + 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_DIEPTSIZ_PKTCNT) >> 19); /* how many packets have used */ - urb->actual_length += count; - + urb->actual_length += (has_used_packets - 1) * USB_GET_MAXPACKETSIZE(urb->ep->wMaxPacketSize) + count; //the same with urb->actual_length += chan->xferlen; + if (has_used_packets % 2) /* toggle in odd numbers */ { if (urb->data_toggle == HC_PID_DATA0) { |
