summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-03-23 09:57:08 +0700
committerhathach <[email protected]>2013-03-23 09:57:08 +0700
commit8beb7497618ecf5a90fc13da3eb56a7d62303748 (patch)
tree79f57d67f8d65551224102cff896cced7b40682d /tinyusb
parent660440d69c98c3c3845447618d3572549fb4ecb7 (diff)
clean up
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/host/ehci/ehci.c19
-rw-r--r--tinyusb/host/usbh.h35
2 files changed, 10 insertions, 44 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 989d9dea2..4131d3592 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -57,6 +57,7 @@
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
STATIC_ ehci_data_t ehci_data TUSB_CFG_ATTR_USBRAM;
+//TODO removed if not use period list
STATIC_ ehci_link_t period_frame_list0[EHCI_FRAMELIST_SIZE] ATTR_ALIGNED(4096) TUSB_CFG_ATTR_USBRAM;
#if CONTROLLER_HOST_NUMBER > 1
STATIC_ ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE] ATTR_ALIGNED(4096) TUSB_CFG_ATTR_USBRAM;
@@ -111,8 +112,8 @@ STATIC_ INLINE_ ehci_qhd_t* get_period_head(uint8_t hostid)
return &ehci_data.period_head[ hostid_to_data_idx(hostid) ];
}
-static inline uint8_t get_qhd_index(ehci_qhd_t * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
-static inline uint8_t get_qhd_index(ehci_qhd_t * p_qhd)
+static inline uint8_t qhd_get_index(ehci_qhd_t * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
+static inline uint8_t qhd_get_index(ehci_qhd_t * p_qhd)
{
return p_qhd - ehci_data.device[p_qhd->device_address-1].qhd;
}
@@ -129,8 +130,8 @@ static inline void qtd_remove_1st_from_qhd(ehci_qhd_t *p_qhd)
}
}
-static inline void insert_qtd_to_qhd(ehci_qhd_t *p_qhd, ehci_qtd_t *p_qtd_new) ATTR_ALWAYS_INLINE;
-static inline void insert_qtd_to_qhd(ehci_qhd_t *p_qhd, ehci_qtd_t *p_qtd_new)
+static inline void qtd_insert_to_qhd(ehci_qhd_t *p_qhd, ehci_qtd_t *p_qtd_new) ATTR_ALWAYS_INLINE;
+static inline void qtd_insert_to_qhd(ehci_qhd_t *p_qhd, ehci_qtd_t *p_qtd_new)
{
if (p_qhd->p_qtd_list_head == NULL) // empty list
{
@@ -230,8 +231,8 @@ void async_advance_isr(ehci_qhd_t * const async_head)
qtd_remove_1st_from_qhd(p_qhd);
}
}
- }
- }
+ }// end qhd list loop
+ } // end for device[] loop
}
void port_connect_status_change_isr(uint8_t hostid)
@@ -267,7 +268,7 @@ void async_list_process_isr(ehci_qhd_t * const async_head, ehci_registers_t * co
if (p_qhd->endpoint_number) // if not Control, can only be Bulk
{
pipe_hdl.xfer_type = TUSB_XFER_BULK;
- pipe_hdl.index = get_qhd_index(p_qhd);
+ pipe_hdl.index = qhd_get_index(p_qhd);
}
usbh_isr( pipe_hdl, p_qhd->class_code); // call USBH call back
}
@@ -611,7 +612,7 @@ pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const *
list_insert( (ehci_link_t*) list_head,
(ehci_link_t*) p_qhd, EHCI_QUEUE_ELEMENT_QHD);
- return (pipe_handle_t) { .dev_addr = dev_addr, .xfer_type = p_endpoint_desc->bmAttributes.xfer, .index = get_qhd_index(p_qhd) };
+ return (pipe_handle_t) { .dev_addr = dev_addr, .xfer_type = p_endpoint_desc->bmAttributes.xfer, .index = qhd_get_index(p_qhd) };
}
STATIC_ INLINE_ ehci_qhd_t* get_qhd_from_pipe_handle(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE;
@@ -652,7 +653,7 @@ tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t t
}
//------------- insert TD to TD list -------------//
- insert_qtd_to_qhd(p_qhd, p_qtd);
+ qtd_insert_to_qhd(p_qhd, p_qtd);
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/host/usbh.h b/tinyusb/host/usbh.h
index 8d632f139..e0a1bc0e7 100644
--- a/tinyusb/host/usbh.h
+++ b/tinyusb/host/usbh.h
@@ -93,41 +93,6 @@
// TUSB_CLASS_APPLICATION_SPECIFIC = 0xEF ,
// TUSB_CLASS_VENDOR_SPECIFIC = 0xFF
-enum {
- TUSB_FLAGS_CLASS_UNSPECIFIED = BIT_(0) , ///< 0
- TUSB_FLAGS_CLASS_AUDIO = BIT_(1) , ///< 1
- TUSB_FLAGS_CLASS_CDC = BIT_(2) , ///< 2
- TUSB_FLAGS_CLASS_HID_GENERIC = BIT_(3) , ///< 3
- TUSB_FLAGS_CLASS_RESERVED_4 = BIT_(4) , ///< 4
- TUSB_FLAGS_CLASS_PHYSICAL = BIT_(5) , ///< 5
- TUSB_FLAGS_CLASS_IMAGE = BIT_(6) , ///< 6
- TUSB_FLAGS_CLASS_PRINTER = BIT_(7) , ///< 7
- TUSB_FLAGS_CLASS_MSC = BIT_(8) , ///< 8
- TUSB_FLAGS_CLASS_HUB = BIT_(9) , ///< 9
- TUSB_FLAGS_CLASS_CDC_DATA = BIT_(10) , ///< 10
- TUSB_FLAGS_CLASS_SMART_CARD = BIT_(11) , ///< 11
- TUSB_FLAGS_CLASS_RESERVED_12 = BIT_(12) , ///< 12
- TUSB_FLAGS_CLASS_CONTENT_SECURITY = BIT_(13) , ///< 13
- TUSB_FLAGS_CLASS_VIDEO = BIT_(14) , ///< 14
- TUSB_FLAGS_CLASS_PERSONAL_HEALTHCARE = BIT_(15) , ///< 15
- TUSB_FLAGS_CLASS_AUDIO_VIDEO = BIT_(16) , ///< 16
- // reserved from 17 to 20
- TUSB_FLAGS_CLASS_RESERVED_20 = BIT_(20) , ///< 3
-
- TUSB_FLAGS_CLASS_HID_KEYBOARD = BIT_(21) , ///< 3
- TUSB_FLAGS_CLASS_HID_MOUSE = BIT_(22) , ///< 3
-
- // reserved from 25 to 26
- TUSB_FLAGS_CLASS_RESERVED_25 = BIT_(25) , ///< 3
- TUSB_FLAGS_CLASS_RESERVED_26 = BIT_(26) , ///< 3
-
- TUSB_FLAGS_CLASS_DIAGNOSTIC = BIT_(27),
- TUSB_FLAGS_CLASS_WIRELESS_CONTROLLER = BIT_(28),
- TUSB_FLAGS_CLASS_MISC = BIT_(29),
- TUSB_FLAGS_CLASS_APPLICATION_SPECIFIC = BIT_(30),
- TUSB_FLAGS_CLASS_VENDOR_SPECIFIC = BIT_(31) // TODO out of range for int type
-};
-
/// Device Status
enum tusbh_device_status_{
TUSB_DEVICE_STATUS_UNPLUG = 0,