CC13xx Driver Library
[setup_rom.h] Setup (ROM functions)

Functions

void SetupAfterColdResetWakeupFromShutDownCfg1 (uint32_t ccfg_ModeConfReg)
 First part of configuration required after cold reset and when waking up from shutdown. More...
 
void SetupAfterColdResetWakeupFromShutDownCfg2 (uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg)
 Second part of configuration required after cold reset and when waking up from shutdown. More...
 
void SetupAfterColdResetWakeupFromShutDownCfg3 (uint32_t ccfg_ModeConfReg)
 Third part of configuration required after cold reset and when waking up from shutdown. More...
 
uint32_t SetupGetTrimForAdcShModeEn (uint32_t ui32Fcfg1Revision)
 Returns the trim value from FCFG1 to be used as ADC_SH_MODE_EN setting. More...
 
uint32_t SetupGetTrimForAdcShVbufEn (uint32_t ui32Fcfg1Revision)
 Returns the trim value from FCFG1 to be used as ADC_SH_VBUF_EN setting. More...
 
uint32_t SetupGetTrimForAmpcompCtrl (uint32_t ui32Fcfg1Revision)
 Returns the trim value to be used for the AMPCOMP_CTRL register in OSC_DIG. More...
 
uint32_t SetupGetTrimForAmpcompTh1 (void)
 Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG. More...
 
uint32_t SetupGetTrimForAmpcompTh2 (void)
 Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG. More...
 
uint32_t SetupGetTrimForAnabypassValue1 (uint32_t ccfg_ModeConfReg)
 Returns the trim value to be used for the ANABYPASS_VALUE1 register in OSC_DIG. More...
 
uint32_t SetupGetTrimForDblrLoopFilterResetVoltage (uint32_t ui32Fcfg1Revision)
 Returns the trim value from FCFG1 to be used as DBLR_LOOP_FILTER_RESET_VOLTAGE setting. More...
 
uint32_t SetupGetTrimForRadcExtCfg (uint32_t ui32Fcfg1Revision)
 Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG. More...
 
uint32_t SetupGetTrimForRcOscLfIBiasTrim (uint32_t ui32Fcfg1Revision)
 Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM. More...
 
uint32_t SetupGetTrimForRcOscLfRtuneCtuneTrim (void)
 Returns the trim value to be used for the RCOSCLF_RTUNE_TRIM and the RCOSCLF_CTUNE_TRIM bit fields in the XOSCLF_RCOSCLF_CTRL register in OSC_DIG. More...
 
uint32_t SetupGetTrimForXoscHfCtl (uint32_t ui32Fcfg1Revision)
 Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG. More...
 
uint32_t SetupGetTrimForXoscHfFastStart (void)
 Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START. More...
 
uint32_t SetupGetTrimForXoscHfIbiastherm (void)
 Returns the trim value to be used for the XOSC_HF_IBIASTHERM bit field in the ANABYPASS_VALUE2 register in OSC_DIG. More...
 
uint32_t SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio (uint32_t ui32Fcfg1Revision)
 Returns XOSCLF_REGULATOR_TRIM and XOSCLF_CMIRRWR_RATIO as one packet spanning bits [5:0] in the returned value. More...
 
static int32_t SetupSignExtendVddrTrimValue (uint32_t ui32VddrTrimVal)
 Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21) More...
 
void SetupSetCacheModeAccordingToCcfgSetting (void)
 Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM) More...
 
void SetupSetAonRtcSubSecInc (uint32_t subSecInc)
 Doing the tricky stuff needed to enter new RTCSUBSECINC value. More...
 
void SetupSetVddrLevel (uint32_t ccfg_ModeConfReg)
 Set VDDR boost mode (by setting VDDR_TRIM to FCFG1..VDDR_TRIM_HH and setting VDDS_BOD to max). More...
 

Detailed Description

This module contains functions from the Setup API which are likely to be in ROM.

Note
Do not use functions from this module directly! This module is only to be used by SetupTrimDevice().

Function Documentation

void SetupAfterColdResetWakeupFromShutDownCfg1 ( uint32_t  ccfg_ModeConfReg)

First part of configuration required after cold reset and when waking up from shutdown.

Configures the following based on settings in CCFG (Customer Configuration area:

  • Boost mode for CC13xx devices
  • Minimal VDDR voltage threshold used during sleep mode
  • DCDC functionality:
    • Selects if DCDC or GLDO regulator will be used for VDDR in active mode
    • Selects if DCDC or GLDO regulator will be used for VDDR in sleep mode

In addition the battery monitor low limit for internal regulator mode is set to a hard coded value.

Parameters
ccfg_ModeConfRegis the value of the CCFG_O_MODE_CONF_1 register
Returns
None

Referenced by TrimAfterColdResetWakeupFromShutDown().

173 {
174  int32_t i32VddrSleepTrim;
175  int32_t i32VddrSleepDelta;
176 
177  // Check for CC13xx boost mode
178  // The combination VDDR_EXT_LOAD=0 and VDDS_BOD_LEVEL=1 is defined to select boost mode
179  if ((( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_EXT_LOAD ) == 0 ) &&
180  (( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDS_BOD_LEVEL ) != 0 ) ) {
181  // Set VDDS_BOD trim - using masked write {MASK8:DATA8}
182  // - TRIM_VDDS_BOD is bits[7:3] of ADI3..REFSYSCTL1
183  // - Needs a positive transition on BOD_BG_TRIM_EN (bit[7] of REFSYSCTL3) to
184  // latch new VDDS BOD. Set to 0 first to guarantee a positive transition.
186  //
187  // VDDS_BOD_LEVEL = 1 means that boost mode is selected
188  // - Max out the VDDS_BOD trim (=VDDS_BOD_POS_31)
189  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_REFSYSCTL1 * 2 )) =
193 
194  SetupSetVddrLevel( ccfg_ModeConfReg );
195 
196  i32VddrSleepTrim = SetupSignExtendVddrTrimValue((
197  HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
200  } else
201  {
202  i32VddrSleepTrim = SetupSignExtendVddrTrimValue((
203  HWREG( FCFG1_BASE + FCFG1_O_LDO_TRIM ) &
206  }
207 
208  // Adjust the VDDR_TRIM_SLEEP value with value adjustable by customer (CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA)
209  // Read and sign extend VddrSleepDelta (in range -8 to +7)
210  i32VddrSleepDelta =
211  (((int32_t)( ccfg_ModeConfReg << ( 32 - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_W - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_S )))
213  // Calculate new VDDR sleep trim
214  i32VddrSleepTrim = ( i32VddrSleepTrim + i32VddrSleepDelta + 1 );
215  if ( i32VddrSleepTrim > 21 ) i32VddrSleepTrim = 21;
216  if ( i32VddrSleepTrim < -10 ) i32VddrSleepTrim = -10;
217  // Write adjusted value using MASKED write (MASK8)
218  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_DCDCCTL1 * 2 )) = (( ADI_3_REFSYS_DCDCCTL1_VDDR_TRIM_SLEEP_M << 8 ) |
220 
221  // 1.
222  // Do not allow DCDC to be enabled if in external regulator mode.
223  // Preventing this by setting both the RECHARGE and the ACTIVE bits bit in the CCFG_MODE_CONF copy register (ccfg_ModeConfReg).
224  //
225  // 2.
226  // Adjusted battery monitor low limit in internal regulator mode.
227  // This is done by setting AON_BATMON_FLASHPUMPP0_LOWLIM=0 in internal regulator mode.
230  } else {
232  }
233 
234  // set the RECHARGE source based upon CCFG:MODE_CONF:DCDC_RECHARGE
235  // Note: Inverse polarity
237  ((( ccfg_ModeConfReg >> CCFG_MODE_CONF_DCDC_RECHARGE_S ) & 1 ) ^ 1 );
238 
239  // set the ACTIVE source based upon CCFG:MODE_CONF:DCDC_ACTIVE
240  // Note: Inverse polarity
242  ((( ccfg_ModeConfReg >> CCFG_MODE_CONF_DCDC_ACTIVE_S ) & 1 ) ^ 1 );
243 }
static int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup_rom.h:317
void SetupSetVddrLevel(uint32_t ccfg_ModeConfReg)
Set VDDR boost mode (by setting VDDR_TRIM to FCFG1..VDDR_TRIM_HH and setting VDDS_BOD to max)...
Definition: setup_rom.c:118

Here is the call graph for this function:

void SetupAfterColdResetWakeupFromShutDownCfg2 ( uint32_t  ui32Fcfg1Revision,
uint32_t  ccfg_ModeConfReg 
)

Second part of configuration required after cold reset and when waking up from shutdown.

Configures and trims functionalites required for use of XOSC_HF. The configurations and trimmings are based on settings in FCFG1 (Factory Configuration area) and partly on ccfg_ModeConfReg.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
ccfg_ModeConfRegis the value of the CCFG_O_MODE_CONF_1 register
Returns
None

Referenced by TrimAfterColdResetWakeupFromShutDown().

252 {
253  uint32_t ui32Trim;
254 
255  // Following sequence is required for using XOSCHF, if not included
256  // devices crashes when trying to switch to XOSCHF.
257  //
258  // Trim CAP settings. Get and set trim value for the ANABYPASS_VALUE1
259  // register
260  ui32Trim = SetupGetTrimForAnabypassValue1( ccfg_ModeConfReg );
262 
263  // Trim RCOSC_LF. Get and set trim values for the RCOSCLF_RTUNE_TRIM and
264  // RCOSCLF_CTUNE_TRIM fields in the XOSCLF_RCOSCLF_CTRL register.
270  ui32Trim);
271 
272  // Trim XOSCHF IBIAS THERM. Get and set trim value for the
273  // XOSCHF IBIAS THERM bit field in the ANABYPASS_VALUE2 register. Other
274  // register bit fields are set to 0.
275  ui32Trim = SetupGetTrimForXoscHfIbiastherm();
278 
279  // Trim AMPCOMP settings required before switch to XOSCHF
280  ui32Trim = SetupGetTrimForAmpcompTh2();
282  ui32Trim = SetupGetTrimForAmpcompTh1();
284 #if ( CCFG_BASE == CCFG_BASE_DEFAULT )
285  ui32Trim = SetupGetTrimForAmpcompCtrl( ui32Fcfg1Revision );
286 #else
287  ui32Trim = NOROM_SetupGetTrimForAmpcompCtrl( ui32Fcfg1Revision );
288 #endif
290 
291  // Set trim for DDI_0_OSC_ADCDOUBLERNANOAMPCTL_ADC_SH_MODE_EN in accordance to FCFG1 setting
292  // This is bit[5] in the DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL register
293  // Using MASK4 write + 1 => writing to bits[7:4]
294  ui32Trim = SetupGetTrimForAdcShModeEn( ui32Fcfg1Revision );
295  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL * 2 ) + 1 ) =
296  ( 0x20 | ( ui32Trim << 1 ));
297 
298  // Set trim for DDI_0_OSC_ADCDOUBLERNANOAMPCTL_ADC_SH_VBUF_EN in accordance to FCFG1 setting
299  // This is bit[4] in the DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL register
300  // Using MASK4 write + 1 => writing to bits[7:4]
301  ui32Trim = SetupGetTrimForAdcShVbufEn( ui32Fcfg1Revision );
302  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL * 2 ) + 1 ) =
303  ( 0x10 | ( ui32Trim ));
304 
305  // Set trim for the PEAK_DET_ITRIM, HP_BUF_ITRIM and LP_BUF_ITRIM bit fields
306  // in the DDI0_OSC_O_XOSCHFCTL register in accordance to FCFG1 setting.
307  // Remaining register bit fields are set to their reset values of 0.
308  ui32Trim = SetupGetTrimForXoscHfCtl(ui32Fcfg1Revision);
310 
311  // Set trim for DBLR_LOOP_FILTER_RESET_VOLTAGE in accordance to FCFG1 setting
312  // (This is bits [18:17] in DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL)
313  // (Using MASK4 write + 4 => writing to bits[19:16] => (4*4))
314  // (Assuming: DDI_0_OSC_ADCDOUBLERNANOAMPCTL_DBLR_LOOP_FILTER_RESET_VOLTAGE_S = 17 and
315  // that DDI_0_OSC_ADCDOUBLERNANOAMPCTL_DBLR_LOOP_FILTER_RESET_VOLTAGE_M = 0x00060000)
316  ui32Trim = SetupGetTrimForDblrLoopFilterResetVoltage( ui32Fcfg1Revision );
317  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL * 2 ) + 4 ) =
318  ( 0x60 | ( ui32Trim << 1 ));
319 
320  // Update DDI_0_OSC_ATESTCTL_ATESTLF_RCOSCLF_IBIAS_TRIM with data from
322  // This is DDI_0_OSC_O_ATESTCTL bit[7]
323  // ( DDI_0_OSC_O_ATESTCTL is currently hidden (but=0x00000020))
324  // Using MASK4 write + 1 => writing to bits[7:4]
325  ui32Trim = SetupGetTrimForRcOscLfIBiasTrim( ui32Fcfg1Revision );
326  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( 0x00000020 * 2 ) + 1 ) =
327  ( 0x80 | ( ui32Trim << 3 ));
328 
331  // This can be simplified since the registers are packed together in the same
332  // order both in FCFG1 and in the HW register.
333  // This spans DDI_0_OSC_O_LFOSCCTL bits[23:18]
334  // Using MASK8 write + 4 => writing to bits[23:16]
335  ui32Trim = SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio( ui32Fcfg1Revision );
336  HWREGH( AUX_DDI0_OSC_BASE + DDI_O_MASK8B + ( DDI_0_OSC_O_LFOSCCTL * 2 ) + 4 ) =
337  ( 0xFC00 | ( ui32Trim << 2 ));
338 
339  // Set trim the HPM_IBIAS_WAIT_CNT, LPM_IBIAS_WAIT_CNT and IDAC_STEP bit
340  // fields in the DDI0_OSC_O_RADCEXTCFG register in accordance to FCFG1 setting.
341  // Remaining register bit fields are set to their reset values of 0.
342  ui32Trim = SetupGetTrimForRadcExtCfg(ui32Fcfg1Revision);
344 
345  // Setting FORCE_KICKSTART_EN (ref. CC26_V1_BUG00261). Should also be done for PG2
346  // (This is bit 22 in DDI_0_OSC_O_CTL0)
348 }
uint32_t SetupGetTrimForAdcShModeEn(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as ADC_SH_MODE_EN setting.
Definition: setup_rom.c:757
uint32_t SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio(uint32_t ui32Fcfg1Revision)
Returns XOSCLF_REGULATOR_TRIM and XOSCLF_CMIRRWR_RATIO as one packet spanning bits [5:0] in the retur...
Definition: setup_rom.c:896
void DDI16BitfieldWrite(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask, uint32_t ui32Shift, uint16_t ui32Data)
Write a bit field via the DDI using 16-bit maskable write.
Definition: ddi.c:117
uint32_t SetupGetTrimForAdcShVbufEn(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as ADC_SH_VBUF_EN setting.
Definition: setup_rom.c:776
uint32_t SetupGetTrimForXoscHfCtl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG.
Definition: setup_rom.c:795
uint32_t SetupGetTrimForXoscHfIbiastherm(void)
Returns the trim value to be used for the XOSC_HF_IBIASTHERM bit field in the ANABYPASS_VALUE2 regist...
Definition: setup_rom.c:566
uint32_t SetupGetTrimForRadcExtCfg(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG.
Definition: setup_rom.c:845
uint32_t SetupGetTrimForAnabypassValue1(uint32_t ccfg_ModeConfReg)
Returns the trim value to be used for the ANABYPASS_VALUE1 register in OSC_DIG.
Definition: setup_rom.c:470
uint32_t SetupGetTrimForRcOscLfIBiasTrim(uint32_t ui32Fcfg1Revision)
Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM.
Definition: setup_rom.c:877
uint32_t SetupGetTrimForAmpcompTh1(void)
Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG.
Definition: setup_rom.c:621
uint32_t SetupGetTrimForAmpcompCtrl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the AMPCOMP_CTRL register in OSC_DIG.
Definition: setup_rom.c:656
void DDI32RegWrite(uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Val)
Write a 32 bit value to a register in the DDI slave.
Definition: ddi.c:66
uint32_t SetupGetTrimForRcOscLfRtuneCtuneTrim(void)
Returns the trim value to be used for the RCOSCLF_RTUNE_TRIM and the RCOSCLF_CTUNE_TRIM bit fields in...
Definition: setup_rom.c:539
uint32_t SetupGetTrimForDblrLoopFilterResetVoltage(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as DBLR_LOOP_FILTER_RESET_VOLTAGE setting.
Definition: setup_rom.c:738
uint32_t SetupGetTrimForAmpcompTh2(void)
Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG.
Definition: setup_rom.c:586

Here is the call graph for this function:

void SetupAfterColdResetWakeupFromShutDownCfg3 ( uint32_t  ccfg_ModeConfReg)

Third part of configuration required after cold reset and when waking up from shutdown.

Configures the following:

  • XOSC source selection based on ccfg_ModeConfReg. If HPOSC is selected on a HPOSC device the oscillator is configured based on settings in FCFG1 (Factory Configuration area).
  • Clock loss detection is disabled. Will be re-enabled by TIRTOS power driver.
  • Duration of the XOSC_HF fast startup mode based on FCFG1 setting.
  • SCLK_LF based on ccfg_ModeConfReg.
  • Output voltage of ADC fixed reference based on FCFG1 setting.
Parameters
ccfg_ModeConfRegis the value of the CCFG_O_MODE_CONF_1 register
Returns
None

Referenced by TrimAfterColdResetWakeupFromShutDown().

357 {
358  uint32_t fcfg1OscConf;
359  uint32_t ui32Trim;
360  uint32_t currentHfClock;
361  uint32_t ccfgExtLfClk;
362 
363  // Examine the XOSC_FREQ field to select 0x1=HPOSC, 0x2=48MHz XOSC, 0x3=24MHz XOSC
364  switch (( ccfg_ModeConfReg & CCFG_MODE_CONF_XOSC_FREQ_M ) >> CCFG_MODE_CONF_XOSC_FREQ_S ) {
365  case 2 :
366  // XOSC source is a 48 MHz crystal
367  // Do nothing (since this is the reset setting)
368  break;
369  case 1 :
370  // XOSC source is HPOSC (trim the HPOSC if this is a chip with HPOSC, otherwise skip trimming and default to 24 MHz XOSC)
371 
372  fcfg1OscConf = HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF );
373 
374  if (( fcfg1OscConf & FCFG1_OSC_CONF_HPOSC_OPTION ) == 0 ) {
375  // This is a HPOSC chip, apply HPOSC settings
376  // Set bit DDI_0_OSC_CTL0_HPOSC_MODE_EN (this is bit 14 in DDI_0_OSC_O_CTL0)
378 
386 
399  break;
400  }
401  // Not a HPOSC chip - fall through to default
402  default :
403  // XOSC source is a 24 MHz crystal (default)
404  // Set bit DDI_0_OSC_CTL0_XTAL_IS_24M (this is bit 31 in DDI_0_OSC_O_CTL0)
406  break;
407  }
408 
409  // Set XOSC_HF in bypass mode if CCFG is configured for external TCXO
410  // Please note that it is up to the customer to make sure that the external clock source is up and running before XOSC_HF can be used.
413  }
414 
415  // Clear DDI_0_OSC_CTL0_CLK_LOSS_EN (ClockLossEventEnable()). This is bit 9 in DDI_0_OSC_O_CTL0.
416  // This is typically already 0 except on Lizard where it is set in ROM-boot
418 
419  // Setting DDI_0_OSC_CTL1_XOSC_HF_FAST_START according to value found in FCFG1
420  ui32Trim = SetupGetTrimForXoscHfFastStart();
421  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_CTL1 * 2 )) = ( 0x30 | ui32Trim );
422 
423  // setup the LF clock based upon CCFG:MODE_CONF:SCLK_LF_OPTION
424  switch (( ccfg_ModeConfReg & CCFG_MODE_CONF_SCLK_LF_OPTION_M ) >> CCFG_MODE_CONF_SCLK_LF_OPTION_S ) {
425  case 0 : // XOSC_HF_DLF (XOSCHF/1536) -> SCLK_LF (=31250 Hz)
427  SetupSetAonRtcSubSecInc( 0x8637BD ); // RTC_INCREMENT = 2^38 / frequency
428  break;
429  case 1 : // EXTERNAL signal -> SCLK_LF (frequency=2^38/CCFG_EXT_LF_CLK_RTC_INCREMENT)
430  // Set SCLK_LF to use the same source as SCLK_HF
431  // Can be simplified a bit since possible return values for HF matches LF settings
432  currentHfClock = OSCClockSourceGet( OSC_SRC_CLK_HF );
433  OSCClockSourceSet( OSC_SRC_CLK_LF, currentHfClock );
434  while( OSCClockSourceGet( OSC_SRC_CLK_LF ) != currentHfClock ) {
435  // Wait until switched
436  }
437  ccfgExtLfClk = HWREG( CCFG_BASE + CCFG_O_EXT_LF_CLK );
441  IOC_STD_INPUT | IOC_HYST_ENABLE ); // Route external clock to AON IOC w/hysteresis
442  // Set XOSC_LF in bypass mode to allow external 32 kHz clock
444  // Fall through to set XOSC_LF as SCLK_LF source
445  case 2 : // XOSC_LF -> SLCK_LF (32768 Hz)
447  break;
448  default : // (=3) RCOSC_LF
450  break;
451  }
452 
453  // Update ADI_4_AUX_ADCREF1_VTRIM with value from FCFG1
454  HWREGB( AUX_ADI4_BASE + ADI_4_AUX_O_ADCREF1 ) =
459 
460  // Sync with AON
461  SysCtrlAonSync();
462 }
static void SysCtrlAonSync(void)
Sync all accesses to the AON register interface.
Definition: sys_ctrl.h:177
#define IOC_PORT_AON_CLK32K
Definition: ioc.h:169
uint32_t OSCClockSourceGet(uint32_t ui32SrcClk)
Get the source clock settings.
Definition: osc.c:151
#define IOC_STD_INPUT
Definition: ioc.h:297
#define OSC_SRC_CLK_HF
Definition: osc.h:113
#define OSC_XOSC_HF
Definition: osc.h:118
#define OSC_SRC_CLK_LF
Definition: osc.h:115
void SetupSetAonRtcSubSecInc(uint32_t subSecInc)
Doing the tricky stuff needed to enter new RTCSUBSECINC value.
Definition: setup_rom.c:961
#define OSC_RCOSC_LF
Definition: osc.h:119
void IOCPortConfigureSet(uint32_t ui32IOId, uint32_t ui32PortId, uint32_t ui32IOConfig)
Set the configuration of an IO port.
Definition: ioc.c:96
#define IOC_HYST_ENABLE
Definition: ioc.h:220
void OSCClockSourceSet(uint32_t ui32SrcClk, uint32_t ui32Osc)
Configure the oscillator input to the a source clock.
Definition: osc.c:104
uint32_t SetupGetTrimForXoscHfFastStart(void)
Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START.
Definition: setup_rom.c:827
#define OSC_XOSC_LF
Definition: osc.h:120

Here is the call graph for this function:

uint32_t SetupGetTrimForAdcShModeEn ( uint32_t  ui32Fcfg1Revision)

Returns the trim value from FCFG1 to be used as ADC_SH_MODE_EN setting.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns the trim value from FCFG1.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

758 {
759  uint32_t getTrimForAdcShModeEnValue = 1; // Recommended default setting
760 
761  if ( ui32Fcfg1Revision >= 0x00000022 ) {
762  getTrimForAdcShModeEnValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
765  }
766 
767  return ( getTrimForAdcShModeEnValue );
768 }
uint32_t SetupGetTrimForAdcShVbufEn ( uint32_t  ui32Fcfg1Revision)

Returns the trim value from FCFG1 to be used as ADC_SH_VBUF_EN setting.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns the trim value from FCFG1.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

777 {
778  uint32_t getTrimForAdcShVbufEnValue = 1; // Recommended default setting
779 
780  if ( ui32Fcfg1Revision >= 0x00000022 ) {
781  getTrimForAdcShVbufEnValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
784  }
785 
786  return ( getTrimForAdcShVbufEnValue );
787 }
uint32_t SetupGetTrimForAmpcompCtrl ( uint32_t  ui32Fcfg1Revision)

Returns the trim value to be used for the AMPCOMP_CTRL register in OSC_DIG.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

657 {
658  uint32_t ui32TrimValue ;
659  uint32_t ui32Fcfg1Value ;
660  uint32_t ibiasOffset ;
661  uint32_t ibiasInit ;
662  uint32_t modeConf1 ;
663  int32_t deltaAdjust ;
664 
665  // Use device specific trim values located in factory configuration
666  // area. Register bit fields without trim values in the factory
667  // configuration area will be set to the value of 0.
668  ui32Fcfg1Value = HWREG( FCFG1_BASE + FCFG1_O_AMPCOMP_CTRL1 );
669 
670  ibiasOffset = ( ui32Fcfg1Value &
673  ibiasInit = ( ui32Fcfg1Value &
676 
678  // Adjust with DELTA_IBIAS_OFFSET and DELTA_IBIAS_INIT from CCFG
679  modeConf1 = HWREG( CCFG_BASE + CCFG_O_MODE_CONF_1 );
680 
681  // Both fields are signed 4-bit values. This is an assumption when doing the sign extension.
682  deltaAdjust =
685  deltaAdjust += (int32_t)ibiasOffset;
686  if ( deltaAdjust < 0 ) {
687  deltaAdjust = 0;
688  }
691  }
692  ibiasOffset = (uint32_t)deltaAdjust;
693 
694  deltaAdjust =
695  (((int32_t)( modeConf1 << ( 32 - CCFG_MODE_CONF_1_DELTA_IBIAS_INIT_W - CCFG_MODE_CONF_1_DELTA_IBIAS_INIT_S )))
697  deltaAdjust += (int32_t)ibiasInit;
698  if ( deltaAdjust < 0 ) {
699  deltaAdjust = 0;
700  }
703  }
704  ibiasInit = (uint32_t)deltaAdjust;
705  }
706  ui32TrimValue = ( ibiasOffset << DDI_0_OSC_AMPCOMPCTL_IBIAS_OFFSET_S ) |
707  ( ibiasInit << DDI_0_OSC_AMPCOMPCTL_IBIAS_INIT_S ) ;
708 
709  ui32TrimValue |= (((ui32Fcfg1Value &
713  ui32TrimValue |= (((ui32Fcfg1Value &
717  ui32TrimValue |= (((ui32Fcfg1Value &
721 
722  if ( ui32Fcfg1Revision >= 0x00000022 ) {
723  ui32TrimValue |= ((( ui32Fcfg1Value &
727  }
728 
729  return(ui32TrimValue);
730 }
uint32_t SetupGetTrimForAmpcompTh1 ( void  )

Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG.

Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

622 {
623  uint32_t ui32TrimValue;
624  uint32_t ui32Fcfg1Value;
625 
626  // Use device specific trim values located in factory configuration
627  // area. All defined register bit fields have a corresponding trim
628  // value in the factory configuration area
629  ui32Fcfg1Value = HWREG(FCFG1_BASE + FCFG1_O_AMPCOMP_TH1);
630  ui32TrimValue = (((ui32Fcfg1Value &
634  ui32TrimValue |= (((ui32Fcfg1Value &
638  ui32TrimValue |= (((ui32Fcfg1Value &
642  ui32TrimValue |= (((ui32Fcfg1Value &
646 
647  return(ui32TrimValue);
648 }
uint32_t SetupGetTrimForAmpcompTh2 ( void  )

Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG.

Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

587 {
588  uint32_t ui32TrimValue;
589  uint32_t ui32Fcfg1Value;
590 
591  // Use device specific trim value located in factory configuration
592  // area. All defined register bit fields have corresponding trim
593  // value in the factory configuration area
594  ui32Fcfg1Value = HWREG(FCFG1_BASE + FCFG1_O_AMPCOMP_TH2);
595  ui32TrimValue = ((ui32Fcfg1Value &
599  ui32TrimValue |= (((ui32Fcfg1Value &
603  ui32TrimValue |= (((ui32Fcfg1Value &
607  ui32TrimValue |= (((ui32Fcfg1Value &
611 
612  return(ui32TrimValue);
613 }
uint32_t SetupGetTrimForAnabypassValue1 ( uint32_t  ccfg_ModeConfReg)

Returns the trim value to be used for the ANABYPASS_VALUE1 register in OSC_DIG.

Parameters
ccfg_ModeConfRegis the value of the CCFG_O_MODE_CONF_1 register
Returns
Returns the trim value.

Referenced by OSC_AdjustXoscHfCapArray(), and SetupAfterColdResetWakeupFromShutDownCfg2().

471 {
472  uint32_t ui32Fcfg1Value ;
473  uint32_t ui32XoscHfRow ;
474  uint32_t ui32XoscHfCol ;
475  uint32_t ui32TrimValue ;
476 
477  // Use device specific trim values located in factory configuration
478  // area for the XOSC_HF_COLUMN_Q12 and XOSC_HF_ROW_Q12 bit fields in
479  // the ANABYPASS_VALUE1 register. Value for the other bit fields
480  // are set to 0.
481 
482  ui32Fcfg1Value = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_OSC_TOP);
483  ui32XoscHfRow = (( ui32Fcfg1Value &
486  ui32XoscHfCol = (( ui32Fcfg1Value &
489 
490  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_XOSC_CAP_MOD ) == 0 ) {
491  // XOSC_CAP_MOD = 0 means: CAP_ARRAY_DELTA is in use -> Apply compensation
492  // XOSC_CAPARRAY_DELTA is located in bit[15:8] of ccfg_ModeConfReg
493  // Note: HW_REV_DEPENDENT_IMPLEMENTATION. Field width is not given by
494  // a define and sign extension must therefore be hard coded.
495  // ( A small test program is created verifying the code lines below:
496  // Ref.: ..\test\small_standalone_test_programs\CapArrayDeltaAdjust_test.c)
497  int32_t i32CustomerDeltaAdjust =
498  (((int32_t)( ccfg_ModeConfReg << ( 32 - CCFG_MODE_CONF_XOSC_CAPARRAY_DELTA_W - CCFG_MODE_CONF_XOSC_CAPARRAY_DELTA_S )))
500 
501  while ( i32CustomerDeltaAdjust < 0 ) {
502  ui32XoscHfCol >>= 1; // COL 1 step down
503  if ( ui32XoscHfCol == 0 ) { // if COL below minimum
504  ui32XoscHfCol = 0xFFFF; // Set COL to maximum
505  ui32XoscHfRow >>= 1; // ROW 1 step down
506  if ( ui32XoscHfRow == 0 ) { // if ROW below minimum
507  ui32XoscHfRow = 1; // Set both ROW and COL
508  ui32XoscHfCol = 1; // to minimum
509  }
510  }
511  i32CustomerDeltaAdjust++;
512  }
513  while ( i32CustomerDeltaAdjust > 0 ) {
514  ui32XoscHfCol = ( ui32XoscHfCol << 1 ) | 1; // COL 1 step up
515  if ( ui32XoscHfCol > 0xFFFF ) { // if COL above maximum
516  ui32XoscHfCol = 1; // Set COL to minimum
517  ui32XoscHfRow = ( ui32XoscHfRow << 1 ) | 1; // ROW 1 step up
518  if ( ui32XoscHfRow > 0xF ) { // if ROW above maximum
519  ui32XoscHfRow = 0xF; // Set both ROW and COL
520  ui32XoscHfCol = 0xFFFF; // to maximum
521  }
522  }
523  i32CustomerDeltaAdjust--;
524  }
525  }
526 
527  ui32TrimValue = (( ui32XoscHfRow << DDI_0_OSC_ANABYPASSVAL1_XOSC_HF_ROW_Q12_S ) |
528  ( ui32XoscHfCol << DDI_0_OSC_ANABYPASSVAL1_XOSC_HF_COLUMN_Q12_S ) );
529 
530  return (ui32TrimValue);
531 }
uint32_t SetupGetTrimForDblrLoopFilterResetVoltage ( uint32_t  ui32Fcfg1Revision)

Returns the trim value from FCFG1 to be used as DBLR_LOOP_FILTER_RESET_VOLTAGE setting.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns the trim value from FCFG1.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

739 {
740  uint32_t dblrLoopFilterResetVoltageValue = 0; // Reset value
741 
742  if ( ui32Fcfg1Revision >= 0x00000020 ) {
743  dblrLoopFilterResetVoltageValue = ( HWREG( FCFG1_BASE + FCFG1_O_MISC_OTP_DATA_1 ) &
746  }
747 
748  return ( dblrLoopFilterResetVoltageValue );
749 }
uint32_t SetupGetTrimForRadcExtCfg ( uint32_t  ui32Fcfg1Revision)

Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

846 {
847  uint32_t getTrimForRadcExtCfgValue = 0x403F8000; // Recommended default setting
848  uint32_t fcfg1Data;
849 
850  if ( ui32Fcfg1Revision >= 0x00000020 ) {
851  fcfg1Data = HWREG( FCFG1_BASE + FCFG1_O_MISC_OTP_DATA_1 );
852  getTrimForRadcExtCfgValue =
853  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_HPM_IBIAS_WAIT_CNT_M ) >>
856 
857  getTrimForRadcExtCfgValue |=
858  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_LPM_IBIAS_WAIT_CNT_M ) >>
861 
862  getTrimForRadcExtCfgValue |=
863  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_IDAC_STEP_M ) >>
866  }
867 
868  return ( getTrimForRadcExtCfgValue );
869 }
uint32_t SetupGetTrimForRcOscLfIBiasTrim ( uint32_t  ui32Fcfg1Revision)

Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns the trim value from FCFG1.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

878 {
879  uint32_t trimForRcOscLfIBiasTrimValue = 0; // Default value
880 
881  if ( ui32Fcfg1Revision >= 0x00000022 ) {
882  trimForRcOscLfIBiasTrimValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
885  }
886 
887  return ( trimForRcOscLfIBiasTrimValue );
888 }
uint32_t SetupGetTrimForRcOscLfRtuneCtuneTrim ( void  )

Returns the trim value to be used for the RCOSCLF_RTUNE_TRIM and the RCOSCLF_CTUNE_TRIM bit fields in the XOSCLF_RCOSCLF_CTRL register in OSC_DIG.

Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

540 {
541  uint32_t ui32TrimValue;
542 
543  // Use device specific trim values located in factory configuration
544  // area
545  ui32TrimValue =
550 
551  ui32TrimValue |=
556 
557  return(ui32TrimValue);
558 }
uint32_t SetupGetTrimForXoscHfCtl ( uint32_t  ui32Fcfg1Revision)

Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

796 {
797  uint32_t getTrimForXoschfCtlValue = 0; // Recommended default setting
798  uint32_t fcfg1Data;
799 
800  if ( ui32Fcfg1Revision >= 0x00000020 ) {
801  fcfg1Data = HWREG( FCFG1_BASE + FCFG1_O_MISC_OTP_DATA_1 );
802  getTrimForXoschfCtlValue =
803  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_PEAK_DET_ITRIM_M ) >>
806 
807  getTrimForXoschfCtlValue |=
808  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_HP_BUF_ITRIM_M ) >>
811 
812  getTrimForXoschfCtlValue |=
813  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_LP_BUF_ITRIM_M ) >>
816  }
817 
818  return ( getTrimForXoschfCtlValue );
819 }
uint32_t SetupGetTrimForXoscHfFastStart ( void  )

Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START.

Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg3().

828 {
829  uint32_t ui32XoscHfFastStartValue ;
830 
831  // Get value from FCFG1
832  ui32XoscHfFastStartValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
835 
836  return ( ui32XoscHfFastStartValue );
837 }
uint32_t SetupGetTrimForXoscHfIbiastherm ( void  )

Returns the trim value to be used for the XOSC_HF_IBIASTHERM bit field in the ANABYPASS_VALUE2 register in OSC_DIG.

Returns
Returns the trim value.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

567 {
568  uint32_t ui32TrimValue;
569 
570  // Use device specific trim value located in factory configuration
571  // area
572  ui32TrimValue =
576 
577  return(ui32TrimValue);
578 }
uint32_t SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio ( uint32_t  ui32Fcfg1Revision)

Returns XOSCLF_REGULATOR_TRIM and XOSCLF_CMIRRWR_RATIO as one packet spanning bits [5:0] in the returned value.

Parameters
ui32Fcfg1Revisionis the value of the FCFG1_O_FCFG1_REVISION register
Returns
Returns XOSCLF_REGULATOR_TRIM and XOSCLF_CMIRRWR_RATIO as one packet.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg2().

897 {
898  uint32_t trimForXoscLfRegulatorAndCmirrwrRatioValue = 0; // Default value for both fields
899 
900  if ( ui32Fcfg1Revision >= 0x00000022 ) {
901  trimForXoscLfRegulatorAndCmirrwrRatioValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
905  }
906 
907  return ( trimForXoscLfRegulatorAndCmirrwrRatioValue );
908 }
void SetupSetAonRtcSubSecInc ( uint32_t  subSecInc)

Doing the tricky stuff needed to enter new RTCSUBSECINC value.

Parameters
subSecInc
Returns
None

Referenced by SetupAfterColdResetWakeupFromShutDownCfg3().

962 {
963  // Loading a new RTCSUBSECINC value is done in 5 steps:
964  // 1. Write bit[15:0] of new SUBSECINC value to AUX_WUC_O_RTCSUBSECINC0
965  // 2. Write bit[23:16] of new SUBSECINC value to AUX_WUC_O_RTCSUBSECINC1
967  // 4. Wait for AUX_WUC_RTCSUBSECINCCTL_UPD_ACK
970  HWREG( AUX_WUC_BASE + AUX_WUC_O_RTCSUBSECINC1 ) = (( subSecInc >> 16 ) & AUX_WUC_RTCSUBSECINC1_INC23_16_M );
971 
975 }
void SetupSetCacheModeAccordingToCcfgSetting ( void  )

Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)

Returns
None

Referenced by SetupTrimDevice().

917 {
918  // - Make sure to enable aggressive VIMS clock gating for power optimization
919  // Only for PG2 devices.
920  // - Enable cache prefetch enable as default setting
921  // (Slightly higher power consumption, but higher CPU performance)
922  // - IF ( CCFG_..._DIS_GPRAM == 1 )
923  // then: Enable cache (set cache mode = 1), even if set by ROM boot code
924  // (This is done because it's not set by boot code when running inside
925  // a debugger supporting the Halt In Boot (HIB) functionality).
926  // else: Set MODE_GPRAM if not already set (see inline comments as well)
927  uint32_t vimsCtlMode0 ;
928 
929  while ( HWREGBITW( VIMS_BASE + VIMS_O_STAT, VIMS_STAT_MODE_CHANGING_BITN )) {
930  // Do nothing - wait for an eventual ongoing mode change to complete.
931  // (There should typically be no wait time here, but need to be sure)
932  }
933 
934  // Note that Mode=0 is equal to MODE_GPRAM
935  vimsCtlMode0 = (( HWREG( VIMS_BASE + VIMS_O_CTL ) & ~VIMS_CTL_MODE_M ) | VIMS_CTL_DYN_CG_EN_M | VIMS_CTL_PREF_EN_M );
936 
937 
939  // Enable cache (and hence disable GPRAM)
940  HWREG( VIMS_BASE + VIMS_O_CTL ) = ( vimsCtlMode0 | VIMS_CTL_MODE_CACHE );
941  } else if (( HWREG( VIMS_BASE + VIMS_O_STAT ) & VIMS_STAT_MODE_M ) != VIMS_STAT_MODE_GPRAM ) {
942  // GPRAM is enabled in CCFG but not selected
943  // Note: It is recommended to go via MODE_OFF when switching to MODE_GPRAM
944  HWREG( VIMS_BASE + VIMS_O_CTL ) = ( vimsCtlMode0 | VIMS_CTL_MODE_OFF );
945  while (( HWREG( VIMS_BASE + VIMS_O_STAT ) & VIMS_STAT_MODE_M ) != VIMS_STAT_MODE_OFF ) {
946  // Do nothing - wait for an eventual mode change to complete (This goes fast).
947  }
948  HWREG( VIMS_BASE + VIMS_O_CTL ) = vimsCtlMode0;
949  } else {
950  // Correct mode, but make sure PREF_EN and DYN_CG_EN always are set
951  HWREG( VIMS_BASE + VIMS_O_CTL ) = vimsCtlMode0;
952  }
953 }
void SetupSetVddrLevel ( uint32_t  ccfg_ModeConfReg)

Set VDDR boost mode (by setting VDDR_TRIM to FCFG1..VDDR_TRIM_HH and setting VDDS_BOD to max).

Parameters
ccfg_ModeConfRegis the value of the CCFG_O_MODE_CONF_1 register
Returns
None

Referenced by SetupAfterColdResetWakeupFromShutDownCfg1().

119 {
120  uint32_t newTrimRaw ;
121  int32_t targetTrim ;
122  int32_t currentTrim ;
123  int32_t deltaTrim ;
124 
125  //
126  // VDDS_BOD_LEVEL = 1 means that boost mode is selected
127  // - Step up VDDR_TRIM to FCFG1..VDDR_TRIM_HH
128  newTrimRaw = (( HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
131 
132  targetTrim = SetupSignExtendVddrTrimValue( newTrimRaw );
133  currentTrim = SetupSignExtendVddrTrimValue((
134  HWREGB( ADI3_BASE + ADI_3_REFSYS_O_DCDCCTL0 ) &
137 
138  if ( currentTrim != targetTrim ) {
139  // Disable VDDR BOD
141 
142  while ( currentTrim != targetTrim ) {
143  deltaTrim = targetTrim - currentTrim;
144  if ( deltaTrim > 2 ) deltaTrim = 2;
145  if ( deltaTrim < -2 ) deltaTrim = -2;
146  currentTrim += deltaTrim;
147 
148  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // Wait one SCLK_LF period
149 
150  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_DCDCCTL0 * 2 )) =
151  ( ADI_3_REFSYS_DCDCCTL0_VDDR_TRIM_M << 8 ) | (( currentTrim <<
154 
155  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ) = 1; // Force SCLK_LF period wait on next read
156  }
157 
158  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // Wait one SCLK_LF period
159  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ) = 1; // Force SCLK_LF period wait on next read
160  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // Wait one more SCLK_LF period before re-enabling VDDR BOD
162  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // And finally wait for VDDR_LOSS_EN setting to propagate
163  }
164 }
static int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup_rom.h:317

Here is the call graph for this function:

static int32_t SetupSignExtendVddrTrimValue ( uint32_t  ui32VddrTrimVal)
inlinestatic

Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)

Parameters
ui32VddrTrimVal
Returns
Returns Sign extended VDDR_TRIM setting.

Referenced by SetupAfterColdResetWakeupFromShutDownCfg1(), SetupSetVddrLevel(), and SysCtrlSetRechargeBeforePowerDown().

318 {
319  // The VDDR trim value is 5 bits representing the range from -10 to +21
320  // (where -10=0x16, -1=0x1F, 0=0x00, 1=0x01 and +21=0x15)
321  int32_t i32SignedVddrVal = ui32VddrTrimVal;
322  if ( i32SignedVddrVal > 0x15 ) {
323  i32SignedVddrVal -= 0x20;
324  }
325  return ( i32SignedVddrVal );
326 }