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.

218 lines
6.0 KiB

  1. /*--------------------------------------------------------------------------
  2. *
  3. * Copyright (C) Cyclades Corporation, 1996-2001.
  4. * All rights reserved.
  5. *
  6. * Cyclom-Y Bus/Port Driver
  7. *
  8. * This file: cd1400.h
  9. *
  10. * Description: This file contains the Cirrus CD1400 serial
  11. * controller related contants, macros, addresses,
  12. * etc.
  13. *
  14. * Notes: This code supports Windows 2000 and Windows XP,
  15. * x86 and ia64 processors.
  16. *
  17. * Complies with Cyclades SW Coding Standard rev 1.3.
  18. *
  19. *--------------------------------------------------------------------------
  20. */
  21. /*-------------------------------------------------------------------------
  22. *
  23. * Change History
  24. *
  25. *--------------------------------------------------------------------------
  26. *
  27. *
  28. *--------------------------------------------------------------------------
  29. */
  30. #ifndef CD1400
  31. #define CD1400 1
  32. /* max number of chars in the FIFO */
  33. #define MAX_CHAR_FIFO (12)
  34. /* Firmware Revision Code */
  35. #define REV_G 0x46
  36. /* CD1400 registers */
  37. /* Global Registers */
  38. #define GFRCR (2 * 0x40)
  39. #define CAR (2 * 0x68)
  40. #define GCR (2 * 0x4b)
  41. #define SVRR (2 * 0x67)
  42. #define RICR (2 * 0x44)
  43. #define TICR (2 * 0x45)
  44. #define MICR (2 * 0x46)
  45. #define RIR (2 * 0x6b)
  46. #define TIR (2 * 0x6a)
  47. #define MIR (2 * 0x69)
  48. #define PPR (2 * 0x7e)
  49. /* Virtual Registers */
  50. #define RIVR (2 * 0x43)
  51. #define TIVR (2 * 0x42)
  52. #define MIVR (2 * 0x41)
  53. #define TDR (2 * 0x63)
  54. #define RDSR (2 * 0x62)
  55. #define MISR (2 * 0x4c)
  56. #define EOSRR (2 * 0x60)
  57. /* Channel Registers */
  58. #define LIVR (2 * 0x18)
  59. #define CCR (2 * 0x05)
  60. #define SRER (2 * 0x06)
  61. #define COR1 (2 * 0x08)
  62. #define COR2 (2 * 0x09)
  63. #define COR3 (2 * 0x0a)
  64. #define COR4 (2 * 0x1e)
  65. #define COR5 (2 * 0x1f)
  66. #define CCSR (2 * 0x0b)
  67. #define RDCR (2 * 0x0e)
  68. #define SCHR1 (2 * 0x1a)
  69. #define SCHR2 (2 * 0x1b)
  70. #define SCHR3 (2 * 0x1c)
  71. #define SCHR4 (2 * 0x1d)
  72. #define SCRL (2 * 0x22)
  73. #define SCRH (2 * 0x23)
  74. #define LNC (2 * 0x24)
  75. #define MCOR1 (2 * 0x15)
  76. #define MCOR2 (2 * 0x16)
  77. #define RTPR (2 * 0x21)
  78. #define MSVR1 (2 * 0x6c)
  79. #define MSVR2 (2 * 0x6d)
  80. #define PVSR (2 * 0x6f)
  81. #define RBPR (2 * 0x78)
  82. #define RCOR (2 * 0x7c)
  83. #define TBPR (2 * 0x72)
  84. #define TCOR (2 * 0x76)
  85. /* Register Settings */
  86. /* Channel Access Register (CAR) */
  87. #define CHAN0 0x00
  88. #define CHAN1 0x01
  89. #define CHAN2 0x02
  90. #define CHAN3 0x03
  91. /* Channel Option Register 1 (COR1) */
  92. #define COR1_NONE_PARITY 0x10
  93. #define COR1_ODD_PARITY 0xc0
  94. #define COR1_EVEN_PARITY 0x40
  95. #define COR1_MARK_PARITY 0xb0
  96. #define COR1_SPACE_PARITY 0x30
  97. #define COR1_PARITY_MASK 0xf0
  98. #define COR1_PARITY_ENABLE_MASK 0x60
  99. #define COR1_1_STOP 0x00
  100. #define COR1_1_5_STOP 0x04
  101. #define COR1_2_STOP 0x08
  102. #define COR1_STOP_MASK 0x0c
  103. #define COR1_5_DATA 0x00
  104. #define COR1_6_DATA 0x01
  105. #define COR1_7_DATA 0x02
  106. #define COR1_8_DATA 0x03
  107. #define COR1_DATA_MASK 0x03
  108. /* Channel Option Register 2 (COR2) */
  109. #define IMPL_XON 0x80
  110. #define AUTO_TXFL 0x40
  111. #define EMBED_TX_ENABLE 0x20
  112. #define LOCAL_LOOP_BCK 0x10
  113. #define REMOTE_LOOP_BCK 0x08
  114. #define RTS_AUT_OUTPUT 0x04
  115. #define CTS_AUT_ENABLE 0x02
  116. /* Channel Option Register 3 (COR3) */
  117. #define SPL_CH_DRANGE 0x80 /* special character detect range */
  118. #define SPL_CH_DET1 0x40 /* enable special char. detect on SCHR4-SCHR3 */
  119. #define FL_CTRL_TRNSP 0x20 /* Flow Control Transparency */
  120. #define SPL_CH_DET2 0x10 /* Enable spl char. detect on SCHR2-SCHR1 */
  121. #define REC_FIFO_12CH 0x0c /* Receive FIFO threshold= 12 chars */
  122. /* Global Configuration Register (GCR) values */
  123. #define GCR_CH0_IS_SERIAL 0x00
  124. /* Prescaler Period Register (PPR) values */
  125. #define CLOCK_20_1MS 0x27
  126. #define CLOCK_25_1MS 0x31
  127. #define CLOCK_60_1MS 0x75
  128. /* Channel Command Register (CCR) values */
  129. #define CCR_RESET_CHANNEL 0x80
  130. #define CCR_RESET_CD1400 0x81
  131. #define CCR_FLUSH_TXFIFO 0x82
  132. #define CCR_CORCHG_COR1 0x42
  133. #define CCR_CORCHG_COR2 0x44
  134. #define CCR_CORCHG_COR1_COR2 0x46
  135. #define CCR_CORCHG_COR3 0x48
  136. #define CCR_CORCHG_COR3_COR1 0x4a
  137. #define CCR_CORCHG_COR3_COR2 0x4c
  138. #define CCR_CORCHG_COR1_COR2_COR3 0x4e
  139. #define CCR_SENDSC_SCHR1 0x21
  140. #define CCR_SENDSC_SCHR2 0x22
  141. #define CCR_SENDSC_SCHR3 0x23
  142. #define CCR_SENDSC_SCHR4 0x24
  143. #define CCR_DIS_RX 0x11
  144. #define CCR_ENA_RX 0x12
  145. #define CCR_DIS_TX 0x14
  146. #define CCR_ENA_TX 0x18
  147. #define CCR_DIS_TX_RX 0x15
  148. #define CCR_DIS_TX_ENA_RX 0x16
  149. #define CCR_ENA_TX_DIS_RX 0x19
  150. #define CCR_ENA_TX_RX 0x1a
  151. /* Service Request Enable Register (SRER) values */
  152. #define SRER_TXRDY 0x04
  153. #define SRER_TXMPTY 0x02
  154. // Read from CD1400 registers
  155. #define CD1400_READ(ChipAddress,IsPci,Register) \
  156. (READ_REGISTER_UCHAR((ChipAddress)+((Register)<<(IsPci))))
  157. // Write to CD1400 registers
  158. #define CD1400_WRITE(ChipAddress,IsPci,Register,Value) \
  159. do \
  160. { \
  161. WRITE_REGISTER_UCHAR( \
  162. (ChipAddress)+ ((Register) << (IsPci)), \
  163. (UCHAR)(Value) \
  164. ); \
  165. } while (0);
  166. #define CD1400_DISABLE_ALL_INTERRUPTS(ChipAddress,IsPci,CdChannel) \
  167. do \
  168. { \
  169. CD1400_WRITE((ChipAddress),(IsPci),CAR,(CdChannel & 0x03)); \
  170. CD1400_WRITE((ChipAddress),(IsPci),SRER,0x00); \
  171. \
  172. } while (0);
  173. #endif /* CD1400 */
  174.