From 30e76dfb7bf71d9e15f6c12467059b51a6d08865 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Wed, 7 Sep 2016 00:43:08 -0300 Subject: [PATCH] arm/irq_manage: change assert to allow sharing prio with PendSV Zephyr uses the last priority level for the PendSV exception, but sharing prio can still be useful on systems with a reduced set of priorities, like Cortex-M0/M0+. Change-Id: I767527419dcd8f67c2b406756b9208afd3b96de0 Signed-off-by: Ricardo Salveti --- arch/arm/core/irq_manage.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/core/irq_manage.c b/arch/arm/core/irq_manage.c index e39f31fcd5e..6f7ffdaf6d1 100644 --- a/arch/arm/core/irq_manage.c +++ b/arch/arm/core/irq_manage.c @@ -102,11 +102,15 @@ void _irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags) ARG_UNUSED(flags); prio += IRQ_PRIORITY_OFFSET; #endif - /* Last priority level reserved for PendSV exception */ - __ASSERT(prio < ((1 << CONFIG_NUM_IRQ_PRIO_BITS) - 1), + /* The last priority level is also used by PendSV exception, but + * allow other interrupts to use the same level, even if it ends up + * affecting performance (can still be useful on systems with a + * reduced set of priorities, like Cortex-M0/M0+). + */ + __ASSERT(prio <= ((1 << CONFIG_NUM_IRQ_PRIO_BITS) - 1), "invalid priority %d! values must be less than %d\n", prio - IRQ_PRIORITY_OFFSET, - (1 << CONFIG_NUM_IRQ_PRIO_BITS) - (IRQ_PRIORITY_OFFSET + 1)); + (1 << CONFIG_NUM_IRQ_PRIO_BITS) - (IRQ_PRIORITY_OFFSET)); _NvicIrqPrioSet(irq, _EXC_PRIO(prio)); }