EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
em_system.c
Go to the documentation of this file.
1 /***************************************************************************/
33 #include "em_system.h"
34 #include "em_assert.h"
35 #include <stddef.h>
36 
37 /***************************************************************************/
42 /***************************************************************************/
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 /***************************************************************************/
93 bool SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
94 {
95  SYSTEM_CalAddrVal_TypeDef * p, * end;
96 
97  p = (SYSTEM_CalAddrVal_TypeDef *)(DEVINFO_BASE & 0xFFFFF000);
99 
100  for ( ; p < end; p++)
101  {
102  if (p->address == 0xFFFFFFFF)
103  {
104  /* Found table terminator */
105  return false;
106  }
107  if (p->address == (uint32_t)regAddress)
108  {
109  *regAddress = p->calValue;
110  return true;
111  }
112  }
113  /* Nothing found for regAddress */
114  return false;
115 }
116 
Emlib peripheral API "assert" implementation.
#define _ROMTABLE_PID0_REVMAJOR_SHIFT
void SYSTEM_ChipRevisionGet(SYSTEM_ChipRevision_TypeDef *rev)
Get chip major/minor revision.
Definition: em_system.c:58
#define _ROMTABLE_PID3_REVMINORLSB_SHIFT
#define _ROMTABLE_PID0_FAMILYLSB_SHIFT
bool SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
Get factory calibration value for a given peripheral register.
Definition: em_system.c:93
#define _ROMTABLE_PID1_FAMILYMSB_SHIFT
#define ROMTABLE
#define _ROMTABLE_PID0_REVMAJOR_MASK
#define _ROMTABLE_PID2_REVMINORMSB_MASK
#define _ROMTABLE_PID1_FAMILYMSB_MASK
#define _ROMTABLE_PID0_FAMILYLSB_MASK
System API.
#define _ROMTABLE_PID2_REVMINORMSB_SHIFT
#define DEVINFO_BASE
#define _ROMTABLE_PID3_REVMINORLSB_MASK