summaryrefslogtreecommitdiff
path: root/firmware/export/rtc.h
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-09-26 14:58:32 +0000
committerNils Wallménius <nils@rockbox.org>2009-09-26 14:58:32 +0000
commitc8b87d76eb506d374edd2631d4c29e4300be84c4 (patch)
tree5d380f1f32f317afc579798c5fc4d988e9c48122 /firmware/export/rtc.h
parent66d5bd7cf8c10971578c643c16f72b51df4a1ddf (diff)
downloadrockbox-c8b87d76eb506d374edd2631d4c29e4300be84c4.tar.gz
rockbox-c8b87d76eb506d374edd2631d4c29e4300be84c4.zip
FS#10569 RTC driver cleanup
Change the RTC drivers so that the rtc_(read|write)_datetime functions now deal directly with the tm struct instead of passing a string of bcd digits to/from (set|get)_time . This simplifies drivers for rtc's that do not use a bcd representation internally and cleans up some target specific code and #ifdefs in generic code. Implement simple stubs for the sim to avoid #ifdefing for that too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22839 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/rtc.h')
-rw-r--r--firmware/export/rtc.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/firmware/export/rtc.h b/firmware/export/rtc.h
index 6d21b1f37f..57853f28cc 100644
--- a/firmware/export/rtc.h
+++ b/firmware/export/rtc.h
@@ -24,13 +24,19 @@
24#include <stdbool.h> 24#include <stdbool.h>
25#include "system.h" 25#include "system.h"
26#include "config.h" 26#include "config.h"
27#include "time.h"
28
29/* Macros used to convert to and from BCD, used in various rtc drivers
30 this is the wrong place but misc.h is in apps... */
31#define BCD2DEC(X) (((((X)>>4) & 0x0f) * 10) + ((X) & 0xf))
32#define DEC2BCD(X) ((((X)/10)<<4) | ((X)%10))
27 33
28#if CONFIG_RTC 34#if CONFIG_RTC
29 35
30/* Common functions for all targets */ 36/* Common functions for all targets */
31void rtc_init(void); 37void rtc_init(void);
32int rtc_read_datetime(unsigned char* buf); 38int rtc_read_datetime(struct tm *tm);
33int rtc_write_datetime(unsigned char* buf); 39int rtc_write_datetime(const struct tm *tm);
34 40
35#if CONFIG_RTC == RTC_M41ST84W 41#if CONFIG_RTC == RTC_M41ST84W
36 42
@@ -53,3 +59,4 @@ bool rtc_check_alarm_flag(void);
53#endif /* CONFIG_RTC */ 59#endif /* CONFIG_RTC */
54 60
55#endif 61#endif
62