CC13xx Driver Library
chipinfo.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: chipinfo.h
3 * Revised: 2015-07-16 12:12:04 +0200 (Thu, 16 Jul 2015)
4 * Revision: 44151
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 {
253 } ChipFamily_t;
254 
255 //*****************************************************************************
256 //
261 //
262 //*****************************************************************************
263 extern ChipFamily_t ChipInfo_GetChipFamily( void );
264 
265 //*****************************************************************************
266 //
271 //
272 //*****************************************************************************
273 __STATIC_INLINE bool
275 {
276  return ( ChipInfo_GetChipFamily() == FAMILY_CC26xx );
277 }
278 
279 //*****************************************************************************
280 //
285 //
286 //*****************************************************************************
287 __STATIC_INLINE bool
289 {
290  return ( ChipInfo_GetChipFamily() == FAMILY_CC13xx );
291 }
292 
293 //*****************************************************************************
294 //
299 //
300 //*****************************************************************************
301 __STATIC_INLINE bool
303 {
305 }
306 
307 //*****************************************************************************
308 //
310 //
311 //*****************************************************************************
312 typedef enum {
314  HWREV_1_0 = 10,
315  HWREV_2_0 = 20,
316  HWREV_2_1 = 21,
317  HWREV_2_2 = 22,
318  HWREV_2_3 = 23
319 } HwRevision_t;
320 
321 //*****************************************************************************
322 //
327 //
328 //*****************************************************************************
329 extern HwRevision_t ChipInfo_GetHwRevision( void );
330 
331 //*****************************************************************************
332 //
337 //
338 //*****************************************************************************
339 __STATIC_INLINE bool
341 {
342  return ( ChipInfo_GetHwRevision() == HWREV_1_0 );
343 }
344 
345 //*****************************************************************************
346 //
351 //
352 //*****************************************************************************
353 __STATIC_INLINE bool
355 {
356  return ( ChipInfo_GetHwRevision() >= HWREV_2_0 );
357 }
358 
359 //*****************************************************************************
360 //
365 //
366 //*****************************************************************************
367 __STATIC_INLINE bool
369 {
370  return ( ChipInfo_GetHwRevision() == HWREV_2_0 );
371 }
372 
373 //*****************************************************************************
374 //
379 //
380 //*****************************************************************************
381 __STATIC_INLINE bool
383 {
384  return ( ChipInfo_GetHwRevision() == HWREV_2_1 );
385 }
386 
387 //*****************************************************************************
388 //
393 //
394 //*****************************************************************************
395 __STATIC_INLINE bool
397 {
398  return ( ChipInfo_GetHwRevision() == HWREV_2_2 );
399 }
400 
401 //*****************************************************************************
402 //
407 //
408 //*****************************************************************************
409 __STATIC_INLINE bool
411 {
412  return ( ChipInfo_GetHwRevision() >= HWREV_2_2 );
413 }
414 
415 
416 //*****************************************************************************
417 //
421 //
422 //*****************************************************************************
424 
425 //*****************************************************************************
426 //
427 // Mark the end of the C bindings section for C++ compilers.
428 //
429 //*****************************************************************************
430 #ifdef __cplusplus
431 }
432 #endif
433 
434 #endif // __CHIP_INFO_H__
435 
436 //*****************************************************************************
437 //
441 //
442 //*****************************************************************************
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:410
None of the known protocols are supported.
Definition: chipinfo.h:78
HwRevision_t
HW revision enumeration.
Definition: chipinfo.h:312
static bool ChipInfo_ChipFamilyIsCC26xxLizard(void)
Returns true if this chip is member of the CC26xxLizard family.
Definition: chipinfo.h:302
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:368
23 means that the chip's HW revision is 2.3
Definition: chipinfo.h:318
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:354
-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
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:316
ProtocolBitVector_t ChipInfo_GetSupportedProtocol_BV(void)
Returns bit vector showing supported protocols.
Definition: chipinfo.c:56
void ThisCodeIsBuiltForCC13xxHwRev20AndLater_HaltIfViolated(void)
Verifies that curent chip is built for CC13xx HwRev 2.0 or later and never returns if violated...
Definition: chipinfo.c:168
static bool ChipInfo_HwRevisionIs_1_0(void)
Returns true if HW revision for this chip is 1.0.
Definition: chipinfo.h:340
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
-1 means that the chip's HW revision is unknown.
Definition: chipinfo.h:313
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:114
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:288
20 means that the chip's HW revision is 2.0
Definition: chipinfo.h:315
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:396
22 means that the chip's HW revision is 2.2
Definition: chipinfo.h:317
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:274
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:382
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:314
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