diff options
| author | hathach <[email protected]> | 2018-12-11 01:02:11 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-12-11 01:03:15 +0700 |
| commit | 7c2056defbc9aff3f7aaba4763fd0630df9159bf (patch) | |
| tree | 51b05e9a3403cfe7aa89a93a95f126453c418afa /src/host | |
| parent | 7a626dbc8b7edcf3303deb100f713f12038fefbe (diff) | |
remove pipe handle in host msc
Diffstat (limited to 'src/host')
| -rw-r--r-- | src/host/ehci/ehci.c | 17 | ||||
| -rw-r--r-- | src/host/hcd.h | 11 |
2 files changed, 11 insertions, 17 deletions
diff --git a/src/host/ehci/ehci.c b/src/host/ehci/ehci.c index f9b9db797..c36bfe181 100644 --- a/src/host/ehci/ehci.c +++ b/src/host/ehci/ehci.c @@ -75,11 +75,10 @@ static inline ehci_link_t* get_period_head(uint8_t hostid, uint8_t interval_ms) static inline ehci_qhd_t* get_control_qhd(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
static inline ehci_qtd_t* get_control_qtds(uint8_t dev_addr) ATTR_ALWAYS_INLINE ATTR_PURE ATTR_WARN_UNUSED_RESULT;
-static inline uint8_t qhd_get_index(ehci_qhd_t const * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
static inline ehci_qhd_t* qhd_next(ehci_qhd_t const * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
static inline ehci_qhd_t* qhd_find_free (void);
static inline tusb_xfer_type_t qhd_get_xfer_type(ehci_qhd_t const * p_qhd) ATTR_ALWAYS_INLINE ATTR_PURE;
-static inline ehci_qhd_t* qhd_get_from_pipe_handle(uint8_t dev_addr, uint8_t ep_addr);
+static inline ehci_qhd_t* qhd_get_from_addr(uint8_t dev_addr, uint8_t ep_addr);
// determine if a queue head has bus-related error
static inline bool qhd_has_xact_error(ehci_qhd_t * p_qhd)
@@ -435,7 +434,7 @@ bool hcd_pipe_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const bool hcd_pipe_queue_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t buffer[], uint16_t total_bytes)
{
//------------- set up QTD -------------//
- ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(dev_addr, ep_addr);
+ ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
ehci_qtd_t *p_qtd = qtd_find_free(dev_addr);
TU_ASSERT(p_qtd);
@@ -453,7 +452,7 @@ bool hcd_pipe_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t buffer[], uint16_t {
TU_ASSERT ( hcd_pipe_queue_xfer(dev_addr, ep_addr, buffer, total_bytes) );
- ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(dev_addr, ep_addr);
+ ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
if ( int_on_complete )
{ // the just added qtd is pointed by list_tail
@@ -467,7 +466,7 @@ bool hcd_pipe_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t buffer[], uint16_t /// pipe_close should only be called as a part of unmount/safe-remove process
bool hcd_pipe_close(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr)
{
- ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(dev_addr, ep_addr);
+ ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
// async list needs async advance handshake to make sure host controller has released cached data
// non-control does not use async advance, it will eventually free by control pipe close
@@ -494,19 +493,19 @@ bool hcd_pipe_close(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr) bool hcd_pipe_is_busy(uint8_t dev_addr, uint8_t ep_addr)
{
- ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(dev_addr, ep_addr);
+ ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
return !p_qhd->qtd_overlay.halted && (p_qhd->p_qtd_list_head != NULL);
}
bool hcd_pipe_is_stalled(uint8_t dev_addr, uint8_t ep_addr)
{
- ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(dev_addr, ep_addr);
+ ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
return p_qhd->qtd_overlay.halted && !qhd_has_xact_error(p_qhd);
}
tusb_error_t hcd_pipe_clear_stall(uint8_t dev_addr, uint8_t ep_addr)
{
- ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(dev_addr, ep_addr);
+ ehci_qhd_t *p_qhd = qhd_get_from_addr(dev_addr, ep_addr);
p_qhd->qtd_overlay.halted = 0;
// TODO reset data toggle ?
return TUSB_ERROR_NONE;
@@ -839,7 +838,7 @@ static inline ehci_qhd_t* qhd_next(ehci_qhd_t const * p_qhd) return (ehci_qhd_t*) tu_align32(p_qhd->next.address);
}
-static inline ehci_qhd_t* qhd_get_from_pipe_handle(uint8_t dev_addr, uint8_t ep_addr)
+static inline ehci_qhd_t* qhd_get_from_addr(uint8_t dev_addr, uint8_t ep_addr)
{
ehci_qhd_t* qhd_pool = ehci_data.qhd_pool;
diff --git a/src/host/hcd.h b/src/host/hcd.h index f19812379..3c34a5609 100644 --- a/src/host/hcd.h +++ b/src/host/hcd.h @@ -49,6 +49,9 @@ extern "C" {
#endif
+ //--------------------------------------------------------------------+
+// MACRO CONSTANT TYPEDEF
+//--------------------------------------------------------------------+
typedef enum
{
HCD_EVENT_DEVICE_ATTACH,
@@ -93,13 +96,6 @@ enum { #endif
//--------------------------------------------------------------------+
-// MACRO CONSTANT TYPEDEF
-//--------------------------------------------------------------------+
-typedef struct {
- uint8_t reserved[4];
-} pipe_handle_t;
-
-//--------------------------------------------------------------------+
// USBH-HCD API
//--------------------------------------------------------------------+
bool hcd_init(void);
@@ -131,7 +127,6 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * // PIPE API
//--------------------------------------------------------------------+
// TODO control xfer should be used via usbh layer
-
bool hcd_pipe_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const * ep_desc);
bool hcd_pipe_queue_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t buffer[], uint16_t total_bytes); // only queue, not transferring yet
bool hcd_pipe_xfer(uint8_t dev_addr, uint8_t ep_addr, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete);
|
