SYSTEMEMLIB

Detailed Description

System API.

This module contains functions to read information such as RAM and Flash size, device unique ID, chip revision, family, and part number from DEVINFO and SCB blocks. Functions to configure and read status from FPU are available for compatible devices.

Data Structures

struct  SYSTEM_CalAddrVal_TypeDef
 
struct  SYSTEM_ChipRevision_TypeDef
 

Enumerations

enum  SYSTEM_FpuAccess_TypeDef {
  fpuAccessDenied = (0x0 << 20),
  fpuAccessPrivilegedOnly = (0x5 << 20),
  fpuAccessReserved = (0xA << 20),
  fpuAccessFull = (0xF << 20)
}
 
enum  SYSTEM_PartFamily_TypeDef {
  systemPartFamilyMighty21 = DEVINFO_PART_FAMILY_MG | (21 << _DEVINFO_PART_FAMILYNUM_SHIFT),
  systemPartFamilyFlex21 = DEVINFO_PART_FAMILY_FG | (21 << _DEVINFO_PART_FAMILYNUM_SHIFT),
  systemPartFamilyBlue21 = DEVINFO_PART_FAMILY_BG | (21 << _DEVINFO_PART_FAMILYNUM_SHIFT),
  systemPartFamilyUnknown = 0xFF
}
 

Functions

void SYSTEM_ChipRevisionGet (SYSTEM_ChipRevision_TypeDef *rev)
 Get a chip major/minor revision.
 
__STATIC_INLINE void SYSTEM_FpuAccessModeSet (SYSTEM_FpuAccess_TypeDef accessMode)
 Set floating point co-processor (FPU) access mode.
 
__STATIC_INLINE uint8_t SYSTEM_GetCalibrationTemperature (void)
 Get calibration temperature (in degrees Celsius).
 
bool SYSTEM_GetCalibrationValue (volatile uint32_t *regAddress)
 Get a factory calibration value for a given peripheral register.
 
__STATIC_INLINE uint8_t SYSTEM_GetDevinfoRev (void)
 Get DEVINFO revision.
 
__STATIC_INLINE SYSTEM_PartFamily_TypeDef SYSTEM_GetFamily (void)
 Get family identifier of MCU.
 
__STATIC_INLINE uint32_t SYSTEM_GetFlashPageSize (void)
 Get the flash page size in bytes.
 
__STATIC_INLINE uint16_t SYSTEM_GetFlashSize (void)
 Get the flash size (in KB).
 
__STATIC_INLINE uint16_t SYSTEM_GetPartNumber (void)
 Get part number of MCU.
 
__STATIC_INLINE uint8_t SYSTEM_GetProdRev (void)
 Get production revision for this part.
 
__STATIC_INLINE uint16_t SYSTEM_GetSRAMSize (void)
 Get SRAM size (in KB).
 
__STATIC_INLINE uint64_t SYSTEM_GetUnique (void)
 Get unique number for this device.
 

Enumeration Type Documentation

Floating point co-processor access modes.

Enumerator
fpuAccessDenied 

Access denied, any attempted access generates a NOCP UsageFault.

fpuAccessPrivilegedOnly 

Privileged access only, an unprivileged access generates a NOCP UsageFault.

fpuAccessReserved 

Reserved.

fpuAccessFull 

Full access.

Definition at line 284 of file em_system.h.

Family identifiers.

Enumerator
systemPartFamilyMighty21 

EFR32 Mighty Gecko Series 2 Config 1 Value Device Family

systemPartFamilyFlex21 

EFR32 Flex Gecko Series 2 Config 1 Value Device Family

systemPartFamilyBlue21 

EFR32 Blue Gecko Series 2 Config 1 Value Device Family

systemPartFamilyUnknown 

Unknown Device Family. Family ID is missing on unprogrammed parts.

Definition at line 63 of file em_system.h.

Function Documentation

void SYSTEM_ChipRevisionGet ( SYSTEM_ChipRevision_TypeDef rev)

Get a chip major/minor revision.

Parameters
[out]revA location to place the chip revision information.

Definition at line 57 of file em_system.c.

References _SYSCFG_CHIPREV_FAMILY_MASK, _SYSCFG_CHIPREV_FAMILY_SHIFT, _SYSCFG_CHIPREV_MAJOR_MASK, _SYSCFG_CHIPREV_MAJOR_SHIFT, _SYSCFG_CHIPREV_MINOR_MASK, _SYSCFG_CHIPREV_MINOR_SHIFT, CMU, SYSTEM_ChipRevision_TypeDef::family, SYSTEM_ChipRevision_TypeDef::major, SYSTEM_ChipRevision_TypeDef::minor, and SYSCFG.

Referenced by CHIP_Init().

__STATIC_INLINE void SYSTEM_FpuAccessModeSet ( SYSTEM_FpuAccess_TypeDef  accessMode)

Set floating point co-processor (FPU) access mode.

Parameters
[in]accessModeFloating point co-processor access mode. See SYSTEM_FpuAccess_TypeDef for details.

Definition at line 335 of file em_system.h.

__STATIC_INLINE uint8_t SYSTEM_GetCalibrationTemperature ( void  )

Get calibration temperature (in degrees Celsius).

Returns
Calibration temperature in Celsius.

Definition at line 539 of file em_system.h.

References _DEVINFO_CALTEMP_TEMP_MASK, _DEVINFO_CALTEMP_TEMP_SHIFT, and DEVINFO.

bool SYSTEM_GetCalibrationValue ( volatile uint32_t *  regAddress)

Get a factory calibration value for a given peripheral register.

Parameters
[in]regAddressThe peripheral calibration register address to get a calibration value for. If the calibration value is found, this register is updated with the calibration value.
Returns
True if a calibration value exists, false otherwise.

Definition at line 107 of file em_system.c.

References SYSTEM_CalAddrVal_TypeDef::address, and SYSTEM_CalAddrVal_TypeDef::calValue.

__STATIC_INLINE uint8_t SYSTEM_GetDevinfoRev ( void  )

Get DEVINFO revision.

Returns
Revision of the DEVINFO contents.

Definition at line 314 of file em_system.h.

References _DEVINFO_INFO_DEVINFOREV_MASK, _DEVINFO_INFO_DEVINFOREV_SHIFT, and DEVINFO.

__STATIC_INLINE SYSTEM_PartFamily_TypeDef SYSTEM_GetFamily ( void  )

Get family identifier of MCU.

Note
This function retrieves family ID by reading the chip's device info structure in flash memory. Users can retrieve family ID directly by reading DEVINFO->PART item and decode with mask and shift #defines defined in <part_family>_devinfo.h (refer to code below for details).
Returns
Family identifier of MCU.

Definition at line 517 of file em_system.h.

References _DEVINFO_PART_FAMILY_MASK, _DEVINFO_PART_FAMILYNUM_MASK, and DEVINFO.

__STATIC_INLINE uint32_t SYSTEM_GetFlashPageSize ( void  )

Get the flash page size in bytes.

Note
This function retrieves flash page size by reading the chip device info structure. If your binary is made for one specific device only, use FLASH_PAGE_SIZE instead.
Returns
Page size of internal flash in bytes.

Definition at line 451 of file em_system.h.

References _DEVINFO_MEMINFO_FLASHPAGESIZE_MASK, _DEVINFO_MEMINFO_FLASHPAGESIZE_SHIFT, DEVINFO, FLASH_PAGE_SIZE, and SYSTEM_GetProdRev().

__STATIC_INLINE uint16_t SYSTEM_GetFlashSize ( void  )

Get the flash size (in KB).

Note
This function retrieves flash size by reading the chip device info structure. If your binary is made for one specific device only, use FLASH_SIZE instead.
Returns
Size of internal flash (in KB).

Definition at line 426 of file em_system.h.

References _DEVINFO_MSIZE_FLASH_MASK, _DEVINFO_MSIZE_FLASH_SHIFT, _DEVINFO_MSIZE_SRAM_MASK, _DEVINFO_MSIZE_SRAM_SHIFT, DEVINFO, and SYSTEM_GetProdRev().

__STATIC_INLINE uint16_t SYSTEM_GetPartNumber ( void  )

Get part number of MCU.

Returns
The part number of MCU.

Definition at line 490 of file em_system.h.

References _DEVINFO_PART_DEVICENUM_MASK, _DEVINFO_PART_DEVICENUM_SHIFT, and DEVINFO.

__STATIC_INLINE uint8_t SYSTEM_GetProdRev ( void  )

Get production revision for this part.

Returns
Production revision for this part.

Definition at line 368 of file em_system.h.

References _DEVINFO_INFO_PRODREV_MASK, _DEVINFO_INFO_PRODREV_SHIFT, and DEVINFO.

Referenced by CHIP_Init(), SYSTEM_GetFlashPageSize(), SYSTEM_GetFlashSize(), and SYSTEM_GetSRAMSize().

__STATIC_INLINE uint16_t SYSTEM_GetSRAMSize ( void  )

Get SRAM size (in KB).

Note
This function retrieves SRAM size by reading the chip device info structure. If your binary is made for one specific device only, use SRAM_SIZE instead.
Returns
Size of internal SRAM (in KB).

Definition at line 393 of file em_system.h.

References _DEVINFO_MSIZE_FLASH_MASK, _DEVINFO_MSIZE_FLASH_SHIFT, _DEVINFO_MSIZE_SRAM_MASK, _DEVINFO_MSIZE_SRAM_SHIFT, DEVINFO, and SYSTEM_GetProdRev().

__STATIC_INLINE uint64_t SYSTEM_GetUnique ( void  )

Get unique number for this device.

Returns
Unique number for this device.

Definition at line 348 of file em_system.h.

References DEVINFO.