summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-08-30 08:22:29 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-08-30 08:22:29 +0000
commita7131c13a8999d0085f283ffbe6b4eacd11169f5 (patch)
treef70cf1efb6ce16ba7d11de09171a92167ec72af9
parent9830ab592bd1f905f4e9eeb85d92a1e7e36d9c5d (diff)
downloadrockbox-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/SOURCES3
-rw-r--r--firmware/drivers/rtc.c48
-rw-r--r--firmware/export/config-h10.h2
-rw-r--r--firmware/export/config-h10_5gb.h2
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
157#ifdef IPOD_ARCH 157#ifdef IPOD_ARCH
158drivers/pcf50605.c 158drivers/pcf50605.c
159#endif 159#endif
160#if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) || (CONFIG_RTC == RTC_PCF50605) 160#if (CONFIG_RTC == RTC_M41ST84W) || (CONFIG_RTC == RTC_PCF50606) \
161 || (CONFIG_RTC == RTC_PCF50605) || (CONFIG_RTC == RTC_E8564)
161drivers/rtc.c 162drivers/rtc.c
162#endif 163#endif
163drivers/serial.c 164drivers/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 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese 10 * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -24,13 +24,55 @@
24#include "system.h" 24#include "system.h"
25#include "pcf50606.h" 25#include "pcf50606.h"
26#include "pcf50605.h" 26#include "pcf50605.h"
27#include <stdbool.h> 27#if CONFIG_RTC == RTC_E8564
28#include "i2c-pp5020.h"
29#endif /*CONFIG_RTC == RTC_E8564*/
30#include <stdbool.h>
28 31
29#define RTC_ADR 0xd0 32#define RTC_ADR 0xd0
30#define RTC_DEV_WRITE (RTC_ADR | 0x00) 33#define RTC_DEV_WRITE (RTC_ADR | 0x00)
31#define RTC_DEV_READ (RTC_ADR | 0x01) 34#define RTC_DEV_READ (RTC_ADR | 0x01)
32 35
33#if CONFIG_RTC == RTC_PCF50605 36#if CONFIG_RTC == RTC_E8564
37void rtc_init(void)
38{
39}
40
41int rtc_read_datetime(unsigned char* buf)
42{
43 unsigned char tmp;
44 int read;
45
46 /*RTC_E8564's slave address is 0x51*/
47 read = i2c_readbytes(0x51,0x02,7,buf);
48
49 /* swap wday and mday to be compatible with
50 * get_time() from firmware/common/timefuncs.c */
51 tmp=buf[3];
52 buf[3]=buf[4];
53 buf[4]=tmp;
54
55 return read;
56}
57
58int rtc_write_datetime(unsigned char* buf)
59{
60 int i;
61 unsigned char tmp;
62
63 /* swap wday and mday to be compatible with
64 * set_time() in firmware/common/timefuncs.c */
65 tmp=buf[3];
66 buf[3]=buf[4];
67 buf[4]=tmp;
68
69 for (i=0;i<7;i++){
70 ipod_i2c_send(0x51, 0x02+i,buf[i]);
71 }
72 return 1;
73}
74
75#elif CONFIG_RTC == RTC_PCF50605
34void rtc_init(void) 76void rtc_init(void)
35{ 77{
36} 78}
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 @@
37 37
38/* define this if you have a real-time clock */ 38/* define this if you have a real-time clock */
39#ifndef BOOTLOADER 39#ifndef BOOTLOADER
40/*#define CONFIG_RTC RTC_E8564*/ /* TODO: figure this out */ 40#define CONFIG_RTC RTC_E8564
41#endif 41#endif
42 42
43/* Define this if you have a software controlled poweroff */ 43/* 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 @@
38 38
39/* define this if you have a real-time clock */ 39/* define this if you have a real-time clock */
40#ifndef BOOTLOADER 40#ifndef BOOTLOADER
41/*#define CONFIG_RTC RTC_E8564*/ /* TODO: figure this out */ 41#define CONFIG_RTC RTC_E8564
42#endif 42#endif
43 43
44/* Define this if you have a software controlled poweroff */ 44/* Define this if you have a software controlled poweroff */