CC26xx Driver Library
[sys_ctrl] System Controller

Functions

void SysCtrlPowerEverything (void)
 Power up everything. More...
 
static uint32_t SysCtrlClockGet (void)
 Get the CPU core clock frequency. More...
 
static void SysCtrlAonSync (void)
 Sync all accesses to the AON register interface. More...
 
static void SysCtrlAonUpdate (void)
 Update all interfaces to AON. More...
 
void SysCtrlSetRechargeBeforePowerDown (uint32_t xoscPowerMode)
 Set Recharge values before entering Power Down. More...
 
void SysCtrlAdjustRechargeAfterPowerDown (void)
 Adjust Recharge calculations to be used next. More...
 
void SysCtrl_DCDC_VoltageConditionalControl (void)
 Turns DCDC on or off depending of what is considered to be optimal usage. More...
 
uint32_t SysCtrlResetSourceGet (void)
 Returns last reset source (including "wakeup from shutdown"). More...
 
static void SysCtrlSystemReset (void)
 Perform a full system reset. More...
 
static void SysCtrlClockLossResetEnable (void)
 Enables reset if OSC clock loss event is asserted. More...
 
static void SysCtrlClockLossResetDisable (void)
 Disables reset due to OSC clock loss event. More...
 
#define RSTSRC_PWR_ON   (( AON_SYSCTL_RESETCTL_RESET_SRC_PWR_ON ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_PIN_RESET   (( AON_SYSCTL_RESETCTL_RESET_SRC_PIN_RESET ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_VDDS_LOSS   (( AON_SYSCTL_RESETCTL_RESET_SRC_VDDS_LOSS ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_VDD_LOSS   (( AON_SYSCTL_RESETCTL_RESET_SRC_VDD_LOSS ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_VDDR_LOSS   (( AON_SYSCTL_RESETCTL_RESET_SRC_VDDR_LOSS ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_CLK_LOSS   (( AON_SYSCTL_RESETCTL_RESET_SRC_CLK_LOSS ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_SYSRESET   (( AON_SYSCTL_RESETCTL_RESET_SRC_SYSRESET ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_WARMRESET   (( AON_SYSCTL_RESETCTL_RESET_SRC_WARMRESET ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S ))
 
#define RSTSRC_WAKEUP_FROM_SHUTDOWN   ((( AON_SYSCTL_RESETCTL_RESET_SRC_M ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S )) + 1 )
 

Detailed Description

Function Documentation

void SysCtrl_DCDC_VoltageConditionalControl ( void  )

Turns DCDC on or off depending of what is considered to be optimal usage.

This function controls the DCDC only if both the following CCFG settings are true:

  • DCDC is configured to be used.
  • Alternative DCDC settings are defined and enabled.

The DCDC is configured in accordance to the CCFG settings when turned on.

This function should be called periodically.

Returns
None
455 {
456  uint32_t batThreshold ; // Fractional format with 8 fractional bits.
457  uint32_t aonBatmonBat ; // Fractional format with 8 fractional bits.
458  uint32_t ccfg_ModeConfReg ; // Holds a copy of the CCFG_O_MODE_CONF register.
459  uint32_t aonSysctlPwrctl ; // Reflect whats read/written to the AON_SYSCTL_O_PWRCTL register.
460 
461  // We could potentially call this function before any battery voltage measurement
462  // is made/available. In that case we must make sure that we do not turn off the DCDC.
463  // This can be done by doing nothing as long as the battery voltage is 0 (Since the
464  // reset value of the battery voltage register is 0).
465  aonBatmonBat = HWREG( AON_BATMON_BASE + AON_BATMON_O_BAT );
466  if ( aonBatmonBat != 0 ) {
467  // Check if Voltage Conditional Control is enabled
468  // It is enabled if all the following are true:
469  // - DCDC in use (either in active or recharge mode), (in use if one of the corresponding CCFG bits are zero).
470  // - Alternative DCDC settings are enabled ( DIS_ALT_DCDC_SETTING == 0 )
471  // - Not in external regulator mode ( EXT_REG_MODE == 0 )
472  ccfg_ModeConfReg = HWREG( CCFG_BASE + CCFG_O_MODE_CONF );
473 
474  if (((( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_RECHARGE_M ) == 0 ) ||
475  (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_ACTIVE_M ) == 0 ) ) &&
478  {
479  aonSysctlPwrctl = HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL );
480  batThreshold = (((( HWREG( CCFG_BASE + CCFG_O_MODE_CONF_1 ) &
482  CCFG_MODE_CONF_1_ALT_DCDC_VMIN_S ) + 28 ) << 4 );
483 
484  if ( aonSysctlPwrctl & ( AON_SYSCTL_PWRCTL_DCDC_EN_M | AON_SYSCTL_PWRCTL_DCDC_ACTIVE_M )) {
485  // DCDC is ON, check if it should be switched off
486  if ( aonBatmonBat < batThreshold ) {
488 
489  HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL ) = aonSysctlPwrctl;
490  }
491  } else {
492  // DCDC is OFF, check if it should be switched on
493  if ( aonBatmonBat > batThreshold ) {
494  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_RECHARGE_M ) == 0 ) aonSysctlPwrctl |= AON_SYSCTL_PWRCTL_DCDC_EN_M ;
495  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_DCDC_ACTIVE_M ) == 0 ) aonSysctlPwrctl |= AON_SYSCTL_PWRCTL_DCDC_ACTIVE_M ;
496 
497  HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_PWRCTL ) = aonSysctlPwrctl;
498  }
499  }
500  }
501  }
502 }
void SysCtrlAdjustRechargeAfterPowerDown ( void  )

Adjust Recharge calculations to be used next.

This function shall be called just after returning from Power Down.

Reads the results from the adaptive recharge controller and current chip temperature. This is used as additional information when calculating optimal recharge controller settings next time (When SysCtrlSetRechargeBeforePowerDown() is called next time).

Note
Special care must be taken to make sure that the AON registers read are updated after the wakeup. Writing to an AON register and then calling SysCtrlAonSync() will handle this.
Returns
None
408 {
409  int32_t curTemp ;
410  uint32_t longestRechargePeriod ;
411  uint32_t deltaTime ;
412  uint32_t newRechargePeriod ;
413 
414  //--- Spec. point 2 ---
415  longestRechargePeriod = ( HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGESTAT ) &
418 
419  if ( longestRechargePeriod != 0 ) {
420  //--- Spec. changed (originaly point 1) ---
421  curTemp = AONBatMonTemperatureGetDegC();
422  if ( curTemp < powerQualGlobals.pdTemp ) {
423  if ( curTemp < -128 ) {
424  curTemp = -128;
425  }
426  powerQualGlobals.pdTemp = curTemp;
427  }
428 
429  //--- Spec. point 4 ---
430  if ( longestRechargePeriod < powerQualGlobals.pdRechargePeriod ) {
431  powerQualGlobals.pdRechargePeriod = longestRechargePeriod;
432  } else {
433  //--- Spec. point 5 ---
434  deltaTime = HWREG( AON_RTC_BASE + AON_RTC_O_SEC ) - powerQualGlobals.pdTime + 2;
435  if ( deltaTime > 31 ) {
436  deltaTime = 31;
437  }
438  newRechargePeriod = powerQualGlobals.pdRechargePeriod + (( longestRechargePeriod - powerQualGlobals.pdRechargePeriod ) >> (deltaTime>>1));
439  if ( newRechargePeriod > 0xFFFF ) {
440  newRechargePeriod = 0xFFFF;
441  }
442  powerQualGlobals.pdRechargePeriod = newRechargePeriod;
443  }
444  }
445 }
int8_t pdTemp
Definition: sys_ctrl.c:82
int32_t AONBatMonTemperatureGetDegC(void)
Get the current temperature measurement as a signed value in Deg Celsius.
Definition: aon_batmon.c:60
static PowerQualGlobals_t powerQualGlobals
Definition: sys_ctrl.c:85
uint32_t pdTime
Definition: sys_ctrl.c:79
uint16_t pdRechargePeriod
Definition: sys_ctrl.c:80

Here is the call graph for this function:

static void SysCtrlAonSync ( void  )
inlinestatic

Sync all accesses to the AON register interface.

When this function returns, all writes to the AON register interface are guaranteed to have propagated to hardware. The function will return immediately if no AON writes are pending; otherwise, it will wait for the next AON clock before returning.

Returns
None
See also
SysCtrlAonUpdate()

Referenced by SetupAfterColdResetWakeupFromShutDownCfg3().

195 {
196  // Sync the AON interface
197  HWREG(AON_RTC_BASE + AON_RTC_O_SYNC);
198 }
static void SysCtrlAonUpdate ( void  )
inlinestatic

Update all interfaces to AON.

When this function returns, at least 1 clock cycle has progressed on the AON domain, so that any outstanding updates to and from the AON interface is guaranteed to be in sync.

Note
This function should primarily be used after wakeup from sleep modes, as it will guarantee that all shadow registers on the AON interface are updated before reading any AON registers from the MCU domain. If a write has been done to the AON interface it is sufficient to call the SysCtrlAonSync().
Returns
None
See also
SysCtrlAonSync()
220 {
221  // Force a clock cycle on the AON interface to guarantee all registers are
222  // in sync.
223  HWREG(AON_RTC_BASE + AON_RTC_O_SYNC) = 1;
224  HWREG(AON_RTC_BASE + AON_RTC_O_SYNC);
225 }
static uint32_t SysCtrlClockGet ( void  )
inlinestatic

Get the CPU core clock frequency.

Use this function to get the current clock frequency for the CPU.

The CPU can run from 48 MHz and down to 750kHz. The frequency is defined by the combined division factor of the SYSBUS and the CPU clock divider.

Returns
Returns the current CPU core clock frequency.
174 {
175  // Return fixed clock speed
176  return( GET_MCU_CLOCK );
177 }
static void SysCtrlClockLossResetDisable ( void  )
inlinestatic

Disables reset due to OSC clock loss event.

Note
This function shall typically not be called because the clock loss reset functionality is controlled by the boot code (a factory configuration defines whether it is set or not).
Returns
None
See also
SysCtrlClockLossResetEnable()
377 {
378  // Clear clock loss enable bit in AON_SYSCTRL using bit banding
380 }
static void SysCtrlClockLossResetEnable ( void  )
inlinestatic

Enables reset if OSC clock loss event is asserted.

Clock loss circuit in analog domain must be enabled as well in order to actually enable for a clock loss reset to occur OSCClockLossEventEnable().

Note
This function shall typically not be called because the clock loss reset functionality is controlled by the boot code (a factory configuration defines whether it is set or not).
Returns
None
See also
SysCtrlClockLossResetDisable(), OSCClockLossEventEnable()
357 {
358  // Set clock loss enable bit in AON_SYSCTRL using bit banding
360 }
void SysCtrlPowerEverything ( void  )

Power up everything.

Note
The sequencing in this function is not necessarily how you would want to sequence active mode in a real application. There might be application specific prerequisites or hardware restrictions you would want to consider which deviate from this specific implementation.
This function might be deprecated in future releases
Returns
None
121 {
122  uint32_t ui32Idx;
123  uint32_t ui32AuxClocks;
124 
125  // Force power on AUX
128  { }
129 
130  // Enable all the AUX domain clocks and wait for them to be ready
131  ui32AuxClocks = AUX_WUC_ADI_CLOCK | AUX_WUC_OSCCTRL_CLOCK |
137  AUXWUCClockEnable(ui32AuxClocks);
138  while(AUXWUCClockStatus(ui32AuxClocks) != AUX_WUC_CLOCK_READY)
139  { }
140 
141  // Request to switch to the crystal to enable radio operation.
142  // It takes a while for the XTAL to be ready so it is possible to
143  // perform other tasks while waiting.
146 
147  // Switch the HF source to XTAL - must be performed safely out of ROM to
148  // avoid flash issues when switching the clock.
149  //
150  // NB. If already running XTAL on HF clock source the ROM will wait forever
151  // on a flag that will never be set - need to check.
154  }
155 
156  // Turn on all the MCU power domains
157  // If the CPU is running and executing code the SYSBUS, VIMS and CPU are
158  // automatically on as well.
161  // Wait for power to be on
164 
165  PRCMLoadSet();
166  while(!PRCMLoadGet());
167 
168  // Ensure the domain clocks are running and wait for the clock settings to
169  // take effect
171  PRCMLoadSet();
172  while(!PRCMLoadGet())
173  { }
174 
175  // Enable all the RF Core clocks
176  //
177  // Do not read back to check, for two reasons:
178  // 1. CPE will update the PWMCLKENABLE register right after boot
179  // 2. The PWMCLKENABLE register always reads back what is written
180  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = 0x7FF;
181 
182  // Enable all peripheral clocks in System CPU run/sleep/deep-sleep mode.
183  for(ui32Idx = 0; ui32Idx < sizeof(g_pui32ModuleCG) / sizeof(uint32_t);
184  ui32Idx++)
185  {
189  }
190  PRCMLoadSet();
191  while(!PRCMLoadGet())
192  { }
193 }
#define AUX_WUC_TDC_CLOCK
Definition: aux_wuc.h:113
static void AONWUCAuxWakeupEvent(uint32_t ui32Mode)
Control the wake up procedure of the AUX domain.
Definition: aon_wuc.h:462
static uint32_t AONWUCPowerStatusGet(void)
Get the power status of the device.
Definition: aon_wuc.h:542
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:113
static const uint32_t g_pui32ModuleCG[]
Definition: sys_ctrl.c:97
#define AUX_WUC_OSCCTRL_CLOCK
Definition: aux_wuc.h:109
uint32_t AUXWUCClockStatus(uint32_t ui32Clocks)
Get the status of a clock.
Definition: aux_wuc.c:150
uint32_t OSCClockSourceGet(uint32_t ui32SrcClk)
Get the source clock settings.
Definition: osc.c:147
uint32_t PRCMPowerDomainStatus(uint32_t ui32Domains)
Get the status for a specific power domain.
Definition: prcm.c:539
#define AUX_WUC_CLOCK_READY
Definition: aux_wuc.h:119
#define PRCM_DOMAIN_VIMS
Definition: prcm.h:142
#define AUX_WUC_AIODIO0_CLOCK
Definition: aux_wuc.h:104
#define AUX_WUC_ADI_CLOCK
Definition: aux_wuc.h:110
#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:475
#define AUX_WUC_AIODIO1_CLOCK
Definition: aux_wuc.h:105
#define PRCM_DOMAIN_PERIPH
Definition: prcm.h:138
static bool PRCMLoadGet(void)
Check if any of the load sensitive register has been updated.
Definition: prcm.h:566
#define OSC_XOSC_HF
Definition: osc.h:117
#define AONWUC_AUX_WAKEUP
Definition: aon_wuc.h:152
#define OSC_SRC_CLK_LF
Definition: osc.h:114
#define AUX_WUC_SMPH_CLOCK
Definition: aux_wuc.h:103
#define AUX_WUC_REF_CLOCK
Definition: aux_wuc.h:115
#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:594
#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:359
#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:548
void PRCMPeripheralRunEnable(uint32_t ui32Peripheral)
Enables a peripheral in Run mode.
Definition: prcm.c:443
void PRCMPeripheralDeepSleepEnable(uint32_t ui32Peripheral)
Enables a peripheral in deep-sleep mode.
Definition: prcm.c:507
#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:100
#define OSC_XOSC_LF
Definition: osc.h:119
#define AUX_WUC_TIMER_CLOCK
Definition: aux_wuc.h:106

Here is the call graph for this function:

uint32_t SysCtrlResetSourceGet ( void  )

Returns last reset source (including "wakeup from shutdown").

Returns
Returns one of the RSTSRC_ defines.
512 {
514  return ( RSTSRC_WAKEUP_FROM_SHUTDOWN );
515  } else {
516  return (( HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_RESETCTL ) &
519  }
520 }
#define RSTSRC_WAKEUP_FROM_SHUTDOWN
Definition: sys_ctrl.h:306
void SysCtrlSetRechargeBeforePowerDown ( uint32_t  xoscPowerMode)

Set Recharge values before entering Power Down.

This function shall be called just before entering Power Down. It calculates an optimal and safe recharge setting of the adaptive recharge controller. The results of previous setting are also taken into account.

Note
In order to make sure that the register writes are completed, SysCtrlAonSync() must be called before entering standby/power down. This is not done internally in this function due to two reasons:
  • 1) There might be other register writes that must be synchronized as well.
  • 2) It is possible to save some time by doing other things before calling SysCtrlAonSync() since this call will not return before there are no outstanding write requests between MCU and AON.
Parameters
xoscPowerMode(typically running in XOSC_IN_HIGH_POWER_MODE all the time).
Returns
None
202 {
203  int32_t curTemp ;
204  int32_t shiftedTemp ;
205  int32_t deltaVddrSleepTrim ;
206  int32_t vddrTrimSleep ;
207  int32_t vddrTrimActve ;
208  int32_t diffVddrActiveSleep ;
209  uint32_t ccfg_ModeConfReg ;
210  uint32_t curState ;
211  uint32_t prcmRamRetention ;
212  uint32_t di ;
213  uint32_t dii ;
214  uint32_t ti ;
215  uint32_t cd ;
216  uint32_t cl ;
217  uint32_t load ;
218  uint32_t k ;
219  uint32_t vddrCap ;
220  uint32_t newRechargePeriod ;
221  uint32_t perE ;
222  uint32_t perM ;
223  const uint32_t * pLookupTable ;
224 
225  // If external regulator mode we shall:
226  // - Disable adaptive recharge (bit[31]=0) in AON_WUC_O_RECHARGECFG
227  // - Set recharge period to approximately 500 mS (perM=31, perE=5 => 0xFD)
228  // - Make sure you get a recalculation if leaving external regulator mode by setting powerQualGlobals.pdState accordingly
231  HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGECFG ) = 0x00A4FDFD;
232  return;
233  }
234 
235  //--- Spec. point 1 ---
236  curTemp = AONBatMonTemperatureGetDegC();
237  curState = 0;
238 
239  // read the MODE_CONF register in CCFG
240  ccfg_ModeConfReg = HWREG( CCFG_BASE + CCFG_O_MODE_CONF );
241  // Get VDDR_TRIM_SLEEP_DELTA + 1 (sign extended)
242  deltaVddrSleepTrim = ((((int32_t) ccfg_ModeConfReg )
245  // Do temperature compensation if enabled
246  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_TRIM_SLEEP_TC ) == 0 ) {
247  int32_t tcDelta = ( 62 - curTemp ) >> 3;
248  if ( tcDelta > 8 ) tcDelta = 8;
249  if ( tcDelta > deltaVddrSleepTrim ) deltaVddrSleepTrim = tcDelta;
250  }
251  {
252  vddrTrimSleep = SetupSignExtendVddrTrimValue((
253  HWREG( FCFG1_BASE + FCFG1_O_LDO_TRIM ) &
256  vddrTrimActve = SetupSignExtendVddrTrimValue((
257  HWREG( FCFG1_BASE + FCFG1_O_SHDW_ANA_TRIM ) &
260  }
261  vddrTrimSleep += deltaVddrSleepTrim;
262  if ( vddrTrimSleep > 21 ) vddrTrimSleep = 21;
263  if ( vddrTrimSleep < -10 ) vddrTrimSleep = -10;
264  // Write adjusted value using MASKED write (MASK8)
265  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_DCDCCTL1 * 2 )) = (( ADI_3_REFSYS_DCDCCTL1_VDDR_TRIM_SLEEP_M << 8 ) |
267 
268  prcmRamRetention = HWREG( PRCM_BASE + PRCM_O_RAMRETEN );
269  if ( prcmRamRetention & PRCM_RAMRETEN_VIMS_M ) {
270  curState |= PD_STATE_CACHE_RET;
271  }
272  if ( prcmRamRetention & PRCM_RAMRETEN_RFC ) {
273  curState |= PD_STATE_RFMEM_RET;
274  }
275  if ( xoscPowerMode != XOSC_IN_HIGH_POWER_MODE ) {
276  curState |= PD_STATE_XOSC_LPM;
277  }
278 
279  //--- Spec. point 2 ---
280  if ((( curTemp - powerQualGlobals.pdTemp ) >= 5 ) || ( curState != powerQualGlobals.pdState )) {
281  //--- Spec. point 3 ---
282  shiftedTemp = curTemp - 15;
283 
284  //--- Spec point 4 ---
285  //4. Check for external VDDR load option (may not be supported): ext_load = (VDDR_EXT_LOAD=0 in CCFG)
286  // Currently not implementing external load handling
287  // if ( __ccfg.ulModeConfig & MODE_CONF_VDDR_EXT_LOAD ) {
288  // }
289 
290  pLookupTable = (uint32_t *)( FCFG1_BASE + FCFG1_O_PWD_CURR_20C );
291 
292  //--- Spec point 5 ---
293  di = 0;
294  ti = 0;
295  if ( shiftedTemp >= 0 ) {
296  //--- Spec point 5.a ---
297  shiftedTemp += ( shiftedTemp << 4 );
298 
299  //--- Spec point 5.b ---
300  ti = ( shiftedTemp >> 8 );
301  if ( ti > 7 ) {
302  ti = 7;
303  }
304  dii = ti;
305  if ( dii > 6 ) {
306  dii = 6;
307  }
308 
309  //--- Spec point 5.c ---
310  cd = pLookupTable[ dii + 1 ] - pLookupTable[ dii ];
311 
312  //--- Spec point 5.d ---
313  di = cd & 0xFF;
314 
315  //--- Spec point 5.e ---
316  if ( curState & PD_STATE_XOSC_LPM ) {
317  di += (( cd >> 8 ) & 0xFF );
318  }
319  if ( curState & PD_STATE_RFMEM_RET ) {
320  di += (( cd >> 16 ) & 0xFF );
321  }
322  if ( curState & PD_STATE_CACHE_RET ) {
323  di += (( cd >> 24 ) & 0xFF );
324  }
325 
326  //--- Spec point 5.f ---
327  // Currently not implementing external load handling
328  }
329 
330  //--- Spec. point 6 ---
331  cl = pLookupTable[ ti ];
332 
333  //--- Spec. point 7 ---
334  load = cl & 0xFF;
335 
336  //--- Spec. point 8 ---
337  if ( curState & PD_STATE_XOSC_LPM ) {
338  load += (( cl >> 8 ) & 0xFF );
339  }
340  if ( curState & PD_STATE_RFMEM_RET ) {
341  load += (( cl >> 16 ) & 0xFF );
342  }
343  if ( curState & PD_STATE_CACHE_RET ) {
344  load += (( cl >> 24 ) & 0xFF );
345  }
346 
347  //--- Spec. point 9 ---
348  load += ((( di * ( shiftedTemp - ( ti << 8 ))) + 128 ) >> 8 );
349 
350  // Currently not implementing external load handling
351  // if ( __ccfg.ulModeConfig & MODE_CONF_VDDR_EXT_LOAD ) {
352  //--- Spec. point 10 ---
353  // } else {
354  //--- Spec. point 11 ---
355  diffVddrActiveSleep = ( vddrTrimActve - vddrTrimSleep );
356  if ( diffVddrActiveSleep < 1 ) diffVddrActiveSleep = 1;
357  k = ( diffVddrActiveSleep * 52 );
358  // }
359 
360  //--- Spec. point 12 ---
361 
362  vddrCap = ( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_CAP_M ) >> CCFG_MODE_CONF_VDDR_CAP_S;
363  newRechargePeriod = ( vddrCap * k ) / load;
364  if ( newRechargePeriod > 0xFFFF ) {
365  newRechargePeriod = 0xFFFF;
366  }
367  powerQualGlobals.pdRechargePeriod = newRechargePeriod;
368 
369  //--- Spec. point 13 ---
370  if ( curTemp > 127 ) curTemp = 127;
371  if ( curTemp < -128 ) curTemp = -128;
372  powerQualGlobals.pdTemp = curTemp;
373  powerQualGlobals.pdState = curState;
374  }
375 
377 
378  // Calculate PER_E and PER_M (based on powerQualGlobals.pdRechargePeriod)
379  // Round downwards but make sure PER_E=0 and PER_M=1 is the minimum possible setting.
380  // (assuming that powerQualGlobals.pdRechargePeriod always are <= 0xFFFF)
381  perE = 0;
383  if ( perM < 31 ) {
384  perM = 31;
386  }
387  while ( perM > 511 ) {
388  perM >>= 1;
389  perE += 1;
390  }
391  perM = ( perM - 15 ) >> 4;
392 
394  ( 0x80A4E700 ) |
395  ( perM << AON_WUC_RECHARGECFG_PER_M_S ) |
396  ( perE << AON_WUC_RECHARGECFG_PER_E_S ) ;
397  HWREG( AON_WUC_BASE + AON_WUC_O_RECHARGESTAT ) = 0;
398 }
#define XOSC_IN_HIGH_POWER_MODE
Definition: sys_ctrl.h:135
int8_t pdTemp
Definition: sys_ctrl.c:82
int32_t AONBatMonTemperatureGetDegC(void)
Get the current temperature measurement as a signed value in Deg Celsius.
Definition: aon_batmon.c:60
uint8_t pdState
Definition: sys_ctrl.c:81
#define PD_STATE_XOSC_LPM
Definition: sys_ctrl.c:75
#define PD_STATE_CACHE_RET
Definition: sys_ctrl.c:73
#define PD_STATE_EXT_REG_MODE
Definition: sys_ctrl.c:76
static PowerQualGlobals_t powerQualGlobals
Definition: sys_ctrl.c:85
#define PD_STATE_RFMEM_RET
Definition: sys_ctrl.c:74
uint32_t pdTime
Definition: sys_ctrl.c:79
uint16_t pdRechargePeriod
Definition: sys_ctrl.c:80
static int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup_rom.h:232

Here is the call graph for this function:

static void SysCtrlSystemReset ( void  )
inlinestatic

Perform a full system reset.

Returns
The chip will reset and hence never return from this call.
327 {
328  // Disable CPU interrupts
329  CPUcpsid();
330  // Write reset register
332  // Finally, wait until the above write propagates
333  while ( 1 ) {
334  // Do nothing, just wait for the reset (and never return from here)
335  }
336 }
uint32_t CPUcpsid(void)
Disable all external interrupts.
Definition: cpu.c:91

Here is the call graph for this function:

Macro Definition Documentation

#define CPU_DEEP_SLEEP   0x00000002
#define CPU_RUN   0x00000000
#define CPU_SLEEP   0x00000001
#define RSTSRC_WAKEUP_FROM_SHUTDOWN   ((( AON_SYSCTL_RESETCTL_RESET_SRC_M ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S )) + 1 )

Referenced by SysCtrlResetSourceGet().

#define SYSCTRL_SYSBUS_OFF   0x00000000
#define SYSCTRL_SYSBUS_ON   0x00000001
#define XOSC_IN_HIGH_POWER_MODE   0
#define XOSC_IN_LOW_POWER_MODE   1