rtc.h 791 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef __RT_HW_SERIAL_H__
  2. #define __RT_HW_SERIAL_H__
  3. #include <rthw.h>
  4. #include <rtthread.h>
  5. #include "s3c24x0.h"
  6. #define RTC_DEBUG
  7. #define RTC_ENABLE 0x01
  8. #define RTC_DISABLE 0x02
  9. static const unsigned char days_in_month[] =
  10. {
  11. 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
  12. };
  13. #define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400)
  14. #define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400))
  15. struct rtc_time
  16. {
  17. int tm_sec;
  18. int tm_min;
  19. int tm_hour;
  20. int tm_mday;
  21. int tm_mon;
  22. int tm_year;
  23. int tm_wday;
  24. int tm_yday;
  25. int tm_isdst;
  26. };
  27. void rt_hw_rtc_get (struct rtc_time *tmp);
  28. void rt_hw_rtc_set (struct rtc_time *tmp);
  29. void rt_hw_rtc_reset (void);
  30. void rt_rtc_time_to_tm(rt_uint32_t time, struct rtc_time *tm);
  31. #endif