n8570.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:6k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* n8570.h - National Semiconductor real time clock */
  2. /* Copyright 1984-1994 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,02mar93.eve    upgraded for 5.1
  7. 01a,19mar90,trl    written
  8. */
  9. #ifndef __INCn8570h
  10. #define __INCn8570h
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #ifndef _ASMLANGUAGE
  15. /* registers */
  16. #define DP8570_MSR(base)                    ((char *) (base) + 0)
  17. #define DP8570_TIM0_CNTRL(base)             ((char *) (base) + 1)
  18. #define DP8570_REALTIME_MODE(base)          ((char *) (base) + 1)
  19. #define DP8570_TIM1_CNTRL(base)             ((char *) (base) + 2)
  20. #define DP8570_OUTPUT_MODE(base)            ((char *) (base) + 2)
  21. #define DP8570_PER_FLAG(base)               ((char *) (base) + 3)
  22. #define DP8570_INT_CNTRL0(base)             ((char *) (base) + 3)
  23. #define DP8570_INT_ROUTING(base)            ((char *) (base) + 4)
  24. #define DP8570_INT_CNTRL1(base)             ((char *) (base) + 4)
  25. #define DP8570_100s_SEC(base)               ((char *) (base) + 5)
  26. #define DP8570_SEC_CNT(base)                ((char *) (base) + 6)
  27. #define DP8570_MIN_CNT(base)                ((char *) (base) + 7)
  28. #define DP8570_HOUR_CNT(base)               ((char *) (base) + 8)
  29. #define DP8570_DAY_OF_MONTH_CNT(base)       ((char *) (base) + 9)
  30. #define DP8570_MONTH_CNT(base)              ((char *) (base) + 10)
  31. #define DP8570_YEAR_CNT(base)               ((char *) (base) + 11)
  32. #define DP8570_UNITS_JULIAN_CNT(base)       ((char *) (base) + 12)
  33. #define DP8570_100s_JULIAN_CNT(base)        ((char *) (base) + 13)
  34. #define DP8570_DAY_OF_WEEK_CNT(base)        ((char *) (base) + 14)
  35. #define DP8570_TIM0_LSB(base)               ((char *) (base) + 15)
  36. #define DP8570_TIM0_MSB(base)               ((char *) (base) + 16)
  37. #define DP8570_TIM1_LSB(base)               ((char *) (base) + 17)
  38. #define DP8570_TIM1_MSB(base)               ((char *) (base) + 18)
  39. #define DP8570_SEC_CMP(base)                ((char *) (base) + 19)
  40. #define DP8570_MIN_CMP(base)                ((char *) (base) + 20)
  41. #define DP8570_HOUR_CMP(base)               ((char *) (base) + 21)
  42. #define DP8570_DAY_OF_MONTH_CMP(base)       ((char *) (base) + 22)
  43. #define DP8570_MONTH_CMP(base)              ((char *) (base) + 23)
  44. #define DP8570_DAY_OF_WEEK_CMP(base)        ((char *) (base) + 24)
  45. #define DP8570_SEC_TIME_SAVE(base)          ((char *) (base) + 25)
  46. #define DP8570_MIN_TIME_SAVE(base)          ((char *) (base) + 26)
  47. #define DP8570_HOUR_TIME_SAVE(base)         ((char *) (base) + 27)
  48. #define DP8570_DAY_OF_MONTH_TIME_SAVE(base) ((char *) (base) + 28)
  49. #define DP8570_MONTH_TIME_SAVE(base)        ((char *) (base) + 29)
  50. #define DP8570_ONE_BYTE_RAM(base)           ((char *) (base) + 30)
  51. #define DP8570_TEST_REG(base)               ((char *) (base) + 31)
  52. #endif  /* _ASMLANGUAGE */
  53. /* main status register */
  54. #define DP8570_INT_PENDING                  0x01
  55. #define DP8570_PWR_FAIL_INT                 0x02
  56. #define DP8570_PERIODIC_INT                 0x04
  57. #define DP8570_ALARM_INT                    0x08
  58. #define DP8570_TIMER0_INT                   0x10
  59. #define DP8570_TIMER1_INT                   0x20
  60. #define DP8570_REG_SET_1_SEL                0x40
  61. #define DP8570_RAM_PAGE_SEL                 0x80
  62. /* timer 0/1 control register */
  63. #define DP8570_TIMER_START_STOP             0x01
  64. #define DP8570_MODE_SEL_M0                  0x02
  65. #define DP8570_MODE_SEL_M1                  0x04
  66. #define DP8570_INPUT_CLK_SEL_C0             0x08
  67. #define DP8570_INPUT_CLK_SEL_C1             0x10
  68. #define DP8570_INPUT_CLK_SEL_C2             0x20
  69. #define DP8570_TIMER_READ                   0x40
  70. #define DP8570_COUNT_HOLD_GATE              0x80
  71. /* periodic flag register */
  72. #define DP8570_MINUTES_FLAG                 0x01
  73. #define DP8570_10s_SECONDS_FLAG             0x02
  74. #define DP8570_SECONDS_FLAG                 0x04
  75. #define DP8570_10e_SECONDS_FLAG             0x08
  76. #define DP8570_100e_SECONDS_FLAG            0x10
  77. #define DP8570_MILLISECONDS_FLAG            0x20
  78. #define DP8570_OSCILLATOR_FAILED            0x40
  79. #define DP8570_TEST_MODE                    0x80
  80. /* interrupt routing register */
  81. #define DP8570_PWR_FAIL_ROUTE               0x01
  82. #define DP8570_PERIODIC_ROUTE               0x02
  83. #define DP8570_ALARM_ROUTE                  0x04
  84. #define DP8570_TIMER0_ROUTE                 0x08
  85. #define DP8570_TIMER1_ROUTE                 0x10
  86. #define DP8570_PWR_FAIL_DELAY               0x20
  87. #define DP8570_LOW_BATTERY_FLAG             0x40
  88. #define DP8570_TIME_SAVE_ENABLE             0x80
  89. /* real time mode register */
  90. #define DP8570_LEAP_YEAR_LSB                0x01
  91. #define DP8570_LEAP_YEAR_MSB                0x02
  92. #define DP8570_12_24_HOUR_MODE              0x04
  93. #define DP8570_CLK_START_STOP               0x08
  94. #define DP8570_INT_OP                       0x10
  95. #define DP8570_TIMER_PF_OP                  0x20
  96. #define DP8570_OSCILLATOR_FREQ1             0x40
  97. #define DP8570_OSCILLATOR_FREQ2             0x80
  98. /* output mode register */
  99. #define DP8570_T1_ACTIVE_HIGH               0x01
  100. #define DP8570_T1_PUSH_PULL                 0x02
  101. #define DP8570_INT_ACTIVE_HIGH              0x04
  102. #define DP8570_INT_PUSH_PULL                0x08
  103. #define DP8570_MFO_ACTIVE_HIGH              0x10
  104. #define DP8570_MFO_PUSH_PULL                0x20
  105. #define DP8570_MFO_TIMER0                   0x40
  106. #define DP8570_MFO_OSCILLATOR               0x80
  107. /* interrupt control register 0 */
  108. #define DP8570_MINUTES_ENABLE               0x01
  109. #define DP8570_10s_SECONDS_ENABLE           0x02
  110. #define DP8570_SECONDS_ENABLE               0x04
  111. #define DP8570_10e_SECONDS_ENABLE           0x08
  112. #define DP8570_100e_SECONDS_ENABLE          0x10
  113. #define DP8570_MILLISECONDS_ENABLE          0x20
  114. #define DP8570_TIMER0_ENABLE                0x40
  115. #define DP8570_TIMER1_ENABLE                0x80
  116. /* interrupt control register 1 */
  117. #define DP8570_SECOND_CMP_ENABLE            0x01
  118. #define DP8570_MINUTE_CMP_ENABLE            0x02
  119. #define DP8570_HOURS_CMP_ENABLE             0x04
  120. #define DP8570_DOM_CMP_ENABLE               0x08
  121. #define DP8570_MONTH_CMP_ENABLE             0x10
  122. #define DP8570_DOY_CMP_ENABLE               0x20
  123. #define DP8570_ALARM_INT_ENABLE             0x40
  124. #define DP8570_PWR_FAIL_INT_ENABLE          0x80
  125. /* miscellaneous */
  126. #define DP8570_PAGE0_RAM_START              0x13
  127. #define DP8570_PAGE1_RAM_START              0x01
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* __INCn8570h */