mc146818rtc.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:1k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * Machine dependent access functions for RTC registers.
  3.  */
  4. #ifndef _ASM_MC146818RTC_H
  5. #define _ASM_MC146818RTC_H
  6. #include <linux/config.h>
  7. #include <asm/atarihw.h>
  8. #ifdef CONFIG_ATARI
  9. /* RTC in Atari machines */
  10. #include <asm/atarihw.h>
  11. #include <asm/atariints.h>
  12. #include <asm/io.h>
  13. #define RTC_HAS_IRQ (ATARIHW_PRESENT(TT_MFP))
  14. #define RTC_IRQ  IRQ_TT_MFP_RTC
  15. #define RTC_IRQ_FLAGS IRQ_TYPE_FAST
  16. #define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
  17. #define RTC_ALWAYS_BCD 0 /* TOS uses binary mode, Linux should be able
  18.  * to deal with both modes */
  19. #define RTC_CHECK_DRIVER_INIT() (MACH_IS_ATARI && ATARIHW_PRESENT(TT_CLK))
  20. #define RTC_MACH_INIT()
  21.     do {
  22. epoch = atari_rtc_year_offset + 1900;
  23. if (RTC_HAS_IRQ)
  24.     /* select RTC int on H->L edge */
  25.     tt_mfp.active_edge &= ~0x40;
  26.     } while(0)
  27. #define RTC_MACH_EXIT()
  28. /* On Atari, the year was stored with base 1970 in old TOS versions (before
  29.  * 3.06). Later, Atari recognized that this broke leap year recognition, and
  30.  * changed the base to 1968. Medusa and Hades always use the new version. */
  31. #define RTC_CENTURY_SWITCH -1 /* no century switch */
  32. #define RTC_MINYEAR epoch
  33. #define CMOS_READ(addr) ({ 
  34. atari_outb_p((addr),RTC_PORT(0)); 
  35. atari_inb_p(RTC_PORT(1)); 
  36. })
  37. #define CMOS_WRITE(val, addr) ({ 
  38. atari_outb_p((addr),RTC_PORT(0)); 
  39. atari_outb_p((val),RTC_PORT(1)); 
  40. })
  41. #endif /* CONFIG_ATARI */
  42. #endif /* _ASM_MC146818RTC_H */