rflib
cc13x1_cc26x1/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 configRfCommon;
81  uint8_t loDivider;
82  uint8_t noTrim;
83 } rfTrim_t;
84 
85 // Definition of maximum search depth used by the RFCOverrideUpdate function
86 #define RFC_MAX_SEARCH_DEPTH 5
87 #define RFC_IEEE_CMD_BG_ADDRESS 0x21000160
88 #define RFC_IEEE_CMD_BG_IEEE_RX_O_CAP_TIME 24
89 #define RFC_PA_TYPE_ADDRESS 0x21000385
90 #define RFC_PA_TYPE_MASK 0x04
91 #define RFC_PA_GAIN_ADDRESS 0x21000398
92 #define RFC_PA_GAIN_MASK 0x003FFFFF
93 #define RFC_FE_MODE_ESCAPE_VALUE 0xFF
94 #define RFC_FE_OVERRIDE_ADDRESS 0x0703
95 #define RFC_FE_OVERRIDE_MASK 0x0000FFFF
96 
97 //*****************************************************************************
98 //
99 // Support for DriverLib in ROM:
100 // This section renames all functions that are not "static inline", so that
101 // calling these functions will default to implementation in flash. At the end
102 // of this file a second renaming will change the defaults to implementation in
103 // ROM for available functions.
104 //
105 // To force use of the implementation in flash, e.g. for debugging:
106 // - Globally: Define DRIVERLIB_NOROM at project level
107 // - Per function: Use prefix "NOROM_" when calling the function
108 //
109 //*****************************************************************************
110 #if !defined(DOXYGEN)
111  #define RFCCpeIntGetAndClear NOROM_RFCCpeIntGetAndClear
112  #define RFCDoorbellSendTo NOROM_RFCDoorbellSendTo
113  #define RFCSynthPowerDown NOROM_RFCSynthPowerDown
114  #define RFCCpePatchReset NOROM_RFCCpePatchReset
115  #define RFCOverrideSearch NOROM_RFCOverrideSearch
116  #define RFCOverrideUpdate NOROM_RFCOverrideUpdate
117  #define RFCHwIntGetAndClear NOROM_RFCHwIntGetAndClear
118  #define RFCAnaDivTxOverride NOROM_RFCAnaDivTxOverride
119  #define RFCRfTrimRead NOROM_RFCRfTrimRead
120  #define RFCRfTrimSet NOROM_RFCRfTrimSet
121 #endif
122 
123 //*****************************************************************************
124 //
125 // API Functions and prototypes
126 //
127 //*****************************************************************************
128 
129 //*****************************************************************************
130 //
138 //
139 //*****************************************************************************
140 __STATIC_INLINE void
141 RFCClockEnable(void)
142 {
143  // Enable basic clocks to get the CPE run
144  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RFC_PWR_PWMCLKEN_CPERAM
145  | RFC_PWR_PWMCLKEN_CPE
146  | RFC_PWR_PWMCLKEN_RFC;
147 }
148 
149 
150 //*****************************************************************************
151 //
163 //
164 //*****************************************************************************
165 __STATIC_INLINE void
166 RFCClockDisable(void)
167 {
168  // Disable all clocks
169  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = 0x0;
170 }
171 
172 
173 //*****************************************************************************
174 //
176 //
177 //*****************************************************************************
178 __STATIC_INLINE void
179 RFCCpeIntClear(uint32_t ui32Mask)
180 {
181  // Clear the masked pending interrupts.
182  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) = ~ui32Mask;
183 }
184 
185 
186 //*****************************************************************************
187 //
189 //
190 //*****************************************************************************
191 __STATIC_INLINE void
192 RFCHwIntClear(uint32_t ui32Mask)
193 {
194  // Clear the masked pending interrupts.
195  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) = ~ui32Mask;
196 }
197 
198 
199 //*****************************************************************************
200 //
202 //
203 //*****************************************************************************
204 __STATIC_INLINE void
205 RFCCpe0IntSelect(uint32_t ui32Mask)
206 {
207  // Multiplex RF Core interrupts to CPE0 IRQ.
208  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) &= ~ui32Mask;
209 }
210 
211 
212 //*****************************************************************************
213 //
215 //
216 //*****************************************************************************
217 __STATIC_INLINE void
218 RFCCpe1IntSelect(uint32_t ui32Mask)
219 {
220  // Multiplex RF Core interrupts to CPE1 IRQ.
221  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) |= ui32Mask;
222 }
223 
224 
225 //*****************************************************************************
226 //
228 //
229 //*****************************************************************************
230 __STATIC_INLINE void
231 RFCCpeIntEnable(uint32_t ui32Mask)
232 {
233  // Enable CPE interrupts from RF Core.
234  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) |= ui32Mask;
235 }
236 
237 
238 //*****************************************************************************
239 //
241 //
242 //*****************************************************************************
243 __STATIC_INLINE void
244 RFCCpe0IntSelectClearEnable(uint32_t ui32Mask)
245 {
246  // Multiplex RF Core interrupts to CPE0 IRQ.
247  RFCCpe0IntSelect(ui32Mask);
248 
249  // Clear the masked interrupts.
250  RFCCpeIntClear(ui32Mask);
251 
252  // Enable the masked interrupts.
253  RFCCpeIntEnable(ui32Mask);
254 }
255 
256 
257 //*****************************************************************************
258 //
260 //
261 //*****************************************************************************
262 __STATIC_INLINE void
263 RFCCpe1IntSelectClearEnable(uint32_t ui32Mask)
264 {
265  // Multiplex RF Core interrupts to CPE1 IRQ.
266  RFCCpe1IntSelect(ui32Mask);
267 
268  // Clear the masked interrupts.
269  RFCCpeIntClear(ui32Mask);
270 
271  // Enable the masked interrupts.
272  RFCCpeIntEnable(ui32Mask);
273 }
274 
275 
276 //*****************************************************************************
277 //
279 //
280 //*****************************************************************************
281 __STATIC_INLINE void
282 RFCHwIntEnable(uint32_t ui32Mask)
283 {
284  // Enable the masked interrupts
285  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) |= ui32Mask;
286 }
287 
288 
289 //*****************************************************************************
290 //
292 //
293 //*****************************************************************************
294 __STATIC_INLINE void
295 RFCCpeIntDisable(uint32_t ui32Mask)
296 {
297  // Disable the masked interrupts
298  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) &= ~ui32Mask;
299 }
300 
301 
302 //*****************************************************************************
303 //
305 //
306 //*****************************************************************************
307 __STATIC_INLINE void
308 RFCHwIntDisable(uint32_t ui32Mask)
309 {
310  // Disable the masked interrupts
311  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) &= ~ui32Mask;
312 }
313 
314 
315 //*****************************************************************************
316 //
318 //
319 //*****************************************************************************
320 extern uint32_t RFCCpeIntGetAndClear(uint32_t ui32Mask);
321 
322 
323 //*****************************************************************************
324 //
326 //
327 //*****************************************************************************
328 __STATIC_INLINE void
329 RFCAckIntClear(void)
330 {
331  // Clear any pending interrupts.
332  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0x0;
333 }
334 
335 
336 //*****************************************************************************
337 //
339 //
340 //*****************************************************************************
341 extern uint32_t RFCDoorbellSendTo(uint32_t pOp);
342 
343 
344 //*****************************************************************************
345 //
347 //
348 //*****************************************************************************
349 extern void RFCSynthPowerDown(void);
350 
351 
352 //*****************************************************************************
353 //
355 //
356 //*****************************************************************************
357 extern void RFCCpePatchReset(void);
358 
359 
360 //*****************************************************************************
361 //
362 // Function to search an override list for the provided pattern within the search depth.
363 //
364 //*****************************************************************************
365 extern uint8_t RFCOverrideSearch(const uint32_t *pOverride, const uint32_t pattern, const uint32_t mask, const uint8_t searchDepth);
366 
367 
368 //*****************************************************************************
369 //
371 //
372 //*****************************************************************************
373 extern uint8_t RFCOverrideUpdate(rfc_radioOp_t *pOpSetup, uint32_t *pParams);
374 
375 
376 //*****************************************************************************
377 //
379 //
380 //*****************************************************************************
381 extern uint32_t RFCHwIntGetAndClear(uint32_t ui32Mask);
382 
383 
384 //*****************************************************************************
385 //
387 //
388 //*****************************************************************************
389 __STATIC_INLINE bool
390 RFCGetPaType(void)
391 {
392  return (bool)(HWREGB(RFC_PA_TYPE_ADDRESS) & RFC_PA_TYPE_MASK);
393 }
394 
395 //*****************************************************************************
396 //
398 //
399 //*****************************************************************************
400 __STATIC_INLINE uint32_t
401 RFCGetPaGain(void)
402 {
403  return (HWREG(RFC_PA_GAIN_ADDRESS) & RFC_PA_GAIN_MASK);
404 }
405 
406 //*****************************************************************************
407 //
409 //
410 //*****************************************************************************
411 __STATIC_INLINE uint32_t
413 {
414  return (HWREG(PRCM_BASE + PRCM_O_PDCTL1RFC) |
415  HWREG(PRCM_BASE + PRCM_O_PDSTAT0RFC));
416 }
417 
418 //*****************************************************************************************
419 //
422 //
423 //*****************************************************************************************
424 __STATIC_INLINE uint32_t
426 {
428 }
429 
430 //*****************************************************************************
431 //
433 //
434 //*****************************************************************************
435 extern uint32_t RFCAnaDivTxOverride(uint8_t loDivider, uint8_t frontEndMode);
436 
437 
438 //*****************************************************************************
439 //
441 //
442 //*****************************************************************************
443 extern void RFCRfTrimRead(rfc_radioOp_t *pOpSetup, rfTrim_t *rfTrim);
444 
445 
446 //*****************************************************************************
447 //
449 //
450 //*****************************************************************************
451 extern void RFCRfTrimSet(rfTrim_t *rfTrim);
452 
453 
454 //*****************************************************************************
455 //
456 // Support for DriverLib in ROM:
457 // Redirect to implementation in ROM when available.
458 //
459 //*****************************************************************************
460 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
461  #include DeviceFamily_constructPath(driverlib/rom.h)
462  #ifdef ROM_RFCCpeIntGetAndClear
463  #undef RFCCpeIntGetAndClear
464  #define RFCCpeIntGetAndClear ROM_RFCCpeIntGetAndClear
465  #endif
466  #ifdef ROM_RFCDoorbellSendTo
467  #undef RFCDoorbellSendTo
468  #define RFCDoorbellSendTo ROM_RFCDoorbellSendTo
469  #endif
470  #ifdef ROM_RFCSynthPowerDown
471  #undef RFCSynthPowerDown
472  #define RFCSynthPowerDown ROM_RFCSynthPowerDown
473  #endif
474  #ifdef ROM_RFCCpePatchReset
475  #undef RFCCpePatchReset
476  #define RFCCpePatchReset ROM_RFCCpePatchReset
477  #endif
478  #ifdef ROM_RFCOverrideSearch
479  #undef RFCOverrideSearch
480  #define RFCOverrideSearch ROM_RFCOverrideSearch
481  #endif
482  #ifdef ROM_RFCOverrideUpdate
483  #undef RFCOverrideUpdate
484  #define RFCOverrideUpdate ROM_RFCOverrideUpdate
485  #endif
486  #ifdef ROM_RFCHwIntGetAndClear
487  #undef RFCHwIntGetAndClear
488  #define RFCHwIntGetAndClear ROM_RFCHwIntGetAndClear
489  #endif
490  #ifdef ROM_RFCAnaDivTxOverride
491  #undef RFCAnaDivTxOverride
492  #define RFCAnaDivTxOverride ROM_RFCAnaDivTxOverride
493  #endif
494  #ifdef ROM_RFCRfTrimRead
495  #undef RFCRfTrimRead
496  #define RFCRfTrimRead ROM_RFCRfTrimRead
497  #endif
498  #ifdef ROM_RFCRfTrimSet
499  #undef RFCRfTrimSet
500  #define RFCRfTrimSet ROM_RFCRfTrimSet
501  #endif
502 #endif
503 
504 //*****************************************************************************
505 //
506 // Mark the end of the C bindings section for C++ compilers.
507 //
508 //*****************************************************************************
509 #ifdef __cplusplus
510 }
511 #endif
512 
513 #endif // __RFC_H__
514 
515 //*****************************************************************************
516 //
519 //
520 //*****************************************************************************
__STATIC_INLINE void RFCHwIntDisable(uint32_t ui32Mask)
Disable HW interrupt sources.
Definition: cc13x2_cc26x2/driverlib/rfc.h:304
uint8_t loDivider
Definition: cc13x1_cc26x1/driverlib/rfc.h:81
#define RFCCpePatchReset
Definition: cc13x1_cc26x1/driverlib/rfc.h:114
__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: cc13x1_cc26x1/driverlib/rfc.h:115
#define RFCRfTrimSet
Definition: cc13x1_cc26x1/driverlib/rfc.h:120
#define RFCAnaDivTxOverride
Definition: cc13x1_cc26x1/driverlib/rfc.h:118
#define RFC_PA_TYPE_ADDRESS
Definition: cc13x1_cc26x1/driverlib/rfc.h:89
#define RFCSynthPowerDown
Definition: cc13x1_cc26x1/driverlib/rfc.h:113
__STATIC_INLINE void RFCCpeIntClear(uint32_t ui32Mask)
Clear HW interrupt flags.
Definition: cc13x2_cc26x2/driverlib/rfc.h:175
#define RFCCpeIntGetAndClear
Definition: cc13x1_cc26x1/driverlib/rfc.h:111
__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
uint8_t noTrim
Definition: cc13x1_cc26x1/driverlib/rfc.h:82
__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: cc13x1_cc26x1/driverlib/rfc.h:88
#define RFCDoorbellSendTo
Definition: cc13x1_cc26x1/driverlib/rfc.h:112
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
uint32_t configRfCommon
Definition: cc13x1_cc26x1/driverlib/rfc.h:80
#define RFC_IEEE_CMD_BG_ADDRESS
Definition: cc13x1_cc26x1/driverlib/rfc.h:87
#define RFC_PA_GAIN_ADDRESS
Definition: cc13x1_cc26x1/driverlib/rfc.h:91
__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: cc13x1_cc26x1/driverlib/rfc.h:90
__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: cc13x1_cc26x1/driverlib/rfc.h:116
#define RFC_PA_GAIN_MASK
Definition: cc13x1_cc26x1/driverlib/rfc.h:92
#define RFCHwIntGetAndClear
Definition: cc13x1_cc26x1/driverlib/rfc.h:117
__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
#define RFCRfTrimRead
Definition: cc13x1_cc26x1/driverlib/rfc.h:119
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale