From a3de88a4db337114c8596583fef8fb6cdeeeb638 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 18 Aug 2020 15:52:47 +0200 Subject: [PATCH] boards: efm32 boards, LETIMER + regular timer --- .../common/slwstk6000b/include/periph_conf.h | 3 +- boards/ikea-tradfri/include/board.h | 5 ++- boards/ikea-tradfri/include/periph_conf.h | 34 +++++++++---------- boards/slstk3401a/include/board.h | 5 ++- boards/slstk3401a/include/periph_conf.h | 34 +++++++++---------- boards/slstk3402a/include/board.h | 5 ++- boards/slstk3402a/include/periph_conf.h | 34 +++++++++---------- boards/sltb001a/include/board.h | 5 ++- boards/sltb001a/include/periph_conf.h | 34 +++++++++---------- boards/stk3600/include/board.h | 5 ++- boards/stk3600/include/periph_conf.h | 34 +++++++++---------- boards/stk3700/include/board.h | 5 ++- boards/stk3700/include/periph_conf.h | 34 +++++++++---------- 13 files changed, 128 insertions(+), 109 deletions(-) diff --git a/boards/common/slwstk6000b/include/periph_conf.h b/boards/common/slwstk6000b/include/periph_conf.h index e30471fd76..7f74dd90b9 100644 --- a/boards/common/slwstk6000b/include/periph_conf.h +++ b/boards/common/slwstk6000b/include/periph_conf.h @@ -147,7 +147,8 @@ static const timer_conf_t timer_config[] = { .dev = TIMER1, .cmu = cmuClock_TIMER1 }, - .irq = TIMER1_IRQn + .irq = TIMER1_IRQn, + .channel_numof = 3 } }; diff --git a/boards/ikea-tradfri/include/board.h b/boards/ikea-tradfri/include/board.h index 054eb73fc2..27af510a54 100644 --- a/boards/ikea-tradfri/include/board.h +++ b/boards/ikea-tradfri/include/board.h @@ -34,12 +34,15 @@ extern "C" { * The timer runs at 250 kHz to increase accuracy or 32768 Hz for LETIMER. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) +#if IS_ACTIVE(CONFIG_EFM32_XTIMER_USE_LETIMER) +#define XTIMER_DEV (TIMER_DEV(1)) #define XTIMER_HZ (32768UL) #else +#define XTIMER_DEV (TIMER_DEV(0)) #define XTIMER_HZ (250000UL) #endif #define XTIMER_WIDTH (16) +#define XTIMER_CHAN (0) /** @} */ /** diff --git a/boards/ikea-tradfri/include/periph_conf.h b/boards/ikea-tradfri/include/periph_conf.h index 8255ba038c..98122ea566 100644 --- a/boards/ikea-tradfri/include/periph_conf.h +++ b/boards/ikea-tradfri/include/periph_conf.h @@ -85,19 +85,6 @@ static const spi_dev_t spi_config[] = { * or two regular timers in cascade mode. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) -static const timer_conf_t timer_config[] = { - { - .timer = { - .dev = LETIMER0, - .cmu = cmuClock_LETIMER0 - }, - .irq = LETIMER0_IRQn - } -}; -#define TIMER_0_ISR isr_letimer0 - -#else static const timer_conf_t timer_config[] = { { .prescaler = { @@ -108,12 +95,25 @@ static const timer_conf_t timer_config[] = { .dev = TIMER1, .cmu = cmuClock_TIMER1 }, - .irq = TIMER1_IRQn - } + .irq = TIMER1_IRQn, + .channel_numof = 3 + }, + { + .prescaler = { + .dev = NULL, + .cmu = cmuClock_LETIMER0 + }, + .timer = { + .dev = LETIMER0, + .cmu = cmuClock_LETIMER0 + }, + .irq = LETIMER0_IRQn, + .channel_numof = 2 + }, }; -#define TIMER_0_ISR isr_timer1 -#endif /* CONFIG_EFM32_USE_LETIMER */ +#define TIMER_0_ISR isr_timer1 +#define TIMER_1_ISR isr_letimer0 #define TIMER_NUMOF ARRAY_SIZE(timer_config) /** @} */ diff --git a/boards/slstk3401a/include/board.h b/boards/slstk3401a/include/board.h index 8fc23e0b0f..6894b13576 100644 --- a/boards/slstk3401a/include/board.h +++ b/boards/slstk3401a/include/board.h @@ -35,12 +35,15 @@ extern "C" { * The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) +#if IS_ACTIVE(CONFIG_EFM32_XTIMER_USE_LETIMER) +#define XTIMER_DEV (TIMER_DEV(1)) #define XTIMER_HZ (32768UL) #else +#define XTIMER_DEV (TIMER_DEV(0)) #define XTIMER_HZ (250000UL) #endif #define XTIMER_WIDTH (16) +#define XTIMER_CHAN (0) /** @} */ /** diff --git a/boards/slstk3401a/include/periph_conf.h b/boards/slstk3401a/include/periph_conf.h index e6b3207332..dc034e4f16 100644 --- a/boards/slstk3401a/include/periph_conf.h +++ b/boards/slstk3401a/include/periph_conf.h @@ -145,19 +145,6 @@ static const spi_dev_t spi_config[] = { * or two regular timers in cascade mode. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) -static const timer_conf_t timer_config[] = { - { - .timer = { - .dev = LETIMER0, - .cmu = cmuClock_LETIMER0 - }, - .irq = LETIMER0_IRQn - } -}; -#define TIMER_0_ISR isr_letimer0 - -#else static const timer_conf_t timer_config[] = { { .prescaler = { @@ -168,12 +155,25 @@ static const timer_conf_t timer_config[] = { .dev = TIMER1, .cmu = cmuClock_TIMER1 }, - .irq = TIMER1_IRQn - } + .irq = TIMER1_IRQn, + .channel_numof = 3 + }, + { + .prescaler = { + .dev = NULL, + .cmu = cmuClock_LETIMER0 + }, + .timer = { + .dev = LETIMER0, + .cmu = cmuClock_LETIMER0 + }, + .irq = LETIMER0_IRQn, + .channel_numof = 2 + }, }; -#define TIMER_0_ISR isr_timer1 -#endif /* CONFIG_EFM32_USE_LETIMER */ +#define TIMER_0_ISR isr_timer1 +#define TIMER_1_ISR isr_letimer0 #define TIMER_NUMOF ARRAY_SIZE(timer_config) /** @} */ diff --git a/boards/slstk3402a/include/board.h b/boards/slstk3402a/include/board.h index 8e025c5abb..3b3c6e12dd 100644 --- a/boards/slstk3402a/include/board.h +++ b/boards/slstk3402a/include/board.h @@ -33,13 +33,16 @@ extern "C" { * @name Xtimer configuration * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) +#if IS_ACTIVE(CONFIG_EFM32_XTIMER_USE_LETIMER) +#define XTIMER_DEV (TIMER_DEV(1)) #define XTIMER_HZ (32768UL) #define XTIMER_WIDTH (16) #else +#define XTIMER_DEV (TIMER_DEV(0)) #define XTIMER_HZ (1000000UL) #define XTIMER_WIDTH (32) #endif +#define XTIMER_CHAN (0) /** @} */ /** diff --git a/boards/slstk3402a/include/periph_conf.h b/boards/slstk3402a/include/periph_conf.h index c5aae742e3..866be39ede 100644 --- a/boards/slstk3402a/include/periph_conf.h +++ b/boards/slstk3402a/include/periph_conf.h @@ -136,19 +136,6 @@ static const spi_dev_t spi_config[] = { * or two regular timers in cascade mode. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) -static const timer_conf_t timer_config[] = { - { - .timer = { - .dev = LETIMER0, - .cmu = cmuClock_LETIMER0 - }, - .irq = LETIMER0_IRQn - } -}; -#define TIMER_0_ISR isr_letimer0 - -#else static const timer_conf_t timer_config[] = { { .prescaler = { @@ -159,12 +146,25 @@ static const timer_conf_t timer_config[] = { .dev = WTIMER1, .cmu = cmuClock_WTIMER1 }, - .irq = WTIMER1_IRQn - } + .irq = WTIMER1_IRQn, + .channel_numof = 3 + }, + { + .prescaler = { + .dev = NULL, + .cmu = cmuClock_LETIMER0 + }, + .timer = { + .dev = LETIMER0, + .cmu = cmuClock_LETIMER0 + }, + .irq = LETIMER0_IRQn, + .channel_numof = 2 + }, }; -#define TIMER_0_ISR isr_wtimer1 -#endif /* CONFIG_EFM32_USE_LETIMER */ +#define TIMER_0_ISR isr_wtimer1 +#define TIMER_1_ISR isr_letimer0 #define TIMER_NUMOF ARRAY_SIZE(timer_config) /** @} */ diff --git a/boards/sltb001a/include/board.h b/boards/sltb001a/include/board.h index ef3f2c6d61..aced867dc1 100644 --- a/boards/sltb001a/include/board.h +++ b/boards/sltb001a/include/board.h @@ -35,13 +35,16 @@ extern "C" { * The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) +#if IS_ACTIVE(CONFIG_EFM32_XTIMER_USE_LETIMER) +#define XTIMER_DEV (TIMER_DEV(1)) #define XTIMER_HZ (32768UL) #define XTIMER_WIDTH (16) #else +#define XTIMER_DEV (TIMER_DEV(0)) #define XTIMER_HZ (250000UL) #define XTIMER_WIDTH (16) #endif +#define XTIMER_CHAN (0) /** @} */ /** diff --git a/boards/sltb001a/include/periph_conf.h b/boards/sltb001a/include/periph_conf.h index 98b43802b2..7662a53bff 100644 --- a/boards/sltb001a/include/periph_conf.h +++ b/boards/sltb001a/include/periph_conf.h @@ -145,19 +145,6 @@ static const spi_dev_t spi_config[] = { * or two regular timers in cascade mode. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) -static const timer_conf_t timer_config[] = { - { - .timer = { - .dev = LETIMER0, - .cmu = cmuClock_LETIMER0 - }, - .irq = LETIMER0_IRQn - } -}; -#define TIMER_0_ISR isr_letimer0 - -#else static const timer_conf_t timer_config[] = { { .prescaler = { @@ -168,12 +155,25 @@ static const timer_conf_t timer_config[] = { .dev = TIMER1, .cmu = cmuClock_TIMER1 }, - .irq = TIMER1_IRQn - } + .irq = TIMER1_IRQn, + .channel_numof = 3 + }, + { + .prescaler = { + .dev = NULL, + .cmu = cmuClock_LETIMER0 + }, + .timer = { + .dev = LETIMER0, + .cmu = cmuClock_LETIMER0 + }, + .irq = LETIMER0_IRQn, + .channel_numof = 2 + }, }; -#define TIMER_0_ISR isr_timer1 -#endif /* CONFIG_EFM32_USE_LETIMER */ +#define TIMER_0_ISR isr_timer1 +#define TIMER_1_ISR isr_letimer0 #define TIMER_NUMOF ARRAY_SIZE(timer_config) /** @} */ diff --git a/boards/stk3600/include/board.h b/boards/stk3600/include/board.h index 20caffd57f..60822e884b 100644 --- a/boards/stk3600/include/board.h +++ b/boards/stk3600/include/board.h @@ -35,13 +35,16 @@ extern "C" { * The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) +#if IS_ACTIVE(CONFIG_EFM32_XTIMER_USE_LETIMER) +#define XTIMER_DEV (TIMER_DEV(1)) #define XTIMER_HZ (32768UL) #define XTIMER_WIDTH (16) #else +#define XTIMER_DEV (TIMER_DEV(0)) #define XTIMER_HZ (250000UL) #define XTIMER_WIDTH (16) #endif +#define XTIMER_CHAN (0) /** @} */ /** diff --git a/boards/stk3600/include/periph_conf.h b/boards/stk3600/include/periph_conf.h index 6f90a95668..42a6493cd8 100644 --- a/boards/stk3600/include/periph_conf.h +++ b/boards/stk3600/include/periph_conf.h @@ -199,19 +199,6 @@ static const spi_dev_t spi_config[] = { * or two regular timers in cascade mode. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) -static const timer_conf_t timer_config[] = { - { - .timer = { - .dev = LETIMER0, - .cmu = cmuClock_LETIMER0 - }, - .irq = LETIMER0_IRQn - } -}; -#define TIMER_0_ISR isr_letimer0 - -#else static const timer_conf_t timer_config[] = { { .prescaler = { @@ -222,12 +209,25 @@ static const timer_conf_t timer_config[] = { .dev = TIMER1, .cmu = cmuClock_TIMER1 }, - .irq = TIMER1_IRQn - } + .irq = TIMER1_IRQn, + .channel_numof = 3 + }, + { + .prescaler = { + .dev = NULL, + .cmu = cmuClock_LETIMER0 + }, + .timer = { + .dev = LETIMER0, + .cmu = cmuClock_LETIMER0 + }, + .irq = LETIMER0_IRQn, + .channel_numof = 2 + }, }; -#define TIMER_0_ISR isr_timer1 -#endif /* CONFIG_EFM32_USE_LETIMER */ +#define TIMER_0_ISR isr_timer1 +#define TIMER_1_ISR isr_letimer0 #define TIMER_NUMOF ARRAY_SIZE(timer_config) /** @} */ diff --git a/boards/stk3700/include/board.h b/boards/stk3700/include/board.h index efc3fcc545..58fc3f02cd 100644 --- a/boards/stk3700/include/board.h +++ b/boards/stk3700/include/board.h @@ -35,13 +35,16 @@ extern "C" { * The timer runs at 250 KHz to increase accuracy or 32768 Hz for LETIMER. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) +#if IS_ACTIVE(CONFIG_EFM32_XTIMER_USE_LETIMER) +#define XTIMER_DEV (TIMER_DEV(1)) #define XTIMER_HZ (32768UL) #define XTIMER_WIDTH (16) #else +#define XTIMER_DEV (TIMER_DEV(0)) #define XTIMER_HZ (250000UL) #define XTIMER_WIDTH (16) #endif +#define XTIMER_CHAN (0) /** @} */ /** diff --git a/boards/stk3700/include/periph_conf.h b/boards/stk3700/include/periph_conf.h index 659bb48e29..e63f566fa0 100644 --- a/boards/stk3700/include/periph_conf.h +++ b/boards/stk3700/include/periph_conf.h @@ -199,19 +199,6 @@ static const spi_dev_t spi_config[] = { * or two regular timers in cascade mode. * @{ */ -#if IS_ACTIVE(CONFIG_EFM32_USE_LETIMER) -static const timer_conf_t timer_config[] = { - { - .timer = { - .dev = LETIMER0, - .cmu = cmuClock_LETIMER0 - }, - .irq = LETIMER0_IRQn - } -}; -#define TIMER_0_ISR isr_letimer0 - -#else static const timer_conf_t timer_config[] = { { .prescaler = { @@ -222,12 +209,25 @@ static const timer_conf_t timer_config[] = { .dev = TIMER1, .cmu = cmuClock_TIMER1 }, - .irq = TIMER1_IRQn - } + .irq = TIMER1_IRQn, + .channel_numof = 3 + }, + { + .prescaler = { + .dev = NULL, + .cmu = cmuClock_LETIMER0 + }, + .timer = { + .dev = LETIMER0, + .cmu = cmuClock_LETIMER0 + }, + .irq = LETIMER0_IRQn, + .channel_numof = 2 + }, }; -#define TIMER_0_ISR isr_timer1 -#endif /* CONFIG_EFM32_USE_LETIMER */ +#define TIMER_0_ISR isr_timer1 +#define TIMER_1_ISR isr_letimer0 #define TIMER_NUMOF ARRAY_SIZE(timer_config) /** @} */