digi.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. /*
  2. * Copyright 2003 Digi International (www.digi.com)
  3. * Scott H Kilau <Scott_Kilau at digi dot com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2, or (at your option)
  8. * any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
  12. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. * PURPOSE. See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. *
  19. * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
  20. */
  21. #ifndef __DIGI_H
  22. #define __DIGI_H
  23. /************************************************************************
  24. *** Definitions for Digi ditty(1) command.
  25. ************************************************************************/
  26. /*
  27. * Copyright (c) 1988-96 Digi International Inc., All Rights Reserved.
  28. */
  29. /************************************************************************
  30. * This module provides application access to special Digi
  31. * serial line enhancements which are not standard UNIX(tm) features.
  32. ************************************************************************/
  33. #if !defined(TIOCMODG)
  34. #define TIOCMODG ('d'<<8) | 250 /* get modem ctrl state */
  35. #define TIOCMODS ('d'<<8) | 251 /* set modem ctrl state */
  36. #ifndef TIOCM_LE
  37. #define TIOCM_LE 0x01 /* line enable */
  38. #define TIOCM_DTR 0x02 /* data terminal ready */
  39. #define TIOCM_RTS 0x04 /* request to send */
  40. #define TIOCM_ST 0x08 /* secondary transmit */
  41. #define TIOCM_SR 0x10 /* secondary receive */
  42. #define TIOCM_CTS 0x20 /* clear to send */
  43. #define TIOCM_CAR 0x40 /* carrier detect */
  44. #define TIOCM_RNG 0x80 /* ring indicator */
  45. #define TIOCM_DSR 0x100 /* data set ready */
  46. #define TIOCM_RI TIOCM_RNG /* ring (alternate) */
  47. #define TIOCM_CD TIOCM_CAR /* carrier detect (alt) */
  48. #endif
  49. #endif
  50. #if !defined(TIOCMSET)
  51. #define TIOCMSET ('d'<<8) | 252 /* set modem ctrl state */
  52. #define TIOCMGET ('d'<<8) | 253 /* set modem ctrl state */
  53. #endif
  54. #if !defined(TIOCMBIC)
  55. #define TIOCMBIC ('d'<<8) | 254 /* set modem ctrl state */
  56. #define TIOCMBIS ('d'<<8) | 255 /* set modem ctrl state */
  57. #endif
  58. #if !defined(TIOCSDTR)
  59. #define TIOCSDTR ('e'<<8) | 0 /* set DTR */
  60. #define TIOCCDTR ('e'<<8) | 1 /* clear DTR */
  61. #endif
  62. /************************************************************************
  63. * Ioctl command arguments for DIGI parameters.
  64. ************************************************************************/
  65. #define DIGI_GETA ('e'<<8) | 94 /* Read params */
  66. #define DIGI_SETA ('e'<<8) | 95 /* Set params */
  67. #define DIGI_SETAW ('e'<<8) | 96 /* Drain & set params */
  68. #define DIGI_SETAF ('e'<<8) | 97 /* Drain, flush & set params */
  69. #define DIGI_KME ('e'<<8) | 98 /* Read/Write Host */
  70. /* Adapter Memory */
  71. #define DIGI_GETFLOW ('e'<<8) | 99 /* Get startc/stopc flow */
  72. /* control characters */
  73. #define DIGI_SETFLOW ('e'<<8) | 100 /* Set startc/stopc flow */
  74. /* control characters */
  75. #define DIGI_GETAFLOW ('e'<<8) | 101 /* Get Aux. startc/stopc */
  76. /* flow control chars */
  77. #define DIGI_SETAFLOW ('e'<<8) | 102 /* Set Aux. startc/stopc */
  78. /* flow control chars */
  79. #define DIGI_GEDELAY ('d'<<8) | 246 /* Get edelay */
  80. #define DIGI_SEDELAY ('d'<<8) | 247 /* Set edelay */
  81. struct digiflow_t {
  82. unsigned char startc; /* flow cntl start char */
  83. unsigned char stopc; /* flow cntl stop char */
  84. };
  85. #ifdef FLOW_2200
  86. #define F2200_GETA ('e'<<8) | 104 /* Get 2x36 flow cntl flags */
  87. #define F2200_SETAW ('e'<<8) | 105 /* Set 2x36 flow cntl flags */
  88. #define F2200_MASK 0x03 /* 2200 flow cntl bit mask */
  89. #define FCNTL_2200 0x01 /* 2x36 terminal flow cntl */
  90. #define PCNTL_2200 0x02 /* 2x36 printer flow cntl */
  91. #define F2200_XON 0xf8
  92. #define P2200_XON 0xf9
  93. #define F2200_XOFF 0xfa
  94. #define P2200_XOFF 0xfb
  95. #define FXOFF_MASK 0x03 /* 2200 flow status mask */
  96. #define RCVD_FXOFF 0x01 /* 2x36 Terminal XOFF rcvd */
  97. #define RCVD_PXOFF 0x02 /* 2x36 Printer XOFF rcvd */
  98. #endif
  99. /************************************************************************
  100. * Values for digi_flags
  101. ************************************************************************/
  102. #define DIGI_IXON 0x0001 /* Handle IXON in the FEP */
  103. #define DIGI_FAST 0x0002 /* Fast baud rates */
  104. #define RTSPACE 0x0004 /* RTS input flow control */
  105. #define CTSPACE 0x0008 /* CTS output flow control */
  106. #define DSRPACE 0x0010 /* DSR output flow control */
  107. #define DCDPACE 0x0020 /* DCD output flow control */
  108. #define DTRPACE 0x0040 /* DTR input flow control */
  109. #define DIGI_COOK 0x0080 /* Cooked processing done in FEP */
  110. #define DIGI_FORCEDCD 0x0100 /* Force carrier */
  111. #define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
  112. #define DIGI_AIXON 0x0400 /* Aux flow control in fep */
  113. #define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/
  114. #define DIGI_PP_INPUT 0x1000 /* Change parallel port to input*/
  115. #define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */
  116. #define DIGI_422 0x4000 /* for 422/232 selectable panel */
  117. #define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */
  118. /************************************************************************
  119. * These options are not supported on the comxi.
  120. ************************************************************************/
  121. #define DIGI_COMXI (DIGI_FAST|DIGI_COOK|DSRPACE|DCDPACE|DTRPACE)
  122. #define DIGI_PLEN 28 /* String length */
  123. #define DIGI_TSIZ 10 /* Terminal string len */
  124. /************************************************************************
  125. * Structure used with ioctl commands for DIGI parameters.
  126. ************************************************************************/
  127. struct digi_t {
  128. unsigned short digi_flags; /* Flags (see above) */
  129. unsigned short digi_maxcps; /* Max printer CPS */
  130. unsigned short digi_maxchar; /* Max chars in print queue */
  131. unsigned short digi_bufsize; /* Buffer size */
  132. unsigned char digi_onlen; /* Length of ON string */
  133. unsigned char digi_offlen; /* Length of OFF string */
  134. char digi_onstr[DIGI_PLEN]; /* Printer on string */
  135. char digi_offstr[DIGI_PLEN]; /* Printer off string */
  136. char digi_term[DIGI_TSIZ]; /* terminal string */
  137. };
  138. /************************************************************************
  139. * KME definitions and structures.
  140. ************************************************************************/
  141. #define RW_IDLE 0 /* Operation complete */
  142. #define RW_READ 1 /* Read Concentrator Memory */
  143. #define RW_WRITE 2 /* Write Concentrator Memory */
  144. struct rw_t {
  145. unsigned char rw_req; /* Request type */
  146. unsigned char rw_board; /* Host Adapter board number */
  147. unsigned char rw_conc; /* Concentrator number */
  148. unsigned char rw_reserved; /* Reserved for expansion */
  149. unsigned int rw_addr; /* Address in concentrator */
  150. unsigned short rw_size; /* Read/write request length */
  151. unsigned char rw_data[128]; /* Data to read/write */
  152. };
  153. /***********************************************************************
  154. * Shrink Buffer and Board Information definitions and structures.
  155. ************************************************************************/
  156. /* Board type return codes */
  157. #define PCXI_TYPE 1 /* Board type at the designated port is a PC/Xi */
  158. #define PCXM_TYPE 2 /* Board type at the designated port is a PC/Xm */
  159. #define PCXE_TYPE 3 /* Board type at the designated port is a PC/Xe */
  160. #define MCXI_TYPE 4 /* Board type at the designated port is a MC/Xi */
  161. #define COMXI_TYPE 5 /* Board type at the designated port is a COM/Xi */
  162. /* Non-Zero Result codes. */
  163. #define RESULT_NOBDFND 1 /* A Digi product at that port is not config installed */
  164. #define RESULT_NODESCT 2 /* A memory descriptor was not obtainable */
  165. #define RESULT_NOOSSIG 3 /* FEP/OS signature was not detected on the board */
  166. #define RESULT_TOOSML 4 /* Too small an area to shrink. */
  167. #define RESULT_NOCHAN 5 /* Channel structure for the board was not found */
  168. struct shrink_buf_struct {
  169. unsigned int shrink_buf_vaddr; /* Virtual address of board */
  170. unsigned int shrink_buf_phys; /* Physical address of board */
  171. unsigned int shrink_buf_bseg; /* Amount of board memory */
  172. unsigned int shrink_buf_hseg; /* '186 Beginning of Dual-Port */
  173. unsigned int shrink_buf_lseg; /* '186 Beginning of freed memory */
  174. unsigned int shrink_buf_mseg; /* Linear address from start of
  175. dual-port were freed memory
  176. begins, host viewpoint. */
  177. unsigned int shrink_buf_bdparam; /* Parameter for xxmemon and
  178. xxmemoff */
  179. unsigned int shrink_buf_reserva; /* Reserved */
  180. unsigned int shrink_buf_reservb; /* Reserved */
  181. unsigned int shrink_buf_reservc; /* Reserved */
  182. unsigned int shrink_buf_reservd; /* Reserved */
  183. unsigned char shrink_buf_result; /* Reason for call failing
  184. Zero is Good return */
  185. unsigned char shrink_buf_init; /* Non-Zero if it caused an
  186. xxinit call. */
  187. unsigned char shrink_buf_anports; /* Number of async ports */
  188. unsigned char shrink_buf_snports; /* Number of sync ports */
  189. unsigned char shrink_buf_type; /* Board type 1 = PC/Xi,
  190. 2 = PC/Xm,
  191. 3 = PC/Xe
  192. 4 = MC/Xi
  193. 5 = COMX/i */
  194. unsigned char shrink_buf_card; /* Card number */
  195. };
  196. /************************************************************************
  197. * Structure to get driver status information
  198. ************************************************************************/
  199. struct digi_dinfo {
  200. unsigned int dinfo_nboards; /* # boards configured */
  201. char dinfo_reserved[12]; /* for future expansion */
  202. char dinfo_version[16]; /* driver version */
  203. };
  204. #define DIGI_GETDD ('d'<<8) | 248 /* get driver info */
  205. /************************************************************************
  206. * Structure used with ioctl commands for per-board information
  207. *
  208. * physsize and memsize differ when board has "windowed" memory
  209. ************************************************************************/
  210. struct digi_info {
  211. unsigned int info_bdnum; /* Board number (0 based) */
  212. unsigned int info_ioport; /* io port address */
  213. unsigned int info_physaddr; /* memory address */
  214. unsigned int info_physsize; /* Size of host mem window */
  215. unsigned int info_memsize; /* Amount of dual-port mem */
  216. /* on board */
  217. unsigned short info_bdtype; /* Board type */
  218. unsigned short info_nports; /* number of ports */
  219. char info_bdstate; /* board state */
  220. char info_reserved[7]; /* for future expansion */
  221. };
  222. #define DIGI_GETBD ('d'<<8) | 249 /* get board info */
  223. struct digi_stat {
  224. unsigned int info_chan; /* Channel number (0 based) */
  225. unsigned int info_brd; /* Board number (0 based) */
  226. unsigned int info_cflag; /* cflag for channel */
  227. unsigned int info_iflag; /* iflag for channel */
  228. unsigned int info_oflag; /* oflag for channel */
  229. unsigned int info_mstat; /* mstat for channel */
  230. unsigned int info_tx_data; /* tx_data for channel */
  231. unsigned int info_rx_data; /* rx_data for channel */
  232. unsigned int info_hflow; /* hflow for channel */
  233. unsigned int info_reserved[8]; /* for future expansion */
  234. };
  235. #define DIGI_GETSTAT ('d'<<8) | 244 /* get board info */
  236. /************************************************************************
  237. *
  238. * Structure used with ioctl commands for per-channel information
  239. *
  240. ************************************************************************/
  241. struct digi_ch {
  242. unsigned int info_bdnum; /* Board number (0 based) */
  243. unsigned int info_channel; /* Channel index number */
  244. unsigned int info_ch_cflag; /* Channel cflag */
  245. unsigned int info_ch_iflag; /* Channel iflag */
  246. unsigned int info_ch_oflag; /* Channel oflag */
  247. unsigned int info_chsize; /* Channel structure size */
  248. unsigned int info_sleep_stat; /* sleep status */
  249. dev_t info_dev; /* device number */
  250. unsigned char info_initstate; /* Channel init state */
  251. unsigned char info_running; /* Channel running state */
  252. int reserved[8]; /* reserved for future use */
  253. };
  254. /*
  255. * This structure is used with the DIGI_FEPCMD ioctl to
  256. * tell the driver which port to send the command for.
  257. */
  258. struct digi_cmd {
  259. int cmd;
  260. int word;
  261. int ncmds;
  262. int chan; /* channel index (zero based) */
  263. int bdid; /* board index (zero based) */
  264. };
  265. struct digi_getbuffer /* Struct for holding buffer use counts */
  266. {
  267. unsigned long tIn;
  268. unsigned long tOut;
  269. unsigned long rxbuf;
  270. unsigned long txbuf;
  271. unsigned long txdone;
  272. };
  273. struct digi_getcounter {
  274. unsigned long norun; /* number of UART overrun errors */
  275. unsigned long noflow; /* number of buffer overflow errors */
  276. unsigned long nframe; /* number of framing errors */
  277. unsigned long nparity; /* number of parity errors */
  278. unsigned long nbreak; /* number of breaks received */
  279. unsigned long rbytes; /* number of received bytes */
  280. unsigned long tbytes; /* number of bytes transmitted fully */
  281. };
  282. /*
  283. * info_sleep_stat defines
  284. */
  285. #define INFO_RUNWAIT 0x0001
  286. #define INFO_WOPEN 0x0002
  287. #define INFO_TTIOW 0x0004
  288. #define INFO_CH_RWAIT 0x0008
  289. #define INFO_CH_WEMPTY 0x0010
  290. #define INFO_CH_WLOW 0x0020
  291. #define INFO_XXBUF_BUSY 0x0040
  292. #define DIGI_GETCH ('d'<<8) | 245 /* get board info */
  293. /* Board type definitions */
  294. #define SUBTYPE 0007
  295. #define T_PCXI 0000
  296. #define T_PCXM 0001
  297. #define T_PCXE 0002
  298. #define T_PCXR 0003
  299. #define T_SP 0004
  300. #define T_SP_PLUS 0005
  301. # define T_HERC 0000
  302. # define T_HOU 0001
  303. # define T_LON 0002
  304. # define T_CHA 0003
  305. #define FAMILY 0070
  306. #define T_COMXI 0000
  307. #define T_PCXX 0010
  308. #define T_CX 0020
  309. #define T_EPC 0030
  310. #define T_PCLITE 0040
  311. #define T_SPXX 0050
  312. #define T_AVXX 0060
  313. #define T_DXB 0070
  314. #define T_A2K_4_8 0070
  315. #define BUSTYPE 0700
  316. #define T_ISABUS 0000
  317. #define T_MCBUS 0100
  318. #define T_EISABUS 0200
  319. #define T_PCIBUS 0400
  320. /* Board State Definitions */
  321. #define BD_RUNNING 0x0
  322. #define BD_REASON 0x7f
  323. #define BD_NOTFOUND 0x1
  324. #define BD_NOIOPORT 0x2
  325. #define BD_NOMEM 0x3
  326. #define BD_NOBIOS 0x4
  327. #define BD_NOFEP 0x5
  328. #define BD_FAILED 0x6
  329. #define BD_ALLOCATED 0x7
  330. #define BD_TRIBOOT 0x8
  331. #define BD_BADKME 0x80
  332. #define DIGI_SPOLL ('d'<<8) | 254 /* change poller rate */
  333. #define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */
  334. #define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */
  335. #define DIGI_REALPORT_GETBUFFERS ('e'<<8) | 108
  336. #define DIGI_REALPORT_SENDIMMEDIATE ('e'<<8) | 109
  337. #define DIGI_REALPORT_GETCOUNTERS ('e'<<8) | 110
  338. #define DIGI_REALPORT_GETEVENTS ('e'<<8) | 111
  339. #define EV_OPU 0x0001 /* !<Output paused by client */
  340. #define EV_OPS 0x0002 /* !<Output paused by reqular sw flowctrl */
  341. #define EV_OPX 0x0004 /* !<Output paused by extra sw flowctrl */
  342. #define EV_OPH 0x0008 /* !<Output paused by hw flowctrl */
  343. #define EV_OPT 0x0800 /* !<Output paused for RTS Toggle predelay */
  344. #define EV_IPU 0x0010 /* !<Input paused unconditionally by user */
  345. #define EV_IPS 0x0020 /* !<Input paused by high/low water marks */
  346. #define EV_IPA 0x0400 /* !<Input paused by pattern alarm module */
  347. #define EV_TXB 0x0040 /* !<Transmit break pending */
  348. #define EV_TXI 0x0080 /* !<Transmit immediate pending */
  349. #define EV_TXF 0x0100 /* !<Transmit flowctrl char pending */
  350. #define EV_RXB 0x0200 /* !<Break received */
  351. #define EV_OPALL 0x080f /* !<Output pause flags */
  352. #define EV_IPALL 0x0430 /* !<Input pause flags */
  353. #endif /* DIGI_H */