1 /***************************************************************************//**
\r
3 * @brief System Peripheral API
\r
5 *******************************************************************************
\r
7 * <b>(C) Copyright 2015 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
33 #include "em_system.h"
\r
34 #include "em_assert.h"
\r
36 /***************************************************************************//**
\r
37 * @addtogroup EM_Library
\r
39 ******************************************************************************/
\r
41 /***************************************************************************//**
\r
42 * @addtogroup SYSTEM
\r
43 * @brief System Peripheral API
\r
45 ******************************************************************************/
\r
47 /*******************************************************************************
\r
48 ************************** GLOBAL FUNCTIONS *******************************
\r
49 ******************************************************************************/
\r
51 /***************************************************************************//**
\r
53 * Get chip major/minor revision.
\r
56 * Location to place chip revision info.
\r
57 ******************************************************************************/
\r
58 void SYSTEM_ChipRevisionGet(SYSTEM_ChipRevision_TypeDef *rev)
\r
64 /* CHIP FAMILY bit [5:2] */
\r
65 tmp = (((ROMTABLE->PID1 & _ROMTABLE_PID1_FAMILYMSB_MASK) >> _ROMTABLE_PID1_FAMILYMSB_SHIFT) << 2);
\r
66 /* CHIP FAMILY bit [1:0] */
\r
67 tmp |= ((ROMTABLE->PID0 & _ROMTABLE_PID0_FAMILYLSB_MASK) >> _ROMTABLE_PID0_FAMILYLSB_SHIFT);
\r
70 /* CHIP MAJOR bit [3:0] */
\r
71 rev->major = (ROMTABLE->PID0 & _ROMTABLE_PID0_REVMAJOR_MASK) >> _ROMTABLE_PID0_REVMAJOR_SHIFT;
\r
73 /* CHIP MINOR bit [7:4] */
\r
74 tmp = (((ROMTABLE->PID2 & _ROMTABLE_PID2_REVMINORMSB_MASK) >> _ROMTABLE_PID2_REVMINORMSB_SHIFT) << 4);
\r
75 /* CHIP MINOR bit [3:0] */
\r
76 tmp |= ((ROMTABLE->PID3 & _ROMTABLE_PID3_REVMINORLSB_MASK) >> _ROMTABLE_PID3_REVMINORLSB_SHIFT);
\r
81 #if defined(CALIBRATE)
\r
82 /***************************************************************************//**
\r
84 * Get factory calibration value for a given peripheral register.
\r
86 * @param[in] regAddress
\r
87 * Address of register to get a calibration value for.
\r
90 * Calibration value for the requested register.
\r
91 ******************************************************************************/
\r
92 uint32_t SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
\r
95 CALIBRATE_TypeDef *p;
\r
102 if ((regCount > CALIBRATE_MAX_REGISTERS) ||
\r
103 (p->VALUE == 0xFFFFFFFF))
\r
106 return 0; /* End of device calibration table reached. */
\r
109 if (p->ADDRESS == (uint32_t)regAddress)
\r
111 return p->VALUE; /* Calibration value found ! */
\r
118 #endif /* defined (CALIBRATE) */
\r
120 /** @} (end addtogroup SYSTEM) */
\r
121 /** @} (end addtogroup EM_Library) */
\r