system_efr32bg21.c File Reference

CMSIS Cortex-M33 system support for EFR32BG21 devices.

Version
5.7.0

License

Copyright 2018 Silicon Laboratories, Inc. http://www.silabs.com

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Laboratories, Inc. has no obligation to support this Software. Silicon Laboratories, Inc. is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.

Silicon Laboratories, Inc. will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.

Definition in file system_efr32bg21.c .

#include <stdint.h>
#include " em_device.h "

Macros

#define CLKIN0_FREQ (0UL)
#define FSRCO_FREQ (20000000UL)
#define HFRCODPLL_MAX_FREQ (80000000UL)
#define HFRCODPLL_STARTUP_FREQ (19000000UL)
#define HFXO_FREQ (38400000UL)
#define LFRCO_FREQ (32768UL)
#define LFXO_FREQ (LFRCO_FREQ)
#define ULFRCO_FREQ (1000UL)

Functions

uint32_t SystemCLKIN0Get (void)
Get current CLKIN0 frequency.
uint32_t SystemFSRCOClockGet (void)
Get FSRCO frequency.
uint32_t SystemHCLKGet (void)
Get the current system core clock frequency (HCLK).
uint32_t SystemHFRCODPLLClockGet (void)
Get current HFRCODPLL frequency.
void SystemHFRCODPLLClockSet (uint32_t freq)
Set HFRCODPLL frequency value.
uint32_t SystemHFRCOEM23ClockGet (void)
Get current HFRCOEM23 frequency.
uint32_t SystemHFXOClockGet (void)
Get high frequency crystal oscillator clock frequency for target system.
void SystemHFXOClockSet (uint32_t freq)
Set high frequency crystal oscillator clock frequency for target system.
void SystemInit (void)
Initialize the system.
uint32_t SystemLFRCOClockGet (void)
Get low frequency RC oscillator clock frequency for target system.
uint32_t SystemLFXOClockGet (void)
Get low frequency crystal oscillator clock frequency for target system.
void SystemLFXOClockSet (uint32_t freq)
Set low frequency crystal oscillator clock frequency for target system.
uint32_t SystemMaxCoreClockGet (void)
Get the maximum core clock frequency.
uint32_t SystemSYSCLKGet (void)
Get the current system clock frequency (SYSCLK).
uint32_t SystemULFRCOClockGet (void)
Get ultra low frequency RC oscillator clock frequency for target system.

Variables

uint32_t __Vectors
uint32_t SystemCoreClock = HFRCODPLL_STARTUP_FREQ
System System Clock Frequency (Core Clock).
static uint32_t SystemHFRCODPLLClock = HFRCODPLL_STARTUP_FREQ
static uint32_t SystemHFXOClock = HFXO_FREQ
static uint32_t SystemLFXOClock = LFXO_FREQ

Function Documentation

uint32_t SystemCLKIN0Get ( void )

Get current CLKIN0 frequency.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
CLKIN0 frequency in Hz.

Definition at line 451 of file system_efr32bg21.c .

uint32_t SystemFSRCOClockGet ( void )

Get FSRCO frequency.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
FSRCO frequency in Hz.

Definition at line 467 of file system_efr32bg21.c .

uint32_t SystemHCLKGet ( void )

Get the current system core clock frequency (HCLK).

Calculate and get the current core clock frequency based on the current configuration. Assuming that the SystemCoreClock global variable is maintained, the core clock frequency is stored in that variable as well. This function will however calculate the core clock based on actual HW configuration. It will also update the SystemCoreClock global variable.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
The current core clock (HCLK) frequency in Hz.

Definition at line 234 of file system_efr32bg21.c .

References _CMU_SYSCLKCTRL_HCLKPRESC_MASK , _CMU_SYSCLKCTRL_HCLKPRESC_SHIFT , CMU , SystemCoreClock , and SystemSYSCLKGet() .

Referenced by CMU_ClockFreqGet() , SystemCoreClockGet() , SystemCoreClockUpdate() , and SystemHFXOClockSet() .

uint32_t SystemHFRCODPLLClockGet ( void )

Get current HFRCODPLL frequency.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
HFRCODPLL frequency in Hz.

Definition at line 339 of file system_efr32bg21.c .

References _HFRCO_CAL_CLKDIV_MASK , _HFRCO_CAL_FREQRANGE_MASK , _HFRCO_CAL_FREQRANGE_SHIFT , HFRCO0 , HFRCO_CAL_CLKDIV_DIV1 , HFRCO_CAL_CLKDIV_DIV2 , and HFRCO_CAL_CLKDIV_DIV4 .

Referenced by CMU_DPLLLock() , CMU_HFRCODPLLBandGet() , and SystemSYSCLKGet() .

void SystemHFRCODPLLClockSet ( uint32_t freq )

Set HFRCODPLL frequency value.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Parameters
[in] freq HFRCODPLL frequency in Hz.

Definition at line 431 of file system_efr32bg21.c .

Referenced by CMU_DPLLLock() , and CMU_HFRCODPLLBandSet() .

uint32_t SystemHFRCOEM23ClockGet ( void )

Get current HFRCOEM23 frequency.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
HFRCOEM23 frequency in Hz.

Definition at line 484 of file system_efr32bg21.c .

References _HFRCO_CAL_CLKDIV_MASK , _HFRCO_CAL_FREQRANGE_MASK , _HFRCO_CAL_FREQRANGE_SHIFT , HFRCO_CAL_CLKDIV_DIV1 , HFRCO_CAL_CLKDIV_DIV2 , HFRCO_CAL_CLKDIV_DIV4 , and HFRCOEM23 .

Referenced by CMU_HFRCOEM23BandGet() .

uint32_t SystemHFXOClockGet ( void )

Get high frequency crystal oscillator clock frequency for target system.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
HFXO frequency in Hz. 0 if the external crystal oscillator is not present.

Definition at line 281 of file system_efr32bg21.c .

void SystemHFXOClockSet ( uint32_t freq )

Set high frequency crystal oscillator clock frequency for target system.

Note
This function is mainly provided for being able to handle target systems with different HF crystal oscillator frequencies run-time. If used, it should probably only be used once during system startup.
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Parameters
[in] freq HFXO frequency in Hz used for target.

Definition at line 311 of file system_efr32bg21.c .

References _CMU_SYSCLKCTRL_CLKSEL_HFXO , _CMU_SYSCLKCTRL_CLKSEL_MASK , CMU , and SystemHCLKGet() .

Referenced by BSP_initClocks() .

void SystemInit ( void )

Initialize the system.

Do required generic HW system init.

Note
This function is invoked during system init, before the main() routine and any data has been initialized. For this reason, it cannot do any initialization of variables etc.

Definition at line 147 of file system_efr32bg21.c .

uint32_t SystemLFRCOClockGet ( void )

Get low frequency RC oscillator clock frequency for target system.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
LFRCO frequency in Hz.

Definition at line 553 of file system_efr32bg21.c .

uint32_t SystemLFXOClockGet ( void )

Get low frequency crystal oscillator clock frequency for target system.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
LFXO frequency in Hz.

Definition at line 586 of file system_efr32bg21.c .

void SystemLFXOClockSet ( uint32_t freq )

Set low frequency crystal oscillator clock frequency for target system.

Note
This function is mainly provided for being able to handle target systems with different HF crystal oscillator frequencies run-time. If used, it should probably only be used once during system startup.
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Parameters
[in] freq LFXO frequency in Hz used for target.

Definition at line 616 of file system_efr32bg21.c .

Referenced by BSP_initClocks() .

uint32_t SystemMaxCoreClockGet ( void )

Get the maximum core clock frequency.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
The maximum core clock frequency in Hz.

Definition at line 264 of file system_efr32bg21.c .

uint32_t SystemSYSCLKGet ( void )

Get the current system clock frequency (SYSCLK).

Calculate and get the current core clock frequency based on the current hardware configuration.

Note
This is an EFR32BG21 specific function, not part of the CMSIS definition.
Returns
Current system clock (SYSCLK) frequency in Hz.

Definition at line 178 of file system_efr32bg21.c .

References _CMU_SYSCLKCTRL_CLKSEL_CLKIN0 , _CMU_SYSCLKCTRL_CLKSEL_FSRCO , _CMU_SYSCLKCTRL_CLKSEL_HFRCODPLL , _CMU_SYSCLKCTRL_CLKSEL_HFXO , _CMU_SYSCLKCTRL_CLKSEL_MASK , CMU , and SystemHFRCODPLLClockGet() .

Referenced by CMU_ClockFreqGet() , and SystemHCLKGet() .

uint32_t SystemULFRCOClockGet ( void )

Get ultra low frequency RC oscillator clock frequency for target system.

Note
This is a EFR32BG21 specific function, not part of the CMSIS definition.
Returns
ULFRCO frequency in Hz.

Definition at line 569 of file system_efr32bg21.c .

Variable Documentation

uint32_t SystemCoreClock = HFRCODPLL_STARTUP_FREQ

System System Clock Frequency (Core Clock).

Required CMSIS global variable that must be kept up-to-date.

Definition at line 128 of file system_efr32bg21.c .

Referenced by SystemHCLKGet() .