1a6840a6eSwdenk /* 2a6840a6eSwdenk * (C) Copyright 2001 3a6840a6eSwdenk * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4a6840a6eSwdenk * 5*1a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 6a6840a6eSwdenk */ 7a6840a6eSwdenk 8a6840a6eSwdenk /* 9a6840a6eSwdenk * Generic RTC interface. 10a6840a6eSwdenk */ 11a6840a6eSwdenk #ifndef _RTC_H_ 12a6840a6eSwdenk #define _RTC_H_ 13a6840a6eSwdenk 14885fc78cSAlbin Tonnerre /* bcd<->bin functions are needed by almost all the RTC drivers, let's include 15885fc78cSAlbin Tonnerre * it there instead of in evey single driver */ 16885fc78cSAlbin Tonnerre 17885fc78cSAlbin Tonnerre #include <bcd.h> 18885fc78cSAlbin Tonnerre 19a6840a6eSwdenk /* 20a6840a6eSwdenk * The struct used to pass data from the generic interface code to 21a6840a6eSwdenk * the hardware dependend low-level code ande vice versa. Identical 22a6840a6eSwdenk * to struct rtc_time used by the Linux kernel. 23a6840a6eSwdenk * 24a6840a6eSwdenk * Note that there are small but significant differences to the 25a6840a6eSwdenk * common "struct time": 26a6840a6eSwdenk * 27a6840a6eSwdenk * struct time: struct rtc_time: 28a6840a6eSwdenk * tm_mon 0 ... 11 1 ... 12 29a6840a6eSwdenk * tm_year years since 1900 years since 0 30a6840a6eSwdenk */ 31a6840a6eSwdenk 32a6840a6eSwdenk struct rtc_time { 33a6840a6eSwdenk int tm_sec; 34a6840a6eSwdenk int tm_min; 35a6840a6eSwdenk int tm_hour; 36a6840a6eSwdenk int tm_mday; 37a6840a6eSwdenk int tm_mon; 38a6840a6eSwdenk int tm_year; 39a6840a6eSwdenk int tm_wday; 40a6840a6eSwdenk int tm_yday; 41a6840a6eSwdenk int tm_isdst; 42a6840a6eSwdenk }; 43a6840a6eSwdenk 44b73a19e1SYuri Tikhonov int rtc_get (struct rtc_time *); 45d1e23194SJean-Christophe PLAGNIOL-VILLARD int rtc_set (struct rtc_time *); 46a6840a6eSwdenk void rtc_reset (void); 47a6840a6eSwdenk 48a6840a6eSwdenk void GregorianDay (struct rtc_time *); 49a6840a6eSwdenk void to_tm (int, struct rtc_time *); 50a6840a6eSwdenk unsigned long mktime (unsigned int, unsigned int, unsigned int, 51a6840a6eSwdenk unsigned int, unsigned int, unsigned int); 52a6840a6eSwdenk 53a6840a6eSwdenk #endif /* _RTC_H_ */ 54