14#ifndef ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
15#define ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
17#if !defined(_ASMLANGUAGE)
29void _isr_wrapper(
void);
32void z_irq_spurious(
const void *unused);
39struct _isr_table_entry {
41 void (*isr)(
const void *);
47extern struct _isr_table_entry _sw_isr_table[];
49struct _irq_parent_entry {
71#define Z_SW_ISR_TBL_KCONFIG_BY_ALVL(l) CONCAT(CONFIG_, CONCAT(Z_STR_L, l), _LVL_ISR_TBL_OFFSET)
85#define INTC_BASE_ISR_TBL_OFFSET(node_id) \
86 Z_SW_ISR_TBL_KCONFIG_BY_ALVL(DT_INTC_GET_AGGREGATOR_LEVEL(node_id))
95#define INTC_INST_ISR_TBL_OFFSET(inst) \
96 (INTC_BASE_ISR_TBL_OFFSET(DT_DRV_INST(inst)) + (inst * CONFIG_MAX_IRQ_PER_AGGREGATOR))
108#define INTC_CHILD_ISR_TBL_OFFSET(node_id) \
109 (INTC_BASE_ISR_TBL_OFFSET(node_id) + \
110 (DT_NODE_CHILD_IDX(node_id) * CONFIG_MAX_IRQ_PER_AGGREGATOR))
121#define IRQ_PARENT_ENTRY_DEFINE(_name, _dev, _irq, _offset, _level) \
122 static const STRUCT_SECTION_ITERABLE_ALTERNATE(intc_table, _irq_parent_entry, _name) = { \
159struct _isr_list_sname {
168#ifdef CONFIG_SHARED_INTERRUPTS
169struct z_shared_isr_table_entry {
170 struct _isr_table_entry clients[CONFIG_SHARED_IRQ_MAX_NUM_CLIENTS];
174void z_shared_isr(
const void *data);
176extern struct z_shared_isr_table_entry z_shared_sw_isr_table[];
180#define ISR_FLAG_DIRECT BIT(0)
182#define _MK_ISR_NAME(x, y) __MK_ISR_NAME(x, y)
183#define __MK_ISR_NAME(x, y) __isr_ ## x ## _irq_ ## y
186#if defined(CONFIG_ISR_TABLES_LOCAL_DECLARATION)
188#define _MK_ISR_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id)
189#define __MK_ISR_ELEMENT_NAME(func, id) __isr_table_entry_ ## func ## _irq_ ## id
191#define _MK_IRQ_ELEMENT_NAME(func, id) __MK_ISR_ELEMENT_NAME(func, id)
192#define __MK_IRQ_ELEMENT_NAME(func, id) __irq_table_entry_ ## func ## _irq_ ## id
194#define _MK_ISR_SECTION_NAME(prefix, file, counter) \
195 "." Z_STRINGIFY(prefix)"."file"." Z_STRINGIFY(counter)
197#define _MK_ISR_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(irq, __FILE__, counter)
198#define _MK_IRQ_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(isr, __FILE__, counter)
203#define _Z_ISR_TABLE_ENTRY(irq, func, param, sect) \
204 static Z_DECL_ALIGN(struct _isr_table_entry) \
205 __attribute__((section(sect))) \
206 __used _MK_ISR_ELEMENT_NAME(func, __COUNTER__) = { \
207 .arg = (const void *)(param), \
208 .isr = (void (*)(const void *))(void *)(func) \
211#define Z_ISR_DECLARE_C(irq, flags, func, param, counter) \
212 _Z_ISR_DECLARE_C(irq, flags, func, param, counter)
214#define _Z_ISR_DECLARE_C(irq, flags, func, param, counter) \
215 _Z_ISR_TABLE_ENTRY(irq, func, param, _MK_ISR_ELEMENT_SECTION(counter)); \
216 static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \
217 __used _MK_ISR_NAME(func, counter) = \
218 {irq, flags, _MK_ISR_ELEMENT_SECTION(counter)}
225#define Z_ISR_DECLARE(irq, flags, func, param) \
226 BUILD_ASSERT(((flags) & ISR_FLAG_DIRECT) == 0, "Use Z_ISR_DECLARE_DIRECT macro"); \
227 Z_ISR_DECLARE_C(irq, flags, func, param, __COUNTER__)
233#define _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, sect) \
234 COND_CODE_1(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS, ( \
235 static Z_DECL_ALIGN(uintptr_t) \
236 __attribute__((section(sect))) \
237 __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__) = ((uintptr_t)(func)); \
239 static void __attribute__((section(sect))) __attribute__((naked)) \
240 __used _MK_IRQ_ELEMENT_NAME(func, __COUNTER__)(void) { \
241 __asm(ARCH_IRQ_VECTOR_JUMP_CODE(func)); \
245#define Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \
246 _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter)
248#define _Z_ISR_DECLARE_DIRECT_C(irq, flags, func, counter) \
249 _Z_ISR_DIRECT_TABLE_ENTRY(irq, func, _MK_IRQ_ELEMENT_SECTION(counter)); \
250 static struct _isr_list_sname Z_GENERIC_SECTION(.intList) \
251 __used _MK_ISR_NAME(func, counter) = { \
253 ISR_FLAG_DIRECT | (flags), \
254 _MK_IRQ_ELEMENT_SECTION(counter)}
260#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \
261 BUILD_ASSERT(IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_ADDRESS) || \
262 IS_ENABLED(CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_CODE), \
263 "CONFIG_IRQ_VECTOR_TABLE_JUMP_BY_{ADDRESS,CODE} not set"); \
264 Z_ISR_DECLARE_DIRECT_C(irq, flags, func, __COUNTER__)
273#define Z_ISR_DECLARE(irq, flags, func, param) \
274 static Z_DECL_ALIGN(struct _isr_list) Z_GENERIC_SECTION(.intList) \
275 __used _MK_ISR_NAME(func, __COUNTER__) = \
276 {irq, flags, (void *)&func, (const void *)param}
281#define Z_ISR_DECLARE_DIRECT(irq, flags, func) \
282 Z_ISR_DECLARE(irq, ISR_FLAG_DIRECT | (flags), func, NULL)
286#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
288#ifdef CONFIG_DYNAMIC_INTERRUPTS
289void z_isr_install(
unsigned int irq,
void (*routine)(
const void *),
292#ifdef CONFIG_SHARED_INTERRUPTS
293int 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:403