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:
hathach
2024-10-10 16:22:12 +07:00
parent ffdf81f53a
commit 57aac432b5
59 changed files with 192 additions and 286 deletions

View File

@@ -1,6 +1,7 @@
set(MCU_VARIANT MIMXRT1062)
set(JLINK_DEVICE MIMXRT1062xxx6A)
#set(JLINK_OPTION "-USB 000726129165")
set(PYOCD_TARGET mimxrt1060)
set(NXPLINK_DEVICE MIMXRT1062xxxxA:EVK-MIMXRT1060)

View File

@@ -46,18 +46,6 @@
#pragma GCC diagnostic pop
#endif
#if defined(BOARD_TUD_RHPORT) && CFG_TUD_ENABLED
#define PORT_SUPPORT_DEVICE(_n) (BOARD_TUD_RHPORT == _n)
#else
#define PORT_SUPPORT_DEVICE(_n) 0
#endif
#if defined(BOARD_TUH_RHPORT) && CFG_TUH_ENABLED
#define PORT_SUPPORT_HOST(_n) (BOARD_TUH_RHPORT == _n)
#else
#define PORT_SUPPORT_HOST(_n) 0
#endif
// needed by fsl_flexspi_nor_boot
TU_ATTR_USED const uint8_t dcd_data[] = { 0x00 };
@@ -156,23 +144,11 @@ void board_init(void)
// USB Interrupt Handler
//--------------------------------------------------------------------+
void USB_OTG1_IRQHandler(void) {
#if PORT_SUPPORT_DEVICE(0)
tud_int_handler(0);
#endif
#if PORT_SUPPORT_HOST(0)
tuh_int_handler(0, true);
#endif
tusb_int_handler(0, true);
}
void USB_OTG2_IRQHandler(void) {
#if PORT_SUPPORT_DEVICE(1)
tud_int_handler(1);
#endif
#if PORT_SUPPORT_HOST(1)
tuh_int_handler(1, true);
#endif
tusb_int_handler(1, true);
}
//--------------------------------------------------------------------+