blob: 019c2ebb5181b4c67ac9276a89a596738527ff51 [file] [log] [blame]
wdenka6840a62001-04-09 21:43:07 +00001/*
2 * (C) Copyright 2001
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * Generic RTC interface.
26 */
27#ifndef _RTC_H_
28#define _RTC_H_
29
30/*
31 * The struct used to pass data from the generic interface code to
32 * the hardware dependend low-level code ande vice versa. Identical
33 * to struct rtc_time used by the Linux kernel.
34 *
35 * Note that there are small but significant differences to the
36 * common "struct time":
37 *
Wolfgang Denka1be4762008-05-20 16:00:29 +020038 * struct time: struct rtc_time:
wdenka6840a62001-04-09 21:43:07 +000039 * tm_mon 0 ... 11 1 ... 12
40 * tm_year years since 1900 years since 0
41 */
42
43struct rtc_time {
44 int tm_sec;
45 int tm_min;
46 int tm_hour;
47 int tm_mday;
48 int tm_mon;
49 int tm_year;
50 int tm_wday;
51 int tm_yday;
52 int tm_isdst;
53};
54
Yuri Tikhonov9bacd942008-03-20 17:56:04 +030055int rtc_get (struct rtc_time *);
Jean-Christophe PLAGNIOL-VILLARD97a2e102008-09-01 23:06:23 +020056int rtc_set (struct rtc_time *);
wdenka6840a62001-04-09 21:43:07 +000057void rtc_reset (void);
58
59void GregorianDay (struct rtc_time *);
60void to_tm (int, struct rtc_time *);
61unsigned long mktime (unsigned int, unsigned int, unsigned int,
62 unsigned int, unsigned int, unsigned int);
63
Detlev Zundel58d0bff2009-03-30 00:31:33 +020064uchar rtc_read(uchar reg) __attribute__((weak));
65void rtc_write(uchar reg, uchar val) __attribute__((weak));
66
67
wdenka6840a62001-04-09 21:43:07 +000068#endif /* _RTC_H_ */