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 /firmware/drivers | |
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
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/rtc.c | 48 |
1 files changed, 45 insertions, 3 deletions
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 | } |