14#ifndef ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
15#define ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
17#if !defined(_ASMLANGUAGE)
28void _isr_wrapper(
void);
31void z_irq_spurious(
const void *unused);
38struct _isr_table_entry {
40 void (*isr)(
const void *);
46extern struct _isr_table_entry _sw_isr_table[];
48struct _irq_parent_entry {
84struct _isr_list_sname {
93#ifdef CONFIG_SHARED_INTERRUPTS
94struct z_shared_isr_table_entry {
95 struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS];
99void z_shared_isr(
const void *data);
101extern struct z_shared_isr_table_entry z_shared_sw_isr_table[];
105#define ISR_FLAG_DIRECT BIT(0)
107#define _MK_ISR_NAME(x, y) __MK_ISR_NAME(x, y)
108#define __MK_ISR_NAME(x, y) __isr_ ## x ## _irq_ ## y
111#if IS_ENABLED(CONFIG_ISR_TABLES_LOCAL_DECLARATION)
113#define _MK_ISR_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id)
114#define __MK_ISR_ELEMENT_NAME(func, id) __isr_table_entry_ ## func ## _irq_ ## id
116#define _MK_IRQ_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id)
117#define __MK_IRQ_ELEMENT_NAME(func, id) __irq_table_entry_ ## func ## _irq_ ## id
119#define _MK_ISR_SECTION_NAME(prefix, file, counter) \
120 "." Z_STRINGIFY(prefix)"."file"." Z_STRINGIFY(counter)
122#define _MK_ISR_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(irq, __FILE__, counter)
123#define _MK_IRQ_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(isr, __FILE__, counter)
128#define _Z_ISR_TABLE_ENTRY(irq, func, param, sect) \
129 static Z_DECL_ALIGN(struct _isr_table_entry) \
130 __attribute__((section(sect))) \
131 __used _MK_ISR_ELEMENT_NAME(func, __COUNTER__) = { \
132 .arg = (const void *)(param), \
133 .isr = (void (*)(const void *))(void *)(func) \
136#define Z_ISR_DECLARE_C(irq, flags, func, param, counter) \
137 _Z_ISR_DECLARE_C(irq, flags, func, param, counter)
139#define _Z_ISR_DECLARE_C(irq, flags, func, param, counter) \
140 _Z_ISR_TABLE_ENTRY(irq, func, param, _MK_ISR_ELEMENT_SECTION(counter)); \
141 static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \
142 __used _MK_ISR_NAME(func, counter) = \
143 {irq, flags, _MK_ISR_ELEMENT_SECTION(counter)}
150#define Z_ISR_DECLARE(irq, flags, func, param) \
151 BUILD_ASSERT(((flags) & ISR_FLAG_DIRECT) == 0, "Use Z_ISR_DECLARE_DIRECT macro"); \
152 Z_ISR_DECLARE_C(irq, flags, func, param, __COUNTER__)
158#define _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, sect) \
159 COND_CODE_1(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS, ( \
160 static Z_DECL_ALIGN(uintptr_t) \
161 __attribute__((section(sect))) \
162 __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__) = ((uintptr_t)(func)); \
164 static void __attribute__((section(sect))) __attribute__((naked)) \
165 __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__)(void) { \
166 __asm(ARCH_IRQ_VECTOR_JUMP_CODE(func)); \
170#define Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \
171 _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter)
173#define _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \
174 _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, _MK_IRQ_ELEMENT_SECTION(counter)); \
175 static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \
176 __used _MK_ISR_NAME(func, counter) = { \
178 ISR_FLAG_DIRECT | (flags), \
179 _MK_IRQ_ELEMENT_SECTION(counter)}
185#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \
186 BUILD_ASSERT(IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS) || \
187 IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE), \
188 "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set"); \
189 Z_ISR_DECLARE_DIRECT_C(irq, flags, func, __COUNTER__)
198#define Z_ISR_DECLARE(irq, flags, func, param) \
199 static Z_DECL_ALIGN(struct _isr_list) Z_GENERIC_SECTION(.intList) \
200 __used _MK_ISR_NAME(func, __COUNTER__) = \
201 {irq, flags, (void *)&func, (const void *)param}
206#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \
207 Z_ISR_DECLARE(irq, ISR_FLAG_DIRECT | (flags), func, NULL)
211#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
213#ifdef CONFIG_DYNAMIC_INTERRUPTS
214void z_isr_install(
unsigned int irq,
void (*routine)(
const void *),
217#ifdef CONFIG_SHARED_INTERRUPTS
218int z_isr_uninstall(
unsigned int irq,
void (*routine)(
const void *),
flags
Definition: parser.h:96
__INT32_TYPE__ int32_t
Definition: stdint.h:74
Runtime device structure (in ROM) per driver instance.
Definition: device.h:399