rtc.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. * Generic RTC interface.
  25. */
  26. #ifndef _RTC_H_
  27. #define _RTC_H_
  28. /*
  29. * The struct used to pass data from the generic interface code to
  30. * the hardware dependend low-level code ande vice versa. Identical
  31. * to struct rtc_time used by the Linux kernel.
  32. *
  33. * Note that there are small but significant differences to the
  34. * common "struct time":
  35. *
  36. * struct time: struct rtc_time:
  37. * tm_mon 0 ... 11 1 ... 12
  38. * tm_year years since 1900 years since 0
  39. */
  40. struct rtc_time {
  41. int tm_sec;
  42. int tm_min;
  43. int tm_hour;
  44. int tm_mday;
  45. int tm_mon;
  46. int tm_year;
  47. int tm_wday;
  48. int tm_yday;
  49. int tm_isdst;
  50. };
  51. int rtc_get (struct rtc_time *);
  52. int rtc_set (struct rtc_time *);
  53. void rtc_reset (void);
  54. void GregorianDay (struct rtc_time *);
  55. void to_tm (int, struct rtc_time *);
  56. unsigned long mktime (unsigned int, unsigned int, unsigned int,
  57. unsigned int, unsigned int, unsigned int);
  58. uchar rtc_read(uchar reg) __attribute__((weak));
  59. void rtc_write(uchar reg, uchar val) __attribute__((weak));
  60. #endif /* _RTC_H_ */