1+ /*
2+ * Copyright (c) 2023-2025, RT-Thread Development Team
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ *
6+ * Change Logs:
7+ * Date Author Notes
8+ * 2023-03-01 Yaochenger The first version
9+ * 2023-03-19 flyingcys Add support for rv32e
10+ * 2023-03-29 flyingcys return old handler when install new one for rt_hw_interrupt_install
11+ * 2023-06-08 Liu,Yuan remove unused variables
12+ * 2025-01-27 Chen Wang fix build warnings
13+ * 2025-12-11 HPMicro allow overriding the ISR numbers
14+ */
115#include <rthw.h>
216#include <rtthread.h>
317#include "riscv-ops.h"
418#include "rt_hw_stack_frame.h"
519
6- #define ISR_NUMBER 32
20+ #ifndef RT_HW_ISR_NUM
21+ #define RT_HW_ISR_NUM 32
22+ #endif
723static volatile rt_hw_stack_frame_t * s_stack_frame ;
8- static struct rt_irq_desc rv32irq_table [ISR_NUMBER ];
24+ static struct rt_irq_desc rv32irq_table [RT_HW_ISR_NUM ];
925void rt_show_stack_frame (void );
1026
1127/**
@@ -27,7 +43,7 @@ rt_weak void rt_hw_interrupt_init(void)
2743{
2844 int idx = 0 ;
2945
30- for (idx = 0 ; idx < ISR_NUMBER ; idx ++ )
46+ for (idx = 0 ; idx < RT_HW_ISR_NUM ; idx ++ )
3147 {
3248 rv32irq_table [idx ].handler = (rt_isr_handler_t )rt_hw_interrupt_handle ;
3349 rv32irq_table [idx ].param = RT_NULL ;
@@ -48,7 +64,7 @@ rt_weak rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t ha
4864{
4965 rt_isr_handler_t old_handler = RT_NULL ;
5066
51- if (vector < ISR_NUMBER )
67+ if (vector < RT_HW_ISR_NUM )
5268 {
5369 old_handler = rv32irq_table [vector ].handler ;
5470 if (handler != RT_NULL )
0 commit comments