Appiko
nrf_util.h
1 
28 #ifndef CODEBASE_NRF_UTIL_H_
29 #define CODEBASE_NRF_UTIL_H_
30 
31 #include "stdint.h"
32 #include "common_util.h"
33 
62 #if __CORTEX_M == (0x00U)
63 typedef enum
64 {
65  APP_IRQ_PRIORITY_HIGHEST = 0,
66  APP_IRQ_PRIORITY_HIGH = 1,
67  APP_IRQ_PRIORITY_MID = 2,
68  APP_IRQ_PRIORITY_LOW = 3,
69  APP_IRQ_PRIORITY_THREAD = 4
71 #elif __CORTEX_M == (0x04U)
72 typedef enum
73 {
74  APP_IRQ_PRIORITY_HIGHEST = 2,
75  APP_IRQ_PRIORITY_HIGH = 3,
76  APP_IRQ_PRIORITY_MID = 5,
77  APP_IRQ_PRIORITY_LOW = 6,
78  APP_IRQ_PRIORITY_LOWEST = 7,
79  APP_IRQ_PRIORITY_THREAD = 15
81 #endif
82 
84 #define LFCLK_FREQ 32768
85 
87 #define LFCLK_TICKS_MS(ms) ((uint32_t) ROUNDED_DIV( (LFCLK_FREQ*(uint64_t)ms) , 1000) )
88 
89 #define LFCLK_TICKS_625(ms) ((uint32_t) ROUNDED_DIV( (LFCLK_FREQ*(uint64_t)ms) , 1600) )
90 
91 #define LFCLK_TICKS_977(ms) ((uint32_t) (32*ms) )
92 
93 #define LFCLK_TICKS_1250(ms) ((uint32_t) ROUNDED_DIV( (LFCLK_FREQ*(uint64_t)ms) , 800) )
94 
95 void nrf_util_critical_region_enter(uint8_t * is_critical_entered);
96 void nrf_util_critical_region_exit(uint8_t critical_entered);
97 
103 #define CRITICAL_REGION_ENTER() \
104  { \
105  uint8_t __CR_ENTERED = 0; \
106  nrf_util_critical_region_enter(&__CR_ENTERED);
107 
113 #define CRITICAL_REGION_EXIT() \
114  nrf_util_critical_region_exit(__CR_ENTERED); \
115  }
116 
117 #endif /* CODEBASE_NRF_UTIL_H_ */
118 
app_irq_priority_t
Priority levels that the application can use based on whether the SoftDevice (SD) is used.
Definition: nrf_util.h:63
void nrf_util_critical_region_enter(uint8_t *is_critical_entered)
Definition: nrf_util.c:28