From a6c30ab61d82e8a526881433d181d15a330f39f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Wed, 11 Apr 2018 18:53:24 +0200 Subject: [PATCH] kinetis: Move RTT config to periph_cpu.h --- boards/frdm-k22f/include/periph_conf.h | 15 -------------- boards/frdm-k64f/include/periph_conf.h | 15 -------------- boards/frdm-kw41z/include/periph_conf.h | 15 -------------- boards/mulle/include/periph_conf.h | 23 +--------------------- boards/pba-d-01-kw2x/include/periph_conf.h | 15 -------------- cpu/kinetis/include/periph_cpu.h | 14 +++++++++++++ 6 files changed, 15 insertions(+), 82 deletions(-) diff --git a/boards/frdm-k22f/include/periph_conf.h b/boards/frdm-k22f/include/periph_conf.h index d028cb307b..ed898ba0dd 100644 --- a/boards/frdm-k22f/include/periph_conf.h +++ b/boards/frdm-k22f/include/periph_conf.h @@ -265,21 +265,6 @@ static const spi_conf_t spi_config[] = { #define I2C_0_PORT_CFG (PORT_PCR_MUX(I2C_0_PIN_AF) | PORT_PCR_ODE_MASK) /** @} */ -/** -* @name RTT and RTC configuration -* @{ -*/ -#define RTT_NUMOF (1U) -#define RTC_NUMOF (1U) -#define RTT_DEV RTC -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_UNLOCK() (SIM->SCGC6 |= (SIM_SCGC6_RTC_MASK)) -#define RTT_ISR isr_rtc -#define RTT_FREQUENCY (1) -#define RTT_MAX_VALUE (0xffffffff) -/** @} */ - #ifdef __cplusplus } #endif diff --git a/boards/frdm-k64f/include/periph_conf.h b/boards/frdm-k64f/include/periph_conf.h index 1f36c6427c..649a37572c 100644 --- a/boards/frdm-k64f/include/periph_conf.h +++ b/boards/frdm-k64f/include/periph_conf.h @@ -259,21 +259,6 @@ static const spi_conf_t spi_config[] = { #define I2C_0_PORT_CFG (PORT_PCR_MUX(I2C_0_PIN_AF) | PORT_PCR_ODE_MASK) /** @} */ -/** -* @name RTT and RTC configuration -* @{ -*/ -#define RTT_NUMOF (1U) -#define RTC_NUMOF (1U) -#define RTT_DEV RTC -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_UNLOCK() (SIM->SCGC6 |= (SIM_SCGC6_RTC_MASK)) -#define RTT_ISR isr_rtc -#define RTT_FREQUENCY (1) -#define RTT_MAX_VALUE (0xffffffff) -/** @} */ - #ifdef __cplusplus } #endif diff --git a/boards/frdm-kw41z/include/periph_conf.h b/boards/frdm-kw41z/include/periph_conf.h index 05feabb1cd..50a93eb138 100644 --- a/boards/frdm-kw41z/include/periph_conf.h +++ b/boards/frdm-kw41z/include/periph_conf.h @@ -286,21 +286,6 @@ static const spi_conf_t spi_config[] = { #define I2C_1_PORT_CFG (PORT_PCR_MUX(I2C_0_PIN_AF)) /** @} */ -/** -* @name RTT and RTC configuration -* @{ -*/ -#define RTT_NUMOF (1U) -#define RTC_NUMOF (1U) -#define RTT_DEV RTC -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_UNLOCK() (bit_set32(&SIM->SCGC6, SIM_SCGC6_RTC_SHIFT)) -#define RTT_ISR isr_rtc -#define RTT_FREQUENCY (1) -#define RTT_MAX_VALUE (0xffffffff) -/** @} */ - /** * @name Random Number Generator configuration * @{ diff --git a/boards/mulle/include/periph_conf.h b/boards/mulle/include/periph_conf.h index 67b98614f8..7a688da8da 100644 --- a/boards/mulle/include/periph_conf.h +++ b/boards/mulle/include/periph_conf.h @@ -115,6 +115,7 @@ static const clock_config_t clock_config = { #define PIT_ISR_0 isr_pit1 #define PIT_ISR_1 isr_pit3 #define LPTMR_ISR_0 isr_lptmr0 + /** @} */ /** @@ -374,28 +375,6 @@ static const spi_conf_t spi_config[] = { #define KINETIS_I2C_F_MULT_FAST_PLUS (0) /** @} */ -/** - * @name RTC configuration - * @{ - */ -/* RIOT RTC implementation uses RTT for underlying timekeeper */ -#define RTC_NUMOF (1U) -/** @} */ - -/** - * @name RTT configuration - * @{ - */ -#define RTT_NUMOF (1U) -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_ISR isr_rtc -#define RTT_DEV RTC -#define RTT_UNLOCK() (BITBAND_REG32(SIM->SCGC6, SIM_SCGC6_RTC_SHIFT) = 1) -#define RTT_MAX_VALUE (0xffffffff) -#define RTT_FREQUENCY (1) /* in Hz */ -/** @} */ - #ifdef __cplusplus } #endif diff --git a/boards/pba-d-01-kw2x/include/periph_conf.h b/boards/pba-d-01-kw2x/include/periph_conf.h index bfb467923e..043f93f024 100644 --- a/boards/pba-d-01-kw2x/include/periph_conf.h +++ b/boards/pba-d-01-kw2x/include/periph_conf.h @@ -289,21 +289,6 @@ static const spi_conf_t spi_config[] = { /** @} */ -/** -* @name RTT and RTC configuration -* @{ -*/ -#define RTT_NUMOF (1U) -#define RTC_NUMOF (1U) -#define RTT_DEV RTC -#define RTT_IRQ RTC_IRQn -#define RTT_IRQ_PRIO 10 -#define RTT_UNLOCK() (SIM->SCGC6 |= (SIM_SCGC6_RTC_MASK)) -#define RTT_ISR isr_rtc -#define RTT_FREQUENCY (1) -#define RTT_MAX_VALUE (0xffffffff) -/** @} */ - #ifdef __cplusplus } #endif diff --git a/cpu/kinetis/include/periph_cpu.h b/cpu/kinetis/include/periph_cpu.h index e7645edcaa..703f82d335 100644 --- a/cpu/kinetis/include/periph_cpu.h +++ b/cpu/kinetis/include/periph_cpu.h @@ -114,6 +114,20 @@ typedef uint16_t gpio_t; */ #define PM_NUM_MODES (1U) +#ifdef RTC +/* All Kinetis CPUs have exactly one RTC hardware module, except for the KL02 + * family which don't have an RTC at all */ +/** + * @name RTT and RTC configuration + * @{ + */ +#define RTT_NUMOF (1U) +#define RTC_NUMOF (1U) +#define RTT_FREQUENCY (1) +#define RTT_MAX_VALUE (0xffffffff) +/** @} */ +#endif + #ifndef DOXYGEN /** * @name GPIO pin modes