aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/RTCv2
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-11-25 15:38:15 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-11-25 15:38:15 +0000
commitc8700fc5eeeeb71fce78f169b49ffd62c4748414 (patch)
treec5681941285eb87983c919c7c4a1ad677cce78a1 /os/hal/ports/STM32/LLD/RTCv2
parentf24c09b778d1103a345cb94b2d57c3e76fb5a681 (diff)
downloadChibiOS-c8700fc5eeeeb71fce78f169b49ffd62c4748414.tar.gz
ChibiOS-c8700fc5eeeeb71fce78f169b49ffd62c4748414.tar.bz2
ChibiOS-c8700fc5eeeeb71fce78f169b49ffd62c4748414.zip
RTC update for L0.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12441 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/LLD/RTCv2')
-rw-r--r--os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c30
1 files changed, 28 insertions, 2 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 66bde797a..a5861119c 100644
--- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
+++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
@@ -305,7 +305,7 @@ OSAL_IRQ_HANDLER(STM32_RTC_COMMON_HANDLER) {
if (RTCD1.callback != NULL) {
uint32_t cr = RTCD1.rtc->CR;
- uint32_t tafcr = RTCD1.rtc->TAFCR;
+ uint32_t tcr;
#if defined(RTC_ISR_WUTF)
if (((cr & RTC_CR_WUTIE) != 0U) && ((isr & RTC_ISR_WUTF) != 0U)) {
@@ -333,7 +333,11 @@ OSAL_IRQ_HANDLER(STM32_RTC_COMMON_HANDLER) {
}
}
- if ((tafcr & RTC_TAFCR_TAMPIE) != 0U) {
+ /* This part is different depending on if the RTC has a TAMPCR or TAFCR
+ register.*/
+#if defined(RTC_TAFCR_TAMP1E)
+ tcr = RTCD1.rtc->TAFCR;
+ if ((tcr & RTC_TAFCR_TAMPIE) != 0U) {
#if defined(RTC_ISR_TAMP1F)
if ((isr & RTC_ISR_TAMP1F) != 0U) {
RTCD1.callback(&RTCD1, RTC_EVENT_TAMP1);
@@ -345,6 +349,28 @@ OSAL_IRQ_HANDLER(STM32_RTC_COMMON_HANDLER) {
}
#endif
}
+
+#else /* !defined(RTC_TAFCR_TAMP1E) */
+ tcr = RTCD1.rtc->TAMPCR;
+#if defined(RTC_ISR_TAMP1F)
+ if (((tcr & RTC_TAMPCR_TAMP1IE) != 0U) &&
+ ((isr & RTC_ISR_TAMP1F) != 0U)) {
+ RTCD1.callback(&RTCD1, RTC_EVENT_TAMP1);
+ }
+#endif
+#if defined(RTC_ISR_TAMP2F)
+ if (((tcr & RTC_TAMPCR_TAMP2IE) != 0U) &&
+ ((isr & RTC_ISR_TAMP2F) != 0U)) {
+ RTCD1.callback(&RTCD1, RTC_EVENT_TAMP2);
+ }
+#endif
+#if defined(RTC_ISR_TAMP3F)
+ if (((tcr & RTC_TAMPCR_TAMP3IE) != 0U) &&
+ ((isr & RTC_ISR_TAMP3F) != 0U)) {
+ RTCD1.callback(&RTCD1, RTC_EVENT_TAMP3);
+ }
+#endif
+#endif /* !defined(RTC_TAFCR_TAMP1E) */
}
OSAL_IRQ_EPILOGUE();