1 /***************************************************************************//**
\r
3 * @brief System Peripheral API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\r
10 * Permission is granted to anyone to use this software for any purpose,
\r
11 * including commercial applications, and to alter it and redistribute it
\r
12 * freely, subject to the following restrictions:
\r
14 * 1. The origin of this software must not be misrepresented; you must not
\r
15 * claim that you wrote the original software.
\r
16 * 2. Altered source versions must be plainly marked as such, and must not be
\r
17 * misrepresented as being the original software.
\r
18 * 3. This notice may not be removed or altered from any source distribution.
\r
20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
\r
21 * obligation to support this Software. Silicon Labs is providing the
\r
22 * Software "AS IS", with no express or implied warranties of any kind,
\r
23 * including, but not limited to, any implied warranties of merchantability
\r
24 * or fitness for any particular purpose or warranties against infringement
\r
25 * of any proprietary rights of a third party.
\r
27 * Silicon Labs will not be liable for any consequential, incidental, or
\r
28 * special damages, or any other relief, or for any claim by any third party,
\r
29 * arising from your use of this Software.
\r
31 ******************************************************************************/
\r
34 #include "em_system.h"
\r
35 #include "em_assert.h"
\r
37 /***************************************************************************//**
\r
38 * @addtogroup EM_Library
\r
40 ******************************************************************************/
\r
42 /***************************************************************************//**
\r
43 * @addtogroup SYSTEM
\r
44 * @brief System Peripheral API
\r
46 ******************************************************************************/
\r
48 /*******************************************************************************
\r
49 ************************** GLOBAL FUNCTIONS *******************************
\r
50 ******************************************************************************/
\r
52 /***************************************************************************//**
\r
54 * Get chip major/minor revision.
\r
57 * Location to place chip revision info.
\r
58 ******************************************************************************/
\r
59 void SYSTEM_ChipRevisionGet(SYSTEM_ChipRevision_TypeDef *rev)
\r
65 /* CHIP FAMILY bit [5:2] */
\r
66 tmp = (((ROMTABLE->PID1 & _ROMTABLE_PID1_FAMILYMSB_MASK) >> _ROMTABLE_PID1_FAMILYMSB_SHIFT) << 2);
\r
67 /* CHIP FAMILY bit [1:0] */
\r
68 tmp |= ((ROMTABLE->PID0 & _ROMTABLE_PID0_FAMILYLSB_MASK) >> _ROMTABLE_PID0_FAMILYLSB_SHIFT);
\r
71 /* CHIP MAJOR bit [3:0] */
\r
72 rev->major = (ROMTABLE->PID0 & _ROMTABLE_PID0_REVMAJOR_MASK) >> _ROMTABLE_PID0_REVMAJOR_SHIFT;
\r
74 /* CHIP MINOR bit [7:4] */
\r
75 tmp = (((ROMTABLE->PID2 & _ROMTABLE_PID2_REVMINORMSB_MASK) >> _ROMTABLE_PID2_REVMINORMSB_SHIFT) << 4);
\r
76 /* CHIP MINOR bit [3:0] */
\r
77 tmp |= ((ROMTABLE->PID3 & _ROMTABLE_PID3_REVMINORLSB_MASK) >> _ROMTABLE_PID3_REVMINORLSB_SHIFT);
\r
81 /***************************************************************************//**
\r
83 * Get factory calibration value for a given peripheral register.
\r
85 * @param[in] regAddress
\r
86 * Address of register to get a calibration value for.
\r
89 * Calibration value for the requested register.
\r
90 ******************************************************************************/
\r
91 uint32_t SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
\r
94 CALIBRATE_TypeDef *p;
\r
101 if ((regCount > CALIBRATE_MAX_REGISTERS) ||
\r
102 (p->VALUE == 0xFFFFFFFF))
\r
105 return 0; /* End of device calibration table reached. */
\r
108 if (p->ADDRESS == (uint32_t)regAddress)
\r
110 return p->VALUE; /* Calibration value found ! */
\r
118 /** @} (end addtogroup SYSTEM) */
\r
119 /** @} (end addtogroup EM_Library) */
\r