diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-12-22 23:48:32 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-12-22 23:48:32 +0000 |
commit | e57471a1bed393c1ab8c8560134b2818b4b96ffd (patch) | |
tree | e9845478dfb8752194fc03fd725197ac2c6fdf4d /firmware | |
parent | 0dac8b77b8214f3f2b4a082e9d512b2352459742 (diff) |
H300: RTC support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8284 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/drivers/rtc.c | 30 | ||||
-rw-r--r-- | firmware/export/config-h300.h | 3 |
3 files changed, 34 insertions, 1 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index ce5ec7f803..7f07598273 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -105,7 +105,7 @@ drivers/pcf50606.c #if defined(APPLE_IPODCOLOR) || defined(APPLE_IPODNANO) || defined(APPLE_IPODVIDEO) drivers/pcf50605.c #endif -#if CONFIG_RTC == RTC_M41ST84W +#if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) drivers/rtc.c #endif drivers/serial.c 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 */ diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 54a2ef543f..2698d12098 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -30,6 +30,9 @@ /* Define this if you do software codec */ #define CONFIG_CODEC SWCODEC +/* define this if you have a real-time clock */ +#define CONFIG_RTC RTC_PCF50606 + /* Define this if you have an remote lcd */ #define HAVE_REMOTE_LCD |