From 6fc95e4d6da07a817425b57058516280c39f47da Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:29:18 +0100 Subject: [PATCH 01/10] cpu/atmega2560: removed deps to F_CPU --- cpu/atmega2560/periph/uart.c | 2 +- cpu/atmega2560/startup.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cpu/atmega2560/periph/uart.c b/cpu/atmega2560/periph/uart.c index ba2ce76598..51448f8aad 100644 --- a/cpu/atmega2560/periph/uart.c +++ b/cpu/atmega2560/periph/uart.c @@ -80,7 +80,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg) static int init_base(uart_t uart, uint32_t baudrate) { - uint16_t clock_divider = F_CPU / (16 * baudrate); + uint16_t clock_divider = CLOCK_CORECLOCK / (16 * baudrate); switch (uart) { #if UART_0_EN diff --git a/cpu/atmega2560/startup.c b/cpu/atmega2560/startup.c index 3c36634bf8..21fd9b1751 100644 --- a/cpu/atmega2560/startup.c +++ b/cpu/atmega2560/startup.c @@ -24,8 +24,6 @@ /* For Catchall-Loop */ #include "board.h" -#include -#include /** From 178e82c0e9a92cc4038848ee66e71c96a46c4084 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:29:52 +0100 Subject: [PATCH 02/10] cpu/lpc2387: s/F_CPU/CLOCK_CORECLOCK/ --- cpu/lpc2387/i2c/i2c.c | 2 +- cpu/lpc2387/include/lpc2387.h | 1 - cpu/lpc2387/periph/pwm.c | 2 +- cpu/lpc2387/periph/spi.c | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cpu/lpc2387/i2c/i2c.c b/cpu/lpc2387/i2c/i2c.c index 019f4cea98..5c8e1490f8 100644 --- a/cpu/lpc2387/i2c/i2c.c +++ b/cpu/lpc2387/i2c/i2c.c @@ -258,7 +258,7 @@ void i2c_set_baud_rate(uint8_t i2c_interface, uint32_t baud_rate) { uint32_t pclksel = 0; uint32_t prescale = 0; - lpc2387_pclk_scale(F_CPU, baud_rate, &pclksel, &prescale); + lpc2387_pclk_scale(CLOCK_CORECLOCK, baud_rate, &pclksel, &prescale); switch (i2c_interface) { case I2C0: diff --git a/cpu/lpc2387/include/lpc2387.h b/cpu/lpc2387/include/lpc2387.h index b2036bd0a5..c16a3e11c6 100644 --- a/cpu/lpc2387/include/lpc2387.h +++ b/cpu/lpc2387/include/lpc2387.h @@ -21,7 +21,6 @@ extern "C" { #define F_CCO 288000000 #define CL_CPU_DIV 4 ///< CPU clock divider -#define F_CPU (F_CCO / CL_CPU_DIV) ///< CPU target speed in Hz #define F_RC_OSCILLATOR 4000000 ///< Frequency of internal RC oscillator #define F_RTC_OSCILLATOR 32767 ///< Frequency of RTC oscillator diff --git a/cpu/lpc2387/periph/pwm.c b/cpu/lpc2387/periph/pwm.c index 8e009fc94b..ecafd7bed1 100644 --- a/cpu/lpc2387/periph/pwm.c +++ b/cpu/lpc2387/periph/pwm.c @@ -57,7 +57,7 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int re PWM1TCR = BIT1; /* set prescaler */ - PWM1PR = (F_CPU / (frequency * resolution)) - 1; + PWM1PR = (CLOCK_CORECLOCK / (frequency * resolution)) - 1; /* set match register */ PWM1MR0 = resolution; diff --git a/cpu/lpc2387/periph/spi.c b/cpu/lpc2387/periph/spi.c index 4967a2a65a..15c6e34a0b 100644 --- a/cpu/lpc2387/periph/spi.c +++ b/cpu/lpc2387/periph/spi.c @@ -114,7 +114,7 @@ int spi_init_master(spi_t dev, spi_conf_t conf, spi_speed_t speed) /* Clock Setup*/ uint32_t pclksel; uint32_t cpsr; - lpc2387_pclk_scale(F_CPU / 1000, f_baud, &pclksel, &cpsr); + lpc2387_pclk_scale(CLOCK_CORECLOCK / 1000, f_baud, &pclksel, &cpsr); PCLKSEL1 &= ~(BIT10 | BIT11); /* CCLK to PCLK divider*/ PCLKSEL1 |= pclksel << 10; SSP0CPSR = cpsr; From 4f35f8d57c05172a9be815cf1e5b9a05f1dc0213 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:30:29 +0100 Subject: [PATCH 03/10] cpu/lpc11u34: s/F_CPU/CLOCK_CORECLOCK/ --- cpu/lpc11u34/periph/pwm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cpu/lpc11u34/periph/pwm.c b/cpu/lpc11u34/periph/pwm.c index e3de3c7484..7f9dbdbdf6 100644 --- a/cpu/lpc11u34/periph/pwm.c +++ b/cpu/lpc11u34/periph/pwm.c @@ -40,7 +40,7 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int re return -1; } /* Check if the frequency and resolution is applicable */ - if (F_CPU/(resolution*frequency) <= 0) { + if (CLOCK_CORECLOCK/(resolution*frequency) <= 0) { return -2; } #if PWM_0_CH0_EN @@ -56,8 +56,8 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int re pwm_poweron(dev); /* Enable timer and keep it in reset state */ PWM_0_DEV->TCR = BIT0 | BIT1; - /* Set the prescaler (F_CPU / resolution) */ - PWM_0_DEV->PR = (F_CPU/(resolution*frequency)); + /* Set the prescaler (CLOCK_CORECLOCK / resolution) */ + PWM_0_DEV->PR = (CLOCK_CORECLOCK/(resolution*frequency)); /* Reset timer on MR3 */ PWM_0_DEV->MCR = BIT10; @@ -82,7 +82,7 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int re return -1; } /* Check if the frequency and resolution is applicable */ - if (F_CPU/(resolution*frequency) <= 0) { + if (CLOCK_CORECLOCK/(resolution*frequency) <= 0) { return -2; } #if PWM_1_CH0_EN @@ -98,8 +98,8 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, unsigned int frequency, unsigned int re pwm_poweron(dev); /* Enable timer and keep it in reset state */ PWM_1_DEV->TCR = BIT0 | BIT1; - /* Set the prescaler (F_CPU / resolution) */ - PWM_1_DEV->PR = (F_CPU/(resolution*frequency)); + /* Set the prescaler (CLOCK_CORECLOCK / resolution) */ + PWM_1_DEV->PR = (CLOCK_CORECLOCK/(resolution*frequency)); /* Reset timer on MR3 */ PWM_1_DEV->MCR = BIT10; From 3101baa589c17ba1270e8a054a60f223a972320c Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:30:58 +0100 Subject: [PATCH 04/10] cpu/sam3: s/F_CPU/CLOCK_CORECLOCK/ --- cpu/sam3/periph/pwm.c | 8 ++++---- cpu/sam3/periph/timer.c | 2 +- cpu/sam3/periph/uart.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpu/sam3/periph/pwm.c b/cpu/sam3/periph/pwm.c index 22572620f5..655b095d0a 100644 --- a/cpu/sam3/periph/pwm.c +++ b/cpu/sam3/periph/pwm.c @@ -73,18 +73,18 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, * The pwm provides 11 prescaled clocks with (MCK/2^prea | prea=[0,10]) * and a divider (diva) with a denominator range [1,255] in line. */ - if (F_CPU < pwm_clk) { /* Have to cut down resulting frequency. */ - frequency = F_CPU / resolution; + if (CLOCK_CORECLOCK < pwm_clk) { /* Have to cut down resulting frequency. */ + frequency = CLOCK_CORECLOCK / resolution; } else { /* Estimate prescaler and divider. */ - diva = F_CPU / pwm_clk; + diva = CLOCK_CORECLOCK / pwm_clk; while ((prea < MCK_DIV_LB_MAX) && (~0xff & diva)) { prea = prea + 1; diva = diva >> 1; } - frequency = F_CPU / ((resolution * diva) << prea); + frequency = CLOCK_CORECLOCK / ((resolution * diva) << prea); } retval = frequency; diff --git a/cpu/sam3/periph/timer.c b/cpu/sam3/periph/timer.c index b74927d0e5..8e986a8c49 100644 --- a/cpu/sam3/periph/timer.c +++ b/cpu/sam3/periph/timer.c @@ -117,7 +117,7 @@ int timer_init(tim_t dev, unsigned int ticks_per_us, void (*callback)(int)) * channel 2 toggles this line on each timer tick, the actual frequency driving ch0/1 * is f_ch2 / 2 --> f_ch0/1 = (MCK / 2 / 2 / 1000000) * ticks_per_us. */ - tim->TC_CHANNEL[2].TC_RC = ((F_CPU / 1000000) / 4) * ticks_per_us; + tim->TC_CHANNEL[2].TC_RC = ((CLOCK_CORECLOCK / 1000000) / 4) * ticks_per_us; /* start channel 2 */ tim->TC_CHANNEL[2].TC_CCR = TC_CCR_CLKEN | TC_CCR_SWTRG; diff --git a/cpu/sam3/periph/uart.c b/cpu/sam3/periph/uart.c index 6882e8b400..8d958a54e4 100644 --- a/cpu/sam3/periph/uart.c +++ b/cpu/sam3/periph/uart.c @@ -63,7 +63,7 @@ int uart_init(uart_t uart, uint32_t baudrate, uart_rx_cb_t rx_cb, void *arg) uart_config[uart].tx_pin); /* configure baud rate and set mode to 8N1 */ - dev->UART_BRGR = (F_CPU / (16 * baudrate)); + dev->UART_BRGR = (CLOCK_CORECLOCK / (16 * baudrate)); dev->UART_MR = UART_MR_PAR_NO | US_MR_CHRL_8_BIT; dev->UART_CR = UART_CR_RXEN | UART_CR_TXEN | UART_CR_RSTSTA; From dda721ca0626c44cd2bcb46892486dfc2171e570 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:31:14 +0100 Subject: [PATCH 05/10] cpu/samd21: s/F_CPU/CLOCK_CORECLOCK/ --- cpu/samd21/periph/pwm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/samd21/periph/pwm.c b/cpu/samd21/periph/pwm.c index 9260a2421d..da64c0810b 100644 --- a/cpu/samd21/periph/pwm.c +++ b/cpu/samd21/periph/pwm.c @@ -102,11 +102,11 @@ int pwm_init(pwm_t dev, pwm_mode_t mode, } /* calculate the closest possible clock presacler */ - prescaler = get_prescaler(F_CPU / (frequency * resolution), &scale); + prescaler = get_prescaler(CLOCK_CORECLOCK / (frequency * resolution), &scale); if (prescaler == 0xff) { return -2; } - f_real = (F_CPU / (scale * resolution)); + f_real = (CLOCK_CORECLOCK / (scale * resolution)); /* configure the used pins */ for (int i = 0; i < PWM_MAX_CHANNELS; i++) { From b4362196740fd5bd0359e20a0e3e52a8ec5602df Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:31:46 +0100 Subject: [PATCH 06/10] boards: removed F_CPU define from board.h --- boards/airfy-beacon/include/board.h | 5 ----- boards/arduino-due/include/board.h | 5 ----- boards/arduino-mega2560/include/board.h | 5 ----- boards/cc2538dk/include/board.h | 5 ----- boards/f4vi1/include/board.h | 5 ----- boards/fox/include/board.h | 5 ----- boards/frdm-k64f/include/board.h | 5 ----- boards/iotlab-m3/include/board.h | 5 ----- boards/limifrog-v1/include/board.h | 6 ------ boards/mbed_lpc1768/include/board.h | 5 ----- boards/msbiot/include/board.h | 5 ----- boards/native/include/board.h | 2 -- boards/nrf51dongle/include/board.h | 5 ----- boards/nrf6310/include/board.h | 5 ----- boards/nucleo-f091/include/board.h | 5 ----- boards/nucleo-f103/include/board.h | 7 +------ boards/nucleo-f303/include/board.h | 5 ----- boards/nucleo-f334/include/board.h | 5 ----- boards/nucleo-f401/include/board.h | 5 ----- boards/nucleo-l1/include/board.h | 5 ----- boards/openmote-cc2538/include/board.h | 5 ----- boards/pba-d-01-kw2x/include/board.h | 5 ----- boards/pca10000/include/board.h | 5 ----- boards/pca10005/include/board.h | 5 ----- boards/remote/include/board.h | 5 ----- boards/saml21-xpro/include/board.h | 5 ----- boards/samr21-xpro/include/board.h | 5 ----- boards/slwstk6220a/include/board.h | 5 ----- boards/spark-core/include/board.h | 5 ----- boards/stm32f0discovery/include/board.h | 5 ----- boards/stm32f3discovery/include/board.h | 5 ----- boards/stm32f4discovery/include/board.h | 5 ----- boards/udoo/include/board.h | 5 ----- boards/weio/include/board.h | 5 ----- boards/yunjia-nrf51822/include/board.h | 5 ----- 35 files changed, 1 insertion(+), 174 deletions(-) diff --git a/boards/airfy-beacon/include/board.h b/boards/airfy-beacon/include/board.h index 970dd04c74..95603988d8 100644 --- a/boards/airfy-beacon/include/board.h +++ b/boards/airfy-beacon/include/board.h @@ -27,11 +27,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU (16000000UL) - /** * @brief Xtimer configuration * @{ diff --git a/boards/arduino-due/include/board.h b/boards/arduino-due/include/board.h index 09d5c94872..8a2c825ad8 100644 --- a/boards/arduino-due/include/board.h +++ b/boards/arduino-due/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU (84000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/arduino-mega2560/include/board.h b/boards/arduino-mega2560/include/board.h index 3f00a6a086..cae587c17d 100644 --- a/boards/arduino-mega2560/include/board.h +++ b/boards/arduino-mega2560/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU (16000000L) - /** * @brief As the CPU is too slow to handle 115200 baud, we set the default * baudrate to 9600 for this board diff --git a/boards/cc2538dk/include/board.h b/boards/cc2538dk/include/board.h index acd0f86ae4..caa9319109 100644 --- a/boards/cc2538dk/include/board.h +++ b/boards/cc2538dk/include/board.h @@ -27,11 +27,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU XOSC32M_FREQ - /** * @name Macros for controlling the on-board LEDs. * @{ diff --git a/boards/f4vi1/include/board.h b/boards/f4vi1/include/board.h index 8848fe5e9e..56c0932e90 100644 --- a/boards/f4vi1/include/board.h +++ b/boards/f4vi1/include/board.h @@ -29,11 +29,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name LED pin definitions * @{ diff --git a/boards/fox/include/board.h b/boards/fox/include/board.h index 3dd0220c83..6717f2c77c 100644 --- a/boards/fox/include/board.h +++ b/boards/fox/include/board.h @@ -33,11 +33,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name Define the interface to the AT86RF231 radio * diff --git a/boards/frdm-k64f/include/board.h b/boards/frdm-k64f/include/board.h index ee1d8a71b2..dc4b528e2d 100644 --- a/boards/frdm-k64f/include/board.h +++ b/boards/frdm-k64f/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name LED pin definitions * @{ diff --git a/boards/iotlab-m3/include/board.h b/boards/iotlab-m3/include/board.h index 1bdf833f0a..9b5aaa139e 100644 --- a/boards/iotlab-m3/include/board.h +++ b/boards/iotlab-m3/include/board.h @@ -33,11 +33,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name Set the default baudrate to 500K for this board * @{ diff --git a/boards/limifrog-v1/include/board.h b/boards/limifrog-v1/include/board.h index 883fa2550a..5be17551d1 100644 --- a/boards/limifrog-v1/include/board.h +++ b/boards/limifrog-v1/include/board.h @@ -30,12 +30,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK -/** @} */ - /** * @name LED pin definitions * @{ diff --git a/boards/mbed_lpc1768/include/board.h b/boards/mbed_lpc1768/include/board.h index d333c76039..30ca5fd0f3 100644 --- a/boards/mbed_lpc1768/include/board.h +++ b/boards/mbed_lpc1768/include/board.h @@ -32,11 +32,6 @@ extern "C" { #endif -/** - * @brief The nominal CPU core clock in this board - */ -#define F_CPU (96000000) - /** * @name LED pin definitions * @{ diff --git a/boards/msbiot/include/board.h b/boards/msbiot/include/board.h index f278382d45..cd9e44894a 100644 --- a/boards/msbiot/include/board.h +++ b/boards/msbiot/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name Configure connected CC1101 (radio) device * @{ diff --git a/boards/native/include/board.h b/boards/native/include/board.h index 0ec6dd8763..758a8f68df 100644 --- a/boards/native/include/board.h +++ b/boards/native/include/board.h @@ -30,8 +30,6 @@ extern "C" { #endif -#define F_CPU 1000000 - void _native_LED_GREEN_OFF(void); #define LED_GREEN_OFF (_native_LED_GREEN_OFF()) void _native_LED_GREEN_ON(void); diff --git a/boards/nrf51dongle/include/board.h b/boards/nrf51dongle/include/board.h index b2b0727720..9f1ce05921 100644 --- a/boards/nrf51dongle/include/board.h +++ b/boards/nrf51dongle/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * @brief Define the nominal CPU core clock in this board - */ -#define F_CPU (CLOCK_CORECLOCK) - /** * @name LED pin definitions * @{ diff --git a/boards/nrf6310/include/board.h b/boards/nrf6310/include/board.h index 2c164e11a0..d642762818 100644 --- a/boards/nrf6310/include/board.h +++ b/boards/nrf6310/include/board.h @@ -29,11 +29,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU (16000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/nucleo-f091/include/board.h b/boards/nucleo-f091/include/board.h index 49eb198c94..3d13993d5f 100644 --- a/boards/nucleo-f091/include/board.h +++ b/boards/nucleo-f091/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name LED pin definitions * @{ diff --git a/boards/nucleo-f103/include/board.h b/boards/nucleo-f103/include/board.h index 0f10daad01..749016656e 100755 --- a/boards/nucleo-f103/include/board.h +++ b/boards/nucleo-f103/include/board.h @@ -30,15 +30,10 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @brief Use the 2nd UART for STDIO on this board */ -#define STDIO UART_1 +#define STDIO UART_DEV(1) /** * @name LED pin definitions diff --git a/boards/nucleo-f303/include/board.h b/boards/nucleo-f303/include/board.h index 136ab5f7dd..5c47e914c4 100755 --- a/boards/nucleo-f303/include/board.h +++ b/boards/nucleo-f303/include/board.h @@ -32,11 +32,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name LED pin definitions * @{ diff --git a/boards/nucleo-f334/include/board.h b/boards/nucleo-f334/include/board.h index c3eb3cba38..be2fe0460b 100644 --- a/boards/nucleo-f334/include/board.h +++ b/boards/nucleo-f334/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name LED pin definitions * @{ diff --git a/boards/nucleo-f401/include/board.h b/boards/nucleo-f401/include/board.h index 22b62da265..5d87b5c9d3 100644 --- a/boards/nucleo-f401/include/board.h +++ b/boards/nucleo-f401/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name xtimer configuration * @{ diff --git a/boards/nucleo-l1/include/board.h b/boards/nucleo-l1/include/board.h index e33e4a969b..0d016c2f02 100644 --- a/boards/nucleo-l1/include/board.h +++ b/boards/nucleo-l1/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name xtimer configuration * @{ diff --git a/boards/openmote-cc2538/include/board.h b/boards/openmote-cc2538/include/board.h index 99c6b0f5b5..4e441bae8c 100644 --- a/boards/openmote-cc2538/include/board.h +++ b/boards/openmote-cc2538/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * @name The nominal CPU core clock in this board - */ -#define F_CPU (32000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/pba-d-01-kw2x/include/board.h b/boards/pba-d-01-kw2x/include/board.h index 524f8566e7..c6ecd57ffd 100644 --- a/boards/pba-d-01-kw2x/include/board.h +++ b/boards/pba-d-01-kw2x/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name LED pin definitions * @{ diff --git a/boards/pca10000/include/board.h b/boards/pca10000/include/board.h index d2350866ba..d0be5893b2 100644 --- a/boards/pca10000/include/board.h +++ b/boards/pca10000/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * @brief Define the nominal CPU core clock in this board - */ -#define F_CPU (16000000UL) - /** * @brief Xtimer configuration * @{ diff --git a/boards/pca10005/include/board.h b/boards/pca10005/include/board.h index 0283db40ce..9fc73f3cae 100644 --- a/boards/pca10005/include/board.h +++ b/boards/pca10005/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU (16000000UL) - /** * @brief Xtimer configuration * @{ diff --git a/boards/remote/include/board.h b/boards/remote/include/board.h index 4ecd7b5881..0db379e49d 100644 --- a/boards/remote/include/board.h +++ b/boards/remote/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * @name The nominal CPU core clock in this board - */ -#define F_CPU (32000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/saml21-xpro/include/board.h b/boards/saml21-xpro/include/board.h index 9bace515b6..608f8d7545 100644 --- a/boards/saml21-xpro/include/board.h +++ b/boards/saml21-xpro/include/board.h @@ -27,11 +27,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU (16000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/samr21-xpro/include/board.h b/boards/samr21-xpro/include/board.h index 3e1dcec962..05e4a65168 100644 --- a/boards/samr21-xpro/include/board.h +++ b/boards/samr21-xpro/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU (CLOCK_CORECLOCK) - /** * Assign the hardware timer */ diff --git a/boards/slwstk6220a/include/board.h b/boards/slwstk6220a/include/board.h index 804d3df56b..bb6578173c 100644 --- a/boards/slwstk6220a/include/board.h +++ b/boards/slwstk6220a/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * @brief Define the nominal CPU core clock in this board - */ -#define F_CPU (CLOCK_CORECLOCK) - /** * @brief Assign the hardware timer */ diff --git a/boards/spark-core/include/board.h b/boards/spark-core/include/board.h index 43eb055b84..14f9627b20 100644 --- a/boards/spark-core/include/board.h +++ b/boards/spark-core/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name Define the location of the RIOT image in flash */ diff --git a/boards/stm32f0discovery/include/board.h b/boards/stm32f0discovery/include/board.h index 56e07d5075..4795b52c14 100644 --- a/boards/stm32f0discovery/include/board.h +++ b/boards/stm32f0discovery/include/board.h @@ -27,11 +27,6 @@ extern "C" { #endif -/** - * @name The nominal CPU core clock in this board - */ -#define F_CPU (48000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/stm32f3discovery/include/board.h b/boards/stm32f3discovery/include/board.h index cd7bee4cfa..a6412d9b6f 100644 --- a/boards/stm32f3discovery/include/board.h +++ b/boards/stm32f3discovery/include/board.h @@ -27,11 +27,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU (72000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/stm32f4discovery/include/board.h b/boards/stm32f4discovery/include/board.h index 06923e6179..6db7a5e239 100644 --- a/boards/stm32f4discovery/include/board.h +++ b/boards/stm32f4discovery/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU CLOCK_CORECLOCK - /** * @name xtimer configuration * @{ diff --git a/boards/udoo/include/board.h b/boards/udoo/include/board.h index 5403d04409..e33cf8297f 100644 --- a/boards/udoo/include/board.h +++ b/boards/udoo/include/board.h @@ -28,11 +28,6 @@ extern "C" { #endif -/** - * Define the nominal CPU core clock in this board - */ -#define F_CPU (84000000UL) - /** * @name LED pin definitions * @{ diff --git a/boards/weio/include/board.h b/boards/weio/include/board.h index 7395026302..2fac005278 100644 --- a/boards/weio/include/board.h +++ b/boards/weio/include/board.h @@ -30,11 +30,6 @@ extern "C" { #endif -/** - * @brief The nominal CPU core clock in this board - */ -#define F_CPU (48000000) - /** * @name LED pin definitions * @{ diff --git a/boards/yunjia-nrf51822/include/board.h b/boards/yunjia-nrf51822/include/board.h index c0a0dcbb45..11463377d6 100644 --- a/boards/yunjia-nrf51822/include/board.h +++ b/boards/yunjia-nrf51822/include/board.h @@ -27,11 +27,6 @@ extern "C" { #endif -/** - * @name Define the nominal CPU core clock in this board - */ -#define F_CPU (16000000UL) - /** * @brief Xtimer configuration * @{ From ebfc13c68d8fea2116ffd5709fecfe4bd61a34a6 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:32:33 +0100 Subject: [PATCH 07/10] boards: added CLOCK_CORECLOCK define to periph_conf --- boards/arduino-due/include/periph_conf.h | 7 +++++++ boards/arduino-mega2560/include/periph_conf.h | 7 +++++++ boards/udoo/include/periph_conf.h | 7 +++++++ boards/weio/include/periph_conf.h | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/boards/arduino-due/include/periph_conf.h b/boards/arduino-due/include/periph_conf.h index b5e594dc33..ccc6594591 100644 --- a/boards/arduino-due/include/periph_conf.h +++ b/boards/arduino-due/include/periph_conf.h @@ -27,6 +27,13 @@ extern "C" { #endif +/** + * @name Clock configuration + * @{ + */ +#define CLOCK_CORECLOCK (84000000U) +/** @} */ + /** * @name Timer peripheral configuration * @{ diff --git a/boards/arduino-mega2560/include/periph_conf.h b/boards/arduino-mega2560/include/periph_conf.h index 0f72a0cc75..52c9b8141e 100644 --- a/boards/arduino-mega2560/include/periph_conf.h +++ b/boards/arduino-mega2560/include/periph_conf.h @@ -23,6 +23,13 @@ extern "C" { #endif +/** + * @name Clock configuration + * @{ + */ +#define CLOCK_CORECLOCK (16000000L) +/** @} */ + /** * @name Timer peripheral configuration * @brief The ATmega2560 has 6 timers. Timer0 and Timer2 are 8 Bit Timers, diff --git a/boards/udoo/include/periph_conf.h b/boards/udoo/include/periph_conf.h index d53b0e2502..bf88862c35 100644 --- a/boards/udoo/include/periph_conf.h +++ b/boards/udoo/include/periph_conf.h @@ -25,6 +25,13 @@ extern "C" { #endif +/** + * @name Clock configuration + * @{ + */ +#define CLOCK_CORECLOCK (84000000U) +/** @} */ + /** * @name Timer peripheral configuration * @{ diff --git a/boards/weio/include/periph_conf.h b/boards/weio/include/periph_conf.h index d5d8b77728..dbcc20ab24 100644 --- a/boards/weio/include/periph_conf.h +++ b/boards/weio/include/periph_conf.h @@ -24,6 +24,13 @@ extern "C" { #endif +/** + * @brief Clock configuration + * @{ + */ +#define CLOCK_CORECLOCK (48000000U) +/** @} */ + /** * @brief Timer configuration * @{ From 9ddd13b0b8b05d0a414fb1665f7bcf50555659b2 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:43:07 +0100 Subject: [PATCH 08/10] boards: removed F_CPU from periph_conf.h --- boards/ek-lm4f120xl/include/periph_conf.h | 1 - boards/mulle/include/periph_conf.h | 4 ---- 2 files changed, 5 deletions(-) diff --git a/boards/ek-lm4f120xl/include/periph_conf.h b/boards/ek-lm4f120xl/include/periph_conf.h index 69d0d9c5b4..e2de1321cb 100644 --- a/boards/ek-lm4f120xl/include/periph_conf.h +++ b/boards/ek-lm4f120xl/include/periph_conf.h @@ -27,7 +27,6 @@ extern "C" { * @name Define the nominal CPU core clock in this board * @{ */ -#define F_CPU 1000000 #define CLK80 1 #define CLK50 2 #define CLK40 3 diff --git a/boards/mulle/include/periph_conf.h b/boards/mulle/include/periph_conf.h index 11467b5abe..09628b626d 100644 --- a/boards/mulle/include/periph_conf.h +++ b/boards/mulle/include/periph_conf.h @@ -50,10 +50,6 @@ extern "C" #define CPU_INT_FAST_CLK_HZ 4000000u /** Default System clock value */ #define DEFAULT_SYSTEM_CLOCK (CPU_XTAL32k_CLK_HZ * 2929u) - -/** @todo Investigate the side effects of making F_CPU run-time variable */ -#define F_CPU DEFAULT_SYSTEM_CLOCK - /** @} */ /** From fd7f4031446a5e5b9df74deafc02f4d8e62ca79c Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:33:05 +0100 Subject: [PATCH 09/10] board/qemu-i386: removed unused F_CPU define --- boards/qemu-i386/include/cpu_conf.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/boards/qemu-i386/include/cpu_conf.h b/boards/qemu-i386/include/cpu_conf.h index 8c95ec3e6c..f2ec3a0e96 100644 --- a/boards/qemu-i386/include/cpu_conf.h +++ b/boards/qemu-i386/include/cpu_conf.h @@ -31,8 +31,6 @@ extern "C" { #define THREAD_EXTRA_STACKSIZE_PRINTF_FLOAT (8192) #define THREAD_STACKSIZE_MINIMUM (8192) -#define F_CPU (1000000) /* This value is unused in x86 */ - #ifdef __cplusplus } #endif From 235b91efd8864b5484ed827794e848e27789b515 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 5 Jan 2016 13:33:37 +0100 Subject: [PATCH 10/10] boards/avsextrem: s/F_CPU/CLOCK_CORECLOCK/ --- boards/avsextrem/drivers/avsextrem-ssp0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boards/avsextrem/drivers/avsextrem-ssp0.c b/boards/avsextrem/drivers/avsextrem-ssp0.c index f5ce2b666f..9618054025 100644 --- a/boards/avsextrem/drivers/avsextrem-ssp0.c +++ b/boards/avsextrem/drivers/avsextrem-ssp0.c @@ -23,6 +23,7 @@ #include "lpc23xx.h" /* LPC23XX/24xx Peripheral Registers */ #include "cpu.h" #include "VIC.h" +#include "periph_conf.h" #include "ssp0-board.h" #include "smb380-board.h" //#include "mma7455l-board.h" @@ -192,7 +193,7 @@ uint8_t SSP0Prepare(uint8_t chip, uint8_t datasize, uint8_t cpol, uint8_t cpha, // Clock Setup uint32_t pclksel; uint32_t cpsr; - lpc2387_pclk_scale(F_CPU / 1000, freq, &pclksel, &cpsr); + lpc2387_pclk_scale(CLOCK_CORECLOCK / 1000, freq, &pclksel, &cpsr); PCLKSEL1 &= ~(BIT10 | BIT11); // CCLK to PCLK divider ??? PCLKSEL1 |= pclksel << 10; SSP0CPSR = cpsr;