EFM32 Leopard Gecko Software Documentation  efm32lg-doc-4.2.1

Backup Real Time Counter (BURTC) Peripheral API

. More...

Data Structures

struct  BURTC_Init_TypeDef
 

Macros

#define burtcClkDiv_1   1
 
#define burtcClkDiv_2   2
 
#define burtcClkDiv_4   4
 
#define burtcClkDiv_8   8
 
#define burtcClkDiv_16   16
 
#define burtcClkDiv_32   32
 
#define burtcClkDiv_64   64
 
#define burtcClkDiv_128   128
 
#define BURTC_INIT_DEFAULT
 

Enumerations

enum  BURTC_ClkSel_TypeDef {
  burtcClkSelULFRCO = BURTC_CTRL_CLKSEL_ULFRCO,
  burtcClkSelLFRCO = BURTC_CTRL_CLKSEL_LFRCO,
  burtcClkSelLFXO = BURTC_CTRL_CLKSEL_LFXO
}
 
enum  BURTC_Mode_TypeDef {
  burtcModeDisable = BURTC_CTRL_MODE_DISABLE,
  burtcModeEM2 = BURTC_CTRL_MODE_EM2EN,
  burtcModeEM3 = BURTC_CTRL_MODE_EM3EN,
  burtcModeEM4 = BURTC_CTRL_MODE_EM4EN
}
 
enum  BURTC_LP_TypeDef {
  burtcLPDisable = BURTC_LPMODE_LPMODE_DISABLE,
  burtcLPEnable = BURTC_LPMODE_LPMODE_ENABLE,
  burtcLPBU = BURTC_LPMODE_LPMODE_BUEN
}
 

Functions

__STATIC_INLINE void BURTC_IntClear (uint32_t flags)
 Clear one or more pending BURTC interrupts. More...
 
__STATIC_INLINE void BURTC_IntDisable (uint32_t flags)
 Disable one or more BURTC interrupts. More...
 
__STATIC_INLINE void BURTC_IntEnable (uint32_t flags)
 Enable one or more BURTC interrupts. More...
 
__STATIC_INLINE uint32_t BURTC_IntGet (void)
 Get pending BURTC interrupt flags. More...
 
__STATIC_INLINE uint32_t BURTC_IntGetEnabled (void)
 Get enabled and pending BURTC interrupt flags. More...
 
__STATIC_INLINE void BURTC_IntSet (uint32_t flags)
 Set one or more pending BURTC interrupts from SW. More...
 
__STATIC_INLINE uint32_t BURTC_Status (void)
 Status of BURTC RAM, timestamp and LP Mode. More...
 
__STATIC_INLINE void BURTC_StatusClear (void)
 Clear and reset BURTC status register.
 
__STATIC_INLINE void BURTC_Enable (bool enable)
 Enable or Disable BURTC peripheral reset and start counter. More...
 
__STATIC_INLINE uint32_t BURTC_CounterGet (void)
 Get BURTC counter. More...
 
__STATIC_INLINE uint32_t BURTC_TimestampGet (void)
 Get BURTC timestamp for entering BU. More...
 
__STATIC_INLINE void BURTC_FreezeEnable (bool enable)
 Freeze register updates until enabled. More...
 
__STATIC_INLINE void BURTC_Powerdown (bool enable)
 Shut down power to rentention register bank. More...
 
__STATIC_INLINE void BURTC_RetRegSet (uint32_t num, uint32_t data)
 Set a value in one of the retention registers. More...
 
__STATIC_INLINE uint32_t BURTC_RetRegGet (uint32_t num)
 Read a value from one of the retention registers. More...
 
__STATIC_INLINE void BURTC_Lock (void)
 Lock BURTC registers, will protect from writing new config settings.
 
__STATIC_INLINE void BURTC_Unlock (void)
 Unlock BURTC registers, enable write access to change configuration.
 
void BURTC_Reset (void)
 Restore BURTC to reset state. More...
 
void BURTC_Init (const BURTC_Init_TypeDef *burtcInit)
 Initialize BURTC. More...
 
void BURTC_CounterReset (void)
 Reset counter.
 
void BURTC_CompareSet (unsigned int comp, uint32_t value)
 Set BURTC compare channel. More...
 
uint32_t BURTC_CompareGet (unsigned int comp)
 Get BURTC compare value. More...
 
uint32_t BURTC_ClockFreqGet (void)
 Get clock frequency of the BURTC. More...
 

Detailed Description

Macro Definition Documentation

#define burtcClkDiv_1   1

BURTC clock divisors. These values are valid for the BURTC prescaler. Divide clock by 1.

Definition at line 62 of file em_burtc.h.

#define burtcClkDiv_2   2

Divide clock by 2.

Definition at line 63 of file em_burtc.h.

#define burtcClkDiv_4   4

Divide clock by 4.

Definition at line 64 of file em_burtc.h.

#define burtcClkDiv_8   8

Divide clock by 8.

Definition at line 65 of file em_burtc.h.

#define burtcClkDiv_16   16

Divide clock by 16.

Definition at line 66 of file em_burtc.h.

#define burtcClkDiv_32   32

Divide clock by 32.

Definition at line 67 of file em_burtc.h.

#define burtcClkDiv_64   64

Divide clock by 64.

Definition at line 68 of file em_burtc.h.

#define burtcClkDiv_128   128

Divide clock by 128.

Definition at line 69 of file em_burtc.h.

#define BURTC_INIT_DEFAULT
Value:
{ \
true, \
false, \
0, \
true, \
false, \
}
#define burtcClkDiv_1
Definition: em_burtc.h:62

Default configuration for BURTC init structure

Definition at line 134 of file em_burtc.h.

Enumeration Type Documentation

BURTC clock selection

Enumerator
burtcClkSelULFRCO 

Ultra low frequency (1 kHz) clock

burtcClkSelLFRCO 

Low frequency RC oscillator

burtcClkSelLFXO 

Low frequency crystal osciallator

Definition at line 76 of file em_burtc.h.

BURTC mode of operation

Enumerator
burtcModeDisable 

Disable BURTC

burtcModeEM2 

Enable and start BURTC counter in EM0 to EM2

burtcModeEM3 

Enable and start BURTC counter in EM0 to EM3

burtcModeEM4 

Enable and start BURTC counter in EM0 to EM4

Definition at line 88 of file em_burtc.h.

BURTC low power mode

Enumerator
burtcLPDisable 

Low Power Mode is disabled

burtcLPEnable 

Low Power Mode is always enabled

burtcLPBU 

Low Power Mode when system enters backup mode

Definition at line 101 of file em_burtc.h.

Function Documentation

__STATIC_INLINE void BURTC_IntClear ( uint32_t  flags)
Parameters
[in]flagsBURTC interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources for the BURTC module (BURTC_IFS_nnn).

Definition at line 160 of file em_burtc.h.

References BURTC.

Referenced by BURTC_Init().

__STATIC_INLINE void BURTC_IntDisable ( uint32_t  flags)
Parameters
[in]flagsBURTC interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt sources for the BURTC module (BURTC_IFS_nnn).

Definition at line 175 of file em_burtc.h.

References BURTC.

__STATIC_INLINE void BURTC_IntEnable ( uint32_t  flags)
Note
Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. Consider using BURTC_IntClear() prior to enabling if such a pending interrupt should be ignored.
Parameters
[in]flagsBURTC interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the BURTC module (BURTC_IFS_nnn).

Definition at line 195 of file em_burtc.h.

References BURTC.

__STATIC_INLINE uint32_t BURTC_IntGet ( void  )
Note
The event bits are not cleared by the use of this function.
Returns
Pending BURTC interrupt sources. Returns a set of interrupt flags OR-ed together for multiple interrupt sources in the BURTC module (BURTC_IFS_nnn).

Definition at line 212 of file em_burtc.h.

References BURTC.

__STATIC_INLINE uint32_t BURTC_IntGetEnabled ( void  )
Note
The event bits are not cleared by the use of this function.
Returns
Pending BURTC interrupt sources that is also enabled. Returns a set of interrupt flags OR-ed together for multiple interrupt sources in the BURTC module (BURTC_IFS_nnn).

Definition at line 230 of file em_burtc.h.

References BURTC.

__STATIC_INLINE void BURTC_IntSet ( uint32_t  flags)
Parameters
[in]flagsBURTC interrupt sources to set to pending. Use a set of interrupt flags OR-ed together to set multiple interrupt sources for the BURTC module (BURTC_IFS_nnn).

Definition at line 251 of file em_burtc.h.

References BURTC.

__STATIC_INLINE uint32_t BURTC_Status ( void  )
Returns
A mask logially OR-ed status bits

Definition at line 263 of file em_burtc.h.

References BURTC.

__STATIC_INLINE void BURTC_Enable ( bool  enable)
Parameters
[in]enableIf true; asserts reset to BURTC, halts counter, if false; deassert reset

Definition at line 285 of file em_burtc.h.

References _BURTC_CTRL_MODE_MASK, _BURTC_CTRL_RSTEN_SHIFT, BURTC, BURTC_CTRL_MODE_DISABLE, and BUS_RegBitWrite().

Referenced by BURTC_Init().

__STATIC_INLINE uint32_t BURTC_CounterGet ( void  )
Returns
BURTC counter value

Definition at line 309 of file em_burtc.h.

References BURTC.

__STATIC_INLINE uint32_t BURTC_TimestampGet ( void  )
Returns
BURTC Time Stamp value

Definition at line 321 of file em_burtc.h.

References BURTC.

__STATIC_INLINE void BURTC_FreezeEnable ( bool  enable)
Parameters
[in]enableIf true, registers are not updated until enabled again.

Definition at line 331 of file em_burtc.h.

References _BURTC_FREEZE_REGFREEZE_SHIFT, BURTC, and BUS_RegBitWrite().

Referenced by BURTC_Init().

__STATIC_INLINE void BURTC_Powerdown ( bool  enable)
Parameters
[in]enableIf true, shuts off power to retention registers.
Note
When power rentention is disabled, it cannot be enabled again (until reset).

Definition at line 345 of file em_burtc.h.

References _BURTC_POWERDOWN_RAM_SHIFT, BURTC, and BUS_RegBitWrite().

__STATIC_INLINE void BURTC_RetRegSet ( uint32_t  num,
uint32_t  data 
)
Parameters
[in]numRegister to set
[in]dataValue to put into register

Definition at line 360 of file em_burtc.h.

References BURTC.

__STATIC_INLINE uint32_t BURTC_RetRegGet ( uint32_t  num)
Parameters
[in]numRetention Register to read

Definition at line 375 of file em_burtc.h.

References BURTC.

void BURTC_Reset ( void  )
Note
Before accessing the BURTC, BURSTEN in RMU->CTRL must be cleared. LOCK will not be reset to default value, as this will disable access to core BURTC registers.

Definition at line 251 of file em_burtc.c.

References _RMU_CTRL_BURSTEN_SHIFT, BUS_RegBitRead(), BUS_RegBitWrite(), and RMU.

void BURTC_Init ( const BURTC_Init_TypeDef burtcInit)

Configures the BURTC peripheral.

Note
Before initialization, BURTC module must first be enabled by clearing the reset bit in the RMU, i.e.
*   RMU_ResetControl(rmuResetBU, rmuResetModeClear);
* 
Compare channel 0 must be configured outside this function, before initialization if enable is set to true. The counter will always be reset.
Parameters
[in]burtcInitPointer to BURTC initialization structure

Definition at line 125 of file em_burtc.c.

References _BURTC_CTRL_BUMODETSEN_SHIFT, _BURTC_CTRL_COMP0TOP_SHIFT, _BURTC_CTRL_DEBUGRUN_SHIFT, _BURTC_CTRL_LPCOMP_SHIFT, _BURTC_CTRL_PRESC_SHIFT, BURTC, BURTC_CTRL_RSTEN, BURTC_Enable(), BURTC_FreezeEnable(), BURTC_IntClear(), BURTC_SYNCBUSY_LPMODE, burtcClkSelULFRCO, burtcLPDisable, burtcModeDisable, BURTC_Init_TypeDef::clkDiv, BURTC_Init_TypeDef::clkSel, BURTC_Init_TypeDef::compare0Top, BURTC_Init_TypeDef::debugRun, BURTC_Init_TypeDef::enable, BURTC_Init_TypeDef::lowPowerComp, BURTC_Init_TypeDef::lowPowerMode, BURTC_Init_TypeDef::mode, and BURTC_Init_TypeDef::timeStamp.

void BURTC_CompareSet ( unsigned int  comp,
uint32_t  value 
)
Parameters
[in]compCompare channel index, must be 0 for Giant / Leopard Gecko
[in]valueNew compare value

Definition at line 200 of file em_burtc.c.

References BURTC, and BURTC_SYNCBUSY_COMP0.

uint32_t BURTC_CompareGet ( unsigned int  comp)
Parameters
[in]compCompare channel index value, must be 0 for Giant/Leopard.
Returns
Currently configured value for this compare channel

Definition at line 222 of file em_burtc.c.

References BURTC.

uint32_t BURTC_ClockFreqGet ( void  )
Returns
The current frequency in Hz.

Ultra low frequency (1 kHz) clock

Low frequency RC oscillator

Low frequency crystal osciallator

Definition at line 269 of file em_burtc.c.

References _BURTC_CTRL_CLKSEL_MASK, _BURTC_CTRL_PRESC_DIV1, _BURTC_CTRL_PRESC_MASK, _BURTC_CTRL_PRESC_SHIFT, BURTC, BURTC_CTRL_CLKSEL_LFRCO, BURTC_CTRL_CLKSEL_LFXO, BURTC_CTRL_CLKSEL_ULFRCO, SystemLFRCOClockGet(), SystemLFXOClockGet(), and SystemULFRCOClockGet().