CC13xx Driver Library
setup_rom.c
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: setup_rom.c
3 * Revised: 2016-07-07 19:12:02 +0200 (to, 07 jul 2016)
4 * Revision: 46848
5 *
6 * Description: Setup file for CC13xx/CC26xx devices.
7 *
8 * Copyright (c) 2015 - 2016, Texas Instruments Incorporated
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * 1) Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * 2) Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 // Hardware headers
40 #include <inc/hw_types.h>
41 #include <inc/hw_memmap.h>
42 #include <inc/hw_adi.h>
43 #include <inc/hw_adi_2_refsys.h>
44 #include <inc/hw_adi_3_refsys.h>
45 #include <inc/hw_adi_4_aux.h>
46 #include <inc/hw_aon_batmon.h>
47 #include <inc/hw_aon_sysctl.h>
48 #include <inc/hw_ccfg.h>
49 #include <inc/hw_ddi_0_osc.h>
50 #include <inc/hw_fcfg1.h>
51 // Driverlib headers
52 #include <driverlib/ddi.h>
53 #include <driverlib/ioc.h>
54 #include <driverlib/osc.h>
55 #include <driverlib/sys_ctrl.h>
56 #include <driverlib/setup_rom.h>
57 // ##### INCLUDE IN ROM BEGIN #####
58 // We need intrinsic functions for IAR (if used in source code)
59 #ifdef __IAR_SYSTEMS_ICC__
60 #include <intrinsics.h>
61 #endif
62 // ##### INCLUDE IN ROM END #####
63 
64 //*****************************************************************************
65 //
66 // Handle support for DriverLib in ROM:
67 // This section will undo prototype renaming made in the header file
68 //
69 //*****************************************************************************
70 #if !defined(DOXYGEN)
71  #undef SetupAfterColdResetWakeupFromShutDownCfg1
72  #define SetupAfterColdResetWakeupFromShutDownCfg1 NOROM_SetupAfterColdResetWakeupFromShutDownCfg1
73  #undef SetupAfterColdResetWakeupFromShutDownCfg2
74  #define SetupAfterColdResetWakeupFromShutDownCfg2 NOROM_SetupAfterColdResetWakeupFromShutDownCfg2
75  #undef SetupAfterColdResetWakeupFromShutDownCfg3
76  #define SetupAfterColdResetWakeupFromShutDownCfg3 NOROM_SetupAfterColdResetWakeupFromShutDownCfg3
77  #undef SetupGetTrimForAdcShModeEn
78  #define SetupGetTrimForAdcShModeEn NOROM_SetupGetTrimForAdcShModeEn
79  #undef SetupGetTrimForAdcShVbufEn
80  #define SetupGetTrimForAdcShVbufEn NOROM_SetupGetTrimForAdcShVbufEn
81  #undef SetupGetTrimForAmpcompCtrl
82  #define SetupGetTrimForAmpcompCtrl NOROM_SetupGetTrimForAmpcompCtrl
83  #undef SetupGetTrimForAmpcompTh1
84  #define SetupGetTrimForAmpcompTh1 NOROM_SetupGetTrimForAmpcompTh1
85  #undef SetupGetTrimForAmpcompTh2
86  #define SetupGetTrimForAmpcompTh2 NOROM_SetupGetTrimForAmpcompTh2
87  #undef SetupGetTrimForAnabypassValue1
88  #define SetupGetTrimForAnabypassValue1 NOROM_SetupGetTrimForAnabypassValue1
89  #undef SetupGetTrimForDblrLoopFilterResetVoltage
90  #define SetupGetTrimForDblrLoopFilterResetVoltage NOROM_SetupGetTrimForDblrLoopFilterResetVoltage
91  #undef SetupGetTrimForRadcExtCfg
92  #define SetupGetTrimForRadcExtCfg NOROM_SetupGetTrimForRadcExtCfg
93  #undef SetupGetTrimForRcOscLfIBiasTrim
94  #define SetupGetTrimForRcOscLfIBiasTrim NOROM_SetupGetTrimForRcOscLfIBiasTrim
95  #undef SetupGetTrimForRcOscLfRtuneCtuneTrim
96  #define SetupGetTrimForRcOscLfRtuneCtuneTrim NOROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
97  #undef SetupGetTrimForXoscHfCtl
98  #define SetupGetTrimForXoscHfCtl NOROM_SetupGetTrimForXoscHfCtl
99  #undef SetupGetTrimForXoscHfFastStart
100  #define SetupGetTrimForXoscHfFastStart NOROM_SetupGetTrimForXoscHfFastStart
101  #undef SetupGetTrimForXoscHfIbiastherm
102  #define SetupGetTrimForXoscHfIbiastherm NOROM_SetupGetTrimForXoscHfIbiastherm
103  #undef SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
104  #define SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio NOROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
105  #undef SetupSetCacheModeAccordingToCcfgSetting
106  #define SetupSetCacheModeAccordingToCcfgSetting NOROM_SetupSetCacheModeAccordingToCcfgSetting
107  #undef SetupSetAonRtcSubSecInc
108  #define SetupSetAonRtcSubSecInc NOROM_SetupSetAonRtcSubSecInc
109  #undef SetupSetVddrLevel
110  #define SetupSetVddrLevel NOROM_SetupSetVddrLevel
111 #endif
112 
113 //*****************************************************************************
114 //
115 // Function declarations
116 //
117 //*****************************************************************************
118 //*****************************************************************************
119 //
124 //
125 //*****************************************************************************
126 void
127 SetupSetVddrLevel( uint32_t ccfg_ModeConfReg )
128 {
129  uint32_t newTrimRaw ;
130  int32_t targetTrim ;
131  int32_t currentTrim ;
132  int32_t deltaTrim ;
133 
134 // if ( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDS_BOD_LEVEL ) {
135  //
136  // VDDS_BOD_LEVEL = 1 means that boost mode is selected
137  // - Step up VDDR_TRIM to FCFG1..VDDR_TRIM_HH
138  //
139  newTrimRaw = (( HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
142 // } else {
143 // //
144 // // VDDS_BOD_LEVEL = 0
145 // // - Step up VDDR_TRIM to FCFG1..VDDR_TRIM_H
146 // //
147 // newTrimRaw = (( HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
150 // }
151  targetTrim = SetupSignExtendVddrTrimValue( newTrimRaw );
152  currentTrim = SetupSignExtendVddrTrimValue((
153  HWREGB( ADI3_BASE + ADI_3_REFSYS_O_DCDCCTL0 ) &
156 
157  if ( currentTrim != targetTrim ) {
158  // Disable VDDR BOD
160 
161  while ( currentTrim != targetTrim ) {
162  deltaTrim = targetTrim - currentTrim;
163  if ( deltaTrim > 2 ) deltaTrim = 2;
164  if ( deltaTrim < -2 ) deltaTrim = -2;
165  currentTrim += deltaTrim;
166 
167  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // Wait one SCLK_LF period
168 
169  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_DCDCCTL0 * 2 )) =
170  ( ADI_3_REFSYS_DCDCCTL0_VDDR_TRIM_M << 8 ) | (( currentTrim <<
173 
174  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ) = 1; // Force SCLK_LF period wait on next read
175  }
176 
177  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // Wait one SCLK_LF period
178  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ) = 1; // Force SCLK_LF period wait on next read
179  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // Wait one more SCLK_LF period before re-enabling VDDR BOD
181  HWREG( AON_RTC_BASE + AON_RTC_O_SYNC ); // And finally wait for VDDR_LOSS_EN setting to propagate
182  }
183 }
184 
185 //*****************************************************************************
186 //
188 //
189 //*****************************************************************************
190 void
191 SetupAfterColdResetWakeupFromShutDownCfg1( uint32_t ccfg_ModeConfReg )
192 {
193  int32_t i32VddrSleepTrim;
194  int32_t i32VddrSleepDelta;
195 
196  //
197  // Check for CC13xx boost mode
198  // The combination VDDR_EXT_LOAD=0 and VDDS_BOD_LEVEL=1 is defined to selct boost mode
199  //
200  if ((( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDR_EXT_LOAD ) == 0 ) &&
201  (( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDS_BOD_LEVEL ) != 0 ) ) {
202  //
203  // Set VDDS_BOD trim - using masked write {MASK8:DATA8}
204  // - TRIM_VDDS_BOD is bits[7:3] of ADI3..REFSYSCTL1
205  // - Needs a positive transition on BOD_BG_TRIM_EN (bit[7] of REFSYSCTL3) to
206  // latch new VDDS BOD. Set to 0 first to guarantee a positive transition.
207  //
209 // if ( ccfg_ModeConfReg & CCFG_MODE_CONF_VDDS_BOD_LEVEL ) {
210  //
211  // VDDS_BOD_LEVEL = 1 means that boost mode is selected
212  // - Max out the VDDS_BOD trim (=VDDS_BOD_POS_31)
213  //
214  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_REFSYSCTL1 * 2 )) =
217 // } else {
218 // //
219 // // VDDS_BOD_LEVEL = 0
220 // // - Set VDDS_BOD to FCFG1..TRIMBOD_H
221 // //
222 // HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_REFSYSCTL1 * 2 )) =
224 // ((( HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
227 // }
229 
230  SetupSetVddrLevel( ccfg_ModeConfReg );
231 
232  i32VddrSleepTrim = SetupSignExtendVddrTrimValue((
233  HWREG( FCFG1_BASE + FCFG1_O_VOLT_TRIM ) &
236  } else
237  {
238  i32VddrSleepTrim = SetupSignExtendVddrTrimValue((
239  HWREG( FCFG1_BASE + FCFG1_O_LDO_TRIM ) &
242  }
243 
244  //
245  // Adjust the VDDR_TRIM_SLEEP value with value adjustable by customer (CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA)
246  // Read and sign extend VddrSleepDelta (in range -8 to +7)
247  //
248  i32VddrSleepDelta = ((((int32_t)ccfg_ModeConfReg )
249  << ( 32 - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_W - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_S ))
250  >> ( 32 - CCFG_MODE_CONF_VDDR_TRIM_SLEEP_DELTA_W ));
251  // Calculate new VDDR sleep trim
252  i32VddrSleepTrim = ( i32VddrSleepTrim + i32VddrSleepDelta + 1 );
253  if ( i32VddrSleepTrim > 21 ) i32VddrSleepTrim = 21;
254  if ( i32VddrSleepTrim < -10 ) i32VddrSleepTrim = -10;
255  // Write adjusted value using MASKED write (MASK8)
256  HWREGH( ADI3_BASE + ADI_O_MASK8B + ( ADI_3_REFSYS_O_DCDCCTL1 * 2 )) = (( ADI_3_REFSYS_DCDCCTL1_VDDR_TRIM_SLEEP_M << 8 ) |
258 
259  //
260  // 1.
261  // Do not allow DCDC to be enabled if in external regulator mode.
262  // Preventing this by setting both the RECHARGE and the ACTIVE bits bit in the CCFG_MODE_CONF copy register (ccfg_ModeConfReg).
263  //
264  // 2.
265  // Adjusted battery monitor low limit in internal regulator mode.
266  // This is done by setting AON_BATMON_FLASHPUMPP0_LOWLIM=0 in internal regulator mode.
267  //
270  } else {
272  }
273 
274  //
275  // set the RECHARGE source based upon CCFG:MODE_CONF:DCDC_RECHARGE
276  // Note: Inverse polarity
277  //
279  ((( ccfg_ModeConfReg >> CCFG_MODE_CONF_DCDC_RECHARGE_S ) & 1 ) ^ 1 );
280 
281  //
282  // set the ACTIVE source based upon CCFG:MODE_CONF:DCDC_ACTIVE
283  // Note: Inverse polarity
284  //
286  ((( ccfg_ModeConfReg >> CCFG_MODE_CONF_DCDC_ACTIVE_S ) & 1 ) ^ 1 );
287 }
288 
289 //*****************************************************************************
290 //
292 //
293 //*****************************************************************************
294 void
295 SetupAfterColdResetWakeupFromShutDownCfg2( uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg )
296 {
297  uint32_t ui32Trim;
298 
299  //
300  // Following sequence is required for using XOSCHF, if not included
301  // devices crashes when trying to switch to XOSCHF.
302  //
303  // Trim CAP settings. Get and set trim value for the ANABYPASS_VALUE1
304  // register
305  ui32Trim = SetupGetTrimForAnabypassValue1( ccfg_ModeConfReg );
307 
308  // Trim RCOSC_LF. Get and set trim values for the RCOSCLF_RTUNE_TRIM and
309  // RCOSCLF_CTUNE_TRIM fields in the XOSCLF_RCOSCLF_CTRL register.
315  ui32Trim);
316 
317  // Trim XOSCHF IBIAS THERM. Get and set trim value for the
318  // XOSCHF IBIAS THERM bit field in the ANABYPASS_VALUE2 register. Other
319  // register bit fields are set to 0.
320  ui32Trim = SetupGetTrimForXoscHfIbiastherm();
323 
324  // Trim AMPCOMP settings required before switch to XOSCHF
325  ui32Trim = SetupGetTrimForAmpcompTh2();
327  ui32Trim = SetupGetTrimForAmpcompTh1();
329  ui32Trim = SetupGetTrimForAmpcompCtrl( ui32Fcfg1Revision );
331 
332  //
333  // Set trim for DDI_0_OSC_ADCDOUBLERNANOAMPCTL_ADC_SH_MODE_EN in accordance to FCFG1 setting
334  // This is bit[5] in the DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL register
335  // Using MASK4 write + 1 => writing to bits[7:4]
336  //
337  ui32Trim = SetupGetTrimForAdcShModeEn( ui32Fcfg1Revision );
338  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL * 2 ) + 1 ) =
339  ( 0x20 | ( ui32Trim << 1 ));
340 
341  //
342  // Set trim for DDI_0_OSC_ADCDOUBLERNANOAMPCTL_ADC_SH_VBUF_EN in accordance to FCFG1 setting
343  // This is bit[4] in the DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL register
344  // Using MASK4 write + 1 => writing to bits[7:4]
345  //
346  ui32Trim = SetupGetTrimForAdcShVbufEn( ui32Fcfg1Revision );
347  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL * 2 ) + 1 ) =
348  ( 0x10 | ( ui32Trim ));
349 
350  //
351  // Set trim for the PEAK_DET_ITRIM, HP_BUF_ITRIM and LP_BUF_ITRIM bit fields
352  // in the DDI0_OSC_O_XOSCHFCTL register in accordance to FCFG1 setting.
353  // Remaining register bit fields are set to their reset values of 0.
354  //
355  ui32Trim = SetupGetTrimForXoscHfCtl(ui32Fcfg1Revision);
357 
358  //
359  // Set trim for DBLR_LOOP_FILTER_RESET_VOLTAGE in accordance to FCFG1 setting
360  // (This is bits [18:17] in DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL)
361  // (Using MASK4 write + 4 => writing to bits[19:16] => (4*4))
362  // (Assuming: DDI_0_OSC_ADCDOUBLERNANOAMPCTL_DBLR_LOOP_FILTER_RESET_VOLTAGE_S = 17 and
363  // that DDI_0_OSC_ADCDOUBLERNANOAMPCTL_DBLR_LOOP_FILTER_RESET_VOLTAGE_M = 0x00060000)
364  //
365  ui32Trim = SetupGetTrimForDblrLoopFilterResetVoltage( ui32Fcfg1Revision );
366  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_ADCDOUBLERNANOAMPCTL * 2 ) + 4 ) =
367  ( 0x60 | ( ui32Trim << 1 ));
368 
369  //
370  // Update DDI_0_OSC_ATESTCTL_ATESTLF_RCOSCLF_IBIAS_TRIM with data from
372  // This is DDI_0_OSC_O_ATESTCTL bit[7]
373  // ( DDI_0_OSC_O_ATESTCTL is currently hidden (but=0x00000020))
374  // Using MASK4 write + 1 => writing to bits[7:4]
375  //
376  ui32Trim = SetupGetTrimForRcOscLfIBiasTrim( ui32Fcfg1Revision );
377  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( 0x00000020 * 2 ) + 1 ) =
378  ( 0x80 | ( ui32Trim << 3 ));
379 
380  //
383  // This can be simplified since the registers are packed together in the same
384  // order both in FCFG1 and in the HW register.
385  // This spans DDI_0_OSC_O_LFOSCCTL bits[23:18]
386  // Using MASK8 write + 4 => writing to bits[23:16]
387  //
388  ui32Trim = SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio( ui32Fcfg1Revision );
389  HWREGH( AUX_DDI0_OSC_BASE + DDI_O_MASK8B + ( DDI_0_OSC_O_LFOSCCTL * 2 ) + 4 ) =
390  ( 0xFC00 | ( ui32Trim << 2 ));
391 
392  //
393  // Set trim the HPM_IBIAS_WAIT_CNT, LPM_IBIAS_WAIT_CNT and IDAC_STEP bit
394  // fields in the DDI0_OSC_O_RADCEXTCFG register in accordance to FCFG1 setting.
395  // Remaining register bit fields are set to their reset values of 0.
396  //
397  ui32Trim = SetupGetTrimForRadcExtCfg(ui32Fcfg1Revision);
399 
400  // Setting FORCE_KICKSTART_EN (ref. CC26_V1_BUG00261). Should also be done for PG2
401  // (This is bit 22 in DDI_0_OSC_O_CTL0)
403 }
404 
405 //*****************************************************************************
406 //
408 //
409 //*****************************************************************************
410 void
411 SetupAfterColdResetWakeupFromShutDownCfg3( uint32_t ccfg_ModeConfReg )
412 {
413  uint32_t fcfg1OscConf;
414  uint32_t ui32Trim;
415  uint32_t currentHfClock;
416  uint32_t ccfgExtLfClk;
417 
418  //
419  // Examin the XOSC_FREQ field to select 0x1=HPOSC, 0x2=48MHz XOSC, 0x3=24MHz XOSC
420  //
421  switch (( ccfg_ModeConfReg & CCFG_MODE_CONF_XOSC_FREQ_M ) >> CCFG_MODE_CONF_XOSC_FREQ_S ) {
422  case 2 :
423  // XOSC source is a 48 MHz xtal
424  // Do nothing (since this is the reset setting)
425  break;
426  case 1 :
427  // XOSC source is HPOSC (trim the HPOSC if this is a chip with HPOSC, otherwise skip trimming and default to 24 MHz XOSC)
428 
429  fcfg1OscConf = HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF );
430 
431  if (( fcfg1OscConf & FCFG1_OSC_CONF_HPOSC_OPTION ) == 0 ) {
432  // This is a HPOSC chip, apply HPOSC settings
433  // Set bit DDI_0_OSC_CTL0_HPOSC_MODE_EN (this is bit 14 in DDI_0_OSC_O_CTL0)
435 
443 
456  break;
457  }
458  // Not a HPOSC chip - fall through to default
459  default :
460  // XOSC source is a 24 MHz xtal (default)
461  // Set bit DDI_0_OSC_CTL0_XTAL_IS_24M (this is bit 31 in DDI_0_OSC_O_CTL0)
463  break;
464  }
465 
466  //
467  // Set XOSC_HF in bypass mode if CCFG is configured for external TCXO
468  // Please note that it is up to the custommer to make sure that the external clock source is up and running before XOSC_HF can be used.
469  //
472  }
473 
474  // Clear DDI_0_OSC_CTL0_CLK_LOSS_EN (ClockLossEventEnable()). This is bit 9 in DDI_0_OSC_O_CTL0.
475  // This is typically already 0 except on Lizard where it is set in ROM-boot
477 
478  // Setting DDI_0_OSC_CTL1_XOSC_HF_FAST_START according to value found in FCFG1
479  ui32Trim = SetupGetTrimForXoscHfFastStart();
480  HWREGB( AUX_DDI0_OSC_BASE + DDI_O_MASK4B + ( DDI_0_OSC_O_CTL1 * 2 )) = ( 0x30 | ui32Trim );
481 
482  //
483  // setup the LF clock based upon CCFG:MODE_CONF:SCLK_LF_OPTION
484  //
485  switch (( ccfg_ModeConfReg & CCFG_MODE_CONF_SCLK_LF_OPTION_M ) >> CCFG_MODE_CONF_SCLK_LF_OPTION_S ) {
486  case 0 : // XOSC_HF_DLF (XOSCHF/1536) -> SCLK_LF (=31250Hz)
488  SetupSetAonRtcSubSecInc( 0x8637BD );
489  break;
490  case 1 : // EXTERNAL signal -> SCLK_LF (frequency=2^38/CCFG_EXT_LF_CLK_RTC_INCREMENT)
491  // Set SCLK_LF to use the same source as SCLK_HF
492  // Can be simplified a bit since possible return values for HF matches LF settings
493  currentHfClock = OSCClockSourceGet( OSC_SRC_CLK_HF );
494  OSCClockSourceSet( OSC_SRC_CLK_LF, currentHfClock );
495  while( OSCClockSourceGet( OSC_SRC_CLK_LF ) != currentHfClock ) {
496  // Wait until switched
497  }
498  ccfgExtLfClk = HWREG( CCFG_BASE + CCFG_O_EXT_LF_CLK );
502  IOC_STD_INPUT | IOC_HYST_ENABLE ); // Route external clock to AON IOC w/hysteresis
503  // Set XOSC_LF in bypass mode to allow external 32k clock
505  // Fall through to set XOSC_LF as SCLK_LF source
506  case 2 : // XOSC_LF -> SLCK_LF (32768 Hz)
508  break;
509  default : // (=3) RCOSC_LF
511  break;
512  }
513 
514  //
515  // Update ADI_4_AUX_ADCREF1_VTRIM with value from FCFG1
516  //
517  HWREGB( AUX_ADI4_BASE + ADI_4_AUX_O_ADCREF1 ) =
522 
523  //
524  // Set ADI_4_AUX:ADC0.SMPL_CYCLE_EXP to it's default minimum value (=3)
525  // (Note: Using MASK8B requires that the bits to be modified must be within the same
526  // byte boundary which is the case for the ADI_4_AUX_ADC0_SMPL_CYCLE_EXP field)
527  //
528  HWREGH( AUX_ADI4_BASE + ADI_O_MASK8B + ( ADI_4_AUX_O_ADC0 * 2 )) =
530 
531  //
532  // Sync with AON
533  //
534  SysCtrlAonSync();
535 }
536 
537 //*****************************************************************************
538 //
540 //
541 //*****************************************************************************
542 uint32_t
543 SetupGetTrimForAnabypassValue1( uint32_t ccfg_ModeConfReg )
544 {
545  uint32_t ui32Fcfg1Value ;
546  uint32_t ui32XoscHfRow ;
547  uint32_t ui32XoscHfCol ;
548  int32_t i32CustomerDeltaAdjust ;
549  uint32_t ui32TrimValue ;
550 
551  // Use device specific trim values located in factory configuration
552  // area for the XOSC_HF_COLUMN_Q12 and XOSC_HF_ROW_Q12 bit fields in
553  // the ANABYPASS_VALUE1 register. Value for the other bit fields
554  // are set to 0.
555 
556  ui32Fcfg1Value = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_OSC_TOP);
557  ui32XoscHfRow = (( ui32Fcfg1Value &
560  ui32XoscHfCol = (( ui32Fcfg1Value &
563 
564  i32CustomerDeltaAdjust = 0;
565  if (( ccfg_ModeConfReg & CCFG_MODE_CONF_XOSC_CAP_MOD ) == 0 ) {
566  // XOSC_CAP_MOD = 0 means: CAP_ARRAY_DELTA is in use -> Apply compensation
567  // XOSC_CAPARRAY_DELTA is located in bit[15:8] of ccfg_ModeConfReg
568  // Note: HW_REV_DEPENDENT_IMPLEMENTATION. Field width is not given by
569  // a define and sign extension must therefore be hardcoded.
570  // ( A small test program is created verifying the code lines below:
571  // Ref.: ..\test\small_standalone_test_programs\CapArrayDeltaAdjust_test.c)
572  i32CustomerDeltaAdjust = ((int32_t)ccfg_ModeConfReg << 16 ) >> 24;
573 
574  while ( i32CustomerDeltaAdjust < 0 ) {
575  ui32XoscHfCol >>= 1; // COL 1 step down
576  if ( ui32XoscHfCol == 0 ) { // if COL below minimum
577  ui32XoscHfCol = 0xFFFF; // Set COL to maximum
578  ui32XoscHfRow >>= 1; // ROW 1 step down
579  if ( ui32XoscHfRow == 0 ) { // if ROW below minimum
580  ui32XoscHfRow = 1; // Set both ROW and COL
581  ui32XoscHfCol = 1; // to minimum
582  }
583  }
584  i32CustomerDeltaAdjust++;
585  }
586  while ( i32CustomerDeltaAdjust > 0 ) {
587  ui32XoscHfCol = ( ui32XoscHfCol << 1 ) | 1; // COL 1 step up
588  if ( ui32XoscHfCol > 0xFFFF ) { // if COL above maximum
589  ui32XoscHfCol = 1; // Set COL to minimum
590  ui32XoscHfRow = ( ui32XoscHfRow << 1 ) | 1; // ROW 1 step up
591  if ( ui32XoscHfRow > 0xF ) { // if ROW above maximum
592  ui32XoscHfRow = 0xF; // Set both ROW and COL
593  ui32XoscHfCol = 0xFFFF; // to maximum
594  }
595  }
596  i32CustomerDeltaAdjust--;
597  }
598  }
599 
600  ui32TrimValue = (( ui32XoscHfRow << DDI_0_OSC_ANABYPASSVAL1_XOSC_HF_ROW_Q12_S ) |
601  ( ui32XoscHfCol << DDI_0_OSC_ANABYPASSVAL1_XOSC_HF_COLUMN_Q12_S ) );
602 
603  return (ui32TrimValue);
604 }
605 
606 //*****************************************************************************
607 //
610 //
611 //*****************************************************************************
612 uint32_t
614 {
615  uint32_t ui32TrimValue;
616 
617  // Use device specific trim values located in factory configuration
618  // area
619  ui32TrimValue =
624 
625  ui32TrimValue |=
630 
631  return(ui32TrimValue);
632 }
633 
634 //*****************************************************************************
635 //
638 //
639 //*****************************************************************************
640 uint32_t
642 {
643  uint32_t ui32TrimValue;
644 
645  // Use device specific trim value located in factory configuration
646  // area
647  ui32TrimValue =
651 
652  return(ui32TrimValue);
653 }
654 
655 //*****************************************************************************
656 //
658 //
659 //*****************************************************************************
660 uint32_t
662 {
663  uint32_t ui32TrimValue;
664  uint32_t ui32Fcfg1Value;
665 
666  // Use device specific trim value located in factory configuration
667  // area. All defined register bit fields have corresponding trim
668  // value in the factory configuration area
669  ui32Fcfg1Value = HWREG(FCFG1_BASE + FCFG1_O_AMPCOMP_TH2);
670  ui32TrimValue = ((ui32Fcfg1Value &
674  ui32TrimValue |= (((ui32Fcfg1Value &
678  ui32TrimValue |= (((ui32Fcfg1Value &
682  ui32TrimValue |= (((ui32Fcfg1Value &
686 
687  return(ui32TrimValue);
688 }
689 
690 //*****************************************************************************
691 //
693 //
694 //*****************************************************************************
695 uint32_t
697 {
698  uint32_t ui32TrimValue;
699  uint32_t ui32Fcfg1Value;
700 
701  // Use device specific trim values located in factory configuration
702  // area. All defined register bit fields have a corresponding trim
703  // value in the factory configuration area
704  ui32Fcfg1Value = HWREG(FCFG1_BASE + FCFG1_O_AMPCOMP_TH1);
705  ui32TrimValue = (((ui32Fcfg1Value &
709  ui32TrimValue |= (((ui32Fcfg1Value &
713  ui32TrimValue |= (((ui32Fcfg1Value &
717  ui32TrimValue |= (((ui32Fcfg1Value &
721 
722  return(ui32TrimValue);
723 }
724 
725 //*****************************************************************************
726 //
728 //
729 //*****************************************************************************
730 uint32_t
731 SetupGetTrimForAmpcompCtrl( uint32_t ui32Fcfg1Revision )
732 {
733  uint32_t ui32TrimValue ;
734  uint32_t ui32Fcfg1Value ;
735  uint32_t ibiasOffset ;
736  uint32_t ibiasInit ;
737  uint32_t modeConf1 ;
738  int32_t deltaAdjust ;
739 
740  // Use device specific trim values located in factory configuration
741  // area. Register bit fields without trim values in the factory
742  // configuration area will be set to the value of 0.
743  ui32Fcfg1Value = HWREG( FCFG1_BASE + FCFG1_O_AMPCOMP_CTRL1 );
744 
745  ibiasOffset = ( ui32Fcfg1Value &
748  ibiasInit = ( ui32Fcfg1Value &
751 
753  // Adjust with DELTA_IBIAS_OFFSET and DELTA_IBIAS_INIT from CCFG
754  modeConf1 = HWREG( CCFG_BASE + CCFG_O_MODE_CONF_1 );
755 
756  // Both fields are signed 4-bit values. This is an assumption when doing the sign extension.
757  deltaAdjust = ((int32_t)modeConf1 << ( 32 - CCFG_MODE_CONF_1_DELTA_IBIAS_OFFSET_S - 4 )) >> 28;
758  deltaAdjust += (int32_t)ibiasOffset;
759  if ( deltaAdjust < 0 ) {
760  deltaAdjust = 0;
761  }
764  }
765  ibiasOffset = (uint32_t)deltaAdjust;
766 
767  deltaAdjust = ((int32_t)modeConf1 << ( 32 - CCFG_MODE_CONF_1_DELTA_IBIAS_INIT_S - 4 )) >> 28;
768  deltaAdjust += (int32_t)ibiasInit;
769  if ( deltaAdjust < 0 ) {
770  deltaAdjust = 0;
771  }
774  }
775  ibiasInit = (uint32_t)deltaAdjust;
776  }
777  ui32TrimValue = ( ibiasOffset << DDI_0_OSC_AMPCOMPCTL_IBIAS_OFFSET_S ) |
778  ( ibiasInit << DDI_0_OSC_AMPCOMPCTL_IBIAS_INIT_S ) ;
779 
780  ui32TrimValue |= (((ui32Fcfg1Value &
784  ui32TrimValue |= (((ui32Fcfg1Value &
788  ui32TrimValue |= (((ui32Fcfg1Value &
792 
793  if ( ui32Fcfg1Revision >= 0x00000022 ) {
794  ui32TrimValue |= ((( ui32Fcfg1Value &
798  }
799 
800  return(ui32TrimValue);
801 }
802 
803 //*****************************************************************************
804 //
806 //
807 //*****************************************************************************
808 uint32_t
809 SetupGetTrimForDblrLoopFilterResetVoltage( uint32_t ui32Fcfg1Revision )
810 {
811  uint32_t dblrLoopFilterResetVoltageValue = 0; // Reset value
812 
813  if ( ui32Fcfg1Revision >= 0x00000020 ) {
814  dblrLoopFilterResetVoltageValue = ( HWREG( FCFG1_BASE + FCFG1_O_MISC_OTP_DATA_1 ) &
817  }
818 
819  return ( dblrLoopFilterResetVoltageValue );
820 }
821 
822 //*****************************************************************************
823 //
825 //
826 //*****************************************************************************
827 uint32_t
828 SetupGetTrimForAdcShModeEn( uint32_t ui32Fcfg1Revision )
829 {
830  uint32_t getTrimForAdcShModeEnValue = 1; // Recommended default setting
831 
832  if ( ui32Fcfg1Revision >= 0x00000022 ) {
833  getTrimForAdcShModeEnValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
836  }
837 
838  return ( getTrimForAdcShModeEnValue );
839 }
840 
841 //*****************************************************************************
842 //
844 //
845 //*****************************************************************************
846 uint32_t
847 SetupGetTrimForAdcShVbufEn( uint32_t ui32Fcfg1Revision )
848 {
849  uint32_t getTrimForAdcShVbufEnValue = 1; // Recommended default setting
850 
851  if ( ui32Fcfg1Revision >= 0x00000022 ) {
852  getTrimForAdcShVbufEnValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
855  }
856 
857  return ( getTrimForAdcShVbufEnValue );
858 }
859 
860 //*****************************************************************************
861 //
863 //
864 //*****************************************************************************
865 uint32_t
866 SetupGetTrimForXoscHfCtl( uint32_t ui32Fcfg1Revision )
867 {
868  uint32_t getTrimForXoschfCtlValue = 0; // Recommended default setting
869  uint32_t fcfg1Data;
870 
871  if ( ui32Fcfg1Revision >= 0x00000020 ) {
872  fcfg1Data = HWREG( FCFG1_BASE + FCFG1_O_MISC_OTP_DATA_1 );
873  getTrimForXoschfCtlValue =
874  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_PEAK_DET_ITRIM_M ) >>
877 
878  getTrimForXoschfCtlValue |=
879  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_HP_BUF_ITRIM_M ) >>
882 
883  getTrimForXoschfCtlValue |=
884  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_LP_BUF_ITRIM_M ) >>
887  }
888 
889  return ( getTrimForXoschfCtlValue );
890 }
891 
892 //*****************************************************************************
893 //
895 //
896 //*****************************************************************************
897 uint32_t
899 {
900  uint32_t ui32XoscHfFastStartValue ;
901 
902  // Get value from FCFG1
903  ui32XoscHfFastStartValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
906 
907  return ( ui32XoscHfFastStartValue );
908 }
909 
910 //*****************************************************************************
911 //
913 //
914 //*****************************************************************************
915 uint32_t
916 SetupGetTrimForRadcExtCfg( uint32_t ui32Fcfg1Revision )
917 {
918  uint32_t getTrimForRadcExtCfgValue = 0x403F8000; // Recommended default setting
919  uint32_t fcfg1Data;
920 
921  if ( ui32Fcfg1Revision >= 0x00000020 ) {
922  fcfg1Data = HWREG( FCFG1_BASE + FCFG1_O_MISC_OTP_DATA_1 );
923  getTrimForRadcExtCfgValue =
924  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_HPM_IBIAS_WAIT_CNT_M ) >>
927 
928  getTrimForRadcExtCfgValue |=
929  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_LPM_IBIAS_WAIT_CNT_M ) >>
932 
933  getTrimForRadcExtCfgValue |=
934  ( ( ( fcfg1Data & FCFG1_MISC_OTP_DATA_1_IDAC_STEP_M ) >>
937  }
938 
939  return ( getTrimForRadcExtCfgValue );
940 }
941 
942 //*****************************************************************************
943 //
945 //
946 //*****************************************************************************
947 uint32_t
948 SetupGetTrimForRcOscLfIBiasTrim( uint32_t ui32Fcfg1Revision )
949 {
950  uint32_t trimForRcOscLfIBiasTrimValue = 0; // Default value
951 
952  if ( ui32Fcfg1Revision >= 0x00000022 ) {
953  trimForRcOscLfIBiasTrimValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
956  }
957 
958  return ( trimForRcOscLfIBiasTrimValue );
959 }
960 
961 //*****************************************************************************
962 //
965 //
966 //*****************************************************************************
967 uint32_t
969 {
970  uint32_t trimForXoscLfRegulatorAndCmirrwrRatioValue = 0; // Default value for both fields
971 
972  if ( ui32Fcfg1Revision >= 0x00000022 ) {
973  trimForXoscLfRegulatorAndCmirrwrRatioValue = ( HWREG( FCFG1_BASE + FCFG1_O_OSC_CONF ) &
977  }
978 
979  return ( trimForXoscLfRegulatorAndCmirrwrRatioValue );
980 }
981 
982 //*****************************************************************************
983 //
987 //
988 //*****************************************************************************
989 void
991 {
992  //
993  // - Make sure to enable aggressive VIMS clock gating for power optimization
994  // Only for PG2 devices.
995  // - Enable cache prefetch enable as default setting
996  // (Slightly higher power consumption, but higher CPU performance)
997  // - IF ( CCFG_..._DIS_GPRAM == 1 )
998  // then: Enable cache (set cache mode = 1), even if set by ROM boot code
999  // (This is done because it's not set by boot code when running inside
1000  // a debugger supporting the Halt In Boot (HIB) functionality).
1001  // else: Set MODE_GPRAM if not already set (see inline comments as well)
1002  //
1003  uint32_t vimsCtlMode0 ;
1004 
1005  while ( HWREGBITW( VIMS_BASE + VIMS_O_STAT, VIMS_STAT_MODE_CHANGING_BITN )) {
1006  // Do nothing - wait for an eventual ongoing mode change to complete.
1007  // (There should typically be no wait time here, but need to be sure)
1008  }
1009 
1010  //
1011  // Note that Mode=0 is equal to MODE_GPRAM
1012  //
1013  vimsCtlMode0 = (( HWREG( VIMS_BASE + VIMS_O_CTL ) & ~VIMS_CTL_MODE_M ) | VIMS_CTL_DYN_CG_EN_M | VIMS_CTL_PREF_EN_M );
1014 
1015 
1017  // Enable cache (and hence disable GPRAM)
1018  HWREG( VIMS_BASE + VIMS_O_CTL ) = ( vimsCtlMode0 | VIMS_CTL_MODE_CACHE );
1019  } else if (( HWREG( VIMS_BASE + VIMS_O_STAT ) & VIMS_STAT_MODE_M ) != VIMS_STAT_MODE_GPRAM ) {
1020  //
1021  // GPRAM is enabled in CCFG but not selected
1022  // Note: It is recommended to go via MODE_OFF when switching to MODE_GPRAM
1023  //
1024  HWREG( VIMS_BASE + VIMS_O_CTL ) = ( vimsCtlMode0 | VIMS_CTL_MODE_OFF );
1025  while (( HWREG( VIMS_BASE + VIMS_O_STAT ) & VIMS_STAT_MODE_M ) != VIMS_STAT_MODE_OFF ) {
1026  // Do nothing - wait for an eventual mode change to complete (This goes fast).
1027  }
1028  HWREG( VIMS_BASE + VIMS_O_CTL ) = vimsCtlMode0;
1029  } else {
1030  // Correct mode, but make sure PREF_EN and DYN_CG_EN always are set
1031  HWREG( VIMS_BASE + VIMS_O_CTL ) = vimsCtlMode0;
1032  }
1033 }
1034 
1035 //*****************************************************************************
1036 //
1040 //
1041 //*****************************************************************************
1042 void
1043 SetupSetAonRtcSubSecInc( uint32_t subSecInc )
1044 {
1045  //
1046  // Loading a new RTCSUBSECINC value is done in 5 steps:
1047  // 1. Write bit[15:0] of new SUBSECINC value to AUX_WUC_O_RTCSUBSECINC0
1048  // 2. Write bit[23:16] of new SUBSECINC value to AUX_WUC_O_RTCSUBSECINC1
1050  // 4. Wait for AUX_WUC_RTCSUBSECINCCTL_UPD_ACK
1052  //
1054  HWREG( AUX_WUC_BASE + AUX_WUC_O_RTCSUBSECINC1 ) = (( subSecInc >> 16 ) & AUX_WUC_RTCSUBSECINC1_INC23_16_M );
1055 
1058  HWREG( AUX_WUC_BASE + AUX_WUC_O_RTCSUBSECINCCTL ) = 0;
1059 }
static void SysCtrlAonSync(void)
Sync all accesses to the AON register interface.
Definition: sys_ctrl.h:196
#define IOC_PORT_AON_CLK32K
Definition: ioc.h:169
uint32_t SetupGetTrimForAmpcompTh1(void)
Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG.
Definition: setup_rom.c:696
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:613
uint32_t SetupGetTrimForAmpcompTh2(void)
Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG.
Definition: setup_rom.c:661
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:809
void SetupAfterColdResetWakeupFromShutDownCfg3(uint32_t ccfg_ModeConfReg)
Third part of configuration required when waking up from shutdown.
Definition: setup_rom.c:411
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:847
uint32_t OSCClockSourceGet(uint32_t ui32SrcClk)
Get the source clock settings.
Definition: osc.c:160
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.
Definition: ddi.c:131
#define IOC_STD_INPUT
Definition: ioc.h:292
uint32_t SetupGetTrimForRadcExtCfg(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG.
Definition: setup_rom.c:916
void SetupSetAonRtcSubSecInc(uint32_t subSecInc)
Doing the tricky stuff needed to enter new RTCSUBSECINC value.
Definition: setup_rom.c:1043
uint32_t SetupGetTrimForRcOscLfIBiasTrim(uint32_t ui32Fcfg1Revision)
Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM.
Definition: setup_rom.c:948
void SetupAfterColdResetWakeupFromShutDownCfg1(uint32_t ccfg_ModeConfReg)
First part of configuration required when waking up from shutdown.
Definition: setup_rom.c:191
#define OSC_SRC_CLK_HF
Definition: osc.h:112
#define OSC_XOSC_HF
Definition: osc.h:117
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:968
#define OSC_SRC_CLK_LF
Definition: osc.h:114
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:543
void SetupSetCacheModeAccordingToCcfgSetting(void)
Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)
Definition: setup_rom.c:990
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:828
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:731
#define OSC_RCOSC_LF
Definition: osc.h:118
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:216
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:127
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 SetupGetTrimForXoscHfFastStart(void)
Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START.
Definition: setup_rom.c:898
void OSCClockSourceSet(uint32_t ui32SrcClk, uint32_t ui32Osc)
Configure the oscillator input to the a source clock.
Definition: osc.c:101
void SetupAfterColdResetWakeupFromShutDownCfg2(uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg)
Second part of configuration required when waking up from shutdown.
Definition: setup_rom.c:295
uint32_t SetupGetTrimForXoscHfCtl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG.
Definition: setup_rom.c:866
#define OSC_XOSC_LF
Definition: osc.h:119
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:641
static int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup_rom.h:233