CC26xx Driver Library
chipinfo.c
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: chipinfo.c
3 * Revised: 2016-08-11 14:48:49 +0200 (Thu, 11 Aug 2016)
4 * Revision: 47002
5 *
6 * Description: Collection of functions returning chip information.
7 *
8 * Copyright (c) 2015 - 2016, 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 // Handle support for DriverLib in ROM:
44 // This section will undo prototype renaming made in the header file
45 //
46 //*****************************************************************************
47 #if !defined(DOXYGEN)
48  #undef ChipInfo_GetSupportedProtocol_BV
49  #define ChipInfo_GetSupportedProtocol_BV NOROM_ChipInfo_GetSupportedProtocol_BV
50  #undef ChipInfo_GetPackageType
51  #define ChipInfo_GetPackageType NOROM_ChipInfo_GetPackageType
52  #undef ChipInfo_GetChipType
53  #define ChipInfo_GetChipType NOROM_ChipInfo_GetChipType
54  #undef ChipInfo_GetChipFamily
55  #define ChipInfo_GetChipFamily NOROM_ChipInfo_GetChipFamily
56  #undef ChipInfo_GetHwRevision
57  #define ChipInfo_GetHwRevision NOROM_ChipInfo_GetHwRevision
58  #undef ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated
59  #define ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated NOROM_ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated
60 #endif
61 
62 //*****************************************************************************
63 //
64 // ChipInfo_GetSupportedProtocol_BV()
65 //
66 //*****************************************************************************
69 {
70  return ((ProtocolBitVector_t)( HWREG( PRCM_BASE + 0x1D4 ) & 0x0E ));
71 }
72 
73 
74 //*****************************************************************************
75 //
76 // ChipInfo_GetPackageType()
77 //
78 //*****************************************************************************
81 {
82  PackageType_t packType = (PackageType_t)((
83  HWREG( FCFG1_BASE + FCFG1_O_USER_ID ) &
86 
87  if (( packType < PACKAGE_4x4 ) ||
88  ( packType > PACKAGE_WCSP ) )
89  {
90  packType = PACKAGE_Unknown;
91  }
92 
93  return ( packType );
94 }
95 
96 //*****************************************************************************
97 //
98 // ChipInfo_GetChipFamily()
99 //
100 //*****************************************************************************
103 {
104  ChipFamily_t chipFam = FAMILY_Unknown ;
105  uint32_t waferId ;
106 
107  waferId = (( HWREG( FCFG1_BASE + FCFG1_O_ICEPICK_DEVICE_ID ) &
110 
111  if ( waferId == 0xB99A ) {
112  if ( ChipInfo_GetDeviceIdHwRevCode() == 0xB ) {
113  chipFam = FAMILY_CC26xx_R2 ;
114  } else {
115  chipFam = FAMILY_CC26xx ;
116  }
117  } else if ( waferId == 0xB9BE ) chipFam = FAMILY_CC13xx ;
118  else if ( waferId == 0xBB41 ) chipFam = FAMILY_CC26xx_Aga ;
119  else if ( waferId == 0xBB20 ) chipFam = FAMILY_CC26xx_Liz ;
120 
121  return ( chipFam );
122 }
123 
124 
125 //*****************************************************************************
126 //
127 // ChipInfo_GetChipType()
128 //
129 //*****************************************************************************
132 {
133  ChipType_t chipType = CHIP_TYPE_Unknown ;
134  uint32_t fcfg1UserId = ChipInfo_GetUserId();
135  uint32_t fcfg1Protocol = (( fcfg1UserId & FCFG1_USER_ID_PROTOCOL_M ) >>
137 
138  switch( ChipInfo_GetChipFamily() ) {
139 
140  case FAMILY_CC26xx :
141  switch ( fcfg1Protocol ) {
142  case 0x2 :
143  chipType = CHIP_TYPE_CC2620 ;
144  break;
145  case 0x4 :
146  case 0xC :
147  chipType = CHIP_TYPE_CC2630 ;
148  case 0x1 :
149  case 0x9 :
150  chipType = CHIP_TYPE_CC2640 ;
151  if ( fcfg1UserId & ( 1 << 23 )) {
152  chipType = CHIP_TYPE_CUSTOM_1;
153  }
154  break;
155  case 0xF :
156  chipType = CHIP_TYPE_CC2650 ;
157  if ( fcfg1UserId & ( 1 << 24 )) {
158  chipType = CHIP_TYPE_CUSTOM_0;
159  }
160  break;
161  }
162  break;
163 
164  default :
165  chipType = CHIP_TYPE_Unknown ;
166  break;
167  }
168 
169  return ( chipType );
170 }
171 
172 
173 //*****************************************************************************
174 //
175 // ChipInfo_GetHwRevision()
176 //
177 //*****************************************************************************
180 {
181  HwRevision_t hwRev = HWREV_Unknown ;
182  uint32_t fcfg1Rev = ChipInfo_GetDeviceIdHwRevCode() ;
183  uint32_t minorHwRev = ChipInfo_GetMinorHwRev() ;
184 
185  switch( ChipInfo_GetChipFamily() ) {
186  case FAMILY_CC26xx :
187  switch ( fcfg1Rev ) {
188  case 1 : // CC26xx PG1.0
189  hwRev = HWREV_1_0;
190  break;
191  case 3 : // CC26xx PG2.0
192  hwRev = HWREV_2_0;
193  break;
194  case 7 : // CC26xx PG2.1
195  hwRev = HWREV_2_1;
196  break;
197  case 8 : // CC26xx PG2.2 (or later)
198  hwRev = (HwRevision_t)(((uint32_t)HWREV_2_2 ) + minorHwRev );
199  break;
200  }
201  break;
202  case FAMILY_CC13xx :
203  switch ( fcfg1Rev ) {
204  case 0 : // CC13xx PG1.0
205  hwRev = HWREV_1_0;
206  break;
207  case 2 : // CC13xx PG2.0 (or later)
208  hwRev = (HwRevision_t)(((uint32_t)HWREV_2_0 ) + minorHwRev );
209  break;
210  }
211  break;
212  case FAMILY_CC26xx_Liz :
213  case FAMILY_CC26xx_Aga :
214  switch ( fcfg1Rev ) {
215  case 0 : // CC26xx_Liz or CC26xx_Aga PG1.0 (or later)
216  hwRev = (HwRevision_t)(((uint32_t)HWREV_1_0 ) + minorHwRev );
217  break;
218  }
219  break;
220  case FAMILY_CC26xx_R2 :
221  hwRev = (HwRevision_t)(((uint32_t)HWREV_1_0 ) + minorHwRev );
222  break;
223  default :
224  // GCC gives warning if not handling all options explicitly in a "switch" on a variable of type "enum"
225  break;
226  }
227 
228  return ( hwRev );
229 }
230 
231 
232 
233 //*****************************************************************************
234 // ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated()
235 //*****************************************************************************
236 void
238 {
239  if (( ! ChipInfo_ChipFamilyIsCC26xx() ) ||
241  {
242  while(1)
243  {
244  //
245  // This driverlib version is for CC26xx PG2.2 and later
246  // Do nothing - stay here forever
247  //
248  }
249  }
250 }
PackageType_t ChipInfo_GetPackageType(void)
Returns package type.
Definition: chipinfo.c:80
static bool ChipInfo_HwRevisionIs_GTEQ_2_2(void)
Returns true if HW revision for this chip is 2.2 or greater.
Definition: chipinfo.h:552
HwRevision_t
HW revision enumeration.
Definition: chipinfo.h:440
PackageType_t
Package type enumeration.
Definition: chipinfo.h:165
-1 means that the chip's family member is unknown.
Definition: chipinfo.h:346
-1 means that current chip type is unknown.
Definition: chipinfo.h:166
4 means that this is a WCSP chip (flip chip).
Definition: chipinfo.h:171
21 means that the chip's HW revision is 2.1
Definition: chipinfo.h:444
ProtocolBitVector_t ChipInfo_GetSupportedProtocol_BV(void)
Returns bit vector showing supported protocols.
Definition: chipinfo.c:68
static uint32_t ChipInfo_GetUserId(void)
Returns the 32 bits USER_ID field.
Definition: chipinfo.h:306
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:237
5 means that this is a CC2650 chip.
Definition: chipinfo.h:324
-1 means that the chip type is unknown.
Definition: chipinfo.h:318
7 means that this is a CUSTOM_1 chip.
Definition: chipinfo.h:326
3 means that this is a CC2630 chip.
Definition: chipinfo.h:322
6 means that this is a CUSTOM_0 chip.
Definition: chipinfo.h:325
-1 means that the chip's HW revision is unknown.
Definition: chipinfo.h:441
HwRevision_t ChipInfo_GetHwRevision(void)
Returns chip HW revision.
Definition: chipinfo.c:179
20 means that the chip's HW revision is 2.0
Definition: chipinfo.h:443
4 means that this is a CC2640 chip.
Definition: chipinfo.h:323
22 means that the chip's HW revision is 2.2
Definition: chipinfo.h:445
ChipType_t
Chip type enumeration.
Definition: chipinfo.h:317
ChipFamily_t
Chip family enumeration.
Definition: chipinfo.h:345
static bool ChipInfo_ChipFamilyIsCC26xx(void)
Returns true if this chip is member of the CC26xx family.
Definition: chipinfo.h:373
ProtocolBitVector_t
Enumeration identifying the protocols supported.
Definition: chipinfo.h:99
ChipFamily_t ChipInfo_GetChipFamily(void)
Returns chip family member.
Definition: chipinfo.c:102
1 means that the chip is a CC13x0 family member.
Definition: chipinfo.h:348
static uint32_t ChipInfo_GetDeviceIdHwRevCode(void)
Returns the internal chip HW revision code.
Definition: chipinfo.h:263
ChipType_t ChipInfo_GetChipType(void)
Returns chip type.
Definition: chipinfo.c:131
2 means that the chip is a CC26x1 family member.
Definition: chipinfo.h:349
10 means that the chip's HW revision is 1.0
Definition: chipinfo.h:442
2 means that this is a CC2620 chip.
Definition: chipinfo.h:321
0 means that this is a 4x4mm chip.
Definition: chipinfo.h:167
static uint32_t ChipInfo_GetMinorHwRev(void)
Returns minor hardware revision number.
Definition: chipinfo.h:281
3 means that the chip is a CCxxx2/xxx4 family member.
Definition: chipinfo.h:350
4 means that the chip is a CC26x0_R2 family (new ROM contents).
Definition: chipinfo.h:351
0 means that the chip is a CC26x0 family member.
Definition: chipinfo.h:347