CC13xx Driver Library
sys_ctrl.c
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: sys_ctrl.c
3 * Revised: 2016-08-09 12:38:32 +0200 (Tue, 09 Aug 2016)
4 * Revision: 46980
5 *
6 * Description: Driver for the System Control.
7 *
8 * Copyright (c) 2015 - 2016, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 // Hardware headers
40 #include <inc/hw_types.h>
41 #include <inc/hw_ccfg.h>
42 // Driverlib headers
43 #include <driverlib/aon_batmon.h>
44 #include <driverlib/sys_ctrl.h>
45 #include <driverlib/setup_rom.h>
46 
47 
48 //*****************************************************************************
49 //
50 // Handle support for DriverLib in ROM:
51 // This section will undo prototype renaming made in the header file
52 //
53 //*****************************************************************************
54 #if !defined(DOXYGEN)
55  #undef SysCtrlPowerEverything
56  #define SysCtrlPowerEverything NOROM_SysCtrlPowerEverything
57  #undef SysCtrlSetRechargeBeforePowerDown
58  #define SysCtrlSetRechargeBeforePowerDown NOROM_SysCtrlSetRechargeBeforePowerDown
59  #undef SysCtrlAdjustRechargeAfterPowerDown
60  #define SysCtrlAdjustRechargeAfterPowerDown NOROM_SysCtrlAdjustRechargeAfterPowerDown
61  #undef SysCtrl_DCDC_VoltageConditionalControl
62  #define SysCtrl_DCDC_VoltageConditionalControl NOROM_SysCtrl_DCDC_VoltageConditionalControl
63  #undef SysCtrlResetSourceGet
64  #define SysCtrlResetSourceGet NOROM_SysCtrlResetSourceGet
65 #endif
66 
67 //*****************************************************************************
68 //
69 // Recharge calculator defines and globals
70 //
71 //*****************************************************************************
72 
73 #define PD_STATE_CACHE_RET 1
74 #define PD_STATE_RFMEM_RET 2
75 #define PD_STATE_XOSC_LPM 4
76 #define PD_STATE_EXT_REG_MODE 8
77 
78 typedef struct {
79  uint32_t pdTime ;
80  uint16_t pdRechargePeriod ;
81  uint8_t pdState ;
82  int8_t pdTemp ;
84 
86 
87 
88 //*****************************************************************************
89 //
90 // Arrays that maps the "peripheral set" number (which is stored in the
91 // third nibble of the PRCM_PERIPH_* defines) to the PRCM register that
92 // contains the relevant bit for that peripheral.
93 //
94 //*****************************************************************************
95 
96 // Run mode registers
97 static const uint32_t g_pui32ModuleCG[] =
98 {
112 };
113 
114 
115 //*****************************************************************************
116 //
117 // Power up everything
118 //
119 //*****************************************************************************
120 void
122 {
123  uint32_t ui32Idx;
124  uint32_t ui32AuxClocks;
125 
126  //
127  // Force power on AUX
128  //
131  { }
132 
133  //
134  // Enable all the AUX domain clocks and wait for them to be ready
135  //
136  ui32AuxClocks = AUX_WUC_ADI_CLOCK | AUX_WUC_OSCCTRL_CLOCK |
142  AUXWUCClockEnable(ui32AuxClocks);
143  while(AUXWUCClockStatus(ui32AuxClocks) != AUX_WUC_CLOCK_READY)
144  { }
145 
146  //
147  // Request to switch to the crystal to enable radio operation.
148  // It takes a while for the XTAL to be ready so it is possible to
149  // perform other tasks while waiting.
152 
153  //
154  // Switch the HF source to XTAL - must be performed safely out of ROM to
155  // avoid flash issues when switching the clock.
156  //
157  // NB. If already running XTAL on HF clock source the ROM will wait forever
158  // on a flag that will never be set - need to check.
159  //
162  }
163 
164  //
165  // Turn on all the MCU power domains
166  // If the CPU is running and executing code the SYSBUS, VIMS and CPU are
167  // automatically on as well.
168  //
171  //
172  // Wait for power to be on
173  //
176 
177  PRCMLoadSet();
178  while(!PRCMLoadGet());
179 
180  //
181  // Ensure the domain clocks are running and wait for the clock settings to
182  // take effect
183  //
185  PRCMLoadSet();
186  while(!PRCMLoadGet())
187  { }
188 
189  //
190  // Enable all the RF Core clocks
191  //
192  // Do not read back to check, for two reasons:
193  // 1. CPE will update the PWMCLKENABLE register right after boot
194  // 2. The PWMCLKENABLE register always reads back what is written
195  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = 0x7FF;
196 
197  //
198  // Enable all peripheral clocks in System CPU run/sleep/deep-sleep mode.
199  //
200  for(ui32Idx = 0; ui32Idx < sizeof(g_pui32ModuleCG) / sizeof(uint32_t);
201  ui32Idx++)
202  {
206  }
207  PRCMLoadSet();
208  while(!PRCMLoadGet())
209  { }
210 }
211 
212 //*****************************************************************************
213 //
214 // SysCtrlSetRechargeBeforePowerDown( xoscPowerMode )
215 //
216 //*****************************************************************************
217 void
218 SysCtrlSetRechargeBeforePowerDown( uint32_t xoscPowerMode )
219 {
220  int32_t curTemp ;
221  int32_t shiftedTemp ;
222  int32_t deltaVddrSleepTrim ;
223  int32_t vddrTrimSleep ;
224  int32_t vddrTrimActve ;
225  int32_t diffVddrActiveSleep ;
226  uint32_t ccfg_ModeConfReg ;
227  uint32_t curState ;
228  uint32_t prcmRamRetention ;
229  uint32_t di ;
230  uint32_t dii ;
231  uint32_t ti ;
232  uint32_t cd ;
233  uint32_t cl ;
234  uint32_t load ;
235  uint32_t k ;
236  uint32_t vddrCap ;
237  uint32_t newRechargePeriod ;
238  uint32_t perE ;
239  uint32_t perM ;
240  const uint32_t * pLookupTable ;
241 
242  //
243  // If external regulator mode we shall:
244  // - Disable adaptive recharge (bit[31]=0) in AON_WUC_O_RECHARGECFG
245  // - Set recharge period to approximately 500 mS (perM=31, perE=5 => 0xFD)
246  // - Make sure you get a recalculation if leaving external regulator mode by setting powerQualGlobals.pdState accordingly
247  //
249  powerQualGlobals.pdState = PD_STATE_EXT_REG_MODE;
250  HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGECFG ) = 0x00A4FDFD;
251  return;
252  }
253 
254  //--- Spec. point 1 ---
255  curTemp = AONBatMonTemperatureGetDegC();
256  curState = 0;
257 
258  // read the MODE_CONF register in CCFG
259  ccfg_ModeConfReg = HWREG( CCFG_BASE + CCFG_O_MODE_CONF );
260  // Get VDDR_TRIM_SLEEP_DELTA + 1 (sign extended)
261  deltaVddrSleepTrim = ((((int32_t) ccfg_ModeConfReg )
262  << ( 32 - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_W - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_S ))
263  >> ( 32 - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_W )) + 1;
264  // Do temperature compensation if enabled
265  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_TRIM_SLEEP_TC ) == 0 ) {
266  int32_t tcDelta = ( 62 - curTemp ) >> 3;
267  if ( tcDelta > 8 ) tcDelta = 8;
268  if ( tcDelta > deltaVddrSleepTrim ) deltaVddrSleepTrim = tcDelta;
269  }
270  if ((( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_EXT_LOAD ) == 0 ) &&
271  (( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDS_BOD_LEVEL ) != 0 ) )
272  {
273  vddrTrimSleep = SetupSignExtendVddrTrimValue((
274  HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
277  vddrTrimActve = SetupSignExtendVddrTrimValue((
278  HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
281  } else
282  {
283  vddrTrimSleep = SetupSignExtendVddrTrimValue((
284  HWREG( FCFG1_BASE + FCFG1_O_LDO_TRIM ) &
287  vddrTrimActve = SetupSignExtendVddrTrimValue((
288  HWREG( FCFG1_BASE + FCFG1_O_SHDW_ANA_TRIM ) &
291  }
292  vddrTrimSleep += deltaVddrSleepTrim;
293  if ( vddrTrimSleep > 21 ) vddrTrimSleep = 21;
294  if ( vddrTrimSleep < -10 ) vddrTrimSleep = -10;
295  // Write adjusted value using MASKED write (MASK8)
296  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_DCDCCTL1 * 2 )) = (( ADI_3_REFSYS_DCDCCTL1_VDDR_TRIM_SLEEP_M << 8 ) |
298 
299  prcmRamRetention = HWREG( PRCM_BASE + PRCM_O_RAMRETEN );
300  if ( prcmRamRetention & PRCM_RAMRETEN_VIMS_M ) {
301  curState |= PD_STATE_CACHE_RET;
302  }
303  if ( prcmRamRetention & PRCM_RAMRETEN_RFC ) {
304  curState |= PD_STATE_RFMEM_RET;
305  }
306  if ( xoscPowerMode != XOSC_IN_HIGH_POWER_MODE ) {
307  curState |= PD_STATE_XOSC_LPM;
308  }
309 
310  //--- Spec. point 2 ---
311  if ((( curTemp - powerQualGlobals.pdTemp ) >= 5 ) || ( curState != powerQualGlobals.pdState )) {
312  //--- Spec. point 3 ---
313  shiftedTemp = curTemp - 15;
314 
315  //--- Spec point 4 ---
316  //4. Check for external VDDR load option (may not be supported): ext_load = (VDDR_EXT_LOAD=0 in CCFG)
317  // Currently not implementing external load handling
318  // if ( __ccfg.ulModeConfig & MODE_CONF_VDDR_EXT_LOAD ) {
319  // }
320 
321  pLookupTable = (uint32_t *)( FCFG1_BASE + FCFG1_O_PWD_CURR_20C );
322 
323  //--- Spec point 5 ---
324  di = 0;
325  ti = 0;
326  if ( shiftedTemp >= 0 ) {
327  //--- Spec point 5.a ---
328  shiftedTemp += ( shiftedTemp << 4 );
329 
330  //--- Spec point 5.b ---
331  ti = ( shiftedTemp >> 8 );
332  if ( ti > 7 ) {
333  ti = 7;
334  }
335  dii = ti;
336  if ( dii > 6 ) {
337  dii = 6;
338  }
339 
340  //--- Spec point 5.c ---
341  cd = pLookupTable[ dii + 1 ] - pLookupTable[ dii ];
342 
343  //--- Spec point 5.d ---
344  di = cd & 0xFF;
345 
346  //--- Spec point 5.e ---
347  if ( curState & PD_STATE_XOSC_LPM ) {
348  di += (( cd >> 8 ) & 0xFF );
349  }
350  if ( curState & PD_STATE_RFMEM_RET ) {
351  di += (( cd >> 16 ) & 0xFF );
352  }
353  if ( curState & PD_STATE_CACHE_RET ) {
354  di += (( cd >> 24 ) & 0xFF );
355  }
356 
357  //--- Spec point 5.f ---
358  // Currently not implementing external load handling
359  }
360 
361  //--- Spec. point 6 ---
362  cl = pLookupTable[ ti ];
363 
364  //--- Spec. point 7 ---
365  load = cl & 0xFF;
366 
367  //--- Spec. point 8 ---
368  if ( curState & PD_STATE_XOSC_LPM ) {
369  load += (( cl >> 8 ) & 0xFF );
370  }
371  if ( curState & PD_STATE_RFMEM_RET ) {
372  load += (( cl >> 16 ) & 0xFF );
373  }
374  if ( curState & PD_STATE_CACHE_RET ) {
375  load += (( cl >> 24 ) & 0xFF );
376  }
377 
378  //--- Spec. point 9 ---
379  load += ((( di * ( shiftedTemp - ( ti << 8 ))) + 128 ) >> 8 );
380 
381  // Currently not implementing external load handling
382  // if ( __ccfg.ulModeConfig & MODE_CONF_VDDR_EXT_LOAD ) {
383  //--- Spec. point 10 ---
384  // } else {
385  //--- Spec. point 11 ---
386  diffVddrActiveSleep = ( vddrTrimActve - vddrTrimSleep );
387  if ( diffVddrActiveSleep < 1 ) diffVddrActiveSleep = 1;
388  k = ( diffVddrActiveSleep * 52 );
389  // }
390 
391  //--- Spec. point 12 ---
392 
393  vddrCap = ( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_CAP_M ) >> CCFG_MODE_CONF_VDDR_CAP_S;
394  newRechargePeriod = ( vddrCap * k ) / load;
395  if ( newRechargePeriod > 0xFFFF ) {
396  newRechargePeriod = 0xFFFF;
397  }
398  powerQualGlobals.pdRechargePeriod = newRechargePeriod;
399 
400  //--- Spec. point 13 ---
401  if ( curTemp > 127 ) curTemp = 127;
402  if ( curTemp < -128 ) curTemp = -128;
403  powerQualGlobals.pdTemp = curTemp;
404  powerQualGlobals.pdState = curState;
405  }
406 
407  powerQualGlobals.pdTime = HWREG( AON_RTC_BASE + AON_RTC_O_SEC );
408 
409  // Calculate PER_E and PER_M (based on powerQualGlobals.pdRechargePeriod)
410  // Round downwards but make sure PER_E=0 and PER_M=1 is the minimum possible setting.
411  // (assuming that powerQualGlobals.pdRechargePeriod always are <= 0xFFFF)
412  perE = 0;
413  perM = powerQualGlobals.pdRechargePeriod;
414  if ( perM < 31 ) {
415  perM = 31;
416  powerQualGlobals.pdRechargePeriod = 31;
417  }
418  while ( perM > 511 ) {
419  perM >>= 1;
420  perE += 1;
421  }
422  perM = ( perM - 15 ) >> 4;
423 
425  ( 0x80A4E700 ) |
426  ( perM << AON_WUC_RECHARGECFG_PER_M_S ) |
427  ( perE << AON_WUC_RECHARGECFG_PER_E_S ) ;
428  HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGESTAT ) = 0;
429 }
430 
431 
432 //*****************************************************************************
433 //
434 // SysCtrlAdjustRechargeAfterPowerDown()
435 //
436 //*****************************************************************************
437 void
439 {
440  int32_t curTemp ;
441  uint32_t longestRechargePeriod ;
442  uint32_t deltaTime ;
443  uint32_t newRechargePeriod ;
444 
445  //--- Spec. point 2 ---
446  longestRechargePeriod = ( HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGESTAT ) &
449 
450  if ( longestRechargePeriod != 0 ) {
451  //--- Spec. changed (originaly point 1) ---
452  curTemp = AONBatMonTemperatureGetDegC();
453  if ( curTemp < powerQualGlobals.pdTemp ) {
454  if ( curTemp < -128 ) {
455  curTemp = -128;
456  }
457  powerQualGlobals.pdTemp = curTemp;
458  }
459 
460  //--- Spec. point 4 ---
461  if ( longestRechargePeriod < powerQualGlobals.pdRechargePeriod ) {
462  powerQualGlobals.pdRechargePeriod = longestRechargePeriod;
463  } else {
464  //--- Spec. point 5 ---
465  deltaTime = HWREG( AON_RTC_BASE + AON_RTC_O_SEC ) - powerQualGlobals.pdTime + 2;
466  if ( deltaTime > 31 ) {
467  deltaTime = 31;
468  }
469  newRechargePeriod = powerQualGlobals.pdRechargePeriod + (( longestRechargePeriod - powerQualGlobals.pdRechargePeriod ) >> (deltaTime>>1));
470  if ( newRechargePeriod > 0xFFFF ) {
471  newRechargePeriod = 0xFFFF;
472  }
473  powerQualGlobals.pdRechargePeriod = newRechargePeriod;
474  }
475  }
476 }
477 
478 
479 //*****************************************************************************
480 //
481 // SysCtrl_DCDC_VoltageConditionalControl()
482 //
483 //*****************************************************************************
484 void
486 {
487  uint32_t batThreshold ; // Fractional format with 8 fractional bits.
488  uint32_t aonBatmonBat ; // Fractional format with 8 fractional bits.
489  uint32_t ccfg_ModeConfReg ; // Holds a copy of the CCFG_O_MODE_CONF register.
490  uint32_t aonSysctlPwrctl ; // Reflect whats read/written to the AON_SYSCTL_O_PWRCTL register.
491 
492  //
493  // We could potentially call this function before any battery voltage measurement
494  // is made/available. In that case we must make sure that we do not turn off the DCDC.
495  // This can be done by doing nothing as long as the battery voltage is 0 (Since the
496  // reset value of the battery voltage register is 0).
497  //
498  aonBatmonBat = HWREG( AON_BATMON_BASE + AON_BATMON_O_BAT );
499  if ( aonBatmonBat != 0 ) {
500  //
501  // Check if Voltage Conditional Control is enabled
502  // It is enabled if all the following are true:
503  // - DCDC in use (either in active or recharge mode), (in use if one of the corresponding CCFG bits are zero).
504  // - Alternative DCDC settings are enabled ( DIS_ALT_DCDC_SETTING == 0 )
505  // - Not in external regulator mode ( EXT_REG_MODE == 0 )
506  //
507  ccfg_ModeConfReg = HWREG( CCFG_BASE + CCFG_O_MODE_CONF );
508 
509  if (((( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_RECHARGE_M ) == 0 ) ||
510  (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_ACTIVE_M ) == 0 ) ) &&
513  {
514  aonSysctlPwrctl = HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL );
515  batThreshold = (((( HWREG( CCFG_BASE + CCFG_O_MODE_CONF_1 ) &
517  CCFG_MODE_CONF_1_ALT_DCDC_VMIN_S ) + 28 ) << 4 );
518 
519  if ( aonSysctlPwrctl & ( AON_SYSCTL_PWRCTL_DCDC_EN_M | AON_SYSCTL_PWRCTL_DCDC_ACTIVE_M )) {
520  //
521  // DCDC is ON, check if it should be switched off
522  //
523  if ( aonBatmonBat < batThreshold ) {
525 
526  HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL ) = aonSysctlPwrctl;
527  }
528  } else {
529  //
530  // DCDC is OFF, check if it should be switched on
531  //
532  if ( aonBatmonBat > batThreshold ) {
533  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_RECHARGE_M ) == 0 ) aonSysctlPwrctl |= AON_SYSCTL_PWRCTL_DCDC_EN_M ;
534  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_ACTIVE_M ) == 0 ) aonSysctlPwrctl |= AON_SYSCTL_PWRCTL_DCDC_ACTIVE_M ;
535 
536  HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL ) = aonSysctlPwrctl;
537  }
538  }
539  }
540  }
541 }
542 
543 
544 //*****************************************************************************
545 //
546 // SysCtrlResetSourceGet()
547 //
548 //*****************************************************************************
549 uint32_t
551 {
553  return ( RSTSRC_WAKEUP_FROM_SHUTDOWN );
554  } else {
555  return (( HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_RESETCTL ) &
558  }
559 }
#define AUX_WUC_TDC_CLOCK
Definition: aux_wuc.h:113
#define PRCM_PERIPH_TIMER1
Definition: prcm.h:181
static void AONWUCAuxWakeupEvent(uint32_t ui32Mode)
Control the wake up procedure of the AUX domain.
Definition: aon_wuc.h:476
#define XOSC_IN_HIGH_POWER_MODE
Definition: sys_ctrl.h:135
static uint32_t AONWUCPowerStatusGet(void)
Get the power status of the device.
Definition: aon_wuc.h:556
static void OSCHfSourceSwitch(void)
Switch the high frequency clock.
Definition: osc.h:320
void AUXWUCClockEnable(uint32_t ui32Clocks)
Enable clocks for peripherals in the AUX domain.
Definition: aux_wuc.c:64
#define OSC_SRC_CLK_MF
Definition: osc.h:113
static const uint32_t g_pui32ModuleCG[]
Definition: sys_ctrl.c:97
#define AUX_WUC_OSCCTRL_CLOCK
Definition: aux_wuc.h:109
void SysCtrl_DCDC_VoltageConditionalControl(void)
Turns DCDC on or off depending of what is considered to be optimal usage.
Definition: sys_ctrl.c:485
uint32_t AUXWUCClockStatus(uint32_t ui32Clocks)
Get the status of a clock.
Definition: aux_wuc.c:162
#define PRCM_PERIPH_TRNG
Definition: prcm.h:191
#define PRCM_PERIPH_I2S
Definition: prcm.h:194
int32_t AONBatMonTemperatureGetDegC(void)
Get the current temperature measurement as a signed value in Deg Celsius.
Definition: aon_batmon.c:60
uint32_t OSCClockSourceGet(uint32_t ui32SrcClk)
Get the source clock settings.
Definition: osc.c:160
uint8_t pdState
Definition: sys_ctrl.c:81
#define PRCM_PERIPH_TIMER0
Definition: prcm.h:180
uint32_t PRCMPowerDomainStatus(uint32_t ui32Domains)
Get the status for a specific power domain.
Definition: prcm.c:601
#define AUX_WUC_CLOCK_READY
Definition: aux_wuc.h:119
uint32_t SysCtrlResetSourceGet(void)
Returns last reset source (including "wakeup from shutdown").
Definition: sys_ctrl.c:550
#define PRCM_DOMAIN_VIMS
Definition: prcm.h:142
#define AUX_WUC_AIODIO0_CLOCK
Definition: aux_wuc.h:104
#define PD_STATE_XOSC_LPM
Definition: sys_ctrl.c:75
#define AUX_WUC_ADI_CLOCK
Definition: aux_wuc.h:110
#define PD_STATE_CACHE_RET
Definition: sys_ctrl.c:73
#define PRCM_PERIPH_TIMER2
Definition: prcm.h:182
#define AONWUC_AUX_POWER_ON
Definition: aon_wuc.h:172
#define OSC_SRC_CLK_HF
Definition: osc.h:112
void PRCMPeripheralSleepEnable(uint32_t ui32Peripheral)
Enables a peripheral in sleep mode.
Definition: prcm.c:521
#define AUX_WUC_AIODIO1_CLOCK
Definition: aux_wuc.h:105
#define PRCM_DOMAIN_PERIPH
Definition: prcm.h:138
#define PD_STATE_EXT_REG_MODE
Definition: sys_ctrl.c:76
static bool PRCMLoadGet(void)
Check if any of the load sensitive register has been updated.
Definition: prcm.h:574
#define OSC_XOSC_HF
Definition: osc.h:117
#define PRCM_PERIPH_SSI0
Definition: prcm.h:184
#define AONWUC_AUX_WAKEUP
Definition: aon_wuc.h:152
#define OSC_SRC_CLK_LF
Definition: osc.h:114
#define PRCM_PERIPH_TIMER3
Definition: prcm.h:183
#define PRCM_PERIPH_SSI1
Definition: prcm.h:185
void SysCtrlAdjustRechargeAfterPowerDown(void)
Adjust Recharge calculations to be used next.
Definition: sys_ctrl.c:438
static PowerQualGlobals_t powerQualGlobals
Definition: sys_ctrl.c:85
#define AUX_WUC_SMPH_CLOCK
Definition: aux_wuc.h:103
#define PD_STATE_RFMEM_RET
Definition: sys_ctrl.c:74
#define PRCM_PERIPH_CRYPTO
Definition: prcm.h:190
#define AUX_WUC_REF_CLOCK
Definition: aux_wuc.h:115
#define PRCM_PERIPH_GPIO
Definition: prcm.h:193
#define PRCM_PERIPH_UART0
Definition: prcm.h:186
#define PRCM_PERIPH_UDMA
Definition: prcm.h:192
void SysCtrlSetRechargeBeforePowerDown(uint32_t xoscPowerMode)
Set Recharge values before entering Power Down.
Definition: sys_ctrl.c:218
#define AUX_WUC_TDCIF_CLOCK
Definition: aux_wuc.h:108
static void PRCMDomainEnable(uint32_t ui32Domains)
Enable clock domains in the MCU voltage domain.
Definition: prcm.h:604
#define PRCM_DOMAIN_POWER_ON
Definition: prcm.h:153
void PRCMPowerDomainOn(uint32_t ui32Domains)
Turn power on in power domains in the MCU domain.
Definition: prcm.c:395
#define AUX_WUC_ANAIF_CLOCK
Definition: aux_wuc.h:107
#define PRCM_DOMAIN_SERIAL
Definition: prcm.h:136
#define PRCM_DOMAIN_RFCORE
Definition: prcm.h:134
static void PRCMLoadSet(void)
Use this function to synchronize the load settings.
Definition: prcm.h:554
void PRCMPeripheralRunEnable(uint32_t ui32Peripheral)
Enables a peripheral in Run mode.
Definition: prcm.c:481
void PRCMPeripheralDeepSleepEnable(uint32_t ui32Peripheral)
Enables a peripheral in deep-sleep mode.
Definition: prcm.c:561
uint32_t pdTime
Definition: sys_ctrl.c:79
#define AUX_WUC_ADC_CLOCK
Definition: aux_wuc.h:114
void OSCClockSourceSet(uint32_t ui32SrcClk, uint32_t ui32Osc)
Configure the oscillator input to the a source clock.
Definition: osc.c:101
#define RSTSRC_WAKEUP_FROM_SHUTDOWN
Definition: sys_ctrl.h:312
uint16_t pdRechargePeriod
Definition: sys_ctrl.c:80
#define OSC_XOSC_LF
Definition: osc.h:119
#define PRCM_PERIPH_I2C0
Definition: prcm.h:188
#define AUX_WUC_TIMER_CLOCK
Definition: aux_wuc.h:106
void SysCtrlPowerEverything(void)
Power up everything.
Definition: sys_ctrl.c:121
static int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup_rom.h:233