From a76d3a872651be52f61a3f8db8936c93b3340e67 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 12 Dec 2018 14:46:28 +0700 Subject: [PATCH] clean up --- src/host/ehci/ehci.c | 20 ++++++++++---------- src/host/hcd.h | 2 +- src/host/hub.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/host/ehci/ehci.c b/src/host/ehci/ehci.c index 278765585..b46c9bc64 100644 --- a/src/host/ehci/ehci.c +++ b/src/host/ehci/ehci.c @@ -109,7 +109,7 @@ static void qtd_init (ehci_qtd_t* p_qtd, void* buffer, uint16_t total_bytes); static inline void list_insert (ehci_link_t *current, ehci_link_t *new, uint8_t new_type); static inline ehci_link_t* list_next (ehci_link_t *p_link_pointer); -static bool ehci_init (uint8_t hostid); +static bool ehci_init (uint8_t rhport); //--------------------------------------------------------------------+ // HCD API @@ -192,9 +192,9 @@ void hcd_device_close(uint8_t rhport, uint8_t dev_addr) } // EHCI controller init -static bool ehci_init(uint8_t hostid) +static bool ehci_init(uint8_t rhport) { - ehci_data.regs = (ehci_registers_t* ) hcd_ehci_register_addr(hostid); + ehci_data.regs = (ehci_registers_t* ) hcd_ehci_register_addr(rhport); ehci_registers_t* regs = ehci_data.regs; @@ -207,7 +207,7 @@ static bool ehci_init(uint8_t hostid) EHCI_INT_MASK_NXP_PERIODIC | EHCI_INT_MASK_NXP_ASYNC ; //------------- Asynchronous List -------------// - ehci_qhd_t * const async_head = qhd_async_head(hostid); + ehci_qhd_t * const async_head = qhd_async_head(rhport); tu_memclr(async_head, sizeof(ehci_qhd_t)); async_head->next.address = (uint32_t) async_head; // circular list, next is itself @@ -227,7 +227,7 @@ static bool ehci_init(uint8_t hostid) } ehci_link_t * const framelist = ehci_data.period_framelist; - ehci_link_t * const period_1ms = get_period_head(hostid, 1); + ehci_link_t * const period_1ms = get_period_head(rhport, 1); // all links --> period_head_arr[0] (1ms) // 0, 2, 4, 6 etc --> period_head_arr[1] (2ms) // 1, 5 --> period_head_arr[2] (4ms) @@ -242,15 +242,15 @@ static bool ehci_init(uint8_t hostid) for(uint32_t i=0; iterminate = 1; @@ -376,11 +376,11 @@ bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_t const { case TUSB_XFER_CONTROL: case TUSB_XFER_BULK: - list_head = (ehci_link_t*) qhd_async_head(_usbh_devices[dev_addr].rhport); + list_head = (ehci_link_t*) qhd_async_head(rhport); break; case TUSB_XFER_INTERRUPT: - list_head = get_period_head(_usbh_devices[dev_addr].rhport, p_qhd->interval_ms); + list_head = get_period_head(rhport, p_qhd->interval_ms); break; case TUSB_XFER_ISOCHRONOUS: diff --git a/src/host/hcd.h b/src/host/hcd.h index f93cbd2c6..e117c20ff 100644 --- a/src/host/hcd.h +++ b/src/host/hcd.h @@ -135,7 +135,7 @@ bool hcd_edpt_busy(uint8_t dev_addr, uint8_t ep_addr); bool hcd_edpt_stalled(uint8_t dev_addr, uint8_t ep_addr); bool hcd_edpt_clear_stall(uint8_t dev_addr, uint8_t ep_addr); - +// TODO merge with pipe_xfer bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen); //--------------------------------------------------------------------+ diff --git a/src/host/hub.c b/src/host/hub.c index e9f9dc7de..6b87e935e 100644 --- a/src/host/hub.c +++ b/src/host/hub.c @@ -245,7 +245,7 @@ void hub_isr(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t event, uint32_t xf else { // TODO [HUB] check if hub is still plugged before polling status endpoint since failed usually mean hub unplugged -// TU_ASSERT ( TUSB_ERROR_NONE == hcd_pipe_xfer(pipe_hdl, &p_hub->status_change, 1, true) ); +// TU_ASSERT ( hub_status_pipe_queue(dev_addr) ); } }