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.

355 lines
17 KiB

  1. /******************************************************************************
  2. *
  3. * $Workfile: 16cx5x.h $
  4. *
  5. * $Author: Golden $
  6. *
  7. * $Revision: 6 $
  8. *
  9. * $Modtime: 10/11/99 14:21 $
  10. *
  11. * Description: Contains private 16Cx9x UART family definitions.
  12. *
  13. ******************************************************************************/
  14. #if !defined(_16CX5X_H) /* _16CX5X.H */
  15. #define _16CX5X_H
  16. /******************************************************************************
  17. * UART REGISTERS
  18. ******************************************************************************/
  19. #define TRANSMIT_HOLDING_REGISTER 0x00 /* Write Only. */
  20. #define RECEIVE_BUFFER_REGISTER 0x00 /* Read Only. */
  21. #define DIVISOR_LATCH_LSB 0x00 /* Read/Write When DLAB is Set. */
  22. #define DIVISOR_LATCH_MSB 0x01 /* Read/Write When DLAB is Set. */
  23. #define INTERRUPT_ENABLE_REGISTER 0x01 /* Read/Write. */
  24. #define FIFO_CONTROL_REGISTER 0x02 /* Write Only. */
  25. #define INTERRUPT_IDENT_REGISTER 0x02 /* Read Only. */
  26. #define LINE_CONTROL_REGISTER 0x03 /* Read/Write. */
  27. #define MODEM_CONTROL_REGISTER 0x04 /* Read/Write. */
  28. #define LINE_STATUS_REGISTER 0x05 /* Read Only. */
  29. #define MODEM_STATUS_REGISTER 0x06 /* Read Only. */
  30. #define SCRATCH_PAD_REGISTER 0x07 /* Read/Write. */
  31. /******************************************************************************
  32. * THR: Transmittter Holding Register - WRITE ONLY
  33. ******************************************************************************/
  34. #define THR TRANSMIT_HOLDING_REGISTER
  35. /******************************************************************************
  36. * RBR: Receive Buffer Register - READ ONLY
  37. ******************************************************************************/
  38. #define RBR RECEIVE_BUFFER_REGISTER
  39. /******************************************************************************
  40. * IER: Interrupt Enable Register - READ/WRITE
  41. ******************************************************************************/
  42. #define IER INTERRUPT_ENABLE_REGISTER
  43. #define IER_INT_RDA 0x01 /* Bit 0: Enable Receive Data Available Interrupt (RXRDY). */
  44. #define IER_INT_THR 0x02 /* Bit 1: Enable Transmitter Holding Register Empty Interrupt (THRE). */
  45. #define IER_INT_RLS 0x04 /* Bit 2: Enable Receiver Line Status Interrupt (RXSTAT). */
  46. #define IER_INT_MS 0x08 /* Bit 3: Enable Modem Status Interrupt (MODEM). */
  47. #define IER_SLEEP_EN 0x10 /* Bit 4: Enable Sleep Mode (16750+). */
  48. #define IER_ALTSLEEP_EN 0x20 /* Bit 5: Enable Low Power Mode (16750+). */
  49. #define IER_SPECIAL_CHR 0x20 /* Bit 5: Enable Level 5 Interupts - Special Char Detect (16950+ Enhanced Mode) */
  50. #define IER_INT_RTS 0x40 /* Bit 6: Enable RTS Interrupt Mask (16950+ Enhanced Mode). */
  51. #define IER_INT_CTS 0x80 /* Bit 7: Enable CTS Interrupt Mask (16950+ Enhanced Mode). */
  52. /******************************************************************************
  53. * FCR: FIFO Control Register - WRITE ONLY
  54. ******************************************************************************/
  55. #define FCR FIFO_CONTROL_REGISTER
  56. #define FCR_FIFO_ENABLE 0x01 /* Bit 0: Enable FIFOs */
  57. #define FCR_FLUSH_RX_FIFO 0x02 /* Bit 1: Clear Receive FIFO. */
  58. #define FCR_FLUSH_TX_FIFO 0x04 /* Bit 2: Clear Transmit FIFO. */
  59. #define FCR_DMA_MODE 0x08 /* Bit 3: DMA Mode Select. Change RXRDY & TXRDY Pins From Mode 1 to Mode 2. */
  60. /* 16C950 - 650 Mode only. */
  61. #define FCR_THR_TRIG_LEVEL_1 0x00 /* Bits 4:5 - Set Transmit FIFO Trigger Level to 16 Bytes in 650 mode. */
  62. #define FCR_THR_TRIG_LEVEL_2 0x10 /* Bits 4:5 - Set Transmit FIFO Trigger Level to 32 Bytes in 650 mode. */
  63. #define FCR_THR_TRIG_LEVEL_3 0x20 /* Bits 4:5 - Set Transmit FIFO Trigger Level to 64 Bytes in 650 mode. */
  64. #define FCR_THR_TRIG_LEVEL_4 0x30 /* Bits 4:5 - Set Transmit FIFO Trigger Level to 112 Bytes in 650 mode. */
  65. #define FCR_750_FIFO 0x20 /* Bit 5: Enable 64 Bit FIFO (16C750) */
  66. #define FCR_TRIG_LEVEL_1 0x00 /* Bits 6:7 - Set Receive FIFO Trigger Level to 1 Byte on 16C550A. */
  67. #define FCR_TRIG_LEVEL_2 0x40 /* Bits 6:7 - Set Receive FIFO Trigger Level to 4 Bytes on 16C550A. */
  68. #define FCR_TRIG_LEVEL_3 0x80 /* Bits 6:7 - Set Receive FIFO Trigger Level to 8 Bytes on 16C550A. */
  69. #define FCR_TRIG_LEVEL_4 0xC0 /* Bits 6:7 - Set Receive FIFO Trigger Level to 16 Bytes on 16C550A. */
  70. /******************************************************************************
  71. * IIR: Interrupt Identification Register. or ISR: Interrupt Status Register - READ ONLY
  72. ******************************************************************************/
  73. #define IIR INTERRUPT_IDENT_REGISTER
  74. #define IIR_NO_INT_PENDING 0x01 /* Bit 0: No Interrupt Pending. */
  75. /* Interrupt Priorities */
  76. #define IIR_RX_STAT_MSK 0x06 /* Bits 1:2 - Receiver Line Status Interrupt (Level 1 - Highest). */
  77. #define IIR_RX_MSK 0x04 /* Bits 1:2 - Received Data Available Interrupt (Level 2a). */
  78. #define IIR_RXTO_MSK 0x0C /* Bits 1:2 - Received Data Time Out Interrupt (Level 2b). */
  79. #define IIR_TX_MSK 0x02 /* Bits 1:2 - Transmitter Holding Empty Interrupt (Level 3). */
  80. #define IIR_MODEM_MSK 0x00 /* Bits 1:2 - Modem Status Interrupt (Level 4). */
  81. #define IIR_TO_INT_PENDING 0x08 /* Bit 3: Time-out Interrupt Pending. */
  82. #define IIR_S_CHR_MSK 0x10 /* Bit 4: Special Char (16C950 - Enhanced Mode) (Level 5) */
  83. #define IIR_CTS_RTS_MSK 0x20 /* Bit 4: CTS/RTS Interrupt (16C950 - Enhanced Mode)(Level 6 - Lowest) */
  84. #define IIR_64BYTE_FIFO 0x20 /* Bit 5: 64 Byte FIFO Enabeled (16C750). */
  85. #define IIR_NO_FIFO 0x00 /* Bits 6:7 - No FIFO. */
  86. #define IIR_FIFO_UNUSABLE 0x40 /* Bits 6:7 - FIFO Enabled But Unusable (16550 Only). */
  87. #define IIR_FIFO_ENABLED 0xC0 /* Bits 6:7 - FIFO Enabled And Usable. */
  88. #define IIR_FIFO_MASK 0xC0 /* Bits 6:7 - Bit mask, */
  89. /******************************************************************************
  90. * LCR: Line Control Register. - READ/WRITE
  91. ******************************************************************************/
  92. #define LCR LINE_CONTROL_REGISTER
  93. #define LCR_DATALEN_5 0x00 /* Bits 0:1 - Sets Data Word Length to 5 Bits. */
  94. #define LCR_DATALEN_6 0x01 /* Bits 0:1 - Sets Data Word Length to 6 Bits. */
  95. #define LCR_DATALEN_7 0x02 /* Bits 0:1 - Sets Data Word Length to 7 Bits. */
  96. #define LCR_DATALEN_8 0x03 /* Bits 0:1 - Sets Data Word Length to 8 Bits. */
  97. #define LCR_STOPBITS 0x04 /* Bit 2 - 2 Stop Bits for 6,7,8 Bit Words or 1.5 Stop Bits for 5 Bit Words. */
  98. #define LCR_NO_PARITY 0x00 /* Bits 3:5 - No Parity. */
  99. #define LCR_ODD_PARITY 0x08 /* Bits 3:5 - Odd Parity. */
  100. #define LCR_EVEN_PARITY 0x18 /* Bits 3:5 - Even Parity. */
  101. #define LCR_MARK_PARITY 0x28 /* Bits 3:5 - High Parity - Mark (Forced to 1). */
  102. #define LCR_SPACE_PARITY 0x38 /* Bits 3:5 - Low Parity - Space (Forced to 0). */
  103. #define LCR_TX_BREAK 0x40 /* Bit 6 - Set Break Enable. */
  104. #define LCR_DLAB 0x80 /* Divisor Latch Access Bit - Allows Access To Low And High Divisor Registers. */
  105. #define LCR_ACCESS_650 0xBF /* Access to 650 Compatiblity Registers (16C950) */
  106. /******************************************************************************
  107. * MCR: Modem Control Register - READ/WRITE
  108. ******************************************************************************/
  109. #define MCR MODEM_CONTROL_REGISTER
  110. #define MCR_SET_DTR 0x01 /* Bit 0: Force DTR (Data Terminal Ready). */
  111. #define MCR_SET_RTS 0x02 /* Bit 1: Force RTS (Request To Send). */
  112. #define MCR_OUT1 0x04 /* Bit 2: Aux Output 1. */
  113. #define MCR_OUT2 0x08 /* Bit 3: Aux Output 2. */
  114. #define MCR_INT_EN 0x08 /* Bit 3: (16C950) */
  115. #define MCR_LOOPBACK 0x10 /* Bit 4: Enable Loopback Mode. */
  116. #define MCR_750CTSRTS 0x20 /* Bit 5: Automatic Flow Control Enabled RTS/CTS (16C750) */
  117. #define MCR_XON_ANY 0x20 /* Bit 5: Xon-Any is enabled (16C950 - Enhanced Mode) */
  118. #define MCR_IRDA_MODE 0x40 /* Bit 6: Enable IrDA mode - requires 16x clock. (16C950 - Enhanced Mode) */
  119. #define MCR_CPR_EN 0x80 /* Bit 7: Enable Baud Prescale (16C950 - Enhanced Mode) */
  120. /******************************************************************************
  121. * LSR: Line Status Register - READ ONLY
  122. ******************************************************************************/
  123. #define LSR LINE_STATUS_REGISTER
  124. #define LSR_RX_DATA 0x01 /* Bit 0: Data Ready. */
  125. #define LSR_ERR_OE 0x02 /* Bit 1: Overrun Error. */
  126. #define LSR_ERR_PE 0x04 /* Bit 2: Parity Error. */
  127. #define LSR_RX_BIT9 0x04 /* Bit 2: 9th Rx Data Bit (16C950 - 9 bit data mode only) */
  128. #define LSR_ERR_FE 0x08 /* Bit 3: Framing Error. */
  129. #define LSR_ERR_BK 0x10 /* Bit 4: Break Interrupt. */
  130. #define LSR_THR_EMPTY 0x20 /* Bit 5: Empty Transmitter Holding Register. */
  131. #define LSR_TX_EMPTY 0x40 /* Bit 6: Empty Data Holding Registers. */
  132. #define LSR_ERR_DE 0x80 /* Bit 7: Error In Received FIFO. */
  133. #define LSR_ERR_MSK LSR_ERR_OE + LSR_ERR_PE + LSR_ERR_FE + LSR_ERR_BK + LSR_ERR_DE
  134. /******************************************************************************
  135. * MSR: Modem Status Register - READ ONLY
  136. ******************************************************************************/
  137. #define MSR MODEM_STATUS_REGISTER
  138. #define MSR_CTS_CHANGE 0x01 /* Bit 0: Delta Clear To Send. */
  139. #define MSR_DSR_CHANGE 0x02 /* Bit 1: Delta Data Set Ready. */
  140. #define MSR_RI_DROPPED 0x04 /* Bit 2: Trailing Edge Ring Indicator (A Change From Low To High). */
  141. #define MSR_DCD_CHANGE 0x08 /* Bit 3: Delta Data Carrier Detect. */
  142. #define MSR_CTS 0x10 /* Bit 4: Clear To Send (Current State of CTS). */
  143. #define MSR_DSR 0x20 /* Bit 5: Data Set Ready (Current State of DSR). */
  144. #define MSR_RI 0x40 /* Bit 6: Ring Indicator (Current State of RI). */
  145. #define MSR_DCD 0x80 /* Bit 7: Data Carrier Detect (Current State of DCD). */
  146. /******************************************************************************
  147. * SR: Scratch Pad Register - READ/WRITE
  148. ******************************************************************************/
  149. #define SPR SCRATCH_PAD_REGISTER
  150. #define SPR_TX_BIT9 0x01 /* Bit 0: 9th Tx Data Bit (16C950 - 9 bit data mode only) */
  151. /******************************************************************************
  152. * Oxford Semiconductor's 16C950 UART Specific Macros
  153. ******************************************************************************/
  154. /******************************************************************************
  155. * 650 COMPATIBLE REGISTERS
  156. * To Access these registers LCR MUST be set to 0xBF
  157. ******************************************************************************/
  158. #define EFR 0x02 /* Enhanced Features Register. */
  159. /* Bits 0:1 In band transmit flow control mode. */
  160. /* 10.11.1999 ARG - ESIL 0927 */
  161. /* Definitions for Tx XON/XOFF bits in the EFR corrected to use bits 0:1 */
  162. #define EFR_TX_XON_XOFF_DISABLED 0x00 /* Bits 0:1 Transmit XON/XOFF Disabled. */
  163. #define EFR_TX_XON_XOFF_2 0x01 /* Bits 0:1 Transmit XON/XOFF Enabled using chars in XON2 and XOFF2 */
  164. #define EFR_TX_XON_XOFF_1 0x02 /* Bits 0:1 Transmit XON/XOFF Enabled using chars in XON1 and XOFF1 */
  165. /* Bits 2:3 In band receive flow control mode. */
  166. /* 10.11.1999 ARG - ESIL 0927 */
  167. /* Definitions for Rx XON/XOFF bits in the EFR corrected to use bits 2:3 */
  168. #define EFR_RX_XON_XOFF_DISABLED 0x00 /* Bits 2:3 Receive XON/XOFF Disabled. */
  169. #define EFR_RX_XON_XOFF_2 0x04 /* Bits 2:3 Receive XON/XOFF Enabled using chars in XON2 and XOFF2 */
  170. #define EFR_RX_XON_XOFF_1 0x08 /* Bits 2:3 Receive XON/XOFF Enabled using chars in XON1 and XOFF1 */
  171. #define EFR_ENH_MODE 0x10 /* Bit 4: Enable Enhanced Mode. */
  172. #define EFR_SPECIAL_CHR 0x20 /* Bit 5: Enable Special Character Detect. */
  173. #define EFR_RTS_FC 0x40 /* Bit 6: Enable Automatic RTS Flow Control. */
  174. #define EFR_CTS_FC 0x80 /* Bit 7: Enable Automatic CTS Flow Control. */
  175. #define XON1 0x04 /* XON Character 1 */
  176. #define XON2 0x05 /* XON Character 2 */
  177. #define XOFF1 0x06 /* XOFF Character 1 */
  178. #define XOFF2 0x07 /* XOFF Character 2 */
  179. #define SPECIAL_CHAR1 XON1 /* Special Character 1 (16C950 - 9 bit data mode only) */
  180. #define SPECIAL_CHAR2 XON2 /* Special Character 2 (16C950 - 9 bit data mode only) */
  181. #define SPECIAL_CHAR3 XOFF1 /* Special Character 3 (16C950 - 9 bit data mode only) */
  182. #define SPECIAL_CHAR4 XOFF2 /* Special Character 4 (16C950 - 9 bit data mode only) */
  183. /*****************************************************************************/
  184. /* 950 SPECIFIC REGISTERS */
  185. #define ASR 0x01 /* Advanced Status Register */
  186. #define ASR_TX_DISABLED 0x01 /* Transmitter Disabled By In-Band Flow Control (XOFF). */
  187. #define ASR_RTX_DISABLED 0x02 /* Remote Transmitter Disabled By In-Band Flow Control (XOFF). */
  188. #define ASR_RTS 0x04 /* Remote Transmitter Disabled By RTS Out-Of-Band Flow Ctrl. */
  189. #define ASR_DTR 0x08 /* Remote Transmitter Disabled By DTR Out-Of-Band Flow Ctrl. */
  190. #define ASR_SPECIAL_CHR 0x10 /* Special Character Detected in the RHR. */
  191. #define ASR_FIFO_SEL 0x20 /* Bit reflects the unlatched state of the FIFOSEL pin. */
  192. #define ASR_FIFO_SIZE 0x40 /* Bit not set: FIFOs are 16 Deep. Bit Set: FIFOs are 128 Deep */
  193. #define ASR_TX_IDLE 0x80 /* Transmitter is Idle. */
  194. /* Receiver FIFO Fill Level Register */
  195. #define RFL 0x03 /* Minimum characters in the Rx FIFO. */
  196. /* Transmitter FIFO Fill Level Register */
  197. #define TFL 0x04 /* Maximum characters in the Tx FIFO. */
  198. /* Indexed Control Register Set Access Register */
  199. #define ICR LINE_STATUS_REGISTER
  200. /*****************************************************************************/
  201. /*INDEXED CONTROL REGISTER SET OFFSETS */
  202. /* Advanced Control Register */
  203. #define ACR 0x00 /* Aditional Control Register. */
  204. #define ACR_DISABLE_RX 0x01 /* Receiver Disable. */
  205. #define ACR_DISABLE_TX 0x02 /* Tranmitter Disable. */
  206. #define ACR_DSR_FC 0x04 /* Enable Automatic DSR Flow Control */
  207. #define ACR_DTR_FC 0x08 /* Enable Automatic DTR Flow Control */
  208. #define ACR_DSRDTR_FC 0x0C /* Enable Automatic DSR/DTR Flow Control. */
  209. #define ACR_DTRDFN_MSK 0x18 /* */
  210. #define ACR_TRIG_LEV_EN 0x20 /* Enable 16950 Enhanced Interrupt & trig. levels defined by RTH, TTL, FCL & FCH. */
  211. #define ACR_ICR_READ_EN 0x40 /* Enables Read Accesss to the Indexed Control Registers. */
  212. #define ACR_ASR_EN 0x80 /* Additional Status Enable: Enables ASR, TFL, RFL. */
  213. /* Clock Prescaler Register */
  214. #define CPR 0x01 /* Clock Prescaler Register. */
  215. #define CPR_FRACT_MSK 0x07 /* Mask for fractional part of clock prescaler. */
  216. #define CPR_INTEGER_MSK 0xF8 /* Mask for integer part of clock prescaler. */
  217. #define TCR 0x02 /* Times Clock Register to operate at baud rates to 50Mbps. */
  218. #define CKS 0x03 /* Clock Select Register. */
  219. #define TTL 0x04 /* Transmitter Interrupt Trigger Level. */
  220. #define RTL 0x05 /* Receiver Interrupt Trigger Level. */
  221. #define FCL 0x06 /* Flow Control Lower Trigger Level. */
  222. #define FCH 0x07 /* Flow Control Higher Trigger Level. */
  223. /* Identification Registers */
  224. #define ID1 0x08 /* 0x16 for OX16C950 */
  225. #define ID2 0x09 /* 0xC9 for OX16C950 */
  226. #define ID3 0x0A /* 0x50 for OX16C950 */
  227. #define REV 0x0B /* UART Revision: 0x1 for integrated 16C950 in rev A of OX16PCI954. */
  228. #define UART_TYPE_950 0x00
  229. #define UART_TYPE_952 0x02
  230. #define UART_TYPE_954 0x04
  231. #define UART_TYPE_NON95x 0xF0
  232. #define UART_REV_A 0x00
  233. #define UART_REV_B 0x01
  234. #define UART_REV_C 0x02
  235. #define UART_REV_D 0x03
  236. /* Channel Soft Reset Register */
  237. #define CSR 0x0C /* Channel Soft Reset Register - Write 0x0 to reset the channel. */
  238. /* Nine-Bit Mode Register */
  239. #define NMR 0x0D /* Nine-Bit Mode Register */
  240. #define NMR_9BIT_EN 0x01 /* Enable 9-Bit mode. */
  241. #define MDM 0x0E /* Modem Disable Mask */
  242. #define RFC 0x0F /* Readable FCR. - Current state of FCR Register. */
  243. #define GDS 0x10 /* Good Data Status Register. */
  244. #define CTR 0xFF /* Register for Testing purposes only - Must not use. */
  245. /******************************************************************************/
  246. /* Local Configuration Register Offsets */
  247. #define LCC 0x00 /* Local Configuration and Control Regiseter */
  248. #define MIC 0x04 /* Multi-purpose IO Configuration Register */
  249. #define LT1 0x08 /* Local Bus Configuration Register 1 - Local Bus Timing Parameter Register. */
  250. #define LT2 0x0C /* Local Bus Configuration Register 2 - Local Bus Timing Parameter Register. */
  251. #define URL 0x10 /* UART Receiver FIFO Levels. */
  252. #define UTL 0x14 /* UART Transmitter FIFO Levels. */
  253. #define UIS 0x18 /* UART Interrupt Source Register. */
  254. #define GIS 0x1C /* Global Interrupt Status Register. */
  255. /* Supported 950s */
  256. #define MIN_SUPPORTED_950_REV UART_REV_A
  257. #define MAX_SUPPORTED_950_REV UART_REV_B
  258. /* Supported 952s */
  259. #define MIN_SUPPORTED_952_REV UART_REV_B
  260. #define MAX_SUPPORTED_952_REV UART_REV_B
  261. /* Supported 954s */
  262. #define MIN_SUPPORTED_954_REV UART_REV_A
  263. #define MAX_SUPPORTED_954_REV UART_REV_A
  264. /* Prototypes. */
  265. /* End of prototypes. */
  266. #endif /* End of 16CX5X.H */