Skip to content

Commit 2f77dca

Browse files
committed
arch: arc: add support for multilevel interrupts
Update the arch_irq_enable/disable functions to support multilevel interrupts on the ARC architecture. Signed-off-by: Aaron Fong <[email protected]>
1 parent bb20f35 commit 2f77dca

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

arch/arc/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
zephyr_library()
44

5+
zephyr_library_include_directories(${ZEPHYR_BASE}/arch/common/include)
56
zephyr_library_sources(
67
thread.c
78
thread_entry_wrapper.S

arch/arc/core/irq_manage.c

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* number from 16 to last IRQ number on the platform.
1818
*/
1919

20+
#include "sw_isr_common.h"
21+
2022
#include <zephyr/kernel.h>
2123
#include <zephyr/arch/cpu.h>
2224
#include <zephyr/sys/__assert.h>
@@ -25,7 +27,8 @@
2527
#include <zephyr/sw_isr_table.h>
2628
#include <zephyr/irq.h>
2729
#include <zephyr/sys/printk.h>
28-
30+
#include <zephyr/irq_multilevel.h>
31+
#include <zephyr/irq_nextlevel.h>
2932

3033
/*
3134
* storage space for the interrupt stack of fast_irq
@@ -187,11 +190,50 @@ int arch_irq_is_enabled(unsigned int irq)
187190
#else
188191
void arch_irq_enable(unsigned int irq)
189192
{
193+
#ifdef CONFIG_MULTI_LEVEL_INTERRUPTS
194+
unsigned int level = irq_get_level(irq);
195+
const struct device *dev;
196+
197+
#ifdef CONFIG_3RD_LEVEL_INTERRUPTS
198+
if (level == 3) {
199+
dev = z_get_sw_isr_device_from_irq(irq);
200+
irq_enable_next_level(dev, irq_from_level_3(irq));
201+
return;
202+
}
203+
#endif
204+
#ifdef CONFIG_2ND_LEVEL_INTERRUPTS
205+
if (level == 2) {
206+
dev = z_get_sw_isr_device_from_irq(irq);
207+
irq_enable_next_level(dev, irq_from_level_2(irq));
208+
return;
209+
}
210+
#endif
211+
#endif
190212
z_arc_v2_irq_unit_int_enable(irq);
191213
}
192214

193215
void arch_irq_disable(unsigned int irq)
194216
{
217+
#ifdef CONFIG_MULTI_LEVEL_INTERRUPTS
218+
unsigned int level = irq_get_level(irq);
219+
const struct device *dev;
220+
221+
#ifdef CONFIG_3RD_LEVEL_INTERRUPTS
222+
if (level == 3) {
223+
dev = z_get_sw_isr_device_from_irq(irq);
224+
irq_disable_next_level(dev, irq_from_level_3(irq));
225+
return;
226+
}
227+
#endif
228+
#ifdef CONFIG_2ND_LEVEL_INTERRUPTS
229+
if (level == 2) {
230+
dev = z_get_sw_isr_device_from_irq(irq);
231+
irq_disable_next_level(dev, irq_from_level_2(irq));
232+
return;
233+
}
234+
#endif
235+
#endif
236+
195237
z_arc_v2_irq_unit_int_disable(irq);
196238
}
197239

0 commit comments

Comments
 (0)