![]() |
Energy Micro IEC60355 Library Example Project 1.0 (internal use only!) GCC-Version
Example project demonstrating POST and BIST library functions
|
CMSIS Cortex-M3 Peripheral Access Layer for EFM32 devices. More...

Go to the source code of this file.
Defines | |
| #define | EFM32_LFRCO_FREQ (32768) |
| #define | EFM32_HFXO_FREQ (32000000) |
| #define | EFM32_LFXO_FREQ (EFM32_LFRCO_FREQ) |
Functions | |
| uint32_t | SystemCoreClockGet (void) |
| Get the current core clock frequency. | |
| uint32_t | SystemHFClockGet (void) |
| Get the current HFCLK 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. | |
Variables | |
| uint32_t | SystemCoreClock |
| System System Clock Frequency (Core Clock). | |
CMSIS Cortex-M3 Peripheral Access Layer for EFM32 devices.
(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com
This source code is the property of Energy Micro AS. The source and compiled code may only be used on Energy Micro "EFM32" microcontrollers.
This copyright notice may not be removed from the source code nor changed.
DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no obligation to support this Software. Energy Micro AS 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.
Energy Micro AS 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_efm32.c.
| #define EFM32_HFXO_FREQ (32000000) |
Definition at line 52 of file system_efm32.c.
| #define EFM32_LFRCO_FREQ (32768) |
LFRCO frequency, tuned to below frequency during manufacturing.
Definition at line 37 of file system_efm32.c.
Referenced by SystemHFClockGet(), and SystemLFRCOClockGet().
| #define EFM32_LFXO_FREQ (EFM32_LFRCO_FREQ) |
(DO_NOT_INCLUDE_WITH_DOXYGEN)
Definition at line 63 of file system_efm32.c.
| uint32_t SystemCoreClockGet | ( | void | ) |
Get the current core clock frequency.
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.
Definition at line 108 of file system_efm32.c.
References SystemCoreClock, and SystemHFClockGet().
Referenced by SystemCoreClockUpdate(), SystemHFXOClockSet(), and SystemLFXOClockSet().
{
uint32_t ret;
ret = SystemHFClockGet();
ret >>= (CMU->HFCORECLKDIV & _CMU_HFCORECLKDIV_HFCORECLKDIV_MASK) >>
_CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT;
/* Keep CMSIS variable up-to-date just in case */
SystemCoreClock = ret;
return ret;
}


| uint32_t SystemHFClockGet | ( | void | ) |
Get the current HFCLK frequency.
Definition at line 133 of file system_efm32.c.
References EFM32_LFRCO_FREQ.
Referenced by SystemCoreClockGet().
{
uint32_t ret;
switch (CMU->STATUS & (CMU_STATUS_HFRCOSEL | CMU_STATUS_HFXOSEL |
CMU_STATUS_LFRCOSEL | CMU_STATUS_LFXOSEL))
{
case CMU_STATUS_LFXOSEL:
#if (EFM32_LFXO_FREQ > 0)
ret = SystemLFXOClock;
#else
/* We should not get here, since core should not be clocked. May */
/* be caused by a misconfiguration though. */
ret = 0;
#endif
break;
case CMU_STATUS_LFRCOSEL:
ret = EFM32_LFRCO_FREQ;
break;
case CMU_STATUS_HFXOSEL:
#if (EFM32_HFXO_FREQ > 0)
ret = SystemHFXOClock;
#else
/* We should not get here, since core should not be clocked. May */
/* be caused by a misconfiguration though. */
ret = 0;
#endif
break;
default: /* CMU_STATUS_HFRCOSEL */
switch (CMU->HFRCOCTRL & _CMU_HFRCOCTRL_BAND_MASK)
{
case CMU_HFRCOCTRL_BAND_28MHZ:
ret = 28000000;
break;
case CMU_HFRCOCTRL_BAND_21MHZ:
ret = 21000000;
break;
case CMU_HFRCOCTRL_BAND_14MHZ:
ret = 14000000;
break;
case CMU_HFRCOCTRL_BAND_11MHZ:
ret = 11000000;
break;
case CMU_HFRCOCTRL_BAND_7MHZ:
ret = 7000000;
break;
case CMU_HFRCOCTRL_BAND_1MHZ:
ret = 1000000;
break;
default:
ret = 0;
break;
}
break;
}
return ret;
}

| uint32_t SystemHFXOClockGet | ( | void | ) |
Get high frequency crystal oscillator clock frequency for target system.
Definition at line 212 of file system_efm32.c.
{
/* External crystal oscillator present? */
#if (EFM32_HFXO_FREQ > 0)
return SystemHFXOClock;
#else
return 0;
#endif
}
| void SystemHFXOClockSet | ( | uint32_t | freq | ) |
Set high frequency crystal oscillator clock frequency for target system.
| [in] | freq | HFXO frequency in Hz used for target. |
Definition at line 238 of file system_efm32.c.
References SystemCoreClockGet().
{
/* External crystal oscillator present? */
#if (EFM32_HFXO_FREQ > 0)
SystemHFXOClock = freq;
/* Update core clock frequency if HFXO is used to clock core */
if (CMU->STATUS & CMU_STATUS_HFXOSEL)
{
/* The function will update the global variable */
SystemCoreClockGet();
}
#else
(void)freq; /* Unused parameter */
#endif
}

| void SystemInit | ( | void | ) |
Initialize the system.
Do required generic HW system init.
Definition at line 268 of file system_efm32.c.
Referenced by Reset_Handler().
{
}

| uint32_t SystemLFRCOClockGet | ( | void | ) |
Get low frequency RC oscillator clock frequency for target system.
Definition at line 283 of file system_efm32.c.
References EFM32_LFRCO_FREQ.
{
/* Currently we assume that this frequency is properly tuned during */
/* manufacturing and is not changed after reset. If future requirements */
/* for re-tuning by user, we can add support for that. */
return EFM32_LFRCO_FREQ;
}
| uint32_t SystemLFXOClockGet | ( | void | ) |
Get low frequency crystal oscillator clock frequency for target system.
Definition at line 302 of file system_efm32.c.
{
/* External crystal oscillator present? */
#if (EFM32_LFXO_FREQ > 0)
return SystemLFXOClock;
#else
return 0;
#endif
}
| void SystemLFXOClockSet | ( | uint32_t | freq | ) |
Set low frequency crystal oscillator clock frequency for target system.
| [in] | freq | LFXO frequency in Hz used for target. |
Definition at line 328 of file system_efm32.c.
References SystemCoreClockGet().
{
/* External crystal oscillator present? */
#if (EFM32_LFXO_FREQ > 0)
SystemLFXOClock = freq;
/* Update core clock frequency if LFXO is used to clock core */
if (CMU->STATUS & CMU_STATUS_LFXOSEL)
{
/* The function will update the global variable */
SystemCoreClockGet();
}
#else
(void)freq; /* Unused parameter */
#endif
}

| uint32_t SystemCoreClock |
System System Clock Frequency (Core Clock).
(DO_NOT_INCLUDE_WITH_DOXYGEN)
Required CMSIS global variable that must be kept up-to-date.
Definition at line 85 of file system_efm32.c.
Referenced by SystemCoreClockGet().