4 * http://www.dave-tech.it
5 * http://www.wawnet.biz
6 * mailto:info@wawnet.biz
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * S3C44B0 CPU specific code
33 #include <asm/hardware.h>
37 int rtc_get (struct rtc_time* tm)
40 tm->tm_year = bcd2bin(BCDYEAR);
41 tm->tm_mon = bcd2bin(BCDMON);
42 tm->tm_wday = bcd2bin(BCDDATE);
43 tm->tm_mday = bcd2bin(BCDDAY);
44 tm->tm_hour = bcd2bin(BCDHOUR);
45 tm->tm_min = bcd2bin(BCDMIN);
46 tm->tm_sec = bcd2bin(BCDSEC);
49 /* we have to re-read the rtc data because of the "one second deviation" problem */
50 /* see RTC datasheet for more info about it */
51 tm->tm_year = bcd2bin(BCDYEAR);
52 tm->tm_mon = bcd2bin(BCDMON);
53 tm->tm_mday = bcd2bin(BCDDAY);
54 tm->tm_wday = bcd2bin(BCDDATE);
55 tm->tm_hour = bcd2bin(BCDHOUR);
56 tm->tm_min = bcd2bin(BCDMIN);
57 tm->tm_sec = bcd2bin(BCDSEC);
70 int rtc_set (struct rtc_time* tm)
72 if(tm->tm_year < 2000)
78 BCDYEAR = bin2bcd(tm->tm_year);
79 BCDMON = bin2bcd(tm->tm_mon);
80 BCDDAY = bin2bcd(tm->tm_mday);
81 BCDDATE = bin2bcd(tm->tm_wday);
82 BCDHOUR = bin2bcd(tm->tm_hour);
83 BCDMIN = bin2bcd(tm->tm_min);
84 BCDSEC = bin2bcd(tm->tm_sec);