summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-02-22 22:40:51 +0700
committerhathach <[email protected]>2021-02-22 22:40:51 +0700
commitc5b8980398a8e79f6501af1f1b1e17e0a599fabf (patch)
tree11c455594ef7da79b3cb3670bb6a2290bc7e4b7d /src
parent1e07fc024c91453cd71d357698b05d40eb571431 (diff)
separate hcd_init from ehci
Diffstat (limited to 'src')
-rw-r--r--src/host/ehci/ehci.c12
-rw-r--r--src/portable/nxp/transdimension/hcd_transdimension.c8
2 files changed, 12 insertions, 8 deletions
diff --git a/src/host/ehci/ehci.c b/src/host/ehci/ehci.c
index b5f872c81..5626abcc8 100644
--- a/src/host/ehci/ehci.c
+++ b/src/host/ehci/ehci.c
@@ -51,6 +51,7 @@ CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4096) static ehci_data_t ehci_data;
// EHCI portable
uint32_t hcd_ehci_register_addr(uint8_t rhport);
+bool hcd_ehci_init (uint8_t rhport); // TODO move later
//--------------------------------------------------------------------+
// PROTOTYPE
@@ -100,16 +101,9 @@ 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 rhport);
-
//--------------------------------------------------------------------+
// HCD API
//--------------------------------------------------------------------+
-bool hcd_init(uint8_t rhport)
-{
- tu_memclr(&ehci_data, sizeof(ehci_data_t));
- return ehci_init(rhport);
-}
uint32_t hcd_uframe_number(uint8_t rhport)
{
@@ -206,8 +200,10 @@ void hcd_device_close(uint8_t rhport, uint8_t dev_addr)
}
// EHCI controller init
-static bool ehci_init(uint8_t rhport)
+bool hcd_ehci_init(uint8_t rhport)
{
+ tu_memclr(&ehci_data, sizeof(ehci_data_t));
+
ehci_data.regs = (ehci_registers_t* ) hcd_ehci_register_addr(rhport);
ehci_registers_t* regs = ehci_data.regs;
diff --git a/src/portable/nxp/transdimension/hcd_transdimension.c b/src/portable/nxp/transdimension/hcd_transdimension.c
index f8ad7c719..62b14364d 100644
--- a/src/portable/nxp/transdimension/hcd_transdimension.c
+++ b/src/portable/nxp/transdimension/hcd_transdimension.c
@@ -65,6 +65,14 @@ typedef struct
#endif
+// TODO better prototype later
+extern bool hcd_ehci_init (uint8_t rhport); // from ehci.c
+
+bool hcd_init(uint8_t rhport)
+{
+ return hcd_ehci_init(rhport);
+}
+
void hcd_int_enable(uint8_t rhport)
{
NVIC_EnableIRQ(_hcd_controller[rhport].irqnum);