drivers/rtc: Enable RTC driver for STM32F4 series

Enable RTC driver for STM32F4 series.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
This commit is contained in:
Yannis Damigos 2018-06-20 19:48:31 +03:00 committed by Kumar Gala
commit 10c763cfbc
6 changed files with 29 additions and 11 deletions

View file

@ -15,7 +15,7 @@ config RTC_STM32
select USE_STM32_LL_EXTI
select NEWLIB_LIBC
help
Build RTC driver for STM32x4 SoCs. Tested on STM32L4 series.
Build RTC driver for STM32 SoCs. Tested on STM32 F4, L4 series.
choice RTC_STM32_CLOCK_SRC
bool "RTC clock source"

View file

@ -17,6 +17,12 @@
#include <board.h>
#include <rtc.h>
#if defined(CONFIG_SOC_SERIES_STM32L4X)
#define EXTI_LINE LL_EXTI_LINE_18
#elif defined(CONFIG_SOC_SERIES_STM32F4X)
#define EXTI_LINE LL_EXTI_LINE_17
#endif
#define EPOCH_OFFSET 946684800
struct rtc_stm32_config {
@ -193,7 +199,7 @@ void rtc_stm32_isr(void *arg)
LL_RTC_DisableIT_ALRA(RTC);
}
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_18);
LL_EXTI_ClearFlag_0_31(EXTI_LINE);
}
static int rtc_stm32_init(struct device *dev)
@ -245,8 +251,8 @@ static int rtc_stm32_init(struct device *dev)
LL_RTC_EnableShadowRegBypass(RTC);
LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_18);
LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_18);
LL_EXTI_EnableIT_0_31(EXTI_LINE);
LL_EXTI_EnableRisingTrig_0_31(EXTI_LINE);
rtc_stm32_irq_config(dev);

View file

@ -72,4 +72,11 @@ config USB_DC_STM32
endif # USB
if RTC
config RTC_STM32
def_bool y
endif # RTC
endif # SOC_FAMILY_STM32

View file

@ -141,4 +141,10 @@
#define CONFIG_PWM_STM32_14_DEV_NAME ST_STM32_PWM_40002000_PWM_LABEL
#define CONFIG_PWM_STM32_14_PRESCALER ST_STM32_PWM_40002000_PWM_ST_PRESCALER
#define CONFIG_RTC_0_BASE_ADDRESS ST_STM32_RTC_40002800_BASE_ADDRESS
#define CONFIG_RTC_0_IRQ_PRI ST_STM32_RTC_40002800_IRQ_0_PRIORITY
#define CONFIG_RTC_0_IRQ ST_STM32_RTC_40002800_IRQ_0
#define CONFIG_RTC_0_NAME ST_STM32_RTC_40002800_LABEL
#define CONFIG_RTC_PRESCALER ST_STM32_RTC_40002800_PRESCALER
/* End of SoC Level DTS fixup file */

View file

@ -59,6 +59,12 @@
#include <stm32f4xx_ll_iwdg.h>
#endif
#ifdef CONFIG_RTC_STM32
#include <stm32f4xx_ll_rtc.h>
#include <stm32f4xx_ll_exti.h>
#include <stm32f4xx_ll_pwr.h>
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F4_SOC_H_ */

View file

@ -27,11 +27,4 @@ config ENTROPY_STM32_RNG
endif # ENTROPY_GENERATOR
if RTC
config RTC_STM32
default y
endif # RTC
endif # SOC_SERIES_STM32L4X