arch/arm/src/tiva/cc13xx/cc13xx_chipinfo.c: Add chip info source file. This will be needed later in order to manage trimming and power setup.

This commit is contained in:
Gregory Nutt 2018-12-14 13:37:54 -06:00
parent 7fef81ea94
commit 791be4566e
9 changed files with 705 additions and 13 deletions

View File

@ -2369,7 +2369,7 @@ static void sam_interrupt_work(FAR void *arg)
/* Handle the received packet */
sam_receive(priv, qid);
sam_receive(priv, qid);
}
/* Check for TX errors */

View File

@ -129,14 +129,15 @@ endchoice
# Chip versions
choice
prompt "CC13x2 Chip Version"
default ARCH_CHIP_CC13X2_V1
prompt "CC13xx Chip Version"
default ARCH_CHIP_CC13XX_V1
depends on ARCH_CHIP_CC13X0 || ARCH_CHIP_CC13X2
config ARCH_CHIP_CC13XX_V1
bool "Version 1"
depends on ARCH_CHIP_CC13X2
config ARCH_CHIP_CC13X2_V1
bool "Version 1"
config ARCH_CHIP_CC13X2_V2
config ARCH_CHIP_CC13XX_V2
bool "Version 2"
endchoice # CC13x2 Chip Version

View File

@ -101,11 +101,11 @@ else
CHIP_CSRCS += lm4xx_tm3c_sysctrl.c
endif
else ifeq ($(CONFIG_ARCH_CHIP_CC13X0),y)
CHIP_CSRCS += cc13xx_start.c cc13xx_prcm.c cc13xx_gpio.c cc13xx_gpioirq.c
CHIP_CSRCS += cc13xx_enableclks.c cc13xx_enablepwr.c
CHIP_CSRCS += cc13xx_start.c cc13xx_prcm.c cc13xx_chipinfo.c cc13xx_gpio.c
CHIP_CSRCS += cc13xx_gpioirq.c cc13xx_enableclks.c cc13xx_enablepwr.c
else ifeq ($(CONFIG_ARCH_CHIP_CC13X2),y)
CHIP_CSRCS += cc13xx_start.c cc13xx_prcm.c cc13xx_gpio.c cc13xx_gpioirq.c
CHIP_CSRCS += cc13xx_enableclks.c cc13xx_enablepwr.c
CHIP_CSRCS += cc13xx_start.c cc13xx_prcm.c cc13xx_chipinfo.c cc13xx_gpio.c
CHIP_CSRCS += cc13xx_gpioirq.c cc13xx_enableclks.c cc13xx_enablepwr.c
endif
ifeq ($(CONFIG_DEBUG_GPIO_INFO),y)

View File

@ -0,0 +1,336 @@
/*****************************************************************************
* arch/arm/src/tiva/tiv_chipinfo.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
*
* Technical content derives from a TI header file that has a compatible BSD
* license:
*
* Copyright (c) 2015-2017, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
/*****************************************************************************
* Included Files
*****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <assert.h>
#include "hardware/tiva_prcm.h"
#include "tiva_chipinfo.h"
/*****************************************************************************
* Public Functions
*****************************************************************************/
/*****************************************************************************
* Name: chipinfo_protocols
*
* Description:
* Returns a bit set indicating supported protocols.
*
* Returned Value:
* Returns a bit set indicating supported protocols.
*
*****************************************************************************/
enum cc13xx_protocol_e chipinfo_protocols(void)
{
/* Return allowed RTC modes.
* REVISIT: Per fcfg1 header file, the allowed RGC modes are in bits 0-2. */
uint32_t regval = getreg32(TIVA_PRCM_RFCMODEHWOPT);
return (enum cc13xx_protocol_e)(regval & 0x0e);
}
/*****************************************************************************
* Name: chipinfo_packagetype
*
* Description:
* Returns an enumeration value indicating the package type.
*
* Returned Value:
* Returns an enumeration value indicating the package type.
*
*****************************************************************************/
enum cc13xx_package_e chipinfo_packagetype(void)
{
uint32_t regval = getreg32(TIVA_FCFG1_USER_ID);
enum cc13xx_package_e pkgtype;
pkgtype = (enum cc13xx_package_e)((regval & FCFG1_USER_ID_PKG_MASK) >>
FCFG1_USER_ID_PKG_SHIFT);
if (pkgtype < PACKAGE_4x4 || pkgtype > PACKAGE_4x4)
{
pkgtype = PACKAGE_UNKNOWN;
}
return pkgtype;
}
/*****************************************************************************
* Name: chipinfo_chiptype
*
* Description:
* Returns an enumeration value indicating the chip type
*
* Returned Value:
* Returns an enumeration value indicating the chip type
*
*****************************************************************************/
enum cc13xx_chiptype_e chipinfo_chiptype(void)
{
enum cc13xx_chiptype_e chiptype;
enum cc13xx_chipfamily_e chipfamily;
uint32_t userid;
uint32_t protocol;
#if defined(CONFIG_ARCH_CHIP_CC13X2)
bool cc13;
bool pa;
#endif
chiptype = CHIP_TYPE_UNKNOWN;
chipfamily = chipinfo_chipfamily();
userid = chipinfo_userid();
protocol = ((userid & FCFG1_USER_ID_PROTOCOL_MASK) >>
FCFG1_USER_ID_PROTOCOL_SHIFT);
#if defined(CONFIG_ARCH_CHIP_CC13X0)
if (chipfamily == FAMILY_CC13x0)
{
switch (protocol)
{
case 0x8:
chiptype = CHIP_TYPE_CC1310;
break;
case 0xf:
chiptype = CHIP_TYPE_CC1350;
break;
}
}
#elif defined(CONFIG_ARCH_CHIP_CC13X2)
cc13 = ((userid & FCFG1_USER_ID_CC13) != 0); /* CC13xx device type (vs CC26xx) */
pa = ((userid & FCFG1_USER_ID_PA) != 0); /* Supports 20dBM PA */
if (chipfamily == FAMILY_CC13x2_CC26x2)
{
switch (protocol)
{
case 0xf:
if (cc13)
{
if (pa)
{
chiptype = CHIP_TYPE_CC1352P;
}
else
{
chiptype = CHIP_TYPE_CC1352;
}
}
else
{
chiptype = CHIP_TYPE_CC2652;
}
break;
case 0x9:
if (pa)
{
chiptype = CHIP_TYPE_UNUSED;
}
else
{
chiptype = CHIP_TYPE_CC2642;
}
break;
case 0x8 :
chiptype = CHIP_TYPE_CC1312;
break;
}
}
#endif
return chiptype;
}
/*****************************************************************************
* Name: chipinfo_chipfamily
*
* Description:
* Returns an enumeration value indicating the chip family
*
* Returned Value:
* Returns an enumeration value indicating the chip family
*
*****************************************************************************/
enum cc13xx_chipfamily_e chipinfo_chipfamily(void)
{
enum cc13xx_chipfamily_e chipfamily = FAMILY_UNKNOWN;
uint32_t regval;
uint32_t waferid;
regval = getreg32(TIVA_FCFG1_ICEPICK_DEVICE_ID);
waferid = (regval & FCFG1_ICEPICK_DEVICE_ID_WAFER_ID_MASK) >>
FCFG1_ICEPICK_DEVICE_ID_WAFER_ID_SHIFT;
#if defined(CONFIG_ARCH_CHIP_CC13X0)
if (waferid == 0xb9be)
{
chipfamily = FAMILY_CC13x0;
}
#elif defined(CONFIG_ARCH_CHIP_CC13X2)
if (waferid == 0xbb41)
{
chipfamily = FAMILY_CC13x2_CC26x2;
}
#endif
return chipfamily;
}
/*****************************************************************************
* Name: chipinfo_hwrevision
*
* Description:
* Returns an enumeration value indicating the hardware revision of the chip
*
* Returned Value:
* Returns an enumeration value indicating the hardware revision of the chip
*
*****************************************************************************/
enum cc13xx_revision_e chipinfo_hwrevision(void)
{
enum cc13xx_revision_e hwrev;
enum cc13xx_chipfamily_e chipfamily;
uint32_t fcg1rev;
uint32_t hwminorrev;
hwrev = HWREV_UNKNOWN;
chipfamily = chipinfo_chipfamily();
fcg1rev = chipinfo_hwrevcode();
hwminorrev = chipinfo_hwminorrev();
#if defined(CONFIG_ARCH_CHIP_CC13X0)
if (chipfamily == FAMILY_CC13x0)
{
switch (fcg1rev)
{
case 0: /* CC13x0 PG1.0 */
hwrev = HWREV_1_0;
break;
case 2: /* CC13x0 PG2.0 (or later) */
hwrev = (enum cc13xx_revision_e)(((uint32_t)HWREV_2_0) + hwminorrev);
break;
}
}
#elif defined(CONFIG_ARCH_CHIP_CC13X2)
if (chipfamily == FAMILY_CC13x2_CC26x2)
{
switch (fcg1rev)
{
case 0: /* CC13x2, CC26x2 - PG1.0 */
case 1: /* CC13x2, CC26x2 - PG1.01 (will also show up as PG1.0) */
hwrev = (enum cc13xx_revision_e)((uint32_t)HWREV_1_0);
break;
case 2: /* CC13x2, CC26x2 - PG1.1 (or later) */
hwrev = (enum cc13xx_revision_e)(((uint32_t)HWREV_1_1) + hwminorrev);
break;
case 3: /* CC13x2, CC26x2 - PG2.1 (or later) */
hwrev = (enum cc13xx_revision_e)(((uint32_t)HWREV_2_1) + hwminorrev);
break;
}
}
#endif
return hwrev;
}
/*****************************************************************************
* Name: chipinfo_verify
*
* Description:
* Verifies that system is correctly configured for the current chip. This
* function will assert if that the system is NOT correctly configured.
*
* Returned Value:
* None
*
*****************************************************************************/
#ifdef CONFIG_DEBUG_ASSERTIONS
void chipinfo_verify(void)
{
enum cc13xx_chipfamily_e chip_family;
enum cc13xx_revision_e hwrev;
chip_family = chipinfo_chipfamily();
#if defined(CONFIG_ARCH_CHIP_CC13X0)
DEBUGASSERT(chip_family == FAMILY_CC13x0);
#elif defined(CONFIG_ARCH_CHIP_CC13X2)
DEBUGASSERT(chip_family == FAMILY_CC13x2_CC26x2);
#else
DEBUPANIC();
#endif
hwrev = chipinfo_hwrevision();
#if defined(CONFIG_ARCH_CHIP_CC13XX_V1)
DEBUGASSERT(hwrev >= HWREV_1_0 && hwrev < HWREV_2_0);
#elif defined(CONFIG_ARCH_CHIP_CC13XX_V2)
DEBUGASSERT(hwrev >= HWREV_2_0);
#else
DEBUPANIC();
#endif
}
#endif

View File

@ -271,12 +271,14 @@ void __start(void)
showprogress('E');
#endif
#ifndef CONFIG_ARCH_CHIP_CC13X0 /* REVISIT */
/* Initialize the Power Manager internal state. It must be called prior
* to any other Power API.
*/
cc13xx_power_initialize();
showprogress('F');
#endif
/* Initialize onboard resources */

View File

@ -139,7 +139,7 @@
/* FCFG1 Register Register Addresses ********************************************************************************/
#define TIVA_FCFG1_MISC_CONF_1 (TIVA_TIVA_FCFG1_BASE + TIVA_FCFG1_MISC_CONF_1_OFFSET)
#define TIVA_FCFG1_MISC_CONF_1 (TIVA_FCFG1_BASE + TIVA_FCFG1_MISC_CONF_1_OFFSET)
#define TIVA_FCFG1_MISC_CONF_2 (TIVA_FCFG1_BASE + TIVA_FCFG1_MISC_CONF_2_OFFSET)
#define TIVA_FCFG1_CONFIG_RF_FRONTEND_DIV5 (TIVA_FCFG1_BASE + TIVA_FCFG1_CONFIG_RF_FRONTEND_DIV5_OFFSET)
#define TIVA_FCFG1_CONFIG_RF_FRONTEND_DIV6 (TIVA_FCFG1_BASE + TIVA_FCFG1_CONFIG_RF_FRONTEND_DIV6_OFFSET)

View File

@ -139,7 +139,7 @@
/* FCFG1 Register Register Addresses ********************************************************************************/
#define TIVA_FCFG1_MISC_CONF_1 (TIVA_TIVA_FCFG1_BASE + TIVA_FCFG1_MISC_CONF_1_OFFSET)
#define TIVA_FCFG1_MISC_CONF_1 (TIVA_FCFG1_BASE + TIVA_FCFG1_MISC_CONF_1_OFFSET)
#define TIVA_FCFG1_MISC_CONF_2 (TIVA_FCFG1_BASE + TIVA_FCFG1_MISC_CONF_2_OFFSET)
#define TIVA_FCFG1_CONFIG_CC26_FE (TIVA_FCFG1_BASE + TIVA_FCFG1_CONFIG_CC26_FE_OFFSET)
#define TIVA_FCFG1_CONFIG_CC13_FE (TIVA_FCFG1_BASE + TIVA_FCFG1_CONFIG_CC13_FE_OFFSET)

View File

@ -0,0 +1,73 @@
/************************************************************************************
* arch/arm/src/tiva/hardware/tiva_fcfg1.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
#ifndef __ARCH_ARM_SRC_TIVA_HARDWARE_TIVA_FCFG1_H
#define __ARCH_ARM_SRC_TIVA_HARDWARE_TIVA_FCFG1_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
/* Include the pin mapping file for the specific Tiva/Stellaris/SimpleLink chip */
#if defined(CONFIG_ARCH_CHIP_LM) || defined(CONFIG_ARCH_CHIP_TM4C)
/* These architectures do not support the FCFG1 block */
#elif defined(CONFIG_ARCH_CHIP_CC13X0)
# include "hardware/cc13x0/cc13x0_fcfg1.h"
#elif defined(CONFIG_ARCH_CHIP_CC13X2)
# include "hardware/cc13x2_cc26x2/cc13x2_cc26x2_fcfg1.h"
#else
# error "Unsupported Tiva/Stellaris/SimpleLink FCFG1"
#endif
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
#endif /* __ARCH_ARM_SRC_TIVA_HARDWARE_TIVA_FCFG1_H */

View File

@ -0,0 +1,280 @@
/*****************************************************************************
* arch/arm/src/tiva/tiv_chipinfo.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
*
* Technical content derives from a TI header file that has a compatible BSD
* license:
*
* Copyright (c) 2015-2017, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#ifndef __ARCH_ARM_SRC_TIVA_TIVA_CHIPINFO_H
#define __ARCH_ARM_SRC_TIVA_TIVA_CHIPINFO_H
/*****************************************************************************
* Included Files
*****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include "up_arch.h"
#include "hardware/tiva_fcfg1.h"
/* Currently only applies to the CC13x0 and CC13x2 families */
#if defined(CONFIG_ARCH_CHIP_CC13X0) || defined(CONFIG_ARCH_CHIP_CC13X2)
/*****************************************************************************
* Public Types
*****************************************************************************/
enum cc13xx_protocol_e
{
PROTOCOL_UNKNOWN = 0x00, /* None of the known protocols are supported */
PROTOCOL_BLE = 0x02, /* Bit[1] Bluetooth Low Energy is supported */
PROTOCOL_IEEE_802_15_4 = 0x04, /* Bit[2] IEEE 802.15.4 is supported */
PROTOCOL_PROPRIETARY = 0x08 /* Bit[3] proprietary protocols are supported */
};
enum cc13xx_package_e
{
PACKAGE_UNKNOWN = -1, /* -1 means that current package type is unknown */
PACKAGE_4x4 = 0, /* 0 This is a 4x4 mm QFN (RHB) package */
PACKAGE_5x5 = 1, /* 1 This is a 5x5 mm QFN (RSM) package */
PACKAGE_7x7 = 2, /* 2 This is a 7x7 mm QFN (RGZ) package */
PACKAGE_WAFER = 3, /* 3 This is a wafer sale package (naked die) */
PACKAGE_WCSP = 4, /* 4 This is a 2.7x2.7 mm WCSP (YFV) */
PACKAGE_7x7_Q1 = 5 /* 5 This is a 7x7 mm QFN package with Wettable Flanks */
};
enum cc13xx_chipfamily_e
{
FAMILY_UNKNOWN = -1, /* -1 The chip's family member is unknown */
FAMILY_CC26x0 = 0, /* 0 The chip is a CC26x0 family member */
FAMILY_CC13x0 = 1, /* 1 The chip is a CC13x0 family member */
FAMILY_CC26x1 = 2, /* 2 The chip is a CC26x1 family member */
FAMILY_CC26x0R2 = 3, /* 3 The chip is a CC26x0R2 family (new ROM contents) */
FAMILY_CC13x2_CC26x2 = 4 /* 4 The chip is a CC13x2, CC26x2 family member */
};
enum cc13xx_chiptype_e
{
CHIP_TYPE_UNKNOWN = -1, /* -1 The chip type is unknown */
CHIP_TYPE_CC1310 = 0, /* 0 This is a CC1310 chip */
CHIP_TYPE_CC1350 = 1, /* 1 This is a CC1350 chip */
CHIP_TYPE_CC2620 = 2, /* 2 This is a CC2620 chip */
CHIP_TYPE_CC2630 = 3, /* 3 This is a CC2630 chip */
CHIP_TYPE_CC2640 = 4, /* 4 This is a CC2640 chip */
CHIP_TYPE_CC2650 = 5, /* 5 This is a CC2650 chip */
CHIP_TYPE_CUSTOM_0 = 6, /* 6 This is a CUSTOM_0 chip */
CHIP_TYPE_CUSTOM_1 = 7, /* 7 This is a CUSTOM_1 chip */
CHIP_TYPE_CC2640R2 = 8, /* 8 This is a CC2640R2 chip */
CHIP_TYPE_CC2642 = 9, /* 9 This is a CC2642 chip */
CHIP_TYPE_UNUSED = 10, /* 10 unused value */
CHIP_TYPE_CC2652 = 11, /* 11 This is a CC2652 chip */
CHIP_TYPE_CC1312 = 12, /* 12 This is a CC1312 chip */
CHIP_TYPE_CC1352 = 13, /* 13 This is a CC1352 chip */
CHIP_TYPE_CC1352P = 14 /* 14 This is a CC1352P chip */
};
enum cc13xx_revision_e
{
HWREV_UNKNOWN = -1, /* -1 The chip's HW revision is unknown */
HWREV_1_0 = 10, /* 10 The chip's HW revision is 1.0 */
HWREV_1_1 = 11, /* 11 The chip's HW revision is 1.1 */
HWREV_2_0 = 20, /* 20 The chip's HW revision is 2.0 */
HWREV_2_1 = 21, /* 21 The chip's HW revision is 2.1 */
HWREV_2_2 = 22, /* 22 The chip's HW revision is 2.2 */
HWREV_2_3 = 23, /* 23 The chip's HW revision is 2.3 */
HWREV_2_4 = 24 /* 24 The chip's HW revision is 2.4 */
};
/*****************************************************************************
* Public Function Prototypes
*****************************************************************************/
/*****************************************************************************
* Name: chipinfo_protocols
*
* Description:
* Returns a bit set indicating supported protocols.
*
* Returned Value:
* Returns a bit set indicating supported protocols.
*
*****************************************************************************/
enum cc13xx_protocol_e chipinfo_protocols(void);
/*****************************************************************************
* Name: chipinfo_packagetype
*
* Description:
* Returns an enumeration value indicating the package type.
*
* Returned Value:
* Returns an enumeration value indicating the package type.
*
*****************************************************************************/
enum cc13xx_package_e chipinfo_packagetype(void);
/*****************************************************************************
* Name: chipinfo_hwrevcode
*
* Description:
* Returns the internal chip HW revision code (in range 0-15)
*
* Returned Value:
* Returns the internal chip HW revision code (in range 0-15)
*
*****************************************************************************/
static inline uint32_t chipinfo_hwrevcode(void)
{
uint32_t regval = getreg32(TIVA_FCFG1_ICEPICK_DEVICE_ID);
/* Returns HwRevCode = FCFG1_O_ICEPICK_DEVICE_ID[31:28] */
return (regval & FCFG1_ICEPICK_DEVICE_ID_PG_REV_MASK) >>
FCFG1_ICEPICK_DEVICE_ID_PG_REV_SHIFT;
}
/*****************************************************************************
* Name: chipinfo_hwminorrev
*
* Description:
* Returns the minor hardware revision number (in range 0-127)
*
* The minor revision number is set to 0 for the first market released chip
* and thereafter incremented by 1 for each minor hardware change.
*
* Returned Value:
* Returns the minor hardware revision number (in range 0-127)
*
*****************************************************************************/
static inline uint32_t chipinfo_hwminorrev(void)
{
uint32_t regval = getreg32(TIVA_FCFG1_MISC_CONF_1);
uint32_t minorrev = (regval & FCFG1_MISC_CONF_1_DEVICE_MINOR_REV_MASK) >>
FCFG1_MISC_CONF_1_DEVICE_MINOR_REV_SHIFT;
if (minorrev >= 0x80)
{
minorrev = 0;
}
return minorrev;
}
/*****************************************************************************
* Name: chipinfo_userid
*
* Description:
* Returns the 32 bits USER_ID field
*
* See the Technical Reference Manual (TRM) for how to decode the USER_ID
* field.
*
* Returned Value:
* Returns the 32 bits USER_ID field
*
*****************************************************************************/
static inline uint32_t chipinfo_userid(void)
{
return getreg32(TIVA_FCFG1_USER_ID);
}
/*****************************************************************************
* Name: chipinfo_chiptype
*
* Description:
* Returns an enumeration value indicating the chip type
*
* Returned Value:
* Returns an enumeration value indicating the chip type
*
*****************************************************************************/
enum cc13xx_chiptype_e chipinfo_chiptype(void);
/*****************************************************************************
* Name: chipinfo_chipfamily
*
* Description:
* Returns an enumeration value indicating the chip family
*
* Returned Value:
* Returns an enumeration value indicating the chip family
*
*****************************************************************************/
enum cc13xx_chipfamily_e chipinfo_chipfamily(void);
/*****************************************************************************
* Name: chipinfo_hwrevision
*
* Description:
* Returns an enumeration value indicating the hardware revision of the chip
*
* Returned Value:
* Returns an enumeration value indicating the hardware revision of the chip
*
*****************************************************************************/
enum cc13xx_revision_e chipinfo_hwrevision(void);
/*****************************************************************************
* Name: chipinfo_verify
*
* Description:
* Verifies that system is correctly configured for the current chip. This
* function will assert if that the system is NOT correctly configured.
*
* Returned Value:
* None
*
*****************************************************************************/
#ifdef CONFIG_DEBUG_ASSERTIONS
void chipinfo_verify(void);
#else
# define chipinfo_verify()
#endif
#endif /* CONFIG_ARCH_CHIP_CC13X0 || CONFIG_ARCH_CHIP_CC13X2 */
#endif /* __ARCH_ARM_SRC_TIVA_TIVA_CHIPINFO_H */