add new tusb_int_handler(rhport, in_isr) as common irq handler
update tusb_init() to take rhport and role, defined as macro with optional argument for backward compatible
This commit is contained in:
@@ -33,39 +33,23 @@
|
||||
#include "pin_mux.h"
|
||||
#include "clock_config.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#ifdef BOARD_TUD_RHPORT
|
||||
#define PORT_SUPPORT_DEVICE(_n) (BOARD_TUD_RHPORT == _n)
|
||||
#else
|
||||
#define PORT_SUPPORT_DEVICE(_n) 0
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_TUH_RHPORT
|
||||
#define PORT_SUPPORT_HOST(_n) (BOARD_TUH_RHPORT == _n)
|
||||
#else
|
||||
#define PORT_SUPPORT_HOST(_n) 0
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_MCXN9
|
||||
void USB0_FS_IRQHandler(void) {
|
||||
tud_int_handler(0);
|
||||
tusb_int_handler(0, true);
|
||||
}
|
||||
|
||||
void USB1_HS_IRQHandler(void) {
|
||||
tud_int_handler(1);
|
||||
tusb_int_handler(1, true);
|
||||
}
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MCXA15
|
||||
|
||||
void USB0_IRQHandler(void) {
|
||||
tud_int_handler(0);
|
||||
tusb_int_handler(0, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -133,7 +117,7 @@ void board_init(void) {
|
||||
// USB VBUS
|
||||
/* PORT0 PIN22 configured as USB0_VBUS */
|
||||
|
||||
#if PORT_SUPPORT_DEVICE(0)
|
||||
#if defined(BOARD_TUD_RHPORT) && BOARD_TUD_RHPORT == 0
|
||||
// Port0 is Full Speed
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_MCXA15
|
||||
@@ -147,7 +131,7 @@ void board_init(void) {
|
||||
CLOCK_EnableUsbfsClock();
|
||||
#endif
|
||||
|
||||
#if PORT_SUPPORT_DEVICE(1) && (CFG_TUSB_MCU == OPT_MCU_MCXN9)
|
||||
#if defined(BOARD_TUD_RHPORT) && BOARD_TUD_RHPORT == 1 && (CFG_TUSB_MCU == OPT_MCU_MCXN9)
|
||||
// Port1 is High Speed
|
||||
|
||||
// Power
|
||||
|
Reference in New Issue
Block a user