From 21feca2a4681739049cdf8bd8b0bca003624ed07 Mon Sep 17 00:00:00 2001 From: Mateusz Szafoni Date: Mon, 6 May 2019 06:45:16 -0600 Subject: [PATCH] arch/arm/src/stm32h7/Kconfig: fix warnings; arch/arm/src/stm32h7/stm32_tim.c: don't use hardcoded UIF interrupt --- arch/arm/src/stm32h7/Kconfig | 82 +++++++++++++++++++++----------- arch/arm/src/stm32h7/stm32_tim.c | 6 +-- 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/arch/arm/src/stm32h7/Kconfig b/arch/arm/src/stm32h7/Kconfig index 2557902044..1e572c9d6c 100644 --- a/arch/arm/src/stm32h7/Kconfig +++ b/arch/arm/src/stm32h7/Kconfig @@ -1117,10 +1117,10 @@ if !STM32H7_PWM_MULTICHAN config STM32H7_TIM1_CHANNEL int "TIM1 PWM Output Channel" default 1 - range 1 6 + range 1 4 ---help--- If TIM1 is enabled for PWM usage, you also need specifies the timer output - channel {1,..,6} + channel {1,..,4} config STM32H7_TIM1_CHMODE int "TIM1 Channel Mode" @@ -1858,10 +1858,10 @@ if !STM32H7_PWM_MULTICHAN config STM32H7_TIM8_CHANNEL int "TIM8 PWM Output Channel" default 1 - range 1 6 + range 1 4 ---help--- If TIM8 is enabled for PWM usage, you also need specifies the timer output - channel {1,..,6} + channel {1,..,4} config STM32H7_TIM8_CHMODE int "TIM8 Channel Mode" @@ -1973,12 +1973,18 @@ config STM32H7_TIM13_PWM is defined then THIS following may also be defined to indicate that the timer is intended to be used for pulsed output modulation. -config STM32H7_TIM13_CHANNEL - default 1 - depends on STM32H7_TIM13_PWM - if STM32H7_TIM13_PWM +if !STM32H7_PWM_MULTICHAN + +config STM32H7_TIM13_CHANNEL + int "TIM13 PWM Output Channel" + default 1 + range 1 1 + ---help--- + If TIM13 is enabled for PWM usage, you also need specifies the timer output + channel {1} + config STM32H7_TIM13_CHMODE int "TIM13 Channel Mode" default 0 @@ -1986,6 +1992,8 @@ config STM32H7_TIM13_CHMODE ---help--- Specifies the channel mode. +endif # !STM32H7_PWM_MULTICHAN + endif # STM32H7_TIM13_PWM config STM32H7_TIM14_PWM @@ -2001,12 +2009,18 @@ config STM32H7_TIM14_PWM is defined then THIS following may also be defined to indicate that the timer is intended to be used for pulsed output modulation. -config STM32H7_TIM14_CHANNEL - default 1 - depends on STM32H7_TIM14_PWM - if STM32H7_TIM14_PWM +if !STM32H7_PWM_MULTICHAN + +config STM32_TIM14_CHANNEL + int "TIM14 PWM Output Channel" + default 1 + range 1 1 + ---help--- + If TIM14 is enabled for PWM usage, you also need specifies the timer output + channel {1} + config STM32H7_TIM14_CHMODE int "TIM14 Channel Mode" default 0 @@ -2014,6 +2028,8 @@ config STM32H7_TIM14_CHMODE ---help--- Specifies the channel mode. +endif # !STM32H7_PWM_MULTICHAN + endif # STM32H7_TIM14_PWM config STM32H7_TIM15_PWM @@ -2072,7 +2088,7 @@ config STM32H7_TIM15_CH2MODE Specifies the channel mode. config STM32H7_TIM15_CH2OUT - bool "TIM12 Channel 2 Output" + bool "TIM15 Channel 2 Output" default n ---help--- Enables channel 2 output. @@ -2084,7 +2100,7 @@ endif # STM32H7_PWM_MULTICHAN if !STM32H7_PWM_MULTICHAN config STM32H7_TIM15_CHANNEL - int "TIM12 PWM Output Channel" + int "TIM15 PWM Output Channel" default 1 range 1 2 ---help--- @@ -2115,16 +2131,18 @@ config STM32H7_TIM16_PWM is defined then THIS following may also be defined to indicate that the timer is intended to be used for pulsed output modulation. -config STM32H7_TIM16_CHANNEL - default 1 - depends on STM32H7_TIM16_PWM - -config STM32H7_TIM16_CHANNEL - default 1 - depends on STM32H7_TIM16_PWM - if STM32H7_TIM16_PWM +if !STM32H7_PWM_MULTICHAN + +config STM32_TIM16_CHANNEL + int "TIM16 PWM Output Channel" + default 1 + range 1 1 + ---help--- + If TIM16 is enabled for PWM usage, you also need specifies the timer output + channel {1} + config STM32H7_TIM16_CHMODE int "TIM16 Channel Mode" default 0 @@ -2132,6 +2150,8 @@ config STM32H7_TIM16_CHMODE ---help--- Specifies the channel mode. +endif # !STM32H7_PWM_MULTICHAN + endif # STM32H7_TIM16_PWM config STM32H7_TIM17_PWM @@ -2147,19 +2167,27 @@ config STM32H7_TIM17_PWM is defined then THIS following may also be defined to indicate that the timer is intended to be used for pulsed output modulation. -config STM32H7_TIM17_CHANNEL - default 1 - depends on STM32H7_TIM17_PWM - if STM32H7_TIM17_PWM +if !STM32H7_PWM_MULTICHAN + +config STM32_TIM17_CHANNEL + int "TIM17 PWM Output Channel" + default 1 + range 1 1 + ---help--- + If TIM17 is enabled for PWM usage, you also need specifies the timer output + channel {1} + config STM32H7_TIM17_CHMODE - int "TIM14 Channel Mode" + int "TIM17 Channel Mode" default 0 range 0 5 ---help--- Specifies the channel mode. +endif # !STM32H7_PWM_MULTICHAN + endif # STM32H7_TIM17_PWM config STM32H7_PWM_MULTICHAN diff --git a/arch/arm/src/stm32h7/stm32_tim.c b/arch/arm/src/stm32h7/stm32_tim.c index 1e3db29662..a3e96c2953 100644 --- a/arch/arm/src/stm32h7/stm32_tim.c +++ b/arch/arm/src/stm32h7/stm32_tim.c @@ -782,18 +782,18 @@ static int stm32_tim_setisr(FAR struct stm32_tim_dev_s *dev, static void stm32_tim_enableint(FAR struct stm32_tim_dev_s *dev, int source) { DEBUGASSERT(dev != NULL); - stm32_modifyreg16(dev, STM32_BTIM_DIER_OFFSET, 0, ATIM_DIER_UIE); + stm32_modifyreg16(dev, STM32_BTIM_DIER_OFFSET, 0, source); } static void stm32_tim_disableint(FAR struct stm32_tim_dev_s *dev, int source) { DEBUGASSERT(dev != NULL); - stm32_modifyreg16(dev, STM32_BTIM_DIER_OFFSET, ATIM_DIER_UIE, 0); + stm32_modifyreg16(dev, STM32_BTIM_DIER_OFFSET, source, 0); } static void stm32_tim_ackint(FAR struct stm32_tim_dev_s *dev, int source) { - stm32_putreg16(dev, STM32_BTIM_SR_OFFSET, ~ATIM_SR_UIF); + stm32_putreg16(dev, STM32_BTIM_SR_OFFSET, ~source); } /****************************************************************************