CC13xx Driver Library
[sys_ctrl] System Controller

Functions

void SysCtrlPowerEverything (void)
 Power up everything. More...
 
void SysCtrlStandby (void)
 Force the system into standby mode. More...
 
void SysCtrlPowerdown (void)
 Force the system into power down. More...
 
void SysCtrlShutdown (void)
 Force the system into shutdown. 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

Definition at line 597 of file sys_ctrl.c.

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. Typically this must be done anyway, for example by calling AONWUCAuxWakeupEvent() and then later on calling SysCtrlAonSync() just before calling SysCtrlSetRechargeBeforePowerDown().
Returns
None

Definition at line 550 of file sys_ctrl.c.

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()

Definition at line 244 of file sys_ctrl.h.

Referenced by HapiTrimDeviceShutDown().

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()

Definition at line 271 of file sys_ctrl.h.

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.

Definition at line 220 of file sys_ctrl.h.

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()

Definition at line 437 of file sys_ctrl.h.

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()

Definition at line 415 of file sys_ctrl.h.

void SysCtrlPowerdown ( void  )

Force the system into power down.

Note
The sequencing in this function is not necessarily how you would want to sequence the powerdown in a real application. There might be application specific prerequisites you would want to do before entering powerdown which deviate from this specific implementation.
Returns
None

Force the system into power down.

Definition at line 247 of file sys_ctrl.c.

Here is the call graph for this function:

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

Definition at line 121 of file sys_ctrl.c.

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.

Definition at line 660 of file sys_ctrl.c.

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

Definition at line 330 of file sys_ctrl.c.

Here is the call graph for this function:

void SysCtrlShutdown ( void  )

Force the system into shutdown.

Note
It is solely the programmer's responsibility to properly configure an interrupt that will enable the device to wakeup from the shutdown mode, before calling this function. In shutdown the only possible wakeup action is an IO interrupt.
The sequencing in this function is not necessarily how you would want to sequence the shutdown in a real application. There might be application specific prerequisites you would want to do before entering shutdown which deviate from this specific implementation.
Returns
This function does not return.

Force the system into shutdown.

Definition at line 288 of file sys_ctrl.c.

Here is the call graph for this function:

void SysCtrlStandby ( void  )

Force the system into standby mode.

Note
The sequencing in this function is not necessarily how you would want to sequence the standby in a real application. There might be application specific prerequisites you would want to do before entering standby which deviate from this specific implementation.
Returns
None

Force the system into standby mode.

Definition at line 217 of file sys_ctrl.c.

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.

Definition at line 385 of file sys_ctrl.h.

Here is the call graph for this function:

Macro Definition Documentation

#define CPU_DEEP_SLEEP   0x00000002

Definition at line 128 of file sys_ctrl.h.

#define CPU_RUN   0x00000000

Definition at line 126 of file sys_ctrl.h.

#define CPU_SLEEP   0x00000001

Definition at line 127 of file sys_ctrl.h.

Definition at line 362 of file sys_ctrl.h.

Definition at line 358 of file sys_ctrl.h.

Definition at line 357 of file sys_ctrl.h.

Definition at line 363 of file sys_ctrl.h.

Definition at line 360 of file sys_ctrl.h.

Definition at line 361 of file sys_ctrl.h.

Definition at line 359 of file sys_ctrl.h.

#define RSTSRC_WAKEUP_FROM_SHUTDOWN   ((( AON_SYSCTL_RESETCTL_RESET_SRC_M ) >> ( AON_SYSCTL_RESETCTL_RESET_SRC_S )) + 1 )

Definition at line 365 of file sys_ctrl.h.

Referenced by SysCtrlResetSourceGet().

Definition at line 364 of file sys_ctrl.h.

#define SYSCTRL_SYSBUS_OFF   0x00000000

Definition at line 119 of file sys_ctrl.h.

#define SYSCTRL_SYSBUS_ON   0x00000001

Definition at line 118 of file sys_ctrl.h.

#define XOSC_IN_HIGH_POWER_MODE   0

Definition at line 135 of file sys_ctrl.h.

Referenced by SysCtrlSetRechargeBeforePowerDown().

#define XOSC_IN_LOW_POWER_MODE   1

Definition at line 136 of file sys_ctrl.h.