diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2006-11-27 09:44:56 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2006-11-27 09:44:56 +0000 |
commit | a45e632495a0b662474771737197658ef22d73f0 (patch) | |
tree | faa6588b0e55cba4ea7ff8a58813d75581c563e1 /firmware/drivers/rtc/rtc_e8564.c | |
parent | 860e387758bbebef04a6fde206decb7f31e45654 (diff) | |
download | rockbox-a45e632495a0b662474771737197658ef22d73f0.tar.gz rockbox-a45e632495a0b662474771737197658ef22d73f0.zip |
move rtc functions to seperate files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11614 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/rtc/rtc_e8564.c')
-rw-r--r-- | firmware/drivers/rtc/rtc_e8564.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/firmware/drivers/rtc/rtc_e8564.c b/firmware/drivers/rtc/rtc_e8564.c new file mode 100644 index 0000000000..233168c303 --- /dev/null +++ b/firmware/drivers/rtc/rtc_e8564.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "i2c.h" | ||
21 | #include "rtc.h" | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | #include "i2c-pp5020.h" | ||
25 | #include <stdbool.h> | ||
26 | |||
27 | void rtc_init(void) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | int rtc_read_datetime(unsigned char* buf) | ||
32 | { | ||
33 | unsigned char tmp; | ||
34 | int read; | ||
35 | |||
36 | /*RTC_E8564's slave address is 0x51*/ | ||
37 | read = i2c_readbytes(0x51,0x02,7,buf); | ||
38 | |||
39 | /* swap wday and mday to be compatible with | ||
40 | * get_time() from firmware/common/timefuncs.c */ | ||
41 | tmp=buf[3]; | ||
42 | buf[3]=buf[4]; | ||
43 | buf[4]=tmp; | ||
44 | |||
45 | return read; | ||
46 | } | ||
47 | |||
48 | int rtc_write_datetime(unsigned char* buf) | ||
49 | { | ||
50 | int i; | ||
51 | unsigned char tmp; | ||
52 | |||
53 | /* swap wday and mday to be compatible with | ||
54 | * set_time() in firmware/common/timefuncs.c */ | ||
55 | tmp=buf[3]; | ||
56 | buf[3]=buf[4]; | ||
57 | buf[4]=tmp; | ||
58 | |||
59 | for (i=0;i<7;i++){ | ||
60 | pp_i2c_send(0x51, 0x02+i,buf[i]); | ||
61 | } | ||
62 | return 1; | ||
63 | } | ||
64 | |||