diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2006-08-30 08:22:29 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2006-08-30 08:22:29 +0000 |
commit | a7131c13a8999d0085f283ffbe6b4eacd11169f5 (patch) | |
tree | f70cf1efb6ce16ba7d11de09171a92167ec72af9 | |
parent | 9830ab592bd1f905f4e9eeb85d92a1e7e36d9c5d (diff) | |
download | rockbox-a7131c13a8999d0085f283ffbe6b4eacd11169f5.tar.gz rockbox-a7131c13a8999d0085f283ffbe6b4eacd11169f5.zip |
RTC driver for H10 by Laurent Baum
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10799 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/SOURCES | 3 | ||||
-rw-r--r-- | firmware/drivers/rtc.c | 48 | ||||
-rw-r--r-- | firmware/export/config-h10.h | 2 | ||||
-rw-r--r-- | firmware/export/config-h10_5gb.h | 2 |
4 files changed, 49 insertions, 6 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index bd5634768d..29e8ad8271 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -157,7 +157,8 @@ eeprom_settings.c #ifdef IPOD_ARCH drivers/pcf50605.c #endif -#if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) || (CONFIG_RTC == RTC_PCF50605) +#if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) \ + || (CONFIG_RTC == RTC_PCF50605) || (CONFIG_RTC == RTC_E8564) drivers/rtc.c #endif drivers/serial.c diff --git a/firmware/drivers/rtc.c b/firmware/drivers/rtc.c index 6015f46026..c911dabbb1 100644 --- a/firmware/drivers/rtc.c +++ b/firmware/drivers/rtc.c @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese + * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. @@ -24,13 +24,55 @@ #include "system.h" #include "pcf50606.h" #include "pcf50605.h" -#include <stdbool.h> +#if CONFIG_RTC == RTC_E8564 +#include "i2c-pp5020.h" +#endif /*CONFIG_RTC == RTC_E8564*/ +#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_PCF50605 +#if CONFIG_RTC == RTC_E8564 +void rtc_init(void) +{ +} + +int rtc_read_datetime(unsigned char* buf) +{ + unsigned char tmp; + int read; + + /*RTC_E8564's slave address is 0x51*/ + read = i2c_readbytes(0x51,0x02,7,buf); + + /* swap wday and mday to be compatible with + * get_time() from firmware/common/timefuncs.c */ + tmp=buf[3]; + buf[3]=buf[4]; + buf[4]=tmp; + + return read; +} + +int rtc_write_datetime(unsigned char* buf) +{ + int i; + unsigned char tmp; + + /* swap wday and mday to be compatible with + * set_time() in firmware/common/timefuncs.c */ + tmp=buf[3]; + buf[3]=buf[4]; + buf[4]=tmp; + + for (i=0;i<7;i++){ + ipod_i2c_send(0x51, 0x02+i,buf[i]); + } + return 1; +} + +#elif CONFIG_RTC == RTC_PCF50605 void rtc_init(void) { } diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index c3cf7eda5f..cfa7f6bb46 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h @@ -37,7 +37,7 @@ /* define this if you have a real-time clock */ #ifndef BOOTLOADER -/*#define CONFIG_RTC RTC_E8564*/ /* TODO: figure this out */ +#define CONFIG_RTC RTC_E8564 #endif /* Define this if you have a software controlled poweroff */ diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index 40f8c26621..d3750c1a08 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h @@ -38,7 +38,7 @@ /* define this if you have a real-time clock */ #ifndef BOOTLOADER -/*#define CONFIG_RTC RTC_E8564*/ /* TODO: figure this out */ +#define CONFIG_RTC RTC_E8564 #endif /* Define this if you have a software controlled poweroff */ |