rtc.h 1.2 KB

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