diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-11-25 13:56:44 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-11-25 13:56:44 +0000 |
commit | 6268914b7c6eac2a8ee04b2f9d4c270fc5363dee (patch) | |
tree | 49eb94045477dd3d2794afee365adfb21dcee5f0 /os/hal/ports/STM32/LLD | |
parent | b8a4c26a9cab50e5a845d0033665a4d74b17444b (diff) | |
download | ChibiOS-6268914b7c6eac2a8ee04b2f9d4c270fc5363dee.tar.gz ChibiOS-6268914b7c6eac2a8ee04b2f9d4c270fc5363dee.tar.bz2 ChibiOS-6268914b7c6eac2a8ee04b2f9d4c270fc5363dee.zip |
RTC adjustments for F0 devices.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12439 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/LLD')
-rw-r--r-- | os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c | 32 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h | 3 |
2 files changed, 19 insertions, 16 deletions
diff --git a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c index 763ebf851..2dfc4f62c 100644 --- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c +++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c @@ -285,7 +285,9 @@ OSAL_IRQ_HANDLER(STM32_RTC_COMMON_HANDLER) { #if defined(RTC_ISR_TAMP3F)
| RTC_ISR_TAMP3F
#endif
+#if defined(RTC_ISR_WUTF)
| RTC_ISR_WUTF
+#endif
#if defined(RTC_ISR_ALRAF)
| RTC_ISR_ALRAF
#endif
@@ -302,12 +304,14 @@ OSAL_IRQ_HANDLER(STM32_RTC_COMMON_HANDLER) { EXTI_MASK1(STM32_RTC_WKUP_EXTI));
if (RTCD1.callback != NULL) {
- uint32_t cr = RTCD1-rtc->CR;
- uint32_t tampcr = RTCD1.rtc->TAMPCR;
+ uint32_t cr = RTCD1.rtc->CR;
+ uint32_t tafcr = RTCD1.rtc->TAFCR;
+#if defined(RTC_ISR_WUTF)
if (((cr & RTC_CR_WUTIE) != 0U) && ((isr & RTC_ISR_WUTF) != 0U)) {
RTCD1.callback(&RTCD1, RTC_EVENT_WAKEUP);
}
+#endif
#if defined(RTC_ISR_ALRAF)
if (((cr & RTC_CR_ALRAIE) != 0U) && ((isr & RTC_ISR_ALRAF) != 0U)) {
@@ -329,24 +333,18 @@ OSAL_IRQ_HANDLER(STM32_RTC_COMMON_HANDLER) { }
}
+ if ((tafcr & RTC_TAFCR_TAMPIE) != 0U) {
#if defined(RTC_ISR_TAMP1F)
- if (((tampcr & RTC_TAMPCR_TAMP1IE) != 0U) &&
- ((isr & RTC_ISR_TAMP1F) != 0U)) {
- RTCD1.callback(&RTCD1, RTC_EVENT_TAMP1);
- }
+ if ((isr & RTC_ISR_TAMP1F) != 0U) {
+ RTCD1.callback(&RTCD1, RTC_EVENT_TAMP1);
+ }
#endif
#if defined(RTC_ISR_TAMP2F)
- if (((tampcr & RTC_TAMPCR_TAMP2IE) != 0U) &&
- ((isr & RTC_ISR_TAMP2F) != 0U)) {
- RTCD1.callback(&RTCD1, RTC_EVENT_TAMP2);
- }
+ if ((isr & RTC_ISR_TAMP2F) != 0U) {
+ RTCD1.callback(&RTCD1, RTC_EVENT_TAMP2);
+ }
#endif
-#if defined(RTC_ISR_TAMP3F)
- if (((tampcr & RTC_TAMPCR_TAMP3IE) != 0U) &&
- ((isr & RTC_ISR_TAMP3F) != 0U)) {
- RTCD1.callback(&RTCD1, RTC_EVENT_TAMP3);
}
-#endif
}
OSAL_IRQ_EPILOGUE();
@@ -520,7 +518,11 @@ void rtc_lld_init(void) { rtc_enter_init();
RTCD1.rtc->CR = STM32_RTC_CR_INIT;
+#if defined(RTC_TAFCR_TAMP1E)
+ RTCD1.rtc->TAFCR = STM32_RTC_TAMPCR_INIT;
+#else
RTCD1.rtc->TAMPCR = STM32_RTC_TAMPCR_INIT;
+#endif
RTCD1.rtc->ISR = RTC_ISR_INIT; /* Clearing all but RTC_ISR_INIT. */
RTCD1.rtc->PRER = STM32_RTC_PRER_BITS;
RTCD1.rtc->PRER = STM32_RTC_PRER_BITS;
diff --git a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h index 3badc3d1d..e538a6480 100644 --- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h +++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.h @@ -51,7 +51,7 @@ /**
* @brief Presence of a local persistent storage.
*/
-#define RTC_HAS_STORAGE TRUE
+#define RTC_HAS_STORAGE (STM32_RTC_STORAGE_SIZE > 0)
/** @} */
/**
@@ -120,6 +120,7 @@ * @brief RTC TAMPCR register initialization value.
* @note Use this value to initialize features not directly handled by
* the RTC driver.
+ * @note On F0 devices this values goes in the similar TAFCR register.
*/
#if !defined(STM32_RTC_TAMPCR_INIT) || defined(__DOXYGEN__)
#define STM32_RTC_TAMPCR_INIT 0
|