diff --git a/common/usb_hc.h b/common/usb_hc.h index 9a2d4cd1..880149fe 100644 --- a/common/usb_hc.h +++ b/common/usb_hc.h @@ -56,6 +56,7 @@ struct usbh_urb { uint32_t timeout; int errorcode; uint32_t num_of_iso_packets; + uint32_t start_frame; usbh_complete_callback_t complete; void *arg; struct usbh_iso_frame_packet iso_packet[0]; @@ -68,6 +69,12 @@ struct usbh_urb { */ int usb_hc_init(void); +/** + * @brief Get frame number. + * + * @return frame number. + */ +uint16_t usbh_get_frame_number(void); /** * @brief control roothub. * diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index c12c9f57..e1591ae6 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/port/dwc2/usb_hc_dwc2.c @@ -348,11 +348,6 @@ static inline uint32_t dwc2_get_glb_intstatus(void) return tmpreg; } -static inline uint32_t dwc2_get_current_frame(void) -{ - return (USB_OTG_HOST->HFNUM & USB_OTG_HFNUM_FRNUM); -} - static int dwc2_pipe_alloc(void) { int chidx; @@ -534,6 +529,11 @@ int usb_hc_init(void) return 0; } +uint16_t usbh_get_frame_number(void) +{ + return (USB_OTG_HOST->HFNUM & USB_OTG_HFNUM_FRNUM); +} + int usbh_roothub_control(struct usb_setup_packet *setup, uint8_t *buf) { __IO uint32_t hprt0;