Zephyr Project API  3.3.0
A Scalable Open Source RTOS
sw_isr_table.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014, Wind River Systems, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
15#define ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
16
17#if !defined(_ASMLANGUAGE)
18#include <zephyr/types.h>
19#include <zephyr/toolchain.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/* Default vector for the IRQ vector table */
26extern void _isr_wrapper(void);
27
28/* Spurious interrupt handler. Throws an error if called */
29extern void z_irq_spurious(const void *unused);
30
31/*
32 * Note the order: arg first, then ISR. This allows a table entry to be
33 * loaded arg -> r0, isr -> r3 in _isr_wrapper with one ldmia instruction,
34 * on ARM Cortex-M (Thumb2).
35 */
36struct _isr_table_entry {
37 const void *arg;
38 void (*isr)(const void *);
39};
40
41/* The software ISR table itself, an array of these structures indexed by the
42 * irq line
43 */
44extern struct _isr_table_entry _sw_isr_table[];
45
46/*
47 * Data structure created in a special binary .intlist section for each
48 * configured interrupt. gen_irq_tables.py pulls this out of the binary and
49 * uses it to create the IRQ vector table and the _sw_isr_table.
50 *
51 * More discussion in include/linker/intlist.ld
52 */
53struct _isr_list {
55 int32_t irq;
59 void *func;
61 const void *param;
62};
63
65#define ISR_FLAG_DIRECT BIT(0)
66
67#define _MK_ISR_NAME(x, y) __MK_ISR_NAME(x, y)
68#define __MK_ISR_NAME(x, y) __isr_ ## x ## _irq_ ## y
69
70/* Create an instance of struct _isr_list which gets put in the .intList
71 * section. This gets consumed by gen_isr_tables.py which creates the vector
72 * and/or SW ISR tables.
73 */
74#define Z_ISR_DECLARE(irq, flags, func, param) \
75 static Z_DECL_ALIGN(struct _isr_list) Z_GENERIC_SECTION(.intList) \
76 __used _MK_ISR_NAME(func, __COUNTER__) = \
77 {irq, flags, (void *)&func, (const void *)param}
78
79#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
80
81#ifdef CONFIG_DYNAMIC_INTERRUPTS
82void z_isr_install(unsigned int irq, void (*routine)(const void *),
83 const void *param);
84#endif
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* _ASMLANGUAGE */
91
92#endif /* ZEPHYR_INCLUDE_SW_ISR_TABLE_H_ */
flags
Definition: parser.h:96
__INT32_TYPE__ int32_t
Definition: stdint.h:74
Macros to abstract toolchain specific capabilities.