CC26xx Driver Library
sys_ctrl.c
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: sys_ctrl.c
3 * Revised: 2015-09-25 11:16:31 +0200 (Fri, 25 Sep 2015)
4 * Revision: 44664
5 *
6 * Description: Driver for the System Control.
7 *
8 * Copyright (c) 2015, 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 
46 // Prototype from setup.c
47 int32_t SignExtendVddrTrimValue( uint32_t ui32VddrTrimVal );
48 
49 //*****************************************************************************
50 //
51 // Handle support for DriverLib in ROM:
52 // This section will undo prototype renaming made in the header file
53 //
54 //*****************************************************************************
55 #if !defined(DOXYGEN)
56  #undef SysCtrlPowerEverything
57  #define SysCtrlPowerEverything NOROM_SysCtrlPowerEverything
58  #undef SysCtrlStandby
59  #define SysCtrlStandby NOROM_SysCtrlStandby
60  #undef SysCtrlPowerdown
61  #define SysCtrlPowerdown NOROM_SysCtrlPowerdown
62  #undef SysCtrlShutdown
63  #define SysCtrlShutdown NOROM_SysCtrlShutdown
64  #undef SysCtrlResetSourceGet
65  #define SysCtrlResetSourceGet NOROM_SysCtrlResetSourceGet
66 #endif
67 
68 //*****************************************************************************
69 //
70 // Recharge calculator defines and globals
71 //
72 //*****************************************************************************
73 
74 #define PD_STATE_CACHE_RET 1
75 #define PD_STATE_RFMEM_RET 2
76 #define PD_STATE_XOSC_LPM 4
77 #define PD_STATE_EXT_REG_MODE 8
78 
79 typedef struct {
80  uint32_t pdTime ;
81  uint16_t pdRechargePeriod ;
82  uint8_t pdState ;
83  int8_t pdTemp ;
85 
87 
88 
89 //*****************************************************************************
90 //
91 // Arrays that maps the "peripheral set" number (which is stored in the
92 // third nibble of the PRCM_PERIPH_* defines) to the PRCM register that
93 // contains the relevant bit for that peripheral.
94 //
95 //*****************************************************************************
96 
97 // Run mode registers
98 static const uint32_t g_pui32ModuleCG[] =
99 {
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 //
215 //
216 //*****************************************************************************
217 void SysCtrlStandby(void)
218 {
219  //
220  // Enable the oscillator configuration interface
221  //
223 
224  //
225  // Ensure the low frequency clock source is sourced from a low frequency
226  // oscillator. The XTAL will provide the most accurate real time clock.
227  //
229 
230  //
231  // Enable the oscillator configuration interface
232  //
234 
235  //
236  // Execute the transition to standby
237  //
239 }
240 
241 //*****************************************************************************
242 //
244 //
245 //*****************************************************************************
246 void
248 {
249  //
250  // Make sure the oscillator interface is enabled
251  //
253 
254  //
255  // Source the LF clock from the low frequency XTAL_OSC.
256  // HF and MF are sourced from the high frequency RC_OSC.
257  //
260 
261  //
262  // Check if already sourcing the HF clock from RC_OSC.
263  // If a switch of the clock source is not required, then the call to ROM
264  // will loop forever.
265  //
267  {
269  }
270 
271  //
272  // Disable the oscillator interface
273  //
275 
276  //
277  // Execute the transition to power down.
278  //
280 }
281 
282 //*****************************************************************************
283 //
285 //
286 //*****************************************************************************
287 void
289 {
290  //
291  // Make sure the oscillator interface is enabled
292  //
294 
295  //
296  // Source the LF clock from the low frequency RC_OSC.
297  // HF and MF are sourced from the high frequency RC_OSC.
298  //
301 
302  //
303  // Check if already sourcing the HF clock from RC_OSC.
304  // If a switch of the clock source is not required, then the call to ROM
305  // will loop forever.
306  //
308  {
310  }
311 
312  //
313  // Disable the oscillator interface
314  //
316 
317  //
318  // Execute transition to shutdown.
319  //
321 }
322 
323 
324 //*****************************************************************************
325 // Need to know the CCFG:MODE_CONF.VDDR_TRIM_SLEEP_DELTA fild width in order
326 // to sign extend correctly but this is however not defined in the hardware
327 // description fields and are therefore defined separately here.
328 //*****************************************************************************
329 #define CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_WIDTH 4
330 
331 //*****************************************************************************
332 //
333 // SysCtrlSetRechargeBeforePowerDown( xoscPowerMode )
334 //
335 //*****************************************************************************
336 void
337 SysCtrlSetRechargeBeforePowerDown( uint32_t xoscPowerMode )
338 {
339  int32_t curTemp ;
340  int32_t shiftedTemp ;
341  int32_t deltaVddrSleepTrim ;
342  int32_t vddrTrimSleep ;
343  int32_t vddrTrimActve ;
344  int32_t diffVddrActiveSleep ;
345  uint32_t ccfg_ModeConfReg ;
346  uint32_t curState ;
347  uint32_t prcmRamRetention ;
348  uint32_t di ;
349  uint32_t dii ;
350  uint32_t ti ;
351  uint32_t cd ;
352  uint32_t cl ;
353  uint32_t load ;
354  uint32_t k ;
355  uint32_t vddrCap ;
356  uint32_t newRechargePeriod ;
357  uint32_t perE ;
358  uint32_t perM ;
359  const uint32_t * pLookupTable ;
360 
361  //
362  // If external regulator mode we shall:
363  // - Disable adaptive recharge (bit[31]=0) in AON_WUC_O_RECHARGECFG
364  // - Set recharge period to approximately 500 mS (perM=31, perE=5 => 0xFD)
365  // - Make sure you get a recalculation if leaving external regulator mode by setting powerQualGlobals.pdState accordingly
366  //
368  powerQualGlobals.pdState = PD_STATE_EXT_REG_MODE;
369  HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGECFG ) = 0x00A4FDFD;
370  return;
371  }
372 
373  //--- Spec. point 1 ---
374  curTemp = AONBatMonTemperatureGetDegC();
375  curState = 0;
376 
377  // read the MODE_CONF register in CCFG
378  ccfg_ModeConfReg = HWREG( CCFG_BASE + CCFG_O_MODE_CONF );
379  // Get VDDR_TRIM_SLEEP_DELTA + 1 (sign extended)
380  deltaVddrSleepTrim = ((((int32_t) ccfg_ModeConfReg )
383  // Do temperature compensation if enabled
384  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_TRIM_SLEEP_TC ) == 0 ) {
385  int32_t tcDelta = ( 62 - curTemp ) >> 3;
386  if ( tcDelta > 8 ) tcDelta = 8;
387  if ( tcDelta > deltaVddrSleepTrim ) deltaVddrSleepTrim = tcDelta;
388  }
389  {
390  vddrTrimSleep = SignExtendVddrTrimValue((
391  HWREG( FCFG1_BASE + FCFG1_O_LDO_TRIM ) &
394  vddrTrimActve = SignExtendVddrTrimValue((
395  HWREG( FCFG1_BASE + FCFG1_O_SHDW_ANA_TRIM ) &
398  }
399  vddrTrimSleep += deltaVddrSleepTrim;
400  if ( vddrTrimSleep > 21 ) vddrTrimSleep = 21;
401  if ( vddrTrimSleep < -10 ) vddrTrimSleep = -10;
402  // Write adjusted value using MASKED write (MASK8)
403  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_DCDCCTL1 * 2 )) = (( ADI_3_REFSYS_DCDCCTL1_VDDR_TRIM_SLEEP_M << 8 ) |
405 
406  prcmRamRetention = HWREG( PRCM_BASE + PRCM_O_RAMRETEN );
407  if ( prcmRamRetention & PRCM_RAMRETEN_VIMS_M ) {
408  curState |= PD_STATE_CACHE_RET;
409  }
410  if ( prcmRamRetention & PRCM_RAMRETEN_RFC ) {
411  curState |= PD_STATE_RFMEM_RET;
412  }
413  if ( xoscPowerMode != XOSC_IN_HIGH_POWER_MODE ) {
414  curState |= PD_STATE_XOSC_LPM;
415  }
416 
417  //--- Spec. point 2 ---
418  if ((( curTemp - powerQualGlobals.pdTemp ) >= 5 ) || ( curState != powerQualGlobals.pdState )) {
419  //--- Spec. point 3 ---
420  shiftedTemp = curTemp - 15;
421 
422  //--- Spec point 4 ---
423  //4. Check for external VDDR load option (may not be supported): ext_load = (VDDR_EXT_LOAD=0 in CCFG)
424  // Currently not implementing external load handling
425  // if ( __ccfg.ulModeConfig & MODE_CONF_VDDR_EXT_LOAD ) {
426  // }
427 
428  pLookupTable = (uint32_t *)( FCFG1_BASE + FCFG1_O_PWD_CURR_20C );
429 
430  //--- Spec point 5 ---
431  di = 0;
432  ti = 0;
433  if ( shiftedTemp >= 0 ) {
434  //--- Spec point 5.a ---
435  shiftedTemp += ( shiftedTemp << 4 );
436 
437  //--- Spec point 5.b ---
438  ti = ( shiftedTemp >> 8 );
439  if ( ti > 7 ) {
440  ti = 7;
441  }
442  dii = ti;
443  if ( dii > 6 ) {
444  dii = 6;
445  }
446 
447  //--- Spec point 5.c ---
448  cd = pLookupTable[ dii + 1 ] - pLookupTable[ dii ];
449 
450  //--- Spec point 5.d ---
451  di = cd & 0xFF;
452 
453  //--- Spec point 5.e ---
454  if ( curState & PD_STATE_XOSC_LPM ) {
455  di += (( cd >> 8 ) & 0xFF );
456  }
457  if ( curState & PD_STATE_RFMEM_RET ) {
458  di += (( cd >> 16 ) & 0xFF );
459  }
460  if ( curState & PD_STATE_CACHE_RET ) {
461  di += (( cd >> 24 ) & 0xFF );
462  }
463 
464  //--- Spec point 5.f ---
465  // Currently not implementing external load handling
466  }
467 
468  //--- Spec. point 6 ---
469  cl = pLookupTable[ ti ];
470 
471  //--- Spec. point 7 ---
472  load = cl & 0xFF;
473 
474  //--- Spec. point 8 ---
475  if ( curState & PD_STATE_XOSC_LPM ) {
476  load += (( cl >> 8 ) & 0xFF );
477  }
478  if ( curState & PD_STATE_RFMEM_RET ) {
479  load += (( cl >> 16 ) & 0xFF );
480  }
481  if ( curState & PD_STATE_CACHE_RET ) {
482  load += (( cl >> 24 ) & 0xFF );
483  }
484 
485  //--- Spec. point 9 ---
486  load += ((( di * ( shiftedTemp - ( ti << 8 ))) + 128 ) >> 8 );
487 
488  // Currently not implementing external load handling
489  // if ( __ccfg.ulModeConfig & MODE_CONF_VDDR_EXT_LOAD ) {
490  //--- Spec. point 10 ---
491  // } else {
492  //--- Spec. point 11 ---
493  diffVddrActiveSleep = ( vddrTrimActve - vddrTrimSleep );
494  if ( diffVddrActiveSleep < 1 ) diffVddrActiveSleep = 1;
495  k = ( diffVddrActiveSleep * 52 );
496  // }
497 
498  //--- Spec. point 12 ---
499 
500  vddrCap = ( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_CAP_M ) >> CCFG_MODE_CONF_VDDR_CAP_S;
501  newRechargePeriod = ( vddrCap * k ) / load;
502  if ( newRechargePeriod > 0xFFFF ) {
503  newRechargePeriod = 0xFFFF;
504  }
505  powerQualGlobals.pdRechargePeriod = newRechargePeriod;
506 
507  //--- Spec. point 13 ---
508  if ( curTemp > 127 ) curTemp = 127;
509  if ( curTemp < -128 ) curTemp = -128;
510  powerQualGlobals.pdTemp = curTemp;
511  powerQualGlobals.pdState = curState;
512  }
513 
514  powerQualGlobals.pdTime = HWREG( AON_RTC_BASE + AON_RTC_O_SEC );
515 
516  // Calculate PER_E and PER_M (based on powerQualGlobals.pdRechargePeriod)
517  // Round downwards but make sure PER_E=0 and PER_M=1 is the minimum possible setting.
518  // (assuming that powerQualGlobals.pdRechargePeriod always are <= 0xFFFF)
519  perE = 0;
520  perM = powerQualGlobals.pdRechargePeriod;
521  if ( perM < 31 ) {
522  perM = 31;
523  powerQualGlobals.pdRechargePeriod = 31;
524  }
525  while ( perM > 511 ) {
526  perM >>= 1;
527  perE += 1;
528  }
529  perM = ( perM - 15 ) >> 4;
530 
532  ( 0x80A4E700 ) |
533  ( perM << AON_WUC_RECHARGECFG_PER_M_S ) |
534  ( perE << AON_WUC_RECHARGECFG_PER_E_S ) ;
535  HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGESTAT ) = 0;
536 }
537 
538 
539 //*****************************************************************************
540 //
541 // SysCtrlAdjustRechargeAfterPowerDown()
542 //
543 //*****************************************************************************
544 void
546 {
547  int32_t curTemp ;
548  uint32_t longestRechargePeriod ;
549  uint32_t deltaTime ;
550  uint32_t newRechargePeriod ;
551 
552  //--- Spec. point 2 ---
553  longestRechargePeriod = ( HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGESTAT ) &
556 
557  if ( longestRechargePeriod != 0 ) {
558  //--- Spec. changed (originaly point 1) ---
559  curTemp = AONBatMonTemperatureGetDegC();
560  if ( curTemp < powerQualGlobals.pdTemp ) {
561  if ( curTemp < -128 ) {
562  curTemp = -128;
563  }
564  powerQualGlobals.pdTemp = curTemp;
565  }
566 
567  //--- Spec. point 4 ---
568  if ( longestRechargePeriod < powerQualGlobals.pdRechargePeriod ) {
569  powerQualGlobals.pdRechargePeriod = longestRechargePeriod;
570  } else {
571  //--- Spec. point 5 ---
572  deltaTime = HWREG( AON_RTC_BASE + AON_RTC_O_SEC ) - powerQualGlobals.pdTime + 2;
573  if ( deltaTime > 31 ) {
574  deltaTime = 31;
575  }
576  newRechargePeriod = powerQualGlobals.pdRechargePeriod + (( longestRechargePeriod - powerQualGlobals.pdRechargePeriod ) >> (deltaTime>>1));
577  if ( newRechargePeriod > 0xFFFF ) {
578  newRechargePeriod = 0xFFFF;
579  }
580  powerQualGlobals.pdRechargePeriod = newRechargePeriod;
581  }
582  }
583 }
584 
585 
586 //*****************************************************************************
587 //
588 // SysCtrl_DCDC_VoltageConditionalControl()
589 //
590 //*****************************************************************************
591 void
593 {
594  uint32_t batThreshold ; // Fractional format with 8 fractional bits.
595  uint32_t aonBatmonBat ; // Fractional format with 8 fractional bits.
596  uint32_t ccfg_ModeConfReg ; // Holds a copy of the CCFG_O_MODE_CONF register.
597  uint32_t aonSysctlPwrctl ; // Reflect whats read/written to the AON_SYSCTL_O_PWRCTL register.
598 
599  //
600  // We could potentially call this function before any battery voltage measurement
601  // is made/available. In that case we must make sure that we do not turn off the DCDC.
602  // This can be done by doing nothing as long as the battery voltage is 0 (Since the
603  // reset value of the battery voltage register is 0).
604  //
605  aonBatmonBat = HWREG( AON_BATMON_BASE + AON_BATMON_O_BAT );
606  if ( aonBatmonBat != 0 ) {
607  //
608  // Check if Voltage Conditional Control is enabled
609  // It is enabled if both:
610  // - DCDC in use (either in active or recharge mode), (in use if one of the corresponding CCFG bits are zero).
611  // - Alternative DCDC settings are enabled ( DIS_ALT_DCDC_SETTING == 0 )
612  //
613  ccfg_ModeConfReg = HWREG( CCFG_BASE + CCFG_O_MODE_CONF );
614 
615  if (((( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_RECHARGE_M ) == 0 ) ||
616  (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_ACTIVE_M ) == 0 ) ) &&
618  {
619  aonSysctlPwrctl = HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL );
620  batThreshold = (((( HWREG( CCFG_BASE + CCFG_O_MODE_CONF_1 ) &
622  CCFG_MODE_CONF_1_ALT_DCDC_VMIN_S ) + 28 ) << 4 );
623 
624  if ( aonSysctlPwrctl & ( AON_SYSCTL_PWRCTL_DCDC_EN_M | AON_SYSCTL_PWRCTL_DCDC_ACTIVE_M )) {
625  //
626  // DCDC is ON, check if it should be switched off
627  //
628  if ( aonBatmonBat < batThreshold ) {
630 
631  HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL ) = aonSysctlPwrctl;
632  }
633  } else {
634  //
635  // DCDC is OFF, check if it should be switched on
636  //
637  if ( aonBatmonBat > batThreshold ) {
638  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_RECHARGE_M ) == 0 ) aonSysctlPwrctl |= AON_SYSCTL_PWRCTL_DCDC_EN_M ;
639  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_ACTIVE_M ) == 0 ) aonSysctlPwrctl |= AON_SYSCTL_PWRCTL_DCDC_ACTIVE_M ;
640 
641  HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL ) = aonSysctlPwrctl;
642  }
643  }
644  }
645  }
646 }
647 
648 
649 //*****************************************************************************
650 //
651 // SysCtrlResetSourceGet()
652 //
653 //*****************************************************************************
654 uint32_t
656 {
658  return ( RSTSRC_WAKEUP_FROM_SHUTDOWN );
659  } else {
660  return (( HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_RESETCTL ) &
663  }
664 }
#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:314
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:107
static const uint32_t g_pui32ModuleCG[]
Definition: sys_ctrl.c:98
int32_t SignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup.c:664
#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:592
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:54
uint32_t OSCClockSourceGet(uint32_t ui32SrcClk)
Get the source clock settings.
Definition: osc.c:144
uint8_t pdState
Definition: sys_ctrl.c:82
#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:609
#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:655
#define CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_WIDTH
Definition: sys_ctrl.c:329
#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:76
#define AUX_WUC_ADI_CLOCK
Definition: aux_wuc.h:110
#define PD_STATE_CACHE_RET
Definition: sys_ctrl.c:74
#define PRCM_PERIPH_TIMER2
Definition: prcm.h:182
void OSCInterfaceEnable(void)
Enable System CPU access to the OSC_DIG module.
Definition: osc.c:178
#define AONWUC_AUX_POWER_ON
Definition: aon_wuc.h:172
#define OSC_SRC_CLK_HF
Definition: osc.h:106
void PRCMPeripheralSleepEnable(uint32_t ui32Peripheral)
Enables a peripheral in sleep mode.
Definition: prcm.c:529
#define OSC_RCOSC_HF
Definition: osc.h:110
#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:77
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:111
#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:108
#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:545
static PowerQualGlobals_t powerQualGlobals
Definition: sys_ctrl.c:86
#define AUX_WUC_SMPH_CLOCK
Definition: aux_wuc.h:103
#define PD_STATE_RFMEM_RET
Definition: sys_ctrl.c:75
#define PRCM_PERIPH_CRYPTO
Definition: prcm.h:190
void SysCtrlShutdown(void)
Force the system in to shutdown.
Definition: sys_ctrl.c:288
void SysCtrlStandby(void)
Force the system in to standby mode.
Definition: sys_ctrl.c:217
#define AUX_WUC_REF_CLOCK
Definition: aux_wuc.h:115
#define PRCM_PERIPH_GPIO
Definition: prcm.h:193
#define PWRCTRL_STANDBY
Definition: pwr_ctrl.h:105
void PowerCtrlStateSet(uint32_t ui32Powerstate)
Force the system into low power modes.
Definition: pwr_ctrl.c:60
#define PRCM_PERIPH_UART0
Definition: prcm.h:186
#define OSC_RCOSC_LF
Definition: osc.h:112
#define PRCM_PERIPH_UDMA
Definition: prcm.h:192
void SysCtrlSetRechargeBeforePowerDown(uint32_t xoscPowerMode)
Set Recharge values before entering Power Down.
Definition: sys_ctrl.c:337
#define AUX_WUC_TDCIF_CLOCK
Definition: aux_wuc.h:108
#define PWRCTRL_SHUTDOWN
Definition: pwr_ctrl.h:107
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:489
void PRCMPeripheralDeepSleepEnable(uint32_t ui32Peripheral)
Enables a peripheral in deep-sleep mode.
Definition: prcm.c:569
uint32_t pdTime
Definition: sys_ctrl.c:80
#define AUX_WUC_ADC_CLOCK
Definition: aux_wuc.h:114
void SysCtrlPowerdown(void)
Force the system in to power down.
Definition: sys_ctrl.c:247
void OSCClockSourceSet(uint32_t ui32SrcClk, uint32_t ui32Osc)
Configure the oscillator input to the a source clock.
Definition: osc.c:85
#define RSTSRC_WAKEUP_FROM_SHUTDOWN
Definition: sys_ctrl.h:359
static void OSCInterfaceDisable(void)
Disable System CPU access to the OSC_DIG module.
Definition: osc.h:352
uint16_t pdRechargePeriod
Definition: sys_ctrl.c:81
#define OSC_XOSC_LF
Definition: osc.h:113
#define PRCM_PERIPH_I2C0
Definition: prcm.h:188
#define PWRCTRL_POWER_DOWN
Definition: pwr_ctrl.h:106
#define AUX_WUC_TIMER_CLOCK
Definition: aux_wuc.h:106
void SysCtrlPowerEverything(void)
Power up everything.
Definition: sys_ctrl.c:121