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.

172 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. ixkdcom.h
  5. Abstract:
  6. This module contains the header file for a very simple com port package.
  7. Author:
  8. Bryan M. Willman (bryanwi) 24-Sep-1990
  9. Revision History:
  10. John Vert (jvert) 19-Jul-1991
  11. Moved into HAL
  12. --*/
  13. #define COM1_PORT 0x03f8
  14. #define COM2_PORT 0x02f8
  15. #define COM3_PORT 0x03e8
  16. #define COM4_PORT 0x02e8
  17. #define COM_DAT 0x00
  18. #define COM_IEN 0x01 // interrupt enable register
  19. #define COM_LCR 0x03 // line control registers
  20. #define COM_MCR 0x04 // modem control reg
  21. #define COM_LSR 0x05 // line status register
  22. #define COM_MSR 0x06 // modem status register
  23. #define COM_DLL 0x00 // divisor latch least sig
  24. #define COM_DLM 0x01 // divisor latch most sig
  25. #define COM_BI 0x10
  26. #define COM_FE 0x08
  27. #define COM_PE 0x04
  28. #define COM_OE 0x02
  29. #define LC_DLAB 0x80 // divisor latch access bit
  30. #define CLOCK_RATE 0x1C200 // USART clock rate
  31. #define MC_DTRRTS 0x03 // Control bits to assert DTR and RTS
  32. #define MS_DSRCTSCD 0xB0 // Status bits for DSR, CTS and CD
  33. #define MS_CD 0x80
  34. #define BD_150 150
  35. #define BD_300 300
  36. #define BD_600 600
  37. #define BD_1200 1200
  38. #define BD_2400 2400
  39. #define BD_4800 4800
  40. #define BD_9600 9600
  41. #define BD_14400 14400
  42. #define BD_19200 19200
  43. #define BD_56000 56000
  44. #define BD_57600 57600
  45. #define BD_115200 115200
  46. #define COM_OUTRDY 0x20
  47. #define COM_DATRDY 0x01
  48. #define MSG_DEBUG_9600 "Switching debugger to 9600 baud\n"
  49. //
  50. // This bit controls the loopback testing mode of the device. Basically
  51. // the outputs are connected to the inputs (and vice versa).
  52. //
  53. #define SERIAL_MCR_LOOP 0x10
  54. //
  55. // This bit is used for general purpose output.
  56. //
  57. #define SERIAL_MCR_OUT1 0x04
  58. //
  59. // This bit contains the (complemented) state of the clear to send
  60. // (CTS) line.
  61. //
  62. #define SERIAL_MSR_CTS 0x10
  63. //
  64. // This bit contains the (complemented) state of the data set ready
  65. // (DSR) line.
  66. //
  67. #define SERIAL_MSR_DSR 0x20
  68. //
  69. // This bit contains the (complemented) state of the ring indicator
  70. // (RI) line.
  71. //
  72. #define SERIAL_MSR_RI 0x40
  73. //
  74. // This bit contains the (complemented) state of the data carrier detect
  75. // (DCD) line.
  76. //
  77. #define SERIAL_MSR_DCD 0x80
  78. #define SERIAL_LSR_NOT_PRESENT 0xff
  79. typedef struct _CPPORT {
  80. PUCHAR Address;
  81. ULONG Baud;
  82. USHORT Flags;
  83. TIME_FIELDS CarrierLostTime;
  84. // ULONG LockVar;
  85. // KSPIN_LOCK Lock;
  86. } CPPORT, *PCPPORT;
  87. #define PORT_DEFAULTRATE 0x0001 // baud rate not specified, using default
  88. #define PORT_MODEMCONTROL 0x0002 // using modem controls
  89. #define PORT_SAVED 0x0004 // port is in saved state
  90. #define PORT_NOCDLTIME 0x0010 // 'Carrier detect lost' time not set
  91. #define PORT_DISBAUD 0x0020 // Display baud rate abbrv
  92. #define PORT_SENDINGSTRING 0x0040 // Sending modem string (don't recurse)
  93. #define PORT_MDM_CD 0x0080 // CD while in modem control mode
  94. VOID
  95. CpInitialize (
  96. PCPPORT Port,
  97. PUCHAR Address,
  98. ULONG Rate
  99. );
  100. VOID
  101. CpSetBaud (
  102. PCPPORT Port,
  103. ULONG Rate
  104. );
  105. USHORT
  106. CpQueryBaud (
  107. PCPPORT Port
  108. );
  109. VOID
  110. CpPutByte (
  111. PCPPORT Port,
  112. UCHAR Byte
  113. );
  114. USHORT
  115. CpGetByte (
  116. PCPPORT Port,
  117. PUCHAR Byte,
  118. BOOLEAN WaitForData
  119. );
  120. VOID
  121. CpLockPort (
  122. PCPPORT Port
  123. );
  124. VOID
  125. CpUnlockPort (
  126. PCPPORT Port
  127. );
  128. VOID
  129. CpStallExecution (
  130. VOID
  131. );
  132. BOOLEAN
  133. CpDoesPortExist(
  134. IN PUCHAR Address
  135. );
  136.