summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test/support/tusb_config.h4
-rw-r--r--tinyusb/hal/hal.h4
-rw-r--r--tinyusb/hal/hal_lpc43xx.c14
-rw-r--r--tinyusb/hal/hal_lpc43xx.h3
-rw-r--r--tinyusb/host/ehci/ehci.c5
-rw-r--r--tinyusb/host/ehci/ehci.h5
-rw-r--r--tinyusb/host/hcd.h1
-rw-r--r--tinyusb/tusb.c12
8 files changed, 37 insertions, 11 deletions
diff --git a/tests/test/support/tusb_config.h b/tests/test/support/tusb_config.h
index 70652209d..93d46401b 100644
--- a/tests/test/support/tusb_config.h
+++ b/tests/test/support/tusb_config.h
@@ -79,12 +79,10 @@
// Test support
#define CONTROLLER_HOST_START_INDEX ( ((CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)) ? 1 : 0)
+
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
//--------------------------------------------------------------------+
-//#define TUSB_CFG_DEVICE
-
-//------------- CORE/CONTROLLER -------------//
//------------- CLASS -------------//
//#define TUSB_CFG_DEVICE_CDC
diff --git a/tinyusb/hal/hal.h b/tinyusb/hal/hal.h
index 9afad4726..ad77055eb 100644
--- a/tinyusb/hal/hal.h
+++ b/tinyusb/hal/hal.h
@@ -68,6 +68,10 @@
extern "C" {
#endif
+// callback from tusb.h
+extern void tusb_isr(uint8_t controller_id);
+
+
/** \brief USB hardware init
*
* \param[in] para1
diff --git a/tinyusb/hal/hal_lpc43xx.c b/tinyusb/hal/hal_lpc43xx.c
index f7280041e..770ffd4ce 100644
--- a/tinyusb/hal/hal_lpc43xx.c
+++ b/tinyusb/hal/hal_lpc43xx.c
@@ -54,4 +54,18 @@ tusb_error_t hal_init()
return TUSB_ERROR_NONE;
}
+void USB0_IRQHandler(void)
+{
+#if TUSB_CFG_CONTROLLER0_MODE
+ tusb_isr(0);
+#endif
+}
+
+void USB1_IRQHandler(void)
+{
+#if TUSB_CFG_CONTROLLER1_MODE
+ tusb_isr(1);
+#endif
+}
+
#endif
diff --git a/tinyusb/hal/hal_lpc43xx.h b/tinyusb/hal/hal_lpc43xx.h
index 0d9e4c8be..63da8a37c 100644
--- a/tinyusb/hal/hal_lpc43xx.h
+++ b/tinyusb/hal/hal_lpc43xx.h
@@ -61,9 +61,6 @@
#define DEVICE_ROM_REG_BASE LPC_USB0_BASE // TODO USB1
#define DEVICE_ROM_DRIVER_ADDR 0x1040011C
-#define tusb_1st_isr USB0_IRQHandler
-#define tusb_2nd_isr
-
static inline void hal_interrupt_enable()
{
NVIC_EnableIRQ(USB0_IRQn); // TODO USB1
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 27562974f..b2d6268f3 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -128,6 +128,11 @@ tusb_error_t hcd_init(void)
return TUSB_ERROR_NONE;
}
+void hcd_isr(uint8_t hostid)
+{
+
+}
+
//--------------------------------------------------------------------+
// Controller API
//--------------------------------------------------------------------+
diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h
index 880a0e477..4b8ec1f17 100644
--- a/tinyusb/host/ehci/ehci.h
+++ b/tinyusb/host/ehci/ehci.h
@@ -92,11 +92,6 @@
#endif
//--------------------------------------------------------------------+
-// USBH-HCD API
-//--------------------------------------------------------------------+
-void hcd_isr(uint8_t hostid);
-
-//--------------------------------------------------------------------+
// EHCI Data Structure
//--------------------------------------------------------------------+
enum ehci_queue_element_type_{
diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h
index 0051b028e..b046a0e64 100644
--- a/tinyusb/host/hcd.h
+++ b/tinyusb/host/hcd.h
@@ -67,6 +67,7 @@ typedef uint32_t pipe_handle_t;
// USBH-HCD API
//--------------------------------------------------------------------+
tusb_error_t hcd_init() ATTR_WARN_UNUSED_RESULT;
+void hcd_isr(uint8_t hostid);
//--------------------------------------------------------------------+
// PIPE API
diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c
index 49f8ef253..fb5cf013c 100644
--- a/tinyusb/tusb.c
+++ b/tinyusb/tusb.c
@@ -54,3 +54,15 @@ tusb_error_t tusb_init(void)
return TUSB_ERROR_NONE;
}
+// called from hal layer
+void tusb_isr(uint8_t controller_id)
+{
+#if MODE_HOST_SUPPORTED
+ hcd_isr(controller_id);
+#endif
+
+#ifdef TUSB_CFG_DEVICE
+ dcd_isr(controller_id);
+#endif
+
+}