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.

288 lines
11 KiB

  1. /*----------------------------------------------------------------------*
  2. * zfwint.h: Cyclom-Z asynchronous interface definition. *
  3. * *
  4. * rev 2.0 12/13/95 Marcio Saito Cyclom-Z interface definition. *
  5. * rev 2.1 03/13/96 Marcio Saito minor changes. *
  6. * rev 2.2 05/29/96 Marcio Saito parity/frame error interrupts. *
  7. * Acknolowdge interrupt mode. *
  8. * Break on/off. Data structures *
  9. * converted to ulong to avoid *
  10. * alignment problems. *
  11. * rev 2.3 07/12/96 Marcio Saito HW flow control changes. Flush *
  12. * buffer command added. Loopback *
  13. * operation. *
  14. * rev 2.4 07/16/96 Marcio Saito Diag counters added to CH_CTRL. *
  15. * rev 2.5 03/21/97 Marcio Saito Added INTBACK2 *
  16. * rez 3.0 06/04/97 Ivan Passos Added OVR_ERROR and RXOVF *
  17. *----------------------------------------------------------------------*/
  18. /*
  19. * This file contains the definitions for interfacing with the
  20. * Cyclom-Z ZFIRM Firmware.
  21. */
  22. /* General Constant definitions */
  23. #define MAX_CHAN 64 /* max number of channels per board */
  24. #define MAX_SEX 4
  25. #define ZO_NPORTS (MAX_CHAN / 8)
  26. /* firmware id structure (set after boot) */
  27. #define ID_ADDRESS 0x00000180L /* signature/pointer address */
  28. #define ZFIRM_ID 0x5557465AL /* ZFIRM/U signature */
  29. #define ZFIRM_HLT 0x59505B5CL /* Halt signal (due to power supply issue) */
  30. #define ZFIRM_RST 0x56040674L /* RST signal (due to FW reset) */
  31. #define ZF_TINACT_DEF 1000 /* default inactivity timeout (1000 ms) */
  32. struct FIRM_ID {
  33. uclong signature; /* ZFIRM/U signature */
  34. uclong zfwctrl_addr; /* pointer to ZFW_CTRL structure */
  35. };
  36. /* Op. System id */
  37. #define C_OS_SVR3 0x00000010 /* generic SVR3 */
  38. #define C_OS_XENIX 0x00000011 /* SCO UNIX SVR3.2 */
  39. #define C_OS_SCO 0x00000012 /* SCO UNIX SVR3.2 */
  40. #define C_OS_SVR4 0x00000020 /* generic SVR4 */
  41. #define C_OS_UXWARE 0x00000021 /* UnixWare */
  42. #define C_OS_LINUX 0x00000030 /* generic Linux system */
  43. #define C_OS_SOLARIS 0x00000040 /* generic Solaris system */
  44. #define C_OS_BSD 0x00000050 /* generic BSD system */
  45. #define C_OS_DOS 0x00000070 /* generic DOS system */
  46. #define C_OS_NT 0x00000080 /* generic NT system */
  47. #define C_OS_OS2 0x00000090 /* generic OS/2 system */
  48. #define C_OS_MAC_OS 0x000000a0 /* MAC/OS */
  49. #define C_OS_AIX 0x000000b0 /* IBM AIX */
  50. /* channel op_mode */
  51. #define C_CH_DISABLE 0x00000000 /* channel is disabled */
  52. #define C_CH_TXENABLE 0x00000001 /* channel Tx enabled */
  53. #define C_CH_RXENABLE 0x00000002 /* channel Rx enabled */
  54. #define C_CH_ENABLE 0x00000003 /* channel Tx/Rx enabled */
  55. #define C_CH_LOOPBACK 0x00000004 /* Loopback mode */
  56. /* comm_parity - parity */
  57. #define C_PR_NONE 0x00000000 /* None */
  58. #define C_PR_ODD 0x00000001 /* Odd */
  59. #define C_PR_EVEN 0x00000002 /* Even */
  60. #define C_PR_MARK 0x00000004 /* Mark */
  61. #define C_PR_SPACE 0x00000008 /* Space */
  62. #define C_PR_PARITY 0x000000ff
  63. #define C_PR_DISCARD 0x00000100 /* discard char with frame/par error */
  64. #define C_PR_IGNORE 0x00000200 /* ignore frame/par error */
  65. /* comm_data_l - data length and stop bits */
  66. #define C_DL_CS5 0x00000001
  67. #define C_DL_CS6 0x00000002
  68. #define C_DL_CS7 0x00000004
  69. #define C_DL_CS8 0x00000008
  70. #define C_DL_CS 0x0000000f
  71. #define C_DL_1STOP 0x00000010
  72. #define C_DL_15STOP 0x00000020
  73. #define C_DL_2STOP 0x00000040
  74. #define C_DL_STOP 0x000000f0
  75. /* comm_data_l - data length and stop bits */
  76. #define C_CF_NOFIFO 0x00000001
  77. /* interrupt enabling/status */
  78. #define C_IN_DISABLE 0x00000000 /* zero, disable interrupts */
  79. #define C_IN_TXBEMPTY 0x00000001 /* tx buffer empty */
  80. #define C_IN_TXLOWWM 0x00000002 /* tx buffer below LWM */
  81. #define C_IN_TXFEMPTY 0x00000004 /* tx buffer + FIFO + shift reg. empty */
  82. #define C_IN_RXHIWM 0x00000010 /* rx buffer above HWM */
  83. #define C_IN_RXNNDT 0x00000020 /* rx no new data timeout */
  84. #define C_IN_MDCD 0x00000100 /* modem DCD change */
  85. #define C_IN_MDSR 0x00000200 /* modem DSR change */
  86. #define C_IN_MRI 0x00000400 /* modem RI change */
  87. #define C_IN_MCTS 0x00000800 /* modem CTS change */
  88. #define C_IN_RXBRK 0x00001000 /* Break received */
  89. #define C_IN_PR_ERROR 0x00002000 /* parity error */
  90. #define C_IN_FR_ERROR 0x00004000 /* frame error */
  91. #define C_IN_OVR_ERROR 0x00008000 /* overrun error */
  92. #define C_IN_RXOFL 0x00010000 /* RX buffer overflow */
  93. #define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */
  94. #define C_IN_MRTS 0x00040000 /* modem RTS drop */
  95. #define C_IN_ICHAR 0x00080000 /* special intr. char received */
  96. /* flow control */
  97. #define C_FL_OXX 0x00000001 /* output Xon/Xoff flow control */
  98. #define C_FL_IXX 0x00000002 /* input Xon/Xoff flow control */
  99. #define C_FL_OIXANY 0x00000004 /* output Xon/Xoff (any xon) */
  100. #define C_FL_SWFLOW 0x0000000f
  101. /* flow status */
  102. #define C_FS_TXIDLE 0x00000000 /* no Tx data in the buffer or UART */
  103. #define C_FS_SENDING 0x00000001 /* UART is sending data */
  104. #define C_FS_SWFLOW 0x00000002 /* Tx is stopped by received Xoff */
  105. /* rs_control/rs_status RS-232 signals */
  106. #define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in
  107. IOCTLM command */
  108. #define C_RS_RTS 0x00000001 /* RTS */
  109. #define C_RS_DTR 0x00000004 /* DTR */
  110. #define C_RS_DCD 0x00000100 /* CD */
  111. #define C_RS_DSR 0x00000200 /* DSR */
  112. #define C_RS_RI 0x00000400 /* RI */
  113. #define C_RS_CTS 0x00000800 /* CTS */
  114. /* commands Host <-> Board */
  115. #define C_CM_RESET 0x01 /* resets/flushes buffers */
  116. #define C_CM_IOCTL 0x02 /* re-reads CH_CTRL */
  117. #define C_CM_IOCTLW 0x03 /* re-reads CH_CTRL, intr when done */
  118. #define C_CM_IOCTLM 0x04 /* RS-232 outputs change */
  119. #define C_CM_SENDXOFF 0x10 /* sends Xoff */
  120. #define C_CM_SENDXON 0x11 /* sends Xon */
  121. #define C_CM_CLFLOW 0x12 /* Clears flow control (resume) */
  122. #define C_CM_SENDBRK 0x41 /* sends break */
  123. #define C_CM_INTBACK 0x42 /* Interrupt back */
  124. #define C_CM_SET_BREAK 0x43 /* Tx break on */
  125. #define C_CM_CLR_BREAK 0x44 /* Tx break off */
  126. #define C_CM_CMD_DONE 0x45 /* Previous command done */
  127. #define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */
  128. #define C_CM_TINACT 0x51 /* sets inactivity detection */
  129. #define C_CM_IRQ_ENBL 0x52 /* enables generation of interrupts */
  130. #define C_CM_IRQ_DSBL 0x53 /* disables generation of interrupts */
  131. #define C_CM_ACK_ENBL 0x54 /* enables acknolowdged interrupt mode */
  132. #define C_CM_ACK_DSBL 0x55 /* disables acknolowdged intr mode */
  133. #define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */
  134. #define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */
  135. #define C_CM_Q_ENABLE 0x58 /* enables queue access from the driver */
  136. #define C_CM_Q_DISABLE 0x59 /* disables queue access from the driver */
  137. #define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */
  138. #define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */
  139. #define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */
  140. #define C_CM_RXNNDT 0x63 /* rx no new data timeout */
  141. #define C_CM_TXFEMPTY 0x64 /* Tx buffer, FIFO and shift reg. are empty */
  142. #define C_CM_ICHAR 0x65 /* Special Interrupt Character received */
  143. #define C_CM_MDCD 0x70 /* modem DCD change */
  144. #define C_CM_MDSR 0x71 /* modem DSR change */
  145. #define C_CM_MRI 0x72 /* modem RI change */
  146. #define C_CM_MCTS 0x73 /* modem CTS change */
  147. #define C_CM_MRTS 0x74 /* modem RTS drop */
  148. #define C_CM_RXBRK 0x84 /* Break received */
  149. #define C_CM_PR_ERROR 0x85 /* Parity error */
  150. #define C_CM_FR_ERROR 0x86 /* Frame error */
  151. #define C_CM_OVR_ERROR 0x87 /* Overrun error */
  152. #define C_CM_RXOFL 0x88 /* RX buffer overflow */
  153. #define C_CM_CMDERROR 0x90 /* command error */
  154. #define C_CM_FATAL 0x91 /* fatal error */
  155. #define C_CM_HW_RESET 0x92 /* reset board */
  156. /*
  157. * CH_CTRL - This per port structure contains all parameters
  158. * that control an specific port. It can be seen as the
  159. * configuration registers of a "super-serial-controller".
  160. */
  161. struct CH_CTRL {
  162. uclong op_mode; /* operation mode */
  163. uclong intr_enable; /* interrupt masking for the UART */
  164. uclong sw_flow; /* SW flow control */
  165. uclong flow_status; /* output flow status */
  166. uclong comm_baud; /* baud rate - numerically specified */
  167. uclong comm_parity; /* parity */
  168. uclong comm_data_l; /* data length/stop */
  169. uclong comm_flags; /* other flags */
  170. uclong hw_flow; /* HW flow control */
  171. uclong rs_control; /* RS-232 outputs */
  172. uclong rs_status; /* RS-232 inputs */
  173. uclong flow_xon; /* xon char */
  174. uclong flow_xoff; /* xoff char */
  175. uclong hw_overflow; /* hw overflow counter */
  176. uclong sw_overflow; /* sw overflow counter */
  177. uclong comm_error; /* frame/parity error counter */
  178. uclong ichar; /* special interrupt char */
  179. uclong filler[7]; /* filler to align structures */
  180. };
  181. /*
  182. * BUF_CTRL - This per channel structure contains
  183. * all Tx and Rx buffer control for a given channel.
  184. */
  185. struct BUF_CTRL {
  186. uclong flag_dma; /* buffers are in Host memory */
  187. uclong tx_bufaddr; /* address of the tx buffer */
  188. uclong tx_bufsize; /* tx buffer size */
  189. uclong tx_threshold; /* tx low water mark */
  190. uclong tx_get; /* tail index tx buf */
  191. uclong tx_put; /* head index tx buf */
  192. uclong rx_bufaddr; /* address of the rx buffer */
  193. uclong rx_bufsize; /* rx buffer size */
  194. uclong rx_threshold; /* rx high water mark */
  195. uclong rx_get; /* tail index rx buf */
  196. uclong rx_put; /* head index rx buf */
  197. uclong filler[5]; /* filler to align structures */
  198. };
  199. /*
  200. * BOARD_CTRL - This per board structure contains all global
  201. * control fields related to the board.
  202. */
  203. struct BOARD_CTRL {
  204. /* static info provided by the on-board CPU */
  205. uclong n_channel; /* number of channels */
  206. uclong fw_version; /* firmware version */
  207. /* static info provided by the driver */
  208. uclong op_system; /* op_system id */
  209. uclong dr_version; /* driver version */
  210. /* board control area */
  211. uclong inactivity; /* inactivity control */
  212. /* host to FW commands */
  213. uclong hcmd_channel; /* channel number */
  214. uclong hcmd_param; /* parameter */
  215. /* FW to Host commands */
  216. uclong fwcmd_channel; /* channel number */
  217. uclong fwcmd_param; /* parameter */
  218. uclong zf_int_queue_addr; /* offset for INT_QUEUE structure */
  219. /* filler so the structures are aligned */
  220. uclong filler[6];
  221. };
  222. /* Host Interrupt Queue */
  223. #define QUEUE_SIZE (10*MAX_CHAN)
  224. struct INT_QUEUE {
  225. unsigned char intr_code[QUEUE_SIZE];
  226. unsigned long channel[QUEUE_SIZE];
  227. unsigned long param[QUEUE_SIZE];
  228. unsigned long put;
  229. unsigned long get;
  230. };
  231. /*
  232. * ZFW_CTRL - This is the data structure that includes all other
  233. * data structures used by the Firmware.
  234. */
  235. struct ZFW_CTRL {
  236. struct BOARD_CTRL board_ctrl;
  237. struct CH_CTRL ch_ctrl[MAX_CHAN];
  238. struct BUF_CTRL buf_ctrl[MAX_CHAN];
  239. };
  240.