The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Thu Oct 27 16:45:56 2016 +0100
Revision:
128:9bcdf88f62b0
Parent:
113:f141b2784e32
Child:
139:856d2700e60b
Release 128 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

2966: Add kw24 support https://github.com/ARMmbed/mbed-os/pull/2966
3068: MultiTech mDot - clean up PeripheralPins.c and add new pin names https://github.com/ARMmbed/mbed-os/pull/3068
3089: Kinetis HAL: Remove clock initialization code from serial and ticker https://github.com/ARMmbed/mbed-os/pull/3089
2943: [NRF5] NVIC_SetVector functionality https://github.com/ARMmbed/mbed-os/pull/2943
2938: InterruptIn changes in NCS36510 HAL. https://github.com/ARMmbed/mbed-os/pull/2938
3108: Fix sleep function for NRF52. https://github.com/ARMmbed/mbed-os/pull/3108
3076: STM32F1: Correct timer master value reading https://github.com/ARMmbed/mbed-os/pull/3076
3085: Add LOWPOWERTIMER capability for NUCLEO_F303ZE https://github.com/ARMmbed/mbed-os/pull/3085
3046: [BEETLE] Update BLE stack on Beetle board https://github.com/ARMmbed/mbed-os/pull/3046
3122: [Silicon Labs] Update of Silicon Labs HAL https://github.com/ARMmbed/mbed-os/pull/3122
3022: OnSemi RAM usage fix https://github.com/ARMmbed/mbed-os/pull/3022
3121: STM32F3: Correct UART4 and UART5 defines when using DEVICE_SERIAL_ASYNCH https://github.com/ARMmbed/mbed-os/pull/3121
3142: Targets- NUMAKER_PFM_NUC47216 remove mbed 2 https://github.com/ARMmbed/mbed-os/pull/3142

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 98:8ab26030e058 1 /***************************************************************************//**
Kojto 98:8ab26030e058 2 * @file em_emu.h
Kojto 98:8ab26030e058 3 * @brief Energy management unit (EMU) peripheral API
<> 128:9bcdf88f62b0 4 * @version 5.0.0
Kojto 98:8ab26030e058 5 *******************************************************************************
Kojto 98:8ab26030e058 6 * @section License
<> 128:9bcdf88f62b0 7 * <b>Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com</b>
Kojto 98:8ab26030e058 8 *******************************************************************************
Kojto 98:8ab26030e058 9 *
Kojto 98:8ab26030e058 10 * Permission is granted to anyone to use this software for any purpose,
Kojto 98:8ab26030e058 11 * including commercial applications, and to alter it and redistribute it
Kojto 98:8ab26030e058 12 * freely, subject to the following restrictions:
Kojto 98:8ab26030e058 13 *
Kojto 98:8ab26030e058 14 * 1. The origin of this software must not be misrepresented; you must not
Kojto 98:8ab26030e058 15 * claim that you wrote the original software.
Kojto 98:8ab26030e058 16 * 2. Altered source versions must be plainly marked as such, and must not be
Kojto 98:8ab26030e058 17 * misrepresented as being the original software.
Kojto 98:8ab26030e058 18 * 3. This notice may not be removed or altered from any source distribution.
Kojto 98:8ab26030e058 19 *
Kojto 98:8ab26030e058 20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
Kojto 98:8ab26030e058 21 * obligation to support this Software. Silicon Labs is providing the
Kojto 98:8ab26030e058 22 * Software "AS IS", with no express or implied warranties of any kind,
Kojto 98:8ab26030e058 23 * including, but not limited to, any implied warranties of merchantability
Kojto 98:8ab26030e058 24 * or fitness for any particular purpose or warranties against infringement
Kojto 98:8ab26030e058 25 * of any proprietary rights of a third party.
Kojto 98:8ab26030e058 26 *
Kojto 98:8ab26030e058 27 * Silicon Labs will not be liable for any consequential, incidental, or
Kojto 98:8ab26030e058 28 * special damages, or any other relief, or for any claim by any third party,
Kojto 98:8ab26030e058 29 * arising from your use of this Software.
Kojto 98:8ab26030e058 30 *
Kojto 98:8ab26030e058 31 ******************************************************************************/
Kojto 98:8ab26030e058 32
<> 128:9bcdf88f62b0 33 #ifndef EM_EMU_H
<> 128:9bcdf88f62b0 34 #define EM_EMU_H
Kojto 98:8ab26030e058 35
Kojto 98:8ab26030e058 36 #include "em_device.h"
Kojto 98:8ab26030e058 37 #if defined( EMU_PRESENT )
Kojto 98:8ab26030e058 38
Kojto 98:8ab26030e058 39 #include <stdbool.h>
Kojto 113:f141b2784e32 40 #include "em_bus.h"
Kojto 98:8ab26030e058 41
Kojto 98:8ab26030e058 42 #ifdef __cplusplus
Kojto 98:8ab26030e058 43 extern "C" {
Kojto 98:8ab26030e058 44 #endif
Kojto 98:8ab26030e058 45
Kojto 98:8ab26030e058 46 /***************************************************************************//**
<> 128:9bcdf88f62b0 47 * @addtogroup emlib
Kojto 98:8ab26030e058 48 * @{
Kojto 98:8ab26030e058 49 ******************************************************************************/
Kojto 98:8ab26030e058 50
Kojto 98:8ab26030e058 51 /***************************************************************************//**
Kojto 98:8ab26030e058 52 * @addtogroup EMU
Kojto 98:8ab26030e058 53 * @{
Kojto 98:8ab26030e058 54 ******************************************************************************/
Kojto 98:8ab26030e058 55
Kojto 98:8ab26030e058 56 /*******************************************************************************
Kojto 98:8ab26030e058 57 ******************************** ENUMS ************************************
Kojto 98:8ab26030e058 58 ******************************************************************************/
Kojto 98:8ab26030e058 59
Kojto 98:8ab26030e058 60 #if defined( _EMU_EM4CONF_OSC_MASK )
Kojto 98:8ab26030e058 61 /** EM4 duty oscillator */
Kojto 98:8ab26030e058 62 typedef enum
Kojto 98:8ab26030e058 63 {
Kojto 98:8ab26030e058 64 /** Select ULFRCO as duty oscillator in EM4 */
Kojto 98:8ab26030e058 65 emuEM4Osc_ULFRCO = EMU_EM4CONF_OSC_ULFRCO,
Kojto 98:8ab26030e058 66 /** Select LFXO as duty oscillator in EM4 */
Kojto 98:8ab26030e058 67 emuEM4Osc_LFXO = EMU_EM4CONF_OSC_LFXO,
Kojto 98:8ab26030e058 68 /** Select LFRCO as duty oscillator in EM4 */
Kojto 98:8ab26030e058 69 emuEM4Osc_LFRCO = EMU_EM4CONF_OSC_LFRCO
Kojto 98:8ab26030e058 70 } EMU_EM4Osc_TypeDef;
Kojto 98:8ab26030e058 71 #endif
Kojto 98:8ab26030e058 72
Kojto 98:8ab26030e058 73 #if defined( _EMU_BUCTRL_PROBE_MASK )
Kojto 98:8ab26030e058 74 /** Backup Power Voltage Probe types */
Kojto 98:8ab26030e058 75 typedef enum
Kojto 98:8ab26030e058 76 {
Kojto 98:8ab26030e058 77 /** Disable voltage probe */
Kojto 98:8ab26030e058 78 emuProbe_Disable = EMU_BUCTRL_PROBE_DISABLE,
Kojto 98:8ab26030e058 79 /** Connect probe to VDD_DREG */
Kojto 98:8ab26030e058 80 emuProbe_VDDDReg = EMU_BUCTRL_PROBE_VDDDREG,
Kojto 98:8ab26030e058 81 /** Connect probe to BU_IN */
Kojto 98:8ab26030e058 82 emuProbe_BUIN = EMU_BUCTRL_PROBE_BUIN,
Kojto 98:8ab26030e058 83 /** Connect probe to BU_OUT */
Kojto 98:8ab26030e058 84 emuProbe_BUOUT = EMU_BUCTRL_PROBE_BUOUT
Kojto 98:8ab26030e058 85 } EMU_Probe_TypeDef;
Kojto 98:8ab26030e058 86 #endif
Kojto 98:8ab26030e058 87
Kojto 98:8ab26030e058 88 #if defined( _EMU_PWRCONF_PWRRES_MASK )
Kojto 98:8ab26030e058 89 /** Backup Power Domain resistor selection */
Kojto 98:8ab26030e058 90 typedef enum
Kojto 98:8ab26030e058 91 {
Kojto 98:8ab26030e058 92 /** Main power and backup power connected with RES0 series resistance */
Kojto 98:8ab26030e058 93 emuRes_Res0 = EMU_PWRCONF_PWRRES_RES0,
Kojto 98:8ab26030e058 94 /** Main power and backup power connected with RES1 series resistance */
Kojto 98:8ab26030e058 95 emuRes_Res1 = EMU_PWRCONF_PWRRES_RES1,
Kojto 98:8ab26030e058 96 /** Main power and backup power connected with RES2 series resistance */
Kojto 98:8ab26030e058 97 emuRes_Res2 = EMU_PWRCONF_PWRRES_RES2,
Kojto 98:8ab26030e058 98 /** Main power and backup power connected with RES3 series resistance */
Kojto 98:8ab26030e058 99 emuRes_Res3 = EMU_PWRCONF_PWRRES_RES3,
Kojto 98:8ab26030e058 100 } EMU_Resistor_TypeDef;
Kojto 98:8ab26030e058 101 #endif
Kojto 98:8ab26030e058 102
Kojto 98:8ab26030e058 103 #if defined( BU_PRESENT )
Kojto 98:8ab26030e058 104 /** Backup Power Domain power connection */
Kojto 98:8ab26030e058 105 typedef enum
Kojto 98:8ab26030e058 106 {
Kojto 98:8ab26030e058 107 /** No connection between main and backup power */
Kojto 98:8ab26030e058 108 emuPower_None = EMU_BUINACT_PWRCON_NONE,
Kojto 98:8ab26030e058 109 /** Main power and backup power connected through diode,
Kojto 98:8ab26030e058 110 allowing current from backup to main only */
Kojto 98:8ab26030e058 111 emuPower_BUMain = EMU_BUINACT_PWRCON_BUMAIN,
Kojto 98:8ab26030e058 112 /** Main power and backup power connected through diode,
Kojto 98:8ab26030e058 113 allowing current from main to backup only */
Kojto 98:8ab26030e058 114 emuPower_MainBU = EMU_BUINACT_PWRCON_MAINBU,
Kojto 98:8ab26030e058 115 /** Main power and backup power connected without diode */
Kojto 98:8ab26030e058 116 emuPower_NoDiode = EMU_BUINACT_PWRCON_NODIODE,
Kojto 98:8ab26030e058 117 } EMU_Power_TypeDef;
Kojto 98:8ab26030e058 118 #endif
Kojto 98:8ab26030e058 119
Kojto 98:8ab26030e058 120 /** BOD threshold setting selector, active or inactive mode */
Kojto 98:8ab26030e058 121 typedef enum
Kojto 98:8ab26030e058 122 {
Kojto 98:8ab26030e058 123 /** Configure BOD threshold for active mode */
Kojto 98:8ab26030e058 124 emuBODMode_Active,
Kojto 98:8ab26030e058 125 /** Configure BOD threshold for inactive mode */
Kojto 98:8ab26030e058 126 emuBODMode_Inactive,
Kojto 98:8ab26030e058 127 } EMU_BODMode_TypeDef;
Kojto 98:8ab26030e058 128
Kojto 113:f141b2784e32 129 #if defined( _EMU_EM4CTRL_EM4STATE_MASK )
Kojto 113:f141b2784e32 130 /** EM4 modes */
Kojto 113:f141b2784e32 131 typedef enum
Kojto 113:f141b2784e32 132 {
Kojto 113:f141b2784e32 133 /** EM4 Hibernate */
Kojto 113:f141b2784e32 134 emuEM4Hibernate = EMU_EM4CTRL_EM4STATE_EM4H,
Kojto 113:f141b2784e32 135 /** EM4 Shutoff */
Kojto 113:f141b2784e32 136 emuEM4Shutoff = EMU_EM4CTRL_EM4STATE_EM4S,
Kojto 113:f141b2784e32 137 } EMU_EM4State_TypeDef;
Kojto 113:f141b2784e32 138 #endif
Kojto 98:8ab26030e058 139
Kojto 98:8ab26030e058 140
Kojto 113:f141b2784e32 141 #if defined( _EMU_EM4CTRL_EM4IORETMODE_MASK )
Kojto 113:f141b2784e32 142 typedef enum
Kojto 113:f141b2784e32 143 {
Kojto 113:f141b2784e32 144 /** No Retention: Pads enter reset state when entering EM4 */
Kojto 113:f141b2784e32 145 emuPinRetentionDisable = EMU_EM4CTRL_EM4IORETMODE_DISABLE,
Kojto 113:f141b2784e32 146 /** Retention through EM4: Pads enter reset state when exiting EM4 */
Kojto 113:f141b2784e32 147 emuPinRetentionEm4Exit = EMU_EM4CTRL_EM4IORETMODE_EM4EXIT,
Kojto 113:f141b2784e32 148 /** Retention through EM4 and wakeup: call EMU_UnlatchPinRetention() to
Kojto 113:f141b2784e32 149 release pins from retention after EM4 wakeup */
Kojto 113:f141b2784e32 150 emuPinRetentionLatch = EMU_EM4CTRL_EM4IORETMODE_SWUNLATCH,
Kojto 113:f141b2784e32 151 } EMU_EM4PinRetention_TypeDef;
Kojto 113:f141b2784e32 152 #endif
Kojto 113:f141b2784e32 153
Kojto 113:f141b2784e32 154
Kojto 113:f141b2784e32 155 #if defined( _EMU_PWRCFG_MASK )
Kojto 113:f141b2784e32 156 /** Power configurations */
Kojto 113:f141b2784e32 157 typedef enum
Kojto 113:f141b2784e32 158 {
Kojto 113:f141b2784e32 159 /** DCDC is connected to DVDD */
Kojto 113:f141b2784e32 160 emuPowerConfig_DcdcToDvdd = EMU_PWRCFG_PWRCFG_DCDCTODVDD,
Kojto 113:f141b2784e32 161 } EMU_PowerConfig_TypeDef;
Kojto 113:f141b2784e32 162 #endif
Kojto 113:f141b2784e32 163
Kojto 113:f141b2784e32 164 #if defined( _EMU_DCDCCTRL_MASK )
Kojto 113:f141b2784e32 165 /** DCDC operating modes */
Kojto 113:f141b2784e32 166 typedef enum
Kojto 113:f141b2784e32 167 {
Kojto 113:f141b2784e32 168 /** DCDC regulator bypass */
Kojto 113:f141b2784e32 169 emuDcdcMode_Bypass = EMU_DCDCCTRL_DCDCMODE_BYPASS,
Kojto 113:f141b2784e32 170 /** DCDC low-noise mode */
Kojto 113:f141b2784e32 171 emuDcdcMode_LowNoise = EMU_DCDCCTRL_DCDCMODE_LOWNOISE,
<> 128:9bcdf88f62b0 172 #if defined(_EMU_DCDCLPEM01CFG_MASK)
<> 128:9bcdf88f62b0 173 /** DCDC low-power mode */
<> 128:9bcdf88f62b0 174 emuDcdcMode_LowPower = EMU_DCDCCTRL_DCDCMODE_LOWPOWER,
<> 128:9bcdf88f62b0 175 #endif
Kojto 113:f141b2784e32 176 } EMU_DcdcMode_TypeDef;
Kojto 113:f141b2784e32 177 #endif
Kojto 113:f141b2784e32 178
Kojto 113:f141b2784e32 179 #if defined( _EMU_PWRCTRL_MASK )
Kojto 113:f141b2784e32 180 /** DCDC to DVDD mode analog peripheral power supply select */
Kojto 113:f141b2784e32 181 typedef enum
Kojto 113:f141b2784e32 182 {
Kojto 113:f141b2784e32 183 /** Select AVDD as analog power supply. Typically lower noise, but less energy efficient. */
Kojto 113:f141b2784e32 184 emuDcdcAnaPeripheralPower_AVDD = EMU_PWRCTRL_ANASW_AVDD,
Kojto 113:f141b2784e32 185 /** Select DCDC (DVDD) as analog power supply. Typically more energy efficient, but more noise. */
Kojto 113:f141b2784e32 186 emuDcdcAnaPeripheralPower_DCDC = EMU_PWRCTRL_ANASW_DVDD
Kojto 113:f141b2784e32 187 } EMU_DcdcAnaPeripheralPower_TypeDef;
Kojto 113:f141b2784e32 188 #endif
Kojto 113:f141b2784e32 189
Kojto 113:f141b2784e32 190 #if defined( _EMU_DCDCMISCCTRL_MASK )
<> 128:9bcdf88f62b0 191 /** DCDC Forced CCM and reverse current limiter control. Positive values have unit mA. */
<> 128:9bcdf88f62b0 192 typedef int16_t EMU_DcdcLnReverseCurrentControl_TypeDef;
<> 128:9bcdf88f62b0 193
<> 128:9bcdf88f62b0 194 /** High efficiency mode. EMU_DCDCZDETCTRL_ZDETILIMSEL is "don't care". */
<> 128:9bcdf88f62b0 195 #define emuDcdcLnHighEfficiency -1
<> 128:9bcdf88f62b0 196
<> 128:9bcdf88f62b0 197 /** Deprecated. Fast transient response mode. Specify a reverse current limit instead. */
<> 128:9bcdf88f62b0 198 #define emuDcdcLnFastTransient 160
Kojto 113:f141b2784e32 199 #endif
<> 128:9bcdf88f62b0 200
Kojto 113:f141b2784e32 201
Kojto 113:f141b2784e32 202 #if defined( _EMU_DCDCCTRL_MASK )
Kojto 113:f141b2784e32 203 /** DCDC Low-noise RCO band select */
Kojto 113:f141b2784e32 204 typedef enum
Kojto 113:f141b2784e32 205 {
Kojto 113:f141b2784e32 206 /** Set RCO to 3MHz */
<> 128:9bcdf88f62b0 207 emuDcdcLnRcoBand_3MHz = 0,
Kojto 113:f141b2784e32 208 /** Set RCO to 4MHz */
<> 128:9bcdf88f62b0 209 emuDcdcLnRcoBand_4MHz = 1,
Kojto 113:f141b2784e32 210 /** Set RCO to 5MHz */
<> 128:9bcdf88f62b0 211 emuDcdcLnRcoBand_5MHz = 2,
Kojto 113:f141b2784e32 212 /** Set RCO to 6MHz */
<> 128:9bcdf88f62b0 213 emuDcdcLnRcoBand_6MHz = 3,
Kojto 113:f141b2784e32 214 /** Set RCO to 7MHz */
<> 128:9bcdf88f62b0 215 emuDcdcLnRcoBand_7MHz = 4,
Kojto 113:f141b2784e32 216 /** Set RCO to 8MHz */
<> 128:9bcdf88f62b0 217 emuDcdcLnRcoBand_8MHz = 5,
Kojto 113:f141b2784e32 218 /** Set RCO to 9MHz */
<> 128:9bcdf88f62b0 219 emuDcdcLnRcoBand_9MHz = 6,
Kojto 113:f141b2784e32 220 /** Set RCO to 10MHz */
<> 128:9bcdf88f62b0 221 emuDcdcLnRcoBand_10MHz = 7,
Kojto 113:f141b2784e32 222 } EMU_DcdcLnRcoBand_TypeDef;
Kojto 113:f141b2784e32 223
<> 128:9bcdf88f62b0 224 /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */
<> 128:9bcdf88f62b0 225 /* Deprecated. */
<> 128:9bcdf88f62b0 226 #define EMU_DcdcLnRcoBand_3MHz emuDcdcLnRcoBand_3MHz
<> 128:9bcdf88f62b0 227 #define EMU_DcdcLnRcoBand_4MHz emuDcdcLnRcoBand_4MHz
<> 128:9bcdf88f62b0 228 #define EMU_DcdcLnRcoBand_5MHz emuDcdcLnRcoBand_5MHz
<> 128:9bcdf88f62b0 229 #define EMU_DcdcLnRcoBand_6MHz emuDcdcLnRcoBand_6MHz
<> 128:9bcdf88f62b0 230 #define EMU_DcdcLnRcoBand_7MHz emuDcdcLnRcoBand_7MHz
<> 128:9bcdf88f62b0 231 #define EMU_DcdcLnRcoBand_8MHz emuDcdcLnRcoBand_8MHz
<> 128:9bcdf88f62b0 232 #define EMU_DcdcLnRcoBand_9MHz emuDcdcLnRcoBand_9MHz
<> 128:9bcdf88f62b0 233 #define EMU_DcdcLnRcoBand_10MHz emuDcdcLnRcoBand_10MHz
<> 128:9bcdf88f62b0 234 /** @endcond */
Kojto 113:f141b2784e32 235 #endif
Kojto 113:f141b2784e32 236
<> 128:9bcdf88f62b0 237
<> 128:9bcdf88f62b0 238 #if defined( _EMU_DCDCCTRL_MASK )
<> 128:9bcdf88f62b0 239 /** DCDC Low Noise Compensator Control register. */
<> 128:9bcdf88f62b0 240 typedef enum
<> 128:9bcdf88f62b0 241 {
<> 128:9bcdf88f62b0 242 /** DCDC capacitor is 1uF. */
<> 128:9bcdf88f62b0 243 emuDcdcLnCompCtrl_1u0F,
<> 128:9bcdf88f62b0 244 /** DCDC capacitor is 4.7uF. */
<> 128:9bcdf88f62b0 245 emuDcdcLnCompCtrl_4u7F,
<> 128:9bcdf88f62b0 246 } EMU_DcdcLnCompCtrl_TypeDef;
<> 128:9bcdf88f62b0 247 #endif
<> 128:9bcdf88f62b0 248
<> 128:9bcdf88f62b0 249
Kojto 113:f141b2784e32 250 #if defined( EMU_STATUS_VMONRDY )
Kojto 113:f141b2784e32 251 /** VMON channels */
Kojto 113:f141b2784e32 252 typedef enum
Kojto 113:f141b2784e32 253 {
Kojto 113:f141b2784e32 254 emuVmonChannel_AVDD,
Kojto 113:f141b2784e32 255 emuVmonChannel_ALTAVDD,
Kojto 113:f141b2784e32 256 emuVmonChannel_DVDD,
Kojto 113:f141b2784e32 257 emuVmonChannel_IOVDD0
Kojto 113:f141b2784e32 258 } EMU_VmonChannel_TypeDef;
Kojto 113:f141b2784e32 259 #endif /* EMU_STATUS_VMONRDY */
Kojto 113:f141b2784e32 260
<> 128:9bcdf88f62b0 261 #if defined( _SILICON_LABS_32B_PLATFORM_2_GEN_1 )
<> 128:9bcdf88f62b0 262 /** Bias mode configurations */
<> 128:9bcdf88f62b0 263 typedef enum
<> 128:9bcdf88f62b0 264 {
<> 128:9bcdf88f62b0 265 emuBiasMode_1KHz,
<> 128:9bcdf88f62b0 266 emuBiasMode_4KHz,
<> 128:9bcdf88f62b0 267 emuBiasMode_Continuous
<> 128:9bcdf88f62b0 268 } EMU_BiasMode_TypeDef;
<> 128:9bcdf88f62b0 269 #endif
<> 128:9bcdf88f62b0 270
Kojto 98:8ab26030e058 271 /*******************************************************************************
Kojto 98:8ab26030e058 272 ******************************* STRUCTS ***********************************
Kojto 98:8ab26030e058 273 ******************************************************************************/
Kojto 98:8ab26030e058 274
Kojto 98:8ab26030e058 275 /** Energy Mode 2 and 3 initialization structure */
Kojto 98:8ab26030e058 276 typedef struct
Kojto 98:8ab26030e058 277 {
Kojto 113:f141b2784e32 278 bool em23VregFullEn; /**< Enable full VREG drive strength in EM2/3 */
Kojto 98:8ab26030e058 279 } EMU_EM23Init_TypeDef;
Kojto 98:8ab26030e058 280
Kojto 98:8ab26030e058 281 /** Default initialization of EM2 and 3 configuration */
Kojto 98:8ab26030e058 282 #define EMU_EM23INIT_DEFAULT \
Kojto 113:f141b2784e32 283 { false } /* Reduced voltage regulator drive strength in EM2 and EM3 */
Kojto 98:8ab26030e058 284
Kojto 98:8ab26030e058 285
Kojto 113:f141b2784e32 286 #if defined( _EMU_EM4CONF_MASK ) || defined( _EMU_EM4CTRL_MASK )
Kojto 98:8ab26030e058 287 /** Energy Mode 4 initialization structure */
Kojto 98:8ab26030e058 288 typedef struct
Kojto 98:8ab26030e058 289 {
Kojto 113:f141b2784e32 290 #if defined( _EMU_EM4CONF_MASK )
Kojto 98:8ab26030e058 291 /* Init parameters for platforms with EMU->EM4CONF register */
Kojto 113:f141b2784e32 292 bool lockConfig; /**< Lock configuration of regulator, BOD and oscillator */
Kojto 113:f141b2784e32 293 bool buBodRstDis; /**< When set, no reset will be asserted due to Brownout when in EM4 */
Kojto 113:f141b2784e32 294 EMU_EM4Osc_TypeDef osc; /**< EM4 duty oscillator */
Kojto 113:f141b2784e32 295 bool buRtcWakeup; /**< Wake up on EM4 BURTC interrupt */
Kojto 113:f141b2784e32 296 bool vreg; /**< Enable EM4 voltage regulator */
Kojto 113:f141b2784e32 297
Kojto 113:f141b2784e32 298 #elif defined( _EMU_EM4CTRL_MASK )
Kojto 113:f141b2784e32 299 /* Init parameters for platforms with EMU->EM4CTRL register */
Kojto 113:f141b2784e32 300 bool retainLfxo; /**< Disable the LFXO upon EM4 entry */
Kojto 113:f141b2784e32 301 bool retainLfrco; /**< Disable the LFRCO upon EM4 entry */
Kojto 113:f141b2784e32 302 bool retainUlfrco; /**< Disable the ULFRCO upon EM4 entry */
Kojto 113:f141b2784e32 303 EMU_EM4State_TypeDef em4State; /**< Hibernate or shutoff EM4 state */
Kojto 113:f141b2784e32 304 EMU_EM4PinRetention_TypeDef pinRetentionMode; /**< EM4 pin retention mode */
Kojto 98:8ab26030e058 305 #endif
Kojto 98:8ab26030e058 306 } EMU_EM4Init_TypeDef;
Kojto 113:f141b2784e32 307 #endif
Kojto 98:8ab26030e058 308
Kojto 98:8ab26030e058 309 /** Default initialization of EM4 configuration */
Kojto 98:8ab26030e058 310 #if defined( _EMU_EM4CONF_MASK )
Kojto 113:f141b2784e32 311 #define EMU_EM4INIT_DEFAULT \
Kojto 113:f141b2784e32 312 { \
Kojto 113:f141b2784e32 313 false, /* Dont't lock configuration after it's been set */ \
Kojto 113:f141b2784e32 314 false, /* No reset will be asserted due to Brownout when in EM4 */ \
Kojto 113:f141b2784e32 315 emuEM4Osc_ULFRCO, /* Use default ULFRCO oscillator */ \
Kojto 113:f141b2784e32 316 true, /* Wake up on EM4 BURTC interrupt */ \
Kojto 113:f141b2784e32 317 true, /* Enable VREG */ \
Kojto 113:f141b2784e32 318 }
Kojto 98:8ab26030e058 319 #endif
Kojto 113:f141b2784e32 320 #if defined( _EMU_EM4CTRL_MASK )
Kojto 113:f141b2784e32 321 #define EMU_EM4INIT_DEFAULT \
Kojto 113:f141b2784e32 322 { \
Kojto 113:f141b2784e32 323 false, /* Retain LFXO configuration upon EM4 entry */ \
Kojto 113:f141b2784e32 324 false, /* Retain LFRCO configuration upon EM4 entry */ \
Kojto 113:f141b2784e32 325 false, /* Retain ULFRCO configuration upon EM4 entry */ \
Kojto 113:f141b2784e32 326 emuEM4Shutoff, /* Use EM4 shutoff state */ \
Kojto 113:f141b2784e32 327 emuPinRetentionDisable, /* Do not retain pins in EM4 */ \
Kojto 113:f141b2784e32 328 }
Kojto 113:f141b2784e32 329 #endif
Kojto 98:8ab26030e058 330
Kojto 98:8ab26030e058 331 #if defined( BU_PRESENT )
Kojto 98:8ab26030e058 332 /** Backup Power Domain Initialization structure */
Kojto 98:8ab26030e058 333 typedef struct
Kojto 98:8ab26030e058 334 {
Kojto 98:8ab26030e058 335 /* Backup Power Domain power configuration */
Kojto 98:8ab26030e058 336
Kojto 98:8ab26030e058 337 /** Voltage probe select, selects ADC voltage */
Kojto 98:8ab26030e058 338 EMU_Probe_TypeDef probe;
Kojto 98:8ab26030e058 339 /** Enable BOD calibration mode */
Kojto 98:8ab26030e058 340 bool bodCal;
Kojto 98:8ab26030e058 341 /** Enable BU_STAT status pin for active BU mode */
Kojto 98:8ab26030e058 342 bool statusPinEnable;
Kojto 98:8ab26030e058 343
Kojto 98:8ab26030e058 344 /* Backup Power Domain connection configuration */
Kojto 98:8ab26030e058 345 /** Power domain resistor */
Kojto 98:8ab26030e058 346 EMU_Resistor_TypeDef resistor;
Kojto 98:8ab26030e058 347 /** BU_VOUT strong enable */
Kojto 98:8ab26030e058 348 bool voutStrong;
Kojto 98:8ab26030e058 349 /** BU_VOUT medium enable */
Kojto 98:8ab26030e058 350 bool voutMed;
Kojto 98:8ab26030e058 351 /** BU_VOUT weak enable */
Kojto 98:8ab26030e058 352 bool voutWeak;
Kojto 98:8ab26030e058 353 /** Power connection, when not in Backup Mode */
Kojto 98:8ab26030e058 354 EMU_Power_TypeDef inactivePower;
Kojto 98:8ab26030e058 355 /** Power connection, when in Backup Mode */
Kojto 98:8ab26030e058 356 EMU_Power_TypeDef activePower;
Kojto 98:8ab26030e058 357 /** Enable backup power domain, and release reset, enable BU_VIN pin */
Kojto 98:8ab26030e058 358 bool enable;
Kojto 98:8ab26030e058 359 } EMU_BUPDInit_TypeDef;
Kojto 98:8ab26030e058 360
Kojto 113:f141b2784e32 361 /** Default Backup Power Domain configuration */
Kojto 113:f141b2784e32 362 #define EMU_BUPDINIT_DEFAULT \
Kojto 113:f141b2784e32 363 { \
Kojto 113:f141b2784e32 364 emuProbe_Disable, /* Do not enable voltage probe */ \
Kojto 113:f141b2784e32 365 false, /* Disable BOD calibration mode */ \
Kojto 113:f141b2784e32 366 false, /* Disable BU_STAT pin for backup mode indication */ \
Kojto 113:f141b2784e32 367 \
Kojto 113:f141b2784e32 368 emuRes_Res0, /* RES0 series resistance between main and backup power */ \
Kojto 113:f141b2784e32 369 false, /* Don't enable strong switch */ \
Kojto 113:f141b2784e32 370 false, /* Don't enable medium switch */ \
Kojto 113:f141b2784e32 371 false, /* Don't enable weak switch */ \
Kojto 113:f141b2784e32 372 \
Kojto 113:f141b2784e32 373 emuPower_None, /* No connection between main and backup power (inactive mode) */ \
Kojto 113:f141b2784e32 374 emuPower_None, /* No connection between main and backup power (active mode) */ \
Kojto 113:f141b2784e32 375 true /* Enable BUPD enter on BOD, enable BU_VIN pin, release BU reset */ \
Kojto 113:f141b2784e32 376 }
Kojto 98:8ab26030e058 377 #endif
Kojto 98:8ab26030e058 378
Kojto 113:f141b2784e32 379 #if defined( _EMU_DCDCCTRL_MASK )
Kojto 113:f141b2784e32 380 /** DCDC initialization structure */
Kojto 113:f141b2784e32 381 typedef struct
Kojto 113:f141b2784e32 382 {
Kojto 113:f141b2784e32 383 EMU_PowerConfig_TypeDef powerConfig; /**< Device external power configuration */
<> 128:9bcdf88f62b0 384 EMU_DcdcMode_TypeDef dcdcMode; /**< DCDC regulator operating mode in EM0/1 */
Kojto 113:f141b2784e32 385 uint16_t mVout; /**< Target output voltage (mV) */
<> 128:9bcdf88f62b0 386 uint16_t em01LoadCurrent_mA; /**< Estimated average load current in EM0/1 (mA).
Kojto 113:f141b2784e32 387 This estimate is also used for EM1 optimization,
Kojto 113:f141b2784e32 388 so if EM1 current is expected to be higher than EM0,
Kojto 113:f141b2784e32 389 then this parameter should hold the higher EM1 current. */
Kojto 113:f141b2784e32 390 uint16_t em234LoadCurrent_uA; /**< Estimated average load current in EM2 (uA).
Kojto 113:f141b2784e32 391 This estimate is also used for EM3 and 4 optimization,
Kojto 113:f141b2784e32 392 so if EM3 or 4 current is expected to be higher than EM2,
Kojto 113:f141b2784e32 393 then this parameter should hold the higher EM3 or 4 current. */
<> 128:9bcdf88f62b0 394 uint16_t maxCurrent_mA; /**< Maximum average DCDC output current (mA).
Kojto 113:f141b2784e32 395 This can be set to the maximum for the power source,
Kojto 113:f141b2784e32 396 for example the maximum for a battery. */
<> 128:9bcdf88f62b0 397 EMU_DcdcAnaPeripheralPower_TypeDef
<> 128:9bcdf88f62b0 398 anaPeripheralPower; /**< Select analog peripheral power in DCDC-to-DVDD mode */
<> 128:9bcdf88f62b0 399 EMU_DcdcLnReverseCurrentControl_TypeDef
<> 128:9bcdf88f62b0 400 reverseCurrentControl; /**< Low-noise reverse current control.
<> 128:9bcdf88f62b0 401 NOTE: this parameter uses special encoding:
<> 128:9bcdf88f62b0 402 >= 0 is forced CCM mode where the parameter is used as the
<> 128:9bcdf88f62b0 403 reverse current threshold in mA.
<> 128:9bcdf88f62b0 404 -1 is encoded as emuDcdcLnHighEfficiencyMode (EFM32 only) */
<> 128:9bcdf88f62b0 405 EMU_DcdcLnCompCtrl_TypeDef dcdcLnCompCtrl; /**< DCDC Low-noise mode compensator control. */
Kojto 113:f141b2784e32 406 } EMU_DCDCInit_TypeDef;
Kojto 113:f141b2784e32 407
Kojto 113:f141b2784e32 408 /** Default DCDC initialization */
Kojto 113:f141b2784e32 409 #if defined( _EFM_DEVICE )
<> 128:9bcdf88f62b0 410 #if defined(_SILICON_LABS_32B_SERIES_1_CONFIG) && (_SILICON_LABS_32B_SERIES_1_CONFIG >= 2)
<> 128:9bcdf88f62b0 411 #define EMU_DCDCINIT_DEFAULT \
<> 128:9bcdf88f62b0 412 { \
<> 128:9bcdf88f62b0 413 emuPowerConfig_DcdcToDvdd, /* DCDC to DVDD */ \
<> 128:9bcdf88f62b0 414 emuDcdcMode_LowNoise, /* Low-niose mode in EM0 (can be set to LowPower on EFM32PG revB0) */ \
<> 128:9bcdf88f62b0 415 1800, /* Nominal output voltage for DVDD mode, 1.8V */ \
<> 128:9bcdf88f62b0 416 5, /* Nominal EM0/1 load current of less than 5mA */ \
<> 128:9bcdf88f62b0 417 10, /* Nominal EM2/3/4 load current less than 10uA */ \
<> 128:9bcdf88f62b0 418 200, /* Maximum average current of 200mA
<> 128:9bcdf88f62b0 419 (assume strong battery or other power source) */ \
<> 128:9bcdf88f62b0 420 emuDcdcAnaPeripheralPower_DCDC,/* Select DCDC as analog power supply (lower power) */ \
<> 128:9bcdf88f62b0 421 emuDcdcLnHighEfficiency, /* Use high-efficiency mode */ \
<> 128:9bcdf88f62b0 422 emuDcdcLnCompCtrl_4u7F, /* 4.7uF DCDC capacitor */ \
<> 128:9bcdf88f62b0 423 }
<> 128:9bcdf88f62b0 424
<> 128:9bcdf88f62b0 425 #else
Kojto 113:f141b2784e32 426 #define EMU_DCDCINIT_DEFAULT \
Kojto 113:f141b2784e32 427 { \
Kojto 113:f141b2784e32 428 emuPowerConfig_DcdcToDvdd, /* DCDC to DVDD */ \
Kojto 113:f141b2784e32 429 emuDcdcMode_LowNoise, /* Low-niose mode in EM0 (can be set to LowPower on EFM32PG revB0) */ \
Kojto 113:f141b2784e32 430 1800, /* Nominal output voltage for DVDD mode, 1.8V */ \
<> 128:9bcdf88f62b0 431 5, /* Nominal EM0/1 load current of less than 5mA */ \
<> 128:9bcdf88f62b0 432 10, /* Nominal EM2/3/4 load current less than 10uA */ \
<> 128:9bcdf88f62b0 433 200, /* Maximum average current of 200mA
<> 128:9bcdf88f62b0 434 (assume strong battery or other power source) */ \
Kojto 113:f141b2784e32 435 emuDcdcAnaPeripheralPower_DCDC,/* Select DCDC as analog power supply (lower power) */ \
<> 128:9bcdf88f62b0 436 emuDcdcLnHighEfficiency, /* Use high-efficiency mode */ \
<> 128:9bcdf88f62b0 437 emuDcdcLnCompCtrl_1u0F, /* 1uF DCDC capacitor */ \
Kojto 113:f141b2784e32 438 }
<> 128:9bcdf88f62b0 439 #endif
<> 128:9bcdf88f62b0 440
Kojto 113:f141b2784e32 441 #else /* EFR32 device */
<> 128:9bcdf88f62b0 442 #if defined(_SILICON_LABS_32B_SERIES_1_CONFIG) && (_SILICON_LABS_32B_SERIES_1_CONFIG >= 2)
Kojto 113:f141b2784e32 443 #define EMU_DCDCINIT_DEFAULT \
Kojto 113:f141b2784e32 444 { \
Kojto 113:f141b2784e32 445 emuPowerConfig_DcdcToDvdd, /* DCDC to DVDD */ \
Kojto 113:f141b2784e32 446 emuDcdcMode_LowNoise, /* Low-niose mode in EM0 */ \
Kojto 113:f141b2784e32 447 1800, /* Nominal output voltage for DVDD mode, 1.8V */ \
<> 128:9bcdf88f62b0 448 15, /* Nominal EM0/1 load current of less than 15mA */ \
<> 128:9bcdf88f62b0 449 10, /* Nominal EM2/3/4 load current less than 10uA */ \
<> 128:9bcdf88f62b0 450 200, /* Maximum average current of 200mA
<> 128:9bcdf88f62b0 451 (assume strong battery or other power source) */ \
<> 128:9bcdf88f62b0 452 emuDcdcAnaPeripheralPower_DCDC,/* Select DCDC as analog power supply (lower power) */ \
<> 128:9bcdf88f62b0 453 160, /* Maximum reverse current of 160mA */ \
<> 128:9bcdf88f62b0 454 emuDcdcLnCompCtrl_4u7F, /* 4.7uF DCDC capacitor */ \
<> 128:9bcdf88f62b0 455 }
<> 128:9bcdf88f62b0 456
<> 128:9bcdf88f62b0 457 #else
<> 128:9bcdf88f62b0 458 #define EMU_DCDCINIT_DEFAULT \
<> 128:9bcdf88f62b0 459 { \
<> 128:9bcdf88f62b0 460 emuPowerConfig_DcdcToDvdd, /* DCDC to DVDD */ \
<> 128:9bcdf88f62b0 461 emuDcdcMode_LowNoise, /* Low-niose mode in EM0 */ \
<> 128:9bcdf88f62b0 462 1800, /* Nominal output voltage for DVDD mode, 1.8V */ \
<> 128:9bcdf88f62b0 463 15, /* Nominal EM0/1 load current of less than 15mA */ \
<> 128:9bcdf88f62b0 464 10, /* Nominal EM2/3/4 load current less than 10uA */ \
<> 128:9bcdf88f62b0 465 200, /* Maximum average current of 200mA
<> 128:9bcdf88f62b0 466 (assume strong battery or other power source) */ \
<> 128:9bcdf88f62b0 467 emuDcdcAnaPeripheralPower_DCDC,/* Select DCDC as analog power supply (lower power) */ \
<> 128:9bcdf88f62b0 468 160, /* Maximum reverse current of 160mA */ \
<> 128:9bcdf88f62b0 469 emuDcdcLnCompCtrl_1u0F, /* 1uF DCDC capacitor */ \
Kojto 113:f141b2784e32 470 }
Kojto 113:f141b2784e32 471 #endif
<> 128:9bcdf88f62b0 472 #endif
Kojto 113:f141b2784e32 473 #endif
Kojto 113:f141b2784e32 474
Kojto 113:f141b2784e32 475 #if defined( EMU_STATUS_VMONRDY )
Kojto 113:f141b2784e32 476 /** VMON initialization structure */
Kojto 113:f141b2784e32 477 typedef struct
Kojto 113:f141b2784e32 478 {
<> 128:9bcdf88f62b0 479 EMU_VmonChannel_TypeDef channel; /**< VMON channel to configure */
<> 128:9bcdf88f62b0 480 int threshold; /**< Trigger threshold (mV) */
<> 128:9bcdf88f62b0 481 bool riseWakeup; /**< Wake up from EM4H on rising edge */
<> 128:9bcdf88f62b0 482 bool fallWakeup; /**< Wake up from EM4H on falling edge */
<> 128:9bcdf88f62b0 483 bool enable; /**< Enable VMON channel */
<> 128:9bcdf88f62b0 484 bool retDisable; /**< Disable IO0 retention when voltage drops below threshold (IOVDD only) */
Kojto 113:f141b2784e32 485 } EMU_VmonInit_TypeDef;
Kojto 113:f141b2784e32 486
Kojto 113:f141b2784e32 487 /** Default VMON initialization structure */
<> 128:9bcdf88f62b0 488 #define EMU_VMONINIT_DEFAULT \
<> 128:9bcdf88f62b0 489 { \
<> 128:9bcdf88f62b0 490 emuVmonChannel_AVDD, /* AVDD VMON channel */ \
<> 128:9bcdf88f62b0 491 3200, /* 3.2 V threshold */ \
<> 128:9bcdf88f62b0 492 false, /* Don't wake from EM4H on rising edge */ \
<> 128:9bcdf88f62b0 493 false, /* Don't wake from EM4H on falling edge */ \
<> 128:9bcdf88f62b0 494 true, /* Enable VMON channel */ \
<> 128:9bcdf88f62b0 495 false /* Don't disable IO0 retention */ \
Kojto 113:f141b2784e32 496 }
Kojto 113:f141b2784e32 497
Kojto 113:f141b2784e32 498 /** VMON Hysteresis initialization structure */
Kojto 113:f141b2784e32 499 typedef struct
Kojto 113:f141b2784e32 500 {
<> 128:9bcdf88f62b0 501 EMU_VmonChannel_TypeDef channel; /**< VMON channel to configure */
<> 128:9bcdf88f62b0 502 int riseThreshold; /**< Rising threshold (mV) */
<> 128:9bcdf88f62b0 503 int fallThreshold; /**< Falling threshold (mV) */
<> 128:9bcdf88f62b0 504 bool riseWakeup; /**< Wake up from EM4H on rising edge */
<> 128:9bcdf88f62b0 505 bool fallWakeup; /**< Wake up from EM4H on falling edge */
<> 128:9bcdf88f62b0 506 bool enable; /**< Enable VMON channel */
Kojto 113:f141b2784e32 507 } EMU_VmonHystInit_TypeDef;
Kojto 113:f141b2784e32 508
Kojto 113:f141b2784e32 509 /** Default VMON Hysteresis initialization structure */
<> 128:9bcdf88f62b0 510 #define EMU_VMONHYSTINIT_DEFAULT \
<> 128:9bcdf88f62b0 511 { \
<> 128:9bcdf88f62b0 512 emuVmonChannel_AVDD, /* AVDD VMON channel */ \
<> 128:9bcdf88f62b0 513 3200, /* 3.2 V rise threshold */ \
<> 128:9bcdf88f62b0 514 3200, /* 3.2 V fall threshold */ \
<> 128:9bcdf88f62b0 515 false, /* Don't wake from EM4H on rising edge */ \
<> 128:9bcdf88f62b0 516 false, /* Don't wake from EM4H on falling edge */ \
<> 128:9bcdf88f62b0 517 true /* Enable VMON channel */ \
Kojto 113:f141b2784e32 518 }
Kojto 113:f141b2784e32 519 #endif /* EMU_STATUS_VMONRDY */
Kojto 98:8ab26030e058 520
Kojto 98:8ab26030e058 521 /*******************************************************************************
Kojto 98:8ab26030e058 522 ***************************** PROTOTYPES **********************************
Kojto 98:8ab26030e058 523 ******************************************************************************/
Kojto 98:8ab26030e058 524
Kojto 98:8ab26030e058 525 /***************************************************************************//**
Kojto 98:8ab26030e058 526 * @brief
Kojto 98:8ab26030e058 527 * Enter energy mode 1 (EM1).
Kojto 98:8ab26030e058 528 ******************************************************************************/
Kojto 98:8ab26030e058 529 __STATIC_INLINE void EMU_EnterEM1(void)
Kojto 98:8ab26030e058 530 {
Kojto 113:f141b2784e32 531 /* Enter sleep mode */
Kojto 98:8ab26030e058 532 SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
Kojto 98:8ab26030e058 533 __WFI();
Kojto 98:8ab26030e058 534 }
Kojto 98:8ab26030e058 535
Kojto 98:8ab26030e058 536 void EMU_EM23Init(EMU_EM23Init_TypeDef *em23Init);
Kojto 113:f141b2784e32 537 #if defined( _EMU_EM4CONF_MASK ) || defined( _EMU_EM4CTRL_MASK )
Kojto 98:8ab26030e058 538 void EMU_EM4Init(EMU_EM4Init_TypeDef *em4Init);
Kojto 98:8ab26030e058 539 #endif
Kojto 98:8ab26030e058 540 void EMU_EnterEM2(bool restore);
Kojto 98:8ab26030e058 541 void EMU_EnterEM3(bool restore);
Kojto 98:8ab26030e058 542 void EMU_EnterEM4(void);
<> 128:9bcdf88f62b0 543 #if defined( _EMU_EM4CTRL_MASK )
<> 128:9bcdf88f62b0 544 void EMU_EnterEM4H(void);
<> 128:9bcdf88f62b0 545 void EMU_EnterEM4S(void);
<> 128:9bcdf88f62b0 546 #endif
Kojto 98:8ab26030e058 547 void EMU_MemPwrDown(uint32_t blocks);
Kojto 98:8ab26030e058 548 void EMU_UpdateOscConfig(void);
Kojto 98:8ab26030e058 549 #if defined( BU_PRESENT )
Kojto 98:8ab26030e058 550 void EMU_BUPDInit(EMU_BUPDInit_TypeDef *bupdInit);
Kojto 98:8ab26030e058 551 void EMU_BUThresholdSet(EMU_BODMode_TypeDef mode, uint32_t value);
Kojto 98:8ab26030e058 552 void EMU_BUThresRangeSet(EMU_BODMode_TypeDef mode, uint32_t value);
Kojto 98:8ab26030e058 553 #endif
Kojto 113:f141b2784e32 554 #if defined( _EMU_DCDCCTRL_MASK )
Kojto 113:f141b2784e32 555 bool EMU_DCDCInit(EMU_DCDCInit_TypeDef *dcdcInit);
Kojto 113:f141b2784e32 556 void EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode);
Kojto 113:f141b2784e32 557 bool EMU_DCDCOutputVoltageSet(uint32_t mV, bool setLpVoltage, bool setLnVoltage);
Kojto 113:f141b2784e32 558 void EMU_DCDCOptimizeSlice(uint32_t mALoadCurrent);
Kojto 113:f141b2784e32 559 void EMU_DCDCLnRcoBandSet(EMU_DcdcLnRcoBand_TypeDef band);
Kojto 113:f141b2784e32 560 bool EMU_DCDCPowerOff(void);
Kojto 113:f141b2784e32 561 #endif
Kojto 113:f141b2784e32 562 #if defined( EMU_STATUS_VMONRDY )
Kojto 113:f141b2784e32 563 void EMU_VmonInit(EMU_VmonInit_TypeDef *vmonInit);
Kojto 113:f141b2784e32 564 void EMU_VmonHystInit(EMU_VmonHystInit_TypeDef *vmonInit);
Kojto 113:f141b2784e32 565 void EMU_VmonEnable(EMU_VmonChannel_TypeDef channel, bool enable);
Kojto 113:f141b2784e32 566 bool EMU_VmonChannelStatusGet(EMU_VmonChannel_TypeDef channel);
Kojto 98:8ab26030e058 567
Kojto 113:f141b2784e32 568 /***************************************************************************//**
Kojto 113:f141b2784e32 569 * @brief
Kojto 113:f141b2784e32 570 * Get the status of the voltage monitor (VMON).
Kojto 113:f141b2784e32 571 *
Kojto 113:f141b2784e32 572 * @return
Kojto 113:f141b2784e32 573 * Status of the VMON. True if all the enabled channels are ready, false if
Kojto 113:f141b2784e32 574 * one or more of the enabled channels are not ready.
Kojto 113:f141b2784e32 575 ******************************************************************************/
Kojto 113:f141b2784e32 576 __STATIC_INLINE bool EMU_VmonStatusGet(void)
Kojto 113:f141b2784e32 577 {
Kojto 113:f141b2784e32 578 return BUS_RegBitRead(&EMU->STATUS, _EMU_STATUS_VMONRDY_SHIFT);
Kojto 113:f141b2784e32 579 }
Kojto 113:f141b2784e32 580 #endif /* EMU_STATUS_VMONRDY */
Kojto 98:8ab26030e058 581
Kojto 98:8ab26030e058 582 #if defined( _EMU_IF_MASK )
Kojto 98:8ab26030e058 583 /***************************************************************************//**
Kojto 98:8ab26030e058 584 * @brief
Kojto 98:8ab26030e058 585 * Clear one or more pending EMU interrupts.
Kojto 98:8ab26030e058 586 *
Kojto 98:8ab26030e058 587 * @param[in] flags
Kojto 98:8ab26030e058 588 * Pending EMU interrupt sources to clear. Use one or more valid
Kojto 98:8ab26030e058 589 * interrupt flags for the EMU module (EMU_IFC_nnn).
Kojto 98:8ab26030e058 590 ******************************************************************************/
Kojto 98:8ab26030e058 591 __STATIC_INLINE void EMU_IntClear(uint32_t flags)
Kojto 98:8ab26030e058 592 {
Kojto 98:8ab26030e058 593 EMU->IFC = flags;
Kojto 98:8ab26030e058 594 }
Kojto 98:8ab26030e058 595
Kojto 98:8ab26030e058 596
Kojto 98:8ab26030e058 597 /***************************************************************************//**
Kojto 98:8ab26030e058 598 * @brief
Kojto 98:8ab26030e058 599 * Disable one or more EMU interrupts.
Kojto 98:8ab26030e058 600 *
Kojto 98:8ab26030e058 601 * @param[in] flags
Kojto 98:8ab26030e058 602 * EMU interrupt sources to disable. Use one or more valid
Kojto 98:8ab26030e058 603 * interrupt flags for the EMU module (EMU_IEN_nnn).
Kojto 98:8ab26030e058 604 ******************************************************************************/
Kojto 98:8ab26030e058 605 __STATIC_INLINE void EMU_IntDisable(uint32_t flags)
Kojto 98:8ab26030e058 606 {
Kojto 113:f141b2784e32 607 EMU->IEN &= ~flags;
Kojto 98:8ab26030e058 608 }
Kojto 98:8ab26030e058 609
Kojto 98:8ab26030e058 610
Kojto 98:8ab26030e058 611 /***************************************************************************//**
Kojto 98:8ab26030e058 612 * @brief
Kojto 98:8ab26030e058 613 * Enable one or more EMU interrupts.
Kojto 98:8ab26030e058 614 *
Kojto 98:8ab26030e058 615 * @note
Kojto 98:8ab26030e058 616 * Depending on the use, a pending interrupt may already be set prior to
Kojto 98:8ab26030e058 617 * enabling the interrupt. Consider using EMU_IntClear() prior to enabling
Kojto 98:8ab26030e058 618 * if such a pending interrupt should be ignored.
Kojto 98:8ab26030e058 619 *
Kojto 98:8ab26030e058 620 * @param[in] flags
Kojto 98:8ab26030e058 621 * EMU interrupt sources to enable. Use one or more valid
Kojto 98:8ab26030e058 622 * interrupt flags for the EMU module (EMU_IEN_nnn).
Kojto 98:8ab26030e058 623 ******************************************************************************/
Kojto 98:8ab26030e058 624 __STATIC_INLINE void EMU_IntEnable(uint32_t flags)
Kojto 98:8ab26030e058 625 {
Kojto 98:8ab26030e058 626 EMU->IEN |= flags;
Kojto 98:8ab26030e058 627 }
Kojto 98:8ab26030e058 628
Kojto 98:8ab26030e058 629
Kojto 98:8ab26030e058 630 /***************************************************************************//**
Kojto 98:8ab26030e058 631 * @brief
Kojto 98:8ab26030e058 632 * Get pending EMU interrupt flags.
Kojto 98:8ab26030e058 633 *
Kojto 98:8ab26030e058 634 * @note
Kojto 98:8ab26030e058 635 * The event bits are not cleared by the use of this function.
Kojto 98:8ab26030e058 636 *
Kojto 98:8ab26030e058 637 * @return
Kojto 98:8ab26030e058 638 * EMU interrupt sources pending. Returns one or more valid
Kojto 98:8ab26030e058 639 * interrupt flags for the EMU module (EMU_IF_nnn).
Kojto 98:8ab26030e058 640 ******************************************************************************/
Kojto 98:8ab26030e058 641 __STATIC_INLINE uint32_t EMU_IntGet(void)
Kojto 98:8ab26030e058 642 {
Kojto 98:8ab26030e058 643 return EMU->IF;
Kojto 98:8ab26030e058 644 }
Kojto 98:8ab26030e058 645
Kojto 98:8ab26030e058 646
Kojto 98:8ab26030e058 647 /***************************************************************************//**
Kojto 98:8ab26030e058 648 * @brief
Kojto 98:8ab26030e058 649 * Get enabled and pending EMU interrupt flags.
Kojto 98:8ab26030e058 650 * Useful for handling more interrupt sources in the same interrupt handler.
Kojto 98:8ab26030e058 651 *
Kojto 98:8ab26030e058 652 * @note
Kojto 98:8ab26030e058 653 * Interrupt flags are not cleared by the use of this function.
Kojto 98:8ab26030e058 654 *
Kojto 98:8ab26030e058 655 * @return
Kojto 98:8ab26030e058 656 * Pending and enabled EMU interrupt sources
Kojto 98:8ab26030e058 657 * The return value is the bitwise AND of
Kojto 98:8ab26030e058 658 * - the enabled interrupt sources in EMU_IEN and
Kojto 98:8ab26030e058 659 * - the pending interrupt flags EMU_IF
Kojto 98:8ab26030e058 660 ******************************************************************************/
Kojto 98:8ab26030e058 661 __STATIC_INLINE uint32_t EMU_IntGetEnabled(void)
Kojto 98:8ab26030e058 662 {
Kojto 98:8ab26030e058 663 uint32_t ien;
Kojto 98:8ab26030e058 664
Kojto 98:8ab26030e058 665 ien = EMU->IEN;
Kojto 98:8ab26030e058 666 return EMU->IF & ien;
Kojto 98:8ab26030e058 667 }
Kojto 98:8ab26030e058 668
Kojto 98:8ab26030e058 669
Kojto 98:8ab26030e058 670 /***************************************************************************//**
Kojto 98:8ab26030e058 671 * @brief
Kojto 98:8ab26030e058 672 * Set one or more pending EMU interrupts
Kojto 98:8ab26030e058 673 *
Kojto 98:8ab26030e058 674 * @param[in] flags
Kojto 98:8ab26030e058 675 * EMU interrupt sources to set to pending. Use one or more valid
Kojto 98:8ab26030e058 676 * interrupt flags for the EMU module (EMU_IFS_nnn).
Kojto 98:8ab26030e058 677 ******************************************************************************/
Kojto 98:8ab26030e058 678 __STATIC_INLINE void EMU_IntSet(uint32_t flags)
Kojto 98:8ab26030e058 679 {
Kojto 98:8ab26030e058 680 EMU->IFS = flags;
Kojto 98:8ab26030e058 681 }
Kojto 98:8ab26030e058 682 #endif /* _EMU_IF_MASK */
Kojto 98:8ab26030e058 683
Kojto 98:8ab26030e058 684
Kojto 98:8ab26030e058 685 #if defined( _EMU_EM4CONF_LOCKCONF_MASK )
Kojto 98:8ab26030e058 686 /***************************************************************************//**
Kojto 98:8ab26030e058 687 * @brief
Kojto 98:8ab26030e058 688 * Enable or disable EM4 lock configuration
Kojto 98:8ab26030e058 689 * @param[in] enable
Kojto 98:8ab26030e058 690 * If true, locks down EM4 configuration
Kojto 98:8ab26030e058 691 ******************************************************************************/
Kojto 98:8ab26030e058 692 __STATIC_INLINE void EMU_EM4Lock(bool enable)
Kojto 98:8ab26030e058 693 {
Kojto 113:f141b2784e32 694 BUS_RegBitWrite(&(EMU->EM4CONF), _EMU_EM4CONF_LOCKCONF_SHIFT, enable);
Kojto 98:8ab26030e058 695 }
Kojto 98:8ab26030e058 696 #endif
Kojto 98:8ab26030e058 697
Kojto 98:8ab26030e058 698 #if defined( _EMU_STATUS_BURDY_MASK )
Kojto 98:8ab26030e058 699 /***************************************************************************//**
Kojto 98:8ab26030e058 700 * @brief
Kojto 98:8ab26030e058 701 * Halts until backup power functionality is ready
Kojto 98:8ab26030e058 702 ******************************************************************************/
Kojto 98:8ab26030e058 703 __STATIC_INLINE void EMU_BUReady(void)
Kojto 98:8ab26030e058 704 {
Kojto 113:f141b2784e32 705 while(!(EMU->STATUS & EMU_STATUS_BURDY))
Kojto 113:f141b2784e32 706 ;
Kojto 98:8ab26030e058 707 }
Kojto 98:8ab26030e058 708 #endif
Kojto 98:8ab26030e058 709
Kojto 98:8ab26030e058 710 #if defined( _EMU_ROUTE_BUVINPEN_MASK )
Kojto 98:8ab26030e058 711 /***************************************************************************//**
Kojto 98:8ab26030e058 712 * @brief
Kojto 98:8ab26030e058 713 * Disable BU_VIN support
Kojto 98:8ab26030e058 714 * @param[in] enable
Kojto 98:8ab26030e058 715 * If true, enables BU_VIN input pin support, if false disables it
Kojto 98:8ab26030e058 716 ******************************************************************************/
Kojto 98:8ab26030e058 717 __STATIC_INLINE void EMU_BUPinEnable(bool enable)
Kojto 98:8ab26030e058 718 {
Kojto 113:f141b2784e32 719 BUS_RegBitWrite(&(EMU->ROUTE), _EMU_ROUTE_BUVINPEN_SHIFT, enable);
Kojto 98:8ab26030e058 720 }
Kojto 98:8ab26030e058 721 #endif
Kojto 98:8ab26030e058 722
Kojto 98:8ab26030e058 723 /***************************************************************************//**
Kojto 98:8ab26030e058 724 * @brief
Kojto 113:f141b2784e32 725 * Lock the EMU in order to protect its registers against unintended
Kojto 98:8ab26030e058 726 * modification.
Kojto 98:8ab26030e058 727 *
Kojto 98:8ab26030e058 728 * @note
Kojto 98:8ab26030e058 729 * If locking the EMU registers, they must be unlocked prior to using any
Kojto 113:f141b2784e32 730 * EMU API functions modifying EMU registers, excluding interrupt control
Kojto 113:f141b2784e32 731 * and regulator control if the architecture has a EMU_PWRCTRL register.
Kojto 113:f141b2784e32 732 * An exception to this is the energy mode entering API (EMU_EnterEMn()),
Kojto 113:f141b2784e32 733 * which can be used when the EMU registers are locked.
Kojto 98:8ab26030e058 734 ******************************************************************************/
Kojto 98:8ab26030e058 735 __STATIC_INLINE void EMU_Lock(void)
Kojto 98:8ab26030e058 736 {
Kojto 98:8ab26030e058 737 EMU->LOCK = EMU_LOCK_LOCKKEY_LOCK;
Kojto 98:8ab26030e058 738 }
Kojto 98:8ab26030e058 739
Kojto 98:8ab26030e058 740
Kojto 98:8ab26030e058 741 /***************************************************************************//**
Kojto 98:8ab26030e058 742 * @brief
Kojto 98:8ab26030e058 743 * Unlock the EMU so that writing to locked registers again is possible.
Kojto 98:8ab26030e058 744 ******************************************************************************/
Kojto 98:8ab26030e058 745 __STATIC_INLINE void EMU_Unlock(void)
Kojto 98:8ab26030e058 746 {
Kojto 98:8ab26030e058 747 EMU->LOCK = EMU_LOCK_LOCKKEY_UNLOCK;
Kojto 98:8ab26030e058 748 }
Kojto 98:8ab26030e058 749
Kojto 113:f141b2784e32 750
Kojto 113:f141b2784e32 751 #if defined( _EMU_PWRLOCK_MASK )
Kojto 113:f141b2784e32 752 /***************************************************************************//**
Kojto 113:f141b2784e32 753 * @brief
Kojto 113:f141b2784e32 754 * Lock the EMU regulator control registers in order to protect against
Kojto 113:f141b2784e32 755 * unintended modification.
Kojto 113:f141b2784e32 756 ******************************************************************************/
Kojto 113:f141b2784e32 757 __STATIC_INLINE void EMU_PowerLock(void)
Kojto 113:f141b2784e32 758 {
Kojto 113:f141b2784e32 759 EMU->PWRLOCK = EMU_PWRLOCK_LOCKKEY_LOCK;
Kojto 113:f141b2784e32 760 }
Kojto 113:f141b2784e32 761
Kojto 113:f141b2784e32 762
Kojto 113:f141b2784e32 763 /***************************************************************************//**
Kojto 113:f141b2784e32 764 * @brief
Kojto 113:f141b2784e32 765 * Unlock the EMU power control registers so that writing to
Kojto 113:f141b2784e32 766 * locked registers again is possible.
Kojto 113:f141b2784e32 767 ******************************************************************************/
Kojto 113:f141b2784e32 768 __STATIC_INLINE void EMU_PowerUnlock(void)
Kojto 113:f141b2784e32 769 {
Kojto 113:f141b2784e32 770 EMU->PWRLOCK = EMU_PWRLOCK_LOCKKEY_UNLOCK;
Kojto 113:f141b2784e32 771 }
Kojto 113:f141b2784e32 772 #endif
Kojto 113:f141b2784e32 773
Kojto 113:f141b2784e32 774
Kojto 98:8ab26030e058 775 /***************************************************************************//**
Kojto 98:8ab26030e058 776 * @brief
Kojto 98:8ab26030e058 777 * Block entering EM2 or higher number energy modes.
Kojto 98:8ab26030e058 778 ******************************************************************************/
Kojto 98:8ab26030e058 779 __STATIC_INLINE void EMU_EM2Block(void)
Kojto 98:8ab26030e058 780 {
Kojto 113:f141b2784e32 781 BUS_RegBitWrite(&(EMU->CTRL), _EMU_CTRL_EM2BLOCK_SHIFT, 1U);
Kojto 98:8ab26030e058 782 }
Kojto 98:8ab26030e058 783
Kojto 98:8ab26030e058 784 /***************************************************************************//**
Kojto 98:8ab26030e058 785 * @brief
Kojto 98:8ab26030e058 786 * Unblock entering EM2 or higher number energy modes.
Kojto 98:8ab26030e058 787 ******************************************************************************/
Kojto 98:8ab26030e058 788 __STATIC_INLINE void EMU_EM2UnBlock(void)
Kojto 98:8ab26030e058 789 {
Kojto 113:f141b2784e32 790 BUS_RegBitWrite(&(EMU->CTRL), _EMU_CTRL_EM2BLOCK_SHIFT, 0U);
Kojto 98:8ab26030e058 791 }
Kojto 98:8ab26030e058 792
Kojto 113:f141b2784e32 793 #if defined( _EMU_EM4CTRL_EM4IORETMODE_MASK )
Kojto 113:f141b2784e32 794 /***************************************************************************//**
Kojto 113:f141b2784e32 795 * @brief
Kojto 113:f141b2784e32 796 * When EM4 pin retention is set to emuPinRetentionLatch, then pins are retained
Kojto 113:f141b2784e32 797 * through EM4 entry and wakeup. The pin state is released by calling this function.
Kojto 113:f141b2784e32 798 * The feature allows peripherals or GPIO to be re-initialized after EM4 exit (reset),
Kojto 113:f141b2784e32 799 * and when the initialization is done, this function can release pins and return control
Kojto 113:f141b2784e32 800 * to the peripherals or GPIO.
Kojto 113:f141b2784e32 801 ******************************************************************************/
Kojto 113:f141b2784e32 802 __STATIC_INLINE void EMU_UnlatchPinRetention(void)
Kojto 113:f141b2784e32 803 {
Kojto 113:f141b2784e32 804 EMU->CMD = EMU_CMD_EM4UNLATCH;
Kojto 113:f141b2784e32 805 }
Kojto 113:f141b2784e32 806 #endif
Kojto 98:8ab26030e058 807
<> 128:9bcdf88f62b0 808 #if defined( _SILICON_LABS_32B_PLATFORM_2_GEN_1 )
<> 128:9bcdf88f62b0 809 void EMU_SetBiasMode(EMU_BiasMode_TypeDef mode);
<> 128:9bcdf88f62b0 810 #endif
<> 128:9bcdf88f62b0 811
Kojto 98:8ab26030e058 812 /** @} (end addtogroup EMU) */
<> 128:9bcdf88f62b0 813 /** @} (end addtogroup emlib) */
Kojto 98:8ab26030e058 814
Kojto 98:8ab26030e058 815 #ifdef __cplusplus
Kojto 98:8ab26030e058 816 }
Kojto 98:8ab26030e058 817 #endif
Kojto 98:8ab26030e058 818
Kojto 98:8ab26030e058 819 #endif /* defined( EMU_PRESENT ) */
<> 128:9bcdf88f62b0 820 #endif /* EM_EMU_H */