rtc.h
上传用户:szlgq88
上传日期:2009-04-28
资源大小:48287k
文件大小:1k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/include/asm-arm/rtc.h
  3.  *
  4.  *  Copyright (C) 2003 Deep Blue Solutions Ltd.
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License version 2 as
  8.  * published by the Free Software Foundation.
  9.  */
  10. #ifndef ASMARM_RTC_H
  11. #define ASMARM_RTC_H
  12. struct module;
  13. struct rtc_ops {
  14. struct module *owner;
  15. int (*open)(void);
  16. void (*release)(void);
  17. int (*ioctl)(unsigned int, unsigned long);
  18. int (*read_time)(struct rtc_time *);
  19. int (*set_time)(struct rtc_time *);
  20. int (*read_alarm)(struct rtc_wkalrm *);
  21. int (*set_alarm)(struct rtc_wkalrm *);
  22. int (*proc)(char *buf);
  23. };
  24. void rtc_time_to_tm(unsigned long, struct rtc_time *);
  25. int rtc_tm_to_time(struct rtc_time *, unsigned long *);
  26. int rtc_valid_tm(struct rtc_time *);
  27. void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *);
  28. void rtc_update(unsigned long, unsigned long);
  29. int register_rtc(struct rtc_ops *);
  30. void unregister_rtc(struct rtc_ops *);
  31. static inline int rtc_periodic_alarm(struct rtc_time *tm)
  32. {
  33. return  (tm->tm_year == -1) ||
  34. ((unsigned)tm->tm_mon >= 12) ||
  35. ((unsigned)(tm->tm_mday - 1) >= 31) ||
  36. ((unsigned)tm->tm_hour > 23) ||
  37. ((unsigned)tm->tm_min > 59) ||
  38. ((unsigned)tm->tm_sec > 59);
  39. }
  40. #endif