rflib
cc13x4_cc26x4/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_memmap_common.h)
66 #include DeviceFamily_constructPath(inc/hw_rfc_pwr.h)
67 #include DeviceFamily_constructPath(inc/hw_rfc_dbell.h)
68 #include DeviceFamily_constructPath(inc/hw_fcfg1.h)
69 #include DeviceFamily_constructPath(inc/hw_adi_3_refsys.h)
70 #include DeviceFamily_constructPath(inc/hw_adi.h)
71 #include DeviceFamily_constructPath(inc/hw_prcm.h)
72 #include "rf_common_cmd.h"
73 #include "rf_prop_cmd.h"
74 #include "rf_ble_cmd.h"
75 
76 // Definition of RFTRIM container
77 typedef struct {
78  uint32_t configIfAdc;
79  uint32_t configRfFrontend;
80  uint32_t configSynth;
81  uint32_t configMiscAdc;
82 } rfTrim_t;
83 
84 // Definition of maximum search depth used by the RFCOverrideUpdate function
85 #define RFC_MAX_SEARCH_DEPTH 5
86 #define RFC_IEEE_CMD_BG_ADDRESS 0x21000160
87 #define RFC_IEEE_CMD_BG_IEEE_RX_O_CAP_TIME 24
88 #define RFC_PA_TYPE_ADDRESS 0x21000385
89 #define RFC_PA_TYPE_MASK 0x04
90 #define RFC_PA_GAIN_ADDRESS 0x21000398
91 #define RFC_PA_GAIN_MASK 0x003FFFFF
92 #define RFC_FE_MODE_ESCAPE_VALUE 0xFF
93 #define RFC_FE_OVERRIDE_ADDRESS 0x0703
94 #define RFC_FE_OVERRIDE_MASK 0x0000FFFF
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 RFCCpeIntGetAndClear NOROM_RFCCpeIntGetAndClear
111  #define RFCDoorbellSendTo NOROM_RFCDoorbellSendTo
112  #define RFCSynthPowerDown NOROM_RFCSynthPowerDown
113  #define RFCCpePatchReset NOROM_RFCCpePatchReset
114  #define RFCOverrideSearch NOROM_RFCOverrideSearch
115  #define RFCOverrideUpdate NOROM_RFCOverrideUpdate
116  #define RFCHwIntGetAndClear NOROM_RFCHwIntGetAndClear
117  #define RFCAnaDivTxOverride NOROM_RFCAnaDivTxOverride
118 #endif
119 
120 //*****************************************************************************
121 //
122 // API Functions and prototypes
123 //
124 //*****************************************************************************
125 
126 //*****************************************************************************
127 //
135 //
136 //*****************************************************************************
137 __STATIC_INLINE void
138 RFCClockEnable(void)
139 {
140  // Enable basic clocks to get the CPE run
141  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RFC_PWR_PWMCLKEN_CPERAM
142  | RFC_PWR_PWMCLKEN_CPE
143  | RFC_PWR_PWMCLKEN_RFC;
144 }
145 
146 
147 //*****************************************************************************
148 //
160 //
161 //*****************************************************************************
162 __STATIC_INLINE void
163 RFCClockDisable(void)
164 {
165  // Disable all clocks
166  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = 0x0;
167 }
168 
169 
170 //*****************************************************************************
171 //
173 //
174 //*****************************************************************************
175 __STATIC_INLINE void
176 RFCCpeIntClear(uint32_t ui32Mask)
177 {
178  // Clear the masked pending interrupts.
179  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) = ~ui32Mask;
180 }
181 
182 
183 //*****************************************************************************
184 //
186 //
187 //*****************************************************************************
188 __STATIC_INLINE void
189 RFCHwIntClear(uint32_t ui32Mask)
190 {
191  // Clear the masked pending interrupts.
192  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) = ~ui32Mask;
193 }
194 
195 
196 //*****************************************************************************
197 //
199 //
200 //*****************************************************************************
201 __STATIC_INLINE void
202 RFCCpe0IntSelect(uint32_t ui32Mask)
203 {
204  // Multiplex RF Core interrupts to CPE0 IRQ.
205  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) &= ~ui32Mask;
206 }
207 
208 
209 //*****************************************************************************
210 //
212 //
213 //*****************************************************************************
214 __STATIC_INLINE void
215 RFCCpe1IntSelect(uint32_t ui32Mask)
216 {
217  // Multiplex RF Core interrupts to CPE1 IRQ.
218  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) |= ui32Mask;
219 }
220 
221 
222 //*****************************************************************************
223 //
225 //
226 //*****************************************************************************
227 __STATIC_INLINE void
228 RFCCpeIntEnable(uint32_t ui32Mask)
229 {
230  // Enable CPE interrupts from RF Core.
231  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) |= ui32Mask;
232 }
233 
234 
235 //*****************************************************************************
236 //
238 //
239 //*****************************************************************************
240 __STATIC_INLINE void
241 RFCCpe0IntSelectClearEnable(uint32_t ui32Mask)
242 {
243  // Multiplex RF Core interrupts to CPE0 IRQ.
244  RFCCpe0IntSelect(ui32Mask);
245 
246  // Clear the masked interrupts.
247  RFCCpeIntClear(ui32Mask);
248 
249  // Enable the masked interrupts.
250  RFCCpeIntEnable(ui32Mask);
251 }
252 
253 
254 //*****************************************************************************
255 //
257 //
258 //*****************************************************************************
259 __STATIC_INLINE void
260 RFCCpe1IntSelectClearEnable(uint32_t ui32Mask)
261 {
262  // Multiplex RF Core interrupts to CPE1 IRQ.
263  RFCCpe1IntSelect(ui32Mask);
264 
265  // Clear the masked interrupts.
266  RFCCpeIntClear(ui32Mask);
267 
268  // Enable the masked interrupts.
269  RFCCpeIntEnable(ui32Mask);
270 }
271 
272 
273 //*****************************************************************************
274 //
276 //
277 //*****************************************************************************
278 __STATIC_INLINE void
279 RFCHwIntEnable(uint32_t ui32Mask)
280 {
281  // Enable the masked interrupts
282  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) |= ui32Mask;
283 }
284 
285 
286 //*****************************************************************************
287 //
289 //
290 //*****************************************************************************
291 __STATIC_INLINE void
292 RFCCpeIntDisable(uint32_t ui32Mask)
293 {
294  // Disable the masked interrupts
295  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) &= ~ui32Mask;
296 }
297 
298 
299 //*****************************************************************************
300 //
302 //
303 //*****************************************************************************
304 __STATIC_INLINE void
305 RFCHwIntDisable(uint32_t ui32Mask)
306 {
307  // Disable the masked interrupts
308  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) &= ~ui32Mask;
309 }
310 
311 
312 //*****************************************************************************
313 //
315 //
316 //*****************************************************************************
317 extern uint32_t RFCCpeIntGetAndClear(uint32_t ui32Mask);
318 
319 
320 //*****************************************************************************
321 //
323 //
324 //*****************************************************************************
325 __STATIC_INLINE void
326 RFCAckIntClear(void)
327 {
328  // Clear any pending interrupts.
329  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0x0;
330 }
331 
332 
333 //*****************************************************************************
334 //
336 //
337 //*****************************************************************************
338 extern uint32_t RFCDoorbellSendTo(uint32_t pOp);
339 
340 
341 //*****************************************************************************
342 //
344 //
345 //*****************************************************************************
346 extern void RFCSynthPowerDown(void);
347 
348 
349 //*****************************************************************************
350 //
352 //
353 //*****************************************************************************
354 extern void RFCCpePatchReset(void);
355 
356 
357 //*****************************************************************************
358 //
359 // Function to search an override list for the provided pattern within the search depth.
360 //
361 //*****************************************************************************
362 extern uint8_t RFCOverrideSearch(const uint32_t *pOverride, const uint32_t pattern, const uint32_t mask, const uint8_t searchDepth);
363 
364 
365 //*****************************************************************************
366 //
368 //
369 //*****************************************************************************
370 extern uint8_t RFCOverrideUpdate(rfc_radioOp_t *pOpSetup, uint32_t *pParams);
371 
372 
373 //*****************************************************************************
374 //
376 //
377 //*****************************************************************************
378 extern uint32_t RFCHwIntGetAndClear(uint32_t ui32Mask);
379 
380 
381 //*****************************************************************************
382 //
384 //
385 //*****************************************************************************
386 __STATIC_INLINE bool
387 RFCGetPaType(void)
388 {
389  return (bool)(HWREGB(RFC_PA_TYPE_ADDRESS) & RFC_PA_TYPE_MASK);
390 }
391 
392 //*****************************************************************************
393 //
395 //
396 //*****************************************************************************
397 __STATIC_INLINE uint32_t
398 RFCGetPaGain(void)
399 {
400  return (HWREG(RFC_PA_GAIN_ADDRESS) & RFC_PA_GAIN_MASK);
401 }
402 
403 //*****************************************************************************
404 //
406 //
407 //*****************************************************************************
408 __STATIC_INLINE uint32_t
410 {
411  return (HWREG(PRCM_BASE + NONSECURE_OFFSET + PRCM_O_PDCTL1RFC) |
412  HWREG(PRCM_BASE + NONSECURE_OFFSET + PRCM_O_PDSTAT0RFC));
413 }
414 
415 //*****************************************************************************************
416 //
419 //
420 //*****************************************************************************************
421 __STATIC_INLINE uint32_t
423 {
425 }
426 
427 //*****************************************************************************
428 //
430 //
431 //*****************************************************************************
432 extern uint32_t RFCAnaDivTxOverride(uint8_t loDivider, uint8_t frontEndMode);
433 
434 
435 //*****************************************************************************
436 //
437 // Support for DriverLib in ROM:
438 // Redirect to implementation in ROM when available.
439 //
440 //*****************************************************************************
441 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
442  #include DeviceFamily_constructPath(driverlib/rom.h)
443  #ifdef ROM_RFCCpeIntGetAndClear
444  #undef RFCCpeIntGetAndClear
445  #define RFCCpeIntGetAndClear ROM_RFCCpeIntGetAndClear
446  #endif
447  #ifdef ROM_RFCDoorbellSendTo
448  #undef RFCDoorbellSendTo
449  #define RFCDoorbellSendTo ROM_RFCDoorbellSendTo
450  #endif
451  #ifdef ROM_RFCSynthPowerDown
452  #undef RFCSynthPowerDown
453  #define RFCSynthPowerDown ROM_RFCSynthPowerDown
454  #endif
455  #ifdef ROM_RFCCpePatchReset
456  #undef RFCCpePatchReset
457  #define RFCCpePatchReset ROM_RFCCpePatchReset
458  #endif
459  #ifdef ROM_RFCOverrideSearch
460  #undef RFCOverrideSearch
461  #define RFCOverrideSearch ROM_RFCOverrideSearch
462  #endif
463  #ifdef ROM_RFCOverrideUpdate
464  #undef RFCOverrideUpdate
465  #define RFCOverrideUpdate ROM_RFCOverrideUpdate
466  #endif
467  #ifdef ROM_RFCHwIntGetAndClear
468  #undef RFCHwIntGetAndClear
469  #define RFCHwIntGetAndClear ROM_RFCHwIntGetAndClear
470  #endif
471  #ifdef ROM_RFCAnaDivTxOverride
472  #undef RFCAnaDivTxOverride
473  #define RFCAnaDivTxOverride ROM_RFCAnaDivTxOverride
474  #endif
475 #endif
476 
477 //*****************************************************************************
478 //
479 // Mark the end of the C bindings section for C++ compilers.
480 //
481 //*****************************************************************************
482 #ifdef __cplusplus
483 }
484 #endif
485 
486 #endif // __RFC_H__
487 
488 //*****************************************************************************
489 //
492 //
493 //*****************************************************************************
__STATIC_INLINE void RFCHwIntDisable(uint32_t ui32Mask)
Disable HW interrupt sources.
Definition: cc13x2_cc26x2/driverlib/rfc.h:304
#define RFCCpePatchReset
Definition: cc13x4_cc26x4/driverlib/rfc.h:113
__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: cc13x4_cc26x4/driverlib/rfc.h:114
#define RFCAnaDivTxOverride
Definition: cc13x4_cc26x4/driverlib/rfc.h:117
#define RFC_PA_TYPE_ADDRESS
Definition: cc13x4_cc26x4/driverlib/rfc.h:88
#define RFCSynthPowerDown
Definition: cc13x4_cc26x4/driverlib/rfc.h:112
__STATIC_INLINE void RFCCpeIntClear(uint32_t ui32Mask)
Clear HW interrupt flags.
Definition: cc13x2_cc26x2/driverlib/rfc.h:175
#define RFCCpeIntGetAndClear
Definition: cc13x4_cc26x4/driverlib/rfc.h:110
__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: cc13x4_cc26x4/driverlib/rfc.h:87
#define RFCDoorbellSendTo
Definition: cc13x4_cc26x4/driverlib/rfc.h:111
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: cc13x4_cc26x4/driverlib/rfc.h:86
#define RFC_PA_GAIN_ADDRESS
Definition: cc13x4_cc26x4/driverlib/rfc.h:90
__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: cc13x4_cc26x4/driverlib/rfc.h:89
__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: cc13x4_cc26x4/driverlib/rfc.h:115
#define RFC_PA_GAIN_MASK
Definition: cc13x4_cc26x4/driverlib/rfc.h:91
#define RFCHwIntGetAndClear
Definition: cc13x4_cc26x4/driverlib/rfc.h:116
__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-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale