summaryrefslogtreecommitdiff
path: root/src/include/rtc.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-06-10 20:58:24 -0600
committerMartin Roth <martinroth@google.com>2016-06-24 20:22:05 +0200
commit2cf99e1655ea2f10bcd5a0f494bbad4db4d46bee (patch)
treeccf4150f9b9861f041f4c68aaf6c67323a093629 /src/include/rtc.h
parent9482cf6c0956f2184c499a125348b09365fcc593 (diff)
lib: Add real-time-clock functions
Add functions to convert between seconds and a struct rtc_time. Also add a function that can display the time on the console. BUG=chrome-os-partner:52220 BRANCH=none TEST=(partial) with future commits and after setting RTC on the EC: boot on gru into linux shell, check firmware log: localhost ~ # grep Date: /sys/firmware/log Date: 2016-06-20 (Monday) Time: 18:01:44 Then reboot ~10 seconds and check again: localhost ~ # grep Date: /sys/firmware/log Date: 2016-06-20 (Monday) Time: 18:01:54 Change-Id: Id148ccb7a18a05865b903307358666ff6c7b4a3d Signed-off-by: Martin Roth <martinroth@chromium.org> Original-Commit-Id: 3b02dbcd7d9023ce0acabebcf904e70007428d27 Original-Change-Id: I344c385e2e4cb995d3a374025c205f01c38b660d Original-Signed-off-by: Simon Glass <sjg@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/351782 Original-Commit-Ready: Vadim Bendebury <vbendeb@chromium.org> Original-Tested-by: Vadim Bendebury <vbendeb@chromium.org> Original-Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://review.coreboot.org/15301 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/include/rtc.h')
-rw-r--r--src/include/rtc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/include/rtc.h b/src/include/rtc.h
index 53e03c1b79..e654785769 100644
--- a/src/include/rtc.h
+++ b/src/include/rtc.h
@@ -27,7 +27,13 @@ struct rtc_time
int wday;
};
+/* Implemented by the RTC driver (there can be only one) */
int rtc_set(const struct rtc_time *time);
int rtc_get(struct rtc_time *time);
+/* Common functions */
+int rtc_to_tm(int tim, struct rtc_time *tm);
+unsigned long rtc_mktime(const struct rtc_time *tm);
+void rtc_display(const struct rtc_time *tm);
+
#endif /* _RTC_H_ */