EFM32 Wonder Gecko Software Documentation  efm32wg-doc-4.2.1
em_system.c
Go to the documentation of this file.
1 /***************************************************************************/
33 #include "em_system.h"
34 #include "em_assert.h"
35 
36 /***************************************************************************/
41 /***************************************************************************/
47 /*******************************************************************************
48  ************************** GLOBAL FUNCTIONS *******************************
49  ******************************************************************************/
50 
51 /***************************************************************************/
59 {
60  uint8_t tmp;
61 
62  EFM_ASSERT(rev);
63 
64  /* CHIP FAMILY bit [5:2] */
66  /* CHIP FAMILY bit [1:0] */
68  rev->family = tmp;
69 
70  /* CHIP MAJOR bit [3:0] */
72 
73  /* CHIP MINOR bit [7:4] */
75  /* CHIP MINOR bit [3:0] */
77  rev->minor = tmp;
78 }
79 
80 
81 #if defined(CALIBRATE)
82 /***************************************************************************/
92 uint32_t SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
93 {
94  int regCount;
96 
97  regCount = 1;
98  p = CALIBRATE;
99 
100  for (;; )
101  {
102  if ((regCount > CALIBRATE_MAX_REGISTERS) ||
103  (p->VALUE == 0xFFFFFFFF))
104  {
105  EFM_ASSERT(false);
106  return 0; /* End of device calibration table reached. */
107  }
108 
109  if (p->ADDRESS == (uint32_t)regAddress)
110  {
111  return p->VALUE; /* Calibration value found ! */
112  }
113 
114  p++;
115  regCount++;
116  }
117 }
118 #endif /* defined (CALIBRATE) */
119 
Emlib peripheral API "assert" implementation.
void SYSTEM_ChipRevisionGet(SYSTEM_ChipRevision_TypeDef *rev)
Get chip major/minor revision.
Definition: em_system.c:58
#define CALIBRATE
#define _ROMTABLE_PID0_REVMAJOR_SHIFT
#define ROMTABLE
__I uint32_t ADDRESS
uint32_t SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
Get factory calibration value for a given peripheral register.
Definition: em_system.c:92
#define _ROMTABLE_PID2_REVMINORMSB_SHIFT
#define _ROMTABLE_PID1_FAMILYMSB_MASK
#define CALIBRATE_MAX_REGISTERS
#define _ROMTABLE_PID0_FAMILYLSB_MASK
#define _ROMTABLE_PID3_REVMINORLSB_SHIFT
#define _ROMTABLE_PID0_FAMILYLSB_SHIFT
System API.
#define _ROMTABLE_PID2_REVMINORMSB_MASK
#define _ROMTABLE_PID3_REVMINORLSB_MASK
#define _ROMTABLE_PID1_FAMILYMSB_SHIFT
#define _ROMTABLE_PID0_REVMAJOR_MASK