Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.2 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /**
  2. * @file
  3. * AIF and RTC registers
  4. */
  5. #ifndef __AIFREGS_H__
  6. #define __AIFREGS_H__
  7. #include <tamtypes.h>
  8. #define AIF_REGBASE (SPD_REGBASE + 0x4000000)
  9. #define USE_AIF_REGS volatile u16 *aif_regs = \
  10. (volatile u16 *)AIF_REGBASE
  11. enum AIF_REGS{
  12. AIF_IDENT = 0x00,
  13. AIF_REVISION,
  14. AIF_INTSR,
  15. AIF_INTEN,
  16. AIF_TIMCFG,
  17. AIF_COUNT_L = 0x08,
  18. AIF_COUNT_H,
  19. AIF_ATA_TCFG = 0x20,
  20. AIF_ATA = 0x30, //ATA register base.
  21. AIF_ATACTL = 0x3C,
  22. AIF_RTC = 0x80 //RTC register base.
  23. };
  24. #define AIF_INTCL AIF_INTSR
  25. //AIF interrupt management
  26. enum AIF_INUM{
  27. AIF_INUM_ATA0 = 0,
  28. AIF_INUM_RTC, //I don't know what this interrupt event is, but it should be for the RTC because it doesn't have a known bit for itself.
  29. AIF_INUM_PCMCIA,
  30. AIF_INUM_COUNT
  31. };
  32. #define AIF_INTR_ATA0 (1<<AIF_INUM_ATA0)
  33. #define AIF_INTR_RTC (1<<AIF_INUM_RTC)
  34. #define AIF_INTR_PCMCIA (1<<AIF_INUM_PCMCIA)
  35. //Motorola MC146818 RTC management
  36. #define USE_AIF_RTC_REGS volatile u16 *aif_rtc_regs = \
  37. (&aif_regs[AIF_RTC])
  38. enum RTC_REGS{
  39. RTC_SECONDS = 0x00,
  40. RTC_SECONDS_ALARM,
  41. RTC_MINUTES,
  42. RTC_MINUTES_ALARM,
  43. RTC_HOURS,
  44. RTC_HOURS_ALARM,
  45. RTC_DAY_OF_WEEK,
  46. RTC_DAY_OF_MONTH,
  47. RTC_MONTH,
  48. RTC_YEAR,
  49. RTC_REG_A,
  50. RTC_REG_B,
  51. RTC_REG_C,
  52. RTC_REG_D
  53. };
  54. /**********************************************************************
  55. * RTC register details, taken from mc146818rtc.h
  56. **********************************************************************/
  57. #define RTC_FREQ_SELECT RTC_REG_A
  58. /**
  59. * update-in-progress - set to "1" 244 microsecs before RTC goes off the bus,
  60. * reset after update (may take 1.984ms @ 32768Hz RefClock) is complete,
  61. * totalling to a max high interval of 2.228 ms.
  62. */
  63. # define RTC_UIP 0x80
  64. # define RTC_DIV_CTL 0x70
  65. /** divider control: refclock values 4.194 / 1.049 MHz / 32.768 kHz */
  66. # define RTC_REF_CLCK_4MHZ 0x00
  67. # define RTC_REF_CLCK_1MHZ 0x10
  68. # define RTC_REF_CLCK_32KHZ 0x20
  69. /** 2 values for divider stage reset, others for "testing purposes only" */
  70. # define RTC_DIV_RESET1 0x60
  71. # define RTC_DIV_RESET2 0x70
  72. /** Periodic intr. / Square wave rate select. 0=none, 1=32.8kHz,... 15=2Hz */
  73. # define RTC_RATE_SELECT 0x0F
  74. /**********************************************************************/
  75. #define RTC_CONTROL RTC_REG_B
  76. /** disable updates for clock setting */
  77. # define RTC_SET 0x80
  78. /** periodic interrupt enable */
  79. # define RTC_PIE 0x40
  80. /** alarm interrupt enable */
  81. # define RTC_AIE 0x20
  82. /** update-finished interrupt enable */
  83. # define RTC_UIE 0x10
  84. /** enable square-wave output */
  85. # define RTC_SQWE 0x08
  86. /** all time/date values are BCD if clear */
  87. # define RTC_DM_BINARY 0x04
  88. /** 24 hour mode - else hours bit 7 means pm */
  89. # define RTC_24H 0x02
  90. /** auto switch DST - works f. USA only */
  91. # define RTC_DST_EN 0x01
  92. /**********************************************************************/
  93. #define RTC_INTR_FLAGS RTC_REG_C
  94. /* caution - cleared by read */
  95. /** any of the following 3 is active */
  96. # define RTC_IRQF 0x80
  97. # define RTC_PF 0x40
  98. # define RTC_AF 0x20
  99. # define RTC_UF 0x10
  100. /**********************************************************************/
  101. #define RTC_VALID RTC_REG_D
  102. /** valid RAM and time */
  103. # define RTC_VRT 0x80
  104. /**********************************************************************/
  105. #endif /* __AIFREGS_H__ */