Source code of Windows XP (NT5)
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.

134 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. 8259.h
  5. Abstract:
  6. This module contains a variety of constants, function prototypes,
  7. inline functions and external data declarations used by code to
  8. access the 8259 PIC.
  9. Author:
  10. Forrest Foltz (forrestf) 24-Oct-2000
  11. --*/
  12. #ifndef _8259_H_
  13. #define _8259_H_
  14. //
  15. // Initialization control words for the PICs
  16. //
  17. #define ICW1_ICW4_NEEDED 0x01
  18. #define ICW1_CASCADE 0x00
  19. #define ICW1_INTERVAL8 0x00
  20. #define ICW1_LEVEL_TRIG 0x08
  21. #define ICW1_EDGE_TRIG 0x00
  22. #define ICW1_ICW 0x10
  23. #define ICW4_8086_MODE 0x01
  24. #define ICW4_AUTO_EOI 0x02
  25. #define ICW4_NORM_EOI 0x00
  26. #define ICW4_NON_BUF_MODE 0x00
  27. #define ICW4_SPEC_FULLY_NESTED 0x10
  28. #define ICW4_NOT_SPEC_FULLY_NESTED 0x00
  29. #define PIC1_EOI_MASK 0x60
  30. #if defined(NEC_98)
  31. #define PIC2_EOI 0x67
  32. #else
  33. #define PIC2_EOI 0x62
  34. #endif
  35. #define OCW2_NON_SPECIFIC_EOI 0x20
  36. #define OCW2_SPECIFIC_EOI 0x60
  37. #define OCW3_READ_ISR 0x0B
  38. #define OCW3_READ_IRR 0x0A
  39. #define PIC1_BASE 0x30
  40. #define PIC2_BASE 0x38
  41. #if defined(PIC1_PORT0)
  42. C_ASSERT(PIC1_PORT0 == 0x20);
  43. C_ASSERT(PIC1_PORT1 == 0x21);
  44. C_ASSERT(PIC2_PORT0 == 0xA0);
  45. C_ASSERT(PIC2_PORT1 == 0xA1);
  46. #undef PIC1_PORT0
  47. #undef PIC1_PORT1
  48. #undef PIC2_PORT0
  49. #undef PIC2_PORT1
  50. #endif
  51. #define PIC1_PORT0 (PUCHAR)0x20
  52. #define PIC1_PORT1 (PUCHAR)0x21
  53. #define PIC2_PORT0 (PUCHAR)0xA0
  54. #define PIC2_PORT1 (PUCHAR)0xA1
  55. #if defined(EISA_EDGE_LEVEL0)
  56. C_ASSERT(EISA_EDGE_LEVEL0 == 0x4D0);
  57. C_ASSERT(EISA_EDGE_LEVEL1 == 0x4D1);
  58. #undef EISA_EDGE_LEVEL0
  59. #undef EISA_EDGE_LEVEL1
  60. #endif
  61. #define EISA_EDGE_LEVEL0 (PUCHAR)0x4D0
  62. #define EISA_EDGE_LEVEL1 (PUCHAR)0x4D1
  63. __inline
  64. VOID
  65. SET_8259_MASK (
  66. IN USHORT Mask
  67. )
  68. {
  69. WRITE_PORT_USHORT_PAIR (PIC1_PORT1,PIC2_PORT1,Mask);
  70. IO_DELAY();
  71. }
  72. __inline
  73. USHORT
  74. GET_8259_MASK (
  75. VOID
  76. )
  77. {
  78. USHORT mask;
  79. mask = READ_PORT_USHORT_PAIR (PIC1_PORT1,PIC2_PORT1);
  80. IO_DELAY();
  81. return mask;
  82. }
  83. __inline
  84. VOID
  85. PIC1DELAY(
  86. VOID
  87. )
  88. {
  89. READ_PORT_UCHAR(PIC1_PORT0);
  90. IO_DELAY();
  91. }
  92. __inline
  93. VOID
  94. PIC2DELAY(
  95. VOID
  96. )
  97. {
  98. READ_PORT_UCHAR(PIC2_PORT0);
  99. IO_DELAY();
  100. }
  101. #endif // _8259_H_