mirror of
https://github.com/sakumisu/CherryUSB.git
synced 2025-10-14 02:58:19 +08:00
update(port/dwc2/usb_hc_dwc2): only set errorcode before urb waitup because split transfer will do many times
Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user