summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCYFS <[email protected]>2026-08-28 17:50:18 +0800
committerRbb666 <[email protected]>2026-09-10 17:54:43 +0800
commitbcda4c3d635700b5800f0dff8c2d822c7b8a8186 (patch)
tree76e448c170b426a7dbfedb7b6292cc045754bd14
parent330a987156f67d1f5536e3b475c72181e6050d3f (diff)
[libcpu] Fix RZ/N2L interrupt dispatch
(cherry picked from commit fe966755e9d9b207b9271afd38e5086624328af4)
-rw-r--r--libcpu/arm/cortex-r52/trap.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/libcpu/arm/cortex-r52/trap.c b/libcpu/arm/cortex-r52/trap.c
index e5c217cb73..bdfba716dd 100644
--- a/libcpu/arm/cortex-r52/trap.c
+++ b/libcpu/arm/cortex-r52/trap.c
@@ -12,7 +12,6 @@
#include <gicv3.h>
#include <rtthread.h>
#include <rthw.h>
-//#include <board.h>
#include "interrupt.h"
@@ -257,16 +256,8 @@ void rt_hw_trap_irq(void)
}
#ifdef SOC_SERIES_R9A07G0
- extern fsp_vector_t g_vector_table[BSP_ICU_VECTOR_MAX_ENTRIES];
-
bsp_common_interrupt_handler((uint32_t)ir);
- if (ir < MAX_HANDLERS)
- {
- /* get interrupt service routine */
- isr_table[ir].handler = (rt_isr_handler_t)g_vector_table[ir];
- isr_table[ir].param = RT_NULL;
- }
-#endif
+#else
/* get interrupt service routine */
isr_func = isr_table[ir].handler;
@@ -280,7 +271,7 @@ void rt_hw_trap_irq(void)
/* turn to interrupt service routine */
isr_func(ir, param);
}
-
+#endif
/* end of interrupt */
rt_hw_interrupt_ack(int_ack);
}
@@ -288,31 +279,38 @@ void rt_hw_trap_irq(void)
void rt_hw_trap_fiq(void)
{
void *param;
+ int int_ack;
int ir;
- rt_isr_handler_t isr_func;
+ volatile rt_isr_handler_t isr_func;
extern struct rt_irq_desc isr_table[];
- ir = rt_hw_interrupt_get_irq();
-
-#ifdef SOC_SERIES_R9A07G0
- extern fsp_vector_t g_vector_table[BSP_ICU_VECTOR_MAX_ENTRIES];
+ int_ack = rt_hw_interrupt_get_irq();
- bsp_common_interrupt_handler((uint32_t)ir);
- if (ir < MAX_HANDLERS)
+ ir = int_ack & GIC_ACK_INTID_MASK;
+ if (ir == 1023)
{
- /* get interrupt service routine */
- isr_table[ir].handler = (rt_isr_handler_t)g_vector_table[ir];
- isr_table[ir].param = RT_NULL;
+ /* Spurious interrupt */
+ return;
}
-#endif
+
+#ifdef SOC_SERIES_R9A07G0
+ bsp_common_interrupt_handler((uint32_t)ir);
+#else
/* get interrupt service routine */
isr_func = isr_table[ir].handler;
- param = isr_table[ir].param;
-
- /* turn to interrupt service routine */
- isr_func(ir, param);
+#ifdef RT_USING_INTERRUPT_INFO
+ isr_table[ir].counter++;
+#endif
+ if (isr_func)
+ {
+ /* Interrupt for myself. */
+ param = isr_table[ir].param;
+ /* turn to interrupt service routine */
+ isr_func(ir, param);
+ }
+#endif
/* end of interrupt */
- rt_hw_interrupt_ack(ir);
+ rt_hw_interrupt_ack(int_ack);
}