CC26xx Driver Library
chipinfo.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: chipinfo.h
3 * Revised: 2015-10-27 13:41:27 +0100 (Tue, 27 Oct 2015)
4 * Revision: 44843
5 *
6 * Description: Collection of functions returning chip information.
7 *
8 * Copyright (c) 2015, 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 __CHIP_INFO_H__
49 #define __CHIP_INFO_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 #include <stdint.h>
63 #include <stdbool.h>
64 #include <inc/hw_types.h>
65 #include <inc/hw_memmap.h>
66 #include <inc/hw_fcfg1.h>
67 
68 //*****************************************************************************
69 //
75 //
76 //*****************************************************************************
77 typedef enum {
79  PROTOCOLBIT_BLE = 0x02,
83 
84 //*****************************************************************************
85 //
90 //
91 //*****************************************************************************
93 
94 
95 //*****************************************************************************
96 //
101 //
102 //*****************************************************************************
103 __STATIC_INLINE bool
105 {
106  return (( ChipInfo_GetSupportedProtocol_BV() & PROTOCOLBIT_BLE ) != 0 );
107 }
108 
109 //*****************************************************************************
110 //
115 //
116 //*****************************************************************************
117 __STATIC_INLINE bool
119 {
121 }
122 
123 //*****************************************************************************
124 //
129 //
130 //*****************************************************************************
131 __STATIC_INLINE bool
133 {
135 }
136 
137 
138 //*****************************************************************************
139 //
141 //
142 //*****************************************************************************
143 typedef enum {
148 } PackageType_t;
149 
150 //*****************************************************************************
151 //
156 //
157 //*****************************************************************************
159 
160 //*****************************************************************************
161 //
166 //
167 //*****************************************************************************
168 __STATIC_INLINE bool
170 {
171  return ( ChipInfo_GetPackageType() == PACKAGE_4x4 );
172 }
173 
174 //*****************************************************************************
175 //
180 //
181 //*****************************************************************************
182 __STATIC_INLINE bool
184 {
185  return ( ChipInfo_GetPackageType() == PACKAGE_5x5 );
186 }
187 
188 //*****************************************************************************
189 //
194 //
195 //*****************************************************************************
196 __STATIC_INLINE bool
198 {
199  return ( ChipInfo_GetPackageType() == PACKAGE_7x7 );
200 }
201 
202 
203 //*****************************************************************************
204 //
209 //*****************************************************************************
210 __STATIC_INLINE uint32_t
212 {
213  // Returns HwRevCode = FCFG1_O_ICEPICK_DEVICE_ID[31:28]
214  return ( HWREG( FCFG1_BASE + FCFG1_O_ICEPICK_DEVICE_ID ) >> 28 );
215 }
216 
217 //*****************************************************************************
218 //
226 //
227 //*****************************************************************************
228 __STATIC_INLINE uint32_t
230 {
231  uint32_t minorRev = (( HWREG( FCFG1_BASE + FCFG1_O_MISC_CONF_1 ) &
234 
235  if ( minorRev >= 0x80 ) {
236  minorRev = 0;
237  }
238 
239  return( minorRev );
240 }
241 
242 
243 //*****************************************************************************
244 //
246 //
247 //*****************************************************************************
248 typedef enum {
254 } ChipFamily_t;
255 
256 //*****************************************************************************
257 //
262 //
263 //*****************************************************************************
264 extern ChipFamily_t ChipInfo_GetChipFamily( void );
265 
266 //*****************************************************************************
267 //
272 //
273 //*****************************************************************************
274 __STATIC_INLINE bool
276 {
277  return ( ChipInfo_GetChipFamily() == FAMILY_CC26xx );
278 }
279 
280 //*****************************************************************************
281 //
286 //
287 //*****************************************************************************
288 __STATIC_INLINE bool
290 {
291  return ( ChipInfo_GetChipFamily() == FAMILY_CC13xx );
292 }
293 
294 //*****************************************************************************
295 //
300 //
301 //*****************************************************************************
302 __STATIC_INLINE bool
304 {
306 }
307 
308 //*****************************************************************************
309 //
314 //
315 //*****************************************************************************
316 __STATIC_INLINE bool
318 {
320 }
321 
322 //*****************************************************************************
323 //
325 //
326 //*****************************************************************************
327 typedef enum {
329  HWREV_1_0 = 10,
330  HWREV_2_0 = 20,
331  HWREV_2_1 = 21,
332  HWREV_2_2 = 22,
333  HWREV_2_3 = 23
334 } HwRevision_t;
335 
336 //*****************************************************************************
337 //
342 //
343 //*****************************************************************************
344 extern HwRevision_t ChipInfo_GetHwRevision( void );
345 
346 //*****************************************************************************
347 //
352 //
353 //*****************************************************************************
354 __STATIC_INLINE bool
356 {
357  return ( ChipInfo_GetHwRevision() == HWREV_1_0 );
358 }
359 
360 //*****************************************************************************
361 //
366 //
367 //*****************************************************************************
368 __STATIC_INLINE bool
370 {
371  return ( ChipInfo_GetHwRevision() >= HWREV_2_0 );
372 }
373 
374 //*****************************************************************************
375 //
380 //
381 //*****************************************************************************
382 __STATIC_INLINE bool
384 {
385  return ( ChipInfo_GetHwRevision() == HWREV_2_0 );
386 }
387 
388 //*****************************************************************************
389 //
394 //
395 //*****************************************************************************
396 __STATIC_INLINE bool
398 {
399  return ( ChipInfo_GetHwRevision() == HWREV_2_1 );
400 }
401 
402 //*****************************************************************************
403 //
408 //
409 //*****************************************************************************
410 __STATIC_INLINE bool
412 {
413  return ( ChipInfo_GetHwRevision() == HWREV_2_2 );
414 }
415 
416 //*****************************************************************************
417 //
422 //
423 //*****************************************************************************
424 __STATIC_INLINE bool
426 {
427  return ( ChipInfo_GetHwRevision() >= HWREV_2_2 );
428 }
429 
430 //*****************************************************************************
431 //
436 //
437 //*****************************************************************************
438 __STATIC_INLINE bool
440 {
441  return ( ChipInfo_GetHwRevision() >= HWREV_2_3 );
442 }
443 
444 
445 //*****************************************************************************
446 //
450 //
451 //*****************************************************************************
453 
454 //*****************************************************************************
455 //
456 // Mark the end of the C bindings section for C++ compilers.
457 //
458 //*****************************************************************************
459 #ifdef __cplusplus
460 }
461 #endif
462 
463 #endif // __CHIP_INFO_H__
464 
465 //*****************************************************************************
466 //
470 //
471 //*****************************************************************************
PackageType_t ChipInfo_GetPackageType(void)
Returns package type.
Definition: chipinfo.c:68
static bool ChipInfo_PackageTypeIs5x5(void)
Returns true if this is a 5x5mm chip.
Definition: chipinfo.h:183
static bool ChipInfo_HwRevisionIs_GTEQ_2_2(void)
Returns true if HW revision for this chip is 2.2 or greater.
Definition: chipinfo.h:425
None of the known protocols are supported.
Definition: chipinfo.h:78
3 means that the chip is a CC26xxAgama family member.
Definition: chipinfo.h:253
HwRevision_t
HW revision enumeration.
Definition: chipinfo.h:327
static bool ChipInfo_ChipFamilyIsCC26xxLizard(void)
Returns true if this chip is member of the CC26xxLizard family.
Definition: chipinfo.h:303
PackageType_t
Package type enumeration.
Definition: chipinfo.h:143
static bool ChipInfo_HwRevisionIs_2_0(void)
Returns true if HW revision for this chip is 2.0.
Definition: chipinfo.h:383
23 means that the chip's HW revision is 2.3
Definition: chipinfo.h:333
static bool ChipInfo_SupportsBLE(void)
Returns true if the chip supports the BLE protocol.
Definition: chipinfo.h:104
static bool ChipInfo_HwRevisionIs_GTEQ_2_0(void)
Returns true if HW revision for this chip is 2.0 or greater.
Definition: chipinfo.h:369
-1 means that the chip's family member is unknown.
Definition: chipinfo.h:249
-1 means that current chip type is unknown.
Definition: chipinfo.h:144
static bool ChipInfo_HwRevisionIs_GTEQ_2_3(void)
Returns true if HW revision for this chip is 2.3 or greater.
Definition: chipinfo.h:439
Bit[3] set, indicates that proprietary protocols are supported.
Definition: chipinfo.h:81
21 means that the chip's HW revision is 2.1
Definition: chipinfo.h:331
ProtocolBitVector_t ChipInfo_GetSupportedProtocol_BV(void)
Returns bit vector showing supported protocols.
Definition: chipinfo.c:56
void ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated(void)
Verifies that current chip is built for CC26xx HwRev 2.2 or later and never returns if violated...
Definition: chipinfo.c:170
static bool ChipInfo_HwRevisionIs_1_0(void)
Returns true if HW revision for this chip is 1.0.
Definition: chipinfo.h:355
static bool ChipInfo_SupportsPROPRIETARY(void)
Returns true if the chip supports propriatary protocols.
Definition: chipinfo.h:132
Bit[1] set, indicates that Bluetooth Low Energy is supported.
Definition: chipinfo.h:79
static bool ChipInfo_ChipFamilyIsCC26xxAgama(void)
Returns true if this chip is member of the CC26xxAgama family.
Definition: chipinfo.h:317
-1 means that the chip's HW revision is unknown.
Definition: chipinfo.h:328
static bool ChipInfo_SupportsIEEE_802_15_4(void)
Returns true if the chip supports the IEEE 802.15.4 protocol.
Definition: chipinfo.h:118
HwRevision_t ChipInfo_GetHwRevision(void)
Returns chip HW revision.
Definition: chipinfo.c:115
static bool ChipInfo_PackageTypeIs7x7(void)
Returns true if this is a 7x7mm chip.
Definition: chipinfo.h:197
static bool ChipInfo_ChipFamilyIsCC13xx(void)
Returns true if this chip is member of the CC13xx family.
Definition: chipinfo.h:289
20 means that the chip's HW revision is 2.0
Definition: chipinfo.h:330
1 means that this is a 5x5mm chip.
Definition: chipinfo.h:146
static bool ChipInfo_HwRevisionIs_2_2(void)
Returns true if HW revision for this chip is 2.2.
Definition: chipinfo.h:411
22 means that the chip's HW revision is 2.2
Definition: chipinfo.h:332
ChipFamily_t
Chip family enumeration.
Definition: chipinfo.h:248
static bool ChipInfo_ChipFamilyIsCC26xx(void)
Returns true if this chip is member of the CC26xx family.
Definition: chipinfo.h:275
static bool ChipInfo_PackageTypeIs4x4(void)
Returns true if this is a 4x4mm chip.
Definition: chipinfo.h:169
ProtocolBitVector_t
Enumeration identifying the protocols supported.
Definition: chipinfo.h:77
ChipFamily_t ChipInfo_GetChipFamily(void)
Returns chip family member.
Definition: chipinfo.c:91
static bool ChipInfo_HwRevisionIs_2_1(void)
Returns true if HW revision for this chip is 2.1.
Definition: chipinfo.h:397
1 means that the chip is a CC13xx family member.
Definition: chipinfo.h:251
2 means that the chip is a CC26xxLizard family member.
Definition: chipinfo.h:252
static uint32_t ChipInfo_GetDeviceIdHwRevCode(void)
Returns the internal chip HW revision code.
Definition: chipinfo.h:211
Bit[2] set, indicates that IEEE 802.15.4 is supported.
Definition: chipinfo.h:80
10 means that the chip's HW revision is 1.0
Definition: chipinfo.h:329
0 means that this is a 4x4mm chip.
Definition: chipinfo.h:145
2 means that this is a 7x7mm chip.
Definition: chipinfo.h:147
static uint32_t ChipInfo_GetMinorHwRev(void)
Returns minor hardware revision number.
Definition: chipinfo.h:229
0 means that the chip is a CC26xx family member.
Definition: chipinfo.h:250