aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2016-12-20 14:43:33 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2016-12-20 14:43:33 +0000
commitbfbb1a6d9e0b534a18d33246faaef90d81916e71 (patch)
treeb983f25f708239354375e1a008a0272138a1d7f8 /os/hal
parentd7a2c3c56f1c19f9569e6a0c545c1b39b85caf81 (diff)
downloadChibiOS-bfbb1a6d9e0b534a18d33246faaef90d81916e71.tar.gz
ChibiOS-bfbb1a6d9e0b534a18d33246faaef90d81916e71.tar.bz2
ChibiOS-bfbb1a6d9e0b534a18d33246faaef90d81916e71.zip
Fixed bug #799.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9974 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c13
1 files changed, 10 insertions, 3 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 824daa9e7..6d44570f1 100644
--- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
+++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c
@@ -50,6 +50,8 @@
#define RTC_DR_DT_OFFSET 4
#define RTC_DR_DU_OFFSET 0
+#define RTC_CR_BKP_OFFSET 18
+
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
@@ -343,8 +345,9 @@ void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) {
/* Writing the registers.*/
rtc_enter_init();
- rtcp->rtc->TR = tr;
- rtcp->rtc->DR = dr;
+ rtcp->rtc->TR = tr;
+ rtcp->rtc->DR = dr;
+ rtcp->rtc->CR |= timespec->dstflag << RTC_CR_BKP_OFFSET;
rtc_exit_init();
/* Leaving a reentrant critical zone.*/
@@ -361,7 +364,7 @@ void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) {
* @notapi
*/
void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec) {
- uint32_t dr, tr;
+ uint32_t dr, tr, cr;
uint32_t subs;
#if STM32_RTC_HAS_SUBSECONDS
uint32_t ssr;
@@ -380,6 +383,7 @@ void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec) {
#endif /* STM32_RTC_HAS_SUBSECONDS */
tr = rtcp->rtc->TR;
dr = rtcp->rtc->DR;
+ cr = rtcp->rtc->CR;
rtcp->rtc->ISR &= ~RTC_ISR_RSF;
/* Leaving a reentrant critical zone.*/
@@ -400,6 +404,9 @@ void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec) {
/* Decoding date, this concludes the atomic read sequence.*/
rtc_decode_date(dr, timespec);
+
+ /* Retrieving the DST bit.*/
+ timespec->dstflag = (cr >> RTC_CR_BKP_OFFSET) & 1;
}
#if (RTC_ALARMS > 0) || defined(__DOXYGEN__)