EFR32 Mighty Gecko 13 Software Documentation  efr32mg13-doc-5.1.2
em_cryotimer.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef EM_CRYOTIMER_H
34 #define EM_CRYOTIMER_H
35 
36 #include <stdbool.h>
37 #include "em_device.h"
38 #include "em_bus.h"
39 
40 #if defined(CRYOTIMER_PRESENT) && (CRYOTIMER_COUNT == 1)
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /***************************************************************************/
51 /***************************************************************************/
114 /*******************************************************************************
115  ********************************* ENUM ************************************
116  ******************************************************************************/
117 
119 typedef enum
120 {
130 
132 typedef enum
133 {
138 
140 typedef enum
141 {
176 
177 /*******************************************************************************
178  ******************************* STRUCTS ***********************************
179  ******************************************************************************/
180 
182 typedef struct
183 {
185  bool enable;
186 
188  bool debugRun;
189 
191  bool em4Wakeup;
192 
195 
198 
202 
203 /*******************************************************************************
204  ******************************* DEFINES ***********************************
205  ******************************************************************************/
206 
208 #define CRYOTIMER_INIT_DEFAULT \
209 { \
210  true, /* Start counting when init done. */ \
211  false, /* Disable CRYOTIMER during debug halt. */ \
212  false, /* Disable EM4 wakeup. */ \
213  cryotimerOscLFRCO, /* Select Low Frequency RC Oscillator. */ \
214  cryotimerPresc_1, /* LF Oscillator frequency undivided. */ \
215  cryotimerPeriod_4096m, /* Wakeup event after 4096M pre-scaled clock cycles. */ \
216 }
217 
218 /*******************************************************************************
219  ***************************** PROTOTYPES **********************************
220  ******************************************************************************/
221 
222 /***************************************************************************/
229 __STATIC_INLINE void CRYOTIMER_IntClear(uint32_t flags)
230 {
231  CRYOTIMER->IFC = flags & _CRYOTIMER_IFC_MASK;
232 }
233 
234 /***************************************************************************/
245 __STATIC_INLINE uint32_t CRYOTIMER_IntGet(void)
246 {
247  return CRYOTIMER->IF;
248 }
249 
250 /***************************************************************************/
264 __STATIC_INLINE uint32_t CRYOTIMER_IntGetEnabled(void)
265 {
266  uint32_t ien;
267 
268  ien = CRYOTIMER->IEN & _CRYOTIMER_IEN_MASK;
269  return CRYOTIMER->IF & ien;
270 }
271 
272 /***************************************************************************/
279 __STATIC_INLINE void CRYOTIMER_IntEnable(uint32_t flags)
280 {
281  CRYOTIMER->IEN |= (flags & _CRYOTIMER_IEN_MASK);
282 }
283 
284 /***************************************************************************/
291 __STATIC_INLINE void CRYOTIMER_IntDisable(uint32_t flags)
292 {
293  CRYOTIMER->IEN &= ~(flags & _CRYOTIMER_IEN_MASK);
294 }
295 
296 /***************************************************************************/
307 __STATIC_INLINE void CRYOTIMER_IntSet(uint32_t flags)
308 {
309  CRYOTIMER->IFS = flags & _CRYOTIMER_IFS_MASK;
310 }
311 
312 /***************************************************************************/
325 __STATIC_INLINE void CRYOTIMER_PeriodSet(uint32_t period)
326 {
327  CRYOTIMER->PERIODSEL = period & _CRYOTIMER_PERIODSEL_MASK;
328 }
329 
330 /***************************************************************************/
343 __STATIC_INLINE uint32_t CRYOTIMER_PeriodGet(void)
344 {
345  return CRYOTIMER->PERIODSEL;
346 }
347 
348 /***************************************************************************/
355 __STATIC_INLINE uint32_t CRYOTIMER_CounterGet(void)
356 {
357  return CRYOTIMER->CNT;
358 }
359 
360 /***************************************************************************/
367 __STATIC_INLINE void CRYOTIMER_EM4WakeupEnable(bool enable)
368 {
370 }
371 
372 /***************************************************************************/
379 __STATIC_INLINE void CRYOTIMER_Enable(bool enable)
380 {
382 }
383 
384 void CRYOTIMER_Init(const CRYOTIMER_Init_TypeDef *init);
385 
386 #ifdef __cplusplus
387 }
388 #endif
389 
393 #endif /* defined(CRYOTIMER_PRESENT) && (CRYOTIMER_COUNT == 1) */
394 #endif /* EM_CRYOTIMER_H */
#define _CRYOTIMER_CTRL_OSCSEL_LFRCO
#define _CRYOTIMER_IFC_MASK
__STATIC_INLINE uint32_t CRYOTIMER_IntGet(void)
Get the CRYOTIMER interrupt flag.
Definition: em_cryotimer.h:245
RAM and peripheral bit-field set and clear API.
#define _CRYOTIMER_IEN_MASK
__STATIC_INLINE uint32_t CRYOTIMER_CounterGet(void)
Get the CRYOTIMER counter value.
Definition: em_cryotimer.h:355
__STATIC_INLINE void CRYOTIMER_EM4WakeupEnable(bool enable)
Enable/disable EM4 wakeup capability.
Definition: em_cryotimer.h:367
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
__STATIC_INLINE void CRYOTIMER_IntDisable(uint32_t flags)
Disable one or more CRYOTIMER interrupts.
Definition: em_cryotimer.h:291
CRYOTIMER_Presc_TypeDef
Definition: em_cryotimer.h:119
CRYOTIMER_Period_TypeDef period
Definition: em_cryotimer.h:200
CRYOTIMER_Osc_TypeDef
Definition: em_cryotimer.h:132
__STATIC_INLINE uint32_t CRYOTIMER_PeriodGet(void)
Get the CRYOTIMER period select value.
Definition: em_cryotimer.h:343
__STATIC_INLINE void CRYOTIMER_IntSet(uint32_t flags)
Set the CRYOTIMER period interrupt flag.
Definition: em_cryotimer.h:307
__STATIC_INLINE uint32_t CRYOTIMER_IntGetEnabled(void)
Get enabled and pending CRYOTIMER interrupt flags. Useful for handling more interrupt sources in the ...
Definition: em_cryotimer.h:264
#define _CRYOTIMER_CTRL_PRESC_DIV128
__STATIC_INLINE void CRYOTIMER_Enable(bool enable)
Enable/disable the CRYOTIMER.
Definition: em_cryotimer.h:379
CRYOTIMER_Period_TypeDef
Definition: em_cryotimer.h:140
void CRYOTIMER_Init(const CRYOTIMER_Init_TypeDef *init)
Initialize the CRYOTIMER.
Definition: em_cryotimer.c:51
#define CRYOTIMER
#define _CRYOTIMER_CTRL_OSCSEL_ULFRCO
#define _CRYOTIMER_CTRL_PRESC_DIV8
CRYOTIMER_Osc_TypeDef osc
Definition: em_cryotimer.h:194
CRYOTIMER_Presc_TypeDef presc
Definition: em_cryotimer.h:197
#define _CRYOTIMER_CTRL_PRESC_DIV2
#define _CRYOTIMER_CTRL_PRESC_DIV1
#define _CRYOTIMER_CTRL_PRESC_DIV16
#define _CRYOTIMER_CTRL_PRESC_DIV64
__STATIC_INLINE void CRYOTIMER_IntEnable(uint32_t flags)
Enable one or more CRYOTIMER interrupts.
Definition: em_cryotimer.h:279
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.
Definition: em_bus.h:148
#define _CRYOTIMER_IFS_MASK
#define _CRYOTIMER_CTRL_OSCSEL_LFXO
#define _CRYOTIMER_CTRL_PRESC_DIV4
#define _CRYOTIMER_CTRL_EN_SHIFT
#define _CRYOTIMER_CTRL_PRESC_DIV32
#define _CRYOTIMER_EM4WUEN_EM4WU_SHIFT
__STATIC_INLINE void CRYOTIMER_PeriodSet(uint32_t period)
Set the CRYOTIMER period select.
Definition: em_cryotimer.h:325
__STATIC_INLINE void CRYOTIMER_IntClear(uint32_t flags)
Clear the CRYOTIMER period interrupt.
Definition: em_cryotimer.h:229
#define _CRYOTIMER_PERIODSEL_MASK