diff options
-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 | |||
157 | #ifdef IPOD_ARCH | 157 | #ifdef IPOD_ARCH |
158 | drivers/pcf50605.c | 158 | drivers/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) | ||
161 | drivers/rtc.c | 162 | drivers/rtc.c |
162 | #endif | 163 | #endif |
163 | drivers/serial.c | 164 | 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 @@ | |||
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 |
37 | void rtc_init(void) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | int 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 | |||
58 | int 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 | ||
34 | void rtc_init(void) | 76 | void 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 */ |