CC26xx Driver Library
setup_rom.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: setup_rom.h
3 * Revised: 2016-07-07 19:12:02 +0200 (to, 07 jul 2016)
4 * Revision: 46848
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_ROM_H__
49 #define __SETUP_ROM_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_types.h>
64 // Driverlib headers
65 // - None needed
66 
67 //*****************************************************************************
68 //
69 // Support for DriverLib in ROM:
70 // This section renames all functions that are not "static inline", so that
71 // calling these functions will default to implementation in flash. At the end
72 // of this file a second renaming will change the defaults to implementation in
73 // ROM for available functions.
74 //
75 // To force use of the implementation in flash, e.g. for debugging:
76 // - Globally: Define DRIVERLIB_NOROM at project level
77 // - Per function: Use prefix "NOROM_" when calling the function
78 //
79 //*****************************************************************************
80 #if !defined(DOXYGEN)
81  #define SetupAfterColdResetWakeupFromShutDownCfg1 NOROM_SetupAfterColdResetWakeupFromShutDownCfg1
82  #define SetupAfterColdResetWakeupFromShutDownCfg2 NOROM_SetupAfterColdResetWakeupFromShutDownCfg2
83  #define SetupAfterColdResetWakeupFromShutDownCfg3 NOROM_SetupAfterColdResetWakeupFromShutDownCfg3
84  #define SetupGetTrimForAdcShModeEn NOROM_SetupGetTrimForAdcShModeEn
85  #define SetupGetTrimForAdcShVbufEn NOROM_SetupGetTrimForAdcShVbufEn
86  #define SetupGetTrimForAmpcompCtrl NOROM_SetupGetTrimForAmpcompCtrl
87  #define SetupGetTrimForAmpcompTh1 NOROM_SetupGetTrimForAmpcompTh1
88  #define SetupGetTrimForAmpcompTh2 NOROM_SetupGetTrimForAmpcompTh2
89  #define SetupGetTrimForAnabypassValue1 NOROM_SetupGetTrimForAnabypassValue1
90  #define SetupGetTrimForDblrLoopFilterResetVoltage NOROM_SetupGetTrimForDblrLoopFilterResetVoltage
91  #define SetupGetTrimForRadcExtCfg NOROM_SetupGetTrimForRadcExtCfg
92  #define SetupGetTrimForRcOscLfIBiasTrim NOROM_SetupGetTrimForRcOscLfIBiasTrim
93  #define SetupGetTrimForRcOscLfRtuneCtuneTrim NOROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
94  #define SetupGetTrimForXoscHfCtl NOROM_SetupGetTrimForXoscHfCtl
95  #define SetupGetTrimForXoscHfFastStart NOROM_SetupGetTrimForXoscHfFastStart
96  #define SetupGetTrimForXoscHfIbiastherm NOROM_SetupGetTrimForXoscHfIbiastherm
97  #define SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio NOROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
98  #define SetupSetCacheModeAccordingToCcfgSetting NOROM_SetupSetCacheModeAccordingToCcfgSetting
99  #define SetupSetAonRtcSubSecInc NOROM_SetupSetAonRtcSubSecInc
100 #endif
101 
102 //*****************************************************************************
103 //
105 //
106 //*****************************************************************************
107 extern void SetupAfterColdResetWakeupFromShutDownCfg1( uint32_t ccfg_ModeConfReg );
108 
109 //*****************************************************************************
110 //
112 //
113 //*****************************************************************************
114 extern void SetupAfterColdResetWakeupFromShutDownCfg2( uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg );
115 
116 //*****************************************************************************
117 //
119 //
120 //*****************************************************************************
121 extern void SetupAfterColdResetWakeupFromShutDownCfg3( uint32_t ccfg_ModeConfReg );
122 
123 //*****************************************************************************
124 //
126 //
127 //*****************************************************************************
128 extern uint32_t SetupGetTrimForAdcShModeEn( uint32_t ui32Fcfg1Revision );
129 
130 //*****************************************************************************
131 //
133 //
134 //*****************************************************************************
135 extern uint32_t SetupGetTrimForAdcShVbufEn( uint32_t ui32Fcfg1Revision );
136 
137 //*****************************************************************************
138 //
140 //
141 //*****************************************************************************
142 extern uint32_t SetupGetTrimForAmpcompCtrl( uint32_t ui32Fcfg1Revision );
143 
144 //*****************************************************************************
145 //
147 //
148 //*****************************************************************************
149 extern uint32_t SetupGetTrimForAmpcompTh1( void );
150 
151 //*****************************************************************************
152 //
154 //
155 //*****************************************************************************
156 extern uint32_t SetupGetTrimForAmpcompTh2( void );
157 
158 //*****************************************************************************
159 //
161 //
162 //*****************************************************************************
163 extern uint32_t SetupGetTrimForAnabypassValue1( uint32_t ccfg_ModeConfReg );
164 
165 //*****************************************************************************
166 //
168 //
169 //*****************************************************************************
170 extern uint32_t SetupGetTrimForDblrLoopFilterResetVoltage( uint32_t ui32Fcfg1Revision );
171 
172 //*****************************************************************************
173 //
175 //
176 //*****************************************************************************
177 extern uint32_t SetupGetTrimForRadcExtCfg( uint32_t ui32Fcfg1Revision );
178 
179 //*****************************************************************************
180 //
182 //
183 //*****************************************************************************
184 extern uint32_t SetupGetTrimForRcOscLfIBiasTrim( uint32_t ui32Fcfg1Revision );
185 
186 //*****************************************************************************
187 //
190 //
191 //*****************************************************************************
192 extern uint32_t SetupGetTrimForRcOscLfRtuneCtuneTrim( void );
193 
194 //*****************************************************************************
195 //
197 //
198 //*****************************************************************************
199 extern uint32_t SetupGetTrimForXoscHfCtl( uint32_t ui32Fcfg1Revision );
200 
201 //*****************************************************************************
202 //
204 //
205 //*****************************************************************************
206 extern uint32_t SetupGetTrimForXoscHfFastStart( void );
207 
208 //*****************************************************************************
209 //
212 //
213 //*****************************************************************************
214 extern uint32_t SetupGetTrimForXoscHfIbiastherm( void );
215 
216 //*****************************************************************************
217 //
220 //
221 //*****************************************************************************
222 extern uint32_t SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio( uint32_t ui32Fcfg1Revision );
223 
224 //*****************************************************************************
225 //
229 //
230 //*****************************************************************************
231 __STATIC_INLINE int32_t
232 SetupSignExtendVddrTrimValue( uint32_t ui32VddrTrimVal )
233 {
234  //
235  // The VDDR trim value is 5 bits representing the range from -10 to +21
236  // (where -10=0x16, -1=0x1F, 0=0x00, 1=0x01 and +21=0x15)
237  //
238  int32_t i32SignedVddrVal = ui32VddrTrimVal;
239  if ( i32SignedVddrVal > 0x15 ) {
240  i32SignedVddrVal -= 0x20;
241  }
242  return ( i32SignedVddrVal );
243 }
244 
245 //*****************************************************************************
246 //
250 //
251 //*****************************************************************************
252 extern void SetupSetCacheModeAccordingToCcfgSetting( void );
253 
254 //*****************************************************************************
255 //
259 //
260 //*****************************************************************************
261 extern void SetupSetAonRtcSubSecInc( uint32_t subSecInc );
262 
263 //*****************************************************************************
264 //
268 //
269 //*****************************************************************************
270 
271 //*****************************************************************************
272 //
273 // Support for DriverLib in ROM:
274 // Redirect to implementation in ROM when available.
275 //
276 //*****************************************************************************
277 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
278  #include <driverlib/rom.h>
279  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg1
280  #undef SetupAfterColdResetWakeupFromShutDownCfg1
281  #define SetupAfterColdResetWakeupFromShutDownCfg1 ROM_SetupAfterColdResetWakeupFromShutDownCfg1
282  #endif
283  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg2
284  #undef SetupAfterColdResetWakeupFromShutDownCfg2
285  #define SetupAfterColdResetWakeupFromShutDownCfg2 ROM_SetupAfterColdResetWakeupFromShutDownCfg2
286  #endif
287  #ifdef ROM_SetupAfterColdResetWakeupFromShutDownCfg3
288  #undef SetupAfterColdResetWakeupFromShutDownCfg3
289  #define SetupAfterColdResetWakeupFromShutDownCfg3 ROM_SetupAfterColdResetWakeupFromShutDownCfg3
290  #endif
291  #ifdef ROM_SetupGetTrimForAdcShModeEn
292  #undef SetupGetTrimForAdcShModeEn
293  #define SetupGetTrimForAdcShModeEn ROM_SetupGetTrimForAdcShModeEn
294  #endif
295  #ifdef ROM_SetupGetTrimForAdcShVbufEn
296  #undef SetupGetTrimForAdcShVbufEn
297  #define SetupGetTrimForAdcShVbufEn ROM_SetupGetTrimForAdcShVbufEn
298  #endif
299  #ifdef ROM_SetupGetTrimForAmpcompCtrl
300  #undef SetupGetTrimForAmpcompCtrl
301  #define SetupGetTrimForAmpcompCtrl ROM_SetupGetTrimForAmpcompCtrl
302  #endif
303  #ifdef ROM_SetupGetTrimForAmpcompTh1
304  #undef SetupGetTrimForAmpcompTh1
305  #define SetupGetTrimForAmpcompTh1 ROM_SetupGetTrimForAmpcompTh1
306  #endif
307  #ifdef ROM_SetupGetTrimForAmpcompTh2
308  #undef SetupGetTrimForAmpcompTh2
309  #define SetupGetTrimForAmpcompTh2 ROM_SetupGetTrimForAmpcompTh2
310  #endif
311  #ifdef ROM_SetupGetTrimForAnabypassValue1
312  #undef SetupGetTrimForAnabypassValue1
313  #define SetupGetTrimForAnabypassValue1 ROM_SetupGetTrimForAnabypassValue1
314  #endif
315  #ifdef ROM_SetupGetTrimForDblrLoopFilterResetVoltage
316  #undef SetupGetTrimForDblrLoopFilterResetVoltage
317  #define SetupGetTrimForDblrLoopFilterResetVoltage ROM_SetupGetTrimForDblrLoopFilterResetVoltage
318  #endif
319  #ifdef ROM_SetupGetTrimForRadcExtCfg
320  #undef SetupGetTrimForRadcExtCfg
321  #define SetupGetTrimForRadcExtCfg ROM_SetupGetTrimForRadcExtCfg
322  #endif
323  #ifdef ROM_SetupGetTrimForRcOscLfIBiasTrim
324  #undef SetupGetTrimForRcOscLfIBiasTrim
325  #define SetupGetTrimForRcOscLfIBiasTrim ROM_SetupGetTrimForRcOscLfIBiasTrim
326  #endif
327  #ifdef ROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
328  #undef SetupGetTrimForRcOscLfRtuneCtuneTrim
329  #define SetupGetTrimForRcOscLfRtuneCtuneTrim ROM_SetupGetTrimForRcOscLfRtuneCtuneTrim
330  #endif
331  #ifdef ROM_SetupGetTrimForXoscHfCtl
332  #undef SetupGetTrimForXoscHfCtl
333  #define SetupGetTrimForXoscHfCtl ROM_SetupGetTrimForXoscHfCtl
334  #endif
335  #ifdef ROM_SetupGetTrimForXoscHfFastStart
336  #undef SetupGetTrimForXoscHfFastStart
337  #define SetupGetTrimForXoscHfFastStart ROM_SetupGetTrimForXoscHfFastStart
338  #endif
339  #ifdef ROM_SetupGetTrimForXoscHfIbiastherm
340  #undef SetupGetTrimForXoscHfIbiastherm
341  #define SetupGetTrimForXoscHfIbiastherm ROM_SetupGetTrimForXoscHfIbiastherm
342  #endif
343  #ifdef ROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
344  #undef SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
345  #define SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio ROM_SetupGetTrimForXoscLfRegulatorAndCmirrwrRatio
346  #endif
347  #ifdef ROM_SetupSetCacheModeAccordingToCcfgSetting
348  #undef SetupSetCacheModeAccordingToCcfgSetting
349  #define SetupSetCacheModeAccordingToCcfgSetting ROM_SetupSetCacheModeAccordingToCcfgSetting
350  #endif
351  #ifdef ROM_SetupSetAonRtcSubSecInc
352  #undef SetupSetAonRtcSubSecInc
353  #define SetupSetAonRtcSubSecInc ROM_SetupSetAonRtcSubSecInc
354  #endif
355 #endif
356 
357 //*****************************************************************************
358 //
359 // Mark the end of the C bindings section for C++ compilers.
360 //
361 //*****************************************************************************
362 #ifdef __cplusplus
363 }
364 #endif
365 
366 #endif // __SETUP_ROM_H__
367 
368 //*****************************************************************************
369 //
373 //
374 //*****************************************************************************
uint32_t SetupGetTrimForAmpcompTh1(void)
Returns the trim value to be used for the AMPCOMP_TH1 register in OSC_DIG.
Definition: setup_rom.c:587
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:504
uint32_t SetupGetTrimForAmpcompTh2(void)
Returns the trim value to be used for the AMPCOMP_TH2 register in OSC_DIG.
Definition: setup_rom.c:552
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:700
void SetupAfterColdResetWakeupFromShutDownCfg3(uint32_t ccfg_ModeConfReg)
Third part of configuration required when waking up from shutdown.
Definition: setup_rom.c:302
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:738
uint32_t SetupGetTrimForRadcExtCfg(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the RADCEXTCFG register in OSC_DIG.
Definition: setup_rom.c:807
void SetupSetAonRtcSubSecInc(uint32_t subSecInc)
Doing the tricky stuff needed to enter new RTCSUBSECINC value.
Definition: setup_rom.c:934
uint32_t SetupGetTrimForRcOscLfIBiasTrim(uint32_t ui32Fcfg1Revision)
Returns the FCFG1 OSC_CONF_ATESTLF_RCOSCLF_IBIAS_TRIM.
Definition: setup_rom.c:839
void SetupAfterColdResetWakeupFromShutDownCfg1(uint32_t ccfg_ModeConfReg)
First part of configuration required when waking up from shutdown.
Definition: setup_rom.c:123
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:859
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:434
void SetupSetCacheModeAccordingToCcfgSetting(void)
Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)
Definition: setup_rom.c:881
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:719
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:622
uint32_t SetupGetTrimForXoscHfFastStart(void)
Returns the trim value to be used as OSC_DIG:CTL1.XOSC_HF_FAST_START.
Definition: setup_rom.c:789
void SetupAfterColdResetWakeupFromShutDownCfg2(uint32_t ui32Fcfg1Revision, uint32_t ccfg_ModeConfReg)
Second part of configuration required when waking up from shutdown.
Definition: setup_rom.c:186
uint32_t SetupGetTrimForXoscHfCtl(uint32_t ui32Fcfg1Revision)
Returns the trim value to be used for the XOSCHFCTL register in OSC_DIG.
Definition: setup_rom.c:757
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:532
static int32_t SetupSignExtendVddrTrimValue(uint32_t ui32VddrTrimVal)
Sign extend the VDDR_TRIM setting (special format ranging from -10 to +21)
Definition: setup_rom.h:232