rflib
cc13x2_cc26x2/driverlib/rfc.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: rfc.h
3 * Revised: 2018-08-08 14:03:25 +0200 (Wed, 08 Aug 2018)
4 * Revision: 52338
5 *
6 * Description: Defines and prototypes for the RF Core.
7 *
8 * Copyright (c) 2015 - 2017, 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 //
43 //
44 //*****************************************************************************
45 
46 #ifndef __RFC_H__
47 #define __RFC_H__
48 
49 //*****************************************************************************
50 //
51 // If building with a C++ compiler, make all of the definitions in this header
52 // have a C binding.
53 //
54 //*****************************************************************************
55 #ifdef __cplusplus
56 extern "C"
57 {
58 #endif
59 
60 #include <stdbool.h>
61 #include <stdint.h>
62 #include <ti/devices/DeviceFamily.h>
63 #include DeviceFamily_constructPath(inc/hw_types.h)
64 #include DeviceFamily_constructPath(inc/hw_memmap.h)
65 #include DeviceFamily_constructPath(inc/hw_rfc_pwr.h)
66 #include DeviceFamily_constructPath(inc/hw_rfc_dbell.h)
67 #include DeviceFamily_constructPath(inc/hw_fcfg1.h)
68 #include DeviceFamily_constructPath(inc/hw_adi_3_refsys.h)
69 #include DeviceFamily_constructPath(inc/hw_adi.h)
70 #include DeviceFamily_constructPath(inc/hw_prcm.h)
71 #include "rf_common_cmd.h"
72 #include "rf_prop_cmd.h"
73 #include "rf_ble_cmd.h"
74 
75 // Definition of RFTRIM container
76 typedef struct {
77  uint32_t configIfAdc;
78  uint32_t configRfFrontend;
79  uint32_t configSynth;
80  uint32_t configMiscAdc;
81 } rfTrim_t;
82 
83 // Definition of maximum search depth used by the RFCOverrideUpdate function
84 #define RFC_MAX_SEARCH_DEPTH 5
85 #define RFC_IEEE_CMD_BG_ADDRESS 0x21000160
86 #define RFC_IEEE_CMD_BG_IEEE_RX_O_CAP_TIME 24
87 #define RFC_PA_TYPE_ADDRESS 0x21000385
88 #define RFC_PA_TYPE_MASK 0x04
89 #define RFC_PA_GAIN_ADDRESS 0x21000398
90 #define RFC_PA_GAIN_MASK 0x003FFFFF
91 #define RFC_FE_MODE_ESCAPE_VALUE 0xFF
92 #define RFC_FE_OVERRIDE_ADDRESS 0x0703
93 #define RFC_FE_OVERRIDE_MASK 0x0000FFFF
94 
95 //*****************************************************************************
96 //
97 // Support for DriverLib in ROM:
98 // This section renames all functions that are not "static inline", so that
99 // calling these functions will default to implementation in flash. At the end
100 // of this file a second renaming will change the defaults to implementation in
101 // ROM for available functions.
102 //
103 // To force use of the implementation in flash, e.g. for debugging:
104 // - Globally: Define DRIVERLIB_NOROM at project level
105 // - Per function: Use prefix "NOROM_" when calling the function
106 //
107 //*****************************************************************************
108 #if !defined(DOXYGEN)
109  #define RFCCpeIntGetAndClear NOROM_RFCCpeIntGetAndClear
110  #define RFCDoorbellSendTo NOROM_RFCDoorbellSendTo
111  #define RFCSynthPowerDown NOROM_RFCSynthPowerDown
112  #define RFCCpePatchReset NOROM_RFCCpePatchReset
113  #define RFCOverrideSearch NOROM_RFCOverrideSearch
114  #define RFCOverrideUpdate NOROM_RFCOverrideUpdate
115  #define RFCHwIntGetAndClear NOROM_RFCHwIntGetAndClear
116  #define RFCAnaDivTxOverride NOROM_RFCAnaDivTxOverride
117 #endif
118 
119 //*****************************************************************************
120 //
121 // API Functions and prototypes
122 //
123 //*****************************************************************************
124 
125 //*****************************************************************************
126 //
134 //
135 //*****************************************************************************
136 __STATIC_INLINE void
138 {
139  // Enable basic clocks to get the CPE run
140  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RFC_PWR_PWMCLKEN_CPERAM
141  | RFC_PWR_PWMCLKEN_CPE
142  | RFC_PWR_PWMCLKEN_RFC;
143 }
144 
145 
146 //*****************************************************************************
147 //
159 //
160 //*****************************************************************************
161 __STATIC_INLINE void
163 {
164  // Disable all clocks
165  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = 0x0;
166 }
167 
168 
169 //*****************************************************************************
170 //
172 //
173 //*****************************************************************************
174 __STATIC_INLINE void
175 RFCCpeIntClear(uint32_t ui32Mask)
176 {
177  // Clear the masked pending interrupts.
178  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) = ~ui32Mask;
179 }
180 
181 
182 //*****************************************************************************
183 //
185 //
186 //*****************************************************************************
187 __STATIC_INLINE void
188 RFCHwIntClear(uint32_t ui32Mask)
189 {
190  // Clear the masked pending interrupts.
191  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) = ~ui32Mask;
192 }
193 
194 
195 //*****************************************************************************
196 //
198 //
199 //*****************************************************************************
200 __STATIC_INLINE void
201 RFCCpe0IntSelect(uint32_t ui32Mask)
202 {
203  // Multiplex RF Core interrupts to CPE0 IRQ.
204  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) &= ~ui32Mask;
205 }
206 
207 
208 //*****************************************************************************
209 //
211 //
212 //*****************************************************************************
213 __STATIC_INLINE void
214 RFCCpe1IntSelect(uint32_t ui32Mask)
215 {
216  // Multiplex RF Core interrupts to CPE1 IRQ.
217  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) |= ui32Mask;
218 }
219 
220 
221 //*****************************************************************************
222 //
224 //
225 //*****************************************************************************
226 __STATIC_INLINE void
227 RFCCpeIntEnable(uint32_t ui32Mask)
228 {
229  // Enable CPE interrupts from RF Core.
230  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) |= ui32Mask;
231 }
232 
233 
234 //*****************************************************************************
235 //
237 //
238 //*****************************************************************************
239 __STATIC_INLINE void
240 RFCCpe0IntSelectClearEnable(uint32_t ui32Mask)
241 {
242  // Multiplex RF Core interrupts to CPE0 IRQ.
243  RFCCpe0IntSelect(ui32Mask);
244 
245  // Clear the masked interrupts.
246  RFCCpeIntClear(ui32Mask);
247 
248  // Enable the masked interrupts.
249  RFCCpeIntEnable(ui32Mask);
250 }
251 
252 
253 //*****************************************************************************
254 //
256 //
257 //*****************************************************************************
258 __STATIC_INLINE void
259 RFCCpe1IntSelectClearEnable(uint32_t ui32Mask)
260 {
261  // Multiplex RF Core interrupts to CPE1 IRQ.
262  RFCCpe1IntSelect(ui32Mask);
263 
264  // Clear the masked interrupts.
265  RFCCpeIntClear(ui32Mask);
266 
267  // Enable the masked interrupts.
268  RFCCpeIntEnable(ui32Mask);
269 }
270 
271 
272 //*****************************************************************************
273 //
275 //
276 //*****************************************************************************
277 __STATIC_INLINE void
278 RFCHwIntEnable(uint32_t ui32Mask)
279 {
280  // Enable the masked interrupts
281  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) |= ui32Mask;
282 }
283 
284 
285 //*****************************************************************************
286 //
288 //
289 //*****************************************************************************
290 __STATIC_INLINE void
291 RFCCpeIntDisable(uint32_t ui32Mask)
292 {
293  // Disable the masked interrupts
294  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) &= ~ui32Mask;
295 }
296 
297 
298 //*****************************************************************************
299 //
301 //
302 //*****************************************************************************
303 __STATIC_INLINE void
304 RFCHwIntDisable(uint32_t ui32Mask)
305 {
306  // Disable the masked interrupts
307  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) &= ~ui32Mask;
308 }
309 
310 
311 //*****************************************************************************
312 //
314 //
315 //*****************************************************************************
316 extern uint32_t RFCCpeIntGetAndClear(uint32_t ui32Mask);
317 
318 
319 //*****************************************************************************
320 //
322 //
323 //*****************************************************************************
324 __STATIC_INLINE void
326 {
327  // Clear any pending interrupts.
328  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0x0;
329 }
330 
331 
332 //*****************************************************************************
333 //
335 //
336 //*****************************************************************************
337 extern uint32_t RFCDoorbellSendTo(uint32_t pOp);
338 
339 
340 //*****************************************************************************
341 //
343 //
344 //*****************************************************************************
345 extern void RFCSynthPowerDown(void);
346 
347 
348 //*****************************************************************************
349 //
351 //
352 //*****************************************************************************
353 extern void RFCCpePatchReset(void);
354 
355 
356 //*****************************************************************************
357 //
358 // Function to search an override list for the provided pattern within the search depth.
359 //
360 //*****************************************************************************
361 extern uint8_t RFCOverrideSearch(const uint32_t *pOverride, const uint32_t pattern, const uint32_t mask, const uint8_t searchDepth);
362 
363 
364 //*****************************************************************************
365 //
367 //
368 //*****************************************************************************
369 extern uint8_t RFCOverrideUpdate(rfc_radioOp_t *pOpSetup, uint32_t *pParams);
370 
371 
372 //*****************************************************************************
373 //
375 //
376 //*****************************************************************************
377 extern uint32_t RFCHwIntGetAndClear(uint32_t ui32Mask);
378 
379 
380 //*****************************************************************************
381 //
383 //
384 //*****************************************************************************
385 __STATIC_INLINE bool
387 {
388  return (bool)(HWREGB(RFC_PA_TYPE_ADDRESS) & RFC_PA_TYPE_MASK);
389 }
390 
391 //*****************************************************************************
392 //
394 //
395 //*****************************************************************************
396 __STATIC_INLINE uint32_t
398 {
399  return (HWREG(RFC_PA_GAIN_ADDRESS) & RFC_PA_GAIN_MASK);
400 }
401 
402 //*****************************************************************************
403 //
405 //
406 //*****************************************************************************
407 __STATIC_INLINE uint32_t
409 {
410  return (HWREG(PRCM_BASE + PRCM_O_PDCTL1RFC) |
411  HWREG(PRCM_BASE + PRCM_O_PDSTAT0RFC));
412 }
413 
414 //*****************************************************************************************
415 //
418 //
419 //*****************************************************************************************
420 __STATIC_INLINE uint32_t
422 {
424 }
425 
426 //*****************************************************************************
427 //
429 //
430 //*****************************************************************************
431 extern uint32_t RFCAnaDivTxOverride(uint8_t loDivider, uint8_t frontEndMode);
432 
433 
434 //*****************************************************************************
435 //
436 // Support for DriverLib in ROM:
437 // Redirect to implementation in ROM when available.
438 //
439 //*****************************************************************************
440 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
441  #include DeviceFamily_constructPath(driverlib/rom.h)
442  #ifdef ROM_RFCCpeIntGetAndClear
443  #undef RFCCpeIntGetAndClear
444  #define RFCCpeIntGetAndClear ROM_RFCCpeIntGetAndClear
445  #endif
446  #ifdef ROM_RFCDoorbellSendTo
447  #undef RFCDoorbellSendTo
448  #define RFCDoorbellSendTo ROM_RFCDoorbellSendTo
449  #endif
450  #ifdef ROM_RFCSynthPowerDown
451  #undef RFCSynthPowerDown
452  #define RFCSynthPowerDown ROM_RFCSynthPowerDown
453  #endif
454  #ifdef ROM_RFCCpePatchReset
455  #undef RFCCpePatchReset
456  #define RFCCpePatchReset ROM_RFCCpePatchReset
457  #endif
458  #ifdef ROM_RFCOverrideSearch
459  #undef RFCOverrideSearch
460  #define RFCOverrideSearch ROM_RFCOverrideSearch
461  #endif
462  #ifdef ROM_RFCOverrideUpdate
463  #undef RFCOverrideUpdate
464  #define RFCOverrideUpdate ROM_RFCOverrideUpdate
465  #endif
466  #ifdef ROM_RFCHwIntGetAndClear
467  #undef RFCHwIntGetAndClear
468  #define RFCHwIntGetAndClear ROM_RFCHwIntGetAndClear
469  #endif
470  #ifdef ROM_RFCAnaDivTxOverride
471  #undef RFCAnaDivTxOverride
472  #define RFCAnaDivTxOverride ROM_RFCAnaDivTxOverride
473  #endif
474 #endif
475 
476 //*****************************************************************************
477 //
478 // Mark the end of the C bindings section for C++ compilers.
479 //
480 //*****************************************************************************
481 #ifdef __cplusplus
482 }
483 #endif
484 
485 #endif // __RFC_H__
486 
487 //*****************************************************************************
488 //
491 //
492 //*****************************************************************************
__STATIC_INLINE void RFCHwIntDisable(uint32_t ui32Mask)
Disable HW interrupt sources.
Definition: cc13x2_cc26x2/driverlib/rfc.h:304
#define RFCCpePatchReset
Definition: cc13x2_cc26x2/driverlib/rfc.h:112
uint32_t configSynth
Definition: cc13x2_cc26x2/driverlib/rfc.h:79
__STATIC_INLINE uint32_t RFCGetIeeeRxCaptureTime(void)
Definition: cc13x2_cc26x2/driverlib/rfc.h:421
__STATIC_INLINE void RFCHwIntClear(uint32_t ui32Mask)
Clear CPE interrupt flags.
Definition: cc13x2_cc26x2/driverlib/rfc.h:188
#define RFCOverrideSearch
Definition: cc13x2_cc26x2/driverlib/rfc.h:113
#define RFCAnaDivTxOverride
Definition: cc13x2_cc26x2/driverlib/rfc.h:116
#define RFC_PA_TYPE_ADDRESS
Definition: cc13x2_cc26x2/driverlib/rfc.h:87
#define RFCSynthPowerDown
Definition: cc13x2_cc26x2/driverlib/rfc.h:111
__STATIC_INLINE void RFCCpeIntClear(uint32_t ui32Mask)
Clear HW interrupt flags.
Definition: cc13x2_cc26x2/driverlib/rfc.h:175
#define RFCCpeIntGetAndClear
Definition: cc13x2_cc26x2/driverlib/rfc.h:109
__STATIC_INLINE void RFCClockDisable(void)
Disable the RF core clocks.
Definition: cc13x2_cc26x2/driverlib/rfc.h:162
__STATIC_INLINE void RFCCpe1IntSelectClearEnable(uint32_t ui32Mask)
Select, clear, and enable interrupt sources to CPE1.
Definition: cc13x2_cc26x2/driverlib/rfc.h:259
__STATIC_INLINE void RFCCpeIntEnable(uint32_t ui32Mask)
Enable CPEx interrupt sources.
Definition: cc13x2_cc26x2/driverlib/rfc.h:227
__STATIC_INLINE void RFCHwIntEnable(uint32_t ui32Mask)
Enable HW interrupt sources.
Definition: cc13x2_cc26x2/driverlib/rfc.h:278
#define RFC_IEEE_CMD_BG_IEEE_RX_O_CAP_TIME
Definition: cc13x2_cc26x2/driverlib/rfc.h:86
#define RFCDoorbellSendTo
Definition: cc13x2_cc26x2/driverlib/rfc.h:110
Definition: cc13x2_cc26x2/driverlib/rfc.h:76
__STATIC_INLINE bool RFCGetPaType(void)
Get the type of currently selected PA.
Definition: cc13x2_cc26x2/driverlib/rfc.h:386
#define RFC_IEEE_CMD_BG_ADDRESS
Definition: cc13x2_cc26x2/driverlib/rfc.h:85
uint32_t configMiscAdc
Definition: cc13x2_cc26x2/driverlib/rfc.h:80
uint32_t configRfFrontend
Definition: cc13x2_cc26x2/driverlib/rfc.h:78
uint32_t configIfAdc
Definition: cc13x2_cc26x2/driverlib/rfc.h:77
#define RFC_PA_GAIN_ADDRESS
Definition: cc13x2_cc26x2/driverlib/rfc.h:89
__STATIC_INLINE void RFCCpeIntDisable(uint32_t ui32Mask)
Disable CPE interrupt sources.
Definition: cc13x2_cc26x2/driverlib/rfc.h:291
__STATIC_INLINE void RFCAckIntClear(void)
Clear ACK interrupt flag.
Definition: cc13x2_cc26x2/driverlib/rfc.h:325
#define RFC_PA_TYPE_MASK
Definition: cc13x2_cc26x2/driverlib/rfc.h:88
__STATIC_INLINE void RFCClockEnable(void)
Enable the RF core clocks.
Definition: cc13x2_cc26x2/driverlib/rfc.h:137
__STATIC_INLINE uint32_t RFCGetPowerDomainStatus(void)
Get the power domain status of the radio core.
Definition: cc13x2_cc26x2/driverlib/rfc.h:408
__STATIC_INLINE void RFCCpe0IntSelectClearEnable(uint32_t ui32Mask)
Select, clear, and enable interrupt sources to CPE0.
Definition: cc13x2_cc26x2/driverlib/rfc.h:240
__STATIC_INLINE uint32_t RFCGetPaGain(void)
Get the gain of currently selected PA.
Definition: cc13x2_cc26x2/driverlib/rfc.h:397
__STATIC_INLINE void RFCCpe1IntSelect(uint32_t ui32Mask)
Select interrupt sources to CPE1 (assign to INT_RFC_CPE_1 interrupt vector).
Definition: cc13x2_cc26x2/driverlib/rfc.h:214
Definition: cc13x2_cc26x2/driverlib/rf_common_cmd.h:122
#define RFCOverrideUpdate
Definition: cc13x2_cc26x2/driverlib/rfc.h:114
#define RFC_PA_GAIN_MASK
Definition: cc13x2_cc26x2/driverlib/rfc.h:90
#define RFCHwIntGetAndClear
Definition: cc13x2_cc26x2/driverlib/rfc.h:115
__STATIC_INLINE void RFCCpe0IntSelect(uint32_t ui32Mask)
Select interrupt sources to CPE0 (assign to INT_RFC_CPE_0 interrupt vector).
Definition: cc13x2_cc26x2/driverlib/rfc.h:201
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale