From 691470c1cdebe3dc291e07ef705435b5ec6a6a5b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 27 Jun 2018 10:20:14 -0600 Subject: [PATCH] arch/arm/src/stm32,stm32l4,stm32f7: Fix duplicated configuration options. All should be unique. --- arch/arm/src/stm32/Kconfig | 10 +++---- arch/arm/src/stm32/stm32_rtc.h | 40 +++++++++++++++------------ arch/arm/src/stm32/stm32l15xxx_rtcc.c | 26 ++++++++--------- arch/arm/src/stm32f7/Kconfig | 10 +++---- arch/arm/src/stm32f7/stm32_rtc.h | 24 ++++++++-------- arch/arm/src/stm32l4/Kconfig | 21 ++++++++++++++ arch/arm/src/stm32l4/stm32l4_rtc.h | 22 +++++++-------- 7 files changed, 89 insertions(+), 64 deletions(-) diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index 93e2cbfcd4..6252cfa9a8 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -7680,7 +7680,7 @@ config STM32_HAVE_RTC_SUBSECONDS menu "RTC Configuration" depends on RTC -config RTC_MAGIC_REG +config STM32_RTC_MAGIC_REG int "BKP register" default 0 range 0 19 @@ -7689,16 +7689,16 @@ config RTC_MAGIC_REG The BKP register used to store/check the Magic value to determine if RTC is already setup -config RTC_MAGIC +config STM32_RTC_MAGIC hex "RTC Magic 1" - default 0xfacefeee + default 0xfacefeed depends on !STM32_HAVE_RTC_COUNTER ---help--- Value used as Magic to determine if the RTC is already setup -config RTC_MAGIC_TIME_SET +config STM32_RTC_MAGIC_TIME_SET hex "RTC Magic 2" - default 0xfacefeef + default 0xf00dface depends on !STM32_HAVE_RTC_COUNTER ---help--- Value used as Magic to determine if the RTC has been setup and has diff --git a/arch/arm/src/stm32/stm32_rtc.h b/arch/arm/src/stm32/stm32_rtc.h index c18daf9144..b1ad332258 100644 --- a/arch/arm/src/stm32/stm32_rtc.h +++ b/arch/arm/src/stm32/stm32_rtc.h @@ -2,7 +2,7 @@ * arch/arm/src/stm32/stm32_rtc.h * * Copyright (C) 2011 Uros Platise. All rights reserved. - * Copyright (C) 2011-2013, 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2015-2018 Gregory Nutt. All rights reserved. * Author: Uros Platise (Original for the F1) * Gregory Nutt (On-going support and development) * @@ -78,41 +78,45 @@ * Pre-processor Definitions ****************************************************************************/ -#define STM32_RTC_PRESCALER_SECOND 32767 /* Default prescaler to get a - * second base */ -#define STM32_RTC_PRESCALER_MIN 1 /* Maximum speed of 16384 Hz */ +#define STM32_RTC_PRESCALER_SECOND 32767 /* Default prescaler to get a + * second base */ +#define STM32_RTC_PRESCALER_MIN 1 /* Maximum speed of 16384 Hz */ #if defined(CONFIG_STM32_STM32F10XX) /* RTC is only a counter, store RTC data in backup domain register DR1 (if * CONFIG_RTC_HIRES) and DR2 (state). */ -#if !defined(CONFIG_RTC_MAGIC) -# define CONFIG_RTC_MAGIC (0xface) /* only 16 bit */ +#if !defined(CONFIG_STM32_RTC_MAGIC) +# define CONFIG_STM32_RTC_MAGIC (0xface) /* only 16 bit */ #endif -#define RTC_MAGIC_REG STM32_BKP_DR2 +#if !defined(CONFIG_STM32_RTC_MAGIC_TIME_SET) +# define CONFIG_STM32_RTC_MAGIC_TIME_SET (0xf00d) +#endif + +#define RTC_MAGIC_REG STM32_BKP_DR2 #else /* !CONFIG_STM32_STM32F10XX */ -#if !defined(CONFIG_RTC_MAGIC) -# define CONFIG_RTC_MAGIC (0xfacefeed) +#if !defined(CONFIG_STM32_RTC_MAGIC) +# define CONFIG_STM32_RTC_MAGIC (0xfacefeed) #endif -#if !defined(CONFIG_RTC_MAGIC_REG) -# define CONFIG_RTC_MAGIC_REG (0) +#if !defined(CONFIG_STM32_RTC_MAGIC_TIME_SET) +# define CONFIG_STM32_RTC_MAGIC_TIME_SET (0xf00dface) #endif -#define RTC_MAGIC_REG STM32_RTC_BKR(CONFIG_RTC_MAGIC_REG) +#if !defined(CONFIG_STM32_RTC_MAGIC_REG) +# define CONFIG_STM32_RTC_MAGIC_REG (0) +#endif + +#define RTC_MAGIC_REG STM32_RTC_BKR(CONFIG_STM32_RTC_MAGIC_REG) #endif /* CONFIG_STM32_STM32F10XX */ -#define RTC_MAGIC CONFIG_RTC_MAGIC -#define RTC_MAGIC_TIME_SET CONFIG_RTC_MAGIC_TIME_SET - -#if !defined(CONFIG_RTC_MAGIC_TIME_SET) -# define CONFIG_RTC_MAGIC_TIME_SET (CONFIG_RTC_MAGIC + 1) -#endif +#define RTC_MAGIC CONFIG_STM32_RTC_MAGIC +#define RTC_MAGIC_TIME_SET CONFIG_STM32_RTC_MAGIC_TIME_SET /**************************************************************************** * Public Types diff --git a/arch/arm/src/stm32/stm32l15xxx_rtcc.c b/arch/arm/src/stm32/stm32l15xxx_rtcc.c index 8064f88075..9c7f094178 100644 --- a/arch/arm/src/stm32/stm32l15xxx_rtcc.c +++ b/arch/arm/src/stm32/stm32l15xxx_rtcc.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32/stm32l15xxx_rtcc.c * - * Copyright (C) 2012-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Juha Niskanen * @@ -89,28 +89,28 @@ # warning "RTC with LSI clock not yet tested on STM32L15XXX" #endif -#if !defined(CONFIG_RTC_MAGIC) -# define CONFIG_RTC_MAGIC (0xfacefeee) +#if !defined(CONFIG_STM32_RTC_MAGIC) +# define CONFIG_STM32_RTC_MAGIC (0xfacefeed) #endif -#if !defined(CONFIG_RTC_MAGIC_TIME_SET) -# define CONFIG_RTC_MAGIC_TIME_SET (CONFIG_RTC_MAGIC + 1) +#if !defined(CONFIG_STM32_RTC_MAGIC_TIME_SET) +# define CONFIG_STM32_RTC_MAGIC_TIME_SET (0xfoodface) #endif -#if !defined(CONFIG_RTC_MAGIC_REG) -# define CONFIG_RTC_MAGIC_REG (0) +#if !defined(CONFIG_STM32_RTC_MAGIC_REG) +# define CONFIG_STM32_RTC_MAGIC_REG (0) #endif -#define RTC_MAGIC CONFIG_RTC_MAGIC -#define RTC_MAGIC_TIME_SET CONFIG_RTC_MAGIC_TIME_SET -#define RTC_MAGIC_REG STM32_RTC_BKR(CONFIG_RTC_MAGIC_REG) +#define RTC_MAGIC CONFIG_STM32_RTC_MAGIC +#define RTC_MAGIC_TIME_SET CONFIG_STM32_RTC_MAGIC_TIME_SET +#define RTC_MAGIC_REG STM32_RTC_BKR(CONFIG_STM32_RTC_MAGIC_REG) /* Constants ****************************************************************/ -#define SYNCHRO_TIMEOUT (0x00020000) -#define INITMODE_TIMEOUT (0x00010000) +#define SYNCHRO_TIMEOUT (0x00020000) +#define INITMODE_TIMEOUT (0x00010000) -#define RTC_ALRMR_ENABLE 0 +#define RTC_ALRMR_ENABLE 0 /**************************************************************************** * Private Types diff --git a/arch/arm/src/stm32f7/Kconfig b/arch/arm/src/stm32f7/Kconfig index 36207f0632..403c9fb362 100644 --- a/arch/arm/src/stm32f7/Kconfig +++ b/arch/arm/src/stm32f7/Kconfig @@ -2052,7 +2052,7 @@ config STM32F7_HAVE_RTC_SUBSECONDS menu "RTC Configuration" depends on RTC -config RTC_MAGIC_REG +config STM32F7_RTC_MAGIC_REG int "BKP register" default 0 range 0 31 @@ -2060,15 +2060,15 @@ config RTC_MAGIC_REG The BKP register used to store/check the Magic value to determine if RTC is already setup -config RTC_MAGIC +config STM32F7_RTC_MAGIC hex "RTC Magic 1" - default 0xfacefeee + default 0xfacefeed ---help--- Value used as Magic to determine if the RTC is already setup -config RTC_MAGIC_TIME_SET +config STM32F7_RTC_MAGIC_TIME_SET hex "RTC Magic 2" - default 0xfacefeef + default 0xf00dface ---help--- Value used as Magic to determine if the RTC has been setup and has time set diff --git a/arch/arm/src/stm32f7/stm32_rtc.h b/arch/arm/src/stm32f7/stm32_rtc.h index 0ec4a808f0..8244e4c8d4 100644 --- a/arch/arm/src/stm32f7/stm32_rtc.h +++ b/arch/arm/src/stm32f7/stm32_rtc.h @@ -2,7 +2,7 @@ * arch/arm/src/stm32f7/stm32_rtc.h * * Copyright (C) 2011 Uros Platise. All rights reserved. - * Copyright (C) 2011-2013, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2015-2018 Gregory Nutt. All rights reserved. * Authors: Uros Platise (Original for the F1) * Gregory Nutt (On-going support and development) * David Sidrane @@ -59,24 +59,24 @@ * Pre-processor Definitions ****************************************************************************/ -#define STM32_RTC_PRESCALER_SECOND 32767 /* Default prescaler to get a second base */ -#define STM32_RTC_PRESCALER_MIN 1 /* Maximum speed of 16384 Hz */ +#define STM32_RTC_PRESCALER_SECOND 32767 /* Default prescaler to get a second base */ +#define STM32_RTC_PRESCALER_MIN 1 /* Maximum speed of 16384 Hz */ -#if !defined(CONFIG_RTC_MAGIC) -# define CONFIG_RTC_MAGIC (0xfacefeee) +#if !defined(CONFIG_STM32F7_RTC_MAGIC) +# define CONFIG_STM32F7_RTC_MAGIC (0xfacefeed) #endif -#if !defined(CONFIG_RTC_MAGIC_TIME_SET) -# define CONFIG_RTC_MAGIC_TIME_SET (CONFIG_RTC_MAGIC + 1) +#if !defined(CONFIG_STM32F7_RTC_MAGIC_TIME_SET) +# define CONFIG_STM32F7_RTC_MAGIC_TIME_SET (0xf00dface) #endif -#if !defined(CONFIG_RTC_MAGIC_REG) -# define CONFIG_RTC_MAGIC_REG (0) +#if !defined(CONFIG_STM32F7_RTC_MAGIC_REG) +# define CONFIG_STM32F7_RTC_MAGIC_REG (0) #endif -#define RTC_MAGIC CONFIG_RTC_MAGIC -#define RTC_MAGIC_TIME_SET CONFIG_RTC_MAGIC_TIME_SET -#define RTC_MAGIC_REG STM32_RTC_BKR(CONFIG_RTC_MAGIC_REG) +#define RTC_MAGIC CONFIG_STM32F7_RTC_MAGIC +#define RTC_MAGIC_TIME_SET CONFIG_STM32F7_RTC_MAGIC_TIME_SET +#define RTC_MAGIC_REG STM32_RTC_BKR(CONFIG_STM32F7_RTC_MAGIC_REG) /**************************************************************************** * Public Types diff --git a/arch/arm/src/stm32l4/Kconfig b/arch/arm/src/stm32l4/Kconfig index 4bd92f983b..41e2636bfb 100644 --- a/arch/arm/src/stm32l4/Kconfig +++ b/arch/arm/src/stm32l4/Kconfig @@ -1426,6 +1426,27 @@ config STM32L4_HAVE_RTC_SUBSECONDS select ARCH_HAVE_RTC_SUBSECONDS default y +config STM32F4_RTC_MAGIC_REG + int "BKP register" + default 0 + range 0 31 + ---help--- + The BKP register used to store/check the Magic value to determine if + RTC is already setup + +config STM32F4_RTC_MAGIC + hex "RTC Magic 1" + default 0xfacefeed + ---help--- + Value used as Magic to determine if the RTC is already setup + +config STM32F4_RTC_MAGIC_TIME_SET + hex "RTC Magic 2" + default 0xf00dface + ---help--- + Value used as Magic to determine if the RTC has been setup and has + time set + choice prompt "RTC clock source" default STM32L4_RTC_LSECLOCK diff --git a/arch/arm/src/stm32l4/stm32l4_rtc.h b/arch/arm/src/stm32l4/stm32l4_rtc.h index 6aa47d5f22..51c0e51dae 100644 --- a/arch/arm/src/stm32l4/stm32l4_rtc.h +++ b/arch/arm/src/stm32l4/stm32l4_rtc.h @@ -54,24 +54,24 @@ * Pre-processor Definitions ****************************************************************************/ -#define STM32L4_RTC_PRESCALER_SECOND 32767 /* Default prescaler to get a second base */ -#define STM32L4_RTC_PRESCALER_MIN 1 /* Maximum speed of 16384 Hz */ +#define STM32L4_RTC_PRESCALER_SECOND 32767 /* Default prescaler to get a second base */ +#define STM32L4_RTC_PRESCALER_MIN 1 /* Maximum speed of 16384 Hz */ -#if !defined(CONFIG_RTC_MAGIC) -# define CONFIG_RTC_MAGIC (0xfacefeee) +#if !defined(CONFIG_STM32L4_RTC_MAGIC) +# define CONFIG_STM32L4_RTC_MAGIC (0xfacefeee) #endif -#if !defined(CONFIG_RTC_MAGIC_TIME_SET) -# define CONFIG_RTC_MAGIC_TIME_SET (CONFIG_RTC_MAGIC + 1) +#if !defined(CONFIG_STM32L4_RTC_MAGIC_TIME_SET) +# define CONFIG_STM32L4_RTC_MAGIC_TIME_SET (0xf00dface) #endif -#if !defined(CONFIG_RTC_MAGIC_REG) -# define CONFIG_RTC_MAGIC_REG (0) +#if !defined(CONFIG_STM32L4_RTC_MAGIC_REG) +# define CONFIG_STM32L4_RTC_MAGIC_REG (0) #endif -#define RTC_MAGIC CONFIG_RTC_MAGIC -#define RTC_MAGIC_TIME_SET CONFIG_RTC_MAGIC_TIME_SET -#define RTC_MAGIC_REG STM32L4_RTC_BKR(CONFIG_RTC_MAGIC_REG) +#define RTC_MAGIC CONFIG_STM32L4_RTC_MAGIC +#define RTC_MAGIC_TIME_SET CONFIG_STM32L4_RTC_MAGIC_TIME_SET +#define RTC_MAGIC_REG STM32L4_RTC_BKR(CONFIG_STM32L4_RTC_MAGIC_REG) /**************************************************************************** * Public Types