klclock.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.  * Copyright (C) 1996, 2001 Silicon Graphics, Inc. All rights reserved.
  7.  * Copyright (C) 2001 by Ralf Baechle
  8.  */
  9. #ifndef _ASM_IA64_SN_KLCLOCK_H
  10. #define _ASM_IA64_SN_KLCLOCK_H
  11. #include <asm/sn/ioc3.h>
  12. #define RTC_BASE_ADDR (unsigned char *)(nvram_base)
  13. /* Defines for the SGS-Thomson M48T35 clock */
  14. #define RTC_SGS_WRITE_ENABLE    0x80
  15. #define RTC_SGS_READ_PROTECT    0x40
  16. #define RTC_SGS_YEAR_ADDR       (RTC_BASE_ADDR + 0x7fffL)
  17. #define RTC_SGS_MONTH_ADDR      (RTC_BASE_ADDR + 0x7ffeL)
  18. #define RTC_SGS_DATE_ADDR       (RTC_BASE_ADDR + 0x7ffdL)
  19. #define RTC_SGS_DAY_ADDR        (RTC_BASE_ADDR + 0x7ffcL)
  20. #define RTC_SGS_HOUR_ADDR       (RTC_BASE_ADDR + 0x7ffbL)
  21. #define RTC_SGS_MIN_ADDR        (RTC_BASE_ADDR + 0x7ffaL)
  22. #define RTC_SGS_SEC_ADDR        (RTC_BASE_ADDR + 0x7ff9L)
  23. #define RTC_SGS_CONTROL_ADDR    (RTC_BASE_ADDR + 0x7ff8L)
  24. /* Defines for the Dallas DS1386 */
  25. #define RTC_DAL_UPDATE_ENABLE   0x80
  26. #define RTC_DAL_UPDATE_DISABLE  0x00
  27. #define RTC_DAL_YEAR_ADDR       (RTC_BASE_ADDR + 0xaL)
  28. #define RTC_DAL_MONTH_ADDR      (RTC_BASE_ADDR + 0x9L)
  29. #define RTC_DAL_DATE_ADDR       (RTC_BASE_ADDR + 0x8L)
  30. #define RTC_DAL_DAY_ADDR        (RTC_BASE_ADDR + 0x6L)
  31. #define RTC_DAL_HOUR_ADDR       (RTC_BASE_ADDR + 0x4L)
  32. #define RTC_DAL_MIN_ADDR        (RTC_BASE_ADDR + 0x2L)
  33. #define RTC_DAL_SEC_ADDR        (RTC_BASE_ADDR + 0x1L)
  34. #define RTC_DAL_CONTROL_ADDR    (RTC_BASE_ADDR + 0xbL)
  35. #define RTC_DAL_USER_ADDR       (RTC_BASE_ADDR + 0xeL)
  36. /* Defines for the Dallas DS1742 */
  37. #define RTC_DS1742_WRITE_ENABLE    0x80
  38. #define RTC_DS1742_READ_ENABLE     0x40
  39. #define RTC_DS1742_UPDATE_DISABLE  0x00
  40. #define RTC_DS1742_YEAR_ADDR       (RTC_BASE_ADDR + 0x7ffL)
  41. #define RTC_DS1742_MONTH_ADDR      (RTC_BASE_ADDR + 0x7feL)
  42. #define RTC_DS1742_DATE_ADDR       (RTC_BASE_ADDR + 0x7fdL)
  43. #define RTC_DS1742_DAY_ADDR        (RTC_BASE_ADDR + 0x7fcL)
  44. #define RTC_DS1742_HOUR_ADDR       (RTC_BASE_ADDR + 0x7fbL)
  45. #define RTC_DS1742_MIN_ADDR        (RTC_BASE_ADDR + 0x7faL)
  46. #define RTC_DS1742_SEC_ADDR        (RTC_BASE_ADDR + 0x7f9L)
  47. #define RTC_DS1742_CONTROL_ADDR    (RTC_BASE_ADDR + 0x7f8L)
  48. #define RTC_DS1742_USER_ADDR       (RTC_BASE_ADDR + 0x0L)
  49. #define BCD_TO_INT(x) (((x>>4) * 10) + (x & 0xf))
  50. #define INT_TO_BCD(x) (((x / 10)<<4) + (x % 10))
  51. #define YRREF 1970 
  52. #endif /* _ASM_IA64_SN_KLCLOCK_H  */