CC26xx 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 #endif
132 
133 //*****************************************************************************
134 //
142 //
143 //*****************************************************************************
144 extern void SetupTrimDevice( void );
145 
146 //*****************************************************************************
147 //
149 //
150 //*****************************************************************************
151 extern void SetupAfterColdResetWakeupFromShutDownCfg1( uint32_t ccfg_ModeConfReg );
152 
153 //*****************************************************************************
154 //
156 //
157 //*****************************************************************************
158 extern void SetupAfterColdResetWakeupFromShutDownCfg2( uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg );
159 
160 //*****************************************************************************
161 //
163 //
164 //*****************************************************************************
165 extern void SetupAfterColdResetWakeupFromShutDownCfg3( uint32_t ccfg_ModeConfReg );
166 
167 //*****************************************************************************
168 //
170 //
171 //*****************************************************************************
172 extern uint32_t SetupGetTrimForAdcShModeEn( uint32_t ui32Fcfg1Revision );
173 
174 //*****************************************************************************
175 //
177 //
178 //*****************************************************************************
179 extern uint32_t SetupGetTrimForAdcShVbufEn( uint32_t ui32Fcfg1Revision );
180 
181 //*****************************************************************************
182 //
184 //
185 //*****************************************************************************
186 extern uint32_t SetupGetTrimForAmpcompCtrl( uint32_t ui32Fcfg1Revision );
187 
188 //*****************************************************************************
189 //
191 //
192 //*****************************************************************************
193 extern uint32_t SetupGetTrimForAmpcompTh1( void );
194 
195 //*****************************************************************************
196 //
198 //
199 //*****************************************************************************
200 extern uint32_t SetupGetTrimForAmpcompTh2( void );
201 
202 //*****************************************************************************
203 //
205 //
206 //*****************************************************************************
207 extern uint32_t SetupGetTrimForAnabypassValue1( uint32_t ccfg_ModeConfReg );
208 
209 //*****************************************************************************
210 //
212 //
213 //*****************************************************************************
214 extern uint32_t SetupGetTrimForDblrLoopFilterResetVoltage( uint32_t ui32Fcfg1Revision );
215 
216 //*****************************************************************************
217 //
219 //
220 //*****************************************************************************
221 extern uint32_t SetupGetTrimForRadcExtCfg( uint32_t ui32Fcfg1Revision );
222 
223 //*****************************************************************************
224 //
226 //
227 //*****************************************************************************
228 extern uint32_t SetupGetTrimForRcOscLfIBiasTrim( uint32_t ui32Fcfg1Revision );
229 
230 //*****************************************************************************
231 //
234 //
235 //*****************************************************************************
236 extern uint32_t SetupGetTrimForRcOscLfRtuneCtuneTrim( void );
237 
238 //*****************************************************************************
239 //
241 //
242 //*****************************************************************************
243 extern uint32_t SetupGetTrimForXoscHfCtl( uint32_t ui32Fcfg1Revision );
244 
245 //*****************************************************************************
246 //
248 //
249 //*****************************************************************************
250 extern uint32_t SetupGetTrimForXoscHfFastStart( void );
251 
252 //*****************************************************************************
253 //
256 //
257 //*****************************************************************************
258 extern uint32_t SetupGetTrimForXoscHfIbiastherm( void );
259 
260 //*****************************************************************************
261 //
264 //
265 //*****************************************************************************
266 extern uint32_t SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio( uint32_t ui32Fcfg1Revision );
267 
268 //*****************************************************************************
269 //
273 //
274 //*****************************************************************************
275 extern int32_t SetupSignExtendVddrTrimValue( uint32_t ui32VddrTrimVal );
276 
277 //*****************************************************************************
278 //
282 //
283 //*****************************************************************************
284 extern void SetupSetCacheModeAccordingToCcfgSetting( void );
285 
286 //*****************************************************************************
287 //
291 //
292 //*****************************************************************************
293 extern void SetupSetAonRtcSubSecInc( uint32_t subSecInc );
294 
295 //*****************************************************************************
296 //
300 //
301 //*****************************************************************************
302 
303 //*****************************************************************************
304 //
305 // Support for DriverLib in ROM:
306 // Redirect to implementation in ROM when available.
307 //
308 //*****************************************************************************
309 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
310  #include <driverlib/rom.h>
311  #ifdef ROM_SetupTrimDevice
312  #undef SetupTrimDevice
313  #define SetupTrimDevice ROM_SetupTrimDevice
314  #endif
315  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg1
316  #undef SetupAfterColdResetWakeupFromShutDownCfg1
317  #define SetupAfterColdResetWakeupFromShutDownCfg1 ROM_SetupAfterColdResetWakeupFromShutDownCfg1
318  #endif
319  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg2
320  #undef SetupAfterColdResetWakeupFromShutDownCfg2
321  #define SetupAfterColdResetWakeupFromShutDownCfg2 ROM_SetupAfterColdResetWakeupFromShutDownCfg2
322  #endif
323  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg3
324  #undef SetupAfterColdResetWakeupFromShutDownCfg3
325  #define SetupAfterColdResetWakeupFromShutDownCfg3 ROM_SetupAfterColdResetWakeupFromShutDownCfg3
326  #endif
327  #ifdef ROM_SetupGetTrimForAdcShModeEn
328  #undef SetupGetTrimForAdcShModeEn
329  #define SetupGetTrimForAdcShModeEn ROM_SetupGetTrimForAdcShModeEn
330  #endif
331  #ifdef ROM_SetupGetTrimForAdcShVbufEn
332  #undef SetupGetTrimForAdcShVbufEn
333  #define SetupGetTrimForAdcShVbufEn ROM_SetupGetTrimForAdcShVbufEn
334  #endif
335  #ifdef ROM_SetupGetTrimForAmpcompCtrl
336  #undef SetupGetTrimForAmpcompCtrl
337  #define SetupGetTrimForAmpcompCtrl ROM_SetupGetTrimForAmpcompCtrl
338  #endif
339  #ifdef ROM_SetupGetTrimForAmpcompTh1
340  #undef SetupGetTrimForAmpcompTh1
341  #define SetupGetTrimForAmpcompTh1 ROM_SetupGetTrimForAmpcompTh1
342  #endif
343  #ifdef ROM_SetupGetTrimForAmpcompTh2
344  #undef SetupGetTrimForAmpcompTh2
345  #define SetupGetTrimForAmpcompTh2 ROM_SetupGetTrimForAmpcompTh2
346  #endif
347  #ifdef ROM_SetupGetTrimForAnabypassValue1
348  #undef SetupGetTrimForAnabypassValue1
349  #define SetupGetTrimForAnabypassValue1 ROM_SetupGetTrimForAnabypassValue1
350  #endif
351  #ifdef ROM_SetupGetTrimForDblrLoopFilterResetVoltage
352  #undef SetupGetTrimForDblrLoopFilterResetVoltage
353  #define SetupGetTrimForDblrLoopFilterResetVoltage ROM_SetupGetTrimForDblrLoopFilterResetVoltage
354  #endif
355  #ifdef ROM_SetupGetTrimForRadcExtCfg
356  #undef SetupGetTrimForRadcExtCfg
357  #define SetupGetTrimForRadcExtCfg ROM_SetupGetTrimForRadcExtCfg
358  #endif
359  #ifdef ROM_SetupGetTrimForRcOscLfIBiasTrim
360  #undef SetupGetTrimForRcOscLfIBiasTrim
361  #define SetupGetTrimForRcOscLfIBiasTrim ROM_SetupGetTrimForRcOscLfIBiasTrim
362  #endif
363  #ifdef ROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
364  #undef SetupGetTrimForRcOscLfRtuneCtuneTrim
365  #define SetupGetTrimForRcOscLfRtuneCtuneTrim ROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
366  #endif
367  #ifdef ROM_SetupGetTrimForXoscHfCtl
368  #undef SetupGetTrimForXoscHfCtl
369  #define SetupGetTrimForXoscHfCtl ROM_SetupGetTrimForXoscHfCtl
370  #endif
371  #ifdef ROM_SetupGetTrimForXoscHfFastStart
372  #undef SetupGetTrimForXoscHfFastStart
373  #define SetupGetTrimForXoscHfFastStart ROM_SetupGetTrimForXoscHfFastStart
374  #endif
375  #ifdef ROM_SetupGetTrimForXoscHfIbiastherm
376  #undef SetupGetTrimForXoscHfIbiastherm
377  #define SetupGetTrimForXoscHfIbiastherm ROM_SetupGetTrimForXoscHfIbiastherm
378  #endif
379  #ifdef ROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
380  #undef SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
381  #define SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio ROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
382  #endif
383  #ifdef ROM_SetupSignExtendVddrTrimValue
384  #undef SetupSignExtendVddrTrimValue
385  #define SetupSignExtendVddrTrimValue ROM_SetupSignExtendVddrTrimValue
386  #endif
387  #ifdef ROM_SetupSetCacheModeAccordingToCcfgSetting
388  #undef SetupSetCacheModeAccordingToCcfgSetting
389  #define SetupSetCacheModeAccordingToCcfgSetting ROM_SetupSetCacheModeAccordingToCcfgSetting
390  #endif
391  #ifdef ROM_SetupSetAonRtcSubSecInc
392  #undef SetupSetAonRtcSubSecInc
393  #define SetupSetAonRtcSubSecInc ROM_SetupSetAonRtcSubSecInc
394  #endif
395 #endif
396 
397 //*****************************************************************************
398 //
399 // Mark the end of the C bindings section for C++ compilers.
400 //
401 //*****************************************************************************
402 #ifdef __cplusplus
403 }
404 #endif
405 
406 #endif // __SETUP_H__
407 
408 //*****************************************************************************
409 //
413 //
414 //*****************************************************************************
uint32_t SetupGetTrimForAmpcompTh1(void)
Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG.
Definition: setup.c:896
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:813
uint32_t SetupGetTrimForAmpcompTh2(void)
Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG.
Definition: setup.c:861
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:1009
void SetupAfterColdResetWakeupFromShutDownCfg3(uint32_t ccfg_ModeConfReg)
Third part of configuration required when waking up from shutdown.
Definition: setup.c:611
uint32_t SetupGetTrimForAdcShVbufEn(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as ADC_SH_VBUF_EN setting.
Definition: setup.c:1047
uint32_t SetupGetTrimForRadcExtCfg(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG.
Definition: setup.c:1116
void SetupSetAonRtcSubSecInc(uint32_t subSecInc)
Doing the tricky stuff needed to enter new RTCSUBSECINC value.
Definition: setup.c:1264
uint32_t SetupGetTrimForRcOscLfIBiasTrim(uint32_t ui32Fcfg1Revision)
Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM.
Definition: setup.c:1148
void SetupTrimDevice(void)
Performs the necessary trim of the device which is not done in boot code.
Definition: setup.c:142
void SetupAfterColdResetWakeupFromShutDownCfg1(uint32_t ccfg_ModeConfReg)
First part of configuration required when waking up from shutdown.
Definition: setup.c:432
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:1168
int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup.c:1190
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:743
void SetupSetCacheModeAccordingToCcfgSetting(void)
Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)
Definition: setup.c:1211
uint32_t SetupGetTrimForAdcShModeEn(uint32_t ui32Fcfg1Revision)
Returns the trim value from FCFG1 to be used as ADC_SH_MODE_EN setting.
Definition: setup.c:1028
uint32_t SetupGetTrimForAmpcompCtrl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the AMPCOMP_CTRL register in OSC_DIG.
Definition: setup.c:931
uint32_t SetupGetTrimForXoscHfFastStart(void)
Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START.
Definition: setup.c:1098
void SetupAfterColdResetWakeupFromShutDownCfg2(uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg)
Second part of configuration required when waking up from shutdown.
Definition: setup.c:495
uint32_t SetupGetTrimForXoscHfCtl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG.
Definition: setup.c:1066
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:841