CC26xx Driver Library |

- Main Page
- Related Pages
- CC26xx APIs
- Register Descriptions
- Online Resources

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
chipinfo.c
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: chipinfo.c
3 * Revised: 2015-01-13 16:59:55 +0100 (ti, 13 jan 2015)
4 * Revision: 42365
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 #include <driverlib/chipinfo.h>
40
41 //*****************************************************************************
42 //
43 // Internal macros
44 //
45 //*****************************************************************************
46
47 #define BV( x ) ( 1 << ( x ))
48
49
50 //*****************************************************************************
51 //
52 // ChipInfo_GetSupportedProtocol_BV()
53 //
54 //*****************************************************************************
55 ProtocolBitVector_t
56 ChipInfo_GetSupportedProtocol_BV( void )
57 {
58 return ((ProtocolBitVector_t)( HWREG( PRCM_BASE + 0x1D4 ) & 0x0E ));
59 }
60
61 //*****************************************************************************
62 //
63 // ChipInfo_GetPackageType()
64 //
65 //*****************************************************************************
66 PackageType_t
67 ChipInfo_GetPackageType( void )
68 {
69 PackageType_t packType = (PackageType_t)((
70 HWREG( FCFG1_BASE + FCFG1_O_USER_ID ) &
71 FCFG1_USER_ID_PKG_M ) >>
72 FCFG1_USER_ID_PKG_S );
73
74 if (( packType < PACKAGE_4x4 ) ||
75 ( packType > PACKAGE_7x7 ) )
76 {
77 packType = PACKAGE_Unknown;
78 }
79
80 return ( packType );
81 }
82
83
84 //*****************************************************************************
85 //
86 // ChipInfo_GetChipFamily()
87 //
88 //*****************************************************************************
89 ChipFamily_t
90 ChipInfo_GetChipFamily( void )
91 {
92 ChipFamily_t chipFam = FAMILY_Unknown;
93 uint32_t pgRevBV = BV( ChipInfo_GetDeviceIdHwRevCode() );
94
95 if ( pgRevBV & ( BV( 1 ) | BV( 3 ) | BV( 7 ) | BV( 8 ))) {
96 chipFam = FAMILY_CC26xx;
97 } else if ( pgRevBV & ( BV( 0 ) | BV( 2 ))) {
98 chipFam = FAMILY_CC13xx;
99 }
100
101 return ( chipFam );
102 }
103
104
105 //*****************************************************************************
106 //
107 // ChipInfo_GetHwRevision()
108 //
109 //*****************************************************************************
110 HwRevision_t
111 ChipInfo_GetHwRevision( void )
112 {
113 HwRevision_t hwRev = HWREV_Unknown;
114
115 switch ( ChipInfo_GetDeviceIdHwRevCode() ) {
116 case 0 : // CC13xx PG1.0
117 case 1 : // CC26xx PG1.0
118 hwRev = HWREV_1_0;
119 break;
120 case 2 : // CC13xx PG2.0
121 case 3 : // CC26xx PG1.0
122 hwRev = HWREV_2_0;
123 break;
124 case 7 : // CC26xx PG2.1
125 hwRev = HWREV_2_1;
126 break;
127 case 8 : // CC26xx PG2.2
128 hwRev = HWREV_2_2;
129 break;
130 }
131
132 return ( hwRev );
133 }
134
135 #if defined( CHECK_AT_STARTUP_FOR_CORRECT_FAMILY_ONLY )
136 //*****************************************************************************
137 // ThisCodeIsBuiltForCC26xxHwRev20AndLater_HaltIfViolated()
138 // (Keeping this check at HwRev2.0 independent of "#else" check)
139 //*****************************************************************************
140 void
141 ThisCodeIsBuiltForCC26xxHwRev20AndLater_HaltIfViolated( void )
142 {
143 if (( ! ChipInfo_ChipFamilyIsCC26xx() ) ||
144 ( ! ChipInfo_HwRevisionIs_GTEQ_2_0() ) )
145 {
146 while(1)
147 {
148 //
149 // This driverlib version is for CC26xx PG2.0 and later
150 // Do nothing - stay here forever
151 //
152 }
153 }
154 }
155 #else
156
157 //*****************************************************************************
158 // ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated()
159 //*****************************************************************************
160 void
161 ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated( void )
162 {
163 if (( ! ChipInfo_ChipFamilyIsCC26xx() ) ||
164 ( ! ChipInfo_HwRevisionIs_GTEQ_2_2() ) )
165 {
166 while(1)
167 {
168 //
169 // This driverlib version is for CC26xx PG2.2 and later
170 // Do nothing - stay here forever
171 //
172 }
173 }
174 }
175 #endif
ChipInfo_GetPackageType
PackageType_t ChipInfo_GetPackageType(void)
Returns package type.
Definition: chipinfo.c:67
HwRevision_t
HwRevision_t
HW revision enumeration.
Definition: chipinfo.h:270
ChipInfo_HwRevisionIs_GTEQ_2_2
__STATIC_INLINE bool ChipInfo_HwRevisionIs_GTEQ_2_2(void)
Returns true if HW revision for this chip is 2.2 or greater.
Definition: chipinfo.h:367
PackageType_t
PackageType_t
Package type enumeration.
Definition: chipinfo.h:141
FAMILY_Unknown
Chip family member is unknown.
Definition: chipinfo.h:222
PACKAGE_Unknown
Current chip type is unknown.
Definition: chipinfo.h:142
HWREV_2_1
This chip's HW revision is 2.1.
Definition: chipinfo.h:274
ChipInfo_GetSupportedProtocol_BV
ProtocolBitVector_t ChipInfo_GetSupportedProtocol_BV(void)
Returns bit vector showing supported protocols.
Definition: chipinfo.c:56
ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated
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:161
BV
#define BV(x)
Definition: chipinfo.c:47
HWREV_Unknown
Chip HW revision is unknown.
Definition: chipinfo.h:271
ChipInfo_GetHwRevision
HwRevision_t ChipInfo_GetHwRevision(void)
Returns chip HW revision.
Definition: chipinfo.c:111
ChipInfo_HwRevisionIs_GTEQ_2_0
__STATIC_INLINE bool ChipInfo_HwRevisionIs_GTEQ_2_0(void)
Returns true if HW revision for this chip is 2.0 or greater.
Definition: chipinfo.h:311
chipinfo.h
HWREV_2_0
This chip's HW revision is 2.0.
Definition: chipinfo.h:273
HWREV_2_2
This chip's HW revision is 2.2.
Definition: chipinfo.h:275
ChipFamily_t
ChipFamily_t
Chip family enumeration.
Definition: chipinfo.h:221
ProtocolBitVector_t
ProtocolBitVector_t
Enumeration identifying the protocols supported.
Definition: chipinfo.h:75
ChipInfo_ChipFamilyIsCC26xx
__STATIC_INLINE bool ChipInfo_ChipFamilyIsCC26xx(void)
Returns true if this chip is member of the CC26xx family.
Definition: chipinfo.h:246
ChipInfo_GetChipFamily
ChipFamily_t ChipInfo_GetChipFamily(void)
Returns chip family member.
Definition: chipinfo.c:90
ChipInfo_GetDeviceIdHwRevCode
__STATIC_INLINE uint32_t ChipInfo_GetDeviceIdHwRevCode(void)
Returns the internal chip HW revision code.
Definition: chipinfo.h:209
FAMILY_CC13xx
This chip is a CC13xx family member.
Definition: chipinfo.h:224
HWREV_1_0
This chip's HW revision is 1.0.
Definition: chipinfo.h:272
PACKAGE_4x4
This is a 4x4mm chip.
Definition: chipinfo.h:143
PACKAGE_7x7
This is a 7x7mm chip.
Definition: chipinfo.h:145
FAMILY_CC26xx
This chip is a CC26xx family member.
Definition: chipinfo.h:223