Skip to content

Commit 0b6ed71

Browse files
committed
[EFM32] Move clock configuration to target settings
Moving the per-board clock configuration (which oscillators are available on the board, their frequencies, and which ones to use) as config options to the target database. This way, they're more easily overridable when third parties start creating boards with EFM32 MCUs
1 parent 758d160 commit 0b6ed71

File tree

11 files changed

+254
-340
lines changed

11 files changed

+254
-340
lines changed

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/TARGET_EFM32GG_STK3700/device_peripherals.h

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -36,54 +36,4 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER1
3838

39-
/* Clocks */
40-
41-
/* Clock definitions */
42-
#define LFXO 0
43-
#define HFXO 1
44-
#define LFRCO 2
45-
#define HFRCO 3
46-
#if !defined(_EFM32_GECKO_FAMILY)
47-
#define ULFRCO 4
48-
#endif
49-
50-
/* Low Energy peripheral clock source.
51-
* Options:
52-
* * LFXO: external crystal, please define frequency.
53-
* * LFRCO: internal RC oscillator (32.768kHz)
54-
* * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz)
55-
*/
56-
#define LOW_ENERGY_CLOCK_SOURCE LFXO
57-
58-
/** Core clock source.
59-
* Options:
60-
* * HFXO: external crystal, please define frequency.
61-
* * HFRCO: High-frequency internal RC oscillator. Please select band as well.
62-
*/
63-
#define CORE_CLOCK_SOURCE HFXO
64-
65-
/** HFRCO frequency band
66-
* Options:
67-
* * _CMU_HFRCOCTRL_BAND_28MHZ
68-
* * _CMU_HFRCOCTRL_BAND_21MHZ
69-
* * _CMU_HFRCOCTRL_BAND_14MHZ
70-
* * _CMU_HFRCOCTRL_BAND_11MHZ
71-
* * _CMU_HFRCOCTRL_BAND_7MHZ
72-
* * _CMU_HFRCOCTRL_BAND_1MHZ
73-
*/
74-
#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ
75-
76-
#define LFXO_FREQUENCY 32768
77-
#define HFXO_FREQUENCY 48000000
78-
79-
#if (LOW_ENERGY_CLOCK_SOURCE == LFXO)
80-
#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY
81-
#elif (LOW_ENERGY_CLOCK_SOURCE == LFRCO)
82-
#define LOW_ENERGY_CLOCK_FREQUENCY 32768
83-
#elif (LOW_ENERGY_CLOCK_SOURCE == ULFRCO)
84-
#define LOW_ENERGY_CLOCK_FREQUENCY 1000
85-
#else
86-
#error "Unknown Low Energy Clock selection"
87-
#endif
88-
8939
#endif

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/PeripheralNames.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ typedef enum {
5050
LEUART_0 = LEUART0_BASE
5151
} UARTName;
5252

53-
#define STDIO_UART_TX USBTX
54-
#define STDIO_UART_RX USBRX
55-
#define STDIO_UART USART1
56-
5753
typedef enum {
5854
SPI_0 = USART0_BASE,
5955
SPI_1 = USART1_BASE

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32HG/TARGET_EFM32HG_STK3400/device_peripherals.h

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -36,53 +36,4 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER2
3838

39-
/* Clocks */
40-
41-
/* Clock definitions */
42-
#define LFXO 0
43-
#define HFXO 1
44-
#define LFRCO 2
45-
#define HFRCO 3
46-
#if !defined(_EFM32_GECKO_FAMILY)
47-
#define ULFRCO 4
48-
#endif
49-
50-
/* Low Energy peripheral clock source.
51-
* Options:
52-
* * LFXO: external crystal, please define frequency.
53-
* * LFRCO: internal RC oscillator (32.768kHz)
54-
* * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz)
55-
*/
56-
#define LOW_ENERGY_CLOCK_SOURCE LFXO
57-
58-
/** Core clock source.
59-
* Options:
60-
* * HFXO: external crystal, please define frequency.
61-
* * HFRCO: High-frequency internal RC oscillator. Please select band as well.
62-
*/
63-
#define CORE_CLOCK_SOURCE HFXO
64-
65-
/** HFRCO frequency band
66-
* Options:
67-
* * _CMU_HFRCOCTRL_BAND_21MHZ
68-
* * _CMU_HFRCOCTRL_BAND_14MHZ
69-
* * _CMU_HFRCOCTRL_BAND_11MHZ
70-
* * _CMU_HFRCOCTRL_BAND_7MHZ
71-
* * _CMU_HFRCOCTRL_BAND_1MHZ
72-
*/
73-
#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ
74-
75-
#define LFXO_FREQUENCY 32768
76-
#define HFXO_FREQUENCY 24000000
77-
78-
#if (LOW_ENERGY_CLOCK_SOURCE == LFXO)
79-
#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY
80-
#elif (LOW_ENERGY_CLOCK_SOURCE == LFRCO)
81-
#define LOW_ENERGY_CLOCK_FREQUENCY 32768
82-
#elif (LOW_ENERGY_CLOCK_SOURCE == ULFRCO)
83-
#define LOW_ENERGY_CLOCK_FREQUENCY 1000
84-
#else
85-
#error "Unknown Low Energy Clock selection"
86-
#endif
87-
8839
#endif

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/TARGET_EFM32LG_STK3600/device_peripherals.h

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -36,54 +36,4 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER1
3838

39-
/* Clocks */
40-
41-
/* Clock definitions */
42-
#define LFXO 0
43-
#define HFXO 1
44-
#define LFRCO 2
45-
#define HFRCO 3
46-
#if !defined(_EFM32_GECKO_FAMILY)
47-
#define ULFRCO 4
48-
#endif
49-
50-
/* Low Energy peripheral clock source.
51-
* Options:
52-
* * LFXO: external crystal, please define frequency.
53-
* * LFRCO: internal RC oscillator (32.768kHz)
54-
* * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz)
55-
*/
56-
#define LOW_ENERGY_CLOCK_SOURCE LFXO
57-
58-
/** Core clock source.
59-
* Options:
60-
* * HFXO: external crystal, please define frequency.
61-
* * HFRCO: High-frequency internal RC oscillator. Please select band as well.
62-
*/
63-
#define CORE_CLOCK_SOURCE HFXO
64-
65-
/** HFRCO frequency band
66-
* Options:
67-
* * _CMU_HFRCOCTRL_BAND_28MHZ
68-
* * _CMU_HFRCOCTRL_BAND_21MHZ
69-
* * _CMU_HFRCOCTRL_BAND_14MHZ
70-
* * _CMU_HFRCOCTRL_BAND_11MHZ
71-
* * _CMU_HFRCOCTRL_BAND_7MHZ
72-
* * _CMU_HFRCOCTRL_BAND_1MHZ
73-
*/
74-
#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ
75-
76-
#define LFXO_FREQUENCY 32768
77-
#define HFXO_FREQUENCY 48000000
78-
79-
#if (LOW_ENERGY_CLOCK_SOURCE == LFXO)
80-
#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY
81-
#elif (LOW_ENERGY_CLOCK_SOURCE == LFRCO)
82-
#define LOW_ENERGY_CLOCK_FREQUENCY 32768
83-
#elif (LOW_ENERGY_CLOCK_SOURCE == ULFRCO)
84-
#define LOW_ENERGY_CLOCK_FREQUENCY 1000
85-
#else
86-
#error "Unknown Low Energy Clock selection"
87-
#endif
88-
8939
#endif

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32PG/TARGET_EFM32PG_STK3401/device_peripherals.h

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -33,62 +33,4 @@
3333
#define PWM_TIMER_CLOCK cmuClock_TIMER1
3434
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC1
3535

36-
/* Clocks */
37-
38-
/* Clock definitions */
39-
#define LFXO 0
40-
#define HFXO 1
41-
#define LFRCO 2
42-
#define HFRCO 3
43-
#define ULFRCO 4
44-
45-
46-
/* Low Energy peripheral clock source.
47-
* Options:
48-
* * LFXO: external crystal, please define frequency.
49-
* * LFRCO: internal RC oscillator (32.768kHz)
50-
* * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz)
51-
*/
52-
#define LOW_ENERGY_CLOCK_SOURCE LFXO
53-
54-
/** Core clock source.
55-
* Options:
56-
* * HFXO: external crystal, please define frequency.
57-
* * HFRCO: High-frequency internal RC oscillator. Please select frequency as well.
58-
*/
59-
#define CORE_CLOCK_SOURCE HFXO
60-
61-
/** HFRCO frequency selection
62-
* Options:
63-
* ** HFRCO_FREQUENCY_ENUM ** HFRCO_FREQUENCY **
64-
* * cmuHFRCOFreq_1M0Hz == 1000000 *
65-
* * cmuHFRCOFreq_2M0Hz == 2000000 *
66-
* * cmuHFRCOFreq_4M0Hz == 4000000 *
67-
* * cmuHFRCOFreq_7M0Hz == 7000000 *
68-
* * cmuHFRCOFreq_13M0Hz == 13000000 *
69-
* * cmuHFRCOFreq_16M0Hz == 16000000 *
70-
* * cmuHFRCOFreq_19M0Hz == 19000000 *
71-
* * cmuHFRCOFreq_26M0Hz == 26000000 *
72-
* * cmuHFRCOFreq_32M0Hz == 32000000 *
73-
* * cmuHFRCOFreq_38M0Hz == 38000000 *
74-
* *********************************************
75-
*/
76-
77-
/* Make sure the settings of HFRCO_FREQUENCY and HFRCO_FREQUENCY_ENUM match, or timings will be faulty! */
78-
#define HFRCO_FREQUENCY_ENUM cmuHFRCOFreq_19M0Hz
79-
#define HFRCO_FREQUENCY 19000000
80-
81-
#define LFXO_FREQUENCY 32768
82-
#define HFXO_FREQUENCY 40000000
83-
84-
#if (LOW_ENERGY_CLOCK_SOURCE == LFXO)
85-
#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY
86-
#elif (LOW_ENERGY_CLOCK_SOURCE == LFRCO)
87-
#define LOW_ENERGY_CLOCK_FREQUENCY 32768
88-
#elif (LOW_ENERGY_CLOCK_SOURCE == ULFRCO)
89-
#define LOW_ENERGY_CLOCK_FREQUENCY 1000
90-
#else
91-
#error "Unknown Low Energy Clock selection"
92-
#endif
93-
9436
#endif

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32WG/TARGET_EFM32WG_STK3800/device_peripherals.h

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -36,54 +36,4 @@
3636
/* USB */
3737
#define USB_TIMER USB_TIMER1
3838

39-
/* Clocks */
40-
41-
/* Clock definitions */
42-
#define LFXO 0
43-
#define HFXO 1
44-
#define LFRCO 2
45-
#define HFRCO 3
46-
#if !defined(_EFM32_GECKO_FAMILY)
47-
#define ULFRCO 4
48-
#endif
49-
50-
/* Low Energy peripheral clock source.
51-
* Options:
52-
* * LFXO: external crystal, please define frequency.
53-
* * LFRCO: internal RC oscillator (32.768kHz)
54-
* * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz)
55-
*/
56-
#define LOW_ENERGY_CLOCK_SOURCE LFXO
57-
58-
/** Core clock source.
59-
* Options:
60-
* * HFXO: external crystal, please define frequency.
61-
* * HFRCO: High-frequency internal RC oscillator. Please select band as well.
62-
*/
63-
#define CORE_CLOCK_SOURCE HFXO
64-
65-
/** HFRCO frequency band
66-
* Options:
67-
* * _CMU_HFRCOCTRL_BAND_28MHZ
68-
* * _CMU_HFRCOCTRL_BAND_21MHZ
69-
* * _CMU_HFRCOCTRL_BAND_14MHZ
70-
* * _CMU_HFRCOCTRL_BAND_11MHZ
71-
* * _CMU_HFRCOCTRL_BAND_7MHZ
72-
* * _CMU_HFRCOCTRL_BAND_1MHZ
73-
*/
74-
#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ
75-
76-
#define LFXO_FREQUENCY 32768
77-
#define HFXO_FREQUENCY 48000000
78-
79-
#if (LOW_ENERGY_CLOCK_SOURCE == LFXO)
80-
#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY
81-
#elif (LOW_ENERGY_CLOCK_SOURCE == LFRCO)
82-
#define LOW_ENERGY_CLOCK_FREQUENCY 32768
83-
#elif (LOW_ENERGY_CLOCK_SOURCE == ULFRCO)
84-
#define LOW_ENERGY_CLOCK_FREQUENCY 1000
85-
#else
86-
#error "Unknown Low Energy Clock selection"
87-
#endif
88-
8939
#endif

targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32ZG/TARGET_EFM32ZG_STK3200/device_peripherals.h

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -33,53 +33,4 @@
3333
#define PWM_TIMER_CLOCK cmuClock_TIMER0
3434
#define PWM_ROUTE TIMER_ROUTE_LOCATION_LOC0
3535

36-
/* Clocks */
37-
38-
/* Clock definitions */
39-
#define LFXO 0
40-
#define HFXO 1
41-
#define LFRCO 2
42-
#define HFRCO 3
43-
#if !defined(_EFM32_GECKO_FAMILY)
44-
#define ULFRCO 4
45-
#endif
46-
47-
/* Low Energy peripheral clock source.
48-
* Options:
49-
* * LFXO: external crystal, please define frequency.
50-
* * LFRCO: internal RC oscillator (32.768kHz)
51-
* * ULFRCO: internal ultra-low power RC oscillator (available down to EM3) (1kHz)
52-
*/
53-
#define LOW_ENERGY_CLOCK_SOURCE LFXO
54-
55-
/** Core clock source.
56-
* Options:
57-
* * HFXO: external crystal, please define frequency.
58-
* * HFRCO: High-frequency internal RC oscillator. Please select band as well.
59-
*/
60-
#define CORE_CLOCK_SOURCE HFXO
61-
62-
/** HFRCO frequency band
63-
* Options:
64-
* * _CMU_HFRCOCTRL_BAND_21MHZ
65-
* * _CMU_HFRCOCTRL_BAND_14MHZ
66-
* * _CMU_HFRCOCTRL_BAND_11MHZ
67-
* * _CMU_HFRCOCTRL_BAND_7MHZ
68-
* * _CMU_HFRCOCTRL_BAND_1MHZ
69-
*/
70-
#define HFRCO_FREQUENCY _CMU_HFRCOCTRL_BAND_21MHZ
71-
72-
#define LFXO_FREQUENCY 32768
73-
#define HFXO_FREQUENCY 24000000
74-
75-
#if (LOW_ENERGY_CLOCK_SOURCE == LFXO)
76-
#define LOW_ENERGY_CLOCK_FREQUENCY LFXO_FREQUENCY
77-
#elif (LOW_ENERGY_CLOCK_SOURCE == LFRCO)
78-
#define LOW_ENERGY_CLOCK_FREQUENCY 32768
79-
#elif (LOW_ENERGY_CLOCK_SOURCE == ULFRCO)
80-
#define LOW_ENERGY_CLOCK_FREQUENCY 1000
81-
#else
82-
#error "Unknown Low Energy Clock selection"
83-
#endif
84-
8536
#endif

0 commit comments

Comments
 (0)