11#ifndef ZEPHYR_INCLUDE_IRQ_MULTILEVEL_H_
12#define ZEPHYR_INCLUDE_IRQ_MULTILEVEL_H_
23#if defined(CONFIG_MULTI_LEVEL_INTERRUPTS) || defined(__DOXYGEN__)
35 CONFIG_1ST_LEVEL_INTERRUPT_BITS;
37 (CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS);
39 if (
IS_ENABLED(CONFIG_3RD_LEVEL_INTERRUPTS) && (irq & mask3) != 0) {
43 if (
IS_ENABLED(CONFIG_2ND_LEVEL_INTERRUPTS) && (irq & mask2) != 0) {
63 return ((irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) &
64 BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS)) - 1;
66 return (irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) - 1;
77#define IRQ_TO_L2(irq) ((irq + 1) << CONFIG_1ST_LEVEL_INTERRUPT_BITS)
108 return irq &
BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS);
124 return (irq >> (CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS)) - 1;
134#define IRQ_TO_L3(irq) \
135 ((irq + 1) << (CONFIG_1ST_LEVEL_INTERRUPT_BITS + CONFIG_2ND_LEVEL_INTERRUPT_BITS))
166 return (irq >> CONFIG_1ST_LEVEL_INTERRUPT_BITS) &
167 BIT_MASK(CONFIG_2ND_LEVEL_INTERRUPT_BITS);
182 }
else if (level == 2) {
184 }
else if (level == 3) {
189 __ASSERT_NO_MSG(
false);
201static inline unsigned int irq_to_level(
unsigned int irq,
unsigned int level)
205 }
else if (level == 2) {
207 }
else if (level == 3) {
212 __ASSERT_NO_MSG(
false);
229 }
else if (level == 2) {
231 }
else if (level == 3) {
236 __ASSERT_NO_MSG(
false);
251 __ASSERT_NO_MSG(level > 1 && level <= 3);
253 return irq &
BIT_MASK(CONFIG_1ST_LEVEL_INTERRUPT_BITS +
254 (level == 3 ? CONFIG_2ND_LEVEL_INTERRUPT_BITS : 0));
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:124
#define BIT_MASK(n)
Bit mask with bits 0 through n-1 (inclusive) set, or 0 if n is 0.
Definition util_macro.h:68
static unsigned int irq_from_level(unsigned int irq, unsigned int level)
Return the interrupt number for a given level.
Definition irq_multilevel.h:178
#define IRQ_TO_L3(irq)
Preprocessor macro to convert irq from level 1 to level 3 format.
Definition irq_multilevel.h:134
static unsigned int irq_to_level_3(unsigned int irq)
Converts irq from level 1 to level 3 format.
Definition irq_multilevel.h:149
static unsigned int irq_from_level_3(unsigned int irq)
Return the 3rd level interrupt number.
Definition irq_multilevel.h:122
static unsigned int irq_from_level_2(unsigned int irq)
Return the 2nd level interrupt number.
Definition irq_multilevel.h:60
static unsigned int irq_get_level(unsigned int irq)
Return IRQ level This routine returns the interrupt level number of the provided interrupt.
Definition irq_multilevel.h:32
static unsigned int irq_to_level_2(unsigned int irq)
Converts irq from level 1 to level 2 format.
Definition irq_multilevel.h:91
static unsigned int irq_parent_level(unsigned int irq, unsigned int level)
Returns the parent IRQ of the given level raw IRQ number.
Definition irq_multilevel.h:224
#define IRQ_TO_L2(irq)
Preprocessor macro to convert irq from level 1 to level 2 format.
Definition irq_multilevel.h:77
static unsigned int irq_get_intc_irq(unsigned int irq)
Returns the parent interrupt controller IRQ of the given IRQ number.
Definition irq_multilevel.h:247
static unsigned int irq_parent_level_2(unsigned int irq)
Returns the parent IRQ of the level 2 raw IRQ number.
Definition irq_multilevel.h:106
static unsigned int irq_parent_level_3(unsigned int irq)
Returns the parent IRQ of the level 3 raw IRQ number.
Definition irq_multilevel.h:164
static unsigned int irq_to_level(unsigned int irq, unsigned int level)
Converts irq from level 1 to a given level.
Definition irq_multilevel.h:201
__UINT32_TYPE__ uint32_t
Definition stdint.h:90