CC26xx Driver Library
chipinfo.c
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: chipinfo.c
3 * Revised: 2015-12-09 13:11:01 +0100 (Wed, 09 Dec 2015)
4 * Revision: 45286
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 // ChipInfo_GetSupportedProtocol_BV()
44 //
45 //*****************************************************************************
48 {
49  return ((ProtocolBitVector_t)( HWREG( PRCM_BASE + 0x1D4 ) & 0x0E ));
50 }
51 
52 
53 //*****************************************************************************
54 //
55 // ChipInfo_GetPackageType()
56 //
57 //*****************************************************************************
60 {
61  PackageType_t packType = (PackageType_t)((
62  HWREG( FCFG1_BASE + FCFG1_O_USER_ID ) &
65 
66  if (( packType < PACKAGE_4x4 ) ||
67  ( packType > PACKAGE_WCSP ) )
68  {
69  packType = PACKAGE_Unknown;
70  }
71 
72  return ( packType );
73 }
74 
75 
76 //*****************************************************************************
77 //
78 // ChipInfo_GetChipFamily()
79 //
80 //*****************************************************************************
83 {
84  ChipFamily_t chipFam = FAMILY_Unknown ;
85  uint32_t waferId ;
86 
87  waferId = (( HWREG( FCFG1_BASE + FCFG1_O_ICEPICK_DEVICE_ID ) &
90 
91  if ( waferId == 0xB99A ) {
92  if ( ChipInfo_GetDeviceIdHwRevCode() == 0xB ) {
93  chipFam = FAMILY_CC26xxR2 ;
94  } else {
95  chipFam = FAMILY_CC26xx ;
96  }
97  } else if ( waferId == 0xB9BE ) chipFam = FAMILY_CC13xx ;
98  else if ( waferId == 0xBB41 ) chipFam = FAMILY_CC26xxAgama ;
99  else if ( waferId == 0xBB20 ) chipFam = FAMILY_CC26xxLizard ;
100 
101  return ( chipFam );
102 }
103 
104 
105 //*****************************************************************************
106 //
107 // ChipInfo_GetHwRevision()
108 //
109 //*****************************************************************************
112 {
113  HwRevision_t hwRev = HWREV_Unknown ;
114  uint32_t fcfg1Rev = ChipInfo_GetDeviceIdHwRevCode() ;
115  uint32_t minorHwRev = ChipInfo_GetMinorHwRev() ;
116 
117  switch( ChipInfo_GetChipFamily() ) {
118  case FAMILY_CC26xx :
119  switch ( fcfg1Rev ) {
120  case 1 : // CC26xx PG1.0
121  hwRev = HWREV_1_0;
122  break;
123  case 3 : // CC26xx PG2.0
124  hwRev = HWREV_2_0;
125  break;
126  case 7 : // CC26xx PG2.1
127  hwRev = HWREV_2_1;
128  break;
129  case 8 : // CC26xx PG2.2 (or later)
130  hwRev = (HwRevision_t)(((uint32_t)HWREV_2_2 ) + minorHwRev );
131  break;
132  }
133  break;
134  case FAMILY_CC13xx :
135  switch ( fcfg1Rev ) {
136  case 0 : // CC13xx PG1.0
137  hwRev = HWREV_1_0;
138  break;
139  case 2 : // CC13xx PG2.0 (or later)
140  hwRev = (HwRevision_t)(((uint32_t)HWREV_2_0 ) + minorHwRev );
141  break;
142  }
143  break;
144  case FAMILY_CC26xxLizard :
145  case FAMILY_CC26xxAgama :
146  switch ( fcfg1Rev ) {
147  case 0 : // CC26xxLizard or CC26xxAgama PG1.0 (or later)
148  hwRev = (HwRevision_t)(((uint32_t)HWREV_1_0 ) + minorHwRev );
149  break;
150  }
151  break;
152  case FAMILY_CC26xxR2 :
153  hwRev = (HwRevision_t)(((uint32_t)HWREV_1_0 ) + minorHwRev );
154  break;
155  default :
156  // GCC gives warning if not handling all options explicitly in a "switch" on a variable of type "enum"
157  break;
158  }
159 
160  return ( hwRev );
161 }
162 
163 
164 
165 //*****************************************************************************
166 // ThisCodeIsBuiltForCC26xxHwRev22AndLater_HaltIfViolated()
167 //*****************************************************************************
168 void
170 {
171  if (( ! ChipInfo_ChipFamilyIsCC26xx() ) ||
173  {
174  while(1)
175  {
176  //
177  // This driverlib version is for CC26xx PG2.2 and later
178  // Do nothing - stay here forever
179  //
180  }
181  }
182 }
PackageType_t ChipInfo_GetPackageType(void)
Returns package type.
Definition: chipinfo.c:59
static bool ChipInfo_HwRevisionIs_GTEQ_2_2(void)
Returns true if HW revision for this chip is 2.2 or greater.
Definition: chipinfo.h:484
3 means that the chip is a CC26xxAgama family member.
Definition: chipinfo.h:283
HwRevision_t
HW revision enumeration.
Definition: chipinfo.h:372
PackageType_t
Package type enumeration.
Definition: chipinfo.h:143
-1 means that the chip's family member is unknown.
Definition: chipinfo.h:279
-1 means that current chip type is unknown.
Definition: chipinfo.h:144
4 means that this is a WCSP chip (flip chip).
Definition: chipinfo.h:149
21 means that the chip's HW revision is 2.1
Definition: chipinfo.h:376
ProtocolBitVector_t ChipInfo_GetSupportedProtocol_BV(void)
Returns bit vector showing supported protocols.
Definition: chipinfo.c:47
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:169
4 means that the chip is a CC26xxR2 family (new ROM contents).
Definition: chipinfo.h:284
-1 means that the chip's HW revision is unknown.
Definition: chipinfo.h:373
HwRevision_t ChipInfo_GetHwRevision(void)
Returns chip HW revision.
Definition: chipinfo.c:111
20 means that the chip's HW revision is 2.0
Definition: chipinfo.h:375
22 means that the chip's HW revision is 2.2
Definition: chipinfo.h:377
ChipFamily_t
Chip family enumeration.
Definition: chipinfo.h:278
static bool ChipInfo_ChipFamilyIsCC26xx(void)
Returns true if this chip is member of the CC26xx family.
Definition: chipinfo.h:306
ProtocolBitVector_t
Enumeration identifying the protocols supported.
Definition: chipinfo.h:77
ChipFamily_t ChipInfo_GetChipFamily(void)
Returns chip family member.
Definition: chipinfo.c:82
1 means that the chip is a CC13xx family member.
Definition: chipinfo.h:281
2 means that the chip is a CC26xxLizard family member.
Definition: chipinfo.h:282
static uint32_t ChipInfo_GetDeviceIdHwRevCode(void)
Returns the internal chip HW revision code.
Definition: chipinfo.h:241
10 means that the chip's HW revision is 1.0
Definition: chipinfo.h:374
0 means that this is a 4x4mm chip.
Definition: chipinfo.h:145
static uint32_t ChipInfo_GetMinorHwRev(void)
Returns minor hardware revision number.
Definition: chipinfo.h:259
0 means that the chip is a CC26xx family member.
Definition: chipinfo.h:280