CC13xx Driver Library
setup.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: setup.h
3 * Revised: 2016-05-18 12:51:22 +0200 (Wed, 18 May 2016)
4 * Revision: 46398
5 *
6 * Description: Prototypes and defines for the setup API.
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 //*****************************************************************************
40 //
45 //
46 //*****************************************************************************
47 
48 #ifndef __SETUP_H__
49 #define __SETUP_H__
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 // Hardware headers
63 #include <inc/hw_memmap.h>
64 #include <inc/hw_types.h>
65 #include <inc/hw_adi.h>
66 #include <inc/hw_adi_0_rf.h>
67 #include <inc/hw_adi_1_synth.h>
68 #include <inc/hw_adi_2_refsys.h>
69 #include <inc/hw_adi_3_refsys.h>
70 #include <inc/hw_adi_4_aux.h>
71 #include <inc/hw_aon_ioc.h>
72 #include <inc/hw_aon_sysctl.h>
73 #include <inc/hw_aon_wuc.h>
74 #include <inc/hw_aux_wuc.h>
75 #include <inc/hw_ccfg.h>
76 #include <inc/hw_chip_def.h>
77 #include <inc/hw_ddi.h>
78 #include <inc/hw_flash.h>
79 #include <inc/hw_fcfg1.h>
80 #include <inc/hw_ddi_0_osc.h>
81 #include <inc/hw_prcm.h>
82 #include <inc/hw_vims.h>
83 #include <inc/hw_aon_batmon.h>
84 #include <inc/hw_aon_rtc.h>
85 // Driverlib headers
86 #include <driverlib/adi.h>
87 #include <driverlib/aon_batmon.h>
88 #include <driverlib/cpu.h>
89 #include <driverlib/chipinfo.h>
90 #include <driverlib/ddi.h>
91 #include <driverlib/ioc.h>
92 #include <driverlib/prcm.h>
93 #include <driverlib/setup.h>
94 #include <driverlib/sys_ctrl.h>
95 
96 //*****************************************************************************
97 //
98 // Support for DriverLib in ROM:
99 // This section renames all functions that are not "static inline", so that
100 // calling these functions will default to implementation in flash. At the end
101 // of this file a second renaming will change the defaults to implementation in
102 // ROM for available functions.
103 //
104 // To force use of the implementation in flash, e.g. for debugging:
105 // - Globally: Define DRIVERLIB_NOROM at project level
106 // - Per function: Use prefix "NOROM_" when calling the function
107 //
108 //*****************************************************************************
109 #if !defined(DOXYGEN)
110  #define SetupTrimDevice NOROM_SetupTrimDevice
111  #define SetupAfterColdResetWakeupFromShutDownCfg1 NOROM_SetupAfterColdResetWakeupFromShutDownCfg1
112  #define SetupAfterColdResetWakeupFromShutDownCfg2 NOROM_SetupAfterColdResetWakeupFromShutDownCfg2
113  #define SetupAfterColdResetWakeupFromShutDownCfg3 NOROM_SetupAfterColdResetWakeupFromShutDownCfg3
114  #define SetupGetTrimForAdcShModeEn NOROM_SetupGetTrimForAdcShModeEn
115  #define SetupGetTrimForAdcShVbufEn NOROM_SetupGetTrimForAdcShVbufEn
116  #define SetupGetTrimForAmpcompCtrl NOROM_SetupGetTrimForAmpcompCtrl
117  #define SetupGetTrimForAmpcompTh1 NOROM_SetupGetTrimForAmpcompTh1
118  #define SetupGetTrimForAmpcompTh2 NOROM_SetupGetTrimForAmpcompTh2
119  #define SetupGetTrimForAnabypassValue1 NOROM_SetupGetTrimForAnabypassValue1
120  #define SetupGetTrimForDblrLoopFilterResetVoltage NOROM_SetupGetTrimForDblrLoopFilterResetVoltage
121  #define SetupGetTrimForRadcExtCfg NOROM_SetupGetTrimForRadcExtCfg
122  #define SetupGetTrimForRcOscLfIBiasTrim NOROM_SetupGetTrimForRcOscLfIBiasTrim
123  #define SetupGetTrimForRcOscLfRtuneCtuneTrim NOROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
124  #define SetupGetTrimForXoscHfCtl NOROM_SetupGetTrimForXoscHfCtl
125  #define SetupGetTrimForXoscHfFastStart NOROM_SetupGetTrimForXoscHfFastStart
126  #define SetupGetTrimForXoscHfIbiastherm NOROM_SetupGetTrimForXoscHfIbiastherm
127  #define SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio NOROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
128  #define SetupSignExtendVddrTrimValue NOROM_SetupSignExtendVddrTrimValue
129  #define SetupSetCacheModeAccordingToCcfgSetting NOROM_SetupSetCacheModeAccordingToCcfgSetting
130  #define SetupSetAonRtcSubSecInc NOROM_SetupSetAonRtcSubSecInc
131  #define SetupSetVddrLevel NOROM_SetupSetVddrLevel
132 #endif
133 
134 //*****************************************************************************
135 //
143 //
144 //*****************************************************************************
145 extern void SetupTrimDevice( void );
146 
147 //*****************************************************************************
148 //
150 //
151 //*****************************************************************************
152 extern void SetupAfterColdResetWakeupFromShutDownCfg1( uint32_t ccfg_ModeConfReg );
153 
154 //*****************************************************************************
155 //
157 //
158 //*****************************************************************************
159 extern void SetupAfterColdResetWakeupFromShutDownCfg2( uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg );
160 
161 //*****************************************************************************
162 //
164 //
165 //*****************************************************************************
166 extern void SetupAfterColdResetWakeupFromShutDownCfg3( uint32_t ccfg_ModeConfReg );
167 
168 //*****************************************************************************
169 //
171 //
172 //*****************************************************************************
173 extern uint32_t SetupGetTrimForAdcShModeEn( uint32_t ui32Fcfg1Revision );
174 
175 //*****************************************************************************
176 //
178 //
179 //*****************************************************************************
180 extern uint32_t SetupGetTrimForAdcShVbufEn( uint32_t ui32Fcfg1Revision );
181 
182 //*****************************************************************************
183 //
185 //
186 //*****************************************************************************
187 extern uint32_t SetupGetTrimForAmpcompCtrl( uint32_t ui32Fcfg1Revision );
188 
189 //*****************************************************************************
190 //
192 //
193 //*****************************************************************************
194 extern uint32_t SetupGetTrimForAmpcompTh1( void );
195 
196 //*****************************************************************************
197 //
199 //
200 //*****************************************************************************
201 extern uint32_t SetupGetTrimForAmpcompTh2( void );
202 
203 //*****************************************************************************
204 //
206 //
207 //*****************************************************************************
208 extern uint32_t SetupGetTrimForAnabypassValue1( uint32_t ccfg_ModeConfReg );
209 
210 //*****************************************************************************
211 //
213 //
214 //*****************************************************************************
215 extern uint32_t SetupGetTrimForDblrLoopFilterResetVoltage( uint32_t ui32Fcfg1Revision );
216 
217 //*****************************************************************************
218 //
220 //
221 //*****************************************************************************
222 extern uint32_t SetupGetTrimForRadcExtCfg( uint32_t ui32Fcfg1Revision );
223 
224 //*****************************************************************************
225 //
227 //
228 //*****************************************************************************
229 extern uint32_t SetupGetTrimForRcOscLfIBiasTrim( uint32_t ui32Fcfg1Revision );
230 
231 //*****************************************************************************
232 //
235 //
236 //*****************************************************************************
237 extern uint32_t SetupGetTrimForRcOscLfRtuneCtuneTrim( void );
238 
239 //*****************************************************************************
240 //
242 //
243 //*****************************************************************************
244 extern uint32_t SetupGetTrimForXoscHfCtl( uint32_t ui32Fcfg1Revision );
245 
246 //*****************************************************************************
247 //
249 //
250 //*****************************************************************************
251 extern uint32_t SetupGetTrimForXoscHfFastStart( void );
252 
253 //*****************************************************************************
254 //
257 //
258 //*****************************************************************************
259 extern uint32_t SetupGetTrimForXoscHfIbiastherm( void );
260 
261 //*****************************************************************************
262 //
265 //
266 //*****************************************************************************
267 extern uint32_t SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio( uint32_t ui32Fcfg1Revision );
268 
269 //*****************************************************************************
270 //
274 //
275 //*****************************************************************************
276 extern int32_t SetupSignExtendVddrTrimValue( uint32_t ui32VddrTrimVal );
277 
278 //*****************************************************************************
279 //
283 //
284 //*****************************************************************************
285 extern void SetupSetCacheModeAccordingToCcfgSetting( void );
286 
287 //*****************************************************************************
288 //
292 //
293 //*****************************************************************************
294 extern void SetupSetAonRtcSubSecInc( uint32_t subSecInc );
295 
296 //*****************************************************************************
297 //
301 //
302 //*****************************************************************************
303 extern void SetupSetVddrLevel( uint32_t ccfg_ModeConfReg );
304 
305 //*****************************************************************************
306 //
307 // Support for DriverLib in ROM:
308 // Redirect to implementation in ROM when available.
309 //
310 //*****************************************************************************
311 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
312  #include <driverlib/rom.h>
313  #ifdef ROM_SetupTrimDevice
314  #undef SetupTrimDevice
315  #define SetupTrimDevice ROM_SetupTrimDevice
316  #endif
317  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg1
318  #undef SetupAfterColdResetWakeupFromShutDownCfg1
319  #define SetupAfterColdResetWakeupFromShutDownCfg1 ROM_SetupAfterColdResetWakeupFromShutDownCfg1
320  #endif
321  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg2
322  #undef SetupAfterColdResetWakeupFromShutDownCfg2
323  #define SetupAfterColdResetWakeupFromShutDownCfg2 ROM_SetupAfterColdResetWakeupFromShutDownCfg2
324  #endif
325  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg3
326  #undef SetupAfterColdResetWakeupFromShutDownCfg3
327  #define SetupAfterColdResetWakeupFromShutDownCfg3 ROM_SetupAfterColdResetWakeupFromShutDownCfg3
328  #endif
329  #ifdef ROM_SetupGetTrimForAdcShModeEn
330  #undef SetupGetTrimForAdcShModeEn
331  #define SetupGetTrimForAdcShModeEn ROM_SetupGetTrimForAdcShModeEn
332  #endif
333  #ifdef ROM_SetupGetTrimForAdcShVbufEn
334  #undef SetupGetTrimForAdcShVbufEn
335  #define SetupGetTrimForAdcShVbufEn ROM_SetupGetTrimForAdcShVbufEn
336  #endif
337  #ifdef ROM_SetupGetTrimForAmpcompCtrl
338  #undef SetupGetTrimForAmpcompCtrl
339  #define SetupGetTrimForAmpcompCtrl ROM_SetupGetTrimForAmpcompCtrl
340  #endif
341  #ifdef ROM_SetupGetTrimForAmpcompTh1
342  #undef SetupGetTrimForAmpcompTh1
343  #define SetupGetTrimForAmpcompTh1 ROM_SetupGetTrimForAmpcompTh1
344  #endif
345  #ifdef ROM_SetupGetTrimForAmpcompTh2
346  #undef SetupGetTrimForAmpcompTh2
347  #define SetupGetTrimForAmpcompTh2 ROM_SetupGetTrimForAmpcompTh2
348  #endif
349  #ifdef ROM_SetupGetTrimForAnabypassValue1
350  #undef SetupGetTrimForAnabypassValue1
351  #define SetupGetTrimForAnabypassValue1 ROM_SetupGetTrimForAnabypassValue1
352  #endif
353  #ifdef ROM_SetupGetTrimForDblrLoopFilterResetVoltage
354  #undef SetupGetTrimForDblrLoopFilterResetVoltage
355  #define SetupGetTrimForDblrLoopFilterResetVoltage ROM_SetupGetTrimForDblrLoopFilterResetVoltage
356  #endif
357  #ifdef ROM_SetupGetTrimForRadcExtCfg
358  #undef SetupGetTrimForRadcExtCfg
359  #define SetupGetTrimForRadcExtCfg ROM_SetupGetTrimForRadcExtCfg
360  #endif
361  #ifdef ROM_SetupGetTrimForRcOscLfIBiasTrim
362  #undef SetupGetTrimForRcOscLfIBiasTrim
363  #define SetupGetTrimForRcOscLfIBiasTrim ROM_SetupGetTrimForRcOscLfIBiasTrim
364  #endif
365  #ifdef ROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
366  #undef SetupGetTrimForRcOscLfRtuneCtuneTrim
367  #define SetupGetTrimForRcOscLfRtuneCtuneTrim ROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
368  #endif
369  #ifdef ROM_SetupGetTrimForXoscHfCtl
370  #undef SetupGetTrimForXoscHfCtl
371  #define SetupGetTrimForXoscHfCtl ROM_SetupGetTrimForXoscHfCtl
372  #endif
373  #ifdef ROM_SetupGetTrimForXoscHfFastStart
374  #undef SetupGetTrimForXoscHfFastStart
375  #define SetupGetTrimForXoscHfFastStart ROM_SetupGetTrimForXoscHfFastStart
376  #endif
377  #ifdef ROM_SetupGetTrimForXoscHfIbiastherm
378  #undef SetupGetTrimForXoscHfIbiastherm
379  #define SetupGetTrimForXoscHfIbiastherm ROM_SetupGetTrimForXoscHfIbiastherm
380  #endif
381  #ifdef ROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
382  #undef SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
383  #define SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio ROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
384  #endif
385  #ifdef ROM_SetupSignExtendVddrTrimValue
386  #undef SetupSignExtendVddrTrimValue
387  #define SetupSignExtendVddrTrimValue ROM_SetupSignExtendVddrTrimValue
388  #endif
389  #ifdef ROM_SetupSetCacheModeAccordingToCcfgSetting
390  #undef SetupSetCacheModeAccordingToCcfgSetting
391  #define SetupSetCacheModeAccordingToCcfgSetting ROM_SetupSetCacheModeAccordingToCcfgSetting
392  #endif
393  #ifdef ROM_SetupSetAonRtcSubSecInc
394  #undef SetupSetAonRtcSubSecInc
395  #define SetupSetAonRtcSubSecInc ROM_SetupSetAonRtcSubSecInc
396  #endif
397  #ifdef ROM_SetupSetVddrLevel
398  #undef SetupSetVddrLevel
399  #define SetupSetVddrLevel ROM_SetupSetVddrLevel
400  #endif
401 #endif
402 
403 //*****************************************************************************
404 //
405 // Mark the end of the C bindings section for C++ compilers.
406 //
407 //*****************************************************************************
408 #ifdef __cplusplus
409 }
410 #endif
411 
412 #endif // __SETUP_H__
413 
414 //*****************************************************************************
415 //
419 //
420 //*****************************************************************************
uint32_t SetupGetTrimForAmpcompTh1(void)
Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG.
Definition: setup.c:936
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.c:853
uint32_t SetupGetTrimForAmpcompTh2(void)
Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG.
Definition: setup.c:901
uint32_t SetupGetTrimForDblrLoopFilterResetVoltage(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as DBLR_LOOP_FILTER_RESET_VOLTAGE setting.
Definition: setup.c:1049
void SetupAfterColdResetWakeupFromShutDownCfg3(uint32_t ccfg_ModeConfReg)
Third part of configuration required when waking up from shutdown.
Definition: setup.c:651
uint32_t SetupGetTrimForAdcShVbufEn(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as ADC_SH_VBUF_EN setting.
Definition: setup.c:1087
uint32_t SetupGetTrimForRadcExtCfg(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG.
Definition: setup.c:1156
void SetupSetAonRtcSubSecInc(uint32_t subSecInc)
Doing the tricky stuff needed to enter new RTCSUBSECINC value.
Definition: setup.c:1304
uint32_t SetupGetTrimForRcOscLfIBiasTrim(uint32_t ui32Fcfg1Revision)
Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM.
Definition: setup.c:1188
void SetupTrimDevice(void)
Performs the necessary trim of the device which is not done in boot code.
Definition: setup.c:144
void SetupAfterColdResetWakeupFromShutDownCfg1(uint32_t ccfg_ModeConfReg)
First part of configuration required when waking up from shutdown.
Definition: setup.c:431
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.c:1208
int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup.c:1230
uint32_t SetupGetTrimForAnabypassValue1(uint32_t ccfg_ModeConfReg)
Returns the trim value to be used for the ANABYPASS_VALUE1 register in OSC_DIG.
Definition: setup.c:783
void SetupSetCacheModeAccordingToCcfgSetting(void)
Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)
Definition: setup.c:1251
uint32_t SetupGetTrimForAdcShModeEn(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as ADC_SH_MODE_EN setting.
Definition: setup.c:1068
uint32_t SetupGetTrimForAmpcompCtrl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the AMPCOMP_CTRL register in OSC_DIG.
Definition: setup.c:971
void SetupSetVddrLevel(uint32_t ccfg_ModeConfReg)
Set VDDR boost mode.
Definition: setup.c:1331
uint32_t SetupGetTrimForXoscHfFastStart(void)
Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START.
Definition: setup.c:1138
void SetupAfterColdResetWakeupFromShutDownCfg2(uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg)
Second part of configuration required when waking up from shutdown.
Definition: setup.c:535
uint32_t SetupGetTrimForXoscHfCtl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG.
Definition: setup.c:1106
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.c:881