33 #ifndef __SILICON_LABS_EM_EMU_H__
34 #define __SILICON_LABS_EM_EMU_H__
37 #if defined( EMU_PRESENT )
60 #if defined( _EMU_EM4CONF_OSC_MASK )
65 emuEM4Osc_ULFRCO = EMU_EM4CONF_OSC_ULFRCO,
67 emuEM4Osc_LFXO = EMU_EM4CONF_OSC_LFXO,
69 emuEM4Osc_LFRCO = EMU_EM4CONF_OSC_LFRCO
73 #if defined( _EMU_BUCTRL_PROBE_MASK )
78 emuProbe_Disable = EMU_BUCTRL_PROBE_DISABLE,
80 emuProbe_VDDDReg = EMU_BUCTRL_PROBE_VDDDREG,
82 emuProbe_BUIN = EMU_BUCTRL_PROBE_BUIN,
84 emuProbe_BUOUT = EMU_BUCTRL_PROBE_BUOUT
88 #if defined( _EMU_PWRCONF_PWRRES_MASK )
93 emuRes_Res0 = EMU_PWRCONF_PWRRES_RES0,
95 emuRes_Res1 = EMU_PWRCONF_PWRRES_RES1,
97 emuRes_Res2 = EMU_PWRCONF_PWRRES_RES2,
99 emuRes_Res3 = EMU_PWRCONF_PWRRES_RES3,
100 } EMU_Resistor_TypeDef;
103 #if defined( BU_PRESENT )
108 emuPower_None = EMU_BUINACT_PWRCON_NONE,
111 emuPower_BUMain = EMU_BUINACT_PWRCON_BUMAIN,
114 emuPower_MainBU = EMU_BUINACT_PWRCON_MAINBU,
116 emuPower_NoDiode = EMU_BUINACT_PWRCON_NODIODE,
129 #if defined( _EMU_EM4CTRL_EM4STATE_MASK )
141 #if defined( _EMU_EM4CTRL_EM4IORETMODE_MASK )
155 #if defined( _EMU_PWRCFG_MASK )
164 #if defined( _EMU_DCDCCTRL_MASK )
175 #if defined( _EMU_PWRCTRL_MASK )
186 #if defined( _EMU_DCDCMISCCTRL_MASK )
190 #if defined( _EFM_DEVICE )
199 #if defined( _EMU_DCDCCTRL_MASK )
223 #if defined( EMU_STATUS_VMONRDY )
228 emuVmonChannel_ALTAVDD,
230 emuVmonChannel_IOVDD0
245 #define EMU_EM23INIT_DEFAULT \
249 #if defined( _EMU_EM4CONF_MASK ) || defined( _EMU_EM4CTRL_MASK )
253 #if defined( _EMU_EM4CONF_MASK )
257 EMU_EM4Osc_TypeDef osc;
261 #elif defined( _EMU_EM4CTRL_MASK )
273 #if defined( _EMU_EM4CONF_MASK )
274 #define EMU_EM4INIT_DEFAULT \
283 #if defined( _EMU_EM4CTRL_MASK )
284 #define EMU_EM4INIT_DEFAULT \
290 emuPinRetentionDisable, \
294 #if defined( BU_PRESENT )
301 EMU_Probe_TypeDef probe;
305 bool statusPinEnable;
309 EMU_Resistor_TypeDef resistor;
317 EMU_Power_TypeDef inactivePower;
319 EMU_Power_TypeDef activePower;
322 } EMU_BUPDInit_TypeDef;
325 #define EMU_BUPDINIT_DEFAULT \
342 #if defined( _EMU_DCDCCTRL_MASK )
366 #if defined( _EFM_DEVICE )
367 #define EMU_DCDCINIT_DEFAULT \
369 emuPowerConfig_DcdcToDvdd, \
370 emuDcdcMode_LowNoise, \
375 emuDcdcAnaPeripheralPower_DCDC, \
376 emuDcdcLnHighEfficiency, \
379 #define EMU_DCDCINIT_DEFAULT \
381 emuPowerConfig_DcdcToDvdd, \
382 emuDcdcMode_LowNoise, \
387 emuDcdcAnaPeripheralPower_AVDD, \
388 emuDcdcLnFastTransient, \
394 #if defined( EMU_STATUS_VMONRDY )
407 #define EMU_VMONINIT_DEFAULT \
409 emuVmonChannel_AVDD, \
429 #define EMU_VMONHYSTINIT_DEFAULT \
431 emuVmonChannel_AVDD, \
451 SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
456 #if defined( _EMU_EM4CONF_MASK ) || defined( _EMU_EM4CTRL_MASK )
464 #if defined( BU_PRESENT )
465 void EMU_BUPDInit(EMU_BUPDInit_TypeDef *bupdInit);
469 #if defined( _EMU_DCDCCTRL_MASK )
477 #if defined( EMU_STATUS_VMONRDY )
497 #if defined( _EMU_IF_MASK )
581 return EMU->IF & ien;
600 #if defined( _EMU_EM4CONF_LOCKCONF_MASK )
607 __STATIC_INLINE
void EMU_EM4Lock(
bool enable)
613 #if defined( _EMU_STATUS_BURDY_MASK )
618 __STATIC_INLINE
void EMU_BUReady(
void)
620 while(!(
EMU->STATUS & EMU_STATUS_BURDY))
625 #if defined( _EMU_ROUTE_BUVINPEN_MASK )
632 __STATIC_INLINE
void EMU_BUPinEnable(
bool enable)
666 #if defined( _EMU_PWRLOCK_MASK )
708 #if defined( _EMU_EM4CTRL_EM4IORETMODE_MASK )
EMU_DcdcAnaPeripheralPower_TypeDef anaPeripheralPower
EMU_EM4PinRetention_TypeDef pinRetentionMode
bool EMU_DCDCPowerOff(void)
Power off the DCDC regulator.
bool EMU_DCDCInit(EMU_DCDCInit_TypeDef *dcdcInit)
Configure DCDC regulator.
void EMU_EnterEM4(void)
Enter energy mode 4 (EM4).
RAM and peripheral bit-field set and clear API.
#define EMU_DCDCCTRL_DCDCMODE_BYPASS
__STATIC_INLINE void EMU_IntDisable(uint32_t flags)
Disable one or more EMU interrupts.
void EMU_MemPwrDown(uint32_t blocks)
Power down memory block.
#define EMU_CMD_EM4UNLATCH
#define EMU_PWRCTRL_ANASW_AVDD
void EMU_VmonHystInit(EMU_VmonHystInit_TypeDef *vmonInit)
Initialize VMON channel with hysteresis (separate rise and fall triggers).
void EMU_EnterEM3(bool restore)
Enter energy mode 3 (EM3).
void EMU_EnterEM2(bool restore)
Enter energy mode 2 (EM2).
#define EMU_EM4CTRL_EM4STATE_EM4S
EMU_PowerConfig_TypeDef powerConfig
bool EMU_DCDCOutputVoltageSet(uint32_t mV, bool setLpVoltage, bool setLnVoltage)
Set DCDC output voltage.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define EMU_LOCK_LOCKKEY_LOCK
void EMU_VmonEnable(EMU_VmonChannel_TypeDef channel, bool enable)
Enable or disable a VMON channel.
#define _EMU_CTRL_EM2BLOCK_SHIFT
__STATIC_INLINE unsigned int BUS_RegBitRead(volatile const uint32_t *addr, unsigned int bit)
Perform a single-bit read operation on a peripheral register.
uint16_t em01LoadCurrent_mA
__STATIC_INLINE void EMU_Unlock(void)
Unlock the EMU so that writing to locked registers again is possible.
__STATIC_INLINE void EMU_Lock(void)
Lock the EMU in order to protect its registers against unintended modification.
EMU_DcdcLnTransientMode_TypeDef
#define EMU_PWRCFG_PWRCFG_DCDCTODVDD
void EMU_VmonInit(EMU_VmonInit_TypeDef *vmonInit)
Initialize VMON channel.
#define EMU_EM4CTRL_EM4IORETMODE_SWUNLATCH
uint16_t em234LoadCurrent_uA
__STATIC_INLINE void EMU_PowerLock(void)
Lock the EMU regulator control registers in order to protect against unintended modification.
EMU_DcdcAnaPeripheralPower_TypeDef
void EMU_DCDCOptimizeSlice(uint32_t mALoadCurrent)
Optimize DCDC slice count based on the estimated average load current in EM0.
#define EMU_EM4CTRL_EM4IORETMODE_DISABLE
__STATIC_INLINE void EMU_UnlatchPinRetention(void)
When EM4 pin retention is set to emuPinRetentionLatch, then pins are retained through EM4 entry and w...
__STATIC_INLINE void EMU_EnterEM1(void)
Enter energy mode 1 (EM1).
EMU_DcdcLnRcoBand_TypeDef
#define EMU_PWRLOCK_LOCKKEY_UNLOCK
void EMU_DCDCLnRcoBandSet(EMU_DcdcLnRcoBand_TypeDef band)
Set DCDC Low-noise RCO band.
#define EMU_PWRLOCK_LOCKKEY_LOCK
__STATIC_INLINE void EMU_EM2UnBlock(void)
Unblock entering EM2 or higher number energy modes.
void EMU_EM23Init(EMU_EM23Init_TypeDef *em23Init)
Update EMU module with Energy Mode 2 and 3 configuration.
__STATIC_INLINE void EMU_IntEnable(uint32_t flags)
Enable one or more EMU interrupts.
#define EMU_LOCK_LOCKKEY_UNLOCK
#define EMU_DCDCCTRL_DCDCMODE_LOWNOISE
#define EMU_EM4CTRL_EM4STATE_EM4H
__STATIC_INLINE void EMU_PowerUnlock(void)
Unlock the EMU power control registers so that writing to locked registers again is possible...
bool EMU_VmonChannelStatusGet(EMU_VmonChannel_TypeDef channel)
Get the status of a voltage monitor channel.
void EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode)
Set DCDC regulator operating mode.
EMU_VmonChannel_TypeDef channel
EMU_DcdcMode_TypeDef dcdcMode
#define EMU_DCDCMISCCTRL_LNFORCECCM
__STATIC_INLINE void EMU_IntClear(uint32_t flags)
Clear one or more pending EMU interrupts.
#define _EMU_STATUS_VMONRDY_SHIFT
#define EMU_PWRCTRL_ANASW_DVDD
#define EMU_EM4CTRL_EM4IORETMODE_EM4EXIT
__STATIC_INLINE uint32_t EMU_IntGet(void)
Get pending EMU interrupt flags.
EMU_VmonChannel_TypeDef channel
__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.
void EMU_EM4Init(EMU_EM4Init_TypeDef *em4Init)
Update EMU module with Energy Mode 4 configuration.
EMU_EM4State_TypeDef em4State
EMU_EM4PinRetention_TypeDef
__STATIC_INLINE bool EMU_VmonStatusGet(void)
Get the status of the voltage monitor (VMON).
void EMU_UpdateOscConfig(void)
Update EMU module with CMU oscillator selection/enable status.
__STATIC_INLINE uint32_t EMU_IntGetEnabled(void)
Get enabled and pending EMU interrupt flags. Useful for handling more interrupt sources in the same i...
__STATIC_INLINE void EMU_EM2Block(void)
Block entering EM2 or higher number energy modes.
__STATIC_INLINE void EMU_IntSet(uint32_t flags)
Set one or more pending EMU interrupts.
EMU_DcdcLnTransientMode_TypeDef lnTransientMode