mikroSDK Reference Manual
NVIC Functions
Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI) | Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI) » Floating Point Unit (FPU) » Core Debug Registers (CoreDebug) » Core register bit field macros » Core Definitions | Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI) | Defines and Type Definitions » Status and Control Registers » Nested Vectored Interrupt Controller (NVIC) » System Control Block (SCB) » System Controls not in SCB (SCnSCB) » System Tick Timer (SysTick) » Instrumentation Trace Macrocell (ITM) » Data Watchpoint and Trace (DWT) » Trace Port Interface (TPI) » Floating Point Unit (FPU) » Core Debug Registers (CoreDebug) » Core register bit field macros » Core Definitions » Functions and Instructions Reference

Functions that manage interrupts and exceptions via the NVIC. More...

Topics

 FPU Functions
 Function that provides FPU type.
 
__STATIC_INLINE void __NVIC_SetPriorityGrouping (uint32_t PriorityGroup)
 Set Priority Grouping.
 
__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping (void)
 Get Priority Grouping.
 
__STATIC_INLINE void __NVIC_EnableIRQ (IRQn_Type IRQn)
 Enable Interrupt.
 
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ (IRQn_Type IRQn)
 Get Interrupt Enable status.
 
__STATIC_INLINE void __NVIC_DisableIRQ (IRQn_Type IRQn)
 Disable Interrupt.
 
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ (IRQn_Type IRQn)
 Get Pending Interrupt.
 
__STATIC_INLINE void __NVIC_SetPendingIRQ (IRQn_Type IRQn)
 Set Pending Interrupt.
 
__STATIC_INLINE void __NVIC_ClearPendingIRQ (IRQn_Type IRQn)
 Clear Pending Interrupt.
 
__STATIC_INLINE uint32_t __NVIC_GetActive (IRQn_Type IRQn)
 Get Active Interrupt.
 
__STATIC_INLINE void __NVIC_SetPriority (IRQn_Type IRQn, uint32_t priority)
 Set Interrupt Priority.
 
__STATIC_INLINE uint32_t __NVIC_GetPriority (IRQn_Type IRQn)
 Get Interrupt Priority.
 
__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
 Encode Priority.
 
__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t *const pPreemptPriority, uint32_t *const pSubPriority)
 Decode Priority.
 
__STATIC_INLINE void __NVIC_SetVector (IRQn_Type IRQn, uint32_t vector)
 Set Interrupt Vector.
 
__STATIC_INLINE uint32_t __NVIC_GetVector (IRQn_Type IRQn)
 Get Interrupt Vector.
 
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset (void)
 System Reset.
 
__STATIC_INLINE uint32_t SCB_GetFPUType (void)
 get FPU type
 
__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
 ITM Send Character.
 
__STATIC_INLINE int32_t ITM_ReceiveChar (void)
 ITM Receive Character.
 
__STATIC_INLINE int32_t ITM_CheckChar (void)
 ITM Check Character.
 
#define NVIC_SetPriorityGrouping   __NVIC_SetPriorityGrouping
 
#define NVIC_GetPriorityGrouping   __NVIC_GetPriorityGrouping
 
#define NVIC_EnableIRQ   __NVIC_EnableIRQ
 
#define NVIC_GetEnableIRQ   __NVIC_GetEnableIRQ
 
#define NVIC_DisableIRQ   __NVIC_DisableIRQ
 
#define NVIC_GetPendingIRQ   __NVIC_GetPendingIRQ
 
#define NVIC_SetPendingIRQ   __NVIC_SetPendingIRQ
 
#define NVIC_ClearPendingIRQ   __NVIC_ClearPendingIRQ
 
#define NVIC_GetActive   __NVIC_GetActive
 
#define NVIC_SetPriority   __NVIC_SetPriority
 
#define NVIC_GetPriority   __NVIC_GetPriority
 
#define NVIC_SystemReset   __NVIC_SystemReset
 
#define NVIC_SetVector   __NVIC_SetVector
 
#define NVIC_GetVector   __NVIC_GetVector
 
#define NVIC_USER_IRQ_OFFSET   16
 
#define EXC_RETURN_HANDLER   (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
 
#define EXC_RETURN_THREAD_MSP   (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
 
#define EXC_RETURN_THREAD_PSP   (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
 
#define NVIC_SetPriorityGrouping   __NVIC_SetPriorityGrouping
 
#define NVIC_GetPriorityGrouping   __NVIC_GetPriorityGrouping
 
#define NVIC_EnableIRQ   __NVIC_EnableIRQ
 
#define NVIC_GetEnableIRQ   __NVIC_GetEnableIRQ
 
#define NVIC_DisableIRQ   __NVIC_DisableIRQ
 
#define NVIC_GetPendingIRQ   __NVIC_GetPendingIRQ
 
#define NVIC_SetPendingIRQ   __NVIC_SetPendingIRQ
 
#define NVIC_ClearPendingIRQ   __NVIC_ClearPendingIRQ
 
#define NVIC_GetActive   __NVIC_GetActive
 
#define NVIC_SetPriority   __NVIC_SetPriority
 
#define NVIC_GetPriority   __NVIC_GetPriority
 
#define NVIC_SystemReset   __NVIC_SystemReset
 
#define NVIC_SetVector   __NVIC_SetVector
 
#define NVIC_GetVector   __NVIC_GetVector
 
#define NVIC_USER_IRQ_OFFSET   16
 
#define EXC_RETURN_HANDLER   (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
 
#define EXC_RETURN_THREAD_MSP   (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
 
#define EXC_RETURN_THREAD_PSP   (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
 
#define EXC_RETURN_HANDLER_FPU   (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */
 
#define EXC_RETURN_THREAD_MSP_FPU   (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */
 
#define EXC_RETURN_THREAD_PSP_FPU   (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */
 
#define NVIC_SetPriorityGrouping   __NVIC_SetPriorityGrouping
 
#define NVIC_GetPriorityGrouping   __NVIC_GetPriorityGrouping
 
#define NVIC_EnableIRQ   __NVIC_EnableIRQ
 
#define NVIC_GetEnableIRQ   __NVIC_GetEnableIRQ
 
#define NVIC_DisableIRQ   __NVIC_DisableIRQ
 
#define NVIC_GetPendingIRQ   __NVIC_GetPendingIRQ
 
#define NVIC_SetPendingIRQ   __NVIC_SetPendingIRQ
 
#define NVIC_ClearPendingIRQ   __NVIC_ClearPendingIRQ
 
#define NVIC_GetActive   __NVIC_GetActive
 
#define NVIC_SetPriority   __NVIC_SetPriority
 
#define NVIC_GetPriority   __NVIC_GetPriority
 
#define NVIC_SystemReset   __NVIC_SystemReset
 
#define NVIC_SetVector   __NVIC_SetVector
 
#define NVIC_GetVector   __NVIC_GetVector
 
#define NVIC_USER_IRQ_OFFSET   16
 
#define EXC_RETURN_HANDLER   (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
 
#define EXC_RETURN_THREAD_MSP   (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
 
#define EXC_RETURN_THREAD_PSP   (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
 
#define EXC_RETURN_HANDLER_FPU   (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */
 
#define EXC_RETURN_THREAD_MSP_FPU   (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */
 
#define EXC_RETURN_THREAD_PSP_FPU   (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */
 

Function Documentation

◆ __NVIC_ClearPendingIRQ()

__STATIC_INLINE void __NVIC_ClearPendingIRQ ( IRQn_Type IRQn)

Clears the pending bit of a device specific interrupt in the NVIC pending register.

Parameters
[in]IRQnDevice specific interrupt number.
Note
IRQn must not be negative.

◆ __NVIC_DisableIRQ()

__STATIC_INLINE void __NVIC_DisableIRQ ( IRQn_Type IRQn)

Disables a device specific interrupt in the NVIC interrupt controller.

Parameters
[in]IRQnDevice specific interrupt number.
Note
IRQn must not be negative.

◆ __NVIC_EnableIRQ()

__STATIC_INLINE void __NVIC_EnableIRQ ( IRQn_Type IRQn)

Enables a device specific interrupt in the NVIC interrupt controller.

Parameters
[in]IRQnDevice specific interrupt number.
Note
IRQn must not be negative.

◆ __NVIC_GetActive()

__STATIC_INLINE uint32_t __NVIC_GetActive ( IRQn_Type IRQn)

Reads the active register in the NVIC and returns the active bit for the device specific interrupt.

Parameters
[in]IRQnDevice specific interrupt number.
Returns
0 Interrupt status is not active.
1 Interrupt status is active.
Note
IRQn must not be negative.

◆ __NVIC_GetEnableIRQ()

__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ ( IRQn_Type IRQn)

Returns a device specific interrupt enable status from the NVIC interrupt controller.

Parameters
[in]IRQnDevice specific interrupt number.
Returns
0 Interrupt is not enabled.
1 Interrupt is enabled.
Note
IRQn must not be negative.

◆ __NVIC_GetPendingIRQ()

__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ ( IRQn_Type IRQn)

Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.

Parameters
[in]IRQnDevice specific interrupt number.
Returns
0 Interrupt status is not pending.
1 Interrupt status is pending.
Note
IRQn must not be negative.

◆ __NVIC_GetPriority()

__STATIC_INLINE uint32_t __NVIC_GetPriority ( IRQn_Type IRQn)

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]IRQnInterrupt number.
Returns
Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.

◆ __NVIC_GetPriorityGrouping()

__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping ( void )

Reads the priority grouping field from the NVIC Interrupt Controller.

Returns
Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).

◆ __NVIC_GetVector()

__STATIC_INLINE uint32_t __NVIC_GetVector ( IRQn_Type IRQn)

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]IRQnInterrupt number.
Returns
Address of interrupt handler function

◆ __NVIC_SetPendingIRQ()

__STATIC_INLINE void __NVIC_SetPendingIRQ ( IRQn_Type IRQn)

Sets the pending bit of a device specific interrupt in the NVIC pending register.

Parameters
[in]IRQnDevice specific interrupt number.
Note
IRQn must not be negative.

◆ __NVIC_SetPriority()

__STATIC_INLINE void __NVIC_SetPriority ( IRQn_Type IRQn,
uint32_t 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]IRQnInterrupt number.
[in]priorityPriority to set.
Note
The priority cannot be set for every processor exception.

◆ __NVIC_SetPriorityGrouping()

__STATIC_INLINE void __NVIC_SetPriorityGrouping ( uint32_t PriorityGroup)

Sets the priority grouping field using the required unlock sequence. The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. Only values from 0..7 are used. In case of a conflict between priority grouping and available priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.

Parameters
[in]PriorityGroupPriority grouping field.

◆ __NVIC_SetVector()

__STATIC_INLINE void __NVIC_SetVector ( IRQn_Type IRQn,
uint32_t 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.

Parameters
[in]IRQnInterrupt number
[in]vectorAddress of interrupt handler function

◆ __NVIC_SystemReset()

__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset ( void )

Initiates a system reset request to reset the MCU.

◆ ITM_CheckChar()

__STATIC_INLINE int32_t ITM_CheckChar ( void )

Checks whether a character is pending for reading in the variable ITM_RxBuffer.

Returns
0 No character available.
1 Character available.

◆ ITM_ReceiveChar()

__STATIC_INLINE int32_t ITM_ReceiveChar ( void )

Inputs a character via the external variable ITM_RxBuffer.

Returns
Received character.
-1 No character pending.

◆ ITM_SendChar()

__STATIC_INLINE uint32_t ITM_SendChar ( uint32_t ch)

Transmits a character via the ITM channel 0, and

  • Just returns when no debugger is connected that has booked the output.
  • Is blocking when a debugger is connected, but the previous character sent has not been transmitted.
    Parameters
    [in]chCharacter to transmit.
    Returns
    Character to transmit.

◆ NVIC_DecodePriority()

__STATIC_INLINE void NVIC_DecodePriority ( uint32_t Priority,
uint32_t PriorityGroup,
uint32_t *const pPreemptPriority,
uint32_t *const pSubPriority )

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]PriorityPriority value, which can be retrieved with the function NVIC_GetPriority().
[in]PriorityGroupUsed priority group.
[out]pPreemptPriorityPreemptive priority value (starting from 0).
[out]pSubPrioritySubpriority value (starting from 0).

◆ NVIC_EncodePriority()

__STATIC_INLINE uint32_t NVIC_EncodePriority ( uint32_t PriorityGroup,
uint32_t PreemptPriority,
uint32_t SubPriority )

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]PriorityGroupUsed priority group.
[in]PreemptPriorityPreemptive priority value (starting from 0).
[in]SubPrioritySubpriority value (starting from 0).
Returns
Encoded priority. Value can be used in the function NVIC_SetPriority().

◆ SCB_GetFPUType()

__STATIC_INLINE uint32_t SCB_GetFPUType ( void )

returns the FPU type

Returns
  • 0: No FPU
  • 1: Single precision FPU
  • 2: Double + Single precision FPU