mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-23 04:20:47 +00:00
abstract call chains from hal usb isr
This commit is contained in:
parent
a259be6edf
commit
2c8596edeb
@ -79,12 +79,10 @@
|
|||||||
|
|
||||||
// Test support
|
// Test support
|
||||||
#define CONTROLLER_HOST_START_INDEX ( ((CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)) ? 1 : 0)
|
#define CONTROLLER_HOST_START_INDEX ( ((CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)) ? 1 : 0)
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// DEVICE CONFIGURATION
|
// DEVICE CONFIGURATION
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
//#define TUSB_CFG_DEVICE
|
|
||||||
|
|
||||||
//------------- CORE/CONTROLLER -------------//
|
|
||||||
|
|
||||||
//------------- CLASS -------------//
|
//------------- CLASS -------------//
|
||||||
//#define TUSB_CFG_DEVICE_CDC
|
//#define TUSB_CFG_DEVICE_CDC
|
||||||
|
@ -68,6 +68,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// callback from tusb.h
|
||||||
|
extern void tusb_isr(uint8_t controller_id);
|
||||||
|
|
||||||
|
|
||||||
/** \brief USB hardware init
|
/** \brief USB hardware init
|
||||||
*
|
*
|
||||||
* \param[in] para1
|
* \param[in] para1
|
||||||
|
@ -54,4 +54,18 @@ tusb_error_t hal_init()
|
|||||||
return TUSB_ERROR_NONE;
|
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
|
#endif
|
||||||
|
@ -61,9 +61,6 @@
|
|||||||
#define DEVICE_ROM_REG_BASE LPC_USB0_BASE // TODO USB1
|
#define DEVICE_ROM_REG_BASE LPC_USB0_BASE // TODO USB1
|
||||||
#define DEVICE_ROM_DRIVER_ADDR 0x1040011C
|
#define DEVICE_ROM_DRIVER_ADDR 0x1040011C
|
||||||
|
|
||||||
#define tusb_1st_isr USB0_IRQHandler
|
|
||||||
#define tusb_2nd_isr
|
|
||||||
|
|
||||||
static inline void hal_interrupt_enable()
|
static inline void hal_interrupt_enable()
|
||||||
{
|
{
|
||||||
NVIC_EnableIRQ(USB0_IRQn); // TODO USB1
|
NVIC_EnableIRQ(USB0_IRQn); // TODO USB1
|
||||||
|
@ -128,6 +128,11 @@ tusb_error_t hcd_init(void)
|
|||||||
return TUSB_ERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hcd_isr(uint8_t hostid)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Controller API
|
// Controller API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -91,11 +91,6 @@
|
|||||||
#error EHCI_CFG_FRAMELIST_SIZE_BITS must be from 0-7
|
#error EHCI_CFG_FRAMELIST_SIZE_BITS must be from 0-7
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
// USBH-HCD API
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
void hcd_isr(uint8_t hostid);
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// EHCI Data Structure
|
// EHCI Data Structure
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -67,6 +67,7 @@ typedef uint32_t pipe_handle_t;
|
|||||||
// USBH-HCD API
|
// USBH-HCD API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
tusb_error_t hcd_init() ATTR_WARN_UNUSED_RESULT;
|
tusb_error_t hcd_init() ATTR_WARN_UNUSED_RESULT;
|
||||||
|
void hcd_isr(uint8_t hostid);
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// PIPE API
|
// PIPE API
|
||||||
|
@ -54,3 +54,15 @@ tusb_error_t tusb_init(void)
|
|||||||
return TUSB_ERROR_NONE;
|
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
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user