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 30*885fc78cSAlbin Tonnerre /* bcd<->bin functions are needed by almost all the RTC drivers, let's include 31*885fc78cSAlbin Tonnerre * it there instead of in evey single driver */ 32*885fc78cSAlbin Tonnerre 33*885fc78cSAlbin Tonnerre #include <bcd.h> 34*885fc78cSAlbin Tonnerre 35a6840a6eSwdenk /* 36a6840a6eSwdenk * The struct used to pass data from the generic interface code to 37a6840a6eSwdenk * the hardware dependend low-level code ande vice versa. Identical 38a6840a6eSwdenk * to struct rtc_time used by the Linux kernel. 39a6840a6eSwdenk * 40a6840a6eSwdenk * Note that there are small but significant differences to the 41a6840a6eSwdenk * common "struct time": 42a6840a6eSwdenk * 43a6840a6eSwdenk * struct time: struct rtc_time: 44a6840a6eSwdenk * tm_mon 0 ... 11 1 ... 12 45a6840a6eSwdenk * tm_year years since 1900 years since 0 46a6840a6eSwdenk */ 47a6840a6eSwdenk 48a6840a6eSwdenk struct rtc_time { 49a6840a6eSwdenk int tm_sec; 50a6840a6eSwdenk int tm_min; 51a6840a6eSwdenk int tm_hour; 52a6840a6eSwdenk int tm_mday; 53a6840a6eSwdenk int tm_mon; 54a6840a6eSwdenk int tm_year; 55a6840a6eSwdenk int tm_wday; 56a6840a6eSwdenk int tm_yday; 57a6840a6eSwdenk int tm_isdst; 58a6840a6eSwdenk }; 59a6840a6eSwdenk 60b73a19e1SYuri Tikhonov int rtc_get (struct rtc_time *); 61d1e23194SJean-Christophe PLAGNIOL-VILLARD int rtc_set (struct rtc_time *); 62a6840a6eSwdenk void rtc_reset (void); 63a6840a6eSwdenk 64a6840a6eSwdenk void GregorianDay (struct rtc_time *); 65a6840a6eSwdenk void to_tm (int, struct rtc_time *); 66a6840a6eSwdenk unsigned long mktime (unsigned int, unsigned int, unsigned int, 67a6840a6eSwdenk unsigned int, unsigned int, unsigned int); 68a6840a6eSwdenk 69a6840a6eSwdenk #endif /* _RTC_H_ */ 70