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 <ricardo.salveti@linaro.org>
This commit is contained in:
Ricardo Salveti 2016-09-07 00:43:08 -03:00 committed by Maureen Helm
commit 30e76dfb7b

View file

@ -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));
}