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
|
|
|
|
|
|
|
#ifndef _SW_ISR_TABLE__H_
|
|
|
|
#define _SW_ISR_TABLE__H_
|
|
|
|
|
2016-06-22 03:18:50 +08:00
|
|
|
#include <arch/cpu.h>
|
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
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>
|
|
|
|
|
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 {
|
2015-04-11 07:44:37 +08:00
|
|
|
void *arg;
|
|
|
|
void (*isr)(void *);
|
|
|
|
};
|
|
|
|
|
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 */
|
|
|
|
int32_t irq;
|
|
|
|
/** Flags for this IRQ, see ISR_FLAG_* definitions */
|
|
|
|
int32_t flags;
|
|
|
|
/** ISR to call */
|
|
|
|
void *func;
|
|
|
|
/** Parameter for non-direct IRQs */
|
|
|
|
void *param;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** This interrupt gets put directly in the vector table */
|
|
|
|
#define ISR_FLAG_DIRECT (1 << 0)
|
|
|
|
|
|
|
|
#define _MK_ISR_NAME(x, y) __isr_ ## x ## _irq_ ## y
|
|
|
|
|
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
#define _ISR_DECLARE(irq, flags, func, param) \
|
|
|
|
static struct _isr_list _GENERIC_SECTION(.intList) __used \
|
|
|
|
_MK_ISR_NAME(func, __COUNTER__) = \
|
|
|
|
{irq, flags, &func, (void *)param}
|
|
|
|
|
|
|
|
#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#endif /* _ASMLANGUAGE */
|
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#endif /* _SW_ISR_TABLE__H_ */
|