36 #if defined( EMU_PRESENT ) && ( EMU_COUNT > 0 )
60 #if (CMU_STATUS_AUXHFRCOENS != CMU_OSCENCMD_AUXHFRCOEN)
61 #error Conflict in AUXHFRCOENS and AUXHFRCOEN bitpositions
63 #if (CMU_STATUS_HFXOENS != CMU_OSCENCMD_HFXOEN)
64 #error Conflict in HFXOENS and HFXOEN bitpositions
66 #if (CMU_STATUS_LFRCOENS != CMU_OSCENCMD_LFRCOEN)
67 #error Conflict in LFRCOENS and LFRCOEN bitpositions
69 #if (CMU_STATUS_LFXOENS != CMU_OSCENCMD_LFXOEN)
70 #error Conflict in LFXOENS and LFXOEN bitpositions
74 #if defined( _SILICON_LABS_32B_SERIES_0 )
77 #if defined( _EFM32_GECKO_FAMILY )
78 #define ERRATA_FIX_EMU_E107_EN
79 #define NON_WIC_INT_MASK_0 (~(0x0dfc0323U))
80 #define NON_WIC_INT_MASK_1 (~(0x0U))
82 #elif defined( _EFM32_TINY_FAMILY )
83 #define ERRATA_FIX_EMU_E107_EN
84 #define NON_WIC_INT_MASK_0 (~(0x001be323U))
85 #define NON_WIC_INT_MASK_1 (~(0x0U))
87 #elif defined( _EFM32_GIANT_FAMILY )
88 #define ERRATA_FIX_EMU_E107_EN
89 #define NON_WIC_INT_MASK_0 (~(0xff020e63U))
90 #define NON_WIC_INT_MASK_1 (~(0x00000046U))
92 #elif defined( _EFM32_WONDER_FAMILY )
93 #define ERRATA_FIX_EMU_E107_EN
94 #define NON_WIC_INT_MASK_0 (~(0xff020e63U))
95 #define NON_WIC_INT_MASK_1 (~(0x00000046U))
101 #if defined(_SILICON_LABS_32B_SERIES_0) && defined( _EFM32_HAPPY_FAMILY )
102 #define ERRATA_FIX_EMU_E108_EN
106 #if defined( _SILICON_LABS_GECKO_INTERNAL_SDID_80 )
107 #define ERRATA_FIX_EMU_E208_EN
111 #if defined( _SILICON_LABS_GECKO_INTERNAL_SDID_80 )
112 #define ERRATA_FIX_DCDC_FETCNT_SET_EN
116 #if defined( _SILICON_LABS_GECKO_INTERNAL_SDID_80 )
117 #define ERRATA_FIX_DCDC_LNHS_BLOCK_EN
121 errataFixDcdcHsTrimSet,
122 errataFixDcdcHsBypassLn,
123 errataFixDcdcHsLnWaitDone
124 } errataFixDcdcHs_TypeDef;
125 static errataFixDcdcHs_TypeDef errataFixDcdcHsState = errataFixDcdcHsInit;
131 #define ADDRESS_NOT_IN_BLOCK(addr, block) ((addr) <= (block))
135 #if defined(_SILICON_LABS_GECKO_INTERNAL_SDID_84)
136 #define RAM1_BLOCKS 2
137 #define RAM1_BLOCK_SIZE 0x10000 // 64 kB blocks
138 #elif defined(_SILICON_LABS_GECKO_INTERNAL_SDID_89)
139 #define RAM0_BLOCKS 2
140 #define RAM0_BLOCK_SIZE 0x4000
141 #define RAM1_BLOCKS 2
142 #define RAM1_BLOCK_SIZE 0x4000 // 16 kB blocks
143 #elif defined(_SILICON_LABS_32B_SERIES_0) && defined(_EFM32_GIANT_FAMILY)
144 #define RAM0_BLOCKS 4
145 #define RAM0_BLOCK_SIZE 0x8000 // 32 kB blocks
146 #elif defined(_SILICON_LABS_32B_SERIES_0) && defined(_EFM32_GECKO_FAMILY)
147 #define RAM0_BLOCKS 4
148 #define RAM0_BLOCK_SIZE 0x1000 // 4 kB blocks
151 #if defined(_SILICON_LABS_32B_SERIES_0)
153 #define RAM0_END (SRAM_BASE + SRAM_SIZE - 1)
155 #define RAM0_END RAM_MEM_END
161 #if defined( _EMU_DCDCCTRL_MASK )
163 #if !defined(PWRCFG_DCDCTODVDD_VMIN)
164 #define PWRCFG_DCDCTODVDD_VMIN 1800
166 #if !defined(PWRCFG_DCDCTODVDD_VMAX)
167 #define PWRCFG_DCDCTODVDD_VMAX 3000
178 #if defined( _EMU_DCDCCTRL_MASK )
179 static uint16_t dcdcMaxCurrent_mA;
180 static uint16_t dcdcEm01LoadCurrent_mA;
183 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
195 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
220 static void emState(emState_TypeDef action)
224 static uint32_t cmuStatus;
226 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
227 static uint8_t vScaleStatus;
232 if (action == emState_Save)
235 cmuStatus =
CMU->STATUS;
237 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
244 else if (action == emState_Restore)
247 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
267 #if defined( _CMU_STATUS_USHFRCOENS_MASK )
268 oscEnCmd |= ((cmuStatus & CMU_STATUS_USHFRCOENS) ? CMU_OSCENCMD_USHFRCOEN : 0);
270 CMU->OSCENCMD = oscEnCmd;
272 #if defined( _EMU_STATUS_VSCALE_MASK )
298 #if defined( ERRATA_FIX_EMU_E107_EN )
300 __STATIC_INLINE
bool getErrataFixEmuE107En(
void)
305 uint16_t majorMinorRev;
319 #if defined( _EFM32_GECKO_FAMILY )
320 return (majorMinorRev <= 0x0103);
321 #elif defined( _EFM32_TINY_FAMILY )
322 return (majorMinorRev <= 0x0102);
323 #elif defined( _EFM32_GIANT_FAMILY )
324 return (majorMinorRev <= 0x0103) || (majorMinorRev == 0x0204);
325 #elif defined( _EFM32_WONDER_FAMILY )
326 return (majorMinorRev == 0x0100);
335 #define DCDC_LP_PFET_CNT 7
336 #define DCDC_LP_NFET_CNT 7
337 #if defined( ERRATA_FIX_DCDC_FETCNT_SET_EN )
338 static void currentLimitersUpdate(
void);
339 static void dcdcFetCntSet(
bool lpModeSet)
342 static uint32_t emuDcdcMiscCtrlReg;
346 emuDcdcMiscCtrlReg =
EMU->DCDCMISCCTRL;
347 tmp =
EMU->DCDCMISCCTRL
351 EMU->DCDCMISCCTRL = tmp;
352 currentLimitersUpdate();
356 EMU->DCDCMISCCTRL = emuDcdcMiscCtrlReg;
357 currentLimitersUpdate();
362 #if defined( ERRATA_FIX_DCDC_LNHS_BLOCK_EN )
363 static void dcdcHsFixLnBlock(
void)
365 #define EMU_DCDCSTATUS (* (volatile uint32_t *)(EMU_BASE + 0x7C))
366 if ((errataFixDcdcHsState == errataFixDcdcHsTrimSet)
367 || (errataFixDcdcHsState == errataFixDcdcHsBypassLn))
372 while (!(EMU_DCDCSTATUS & (0x1 << 16)));
374 errataFixDcdcHsState = errataFixDcdcHsLnWaitDone;
380 #if defined( _EMU_CTRL_EM23VSCALE_MASK )
382 static void vScaleDownEM23Setup(
void)
384 uint32_t hfSrcClockFrequency;
398 if ((uint32_t)scaleEM23Voltage > (uint32_t)currentEM01Voltage)
405 if (hfSrcClockFrequency > CMU_VSCALEEM01_LOWPOWER_VOLTAGE_CLOCK_MAX)
482 #if defined( ERRATA_FIX_EMU_E107_EN )
483 bool errataFixEmuE107En;
484 uint32_t nonWicIntEn[2];
488 emState(emState_Save);
490 #if defined( _EMU_CTRL_EM23VSCALE_MASK )
491 vScaleDownEM23Setup();
495 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
499 #if defined( ERRATA_FIX_EMU_E107_EN )
500 errataFixEmuE107En = getErrataFixEmuE107En();
501 if (errataFixEmuE107En)
503 nonWicIntEn[0] = NVIC->ISER[0] & NON_WIC_INT_MASK_0;
504 NVIC->ICER[0] = nonWicIntEn[0];
505 #if (NON_WIC_INT_MASK_1 != (~(0x0U)))
506 nonWicIntEn[1] = NVIC->ISER[1] & NON_WIC_INT_MASK_1;
507 NVIC->ICER[1] = nonWicIntEn[1];
512 #if defined( ERRATA_FIX_DCDC_FETCNT_SET_EN )
515 #if defined( ERRATA_FIX_DCDC_LNHS_BLOCK_EN )
521 #if defined( ERRATA_FIX_DCDC_FETCNT_SET_EN )
522 dcdcFetCntSet(
false);
526 #if defined( ERRATA_FIX_EMU_E107_EN )
527 if (errataFixEmuE107En)
529 NVIC->ISER[0] = nonWicIntEn[0];
530 #if (NON_WIC_INT_MASK_1 != (~(0x0U)))
531 NVIC->ISER[1] = nonWicIntEn[1];
539 emState(emState_Restore);
601 #if defined( ERRATA_FIX_EMU_E107_EN )
602 bool errataFixEmuE107En;
603 uint32_t nonWicIntEn[2];
607 emState(emState_Save);
609 #if defined( _EMU_CTRL_EM23VSCALE_MASK )
610 vScaleDownEM23Setup();
627 SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
631 #if defined( ERRATA_FIX_EMU_E107_EN )
632 errataFixEmuE107En = getErrataFixEmuE107En();
633 if (errataFixEmuE107En)
635 nonWicIntEn[0] = NVIC->ISER[0] & NON_WIC_INT_MASK_0;
636 NVIC->ICER[0] = nonWicIntEn[0];
637 #if (NON_WIC_INT_MASK_1 != (~(0x0U)))
638 nonWicIntEn[1] = NVIC->ISER[1] & NON_WIC_INT_MASK_1;
639 NVIC->ICER[1] = nonWicIntEn[1];
644 #if defined( ERRATA_FIX_DCDC_FETCNT_SET_EN )
647 #if defined( ERRATA_FIX_DCDC_LNHS_BLOCK_EN )
653 #if defined( ERRATA_FIX_DCDC_FETCNT_SET_EN )
654 dcdcFetCntSet(
false);
658 #if defined( ERRATA_FIX_EMU_E107_EN )
659 if (errataFixEmuE107En)
661 NVIC->ISER[0] = nonWicIntEn[0];
662 #if (NON_WIC_INT_MASK_1 != (~(0x0U)))
663 NVIC->ISER[1] = nonWicIntEn[1];
671 emState(emState_Restore);
694 emState(emState_Restore);
709 #if defined( _EMU_EM4CTRL_EM4ENTRY_SHIFT )
715 uint32_t em4seq2 = (
EMU->CTRL & ~_EMU_CTRL_EM4CTRL_MASK)
716 | (2 << _EMU_CTRL_EM4CTRL_SHIFT);
717 uint32_t em4seq3 = (
EMU->CTRL & ~_EMU_CTRL_EM4CTRL_MASK)
718 | (3 << _EMU_CTRL_EM4CTRL_SHIFT);
724 #if defined( _EMU_EM4CTRL_MASK )
738 #if defined( _EMU_EM4CTRL_MASK ) && defined( ERRATA_FIX_EMU_E208_EN )
744 *(
volatile uint32_t *)(
EMU_BASE + 0x190) = 0x0000ADE8UL;
745 *(
volatile uint32_t *)(
EMU_BASE + 0x198) |= (0x1UL << 7);
746 *(
volatile uint32_t *)(
EMU_BASE + 0x88) |= (0x1UL << 8);
750 #if defined( ERRATA_FIX_EMU_E108_EN )
753 *(
volatile uint32_t *)0x400C80E4 = 0;
756 #if defined( ERRATA_FIX_DCDC_FETCNT_SET_EN )
759 #if defined( ERRATA_FIX_DCDC_LNHS_BLOCK_EN )
763 for (i = 0; i < 4; i++)
765 #if defined( _EMU_EM4CTRL_EM4ENTRY_SHIFT )
766 EMU->EM4CTRL = em4seq2;
767 EMU->EM4CTRL = em4seq3;
769 EMU->EM4CTRL = em4seq2;
778 #if defined( _EMU_EM4CTRL_MASK )
827 #if defined( _EMU_MEMCTRL_MASK )
828 EMU->MEMCTRL = blocks & _EMU_MEMCTRL_MASK;
829 #elif defined( _EMU_RAM0CTRL_MASK )
882 #if defined(_SILICON_LABS_GECKO_INTERNAL_SDID_84) // EFM32xG12 and EFR32xG12
884 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x20004000) << 0;
885 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x20008000) << 1;
886 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x2000C000) << 2;
887 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x20010000) << 3;
888 #elif defined(_SILICON_LABS_GECKO_INTERNAL_SDID_80) // EFM32xG1 and EFR32xG1
890 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x20001000) << 0;
891 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x20002000) << 1;
892 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x20004000) << 2;
893 mask |= ADDRESS_NOT_IN_BLOCK(start, 0x20006000) << 3;
894 #elif defined(RAM0_BLOCKS)
896 for (
int i = 1; i < RAM0_BLOCKS; i++)
898 mask |= ADDRESS_NOT_IN_BLOCK(start,
RAM_MEM_BASE + (i * RAM0_BLOCK_SIZE)) << (i - 1);
904 #if defined( _EMU_MEMCTRL_MASK )
905 EMU->MEMCTRL =
EMU->MEMCTRL | mask;
906 #elif defined( _EMU_RAM0CTRL_MASK )
907 EMU->RAM0CTRL =
EMU->RAM0CTRL | mask;
914 #if defined(RAM1_MEM_END)
918 for (
int i = 0; i < RAM1_BLOCKS; i++)
920 mask |= ADDRESS_NOT_IN_BLOCK(start,
RAM1_MEM_BASE + (i * RAM1_BLOCK_SIZE)) << i;
923 EMU->RAM1CTRL |= mask;
927 #if defined(_EMU_EM23PERNORETAINCTRL_MASK)
946 EMU->EM23PERNORETAINCTRL = periMask & emuPeripheralRetention_ALL;
960 emState(emState_Save);
964 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
981 uint32_t hfSrcClockFrequency;
986 if (clockFrequency == 0)
992 hfSrcClockFrequency = clockFrequency;
997 && (hfSrcClockFrequency < CMU_VSCALEEM01_LOWPOWER_VOLTAGE_CLOCK_MAX))
1014 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
1035 uint32_t hfSrcClockFrequency;
1042 EFM_ASSERT(hfSrcClockFrequency <= CMU_VSCALEEM01_LOWPOWER_VOLTAGE_CLOCK_MAX);
1045 EMU->CMD = vScaleEM01Cmd(voltage);
1054 #if defined( _EMU_CMD_EM01VSCALE0_MASK )
1080 #if defined( _EMU_CTRL_EMVREG_MASK )
1082 : (
EMU->CTRL & ~EMU_CTRL_EMVREG);
1083 #elif defined( _EMU_CTRL_EM23VREG_MASK )
1085 : (
EMU->CTRL & ~EMU_CTRL_EM23VREG);
1090 #if defined( _EMU_CTRL_EM23VSCALE_MASK )
1097 #if defined( _EMU_EM4CONF_MASK ) || defined( _EMU_EM4CTRL_MASK )
1107 #if defined( _EMU_EM4CONF_MASK )
1109 uint32_t em4conf =
EMU->EM4CONF;
1112 em4conf &= ~(_EMU_EM4CONF_LOCKCONF_MASK
1113 | _EMU_EM4CONF_OSC_MASK
1114 | _EMU_EM4CONF_BURTCWU_MASK
1115 | _EMU_EM4CONF_VREGEN_MASK);
1118 em4conf |= (em4Init->lockConfig << _EMU_EM4CONF_LOCKCONF_SHIFT)
1120 | (em4Init->buRtcWakeup << _EMU_EM4CONF_BURTCWU_SHIFT)
1121 | (em4Init->vreg << _EMU_EM4CONF_VREGEN_SHIFT);
1124 EMU->EM4CONF = em4conf;
1126 #elif defined( _EMU_EM4CTRL_MASK )
1129 uint32_t em4ctrl =
EMU->EM4CTRL;
1143 EMU->EM4CTRL = em4ctrl;
1146 #if defined( _EMU_CTRL_EM4HVSCALE_MASK )
1154 #if defined( BU_PRESENT )
1162 void EMU_BUPDInit(
const EMU_BUPDInit_TypeDef *bupdInit)
1167 reg =
EMU->PWRCONF & ~(_EMU_PWRCONF_PWRRES_MASK
1168 | _EMU_PWRCONF_VOUTSTRONG_MASK
1169 | _EMU_PWRCONF_VOUTMED_MASK
1170 | _EMU_PWRCONF_VOUTWEAK_MASK);
1172 reg |= bupdInit->resistor
1173 | (bupdInit->voutStrong << _EMU_PWRCONF_VOUTSTRONG_SHIFT)
1174 | (bupdInit->voutMed << _EMU_PWRCONF_VOUTMED_SHIFT)
1175 | (bupdInit->voutWeak << _EMU_PWRCONF_VOUTWEAK_SHIFT);
1180 reg =
EMU->BUINACT & ~(_EMU_BUINACT_PWRCON_MASK);
1181 reg |= (bupdInit->inactivePower);
1185 reg =
EMU->BUACT & ~(_EMU_BUACT_PWRCON_MASK);
1186 reg |= (bupdInit->activePower);
1190 reg =
EMU->BUCTRL & ~(_EMU_BUCTRL_PROBE_MASK
1191 | _EMU_BUCTRL_BODCAL_MASK
1192 | _EMU_BUCTRL_STATEN_MASK
1193 | _EMU_BUCTRL_EN_MASK);
1197 reg |= bupdInit->probe
1198 | (bupdInit->bodCal << _EMU_BUCTRL_BODCAL_SHIFT)
1199 | (bupdInit->statusPinEnable << _EMU_BUCTRL_STATEN_SHIFT)
1200 | (bupdInit->enable << _EMU_BUCTRL_EN_SHIFT);
1206 EMU_BUPinEnable(bupdInit->enable);
1223 EFM_ASSERT(value<8);
1224 EFM_ASSERT(value<=(_EMU_BUACT_BUEXTHRES_MASK>>_EMU_BUACT_BUEXTHRES_SHIFT));
1229 EMU->BUACT = (
EMU->BUACT & ~_EMU_BUACT_BUEXTHRES_MASK)
1230 | (value<<_EMU_BUACT_BUEXTHRES_SHIFT);
1233 EMU->BUINACT = (
EMU->BUINACT & ~_EMU_BUINACT_BUENTHRES_MASK)
1234 | (value<<_EMU_BUINACT_BUENTHRES_SHIFT);
1250 EFM_ASSERT(value < 4);
1251 EFM_ASSERT(value<=(_EMU_BUACT_BUEXRANGE_MASK>>_EMU_BUACT_BUEXRANGE_SHIFT));
1256 EMU->BUACT = (
EMU->BUACT & ~_EMU_BUACT_BUEXRANGE_MASK)
1257 | (value<<_EMU_BUACT_BUEXRANGE_SHIFT);
1260 EMU->BUINACT = (
EMU->BUINACT & ~_EMU_BUINACT_BUENRANGE_MASK)
1261 | (value<<_EMU_BUINACT_BUENRANGE_SHIFT);
1269 #if defined( _EMU_DCDCCTRL_MASK )
1271 #if defined( _EMU_DCDCMISCCTRL_LPCMPBIAS_MASK )
1272 #define _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_MASK _EMU_DCDCMISCCTRL_LPCMPBIAS_MASK
1273 #define _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_SHIFT _EMU_DCDCMISCCTRL_LPCMPBIAS_SHIFT
1274 #elif defined( _EMU_DCDCMISCCTRL_LPCMPBIASEM234H_MASK )
1275 #define _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_MASK _EMU_DCDCMISCCTRL_LPCMPBIASEM234H_MASK
1276 #define _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_SHIFT _EMU_DCDCMISCCTRL_LPCMPBIASEM234H_SHIFT
1278 #if defined( _EMU_DCDCLPCTRL_LPCMPHYSSEL_MASK )
1279 #define _GENERIC_DCDCLPCTRL_LPCMPHYSSELEM234H_MASK _EMU_DCDCLPCTRL_LPCMPHYSSEL_MASK
1280 #define _GENERIC_DCDCLPCTRL_LPCMPHYSSELEM234H_SHIFT _EMU_DCDCLPCTRL_LPCMPHYSSEL_SHIFT
1281 #elif defined( _EMU_DCDCLPCTRL_LPCMPHYSSELEM234H_MASK )
1282 #define _GENERIC_DCDCLPCTRL_LPCMPHYSSELEM234H_MASK _EMU_DCDCLPCTRL_LPCMPHYSSELEM234H_MASK
1283 #define _GENERIC_DCDCLPCTRL_LPCMPHYSSELEM234H_SHIFT _EMU_DCDCLPCTRL_LPCMPHYSSELEM234H_SHIFT
1289 dcdcTrimMode_EM234H_LP = 0,
1290 #if defined( _EMU_DCDCLPEM01CFG_LPCMPBIASEM01_MASK )
1291 dcdcTrimMode_EM01_LP,
1294 } dcdcTrimMode_TypeDef;
1304 static bool dcdcConstCalibrationLoad(
void)
1306 #if defined( _SILICON_LABS_GECKO_INTERNAL_SDID_80 )
1308 volatile uint32_t *reg;
1311 volatile uint32_t*
const diCal_EMU_DCDCLNFREQCTRL = (
volatile uint32_t *)(0x0FE08038);
1312 volatile uint32_t*
const diCal_EMU_DCDCLNVCTRL = (
volatile uint32_t *)(0x0FE08040);
1313 volatile uint32_t*
const diCal_EMU_DCDCLPCTRL = (
volatile uint32_t *)(0x0FE08048);
1314 volatile uint32_t*
const diCal_EMU_DCDCLPVCTRL = (
volatile uint32_t *)(0x0FE08050);
1315 volatile uint32_t*
const diCal_EMU_DCDCTRIM0 = (
volatile uint32_t *)(0x0FE08058);
1316 volatile uint32_t*
const diCal_EMU_DCDCTRIM1 = (
volatile uint32_t *)(0x0FE08060);
1318 if (
DEVINFO->DCDCLPVCTRL0 != UINT_MAX)
1320 val = *(diCal_EMU_DCDCLNFREQCTRL + 1);
1321 reg = (
volatile uint32_t *)*diCal_EMU_DCDCLNFREQCTRL;
1324 val = *(diCal_EMU_DCDCLNVCTRL + 1);
1325 reg = (
volatile uint32_t *)*diCal_EMU_DCDCLNVCTRL;
1328 val = *(diCal_EMU_DCDCLPCTRL + 1);
1329 reg = (
volatile uint32_t *)*diCal_EMU_DCDCLPCTRL;
1332 val = *(diCal_EMU_DCDCLPVCTRL + 1);
1333 reg = (
volatile uint32_t *)*diCal_EMU_DCDCLPVCTRL;
1336 val = *(diCal_EMU_DCDCTRIM0 + 1);
1337 reg = (
volatile uint32_t *)*diCal_EMU_DCDCTRIM0;
1340 val = *(diCal_EMU_DCDCTRIM1 + 1);
1341 reg = (
volatile uint32_t *)*diCal_EMU_DCDCTRIM1;
1361 static void dcdcValidatedConfigSet(
void)
1364 #define EMU_DCDCMISCCTRL_LPCMPHYSDIS (0x1UL << 1)
1366 #define EMU_DCDCMISCCTRL_LPCMPHYSHI (0x1UL << 2)
1367 #define EMU_DCDCSMCTRL (* (volatile uint32_t *)(EMU_BASE + 0x44))
1369 uint32_t lnForceCcm;
1371 #if defined( _SILICON_LABS_GECKO_INTERNAL_SDID_80 )
1372 uint32_t dcdcTiming;
1395 #if defined( _SILICON_LABS_GECKO_INTERNAL_SDID_80 )
1396 EMU->DCDCTIMING &= ~_EMU_DCDCTIMING_DUTYSCALE_MASK;
1401 if ((rev.
major == 1)
1403 && (errataFixDcdcHsState == errataFixDcdcHsInit))
1406 EMU_DCDCSMCTRL |= 1;
1408 dcdcTiming =
EMU->DCDCTIMING;
1409 dcdcTiming &= ~(_EMU_DCDCTIMING_LPINITWAIT_MASK
1410 |_EMU_DCDCTIMING_LNWAIT_MASK
1411 |_EMU_DCDCTIMING_BYPWAIT_MASK);
1413 dcdcTiming |= ((180 << _EMU_DCDCTIMING_LPINITWAIT_SHIFT)
1414 | (12 << _EMU_DCDCTIMING_LNWAIT_SHIFT)
1415 | (180 << _EMU_DCDCTIMING_BYPWAIT_SHIFT));
1416 EMU->DCDCTIMING = dcdcTiming;
1418 errataFixDcdcHsState = errataFixDcdcHsTrimSet;
1431 static void currentLimitersUpdate(
void)
1434 uint32_t zdetLimSel;
1436 uint16_t maxReverseCurrent_mA;
1443 const uint32_t lpcLim = (((14 + 40) + ((14 + 40) / 2))
1444 / (5 * (DCDC_LP_PFET_CNT + 1)))
1455 lncLimSel = (((dcdcMaxCurrent_mA + 40) + ((dcdcMaxCurrent_mA + 40) / 2))
1456 / (5 * (pFetCnt + 1)))
1460 lncLimSel =
SL_MIN(lncLimSel,
1472 | (lncLimSel | lpcLimSel);
1478 if (dcdcReverseCurrentControl >= 0)
1481 maxReverseCurrent_mA = (uint16_t)dcdcReverseCurrentControl;
1483 zdetLimSel = ( ((maxReverseCurrent_mA + 40) + ((maxReverseCurrent_mA + 40) / 2))
1484 / ((2 * (pFetCnt + 1)) + ((pFetCnt + 1) / 2)) );
1486 zdetLimSel =
SL_MIN(zdetLimSel,
1512 static void userCurrentLimitsSet(uint32_t maxCurrent_mA,
1515 dcdcMaxCurrent_mA = maxCurrent_mA;
1516 dcdcReverseCurrentControl = reverseCurrentControl;
1532 EMU->DCDCLNCOMPCTRL = 0x57204077UL;
1536 EMU->DCDCLNCOMPCTRL = 0xB7102137UL;
1557 static bool lpCmpHystCalibrationLoad(
bool lpAttenuation,
1559 dcdcTrimMode_TypeDef trimMode)
1561 uint32_t lpcmpHystSel;
1564 #if defined(_SILICON_LABS_GECKO_INTERNAL_SDID_80)
1574 lpcmpHystSel =
DEVINFO->DCDCLPCMPHYSSEL0;
1590 lpcmpHystSel =
DEVINFO->DCDCLPCMPHYSSEL1;
1621 if (trimMode == dcdcTrimMode_EM234H_LP)
1624 lpcmpHystSel <<= _GENERIC_DCDCLPCTRL_LPCMPHYSSELEM234H_SHIFT;
1625 if (lpcmpHystSel & ~_GENERIC_DCDCLPCTRL_LPCMPHYSSELEM234H_MASK)
1631 EMU->DCDCLPCTRL = (
EMU->DCDCLPCTRL & ~_GENERIC_DCDCLPCTRL_LPCMPHYSSELEM234H_MASK) | lpcmpHystSel;
1634 #if defined( _EMU_DCDCLPEM01CFG_LPCMPHYSSELEM01_MASK )
1635 if (trimMode == dcdcTrimMode_EM01_LP)
1666 static void lpGetDevinfoVrefLowHigh(uint32_t *vrefL,
1671 uint32_t vrefLow = 0;
1672 uint32_t vrefHigh = 0;
1676 uint32_t switchVal = (lpcmpBias << 8) | (lpAttenuation ? 1 : 0);
1679 case ((0 << 8) | 1):
1680 vrefLow =
DEVINFO->DCDCLPVCTRL2;
1687 case ((1 << 8) | 1):
1688 vrefLow =
DEVINFO->DCDCLPVCTRL2;
1695 case ((2 << 8) | 1):
1696 vrefLow =
DEVINFO->DCDCLPVCTRL3;
1703 case ((3 << 8) | 1):
1704 vrefLow =
DEVINFO->DCDCLPVCTRL3;
1711 case ((0 << 8) | 0):
1712 vrefLow =
DEVINFO->DCDCLPVCTRL0;
1719 case ((1 << 8) | 0):
1720 vrefLow =
DEVINFO->DCDCLPVCTRL0;
1727 case ((2 << 8) | 0):
1728 vrefLow =
DEVINFO->DCDCLPVCTRL1;
1735 case ((3 << 8) | 0):
1736 vrefLow =
DEVINFO->DCDCLPVCTRL1;
1770 #if defined(_SILICON_LABS_GECKO_INTERNAL_SDID_80)
1780 errataFixDcdcHsState = errataFixDcdcHsBypassLn;
1871 uint32_t lpCmpBiasSelEM234H;
1873 #if defined(_EMU_PWRCFG_MASK)
1876 EMU->PWRCFG = EMU_PWRCFG_PWRCFG_DCDCTODVDD;
1880 if ((
EMU->PWRCFG & _EMU_PWRCFG_PWRCFG_MASK) != EMU_PWRCFG_PWRCFG_DCDCTODVDD)
1891 dcdcConstCalibrationLoad();
1903 #if (_SILICON_LABS_GECKO_INTERNAL_SDID != 80)
1916 lpCmpBiasSelEM234H = 0;
1920 lpCmpBiasSelEM234H = 1 << _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_SHIFT;
1924 lpCmpBiasSelEM234H = 2 << _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_SHIFT;
1928 lpCmpBiasSelEM234H = 3 << _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_SHIFT;
1937 EMU->DCDCMISCCTRL = (
EMU->DCDCMISCCTRL & ~(_GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_MASK
1939 | ((uint32_t)lpCmpBiasSelEM234H
1942 #if defined(_EMU_DCDCLPEM01CFG_LPCMPBIASEM01_MASK)
1951 dcdcValidatedConfigSet();
1980 #if ( _SILICON_LABS_GECKO_INTERNAL_SDID == 80 )
1988 #if defined(_EMU_PWRCTRL_REGPWRSEL_MASK)
1999 #if ( _SILICON_LABS_GECKO_INTERNAL_SDID != 80 )
2024 #if defined( _DEVINFO_DCDCLNVCTRL0_3V0LNATT1_MASK )
2026 #define DCDC_TRIM_MODES ((uint8_t)dcdcTrimMode_LN + 1)
2027 bool validOutVoltage;
2028 bool attenuationSet;
2030 uint32_t mVhigh = 0;
2032 uint32_t vrefVal[DCDC_TRIM_MODES] = {0};
2033 uint32_t vrefLow[DCDC_TRIM_MODES] = {0};
2034 uint32_t vrefHigh[DCDC_TRIM_MODES] = {0};
2035 uint8_t lpcmpBias[DCDC_TRIM_MODES] = {0};
2039 validOutVoltage = ((mV >= PWRCFG_DCDCTODVDD_VMIN)
2040 && (mV <= PWRCFG_DCDCTODVDD_VMAX));
2042 if (!validOutVoltage)
2050 attenuationSet = (mV > 1800);
2055 mVdiff = mVhigh - mVlow;
2061 mVdiff = mVhigh - mVlow;
2069 vrefLow[dcdcTrimMode_LN] =
DEVINFO->DCDCLNVCTRL0;
2077 vrefLow[dcdcTrimMode_LN] =
DEVINFO->DCDCLNVCTRL0;
2086 lpcmpBias[dcdcTrimMode_EM234H_LP] = (
EMU->DCDCMISCCTRL & _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_MASK)
2087 >> _GENERIC_DCDCMISCCTRL_LPCMPBIASEM234H_SHIFT;
2088 lpGetDevinfoVrefLowHigh(&vrefLow[dcdcTrimMode_EM234H_LP],
2089 &vrefHigh[dcdcTrimMode_EM234H_LP],
2091 lpcmpBias[dcdcTrimMode_EM234H_LP]);
2093 #if defined( _EMU_DCDCLPEM01CFG_LPCMPBIASEM01_MASK )
2097 lpGetDevinfoVrefLowHigh(&vrefLow[dcdcTrimMode_EM01_LP],
2098 &vrefHigh[dcdcTrimMode_EM01_LP],
2100 lpcmpBias[dcdcTrimMode_EM01_LP]);
2105 vrefVal[dcdcTrimMode_LN] = ((mV - mVlow) * (vrefHigh[dcdcTrimMode_LN] - vrefLow[dcdcTrimMode_LN]))
2107 vrefVal[dcdcTrimMode_LN] += vrefLow[dcdcTrimMode_LN];
2109 vrefVal[dcdcTrimMode_EM234H_LP] = ((mV - mVlow) * (vrefHigh[dcdcTrimMode_EM234H_LP] - vrefLow[dcdcTrimMode_EM234H_LP]))
2111 vrefVal[dcdcTrimMode_EM234H_LP] += vrefLow[dcdcTrimMode_EM234H_LP];
2113 #if defined( _EMU_DCDCLPEM01CFG_LPCMPBIASEM01_MASK )
2114 vrefVal[dcdcTrimMode_EM01_LP] = ((mV - mVlow) * (vrefHigh[dcdcTrimMode_EM01_LP] - vrefLow[dcdcTrimMode_EM01_LP]))
2116 vrefVal[dcdcTrimMode_EM01_LP] += vrefLow[dcdcTrimMode_EM01_LP];
2120 if ((vrefVal[dcdcTrimMode_LN] > vrefHigh[dcdcTrimMode_LN])
2121 || (vrefVal[dcdcTrimMode_LN] < vrefLow[dcdcTrimMode_LN])
2123 || (vrefVal[dcdcTrimMode_EM01_LP] > vrefHigh[dcdcTrimMode_EM01_LP])
2124 || (vrefVal[dcdcTrimMode_EM01_LP] < vrefLow[dcdcTrimMode_EM01_LP])
2126 || (vrefVal[dcdcTrimMode_EM234H_LP] > vrefHigh[dcdcTrimMode_EM234H_LP])
2127 || (vrefVal[dcdcTrimMode_EM234H_LP] < vrefLow[dcdcTrimMode_EM234H_LP]))
2145 if(!(lpCmpHystCalibrationLoad(attenuationSet, lpcmpBias[dcdcTrimMode_EM234H_LP], dcdcTrimMode_EM234H_LP)))
2152 #if defined( _EMU_DCDCLPEM01CFG_LPCMPBIASEM01_MASK )
2154 if(!(lpCmpHystCalibrationLoad(attenuationSet, lpcmpBias[dcdcTrimMode_EM01_LP], dcdcTrimMode_EM01_LP)))
2162 vrefVal[dcdcTrimMode_EM234H_LP] =
SL_MAX(vrefVal[dcdcTrimMode_EM234H_LP], vrefVal[dcdcTrimMode_EM01_LP]);
2166 vrefVal[dcdcTrimMode_EM234H_LP] =
SL_MIN(vrefVal[dcdcTrimMode_EM234H_LP], 0xE7U);
2186 uint32_t sliceCount = 0;
2193 if (em0LoadCurrent_mA < 20)
2197 else if ((em0LoadCurrent_mA >= 20) && (em0LoadCurrent_mA < 40))
2208 if (em0LoadCurrent_mA < 10)
2212 else if ((em0LoadCurrent_mA >= 10) && (em0LoadCurrent_mA < 20))
2223 if (em0LoadCurrent_mA < 40)
2250 currentLimitersUpdate();
2292 #if defined(_EMU_PWRCFG_MASK)
2294 EMU->PWRCFG = EMU_PWRCFG_PWRCFG_DCDCTODVDD;
2298 #if defined(EMU_PWRCTRL_IMMEDIATEPWRSWITCH)
2300 #elif defined(EMU_PWRCTRL_REGPWRSEL_DVDD)
2310 EFM_ASSERT(dcdcModeSet);
2317 #if defined( EMU_STATUS_VMONRDY )
2319 __STATIC_INLINE uint32_t vmonMilliVoltToCoarseThreshold(
int mV)
2321 return (mV - 1200) / 200;
2324 __STATIC_INLINE uint32_t vmonMilliVoltToFineThreshold(
int mV, uint32_t coarseThreshold)
2326 return (mV - 1200 - (coarseThreshold * 200)) / 20;
2344 uint32_t thresholdCoarse, thresholdFine;
2347 thresholdCoarse = vmonMilliVoltToCoarseThreshold(vmonInit->
threshold);
2348 thresholdFine = vmonMilliVoltToFineThreshold(vmonInit->
threshold, thresholdCoarse);
2352 case emuVmonChannel_AVDD:
2361 case emuVmonChannel_ALTAVDD:
2368 case emuVmonChannel_DVDD:
2375 case emuVmonChannel_IOVDD0:
2402 uint32_t riseThresholdCoarse, riseThresholdFine, fallThresholdCoarse, fallThresholdFine;
2409 riseThresholdCoarse = vmonMilliVoltToCoarseThreshold(vmonInit->
riseThreshold);
2410 riseThresholdFine = vmonMilliVoltToFineThreshold(vmonInit->
riseThreshold, riseThresholdCoarse);
2411 fallThresholdCoarse = vmonMilliVoltToCoarseThreshold(vmonInit->
fallThreshold);
2412 fallThresholdFine = vmonMilliVoltToFineThreshold(vmonInit->
fallThreshold, fallThresholdCoarse);
2416 case emuVmonChannel_AVDD:
2443 uint32_t
volatile * reg;
2448 case emuVmonChannel_AVDD:
2449 reg = &(
EMU->VMONAVDDCTRL);
2452 case emuVmonChannel_ALTAVDD:
2453 reg = &(
EMU->VMONALTAVDDCTRL);
2456 case emuVmonChannel_DVDD:
2457 reg = &(
EMU->VMONDVDDCTRL);
2460 case emuVmonChannel_IOVDD0:
2461 reg = &(
EMU->VMONIO0CTRL);
2487 case emuVmonChannel_AVDD:
2490 case emuVmonChannel_ALTAVDD:
2493 case emuVmonChannel_DVDD:
2496 case emuVmonChannel_IOVDD0:
2508 #if defined( _SILICON_LABS_GECKO_INTERNAL_SDID_80 )
2522 void EMU_SetBiasMode(EMU_BiasMode_TypeDef mode)
2524 #define EMU_TESTLOCK (*(volatile uint32_t *) (EMU_BASE + 0x190))
2525 #define EMU_BIASCONF (*(volatile uint32_t *) (EMU_BASE + 0x164))
2526 #define EMU_BIASTESTCTRL (*(volatile uint32_t *) (EMU_BASE + 0x19C))
2527 #define CMU_ULFRCOCTRL (*(volatile uint32_t *) (CMU_BASE + 0x03C))
2529 uint32_t freq = 0x2u;
2530 bool emuTestLocked =
false;
2532 if (mode == emuBiasMode_1KHz)
2537 if (EMU_TESTLOCK == 0x1u)
2539 emuTestLocked =
true;
2540 EMU_TESTLOCK = 0xADE8u;
2543 if (mode == emuBiasMode_Continuous)
2545 EMU_BIASCONF &= ~0x74u;
2549 EMU_BIASCONF |= 0x74u;
2552 EMU_BIASTESTCTRL |= 0x8u;
2553 CMU_ULFRCOCTRL = (CMU_ULFRCOCTRL & ~0xC00u)
2554 | ((freq & 0x3u) << 10u);
2555 EMU_BIASTESTCTRL &= ~0x8u;
#define _EMU_CTRL_EM4HVSCALE_MASK
EMU_PeripheralRetention_TypeDef
Clock management unit (CMU) API.
#define _EMU_DCDCZDETCTRL_ZDETILIMSEL_MASK
void CMU_ClockSelectSet(CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
Select reference clock/oscillator used for a clock branch.
#define EMU_VMONDVDDCTRL_FALLWU
#define _EMU_DCDCLNFREQCTRL_RCOBAND_SHIFT
EMU_DcdcAnaPeripheralPower_TypeDef anaPeripheralPower
#define CMU_STATUS_AUXHFRCOENS
#define EMU_IF_DCDCLNRUNNING
#define _EMU_EM4CTRL_RETAINULFRCO_MASK
#define _EMU_VMONAVDDCTRL_RISETHRESFINE_SHIFT
#define _DEVINFO_DCDCLPVCTRL3_3V0LPATT1LPCMPBIAS3_SHIFT
bool EMU_DCDCInit(const EMU_DCDCInit_TypeDef *dcdcInit)
Configure DCDC regulator.
EMU_EM4PinRetention_TypeDef pinRetentionMode
#define EMU_VMONIO0CTRL_FALLWU
__STATIC_INLINE void CMU_Lock(void)
Lock the CMU in order to protect some of its registers against unintended modification.
bool EMU_DCDCPowerOff(void)
Power off the DCDC regulator.
#define _EMU_DCDCLPEM01CFG_LPCMPBIASEM01_MASK
EMU_DcdcLnCompCtrl_TypeDef dcdcLnCompCtrl
#define _DEVINFO_DCDCLPVCTRL2_3V0LPATT1LPCMPBIAS0_MASK
#define EMU_DCDCLPVCTRL_LPATT
Emlib peripheral API "assert" implementation.
#define _DEVINFO_DCDCLPVCTRL1_1V2LPATT0LPCMPBIAS3_MASK
#define _EMU_STATUS_VMONALTAVDD_SHIFT
#define _EMU_STATUS_VSCALE_VSCALE0
#define CMU_LOCK_LOCKKEY_LOCKED
#define EMU_DCDCMISCCTRL_LPCMPHYSHI
void EMU_EnterEM4(void)
Enter energy mode 4 (EM4).
#define _DEVINFO_DCDCLPVCTRL0_1V2LPATT0LPCMPBIAS1_SHIFT
#define _EMU_DCDCLPEM01CFG_LPCMPHYSSELEM01_SHIFT
#define _DEVINFO_DCDCLPVCTRL3_1V8LPATT1LPCMPBIAS2_MASK
#define CMU_OSCENCMD_LFRCOEN
#define EMU_VMONAVDDCTRL_RISEWU
void SYSTEM_ChipRevisionGet(SYSTEM_ChipRevision_TypeDef *rev)
Get chip major/minor revision.
#define _DEVINFO_DCDCLPVCTRL1_1V8LPATT0LPCMPBIAS2_SHIFT
#define _DEVINFO_DCDCLNVCTRL0_1V8LNATT0_SHIFT
#define _DEVINFO_DCDCLPVCTRL0_1V8LPATT0LPCMPBIAS0_SHIFT
#define EMU_DCDCLPCTRL_LPVREFDUTYEN
#define _DEVINFO_DCDCLPVCTRL3_1V8LPATT1LPCMPBIAS3_SHIFT
void EMU_MemPwrDown(uint32_t blocks)
Power down memory block.
EMU_DcdcLnCompCtrl_TypeDef
static __INLINE void SystemCoreClockUpdate(void)
Update CMSIS SystemCoreClock variable.
#define EMU_DCDCSYNC_DCDCCTRLBUSY
#define _EMU_STATUS_VMONIO0_SHIFT
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS2_MASK
void EMU_PeripheralRetention(EMU_PeripheralRetention_TypeDef periMask, bool enable)
Set EM2 3 peripheral retention control.
#define CMU_STATUS_HFXOENS
#define EMU_VMONIO0CTRL_EN
#define EMU_DCDCCTRL_DCDCMODE_LOWNOISE
void EMU_EM4Init(const EMU_EM4Init_TypeDef *em4Init)
Update EMU module with Energy Mode 4 configuration.
#define _EMU_EM4CTRL_EM4STATE_SHIFT
#define _EMU_VMONALTAVDDCTRL_THRESCOARSE_SHIFT
#define _EMU_VMONAVDDCTRL_EN_SHIFT
void EMU_EnterEM3(bool restore)
Enter energy mode 3 (EM3).
void EMU_EnterEM2(bool restore)
Enter energy mode 2 (EM2).
#define _DEVINFO_DCDCLPVCTRL1_1V8LPATT0LPCMPBIAS3_SHIFT
#define EMU_DCDCMISCCTRL_LPCMPHYSDIS
#define _EMU_DCDCZDETCTRL_ZDETILIMSEL_SHIFT
#define EMU_VMONAVDDCTRL_EN
bool EMU_DCDCOutputVoltageSet(uint32_t mV, bool setLpVoltage, bool setLnVoltage)
Set DCDC output voltage.
uint32_t SystemHFClockGet(void)
Get the current HFCLK frequency.
#define EMU_PWRCTRL_REGPWRSEL_DVDD
#define _EMU_EM4CTRL_EM4IORETMODE_MASK
EMU_VScaleEM23_TypeDef vScaleEM23Voltage
#define _EMU_STATUS_VMONAVDD_SHIFT
#define _DEVINFO_DCDCLPCMPHYSSEL0_LPCMPHYSSELLPATT0_SHIFT
#define _DEVINFO_DCDCLPCMPHYSSEL0_LPCMPHYSSELLPATT0_MASK
#define _EMU_VMONDVDDCTRL_EN_SHIFT
#define _DEVINFO_DCDCLPVCTRL3_1V8LPATT1LPCMPBIAS2_SHIFT
#define _EMU_DCDCLNVCTRL_LNATT_MASK
#define _CMU_HFPRESC_PRESC_SHIFT
#define _DEVINFO_DCDCLPVCTRL2_3V0LPATT1LPCMPBIAS0_SHIFT
#define EMU_VMONIO0CTRL_RETDIS
void EMU_VmonEnable(EMU_VmonChannel_TypeDef channel, bool enable)
Enable or disable a VMON channel.
#define _DEVINFO_DCDCLPVCTRL1_1V2LPATT0LPCMPBIAS3_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.
#define EMU_EM4CTRL_EM4STATE_EM4S
#define CMU_STATUS_HFRCOENS
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS0_MASK
#define _EMU_STATUS_VSCALE_MASK
#define EMU_EM4CTRL_RETAINULFRCO
#define EMU_EM4CTRL_EM4STATE_EM4H
uint16_t em01LoadCurrent_mA
General purpose utilities.
#define EMU_VMONIO0CTRL_RISEWU
#define _ROMTABLE_PID0_REVMAJOR_MASK
__STATIC_INLINE void EMU_Unlock(void)
Unlock the EMU so that writing to locked registers again is possible.
#define _DEVINFO_DCDCLPVCTRL0_1V8LPATT0LPCMPBIAS0_MASK
#define CMU_STATUS_LFRCOENS
void EMU_VScaleEM01ByClock(uint32_t clockFrequency, bool wait)
Voltage scale in EM0 and 1 by clock frequency.
#define _ROMTABLE_PID3_REVMINORLSB_SHIFT
#define _EMU_VMONIO0CTRL_THRESFINE_SHIFT
#define _EMU_DCDCLPVCTRL_LPVREF_SHIFT
void EMU_Restore(void)
Restore CMU HF clock select state, oscillator enable and voltage scaling (if available) after EMU_Ent...
void EMU_DCDCOptimizeSlice(uint32_t mALoadCurrent)
Optimize DCDC slice count based on the estimated average load current in EM0.
#define CMU_STATUS_LFXOENS
#define _EMU_DCDCMISCCTRL_PFETCNT_MASK
#define _EMU_DCDCMISCCTRL_LPCLIMILIMSEL_SHIFT
uint16_t em234LoadCurrent_uA
#define _EMU_DCDCMISCCTRL_LNFORCECCM_SHIFT
#define _EMU_VMONAVDDCTRL_FALLTHRESCOARSE_SHIFT
void EMU_EnterEM4H(void)
Enter energy mode 4 hibernate (EM4H).
#define EMU_DCDCLNVCTRL_LNATT
#define CMU_OSCENCMD_LFXODIS
#define _EMU_DCDCCTRL_DCDCMODE_MASK
#define _ROMTABLE_PID2_REVMINORMSB_MASK
#define CMU_OSCENCMD_AUXHFRCOEN
#define _EMU_DCDCCLIMCTRL_BYPLIMEN_SHIFT
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS3_MASK
#define _DEVINFO_DCDCLPCMPHYSSEL0_LPCMPHYSSELLPATT1_MASK
#define EMU_DCDCCTRL_DCDCMODE_BYPASS
#define _EMU_CTRL_EM4HVSCALE_SHIFT
EMU_DcdcLnReverseCurrentControl_TypeDef reverseCurrentControl
void EMU_RamPowerDown(uint32_t start, uint32_t end)
Power down RAM memory blocks.
#define _DEVINFO_DCDCLPVCTRL2_1V8LPATT1LPCMPBIAS0_MASK
#define _EMU_VMONIO0CTRL_THRESCOARSE_SHIFT
#define _EMU_DCDCMISCCTRL_LNCLIMILIMSEL_MASK
#define EMU_VMONDVDDCTRL_RISEWU
#define _EMU_DCDCMISCCTRL_LNCLIMILIMSEL_SHIFT
#define _EMU_DCDCMISCCTRL_LNFORCECCM_MASK
bool vScaleEM01LowPowerVoltageEnable
#define _EMU_STATUS_VSCALE_SHIFT
#define _DEVINFO_DCDCLPVCTRL0_1V2LPATT0LPCMPBIAS1_MASK
#define CMU_OSCENCMD_HFRCODIS
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS1_SHIFT
#define _EMU_DCDCMISCCTRL_LPCLIMILIMSEL_MASK
void EMU_VScaleEM01(EMU_VScaleEM01_TypeDef voltage, bool wait)
Force voltage scaling in EM0 and 1 to a specific voltage level.
EMU_DcdcLnRcoBand_TypeDef
#define EMU_VMONDVDDCTRL_EN
#define _EMU_EM4CTRL_EM4ENTRY_MASK
void EMU_DCDCLnRcoBandSet(EMU_DcdcLnRcoBand_TypeDef band)
Set DCDC Low-noise RCO band.
void EMU_DCDCConductionModeSet(EMU_DcdcConductionMode_TypeDef conductionMode, bool rcoDefaultSet)
Set DCDC LN regulator conduction mode.
#define EMU_IFC_DCDCINBYPASS
#define EMU_VMONAVDDCTRL_FALLWU
#define _EMU_DCDCMISCCTRL_PFETCNT_SHIFT
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS1_MASK
#define CMU_OSCENCMD_HFRCOEN
EMU_VScaleEM4H_TypeDef vScaleEM4HVoltage
#define _EMU_EM4CTRL_RETAINLFRCO_MASK
void EMU_VmonHystInit(const EMU_VmonHystInit_TypeDef *vmonInit)
Initialize VMON channel with hysteresis (separate rise and fall triggers).
#define _DEVINFO_DCDCLNVCTRL0_3V0LNATT1_MASK
#define _DEVINFO_DCDCLNVCTRL0_1V8LNATT0_MASK
#define EMU_DCDCCTRL_DCDCMODE_OFF
#define _DEVINFO_DCDCLPCMPHYSSEL0_LPCMPHYSSELLPATT1_SHIFT
#define _EMU_DCDCMISCCTRL_NFETCNT_MASK
#define _DEVINFO_DCDCLPVCTRL2_1V8LPATT1LPCMPBIAS1_SHIFT
#define _EMU_CTRL_EM23VSCALE_MASK
#define CMU_OSCENCMD_LFXOEN
#define _ROMTABLE_PID3_REVMINORLSB_MASK
#define EMU_DCDCMISCCTRL_LNFORCECCM
#define _EMU_EM4CTRL_RETAINLFXO_MASK
void EMU_EM23Init(const EMU_EM23Init_TypeDef *em23Init)
Update EMU module with Energy Mode 2 and 3 configuration.
#define _EMU_EM4CTRL_EM4STATE_MASK
#define _EMU_VMONDVDDCTRL_THRESCOARSE_SHIFT
#define _EMU_DCDCMISCCTRL_NFETCNT_SHIFT
__STATIC_INLINE uint8_t SYSTEM_GetDevinfoRev(void)
Get DEVINFO revision.
#define _EMU_STATUS_VMONDVDD_SHIFT
#define _DEVINFO_DCDCLPVCTRL2_3V0LPATT1LPCMPBIAS1_MASK
void CMU_HFRCOBandSet(CMU_HFRCOFreq_TypeDef setFreq)
Set HFRCO calibration for the selected target frequency.
#define _CMU_HFPRESC_PRESC_MASK
#define _EMU_VMONAVDDCTRL_RISETHRESCOARSE_SHIFT
#define EMU_VMONALTAVDDCTRL_RISEWU
#define _EMU_DCDCLPVCTRL_LPATT_MASK
#define _ROMTABLE_PID2_REVMINORMSB_SHIFT
#define _DEVINFO_DCDCLPVCTRL3_3V0LPATT1LPCMPBIAS2_MASK
#define CMU_OSCENCMD_LFRCODIS
#define _DEVINFO_DCDCLPVCTRL0_1V8LPATT0LPCMPBIAS1_MASK
Energy management unit (EMU) peripheral API.
#define _DEVINFO_DCDCLPVCTRL1_1V2LPATT0LPCMPBIAS2_SHIFT
bool EMU_VmonChannelStatusGet(EMU_VmonChannel_TypeDef channel)
Get the status of a voltage monitor channel.
#define _EMU_CTRL_EM23VSCALE_SHIFT
void EMU_DCDCModeSet(EMU_DcdcMode_TypeDef dcdcMode)
Set DCDC regulator operating mode.
#define _DEVINFO_DCDCLPVCTRL0_1V2LPATT0LPCMPBIAS0_MASK
#define _ROMTABLE_PID0_REVMAJOR_SHIFT
#define EMU_DCDCLPEM01CFG_LPCMPBIASEM01_BIAS3
EMU_DcdcConductionMode_TypeDef
EMU_VmonChannel_TypeDef channel
EMU_DcdcMode_TypeDef dcdcMode
#define _EMU_DCDCLPVCTRL_LPVREF_MASK
#define _EMU_VMONIO0CTRL_EN_SHIFT
__STATIC_INLINE void EMU_IntClear(uint32_t flags)
Clear one or more pending EMU interrupts.
#define _DEVINFO_DCDCLPVCTRL1_1V8LPATT0LPCMPBIAS2_MASK
#define EMU_CMD_EM01VSCALE0
#define _DEVINFO_DCDCLPVCTRL3_1V8LPATT1LPCMPBIAS3_MASK
#define _DEVINFO_DCDCLNVCTRL0_1V2LNATT0_MASK
#define _DEVINFO_DCDCLPVCTRL3_3V0LPATT1LPCMPBIAS3_MASK
#define _DEVINFO_DCDCLPVCTRL2_1V8LPATT1LPCMPBIAS0_SHIFT
#define EMU_VMONALTAVDDCTRL_EN
#define SL_MIN(a, b)
Macro for getting minimum value. No sideeffects, a and b are evaluated once only. ...
#define SL_MAX(a, b)
Macro for getting maximum value. No sideeffects, a and b are evaluated once only. ...
#define _DEVINFO_DCDCLPVCTRL0_1V2LPATT0LPCMPBIAS0_SHIFT
__STATIC_INLINE void EMU_VScaleWait(void)
Wait for voltage scaling to complete.
#define EMU_EM4CTRL_RETAINLFXO
#define _DEVINFO_DCDCLNVCTRL0_3V0LNATT1_SHIFT
int16_t EMU_DcdcLnReverseCurrentControl_TypeDef
#define _DEVINFO_DCDCLNVCTRL0_1V8LNATT1_SHIFT
#define _DEVINFO_DCDCLPVCTRL1_1V8LPATT0LPCMPBIAS3_MASK
__STATIC_INLINE uint32_t EMU_IntGet(void)
Get pending EMU interrupt flags.
#define _EMU_DCDCLNVCTRL_LNVREF_SHIFT
#define EMU_IFC_DCDCLNRUNNING
EMU_VmonChannel_TypeDef channel
#define EMU_DCDCCTRL_DCDCMODE_LOWPOWER
__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.
#define _DEVINFO_DCDCLNVCTRL0_1V8LNATT1_MASK
#define _DEVINFO_DCDCLPVCTRL3_3V0LPATT1LPCMPBIAS2_SHIFT
#define EMU_VMONALTAVDDCTRL_FALLWU
#define _EMU_EM4CTRL_EM4ENTRY_SHIFT
#define CMU_OSCENCMD_HFXOEN
#define EMU_PWRCTRL_IMMEDIATEPWRSWITCH
EMU_EM4State_TypeDef em4State
#define _EMU_PWRCTRL_ANASW_SHIFT
#define _DEVINFO_DCDCLPVCTRL2_3V0LPATT1LPCMPBIAS1_SHIFT
void EMU_EM01Init(const EMU_EM01Init_TypeDef *em01Init)
Update EMU module with Energy Mode 0 and 1 configuration.
#define _EMU_VMONAVDDCTRL_FALLTHRESFINE_SHIFT
#define _EMU_VMONALTAVDDCTRL_EN_SHIFT
uint32_t CMU_ClockFreqGet(CMU_Clock_TypeDef clock)
Get clock frequency for a clock point.
#define EMU_EM4CTRL_RETAINLFRCO
void EMU_VmonInit(const EMU_VmonInit_TypeDef *vmonInit)
Initialize VMON channel.
#define EMU_IF_DCDCINBYPASS
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS0_SHIFT
void EMU_UpdateOscConfig(void)
Update EMU module with CMU oscillator selection/enable status.
#define _DEVINFO_DCDCLPVCTRL1_1V2LPATT0LPCMPBIAS2_MASK
#define _EMU_RAM0CTRL_MASK
__STATIC_INLINE void CMU_Unlock(void)
Unlock the CMU so that writing to locked registers again is possible.
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS2_SHIFT
#define _EMU_DCDCLPEM01CFG_LPCMPBIASEM01_SHIFT
#define _EMU_VMONDVDDCTRL_THRESFINE_SHIFT
#define _DEVINFO_DCDCLPCMPHYSSEL1_LPCMPHYSSELLPCMPBIAS3_SHIFT
#define _EMU_DCDCLNVCTRL_LNVREF_MASK
#define _DEVINFO_DCDCLPVCTRL0_1V8LPATT0LPCMPBIAS1_SHIFT
#define _EMU_VMONALTAVDDCTRL_THRESFINE_SHIFT
#define _EMU_DCDCLPEM01CFG_LPCMPHYSSELEM01_MASK
void EMU_EnterEM4S(void)
Enter energy mode 4 shutoff (EM4S).
CMU_ClkDiv_TypeDef CMU_ClockDivGet(CMU_Clock_TypeDef clock)
Get clock divisor/prescaler.
#define _DEVINFO_DCDCLNVCTRL0_1V2LNATT0_SHIFT
CMU_Select_TypeDef CMU_ClockSelectGet(CMU_Clock_TypeDef clock)
Get currently selected reference clock used for a clock branch.
#define _DEVINFO_DCDCLPVCTRL2_1V8LPATT1LPCMPBIAS1_MASK
#define _EMU_DCDCLNFREQCTRL_RCOBAND_MASK