Utility Functions and Definitions (Platform)

nRF5 SDK v12.1.0

Various types and definitions available to all applications when using SoftDevice. More...

Macros

#define _PRIO_SD_HIGH 0
#define _PRIO_APP_HIGH 1
#define _PRIO_APP_MID 1
#define _PRIO_SD_LOW 2
#define _PRIO_APP_LOW 3
#define _PRIO_APP_LOWEST 3
#define _PRIO_THREAD 4
#define NRF_BREAKPOINT __BKPT(0)
Macro for setting a breakpoint.
#define PACKED (TYPE)   __packed TYPE
#define CRITICAL_REGION_ENTER ()   app_util_critical_region_enter(NULL)
Macro for entering a critical region. More...
#define CRITICAL_REGION_EXIT ()   app_util_critical_region_exit(0)
Macro for leaving a critical region. More...
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/)
#define ANON_UNIONS_ENABLE
Macro to enable anonymous unions from a certain point in the code. More...
#define ANON_UNIONS_DISABLE _Pragma("pop")
Macro to disable anonymous unions from a certain point in the code. More...
#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/)

Enumerations

enum app_irq_priority_t {
APP_IRQ_PRIORITY_HIGHEST = 0,
APP_IRQ_PRIORITY_HIGH = 1,
APP_IRQ_PRIORITY_MID = 2,
APP_IRQ_PRIORITY_LOW = 3,
APP_IRQ_PRIORITY_LOWEST = 3,
APP_IRQ_PRIORITY_THREAD = 4
}
The interrupt priorities available to the application while the SoftDevice is active. More...
enum app_level_t {
APP_LEVEL_UNPRIVILEGED ,
APP_LEVEL_PRIVILEGED
}

Functions

void app_util_critical_region_enter (uint8_t *p_nested)
void app_util_critical_region_exit (uint8_t nested)
static __INLINE uint8_t current_int_priority_get (void)
Function for finding the current interrupt level. More...
static __INLINE uint8_t privilege_level_get (void)
Function for finding out the current privilege level. More...

Detailed Description

Various types and definitions available to all applications when using SoftDevice.

Macro Definition Documentation

#define ANON_UNIONS_DISABLE   _Pragma("pop")

Macro to disable anonymous unions from a certain point in the code.

Note
Call only after first calling ANON_UNIONS_ENABLE .
#define ANON_UNIONS_ENABLE
Value:
_Pragma( "push" ) \
_Pragma( "anon_unions" )

Macro to enable anonymous unions from a certain point in the code.

#define CONTROL_nPRIV_Msk   (1UL /*<< CONTROL_nPRIV_Pos*/)

CONTROL: nPRIV Mask

#define CRITICAL_REGION_ENTER ( ) app_util_critical_region_enter(NULL)

Macro for entering a critical region.

Note
Due to implementation details, there must exist one and only one call to CRITICAL_REGION_EXIT() for each call to CRITICAL_REGION_ENTER() , and they must be located in the same scope.
#define CRITICAL_REGION_EXIT ( ) app_util_critical_region_exit(0)

Macro for leaving a critical region.

Note
Due to implementation details, there must exist one and only one call to CRITICAL_REGION_EXIT() for each call to CRITICAL_REGION_ENTER() , and they must be located in the same scope.
#define IPSR_ISR_Msk   (0x1FFUL /*<< IPSR_ISR_Pos*/)

IPSR: ISR Mask

Enumeration Type Documentation

The interrupt priorities available to the application while the SoftDevice is active.

Enumerator
APP_IRQ_PRIORITY_THREAD

"Interrupt level" when running in Thread Mode.

Function Documentation

static __INLINE uint8_t current_int_priority_get ( void )
static

Function for finding the current interrupt level.

Returns
Current interrupt level.
Return values
APP_IRQ_PRIORITY_HIGH We are running in Application High interrupt level.
APP_IRQ_PRIORITY_LOW We are running in Application Low interrupt level.
APP_IRQ_PRIORITY_THREAD We are running in Thread Mode.

< IPSR: ISR Mask

static __INLINE uint8_t privilege_level_get ( void )
static

Function for finding out the current privilege level.

Returns
Current privilege level.
Return values
APP_LEVEL_UNPRIVILEGED We are running in unprivileged level.
APP_LEVEL_PRIVILEGED We are running in privileged level.