40 #include <inc/hw_types.h>
41 #include <inc/hw_ccfg.h>
52 #ifndef DRIVERLIB_GENERATE_ROM
53 #undef SysCtrlPowerEverything
54 #define SysCtrlPowerEverything NOROM_SysCtrlPowerEverything
56 #define SysCtrlStandby NOROM_SysCtrlStandby
57 #undef SysCtrlPowerdown
58 #define SysCtrlPowerdown NOROM_SysCtrlPowerdown
59 #undef SysCtrlShutdown
60 #define SysCtrlShutdown NOROM_SysCtrlShutdown
61 #undef SysCtrlClockGet
62 #define SysCtrlClockGet NOROM_SysCtrlClockGet
63 #undef SysCtrlPeripheralClockGet
64 #define SysCtrlPeripheralClockGet NOROM_SysCtrlPeripheralClockGet
65 #undef SysCtrlResetSourceGet
66 #define SysCtrlResetSourceGet NOROM_SysCtrlResetSourceGet
75 #define PD_STATE_CACHE_RET 1
76 #define PD_STATE_RFMEM_RET 2
77 #define PD_STATE_XOSC_LPM 4
98 static const uint32_t g_pui32ModuleCG[] =
124 uint32_t ui32AuxClocks;
208 for(ui32Idx = 0; ui32Idx <
sizeof(g_pui32ModuleCG) /
sizeof(uint32_t);
355 return (GET_MCU_CLOCK / ui32Div);
366 uint32_t ui32SysBusDiv;
369 uint32_t ui32ClkFreq;
395 switch(ui32Peripheral)
406 if(ui32PerDiv < ui32Div)
408 ui32ClkFreq = GET_MCU_CLOCK >> ui32Div;
412 ui32ClkFreq = GET_MCU_CLOCK >> ui32PerDiv;
423 ui32ClkFreq = GET_MCU_CLOCK >> ui32Div;
432 ui32ClkFreq = GET_MCU_CLOCK >> ui32PerDiv;
442 return (ui32ClkFreq);
455 int32_t shiftedTemp ;
457 uint32_t prcmRamRetention ;
466 uint32_t newRechargePeriod ;
469 const uint32_t * pLookupTable ;
488 if ((( curTemp - powerQualGlobals.
pdTemp ) >= 5 ) || ( curState != powerQualGlobals.
pdState )) {
490 shiftedTemp = curTemp - 15;
501 if ( shiftedTemp >= 0 ) {
503 shiftedTemp += ( shiftedTemp << 4 );
506 ti = ( shiftedTemp >> 8 );
516 cd = pLookupTable[ dii + 1 ] - pLookupTable[ dii ];
523 di += (( cd >> 8 ) & 0xFF );
526 di += (( cd >> 16 ) & 0xFF );
529 di += (( cd >> 24 ) & 0xFF );
537 cl = pLookupTable[ ti ];
544 load += (( cl >> 8 ) & 0xFF );
547 load += (( cl >> 16 ) & 0xFF );
550 load += (( cl >> 24 ) & 0xFF );
554 load += ((( di * ( shiftedTemp - ( ti << 8 ))) + 128 ) > 8 );
567 newRechargePeriod = ( vddrCap * k ) / load;
568 if ( newRechargePeriod > 0xFFFF ) {
569 newRechargePeriod = 0xFFFF;
575 if ( curTemp > 127 ) curTemp = 127;
576 if ( curTemp < -128 ) curTemp = -128;
577 powerQualGlobals.
pdTemp = curTemp;
578 powerQualGlobals.
pdState = curState;
589 while ( perM > 511 ) {
593 perM = ( perM - 15 ) >> 4;
612 uint32_t longestRechargePeriod ;
613 uint32_t newRechargePeriod ;
617 if ( curTemp < powerQualGlobals.
pdTemp ) {
618 if ( curTemp < -128 ) {
621 powerQualGlobals.
pdTemp = curTemp;
629 if ( longestRechargePeriod == 0 ) {
639 if ( deltaTime > 31 ) {
643 if ( newRechargePeriod > 0xFFFF ) {
644 newRechargePeriod = 0xFFFF;
660 uint32_t batThreshold ;
661 uint32_t aonBatmonBat ;
662 uint32_t aonSysctlPwrctl ;
685 if ( aonBatmonBat < batThreshold ) {
694 if ( aonBatmonBat > batThreshold ) {
#define AUX_WUC_TDC_CLOCK
uint32_t SysCtrlPeripheralClockGet(uint32_t ui32Peripheral, uint32_t ui32BusMode)
Get the clock for a peripheral.
#define PRCM_PERIPH_TIMER1
void AUXWUCClockEnable(uint32_t ui32Clocks)
Enable clocks for peripherals in the AUX domain.
__STATIC_INLINE bool PRCMLoadGet(void)
Check if any of the load sensitive register has been updated.
#define AUX_WUC_OSCCTRL_CLOCK
void SysCtrl_DCDC_VoltageConditionalControl(void)
Turns DCDC on or off depending of what’s considered to be optimal usage.
uint32_t AUXWUCClockStatus(uint32_t ui32Clocks)
Get the status of a clock.
uint32_t PRCMClockConfigureGet(uint32_t ui32Domain)
Get the clock configuration for a specific sub system in the MCU Voltage Domain.
#define AUX_WUC_SOC_CLOCK
uint32_t OSCClockSourceGet(uint32_t ui32SrcClk)
Get the source clock settings.
#define PRCM_PERIPH_TIMER0
uint32_t PRCMPowerDomainStatus(uint32_t ui32Domains)
Get the status for a specific power domain.
#define AUX_WUC_CLOCK_READY
#define PRCM_PERIPH_UART1
uint32_t SysCtrlResetSourceGet(void)
Returns last reset source (including "wakeup from shutdown")
__STATIC_INLINE void PRCMLoadSet(void)
Use this function to synchronize the load settings.
#define AUX_WUC_AIODIO0_CLOCK
#define PD_STATE_XOSC_LPM
#define AUX_WUC_ADI_CLOCK
#define PD_STATE_CACHE_RET
#define PRCM_PERIPH_TIMER2
void OSCInterfaceEnable(void)
Enable CM3 access to the OSC_DIG module.
#define AONWUC_AUX_POWER_ON
void PRCMPeripheralSleepEnable(uint32_t ui32Peripheral)
Enables a peripheral in sleep mode.
#define AUX_WUC_AIODIO1_CLOCK
#define PRCM_DOMAIN_PERIPH
#define SYSCTRL_SYSBUS_ON
#define AONWUC_AUX_WAKEUP
#define PRCM_PERIPH_TIMER3
int32_t AON_BatmonTempGetDegC(void)
Get the current temperature measurement as a signed value in Deg Celsius.
void SysCtrlAdjustRechargeAfterPowerDown(void)
Adjust Recharge calculations to be used next.
void AONWUCAuxWakeupEvent(uint32_t ui32Mode)
Control the wake up procedure of the AUX domain.
#define PRCM_DOMAIN_TIMER
#define AUX_WUC_SMPH_CLOCK
#define SYSCTRL_SYSBUS_OFF
#define PD_STATE_RFMEM_RET
#define PRCM_PERIPH_CRYPTO
uint32_t SysCtrlClockGet(void)
Get the CPU core clock frequency.
void SysCtrlShutdown(void)
Force the system in to shutdown.
void SysCtrlStandby(void)
Force the system in to standby mode.
#define AUX_WUC_REF_CLOCK
__STATIC_INLINE void OSCInterfaceDisable(void)
Disable CM3 access to the OSC_DIG module.
void PowerCtrlStateSet(uint32_t ui32Powerstate)
Force the system in to low power modes.
#define PRCM_PERIPH_UART0
#define AUX_WUC_TDCIF_CLOCK
#define PRCM_DOMAIN_SYSBUS
#define PRCM_DOMAIN_POWER_ON
void PRCMPowerDomainOn(uint32_t ui32Domains)
Turn power on in power domains in the MCU domain.
When xosc_hf is in HIGH_POWER_XOSC.
#define PRCM_DOMAIN_SERIAL
XoscPowerMode_t
Enumeration describing possible input options to SysCtrlSetRechargeBeforePowerDown().
#define PRCM_DOMAIN_RFCORE
void PRCMClockConfigureSet(uint32_t ui32Domains, uint32_t ui32ClkDiv)
Setup the clock division factor for a subsystem in the MCU voltage domain.
void PRCMPeripheralRunEnable(uint32_t ui32Peripheral)
Enables a peripheral in Run mode.
void PRCMPeripheralDeepSleepEnable(uint32_t ui32Peripheral)
Enables a peripheral in deep-sleep mode.
#define AUX_WUC_ADC_CLOCK
void SysCtrlPowerdown(void)
Force the system in to power down.
void OSCClockSourceSet(uint32_t ui32SrcClk, uint32_t ui32Osc)
Configure the oscillator input to the a source clock.
__STATIC_INLINE void OSCHfSourceSwitch(void)
Switch the high frequency clock.
#define RSTSRC_WAKEUP_FROM_SHUTDOWN
void SysCtrlSetRechargeBeforePowerDown(XoscPowerMode_t xoscPowerMode)
Set Recharge values before entering Power Down.
__STATIC_INLINE void PRCMDomainEnable(uint32_t ui32Domains)
Enable clock domains in the MCU voltage domain.
uint16_t pdRechargePeriod
__STATIC_INLINE uint32_t AONWUCPowerStatus(void)
Get the power status of the device.
#define PWRCTRL_POWER_DOWN
#define AUX_WUC_TIMER_CLOCK
void SysCtrlPowerEverything(void)
Power up everything.