mc146818rtc.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  *
  6.  * Machine dependent access functions for RTC registers.
  7.  *
  8.  * Copyright (C) 1996, 1997, 1998 Ralf Baechle
  9.  */
  10. #ifndef _ASM_MC146818RTC_H
  11. #define _ASM_MC146818RTC_H
  12. #include <asm/io.h>
  13. /*
  14.  * This structure defines how to access various features of
  15.  * different machine types and how to access them.
  16.  */
  17. struct rtc_ops {
  18. /* How to access the RTC register in a DS1287.  */
  19. unsigned char (*rtc_read_data)(unsigned long addr);
  20. void (*rtc_write_data)(unsigned char data, unsigned long addr);
  21. int (*rtc_bcd_mode)(void);
  22. };
  23. extern struct rtc_ops *rtc_ops;
  24. /*
  25.  * The yet supported machines all access the RTC index register via
  26.  * an ISA port access but the way to access the date register differs ...
  27.  */
  28. #define CMOS_READ(addr) ({ 
  29. rtc_ops->rtc_read_data(addr); 
  30. })
  31. #define CMOS_WRITE(val, addr) ({ 
  32. rtc_ops->rtc_write_data(val, addr); 
  33. })
  34. #define RTC_ALWAYS_BCD 
  35. rtc_ops->rtc_bcd_mode()
  36. #define RTC_PORT(x) (0x70 + (x))
  37. #define RTC_IRQ 8
  38. #endif /* _ASM_MC146818RTC_H */