remove tusb_isr(), rename hal_hcd_isr() and hal_dcd_isr()

This commit is contained in:
hathach 2018-03-06 17:38:35 +07:00
parent 98f12c9833
commit fce85875c4
13 changed files with 32 additions and 34 deletions

View File

@ -75,7 +75,7 @@ bool hal_usb_init(void)
void USB_IRQHandler(void) void USB_IRQHandler(void)
{ {
tusb_isr(0); hal_dcd_isr(0);
} }
#endif #endif

View File

@ -74,7 +74,7 @@ bool hal_usb_init(void)
void USB_IRQHandler(void) void USB_IRQHandler(void)
{ {
tusb_isr(0); hal_dcd_isr(0);
} }

View File

@ -102,7 +102,13 @@ bool hal_usb_init(void)
void USB_IRQHandler(void) void USB_IRQHandler(void)
{ {
tusb_isr(0); #if MODE_HOST_SUPPORTED
hal_hcd_isr(0);
#endif
#if MODE_DEVICE_SUPPORTED
hal_dcd_isr(0);
#endif
} }
#endif #endif

View File

@ -512,7 +512,7 @@ void xfer_complete_isr(uint8_t coreid, uint32_t reg_complete)
} }
} }
void dcd_isr(uint8_t coreid) void hal_dcd_isr(uint8_t coreid)
{ {
LPC_USB0_Type* const lpc_usb = LPC_USB[coreid]; LPC_USB0_Type* const lpc_usb = LPC_USB[coreid];

View File

@ -127,17 +127,31 @@ bool hal_usb_init(void)
return true; return true;
} }
void hal_dcd_isr(uint8_t coreid);
#if TUSB_CFG_CONTROLLER_0_MODE #if TUSB_CFG_CONTROLLER_0_MODE
void USB0_IRQHandler(void) void USB0_IRQHandler(void)
{ {
tusb_isr(0); #if MODE_HOST_SUPPORTED
hal_hcd_isr(0);
#endif
#if MODE_DEVICE_SUPPORTED
hal_dcd_isr(0);
#endif
} }
#endif #endif
#if TUSB_CFG_CONTROLLER_1_MODE #if TUSB_CFG_CONTROLLER_1_MODE
void USB1_IRQHandler(void) void USB1_IRQHandler(void)
{ {
tusb_isr(1); #if MODE_HOST_SUPPORTED
hal_hcd_isr(1);
#endif
#if MODE_DEVICE_SUPPORTED
hal_dcd_isr(1);
#endif
} }
#endif #endif

View File

@ -68,9 +68,6 @@ static inline bool endpointhandle_is_equal(endpoint_handle_t x, endpoint_handle_
return (x.coreid == y.coreid) && (x.index == y.index); return (x.coreid == y.coreid) && (x.index == y.index);
} }
void dcd_isr(uint8_t coreid);
//------------- Controller API -------------// //------------- Controller API -------------//
bool hal_dcd_init (uint8_t coreid); bool hal_dcd_init (uint8_t coreid);
void hal_dcd_connect (uint8_t coreid); void hal_dcd_connect (uint8_t coreid);

View File

@ -216,7 +216,7 @@ static void endpoint_control_isr(void)
LPC_USB->USBEpIntClr = endpoint_int_status; // acknowledge interrupt TODO cannot immediately acknowledge setup packet LPC_USB->USBEpIntClr = endpoint_int_status; // acknowledge interrupt TODO cannot immediately acknowledge setup packet
} }
void dcd_isr(uint8_t coreid) void hal_dcd_isr(uint8_t coreid)
{ {
(void) coreid; (void) coreid;
uint32_t const device_int_enable = LPC_USB->USBDevIntEn; uint32_t const device_int_enable = LPC_USB->USBDevIntEn;
@ -402,7 +402,7 @@ bool hal_dcd_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buff
//------------- Status Phase (opposite direct to Data) -------------// //------------- Status Phase (opposite direct to Data) -------------//
if (dir == TUSB_DIR_HOST_TO_DEV) if (dir == TUSB_DIR_HOST_TO_DEV)
{ // only write for CONTROL OUT, CONTROL IN data will be retrieved in dcd_isr // TODO ???? { // only write for CONTROL OUT, CONTROL IN data will be retrieved in hal_dcd_isr // TODO ????
VERIFY_STATUS ( pipe_control_write(NULL, 0), false ); VERIFY_STATUS ( pipe_control_write(NULL, 0), false );
} }

View File

@ -296,7 +296,7 @@ static void endpoint_control_isr(uint32_t int_status)
} }
} }
void dcd_isr(uint8_t coreid) void hal_dcd_isr(uint8_t coreid)
{ {
(void) coreid; (void) coreid;

View File

@ -730,7 +730,7 @@ static void xfer_error_isr(uint8_t hostid)
} }
//------------- Host Controller Driver's Interrupt Handler -------------// //------------- Host Controller Driver's Interrupt Handler -------------//
void hcd_isr(uint8_t hostid) void hal_hcd_isr(uint8_t hostid)
{ {
ehci_registers_t* const regs = get_operational_register(hostid); ehci_registers_t* const regs = get_operational_register(hostid);

View File

@ -85,7 +85,7 @@ static inline bool pipehandle_is_equal(pipe_handle_t x, pipe_handle_t y)
// USBH-HCD API // USBH-HCD API
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
tusb_error_t hcd_init(void) ATTR_WARN_UNUSED_RESULT; tusb_error_t hcd_init(void) ATTR_WARN_UNUSED_RESULT;
void hcd_isr(uint8_t hostid); void hal_hcd_isr(uint8_t hostid);
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// PIPE API // PIPE API

View File

@ -658,7 +658,7 @@ static void done_queue_isr(uint8_t hostid)
} }
} }
void hcd_isr(uint8_t hostid) void hal_hcd_isr(uint8_t hostid)
{ {
uint32_t const int_en = OHCI_REG->interrupt_enable; uint32_t const int_en = OHCI_REG->interrupt_enable;
uint32_t const int_status = OHCI_REG->interrupt_status & int_en; uint32_t const int_status = OHCI_REG->interrupt_status & int_en;

View File

@ -63,23 +63,6 @@ tusb_error_t tusb_init(void)
return TUSB_ERROR_NONE; return TUSB_ERROR_NONE;
} }
/** \ingroup group_application_api
* \brief USB interrupt handler
* \param[in] coreid Controller ID where the interrupt happened
* \note This function must be called by HAL layer or Application for the stack to manage USB events/transfers.
*/
void tusb_isr(uint8_t coreid)
{
#if MODE_HOST_SUPPORTED
hcd_isr(coreid);
#endif
#if MODE_DEVICE_SUPPORTED
dcd_isr(coreid);
#endif
}
#if TUSB_CFG_OS == TUSB_OS_NONE #if TUSB_CFG_OS == TUSB_OS_NONE
void tusb_task_runner(void) void tusb_task_runner(void)
{ {

View File

@ -102,8 +102,6 @@
*/ */
tusb_error_t tusb_init(void); tusb_error_t tusb_init(void);
void tusb_isr(uint8_t coreid);
#if TUSB_CFG_OS == TUSB_OS_NONE #if TUSB_CFG_OS == TUSB_OS_NONE
/** \brief Run all tinyusb's internal tasks (e.g host task, device task). /** \brief Run all tinyusb's internal tasks (e.g host task, device task).
* \note This function is only required when using no RTOS (\ref TUSB_CFG_OS == TUSB_OS_NONE). All the stack functions * \note This function is only required when using no RTOS (\ref TUSB_CFG_OS == TUSB_OS_NONE). All the stack functions