Skip to content

Commit e0220c6

Browse files
committed
fix int handling for host in ek_ra4m3 port
1 parent c529d0b commit e0220c6

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

hw/bsp/ra/boards/ek_ra4m3/ek_ra4m3.c

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,28 +91,52 @@ void usbfs_interrupt_handler(void)
9191
IRQn_Type irq = R_FSP_CurrentIrqGet();
9292
R_BSP_IrqStatusClear(irq);
9393

94+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
95+
tuh_int_handler(0);
96+
#endif
97+
98+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
9499
tud_int_handler(0);
100+
#endif
95101
}
96102
void usbfs_resume_handler(void)
97103
{
98104
IRQn_Type irq = R_FSP_CurrentIrqGet();
99105
R_BSP_IrqStatusClear(irq);
100106

107+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
108+
tuh_int_handler(0);
109+
#endif
110+
111+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
101112
tud_int_handler(0);
113+
#endif
102114
}
103115
void usbfs_d0fifo_handler(void)
104116
{
105117
IRQn_Type irq = R_FSP_CurrentIrqGet();
106118
R_BSP_IrqStatusClear(irq);
107119

120+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
121+
tuh_int_handler(0);
122+
#endif
123+
124+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
108125
tud_int_handler(0);
126+
#endif
109127
}
110128
void usbfs_d1fifo_handler(void)
111129
{
112130
IRQn_Type irq = R_FSP_CurrentIrqGet();
113131
R_BSP_IrqStatusClear(irq);
114132

133+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_HOST
134+
tuh_int_handler(0);
135+
#endif
136+
137+
#if CFG_TUSB_RHPORT0_MODE & OPT_MODE_DEVICE
115138
tud_int_handler(0);
139+
#endif
116140
}
117141

118142
void board_init(void)
@@ -125,17 +149,17 @@ void board_init(void)
125149
R_MSTP->MSTPCRB &= ~(1U << 11U);
126150
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK;
127151

128-
#if CFG_TUSB_OS == OPT_OS_FREERTOS
129-
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
130-
NVIC_SetPriority(TU_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
131-
NVIC_SetPriority(USBFS_RESUME_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
132-
NVIC_SetPriority(USBFS_FIFO_0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
133-
NVIC_SetPriority(USBFS_FIFO_1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
152+
#if CFG_TUSB_OS == OPT_OS_FREERTOS
153+
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
154+
NVIC_SetPriority(TU_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
155+
NVIC_SetPriority(USBFS_RESUME_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
156+
NVIC_SetPriority(USBFS_FIFO_0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
157+
NVIC_SetPriority(USBFS_FIFO_1_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
134158
#endif
135159

136160
#if CFG_TUSB_OS == OPT_OS_NONE
137161
/* Init systick */
138-
SysTick_Config(SystemCoreClock / 1000);
162+
SysTick_Config(SystemCoreClock / 1000);
139163
#endif
140164
}
141165

0 commit comments

Comments
 (0)