Browse Source

use hcd_frame_number() instead of uframe

hathach 4 years ago
parent
commit
4e98ce9147
4 changed files with 7 additions and 14 deletions
  1. 1 8
      src/host/hcd.h
  2. 2 0
      src/host/usbh.c
  3. 2 3
      src/portable/ehci/ehci.c
  4. 2 3
      src/portable/raspberrypi/rp2040/hcd_rp2040.c

+ 1 - 8
src/host/hcd.h

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

+ 2 - 0
src/host/usbh.c

@@ -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),

+ 2 - 3
src/portable/ehci/ehci.c

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

+ 2 - 3
src/portable/raspberrypi/rp2040/hcd_rp2040.c

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