Leaked source code of windows server 2003
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.6 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. ixkdcom.h
  5. Abstract:
  6. This module contains the header file for comport detection code.
  7. The code is extracted from NT Hal for kernel debugger.
  8. Author:
  9. Shie-Lin Tzong (shielint) Dec-23-1991.
  10. Revision History:
  11. --*/
  12. #define MAX_COM_PORTS 4 // Max. number of comports detectable
  13. #define MAX_LPT_PORTS 3 // Max. number of LPT ports detectable
  14. #define COM1_PORT 0x03f8
  15. #define COM2_PORT 0x02f8
  16. #define COM3_PORT
  17. #define COM4_PORT
  18. #define BAUD_RATE_9600_MSB 0x0
  19. #define BAUD_RATE_9600_LSB 0xC
  20. #define IER_TEST_VALUE 0xF
  21. //
  22. // Offsets from the base register address of the
  23. // various registers for the 8250 family of UARTS.
  24. //
  25. #define RECEIVE_BUFFER_REGISTER (0x00u)
  26. #define TRANSMIT_HOLDING_REGISTER (0x00u)
  27. #define INTERRUPT_ENABLE_REGISTER (0x01u)
  28. #define INTERRUPT_IDENT_REGISTER (0x02u)
  29. #define FIFO_CONTROL_REGISTER (0x02u)
  30. #define LINE_CONTROL_REGISTER (0x03u)
  31. #define MODEM_CONTROL_REGISTER (0x04u)
  32. #define LINE_STATUS_REGISTER (0x05u)
  33. #define MODEM_STATUS_REGISTER (0x06u)
  34. #define DIVISOR_LATCH_LSB (0x00u)
  35. #define DIVISOR_LATCH_MSB (0x01u)
  36. #define SERIAL_REGISTER_LENGTH (7)
  37. //
  38. // These masks define access to the line control register.
  39. //
  40. //
  41. // This defines the bit used to control the definition of the "first"
  42. // two registers for the 8250. These registers are the input/output
  43. // register and the interrupt enable register. When the DLAB bit is
  44. // enabled these registers become the least significant and most
  45. // significant bytes of the divisor value.
  46. //
  47. #define SERIAL_LCR_DLAB 0x80
  48. //
  49. // This defines the bit used to control whether the device is sending
  50. // a break. When this bit is set the device is sending a space (logic 0).
  51. //
  52. // Most protocols will assume that this is a hangup.
  53. //
  54. #define SERIAL_LCR_BREAK 0x40
  55. //
  56. // This macro writes to the modem control register
  57. //
  58. // Arguments:
  59. //
  60. // BaseAddress - A pointer to the address from which the hardware
  61. // device registers are located.
  62. //
  63. // ModemControl - The control bits to send to the modem control.
  64. //
  65. //
  66. #define WRITE_MODEM_CONTROL(BaseAddress,ModemControl) \
  67. do \
  68. { \
  69. WRITE_PORT_UCHAR( \
  70. (BaseAddress)+MODEM_CONTROL_REGISTER, \
  71. (ModemControl) \
  72. ); \
  73. } while (0)
  74. //
  75. // This macro reads the modem control register
  76. //
  77. // Arguments:
  78. //
  79. // BaseAddress - A pointer to the address from which the hardware
  80. // device registers are located.
  81. //
  82. //
  83. #define READ_MODEM_CONTROL(BaseAddress) \
  84. (READ_PORT_UCHAR((BaseAddress)+MODEM_CONTROL_REGISTER))
  85. //
  86. // This macro reads the interrupt identification register
  87. //
  88. // Arguments:
  89. //
  90. // BaseAddress - A pointer to the address from which the hardware
  91. // device registers are located.
  92. //
  93. // Note that this routine potententially quites a transmitter
  94. // empty interrupt. This is because one way that the transmitter
  95. // empty interrupt is cleared is to simply read the interrupt id
  96. // register.
  97. //
  98. //
  99. #define READ_INTERRUPT_ID_REG(BaseAddress) \
  100. (READ_PORT_UCHAR((BaseAddress)+INTERRUPT_IDENT_REGISTER))
  101.