What is interesting is that the functions NVIC_SetPriority() and NVIC_GetPriority() check the passed IRQn number. If IRQn is negative they access the System control block (SCB), otherwise the Nested vectored interrupt controller (NVIC).
With this, these functions can be used for system exceptions AND NVIC interrupts.
This is different from the other functions. For NVIC_SetPendingIRQ() and NVIC_ClearPendingIRQ() the passed IRQn number must be positive. They don't support system exceptions, even it would be nice if NVIC_SetPendingIRQ() could be used to trigger a PendSV exception.
Therefore, I have the following objections:
If the functions support negative IRQn numbers, the prefix NVIC_ is misleading. SetIRQPriority(), GetIRQPriority() or similar may be a better name.
If NVIC_SetPriority(), NVICGetPriority() support system exceptions (i.e. a negative IRQn number), the other NVIC functions should do so as well.
The doxygen comment before each function should state if negative IRQn numbers are allowed or not.
There is the following code in core_cm0.h:
What is interesting is that the functions NVIC_SetPriority() and NVIC_GetPriority() check the passed IRQn number. If IRQn is negative they access the System control block (SCB), otherwise the Nested vectored interrupt controller (NVIC).
With this, these functions can be used for system exceptions AND NVIC interrupts.
This is different from the other functions. For NVIC_SetPendingIRQ() and NVIC_ClearPendingIRQ() the passed IRQn number must be positive. They don't support system exceptions, even it would be nice if NVIC_SetPendingIRQ() could be used to trigger a PendSV exception.
Therefore, I have the following objections: