arch: aarch32: Add build asserts for IRQ priority range
Figuring out what the lowest possible priority in platforms where CONFIG_ZERO_LATENCY_IRQS is supported is not possible before the Kconfig tree is built and resolved. In order to make the user's life easier, abort the build if IRQ_CONNECT() is called with an invalid (i.e. too low) priority. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
56ec755aeb
commit
148005bfe1
2 changed files with 11 additions and 0 deletions
|
@ -51,6 +51,7 @@
|
|||
#define _EXC_ZERO_LATENCY_IRQS_PRIO 0
|
||||
#define _EXC_SVC_PRIO COND_CODE_1(CONFIG_ZERO_LATENCY_IRQS, (1), (0))
|
||||
#define _IRQ_PRIO_OFFSET (_EXCEPTION_RESERVED_PRIO + _EXC_SVC_PRIO)
|
||||
#define IRQ_PRIO_LOWEST (BIT(NUM_IRQ_PRIO_BITS) - (_IRQ_PRIO_OFFSET) - 1)
|
||||
|
||||
#define _EXC_IRQ_DEFAULT_PRIO Z_EXC_PRIO(_IRQ_PRIO_OFFSET)
|
||||
|
||||
|
|
|
@ -92,6 +92,14 @@ extern void z_arm_interrupt_init(void);
|
|||
*/
|
||||
#define IRQ_ZERO_LATENCY BIT(0)
|
||||
|
||||
#ifdef CONFIG_CPU_CORTEX_M
|
||||
#define _CHECK_PRIO(priority_p, flags_p) \
|
||||
BUILD_ASSERT((flags_p & IRQ_ZERO_LATENCY) || \
|
||||
priority_p <= IRQ_PRIO_LOWEST, \
|
||||
"Invalid interrupt priority. Values must not exceed IRQ_PRIO_LOWEST");
|
||||
#else
|
||||
#define _CHECK_PRIO(priority_p, flags_p)
|
||||
#endif
|
||||
|
||||
/* All arguments must be computable by the compiler at build time.
|
||||
*
|
||||
|
@ -107,6 +115,7 @@ extern void z_arm_interrupt_init(void);
|
|||
{ \
|
||||
BUILD_ASSERT(IS_ENABLED(CONFIG_ZERO_LATENCY_IRQS) || !(flags_p & IRQ_ZERO_LATENCY), \
|
||||
"ZLI interrupt registered but feature is disabled"); \
|
||||
_CHECK_PRIO(priority_p, flags_p) \
|
||||
Z_ISR_DECLARE(irq_p, 0, isr_p, isr_param_p); \
|
||||
z_arm_irq_priority_set(irq_p, priority_p, flags_p); \
|
||||
}
|
||||
|
@ -115,6 +124,7 @@ extern void z_arm_interrupt_init(void);
|
|||
{ \
|
||||
BUILD_ASSERT(IS_ENABLED(CONFIG_ZERO_LATENCY_IRQS) || !(flags_p & IRQ_ZERO_LATENCY), \
|
||||
"ZLI interrupt registered but feature is disabled"); \
|
||||
_CHECK_PRIO(priority_p, flags_p) \
|
||||
Z_ISR_DECLARE(irq_p, ISR_FLAG_DIRECT, isr_p, NULL); \
|
||||
z_arm_irq_priority_set(irq_p, priority_p, flags_p); \
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue