summaryrefslogtreecommitdiff
path: root/hw/bsp/mcx
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-10-10 16:22:12 +0700
committerhathach <[email protected]>2024-10-10 16:28:36 +0700
commit57aac432b52df6d284c98daf591e661d1c55aa05 (patch)
tree1e980f0c18f558e3041dbef3021afa346297a85d /hw/bsp/mcx
parentffdf81f53a84111a2536defa86e4a637c3c46854 (diff)
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
Diffstat (limited to 'hw/bsp/mcx')
-rw-r--r--hw/bsp/mcx/family.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/hw/bsp/mcx/family.c b/hw/bsp/mcx/family.c
index cc675a49d..ce54097fe 100644
--- a/hw/bsp/mcx/family.c
+++ b/hw/bsp/mcx/family.c
@@ -34,38 +34,22 @@
#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