39 #include <inc/hw_types.h>
40 #include <inc/hw_ccfg.h>
52 #undef OSCClockSourceSet
53 #define OSCClockSourceSet NOROM_OSCClockSourceSet
54 #undef OSCClockSourceGet
55 #define OSCClockSourceGet NOROM_OSCClockSourceGet
56 #undef OSCInterfaceEnable
57 #define OSCInterfaceEnable NOROM_OSCInterfaceEnable
66 #define RTC_CV_TO_MS(x) (( 1000 * ( x )) >> 16 )
67 #define RTC_CV_TO_US(x) (( 1000000 * ( x )) >> 16 )
101 if(ui32SrcClk & OSC_SRC_CLK_HF)
115 if(ui32SrcClk & OSC_SRC_CLK_MF)
126 if(ui32SrcClk & OSC_SRC_CLK_LF)
146 uint32_t ui32ClockSource;
157 if(ui32SrcClk == OSC_SRC_CLK_LF)
169 return (ui32ClockSource);
204 uint32_t deltaTimeSinceXoscOnInMs ;
205 int32_t deltaTempSinceXoscOn ;
206 uint32_t newStartupTimeInUs ;
211 if ( deltaTempSinceXoscOn < 0 ) {
212 deltaTempSinceXoscOn = -deltaTempSinceXoscOn;
215 if ( (( timeUntilWakeupInMs + deltaTimeSinceXoscOnInMs ) > 3000 ) ||
216 ( deltaTempSinceXoscOn > 5 ) ||
220 newStartupTimeInUs = 2000;
229 newStartupTimeInUs += ( newStartupTimeInUs >> 2 );
235 if ( newStartupTimeInUs < 200 ) {
236 newStartupTimeInUs = 200;
238 if ( newStartupTimeInUs > 4000 ) {
239 newStartupTimeInUs = 4000;
241 return ( newStartupTimeInUs );
266 uint32_t startupTimeInUs;
267 uint32_t prevLimmit25InUs;
282 prevLimmit25InUs -= ( prevLimmit25InUs >> 2 );
284 if ( prevLimmit25InUs > startupTimeInUs ) {
static void AONWUCAuxWakeupEvent(uint32_t ui32Mode)
Control the wake up procedure of the AUX domain.
static uint32_t AONWUCPowerStatusGet(void)
Get the power status of the device.
static void OSCHfSourceSwitch(void)
Switch the high frequency clock.
void AUXWUCClockEnable(uint32_t ui32Clocks)
Enable clocks for peripherals in the AUX domain.
#define AUX_WUC_OSCCTRL_CLOCK
uint32_t AUXWUCClockStatus(uint32_t ui32Clocks)
Get the status of a clock.
uint32_t timeXoscStable_CV
int32_t AONBatMonTemperatureGetDegC(void)
Get the current temperature measurement as a signed value in Deg Celsius.
uint32_t OSCClockSourceGet(uint32_t ui32SrcClk)
Get the source clock settings.
#define AUX_WUC_CLOCK_READY
void DDI16BitfieldWrite(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask, uint32_t ui32Shift, uint16_t ui32Data)
Write a bitfield via the DDI using 16-bit maskable write.
void OSCInterfaceEnable(void)
Enable System CPU access to the OSC_DIG module.
uint32_t OSCHF_GetStartupTime(uint32_t timeUntilWakeupInMs)
Returns maximum startup time (in microseconds) of XOSC_HF.
#define AONWUC_AUX_POWER_ON
bool OSCHF_AttemptToSwitchToXosc(void)
Switch to XOSC_HF if XOSC_HF is ready.
static bool OSCHfSourceReady(void)
Check if the HF clock source is ready to be switched.
#define AONWUC_AUX_WAKEUP
uint32_t previousStartupTimeInUs
uint16_t DDI16BitfieldRead(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask, uint32_t ui32Shift)
Read a bitfield via the DDI using 16-bit read.
static OscHfGlobals_t oscHfGlobals
void OSCHF_SwitchToRcOscTurnOffXosc(void)
Switch to RCOSC_HF and turn off XOSC_HF.
uint32_t AONRTCCurrentCompareValueGet(void)
Get the current value of the RTC counter in a format that matches RTC compare values.
void OSCClockSourceSet(uint32_t ui32SrcClk, uint32_t ui32Osc)
Configure the oscillator input to the a source clock.
void OSCHF_TurnOnXosc(void)
Turns on XOSC_HF (but without switching to XOSC_HF).