nRF5 SDK v17.1.0
Macros | Enumerations | Functions
Utility Functions and Definitions (Platform)

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

Macros

#define _PRIO_SD_HIGH   0
 
#define _PRIO_SD_MID   1
 
#define _PRIO_APP_HIGH   2
 
#define _PRIO_APP_MID   3
 
#define _PRIO_SD_LOW   4
 
#define _PRIO_APP_LOW_MID   5
 
#define _PRIO_APP_LOW   6
 
#define _PRIO_APP_LOWEST   7
 
#define _PRIO_THREAD   15
 
#define NRF_BREAKPOINT   __BKPT(0)
 Macro for setting a breakpoint.
 
#define NRF_BREAKPOINT_COND
 Macro for setting a breakpoint. More...
 
#define PACKED(TYPE)   __packed TYPE
 
#define PACKED_STRUCT   PACKED(struct)
 
#define PRAGMA_OPTIMIZATION_FORCE_START
 
#define PRAGMA_OPTIMIZATION_FORCE_END   _Pragma ("pop")
 
#define CRITICAL_REGION_ENTER()
 Macro for entering a critical region. More...
 
#define CRITICAL_REGION_EXIT()
 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
 Macro to disable anonymous unions from a certain point in the code. More...
 
#define GCC_PRAGMA(v)
 Macro for adding pragma directive only for GCC.
 
#define CONTROL_nPRIV_Msk   (1UL /*<< CONTROL_nPRIV_Pos*/)
 

Enumerations

enum  app_irq_priority_t {
  APP_IRQ_PRIORITY_HIGHEST = 2,
  APP_IRQ_PRIORITY_HIGH = 2,
  APP_IRQ_PRIORITY_MID = 3,
  APP_IRQ_PRIORITY_LOW_MID = 5,
  APP_IRQ_PRIORITY_LOW = 6,
  APP_IRQ_PRIORITY_LOWEST = 7,
  APP_IRQ_PRIORITY_THREAD = 15
}
 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)
 
uint8_t current_int_priority_get (void)
 Function for finding the current interrupt level. More...
 
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
Value:
_Pragma("pop") \
struct semicolon_swallower

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") \
struct semicolon_swallower

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 ( )
Value:
{ \
uint8_t __CR_NESTED = 0; \
app_util_critical_region_enter(&__CR_NESTED);

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 ( )
Value:
app_util_critical_region_exit(__CR_NESTED); \
}

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

#define NRF_BREAKPOINT_COND
Value:
do { \
/* C_DEBUGEN == 1 -> Debugger Connected */ \
if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) \
{ \
/* Generate breakpoint if debugger is connected */ \
NRF_BREAKPOINT; \
} \
}while (0)

Macro for setting a breakpoint.

If it is possible to detect debugger presence then it is set only in that case.

#define PRAGMA_OPTIMIZATION_FORCE_START
Value:
_Pragma ("push") \
_Pragma ("O3")

Enumeration Type Documentation

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

Enumerator
APP_IRQ_PRIORITY_HIGHEST 

Running in Application Highest interrupt level.

APP_IRQ_PRIORITY_HIGH 

Running in Application High interrupt level.

APP_IRQ_PRIORITY_MID 

Running in Application Middle interrupt level.

APP_IRQ_PRIORITY_LOW_MID 

Running in Application Middle Low interrupt level.

APP_IRQ_PRIORITY_LOW 

Running in Application Low interrupt level.

APP_IRQ_PRIORITY_LOWEST 

Running in Application Lowest interrupt level.

APP_IRQ_PRIORITY_THREAD 

Running in Thread Mode.

Function Documentation

uint8_t current_int_priority_get ( void  )

Function for finding the current interrupt level.

Returns
Current interrupt level. See app_irq_priority_t for values.
uint8_t privilege_level_get ( void  )

Function for finding out the current privilege level.

Returns
Current privilege level.
Return values
APP_LEVEL_UNPRIVILEGEDWe are running in unprivileged level.
APP_LEVEL_PRIVILEGEDWe are running in privileged level.

Documentation feedback | Developer Zone | Subscribe | Updated