fix int handling for host in ek_ra4m3 port

This commit is contained in:
Rafael Silva 2022-03-21 15:59:08 +00:00
parent c529d0b440
commit e0220c6594
1 changed files with 31 additions and 7 deletions

View File

@ -91,28 +91,52 @@ void usbfs_interrupt_handler(void)
IRQn_Type irq = R_FSP_CurrentIrqGet(); IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq); R_BSP_IrqStatusClear(irq);
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
tuh_int_handler(0);
#endif
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
tud_int_handler(0); tud_int_handler(0);
#endif
} }
void usbfs_resume_handler(void) void usbfs_resume_handler(void)
{ {
IRQn_Type irq = R_FSP_CurrentIrqGet(); IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq); R_BSP_IrqStatusClear(irq);
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
tuh_int_handler(0);
#endif
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
tud_int_handler(0); tud_int_handler(0);
#endif
} }
void usbfs_d0fifo_handler(void) void usbfs_d0fifo_handler(void)
{ {
IRQn_Type irq = R_FSP_CurrentIrqGet(); IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq); R_BSP_IrqStatusClear(irq);
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
tuh_int_handler(0);
#endif
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
tud_int_handler(0); tud_int_handler(0);
#endif
} }
void usbfs_d1fifo_handler(void) void usbfs_d1fifo_handler(void)
{ {
IRQn_Type irq = R_FSP_CurrentIrqGet(); IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq); R_BSP_IrqStatusClear(irq);
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
tuh_int_handler(0);
#endif
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
tud_int_handler(0); tud_int_handler(0);
#endif
} }
void board_init(void) void board_init(void)
@ -125,17 +149,17 @@ void board_init(void)
R_MSTP->MSTPCRB &= ~(1U << 11U); R_MSTP->MSTPCRB &= ~(1U << 11U);
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK; R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK;
#if CFG_TUSB_OS == OPT_OS_FREERTOS #if CFG_TUSB_OS == OPT_OS_FREERTOS
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher ) // If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
NVIC_SetPriority(TU_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY); NVIC_SetPriority(TU_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USBFS_RESUME_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY); NVIC_SetPriority(USBFS_RESUME_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USBFS_FIFO_0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY); NVIC_SetPriority(USBFS_FIFO_0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(USBFS_FIFO_1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY); NVIC_SetPriority(USBFS_FIFO_1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
#endif #endif
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_NONE
/* Init systick */ /* Init systick */
SysTick_Config(SystemCoreClock / 1000); SysTick_Config(SystemCoreClock / 1000);
#endif #endif
} }