Functions that manage interrupts and exceptions via the NVIC.
More...
Functions that manage interrupts and exceptions via the NVIC.
§ NVIC_SetPriorityGrouping
§ NVIC_GetPriorityGrouping
§ NVIC_EnableIRQ
§ NVIC_GetEnableIRQ
§ NVIC_DisableIRQ
§ NVIC_GetPendingIRQ
§ NVIC_SetPendingIRQ
§ NVIC_ClearPendingIRQ
§ NVIC_SetPriority
§ NVIC_GetPriority
§ NVIC_SystemReset
§ NVIC_SetVector
§ NVIC_GetVector
§ NVIC_USER_IRQ_OFFSET
| #define NVIC_USER_IRQ_OFFSET 16 |
§ EXC_RETURN_HANDLER
| #define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ |
§ EXC_RETURN_THREAD_MSP
| #define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ |
§ EXC_RETURN_THREAD_PSP
| #define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ |
§ _BIT_SHIFT
| #define _BIT_SHIFT |
( |
|
IRQn | ) |
( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) |
§ _SHP_IDX
| #define _SHP_IDX |
( |
|
IRQn | ) |
( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) |
§ _IP_IDX
| #define _IP_IDX |
( |
|
IRQn | ) |
( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) |
§ __NVIC_SetPriorityGrouping
| #define __NVIC_SetPriorityGrouping |
( |
|
X | ) |
(void)(X) |
§ __NVIC_GetPriorityGrouping
| #define __NVIC_GetPriorityGrouping |
( |
| ) |
(0U) |
§ __NVIC_EnableIRQ()
Enable Interrupt.
Enables a device specific interrupt in the NVIC interrupt controller.
- Parameters
-
| [in] | IRQn | Device specific interrupt number. |
- Note
- IRQn must not be negative.
References __COMPILER_BARRIER, and NVIC.
§ __NVIC_GetEnableIRQ()
Get Interrupt Enable status.
Returns a device specific interrupt enable status from the NVIC interrupt controller.
- Parameters
-
| [in] | IRQn | Device specific interrupt number. |
- Returns
- 0 Interrupt is not enabled.
-
1 Interrupt is enabled.
- Note
- IRQn must not be negative.
References NVIC.
§ __NVIC_DisableIRQ()
Disable Interrupt.
Disables a device specific interrupt in the NVIC interrupt controller.
- Parameters
-
| [in] | IRQn | Device specific interrupt number. |
- Note
- IRQn must not be negative.
References __DSB(), __ISB(), and NVIC.
§ __NVIC_GetPendingIRQ()
Get Pending Interrupt.
Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
- Parameters
-
| [in] | IRQn | Device specific interrupt number. |
- Returns
- 0 Interrupt status is not pending.
-
1 Interrupt status is pending.
- Note
- IRQn must not be negative.
References NVIC.
§ __NVIC_SetPendingIRQ()
Set Pending Interrupt.
Sets the pending bit of a device specific interrupt in the NVIC pending register.
- Parameters
-
| [in] | IRQn | Device specific interrupt number. |
- Note
- IRQn must not be negative.
References NVIC.
§ __NVIC_ClearPendingIRQ()
Clear Pending Interrupt.
Clears the pending bit of a device specific interrupt in the NVIC pending register.
- Parameters
-
| [in] | IRQn | Device specific interrupt number. |
- Note
- IRQn must not be negative.
References NVIC.
§ __NVIC_SetPriority()
Set Interrupt Priority.
Sets the priority of a device specific interrupt or a processor exception. The interrupt number can be positive to specify a device specific interrupt, or negative to specify a processor exception.
- Parameters
-
| [in] | IRQn | Interrupt number. |
| [in] | priority | Priority to set. |
- Note
- The priority cannot be set for every processor exception.
References __NVIC_PRIO_BITS, _BIT_SHIFT, _IP_IDX, _SHP_IDX, NVIC, and SCB.
§ __NVIC_GetPriority()
Get Interrupt Priority.
Reads the priority of a device specific interrupt or a processor exception. The interrupt number can be positive to specify a device specific interrupt, or negative to specify a processor exception.
- Parameters
-
| [in] | IRQn | Interrupt number. |
- Returns
- Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
References __NVIC_PRIO_BITS, _BIT_SHIFT, _IP_IDX, _SHP_IDX, NVIC, and SCB.
§ NVIC_EncodePriority()
| __STATIC_INLINE uint32_t NVIC_EncodePriority |
( |
uint32_t |
PriorityGroup, |
|
|
uint32_t |
PreemptPriority, |
|
|
uint32_t |
SubPriority |
|
) |
| |
Encode Priority.
Encodes the priority for an interrupt with the given priority group, preemptive priority value, and subpriority value. In case of a conflict between priority grouping and available priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
- Parameters
-
| [in] | PriorityGroup | Used priority group. |
| [in] | PreemptPriority | Preemptive priority value (starting from 0). |
| [in] | SubPriority | Subpriority value (starting from 0). |
- Returns
- Encoded priority. Value can be used in the function NVIC_SetPriority().
References __NVIC_PRIO_BITS.
§ NVIC_DecodePriority()
| __STATIC_INLINE void NVIC_DecodePriority |
( |
uint32_t |
Priority, |
|
|
uint32_t |
PriorityGroup, |
|
|
uint32_t *const |
pPreemptPriority, |
|
|
uint32_t *const |
pSubPriority |
|
) |
| |
Decode Priority.
Decodes an interrupt priority value with a given priority group to preemptive priority value and subpriority value. In case of a conflict between priority grouping and available priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
- Parameters
-
| [in] | Priority | Priority value, which can be retrieved with the function NVIC_GetPriority(). |
| [in] | PriorityGroup | Used priority group. |
| [out] | pPreemptPriority | Preemptive priority value (starting from 0). |
| [out] | pSubPriority | Subpriority value (starting from 0). |
References __NVIC_PRIO_BITS.
§ __NVIC_SetVector()
Set Interrupt Vector.
Sets an interrupt vector in SRAM based interrupt vector table. The interrupt number can be positive to specify a device specific interrupt, or negative to specify a processor exception. VTOR must been relocated to SRAM before. If VTOR is not present address 0 must be mapped to SRAM.
- Parameters
-
| [in] | IRQn | Interrupt number |
| [in] | vector | Address of interrupt handler function |
References NVIC_USER_IRQ_OFFSET, and SCB.
§ __NVIC_GetVector()
Get Interrupt Vector.
Reads an interrupt vector from interrupt vector table. The interrupt number can be positive to specify a device specific interrupt, or negative to specify a processor exception.
- Parameters
-
| [in] | IRQn | Interrupt number. |
- Returns
- Address of interrupt handler function
References NVIC_USER_IRQ_OFFSET, and SCB.
§ __NVIC_SystemReset()