summaryrefslogtreecommitdiff
path: root/firmware/drivers/rtc.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-12-22 23:48:32 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-12-22 23:48:32 +0000
commite57471a1bed393c1ab8c8560134b2818b4b96ffd (patch)
treee9845478dfb8752194fc03fd725197ac2c6fdf4d /firmware/drivers/rtc.c
parent0dac8b77b8214f3f2b4a082e9d512b2352459742 (diff)
H300: RTC support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8284 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/rtc.c')
-rw-r--r--firmware/drivers/rtc.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/firmware/drivers/rtc.c b/firmware/drivers/rtc.c
index b77db8b865..0e6d68eb1a 100644
--- a/firmware/drivers/rtc.c
+++ b/firmware/drivers/rtc.c
@@ -21,12 +21,41 @@
#include "i2c.h"
#include "rtc.h"
#include "kernel.h"
+#include "system.h"
+#include "pcf50606.h"
#include <stdbool.h>
#define RTC_ADR 0xd0
#define RTC_DEV_WRITE (RTC_ADR | 0x00)
#define RTC_DEV_READ (RTC_ADR | 0x01)
+#if CONFIG_RTC == RTC_PCF50606
+void rtc_init(void)
+{
+}
+int rtc_read_datetime(unsigned char* buf) {
+ int rc;
+ int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
+
+ rc = pcf50606_read_multiple(0x0a, buf, 7);
+
+ set_irq_level(oldlevel);
+
+ return rc;
+}
+
+int rtc_write_datetime(unsigned char* buf) {
+ int rc;
+ int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
+
+ rc = pcf50606_write_multiple(0x0a, buf, 7);
+
+ set_irq_level(oldlevel);
+
+ return rc;
+}
+
+#else
void rtc_init(void)
{
unsigned char data;
@@ -278,5 +307,6 @@ int rtc_write_datetime(unsigned char* buf) {
return rc;
}
+#endif /* CONFIG_RTC == RTC_PCF50606 */
#endif /* CONFIG_RTC */