use hcd_frame_number() instead of uframe

This commit is contained in:
hathach 2021-05-31 18:15:47 +07:00
parent da8000d42d
commit 4e98ce9147
No known key found for this signature in database
GPG Key ID: 2FA891220FBFD581
4 changed files with 7 additions and 14 deletions

View File

@ -108,15 +108,8 @@ void hcd_int_enable (uint8_t rhport);
// Disable USB interrupt
void hcd_int_disable(uint8_t rhport);
// Get micro frame number (125 us)
uint32_t hcd_uframe_number(uint8_t rhport);
// Get frame number (1ms)
TU_ATTR_ALWAYS_INLINE static inline
uint32_t hcd_frame_number(uint8_t rhport)
{
return hcd_uframe_number(rhport) >> 3;
}
uint32_t hcd_frame_number(uint8_t rhport);
//--------------------------------------------------------------------+
// Port API

View File

@ -378,6 +378,8 @@ bool usbh_edpt_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_
bool usbh_edpt_control_open(uint8_t dev_addr, uint8_t max_packet_size)
{
TU_LOG2("Open EP Control with Size = %u\r\n", max_packet_size);
tusb_desc_endpoint_t ep0_desc =
{
.bLength = sizeof(tusb_desc_endpoint_t),

View File

@ -65,7 +65,6 @@ typedef struct
volatile uint32_t uframe_number;
}ehci_data_t;
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
@ -125,10 +124,10 @@ static inline ehci_link_t* list_next (ehci_link_t *p_link_pointer);
// HCD API
//--------------------------------------------------------------------+
uint32_t hcd_uframe_number(uint8_t rhport)
uint32_t hcd_frame_number(uint8_t rhport)
{
(void) rhport;
return ehci_data.uframe_number + ehci_data.regs->frame_index;
return (ehci_data.uframe_number + ehci_data.regs->frame_index) >> 3;
}
void hcd_port_reset(uint8_t rhport)

View File

@ -504,10 +504,9 @@ bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet
return true;
}
uint32_t hcd_uframe_number(uint8_t rhport)
uint32_t hcd_frame_number(uint8_t rhport)
{
// Microframe number is (125us) but we are max full speed so return miliseconds * 8
return usb_hw->sof_rd * 8;
return usb_hw->sof_rd;
}
bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * ep_desc)