mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Clarify receive_packet comment, add SOF handling.
This commit is contained in:
parent
5645d44127
commit
c7a52829f4
@ -154,7 +154,8 @@ bool dcd_init (uint8_t rhport)
|
|||||||
/* USB_OTG_FS->GINTMSK |= USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM | \
|
/* USB_OTG_FS->GINTMSK |= USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM | \
|
||||||
USB_OTG_GINTMSK_ESUSPM | USB_OTG_GINTMSK_USBSUSPM | \
|
USB_OTG_GINTMSK_ESUSPM | USB_OTG_GINTMSK_USBSUSPM | \
|
||||||
USB_OTG_GINTMSK_SOFM; */
|
USB_OTG_GINTMSK_SOFM; */
|
||||||
USB_OTG_FS->GINTMSK |= USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM | USB_OTG_GINTMSK_RXFLVLM;
|
USB_OTG_FS->GINTMSK |= USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM | \
|
||||||
|
USB_OTG_GINTMSK_SOFM | USB_OTG_GINTMSK_RXFLVLM;
|
||||||
|
|
||||||
// Enable pullup, enable peripheral.
|
// Enable pullup, enable peripheral.
|
||||||
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBUSBSEN | USB_OTG_GCCFG_PWRDWN;
|
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBUSBSEN | USB_OTG_GCCFG_PWRDWN;
|
||||||
@ -412,6 +413,9 @@ static void receive_packet(xfer_ctl_t * xfer, /* USB_OTG_OUTEndpointTypeDef * ou
|
|||||||
}
|
}
|
||||||
|
|
||||||
xfer->queued_len += xfer_size;
|
xfer->queued_len += xfer_size;
|
||||||
|
|
||||||
|
// Per USB spec, a short OUT packet (including length 0) is always
|
||||||
|
// indicative of the end of a transfer (at least for ctl, bulk, int).
|
||||||
xfer->short_packet = (xfer_size < xfer->max_size);
|
xfer->short_packet = (xfer_size < xfer->max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,6 +483,11 @@ void OTG_FS_IRQHandler(void) {
|
|||||||
dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true);
|
dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(int_status & USB_OTG_GINTSTS_SOF) {
|
||||||
|
USB_OTG_FS->GINTSTS = USB_OTG_GINTSTS_SOF;
|
||||||
|
dcd_event_bus_signal(0, DCD_EVENT_SOF, true);
|
||||||
|
}
|
||||||
|
|
||||||
if(int_status & USB_OTG_GINTSTS_RXFLVL) {
|
if(int_status & USB_OTG_GINTSTS_RXFLVL) {
|
||||||
USB_OTG_FS->GINTSTS = USB_OTG_GINTSTS_RXFLVL;
|
USB_OTG_FS->GINTSTS = USB_OTG_GINTSTS_RXFLVL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user