arm: move IRQ_PRIORITY_OFFSET to header file, rename to _IRQ_PRIO_OFFSET
This allows using it in _EXC_PRIO() instead of hardcoding 2 and 3. Change-Id: I3549be54602643e06823ba63beb6a6992f39f776 Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
parent
194a2e3a12
commit
f5d0cbe8ad
2 changed files with 9 additions and 8 deletions
|
@ -94,7 +94,6 @@ void _irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if CONFIG_ZERO_LATENCY_IRQS
|
#if CONFIG_ZERO_LATENCY_IRQS
|
||||||
#define IRQ_PRIORITY_OFFSET 3
|
|
||||||
/* If we have zero latency interrupts, that makes priority level 2
|
/* If we have zero latency interrupts, that makes priority level 2
|
||||||
* a case with special semantics; it is not masked by irq_lock().
|
* a case with special semantics; it is not masked by irq_lock().
|
||||||
* Our policy is to express priority levels with special properties
|
* Our policy is to express priority levels with special properties
|
||||||
|
@ -103,12 +102,11 @@ void _irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
|
||||||
if (flags & IRQ_ZERO_LATENCY) {
|
if (flags & IRQ_ZERO_LATENCY) {
|
||||||
prio = 2;
|
prio = 2;
|
||||||
} else {
|
} else {
|
||||||
prio += IRQ_PRIORITY_OFFSET;
|
prio += _IRQ_PRIO_OFFSET;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define IRQ_PRIORITY_OFFSET 2
|
|
||||||
ARG_UNUSED(flags);
|
ARG_UNUSED(flags);
|
||||||
prio += IRQ_PRIORITY_OFFSET;
|
prio += _IRQ_PRIO_OFFSET;
|
||||||
#endif
|
#endif
|
||||||
/* The last priority level is also used by PendSV exception, but
|
/* The last priority level is also used by PendSV exception, but
|
||||||
* allow other interrupts to use the same level, even if it ends up
|
* allow other interrupts to use the same level, even if it ends up
|
||||||
|
@ -117,8 +115,8 @@ void _irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
|
||||||
*/
|
*/
|
||||||
__ASSERT(prio <= ((1 << CONFIG_NUM_IRQ_PRIO_BITS) - 1),
|
__ASSERT(prio <= ((1 << CONFIG_NUM_IRQ_PRIO_BITS) - 1),
|
||||||
"invalid priority %d! values must be less than %d\n",
|
"invalid priority %d! values must be less than %d\n",
|
||||||
prio - IRQ_PRIORITY_OFFSET,
|
prio - _IRQ_PRIO_OFFSET,
|
||||||
(1 << CONFIG_NUM_IRQ_PRIO_BITS) - (IRQ_PRIORITY_OFFSET));
|
(1 << CONFIG_NUM_IRQ_PRIO_BITS) - (_IRQ_PRIO_OFFSET));
|
||||||
_NvicIrqPrioSet(irq, _EXC_PRIO(prio));
|
_NvicIrqPrioSet(irq, _EXC_PRIO(prio));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,15 @@ extern "C" {
|
||||||
|
|
||||||
/* for assembler, only works with constants */
|
/* for assembler, only works with constants */
|
||||||
#define _EXC_PRIO(pri) (((pri) << (8 - CONFIG_NUM_IRQ_PRIO_BITS)) & 0xff)
|
#define _EXC_PRIO(pri) (((pri) << (8 - CONFIG_NUM_IRQ_PRIO_BITS)) & 0xff)
|
||||||
|
|
||||||
#if defined(CONFIG_ZERO_LATENCY_IRQS)
|
#if defined(CONFIG_ZERO_LATENCY_IRQS)
|
||||||
#define _EXC_IRQ_DEFAULT_PRIO _EXC_PRIO(0x03)
|
#define _IRQ_PRIO_OFFSET 3
|
||||||
#else
|
#else
|
||||||
#define _EXC_IRQ_DEFAULT_PRIO _EXC_PRIO(0x02)
|
#define _IRQ_PRIO_OFFSET 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _EXC_IRQ_DEFAULT_PRIO _EXC_PRIO(_IRQ_PRIO_OFFSET)
|
||||||
|
|
||||||
/* no exc #0 */
|
/* no exc #0 */
|
||||||
#define _EXC_RESET 1
|
#define _EXC_RESET 1
|
||||||
#define _EXC_NMI 2
|
#define _EXC_NMI 2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue