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.

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