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

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, 2000 Ralf Baechle
  9.  * Copyright (C) 2002  Maciej W. Rozycki
  10.  */
  11. #ifndef _ASM_MC146818RTC_H
  12. #define _ASM_MC146818RTC_H
  13. #include <linux/config.h>
  14. #include <asm/io.h>
  15. /*
  16.  * This structure defines how to access various features of
  17.  * different machine types and how to access them.
  18.  */
  19. struct rtc_ops {
  20. /* How to access the RTC register in a DS1287.  */
  21. unsigned char (*rtc_read_data)(unsigned long addr);
  22. void (*rtc_write_data)(unsigned char data, unsigned long addr);
  23. int (*rtc_bcd_mode)(void);
  24. };
  25. extern struct rtc_ops *rtc_ops;
  26. /*
  27.  * Most supported machines access the RTC index register via an ISA
  28.  * port access but the way to access the date register differs ...
  29.  * The DECstation directly maps the RTC memory in the CPU's address
  30.  * space with the chipset generating necessary index write/data access
  31.  * cycles automagically.
  32.  */
  33. #define CMOS_READ(addr) ({ 
  34. rtc_ops->rtc_read_data(addr); 
  35. })
  36. #define CMOS_WRITE(val, addr) ({ 
  37. rtc_ops->rtc_write_data(val, addr); 
  38. })
  39. #define RTC_ALWAYS_BCD 
  40. rtc_ops->rtc_bcd_mode()
  41. #ifdef CONFIG_DECSTATION
  42. #include <asm/dec/rtc-dec.h>
  43. #elif defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
  44. #include <asm/it8172/it8172_int.h>
  45. #define RTC_PORT(x) (0x14014800 + (x))
  46. #define RTC_IOMAPPED 0
  47. #define RTC_IRQ IT8172_RTC_IRQ
  48. #elif defined(CONFIG_MIPS_PB1500) || defined(CONFIG_MIPS_PB1100)
  49. #define RTC_PORT(x) (0x0c000000 + (x))
  50. #define RTC_IOMAPPED 0
  51. #define RTC_IRQ 0
  52. #else
  53. #define RTC_PORT(x) (0x70 + (x))
  54. #define RTC_IRQ 8
  55. #endif
  56. #endif /* _ASM_MC146818RTC_H */