add get frame number api

This commit is contained in:
sakimisu
2022-12-31 14:11:18 +08:00
parent 27ff38f745
commit b461821639
2 changed files with 12 additions and 5 deletions

View File

@@ -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.
*

View File

@@ -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;