EMUEMLIB

Detailed Description

Energy Management Unit (EMU) Peripheral API.

This module contains functions to control the EMU peripheral of Silicon Labs 32-bit MCUs and SoCs. The EMU handles the different low energy modes in Silicon Labs microcontrollers.

Data Structures

struct EMU_DCDCInit_TypeDef
struct EMU_EM01Init_TypeDef
struct EMU_EM23Init_TypeDef
struct EMU_EM4Init_TypeDef

Macros

#define EMU_DCDCINIT_DEFAULT
#define EMU_EM01INIT_DEFAULT
#define EMU_EM23INIT_DEFAULT
#define EMU_EM4INIT_DEFAULT
#define EMU_VSCALE_PRESENT

Enumerations

enum EMU_BODMode_TypeDef {
emuBODMode_Active ,
emuBODMode_Inactive
}
enum EMU_DcdcDriveSpeed_TypeDef {
emuDcdcDriveSpeed_BestEmi = _DCDC_EM01CTRL0_DRVSPEED_BEST_EMI,
emuDcdcDriveSpeed_Default = _DCDC_EM01CTRL0_DRVSPEED_DEFAULT_SETTING,
emuDcdcDriveSpeed_Intermediate = _DCDC_EM01CTRL0_DRVSPEED_INTERMEDIATE,
emuDcdcDriveSpeed_BestEfficiency = _DCDC_EM01CTRL0_DRVSPEED_BEST_EFFICIENCY
}
enum EMU_DcdcMode_TypeDef {
emuDcdcMode_Bypass ,
emuDcdcMode_Regulation
}
enum EMU_DcdcPeakCurrent_TypeDef {
emuDcdcPeakCurrent_Load36mA = _DCDC_EM01CTRL0_IPKVAL_Load36mA,
emuDcdcPeakCurrent_Load40mA = _DCDC_EM01CTRL0_IPKVAL_Load40mA,
emuDcdcPeakCurrent_Load44mA = _DCDC_EM01CTRL0_IPKVAL_Load44mA,
emuDcdcPeakCurrent_Load48mA = _DCDC_EM01CTRL0_IPKVAL_Load48mA,
emuDcdcPeakCurrent_Load52mA = _DCDC_EM01CTRL0_IPKVAL_Load52mA,
emuDcdcPeakCurrent_Load56mA = _DCDC_EM01CTRL0_IPKVAL_Load56mA,
emuDcdcPeakCurrent_Load60mA = _DCDC_EM01CTRL0_IPKVAL_Load60mA
}
enum EMU_DcdcTonMaxTimeout_TypeDef {
emuDcdcTonMaxTimeout_Off = _DCDC_CTRL_IPKTMAXCTRL_OFF,
emuDcdcTonMaxTimeout_0P35us = _DCDC_CTRL_IPKTMAXCTRL_TMAX_0P35us,
emuDcdcTonMaxTimeout_0P63us = _DCDC_CTRL_IPKTMAXCTRL_TMAX_0P63us,
emuDcdcTonMaxTimeout_0P91us = _DCDC_CTRL_IPKTMAXCTRL_TMAX_0P91us,
emuDcdcTonMaxTimeout_1P19us = _DCDC_CTRL_IPKTMAXCTRL_TMAX_1P19us,
emuDcdcTonMaxTimeout_1P47us = _DCDC_CTRL_IPKTMAXCTRL_TMAX_1P47us,
emuDcdcTonMaxTimeout_1P75us = _DCDC_CTRL_IPKTMAXCTRL_TMAX_1P75us,
emuDcdcTonMaxTimeout_2P03us = _DCDC_CTRL_IPKTMAXCTRL_TMAX_2P03us
}
enum EMU_EM4PinRetention_TypeDef {
emuPinRetentionDisable = EMU_EM4CTRL_EM4IORETMODE_DISABLE,
emuPinRetentionEm4Exit = EMU_EM4CTRL_EM4IORETMODE_EM4EXIT,
emuPinRetentionLatch = EMU_EM4CTRL_EM4IORETMODE_SWUNLATCH
}
enum EMU_EM4State_TypeDef {
emuEM4Shutoff = 0,
emuEM4Hibernate = 1
}
enum EMU_PowerConfig_TypeDef { emuPowerConfig_DcdcToDvdd }
enum EMU_VreginCmpThreshold_TypeDef {
emuVreginCmpThreshold_2v0 = 0,
emuVreginCmpThreshold_2v1 = 1,
emuVreginCmpThreshold_2v2 = 2,
emuVreginCmpThreshold_2v3 = 3
}
enum EMU_VScaleEM01_TypeDef {
emuVScaleEM01_HighPerformance = _EMU_STATUS_VSCALE_VSCALE2,
emuVScaleEM01_LowPower = _EMU_STATUS_VSCALE_VSCALE1
}
enum EMU_VScaleEM23_TypeDef {
emuVScaleEM23_FastWakeup = _EMU_CTRL_EM23VSCALE_VSCALE2,
emuVScaleEM23_LowPower = _EMU_CTRL_EM23VSCALE_VSCALE0
}

Functions

bool EMU_DCDCInit (const EMU_DCDCInit_TypeDef *dcdcInit)
__STATIC_INLINE void EMU_DCDCLock (void)
Lock DCDC registers in order to protect them against unintended modification.
void EMU_DCDCModeSet ( EMU_DcdcMode_TypeDef dcdcMode)
bool EMU_DCDCPowerOff (void)
__STATIC_INLINE void EMU_DCDCUnlock (void)
Unlock the DCDCU so that writing to locked registers again is possible.
void EMU_EM01Init (const EMU_EM01Init_TypeDef *em01Init)
Update the EMU module with Energy Mode 0 and 1 configuration.
void EMU_EM23Init (const EMU_EM23Init_TypeDef *em23Init)
Update the EMU module with Energy Mode 2 and 3 configuration.
void EMU_EM23PostsleepHook (void)
Energy mode 2/3 post-sleep hook function.
void EMU_EM23PresleepHook (void)
Energy mode 2/3 pre-sleep hook function.
void EMU_EM4Init (const EMU_EM4Init_TypeDef *em4Init)
Update the EMU module with Energy Mode 4 configuration.
__STATIC_INLINE void EMU_EnterEM1 (void)
Enter energy mode 1 (EM1).
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_EnterEM4H (void)
Enter energy mode 4 hibernate (EM4H).
void EMU_EnterEM4S (void)
Enter energy mode 4 shutoff (EM4S).
__STATIC_INLINE void EMU_IntClear (uint32_t flags)
Clear one or more pending EMU interrupts.
__STATIC_INLINE void EMU_IntDisable (uint32_t flags)
Disable one or more EMU interrupts.
__STATIC_INLINE void EMU_IntEnable (uint32_t flags)
Enable one or more EMU interrupts.
__STATIC_INLINE uint32_t EMU_IntGet (void)
Get pending EMU interrupt flags.
__STATIC_INLINE uint32_t EMU_IntGetEnabled (void)
Get enabled and pending EMU interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.
__STATIC_INLINE void EMU_IntSet (uint32_t flags)
Set one or more pending EMU interrupts.
__STATIC_INLINE void EMU_Lock (void)
Lock EMU registers in order to protect them against unintended modification.
void EMU_MemPwrDown (uint32_t blocks)
Power down memory block.
void EMU_RamPowerDown (uint32_t start, uint32_t end)
Power down RAM memory blocks.
void EMU_RamPowerUp (void)
Power up all available RAM memory blocks.
void EMU_Restore (void)
Restore CMU HF clock select state, oscillator enable, and voltage scaling (if available) after EMU_EnterEM2() or EMU_EnterEM3() are called with the restore parameter set to false. Calling this function is equivalent to calling EMU_EnterEM2() or EMU_EnterEM3() with the restore parameter set to true, but it allows the application to evaluate the wakeup reason before restoring state.
void EMU_Save (void)
Save the CMU HF clock select state, oscillator enable, and voltage scaling (if available) before EMU_EnterEM2() or EMU_EnterEM3() are called with the restore parameter set to false. Calling this function is equivalent to calling EMU_EnterEM2() or EMU_EnterEM3() with the restore parameter set to true, but it allows the state to be saved without going to sleep. The state can be restored manually by calling EMU_Restore() .
__STATIC_INLINE void EMU_UnlatchPinRetention (void)
When EM4 pin retention is set to emuPinRetentionLatch, then pins are retained through EM4 entry and wakeup. The pin state is released by calling this function. The feature allows peripherals or GPIO to be re-initialized after EM4 exit (reset), and when initialization is done, this function can release pins and return control to the peripherals or GPIO.
__STATIC_INLINE void EMU_Unlock (void)
Unlock the EMU so that writing to locked registers again is possible.
void EMU_UpdateOscConfig (void)
Update EMU module with CMU oscillator selection/enable status.
void EMU_VScaleEM01 ( EMU_VScaleEM01_TypeDef voltage, bool wait)
Force voltage scaling in EM0 and 1 to a specific voltage level.
void EMU_VScaleEM01ByClock (uint32_t clockFrequency, bool wait)
Voltage scale in EM0 and 1 by clock frequency.
__STATIC_INLINE EMU_VScaleEM01_TypeDef EMU_VScaleGet (void)
Get current voltage scaling level.
__STATIC_INLINE void EMU_VScaleWait (void)
Wait for voltage scaling to complete.

Macro Definition Documentation

#define EMU_DCDCINIT_DEFAULT
Value:
{ \
emuDcdcMode_Regulation, \
emuVreginCmpThreshold_2v3, \
emuDcdcTonMaxTimeout_1P19us, \
true, \
emuDcdcDriveSpeed_Default, \
emuDcdcDriveSpeed_Default, \
emuDcdcPeakCurrent_Load60mA, \
emuDcdcPeakCurrent_Load36mA \
}

Default DCDC initialization.

Definition at line 751 of file em_emu.h .

#define EMU_EM01INIT_DEFAULT
Value:
{ \
false \
}

Default initialization of EM0 and 1 configuration.

Definition at line 576 of file em_emu.h .

Referenced by BSP_initEmu() .

#define EMU_EM23INIT_DEFAULT
Value:
{ \
false, /* Reduced voltage regulator drive strength in EM2/3.*/ \
emuVScaleEM23_FastWakeup, /* Do not scale down in EM2/3. */ \
}

Default initialization of EM2 and 3 configuration.

Definition at line 592 of file em_emu.h .

Referenced by BSP_initEmu() .

#define EMU_EM4INIT_DEFAULT
Value:
{ \
false, /* Retain LFXO configuration upon EM4 entry. */ \
false, /* Retain LFRCO configuration upon EM4 entry. */ \
false, /* Retain ULFRCO configuration upon EM4 entry. */ \
emuEM4Shutoff, /* Use EM4 shutoff state. */ \
emuPinRetentionDisable, /* Do not retain pins in EM4. */ \
}

Default initialization of EM4 configuration (Series 1 without VSCALE).

Definition at line 653 of file em_emu.h .

Referenced by UTIL_shutdown() .

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 180 of file em_emu.h .

DCDC drive speed.

Enumerator
emuDcdcDriveSpeed_BestEmi

Lowest efficiency, lowest EMI.

emuDcdcDriveSpeed_Default

Default efficiency, acceptable EMI level.

emuDcdcDriveSpeed_Intermediate

Small increase in efficiency from the default setting.

emuDcdcDriveSpeed_BestEfficiency

Highest efficiency, highest EMI. Small increase in efficiency from INTERMEDIATE setting.

Definition at line 332 of file em_emu.h .

DCDC mode.

Enumerator
emuDcdcMode_Bypass

DCDC regulator bypass.

emuDcdcMode_Regulation

DCDC regulator on.

Definition at line 306 of file em_emu.h .

DCDC peak current setting.

Enumerator
emuDcdcPeakCurrent_Load36mA

Load 36mA, peak current 90mA.

emuDcdcPeakCurrent_Load40mA

Load 40mA, peak current 100mA.

emuDcdcPeakCurrent_Load44mA

Load 44mA, peak current 110mA.

emuDcdcPeakCurrent_Load48mA

Load 48mA, peak current 120mA.

emuDcdcPeakCurrent_Load52mA

Load 52mA, peak current 130mA.

emuDcdcPeakCurrent_Load56mA

Load 56mA, peak current 140mA.

emuDcdcPeakCurrent_Load60mA

Load 60mA, peak current 150mA.

Definition at line 340 of file em_emu.h .

DCDC Ton max timeout.

Enumerator
emuDcdcTonMaxTimeout_Off

Ton max off.

emuDcdcTonMaxTimeout_0P35us

Ton max is 0.35us.

emuDcdcTonMaxTimeout_0P63us

Ton max is 0.63us.

emuDcdcTonMaxTimeout_0P91us

Ton max is 0.91us.

emuDcdcTonMaxTimeout_1P19us

Ton max is 1.19us.

emuDcdcTonMaxTimeout_1P47us

Ton max is 1.47us.

emuDcdcTonMaxTimeout_1P75us

Ton max is 1.75us.

emuDcdcTonMaxTimeout_2P03us

Ton max is 2.03us.

Definition at line 320 of file em_emu.h .

Enumerator
emuPinRetentionDisable

No Retention: Pads enter reset state when entering EM4.

emuPinRetentionEm4Exit

Retention through EM4: Pads enter reset state when exiting EM4.

emuPinRetentionLatch

Retention through EM4 and wakeup: call EMU_UnlatchPinRetention() to release pins from retention after EM4 wakeup.

Definition at line 196 of file em_emu.h .

EM4 modes.

Enumerator
emuEM4Shutoff

EM4 Shutoff.

emuEM4Hibernate

EM4 Hibernate.

Definition at line 188 of file em_emu.h .

Power configurations. DCDC-to-DVDD is currently the only supported mode.

Enumerator
emuPowerConfig_DcdcToDvdd

DCDC is connected to DVDD.

Definition at line 208 of file em_emu.h .

VREGIN comparator threshold.

Enumerator
emuVreginCmpThreshold_2v0

Comparator threshold is 2.0V.

emuVreginCmpThreshold_2v1

Comparator threshold is 2.1V.

emuVreginCmpThreshold_2v2

Comparator threshold is 2.2V.

emuVreginCmpThreshold_2v3

Comparator threshold is 2.3V.

Definition at line 312 of file em_emu.h .

Supported EM0/1 Voltage Scaling Levels.

Enumerator
emuVScaleEM01_HighPerformance

High-performance voltage level. HF clock can be set to any frequency.

emuVScaleEM01_LowPower

Low-power optimized voltage level. HF clock must be limited to CMU_VSCALEEM01_LOWPOWER_VOLTAGE_CLOCK_MAX Hz at this voltage. EM0/1 voltage scaling is applied when core clock frequency is changed from CMU or when calling EMU_EM01Init() when HF clock is already below the limit. Minimum VSCALE level in EM0/1 is VSCALE1.

Definition at line 401 of file em_emu.h .

Supported EM2/3 Voltage Scaling Levels.

Enumerator
emuVScaleEM23_FastWakeup

Fast-wakeup voltage level.

emuVScaleEM23_LowPower

Low-power optimized voltage level. Using this voltage level in EM2 and 3 adds approximately 30 us to wakeup time if EM0 and 1 voltage must be scaled up to emuVScaleEM01_HighPerformance on EM2 or 3 exit.

Definition at line 420 of file em_emu.h .

Function Documentation

void EMU_EM01Init ( const EMU_EM01Init_TypeDef * em01Init )

Update the EMU module with Energy Mode 0 and 1 configuration.

Parameters
[in] em01Init Energy Mode 0 and 1 configuration structure.

Definition at line 1485 of file em_emu.c .

References EMU_VScaleEM01ByClock() , and EMU_EM01Init_TypeDef::vScaleEM01LowPowerVoltageEnable .

Referenced by BSP_initEmu() .

void EMU_EM23Init ( const EMU_EM23Init_TypeDef * em23Init )

Update the EMU module with Energy Mode 2 and 3 configuration.

Parameters
[in] em23Init Energy Mode 2 and 3 configuration structure.

Definition at line 1500 of file em_emu.c .

References EMU_EM23Init_TypeDef::em23VregFullEn , emuVScaleEM23_LowPower , and EMU_EM23Init_TypeDef::vScaleEM23Voltage .

Referenced by BSP_initEmu() .

SL_WEAK void EMU_EM23PostsleepHook ( void )

Energy mode 2/3 post-sleep hook function.

This function is called by EMU_EnterEM2() and EMU_EnterEM3() functions just after wakeup from the WFI instruction. The function implementation does not perform anything, but it is SL_WEAK so that it can be re- implemented in application code if actions are needed.

Note
The function is primarily meant to be used in systems with EFP circuitry. (EFP = Energy Friendly Pmic (PMIC = Power Management IC)). In such systems there is a need to drive certain signals to EFP pins to notify about energy mode transitions.

Definition at line 635 of file em_emu.c .

Referenced by EMU_EnterEM2() , and EMU_EnterEM3() .

SL_WEAK void EMU_EM23PresleepHook ( void )

Energy mode 2/3 pre-sleep hook function.

This function is called by EMU_EnterEM2() and EMU_EnterEM3() functions just prior to execution of the WFI instruction. The function implementation does not perform anything, but it is SL_WEAK so that it can be re- implemented in application code if actions are needed.

Note
The function is primarily meant to be used in systems with EFP circuitry. (EFP = Energy Friendly Pmic (PMIC = Power Management IC)). In such systems there is a need to drive certain signals to EFP pins to notify about energy mode transitions.

Definition at line 615 of file em_emu.c .

Referenced by EMU_EnterEM2() , and EMU_EnterEM3() .

void EMU_EM4Init ( const EMU_EM4Init_TypeDef * em4Init )

Update the EMU module with Energy Mode 4 configuration.

Parameters
[in] em4Init Energy Mode 4 configuration structure.

Definition at line 1532 of file em_emu.c .

References EMU_EM4Init_TypeDef::em4State , emuEM4Hibernate , EMU_EM4Init_TypeDef::pinRetentionMode , EMU_EM4Init_TypeDef::retainLfrco , EMU_EM4Init_TypeDef::retainLfxo , and EMU_EM4Init_TypeDef::retainUlfrco .

Referenced by UTIL_shutdown() .

void EMU_EnterEM2 ( bool restore )

Enter energy mode 2 (EM2).

When entering EM2, high-frequency clocks are disabled, i.e., 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 ERRATA_FIX_EMU_E110_ENABLE is active, the core's SLEEPONEXIT feature can not be used.
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.
If HFXO autostart and select is enabled by using CMU_HFXOAutostartEnable(), the starting and selecting of the core clocks will be identical to the user independently of the value of the restore parameter when waking up on the wakeup sources corresponding to the autostart and select setting.
If voltage scaling is supported, the restore parameter is true and the EM0 voltage scaling level is set higher than the EM2 level, then the EM0 level is also restored.
On Series 2 Config 2 devices (EFRxG22), this function will also relock the DPLL if the DPLL is used and restore is true.

Note that the hardware will automatically update the HFRCO frequency in the case where voltage scaling is used in EM2/EM3 and not in EM0/EM1. When the restore argument to this function is true then software will restore the original HFRCO frequency after EM2/EM3 wake up. If the restore argument is false then the HFRCO frequency is 19 MHz when coming out of EM2/EM3 and all wait states are at a safe value.

Parameters
[in] restore
  • true - save and restore oscillators, clocks and voltage scaling, see function details.
  • false - do not save and 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 704 of file em_emu.c .

References CORE_CRITICAL_SECTION , EMU_EM23PostsleepHook() , EMU_EM23PresleepHook() , and SystemCoreClockUpdate() .

Referenced by CAPLESENSE_Sleep() , UTIL_sleep() , and UTIL_waitForEvent() .

void EMU_EnterEM3 ( bool restore )

Enter energy mode 3 (EM3).

When entering EM3, the high-frequency clocks are disabled by hardware, i.e., HFXO, HFRCO, and AUXHFRCO (for AUXHFRCO, see exception note below). In addition, the low-frequency clocks, i.e., LFXO and LFRCO are disabled by software. 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 an oscillator other 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 software. However, since it is handled by software, 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. This feature is, however, outside the scope of the implementation in this function.
If ERRATA_FIX_EMU_E110_ENABLE is active, the core's SLEEPONEXIT feature can't be used.
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, therefore, remain enabled when returning to EM0 regardless of the restore parameter.
If voltage scaling is supported, the restore parameter is true and the EM0 voltage scaling level is set higher than the EM3 level, then the EM0 level is also restored.
On Series 2 Config 2 devices (EFRxG22), this function will also relock the DPLL if the DPLL is used and restore is true.
Parameters
[in] restore
  • true - save and restore oscillators, clocks and voltage scaling, see function details.
  • false - do not save and 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 855 of file em_emu.c .

References CMU_Lock() , CMU_Unlock() , CORE_CRITICAL_SECTION , EMU_EM23PostsleepHook() , EMU_EM23PresleepHook() , and SystemCoreClockUpdate() .

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 1012 of file em_emu.c .

References BUS_RegMaskedClear() , EMU_Unlock() , and emuDcdcMode_Bypass .

Referenced by EMU_EnterEM4H() , EMU_EnterEM4S() , and UTIL_shutdown() .

void EMU_EnterEM4H ( void )

Enter energy mode 4 hibernate (EM4H).

Note
Retention of clocks and GPIO in EM4 can be configured using EMU_EM4Init before calling this function.

Definition at line 1117 of file em_emu.c .

References BUS_RegBitWrite() , and EMU_EnterEM4() .

void EMU_EnterEM4S ( void )

Enter energy mode 4 shutoff (EM4S).

Note
Retention of clocks and GPIO in EM4 can be configured using EMU_EM4Init before calling this function.

Definition at line 1133 of file em_emu.c .

References BUS_RegBitWrite() , and EMU_EnterEM4() .

__STATIC_INLINE void EMU_IntClear ( uint32_t flags )

Clear one or more pending EMU interrupts.

Parameters
[in] flags Pending EMU interrupt sources to clear. Use one or more valid interrupt flags for the EMU module (EMU_IFC_nnn).

Definition at line 1099 of file em_emu.h .

Referenced by disableInterrupts() , and TEMPDRV_IRQHandler() .

__STATIC_INLINE void EMU_IntDisable ( uint32_t flags )

Disable one or more EMU interrupts.

Parameters
[in] flags EMU interrupt sources to disable. Use one or more valid interrupt flags for the EMU module (EMU_IEN_nnn).

Definition at line 1116 of file em_emu.h .

Referenced by disableInterrupts() , and updateInterrupts() .

__STATIC_INLINE void EMU_IntEnable ( uint32_t flags )

Enable one or more EMU interrupts.

Note
Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using EMU_IntClear() prior to enabling the interrupt.
Parameters
[in] flags EMU interrupt sources to enable. Use one or more valid interrupt flags for the EMU module (EMU_IEN_nnn).

Definition at line 1138 of file em_emu.h .

Referenced by updateInterrupts() .

__STATIC_INLINE uint32_t EMU_IntGet ( void )

Get pending EMU interrupt flags.

Note
Event bits are not cleared by the use of this function.
Returns
EMU interrupt sources pending. Returns one or more valid interrupt flags for the EMU module (EMU_IF_nnn).

Definition at line 1158 of file em_emu.h .

__STATIC_INLINE uint32_t EMU_IntGetEnabled ( void )

Get enabled and pending EMU interrupt flags. Useful for handling more interrupt sources in the same interrupt handler.

Note
Interrupt flags are not cleared by the use of this function.
Returns
Pending and enabled EMU interrupt sources Return value is the bitwise AND of
  • the enabled interrupt sources in EMU_IEN and
  • the pending interrupt flags EMU_IF.

Definition at line 1177 of file em_emu.h .

Referenced by TEMPDRV_IRQHandler() .

__STATIC_INLINE void EMU_IntSet ( uint32_t flags )

Set one or more pending EMU interrupts.

Parameters
[in] flags EMU interrupt sources to set to pending. Use one or more valid interrupt flags for the EMU module (EMU_IFS_nnn).

Definition at line 1193 of file em_emu.h .

__STATIC_INLINE void EMU_Lock ( void )

Lock EMU registers in order to protect them against unintended modification.

Note
If locking EMU registers, they must be unlocked prior to using any EMU API functions modifying EMU registers, excluding interrupt control and regulator control if the architecture has a EMU_PWRCTRL register. 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 1253 of file em_emu.h .

Referenced by RMU_ResetCauseClear() .

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, and so on. Memory block 0 cannot be disabled. See the reference manual for available memory blocks for a device.
Note
Only a POR reset can power up the specified memory block(s) after power down.
Deprecated:
This function is deprecated, use EMU_RamPowerDown() instead which maps a user provided memory range into RAM blocks to power down.

Definition at line 1159 of file em_emu.c .

void EMU_RamPowerDown ( uint32_t start,
uint32_t end
)

Power down RAM memory blocks.

This function will power down all the RAM blocks that are within a given range. The RAM block layout is different between device families, so this function can be used in a generic way to power down a RAM memory region which is known to be unused.

This function will only power down blocks which are completely enclosed by the memory range given by [start, end).

This is an example to power down all RAM blocks except the first one. The first RAM block is special in that it cannot be powered down by the hardware. The size of the first RAM block is device-specific. See the reference manual to find the RAM block sizes.

1 EMU_RamPowerDown(SRAM_BASE, SRAM_BASE + SRAM_SIZE);
Note
Only a reset can power up the specified memory block(s) after power down on a series 0 device.
Parameters
[in] start The start address of the RAM region to power down. This address is inclusive.
[in] end The end address of the RAM region to power down. This address is exclusive. If this parameter is 0, all RAM blocks contained in the region from start to the upper RAM address will be powered down.

Definition at line 1205 of file em_emu.c .

void EMU_RamPowerUp ( void )

Power up all available RAM memory blocks.

This function will power up all the RAM blocks on a device, this means that the RAM blocks are retained in EM2/EM3. Note that this functionality is not supported on Series 0 devices. Only a reset will power up the RAM blocks on a series 0 device.

Definition at line 1286 of file em_emu.c .

void EMU_UpdateOscConfig ( void )

Update EMU module with CMU oscillator selection/enable status.

Deprecated:
Oscillator status is saved in EMU_EnterEM2() and EMU_EnterEM3() .

Definition at line 1336 of file em_emu.c .

void EMU_VScaleEM01 ( EMU_VScaleEM01_TypeDef voltage,
bool wait
)

Force voltage scaling in EM0 and 1 to a specific voltage level.

Parameters
[in] voltage Target VSCALE voltage level.
[in] wait Wait for scaling to complete.
Note
This function is useful for upscaling before programming Flash from MSC and downscaling after programming is done. Flash programming is only supported at emuVScaleEM01_HighPerformance .
This function ignores vScaleEM01LowPowerVoltageEnable set from EMU_EM01Init() .

Definition at line 1411 of file em_emu.c .

References CMU_UpdateWaitStates() , CORE_DECLARE_IRQ_STATE , CORE_ENTER_CRITICAL , CORE_EXIT_CRITICAL , EMU_VScaleGet() , EMU_VScaleWait() , emuVScaleEM01_HighPerformance , emuVScaleEM01_LowPower , and SystemSYSCLKGet() .

Referenced by CMU_ClockSelectSet() , and EMU_VScaleEM01ByClock() .

void EMU_VScaleEM01ByClock ( uint32_t clockFrequency,
bool wait
)

Voltage scale in EM0 and 1 by clock frequency.

Parameters
[in] clockFrequency Use CMSIS HF clock if 0 or override to custom clock. Providing a custom clock frequency is required if using a non-standard HFXO frequency.
[in] wait Wait for scaling to complete.
Note
This function is primarily needed by the CMU module.

Definition at line 1358 of file em_emu.c .

References EMU_VScaleEM01() , emuVScaleEM01_HighPerformance , emuVScaleEM01_LowPower , SystemSYSCLKGet() , and EMU_EM01Init_TypeDef::vScaleEM01LowPowerVoltageEnable .

Referenced by CMU_ClockSelectSet() , CMU_HFRCODPLLBandSet() , and EMU_EM01Init() .

__STATIC_INLINE EMU_VScaleEM01_TypeDef EMU_VScaleGet ( void )

Get current voltage scaling level.

Returns
Current voltage scaling level.

Definition at line 1066 of file em_emu.h .

References EMU_VScaleWait() .

Referenced by CMU_DPLLLock() , and EMU_VScaleEM01() .