|
17 | 17 | * number from 16 to last IRQ number on the platform. |
18 | 18 | */ |
19 | 19 |
|
| 20 | +#include "sw_isr_common.h" |
| 21 | + |
20 | 22 | #include <zephyr/kernel.h> |
21 | 23 | #include <zephyr/arch/cpu.h> |
22 | 24 | #include <zephyr/sys/__assert.h> |
|
25 | 27 | #include <zephyr/sw_isr_table.h> |
26 | 28 | #include <zephyr/irq.h> |
27 | 29 | #include <zephyr/sys/printk.h> |
28 | | - |
| 30 | +#include <zephyr/irq_multilevel.h> |
| 31 | +#include <zephyr/irq_nextlevel.h> |
29 | 32 |
|
30 | 33 | /* |
31 | 34 | * storage space for the interrupt stack of fast_irq |
@@ -187,11 +190,50 @@ int arch_irq_is_enabled(unsigned int irq) |
187 | 190 | #else |
188 | 191 | void arch_irq_enable(unsigned int irq) |
189 | 192 | { |
| 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 |
190 | 212 | z_arc_v2_irq_unit_int_enable(irq); |
191 | 213 | } |
192 | 214 |
|
193 | 215 | void arch_irq_disable(unsigned int irq) |
194 | 216 | { |
| 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 | + |
195 | 237 | z_arc_v2_irq_unit_int_disable(irq); |
196 | 238 | } |
197 | 239 |
|
|
0 commit comments