From e57471a1bed393c1ab8c8560134b2818b4b96ffd Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 22 Dec 2005 23:48:32 +0000 Subject: H300: RTC support git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8284 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/rtc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'firmware/drivers') 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 #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 */ -- cgit v1.2.3