Hi everybody,
We are working on a simple priority RTC (run to completion) framework for the Cortex M3/M4. Thanks to the NVIC/BASEPRI, we got most of this functionality for free but we want to extend it to user tasks.
In our implementation we need to determine the current active interrupt priority to decide for: a) adjust BASEPRI for a higher priority task or b) Queue the request (like NVIC pending bit) to schedule it later
Does a NVIC/CPU register exist to directly get the current active interrupt priority? We havn't found any information in Yiu's book or on infocenter.arm.com.
Our current approce (in C) is:
IRQn_Type actirqn = ((int32_t)__get_IPSR()) - 16; /* -16 see IPSR bit assignments */ uint32_t actprio = actirqn==-16?PRIO_THREAD:NVIC_GetPriority(actirqn); /* Actual interrupt priority, PRIO_THREAD=0x100 for non IRQ prio */ uint32_t reqprio = task->priority; /* Requested interrupt priority */ /* ... */
We are thankful for any further hints.
Greetings
Jonathan
References: