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