EMU
[EM_Library]

Energy Management Unit (EMU) Peripheral API. More...

Collaboration diagram for EMU:

Data Structures

struct  EMU_EM23Init_TypeDef
struct  EMU_EM4Init_TypeDef

Defines

#define EMU_EM23INIT_DEFAULT   { false }
#define EMU_EM4INIT_DEFAULT

Enumerations

enum  EMU_EM23VregMode
enum  EMU_BODMode_TypeDef {
  emuBODMode_Active,
  emuBODMode_Inactive
}

Functions

__STATIC_INLINE void EMU_EnterEM1 (void)
 Enter energy mode 1 (EM1).
void EMU_EM23Init (EMU_EM23Init_TypeDef *em23Init)
void EMU_EM4Init (EMU_EM4Init_TypeDef *em4Init)
 Update EMU module with Energy Mode 4 configuration.
void EMU_EnterEM2 (bool restore)
 Enter energy mode 2 (EM2).
void EMU_EnterEM3 (bool restore)
 Enter energy mode 3 (EM3).
void EMU_EnterEM4 (void)
 Enter energy mode 4 (EM4).
void EMU_MemPwrDown (uint32_t blocks)
 Power down memory block.
void EMU_UpdateOscConfig (void)
 Update EMU module with CMU oscillator selection/enable status.
__STATIC_INLINE void EMU_Lock (void)
 Lock the EMU in order to protect all its registers against unintended modification.
__STATIC_INLINE void EMU_Unlock (void)
 Unlock the EMU so that writing to locked registers again is possible.
__STATIC_INLINE void EMU_EM2Block (void)
 Block entering EM2 or higher number energy modes.
__STATIC_INLINE void EMU_EM2UnBlock (void)
 Unblock entering EM2 or higher number energy modes.

Detailed Description

Energy Management Unit (EMU) Peripheral API.


Define Documentation

#define EMU_EM23INIT_DEFAULT   { false }

Default initialization of EM2 and 3 configuration

Definition at line 159 of file em_emu.h.

#define EMU_EM4INIT_DEFAULT
Value:
{ false,             /* Dont't lock configuration after it's been set */ \
    false,             /* No reset will be asserted due to Brownout when in EM4 */ \
    emuEM4Osc_ULFRCO,  /* Use default ULFRCO oscillator  */ \
    true,              /* Wake up on EM4 BURTC interrupt */ \
    true,              /* Enable VREG */ \
  }

Default initialization of EM4 configuration

Definition at line 180 of file em_emu.h.


Enumeration Type Documentation

BOD threshold setting selector, active or inactive mode

Enumerator:
emuBODMode_Active 

Configure BOD threshold for active mode

emuBODMode_Inactive 

Configure BOD threshold for inactive mode

Definition at line 138 of file em_emu.h.


Function Documentation

__STATIC_INLINE void EMU_EM2Block ( void   ) 

Block entering EM2 or higher number energy modes.

Definition at line 446 of file em_emu.h.

References BITBAND_Peripheral().

Here is the call graph for this function:

__STATIC_INLINE void EMU_EM2UnBlock ( void   ) 

Unblock entering EM2 or higher number energy modes.

Definition at line 456 of file em_emu.h.

References BITBAND_Peripheral().

Here is the call graph for this function:

void EMU_EM4Init ( EMU_EM4Init_TypeDef em4Init  ) 

Update EMU module with Energy Mode 4 configuration.

Parameters:
[in] em4Init Energy Mode 4 configuration structure

Definition at line 578 of file em_emu.c.

References EMU_EM4Init_TypeDef::buRtcWakeup, EMU_EM4Init_TypeDef::osc, and EMU_EM4Init_TypeDef::vreg.

__STATIC_INLINE void EMU_EnterEM1 ( void   ) 

Enter energy mode 1 (EM1).

Definition at line 250 of file em_emu.h.

void EMU_EnterEM2 ( bool  restore  ) 

Enter energy mode 2 (EM2).

When entering EM2, the high frequency clocks are disabled, ie HFXO, HFRCO and AUXHFRCO (for AUXHFRCO, see exception note below). When re-entering EM0, HFRCO is re-enabled and the core will be clocked by the configured HFRCO band. This ensures a quick wakeup from EM2.

However, prior to entering EM2, the core may have been using another oscillator than HFRCO. The restore parameter gives the user the option to restore all HF oscillators according to state prior to entering EM2, as well as the clock used to clock the core. This restore procedure is handled by SW. However, since handled by SW, it will not be restored before completing the interrupt function(s) waking up the core!

Note:
If restoring core clock to use the HFXO oscillator, which has been disabled during EM2 mode, this function will stall until the oscillator has stabilized. Stalling time can be reduced by adding interrupt support detecting stable oscillator, and an asynchronous switch to the original oscillator. See CMU documentation. Such a feature is however outside the scope of the implementation in this function.
If HFXO is re-enabled by this function, and NOT used to clock the core, this function will not wait for HFXO to stabilize. This must be considered by the application if trying to use features relying on that oscillator upon return.
If a debugger is attached, the AUXHFRCO will not be disabled if enabled upon entering EM2. It will thus remain enabled when returning to EM0 regardless of the restore parameter.
Parameters:
[in] restore 
  • true - restore oscillators and clocks, see function details.
  • false - do not restore oscillators and clocks, see function details.
The restore option should only be used if all clock control is done via the CMU API.

Definition at line 292 of file em_emu.c.

void EMU_EnterEM3 ( bool  restore  ) 

Enter energy mode 3 (EM3).

When entering EM3, the high frequency clocks are disabled by HW, ie HFXO, HFRCO and AUXHFRCO (for AUXHFRCO, see exception note below). In addition, the low frequency clocks, ie LFXO and LFRCO are disabled by SW. When re-entering EM0, HFRCO is re-enabled and the core will be clocked by the configured HFRCO band. This ensures a quick wakeup from EM3.

However, prior to entering EM3, the core may have been using another oscillator than HFRCO. The restore parameter gives the user the option to restore all HF/LF oscillators according to state prior to entering EM3, as well as the clock used to clock the core. This restore procedure is handled by SW. However, since handled by SW, it will not be restored before completing the interrupt function(s) waking up the core!

Note:
If restoring core clock to use an oscillator other than HFRCO, this function will stall until the oscillator has stabilized. Stalling time can be reduced by adding interrupt support detecting stable oscillator, and an asynchronous switch to the original oscillator. See CMU documentation. Such a feature is however outside the scope of the implementation in this function.
If HFXO/LFXO/LFRCO are re-enabled by this function, and NOT used to clock the core, this function will not wait for those oscillators to stabilize. This must be considered by the application if trying to use features relying on those oscillators upon return.
If a debugger is attached, the AUXHFRCO will not be disabled if enabled upon entering EM3. It will thus remain enabled when returning to EM0 regardless of the restore parameter.
Parameters:
[in] restore 
  • true - restore oscillators and clocks, see function details.
  • false - do not restore oscillators and clocks, see function details.
The restore option should only be used if all clock control is done via the CMU API.

Definition at line 391 of file em_emu.c.

References CMU_Lock(), and CMU_Unlock().

Here is the call graph for this function:

void EMU_EnterEM4 ( void   ) 

Enter energy mode 4 (EM4).

Note:
Only a power on reset or external reset pin can wake the device from EM4.

Definition at line 471 of file em_emu.c.

References EMU_Unlock().

Here is the call graph for this function:

__STATIC_INLINE void EMU_Lock ( void   ) 

Lock the EMU in order to protect all its registers against unintended modification.

Note:
If locking the EMU registers, they must be unlocked prior to using any EMU API functions modifying EMU registers. An exception to this is the energy mode entering API (EMU_EnterEMn()), which can be used when the EMU registers are locked.

Definition at line 427 of file em_emu.h.

Referenced by RMU_ResetCauseClear().

Here is the caller graph for this function:

void EMU_MemPwrDown ( uint32_t  blocks  ) 

Power down memory block.

Parameters:
[in] blocks Specifies a logical OR of bits indicating memory blocks to power down. Bit 0 selects block 1, bit 1 selects block 2, etc. Memory block 0 cannot be disabled. Please refer to the EFM32 reference manual for available memory blocks for a device.
Note:
Only a reset can make the specified memory block(s) available for use after having been powered down. Function will be void for devices not supporting this feature.

Definition at line 513 of file em_emu.c.

__STATIC_INLINE void EMU_Unlock ( void   ) 

Unlock the EMU so that writing to locked registers again is possible.

Definition at line 437 of file em_emu.h.

Referenced by EMU_EnterEM4(), and RMU_ResetCauseClear().

Here is the caller graph for this function:

void EMU_UpdateOscConfig ( void   ) 

Update EMU module with CMU oscillator selection/enable status.

When entering EM2 and EM3, the HW may change the core clock oscillator used, as well as disabling some oscillators. The user may optionally select to restore the oscillators after waking up from EM2 and EM3 through the SW API.

However, in order to support this in a safe way, the EMU module must be kept up-to-date on the actual selected configuration. The CMU module must keep the EMU module up-to-date.

This function is mainly intended for internal use by the CMU module, but if the applications changes oscillator configurations without using the CMU API, this function can be used to keep the EMU module up-to-date.

Definition at line 544 of file em_emu.c.

Referenced by CMU_ClockSelectSet(), and CMU_OscillatorEnable().

Here is the caller graph for this function: