summaryrefslogtreecommitdiff
path: root/firmware/drivers/rtc/rtc_s3c2440.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-01-25 19:32:15 -0500
committerMichael Sevakis <jethead71@rockbox.org>2017-01-26 23:07:49 -0500
commit58b849c451ac1281c14bfc535ab7f411a0b736e0 (patch)
tree035026a62581900f72fa0d90bd694a8a92372c00 /firmware/drivers/rtc/rtc_s3c2440.c
parent783c77531c35e62dd754c510c4f2beefe6df4a9d (diff)
downloadrockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.tar.gz
rockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.zip
Move intrinsic RTC implmentation differences to driver files
Some drivers set tm_wday just fine and do not need it coerced to be correct. Others set tm_yday, so don't overwrite what the driver sets; just zero it inside if it can't fill the field. Move calls to set_day_of_week() to the sorts of drivers that presumably required the hammer (FS#11814) in get_time() where the weekday isn't locked to the date. Change-Id: Idd0ded6bfc9d9f48fcc1a6074068164c42fcf24a
Diffstat (limited to 'firmware/drivers/rtc/rtc_s3c2440.c')
-rw-r--r--firmware/drivers/rtc/rtc_s3c2440.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/drivers/rtc/rtc_s3c2440.c b/firmware/drivers/rtc/rtc_s3c2440.c
index a8787e3f8f..6cd34f0e23 100644
--- a/firmware/drivers/rtc/rtc_s3c2440.c
+++ b/firmware/drivers/rtc/rtc_s3c2440.c
@@ -23,6 +23,7 @@
23#include "rtc.h" 23#include "rtc.h"
24#include "kernel.h" 24#include "kernel.h"
25#include "system.h" 25#include "system.h"
26#include "timefuncs.h"
26 27
27void rtc_init(void) 28void rtc_init(void)
28{ 29{
@@ -35,10 +36,12 @@ int rtc_read_datetime(struct tm *tm)
35 tm->tm_sec = BCD2DEC(BCDSEC); 36 tm->tm_sec = BCD2DEC(BCDSEC);
36 tm->tm_min = BCD2DEC(BCDMIN); 37 tm->tm_min = BCD2DEC(BCDMIN);
37 tm->tm_hour = BCD2DEC(BCDHOUR); 38 tm->tm_hour = BCD2DEC(BCDHOUR);
38 tm->tm_wday = BCD2DEC(BCDDAY) - 1; /* timefuncs wants 0..6 for wday */
39 tm->tm_mday = BCD2DEC(BCDDATE); 39 tm->tm_mday = BCD2DEC(BCDDATE);
40 tm->tm_mon = BCD2DEC(BCDMON) - 1; 40 tm->tm_mon = BCD2DEC(BCDMON) - 1;
41 tm->tm_year = BCD2DEC(BCDYEAR) + 100; 41 tm->tm_year = BCD2DEC(BCDYEAR) + 100;
42 tm->tm_yday = 0; /* Not implemented for now */
43
44 set_day_of_week(tm);
42 45
43 return 1; 46 return 1;
44} 47}