2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014, Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2015-12-04 23:09:39 +08:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Software-managed ISR table
|
|
|
|
*
|
2015-10-21 00:42:33 +08:00
|
|
|
* Data types for a software-managed ISR table, with a parameter per-ISR.
|
2015-07-02 05:22:39 +08:00
|
|
|
*/
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
|
|
|
|
#define ZEPHYR_INCLUDE_SW_ISR_TABLE_H_
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
#if !defined(_ASMLANGUAGE)
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2017-02-09 09:16:29 +08:00
|
|
|
#include <toolchain.h>
|
|
|
|
|
2019-08-13 01:54:52 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* Note the order: arg first, then ISR. This allows a table entry to be
|
2015-04-24 15:40:17 +08:00
|
|
|
* loaded arg -> r0, isr -> r3 in _isr_wrapper with one ldmia instruction,
|
2015-04-11 07:44:37 +08:00
|
|
|
* on ARM Cortex-M (Thumb2).
|
|
|
|
*/
|
2017-01-26 06:32:53 +08:00
|
|
|
struct _isr_table_entry {
|
2020-07-10 20:17:20 +08:00
|
|
|
const void *arg;
|
|
|
|
void (*isr)(const void *);
|
2015-04-11 07:44:37 +08:00
|
|
|
};
|
|
|
|
|
2017-01-26 06:32:53 +08:00
|
|
|
/* The software ISR table itself, an array of these structures indexed by the
|
|
|
|
* irq line
|
|
|
|
*/
|
|
|
|
extern struct _isr_table_entry _sw_isr_table[];
|
2016-01-28 22:24:56 +08:00
|
|
|
|
2017-02-09 09:16:29 +08:00
|
|
|
/*
|
|
|
|
* Data structure created in a special binary .intlist section for each
|
|
|
|
* configured interrupt. gen_irq_tables.py pulls this out of the binary and
|
|
|
|
* uses it to create the IRQ vector table and the _sw_isr_table.
|
|
|
|
*
|
|
|
|
* More discussion in include/linker/intlist.ld
|
|
|
|
*/
|
|
|
|
struct _isr_list {
|
|
|
|
/** IRQ line number */
|
2020-05-28 00:26:57 +08:00
|
|
|
int32_t irq;
|
2017-02-09 09:16:29 +08:00
|
|
|
/** Flags for this IRQ, see ISR_FLAG_* definitions */
|
2020-05-28 00:26:57 +08:00
|
|
|
int32_t flags;
|
2017-02-09 09:16:29 +08:00
|
|
|
/** ISR to call */
|
|
|
|
void *func;
|
|
|
|
/** Parameter for non-direct IRQs */
|
2020-07-10 20:17:20 +08:00
|
|
|
const void *param;
|
2017-02-09 09:16:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** This interrupt gets put directly in the vector table */
|
2019-03-09 04:35:46 +08:00
|
|
|
#define ISR_FLAG_DIRECT BIT(0)
|
2017-02-09 09:16:29 +08:00
|
|
|
|
2020-04-15 13:26:04 +08:00
|
|
|
#define _MK_ISR_NAME(x, y) __MK_ISR_NAME(x, y)
|
|
|
|
#define __MK_ISR_NAME(x, y) __isr_ ## x ## _irq_ ## y
|
2017-02-09 09:16:29 +08:00
|
|
|
|
|
|
|
/* Create an instance of struct _isr_list which gets put in the .intList
|
|
|
|
* section. This gets consumed by gen_isr_tables.py which creates the vector
|
|
|
|
* and/or SW ISR tables.
|
|
|
|
*/
|
2019-03-09 05:19:05 +08:00
|
|
|
#define Z_ISR_DECLARE(irq, flags, func, param) \
|
2019-07-25 04:34:40 +08:00
|
|
|
static Z_DECL_ALIGN(struct _isr_list) Z_GENERIC_SECTION(.intList) \
|
|
|
|
__used _MK_ISR_NAME(func, __COUNTER__) = \
|
2020-07-10 20:17:20 +08:00
|
|
|
{irq, flags, (void *)&func, (const void *)param}
|
2017-02-09 09:16:29 +08:00
|
|
|
|
|
|
|
#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
|
|
|
|
|
2018-11-01 07:18:34 +08:00
|
|
|
#ifdef CONFIG_DYNAMIC_INTERRUPTS
|
2020-07-10 20:17:20 +08:00
|
|
|
void z_isr_install(unsigned int irq, void (*routine)(const void *),
|
|
|
|
const void *param);
|
2018-11-01 07:18:34 +08:00
|
|
|
#endif
|
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 01:54:52 +08:00
|
|
|
#endif /* _ASMLANGUAGE */
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_SW_ISR_TABLE_H_ */
|