summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s5l8700/ipodnano2g
diff options
context:
space:
mode:
authorMichael Sparmann <theseven@rockbox.org>2009-10-05 20:54:37 +0000
committerMichael Sparmann <theseven@rockbox.org>2009-10-05 20:54:37 +0000
commit5abd9686f47c4e890677b4c9cb0d8f750642b5da (patch)
tree64081d2d611c2f60407d1eeffa3dea5ecee5cd36 /firmware/target/arm/s5l8700/ipodnano2g
parent0f305827bf748daa7e3e38d96a9d4565c5fff2c2 (diff)
downloadrockbox-5abd9686f47c4e890677b4c9cb0d8f750642b5da.tar.gz
rockbox-5abd9686f47c4e890677b4c9cb0d8f750642b5da.zip
Encoding fixes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22970 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/s5l8700/ipodnano2g')
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/pmu-target.h2
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c146
2 files changed, 74 insertions, 74 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/pmu-target.h b/firmware/target/arm/s5l8700/ipodnano2g/pmu-target.h
index 608a22a8eb..7ddfc631fc 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/pmu-target.h
+++ b/firmware/target/arm/s5l8700/ipodnano2g/pmu-target.h
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright © 2009 Michael Sparmann 10 * Copyright © 2009 Michael Sparmann
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c
index f0975efb9f..01d64f1c54 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c
@@ -1,73 +1,73 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum 10 * Copyright (C) 2002 by Linus Nielsen Feltzing, Uwe Freese, Laurent Baum
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version. 15 * of the License, or (at your option) any later version.
16 * 16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "config.h" 21#include "config.h"
22#include "rtc.h" 22#include "rtc.h"
23#include "kernel.h" 23#include "kernel.h"
24#include "system.h" 24#include "system.h"
25#include "pmu-target.h" 25#include "pmu-target.h"
26 26
27void rtc_init(void) 27void rtc_init(void)
28{ 28{
29} 29}
30 30
31int rtc_read_datetime(struct tm *tm) 31int rtc_read_datetime(struct tm *tm)
32{ 32{
33 unsigned int i; 33 unsigned int i;
34 unsigned char buf[7]; 34 unsigned char buf[7];
35 35
36 pmu_read_multiple(0x59, sizeof(buf), buf); 36 pmu_read_multiple(0x59, sizeof(buf), buf);
37 37
38 for (i = 0; i < sizeof(buf); i++) 38 for (i = 0; i < sizeof(buf); i++)
39 buf[i] = BCD2DEC(buf[i]); 39 buf[i] = BCD2DEC(buf[i]);
40 40
41 tm->tm_sec = buf[0]; 41 tm->tm_sec = buf[0];
42 tm->tm_min = buf[1]; 42 tm->tm_min = buf[1];
43 tm->tm_hour = buf[2]; 43 tm->tm_hour = buf[2];
44 tm->tm_wday = buf[3]; 44 tm->tm_wday = buf[3];
45 tm->tm_mday = buf[4]; 45 tm->tm_mday = buf[4];
46 tm->tm_mon = buf[5] - 1; 46 tm->tm_mon = buf[5] - 1;
47 tm->tm_year = buf[6] + 100; 47 tm->tm_year = buf[6] + 100;
48 48
49 return 0; 49 return 0;
50} 50}
51 51
52int rtc_write_datetime(const struct tm *tm) 52int rtc_write_datetime(const struct tm *tm)
53{ 53{
54 unsigned int i; 54 unsigned int i;
55 int rc, oldlevel; 55 int rc, oldlevel;
56 unsigned char buf[7]; 56 unsigned char buf[7];
57 57
58 buf[0] = tm->tm_sec; 58 buf[0] = tm->tm_sec;
59 buf[1] = tm->tm_min; 59 buf[1] = tm->tm_min;
60 buf[2] = tm->tm_hour; 60 buf[2] = tm->tm_hour;
61 buf[3] = tm->tm_wday; 61 buf[3] = tm->tm_wday;
62 buf[4] = tm->tm_mday; 62 buf[4] = tm->tm_mday;
63 buf[5] = tm->tm_mon + 1; 63 buf[5] = tm->tm_mon + 1;
64 buf[6] = tm->tm_year - 100; 64 buf[6] = tm->tm_year - 100;
65 65
66 for (i = 0; i < sizeof(buf); i++) 66 for (i = 0; i < sizeof(buf); i++)
67 buf[i] = DEC2BCD(buf[i]); 67 buf[i] = DEC2BCD(buf[i]);
68 68
69 pmu_write_multiple(0x59, sizeof(buf), buf); 69 pmu_write_multiple(0x59, sizeof(buf), buf);
70 70
71 return 0; 71 return 0;
72} 72}
73 73