diff options
author | Cástor Muñoz <cmvidal@gmail.com> | 2017-03-03 22:46:57 +0100 |
---|---|---|
committer | Cástor Muñoz <cmvidal@gmail.com> | 2017-03-03 22:50:38 +0100 |
commit | 1ba5ef716d37a9fe7f0863caed2fab8570b2c7c4 (patch) | |
tree | 2e209052bc802183b73a705f77ebc552250c9353 /firmware/target/arm/s5l8702/ipod6g/rtc-6g.c | |
parent | 8ff1b6b6033aad55fadf076f066da5d8b7d2e631 (diff) | |
download | rockbox-1ba5ef716d37a9fe7f0863caed2fab8570b2c7c4.tar.gz rockbox-1ba5ef716d37a9fe7f0863caed2fab8570b2c7c4.zip |
ipod6g: rename some target files
As preparation to add new targets to the s5l8702 directory,
rename files as:
s5l8702/ipod6g/*-ipod6g.c -> s5l8702/ipod6g/*-6g.c
Change-Id: I0cd03d6bcf39b2aa198235f9014cb6948bbafcd5
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/rtc-6g.c')
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/rtc-6g.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/rtc-6g.c b/firmware/target/arm/s5l8702/ipod6g/rtc-6g.c new file mode 100644 index 0000000000..384cded758 --- /dev/null +++ b/firmware/target/arm/s5l8702/ipod6g/rtc-6g.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: rtc-nano2g.c 23114 2009-10-11 18:20:56Z theseven $ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | #include "rtc.h" | ||
23 | #include "kernel.h" | ||
24 | #include "system.h" | ||
25 | #include "pmu-target.h" | ||
26 | #include "timefuncs.h" | ||
27 | |||
28 | void rtc_init(void) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | int rtc_read_datetime(struct tm *tm) | ||
33 | { | ||
34 | unsigned int i; | ||
35 | unsigned char buf[7]; | ||
36 | |||
37 | pmu_read_rtc(buf); | ||
38 | |||
39 | for (i = 0; i < sizeof(buf); i++) | ||
40 | buf[i] = BCD2DEC(buf[i]); | ||
41 | |||
42 | tm->tm_sec = buf[0]; | ||
43 | tm->tm_min = buf[1]; | ||
44 | tm->tm_hour = buf[2]; | ||
45 | tm->tm_mday = buf[4]; | ||
46 | tm->tm_mon = buf[5] - 1; | ||
47 | tm->tm_year = buf[6] + 100; | ||
48 | tm->tm_yday = 0; /* Not implemented for now */ | ||
49 | |||
50 | set_day_of_week(tm); | ||
51 | |||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | int rtc_write_datetime(const struct tm *tm) | ||
56 | { | ||
57 | unsigned int i; | ||
58 | unsigned char buf[7]; | ||
59 | |||
60 | buf[0] = tm->tm_sec; | ||
61 | buf[1] = tm->tm_min; | ||
62 | buf[2] = tm->tm_hour; | ||
63 | buf[3] = tm->tm_wday; | ||
64 | buf[4] = tm->tm_mday; | ||
65 | buf[5] = tm->tm_mon + 1; | ||
66 | buf[6] = tm->tm_year - 100; | ||
67 | |||
68 | for (i = 0; i < sizeof(buf); i++) | ||
69 | buf[i] = DEC2BCD(buf[i]); | ||
70 | |||
71 | pmu_write_rtc(buf); | ||
72 | |||
73 | return 0; | ||
74 | } | ||
75 | |||