wdenk | a6840a6 | 2001-04-09 21:43:07 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
Albin Tonnerre | dfdea73 | 2009-08-13 15:31:12 +0200 | [diff] [blame] | 30 | /* bcd<->bin functions are needed by almost all the RTC drivers, let's include |
| 31 | * it there instead of in evey single driver */ |
| 32 | |
| 33 | #include <bcd.h> |
| 34 | |
wdenk | a6840a6 | 2001-04-09 21:43:07 +0000 | [diff] [blame] | 35 | /* |
| 36 | * The struct used to pass data from the generic interface code to |
| 37 | * the hardware dependend low-level code ande vice versa. Identical |
| 38 | * to struct rtc_time used by the Linux kernel. |
| 39 | * |
| 40 | * Note that there are small but significant differences to the |
| 41 | * common "struct time": |
| 42 | * |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 43 | * struct time: struct rtc_time: |
wdenk | a6840a6 | 2001-04-09 21:43:07 +0000 | [diff] [blame] | 44 | * tm_mon 0 ... 11 1 ... 12 |
| 45 | * tm_year years since 1900 years since 0 |
| 46 | */ |
| 47 | |
| 48 | struct rtc_time { |
| 49 | int tm_sec; |
| 50 | int tm_min; |
| 51 | int tm_hour; |
| 52 | int tm_mday; |
| 53 | int tm_mon; |
| 54 | int tm_year; |
| 55 | int tm_wday; |
| 56 | int tm_yday; |
| 57 | int tm_isdst; |
| 58 | }; |
| 59 | |
Yuri Tikhonov | 9bacd94 | 2008-03-20 17:56:04 +0300 | [diff] [blame] | 60 | int rtc_get (struct rtc_time *); |
Jean-Christophe PLAGNIOL-VILLARD | 97a2e10 | 2008-09-01 23:06:23 +0200 | [diff] [blame] | 61 | int rtc_set (struct rtc_time *); |
wdenk | a6840a6 | 2001-04-09 21:43:07 +0000 | [diff] [blame] | 62 | void rtc_reset (void); |
| 63 | |
| 64 | void GregorianDay (struct rtc_time *); |
| 65 | void to_tm (int, struct rtc_time *); |
| 66 | unsigned long mktime (unsigned int, unsigned int, unsigned int, |
| 67 | unsigned int, unsigned int, unsigned int); |
| 68 | |
wdenk | a6840a6 | 2001-04-09 21:43:07 +0000 | [diff] [blame] | 69 | #endif /* _RTC_H_ */ |