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