From 2cf99e1655ea2f10bcd5a0f494bbad4db4d46bee Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 10 Jun 2016 20:58:24 -0600 Subject: 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 Original-Commit-Id: 3b02dbcd7d9023ce0acabebcf904e70007428d27 Original-Change-Id: I344c385e2e4cb995d3a374025c205f01c38b660d Original-Signed-off-by: Simon Glass Original-Reviewed-on: https://chromium-review.googlesource.com/351782 Original-Commit-Ready: Vadim Bendebury Original-Tested-by: Vadim Bendebury Original-Reviewed-by: Vadim Bendebury Reviewed-on: https://review.coreboot.org/15301 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/include/rtc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/include/rtc.h') diff --git a/src/include/rtc.h b/src/include/rtc.h index 53e03c1b7964..e6547857697e 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_ */ -- cgit v1.2.3