blob: d11aa8baf91b7370bf40a18f5785522448933386 [file] [log] [blame]
wdenka6840a62001-04-09 21:43:07 +00001/*
2 * (C) Copyright 2001
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenka6840a62001-04-09 21:43:07 +00006 */
7
8/*
9 * Generic RTC interface.
10 */
11#ifndef _RTC_H_
12#define _RTC_H_
13
Albin Tonnerredfdea732009-08-13 15:31:12 +020014/* bcd<->bin functions are needed by almost all the RTC drivers, let's include
15 * it there instead of in evey single driver */
16
17#include <bcd.h>
18
wdenka6840a62001-04-09 21:43:07 +000019/*
20 * The struct used to pass data from the generic interface code to
21 * the hardware dependend low-level code ande vice versa. Identical
22 * to struct rtc_time used by the Linux kernel.
23 *
24 * Note that there are small but significant differences to the
25 * common "struct time":
26 *
Wolfgang Denka1be4762008-05-20 16:00:29 +020027 * struct time: struct rtc_time:
wdenka6840a62001-04-09 21:43:07 +000028 * tm_mon 0 ... 11 1 ... 12
29 * tm_year years since 1900 years since 0
30 */
31
32struct rtc_time {
33 int tm_sec;
34 int tm_min;
35 int tm_hour;
36 int tm_mday;
37 int tm_mon;
38 int tm_year;
39 int tm_wday;
40 int tm_yday;
41 int tm_isdst;
42};
43
Yuri Tikhonov9bacd942008-03-20 17:56:04 +030044int rtc_get (struct rtc_time *);
Jean-Christophe PLAGNIOL-VILLARD97a2e102008-09-01 23:06:23 +020045int rtc_set (struct rtc_time *);
wdenka6840a62001-04-09 21:43:07 +000046void rtc_reset (void);
47
48void GregorianDay (struct rtc_time *);
49void to_tm (int, struct rtc_time *);
50unsigned long mktime (unsigned int, unsigned int, unsigned int,
51 unsigned int, unsigned int, unsigned int);
52
Simon Glass538059d2014-11-14 18:18:26 -070053/**
54 * rtc_init() - Set up the real time clock ready for use
55 */
56void rtc_init(void);
57
wdenka6840a62001-04-09 21:43:07 +000058#endif /* _RTC_H_ */