2 * Copyright 2003 Digi International (www.digi.com)
3 * Scott H Kilau <Scott_Kilau at digi dot com>
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)
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.
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.
19 * $Id: digi.h,v 1.1 2009/10/23 14:01:57 markh Exp $
21 * NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
27 /************************************************************************
28 *** Definitions for Digi ditty(1) command.
29 ************************************************************************/
33 * Copyright (c) 1988-96 Digi International Inc., All Rights Reserved.
36 /************************************************************************
37 * This module provides application access to special Digi
38 * serial line enhancements which are not standard UNIX(tm) features.
39 ************************************************************************/
41 #if !defined(TIOCMODG)
43 #define TIOCMODG ('d'<<8) | 250 /* get modem ctrl state */
44 #define TIOCMODS ('d'<<8) | 251 /* set modem ctrl state */
47 #define TIOCM_LE 0x01 /* line enable */
48 #define TIOCM_DTR 0x02 /* data terminal ready */
49 #define TIOCM_RTS 0x04 /* request to send */
50 #define TIOCM_ST 0x08 /* secondary transmit */
51 #define TIOCM_SR 0x10 /* secondary receive */
52 #define TIOCM_CTS 0x20 /* clear to send */
53 #define TIOCM_CAR 0x40 /* carrier detect */
54 #define TIOCM_RNG 0x80 /* ring indicator */
55 #define TIOCM_DSR 0x100 /* data set ready */
56 #define TIOCM_RI TIOCM_RNG /* ring (alternate) */
57 #define TIOCM_CD TIOCM_CAR /* carrier detect (alt) */
62 #if !defined(TIOCMSET)
63 #define TIOCMSET ('d'<<8) | 252 /* set modem ctrl state */
64 #define TIOCMGET ('d'<<8) | 253 /* set modem ctrl state */
67 #if !defined(TIOCMBIC)
68 #define TIOCMBIC ('d'<<8) | 254 /* set modem ctrl state */
69 #define TIOCMBIS ('d'<<8) | 255 /* set modem ctrl state */
73 #if !defined(TIOCSDTR)
74 #define TIOCSDTR ('e'<<8) | 0 /* set DTR */
75 #define TIOCCDTR ('e'<<8) | 1 /* clear DTR */
78 /************************************************************************
79 * Ioctl command arguments for DIGI parameters.
80 ************************************************************************/
81 #define DIGI_GETA ('e'<<8) | 94 /* Read params */
83 #define DIGI_SETA ('e'<<8) | 95 /* Set params */
84 #define DIGI_SETAW ('e'<<8) | 96 /* Drain & set params */
85 #define DIGI_SETAF ('e'<<8) | 97 /* Drain, flush & set params */
87 #define DIGI_KME ('e'<<8) | 98 /* Read/Write Host */
90 #define DIGI_GETFLOW ('e'<<8) | 99 /* Get startc/stopc flow */
91 /* control characters */
92 #define DIGI_SETFLOW ('e'<<8) | 100 /* Set startc/stopc flow */
93 /* control characters */
94 #define DIGI_GETAFLOW ('e'<<8) | 101 /* Get Aux. startc/stopc */
95 /* flow control chars */
96 #define DIGI_SETAFLOW ('e'<<8) | 102 /* Set Aux. startc/stopc */
97 /* flow control chars */
99 #define DIGI_GEDELAY ('d'<<8) | 246 /* Get edelay */
100 #define DIGI_SEDELAY ('d'<<8) | 247 /* Set edelay */
103 unsigned char startc
; /* flow cntl start char */
104 unsigned char stopc
; /* flow cntl stop char */
109 #define F2200_GETA ('e'<<8) | 104 /* Get 2x36 flow cntl flags */
110 #define F2200_SETAW ('e'<<8) | 105 /* Set 2x36 flow cntl flags */
111 #define F2200_MASK 0x03 /* 2200 flow cntl bit mask */
112 #define FCNTL_2200 0x01 /* 2x36 terminal flow cntl */
113 #define PCNTL_2200 0x02 /* 2x36 printer flow cntl */
114 #define F2200_XON 0xf8
115 #define P2200_XON 0xf9
116 #define F2200_XOFF 0xfa
117 #define P2200_XOFF 0xfb
119 #define FXOFF_MASK 0x03 /* 2200 flow status mask */
120 #define RCVD_FXOFF 0x01 /* 2x36 Terminal XOFF rcvd */
121 #define RCVD_PXOFF 0x02 /* 2x36 Printer XOFF rcvd */
124 /************************************************************************
125 * Values for digi_flags
126 ************************************************************************/
127 #define DIGI_IXON 0x0001 /* Handle IXON in the FEP */
128 #define DIGI_FAST 0x0002 /* Fast baud rates */
129 #define RTSPACE 0x0004 /* RTS input flow control */
130 #define CTSPACE 0x0008 /* CTS output flow control */
131 #define DSRPACE 0x0010 /* DSR output flow control */
132 #define DCDPACE 0x0020 /* DCD output flow control */
133 #define DTRPACE 0x0040 /* DTR input flow control */
134 #define DIGI_COOK 0x0080 /* Cooked processing done in FEP */
135 #define DIGI_FORCEDCD 0x0100 /* Force carrier */
136 #define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
137 #define DIGI_AIXON 0x0400 /* Aux flow control in fep */
138 #define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/
139 #define DIGI_PP_INPUT 0x1000 /* Change parallel port to input*/
140 #define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */
141 #define DIGI_422 0x4000 /* for 422/232 selectable panel */
142 #define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */
144 /************************************************************************
145 * These options are not supported on the comxi.
146 ************************************************************************/
147 #define DIGI_COMXI (DIGI_FAST|DIGI_COOK|DSRPACE|DCDPACE|DTRPACE)
149 #define DIGI_PLEN 28 /* String length */
150 #define DIGI_TSIZ 10 /* Terminal string len */
152 /************************************************************************
153 * Structure used with ioctl commands for DIGI parameters.
154 ************************************************************************/
156 unsigned short digi_flags
; /* Flags (see above) */
157 unsigned short digi_maxcps
; /* Max printer CPS */
158 unsigned short digi_maxchar
; /* Max chars in print queue */
159 unsigned short digi_bufsize
; /* Buffer size */
160 unsigned char digi_onlen
; /* Length of ON string */
161 unsigned char digi_offlen
; /* Length of OFF string */
162 char digi_onstr
[DIGI_PLEN
]; /* Printer on string */
163 char digi_offstr
[DIGI_PLEN
]; /* Printer off string */
164 char digi_term
[DIGI_TSIZ
]; /* terminal string */
167 /************************************************************************
168 * KME definitions and structures.
169 ************************************************************************/
170 #define RW_IDLE 0 /* Operation complete */
171 #define RW_READ 1 /* Read Concentrator Memory */
172 #define RW_WRITE 2 /* Write Concentrator Memory */
175 unsigned char rw_req
; /* Request type */
176 unsigned char rw_board
; /* Host Adapter board number */
177 unsigned char rw_conc
; /* Concentrator number */
178 unsigned char rw_reserved
; /* Reserved for expansion */
179 unsigned long rw_addr
; /* Address in concentrator */
180 unsigned short rw_size
; /* Read/write request length */
181 unsigned char rw_data
[128]; /* Data to read/write */
184 /***********************************************************************
185 * Shrink Buffer and Board Information definitions and structures.
187 ************************************************************************/
188 /* Board type return codes */
189 #define PCXI_TYPE 1 /* Board type at the designated port is a PC/Xi */
190 #define PCXM_TYPE 2 /* Board type at the designated port is a PC/Xm */
191 #define PCXE_TYPE 3 /* Board type at the designated port is a PC/Xe */
192 #define MCXI_TYPE 4 /* Board type at the designated port is a MC/Xi */
193 #define COMXI_TYPE 5 /* Board type at the designated port is a COM/Xi */
195 /* Non-Zero Result codes. */
196 #define RESULT_NOBDFND 1 /* A Digi product at that port is not config installed */
197 #define RESULT_NODESCT 2 /* A memory descriptor was not obtainable */
198 #define RESULT_NOOSSIG 3 /* FEP/OS signature was not detected on the board */
199 #define RESULT_TOOSML 4 /* Too small an area to shrink. */
200 #define RESULT_NOCHAN 5 /* Channel structure for the board was not found */
202 struct shrink_buf_struct
{
203 unsigned long shrink_buf_vaddr
; /* Virtual address of board */
204 unsigned long shrink_buf_phys
; /* Physical address of board */
205 unsigned long shrink_buf_bseg
; /* Amount of board memory */
206 unsigned long shrink_buf_hseg
; /* '186 Beginning of Dual-Port */
208 unsigned long shrink_buf_lseg
; /* '186 Beginning of freed memory */
209 unsigned long shrink_buf_mseg
; /* Linear address from start of
210 dual-port were freed memory
211 begins, host viewpoint. */
213 unsigned long shrink_buf_bdparam
; /* Parameter for xxmemon and
216 unsigned long shrink_buf_reserva
; /* Reserved */
217 unsigned long shrink_buf_reservb
; /* Reserved */
218 unsigned long shrink_buf_reservc
; /* Reserved */
219 unsigned long shrink_buf_reservd
; /* Reserved */
221 unsigned char shrink_buf_result
; /* Reason for call failing
222 Zero is Good return */
223 unsigned char shrink_buf_init
; /* Non-Zero if it caused an
226 unsigned char shrink_buf_anports
; /* Number of async ports */
227 unsigned char shrink_buf_snports
; /* Number of sync ports */
228 unsigned char shrink_buf_type
; /* Board type 1 = PC/Xi,
233 unsigned char shrink_buf_card
; /* Card number */
237 /************************************************************************
238 * Structure to get driver status information
239 ************************************************************************/
241 unsigned long dinfo_nboards
; /* # boards configured */
242 char dinfo_reserved
[12]; /* for future expansion */
243 char dinfo_version
[16]; /* driver version */
246 #define DIGI_GETDD ('d'<<8) | 248 /* get driver info */
248 /************************************************************************
249 * Structure used with ioctl commands for per-board information
251 * physsize and memsize differ when board has "windowed" memory
252 ************************************************************************/
254 unsigned long info_bdnum
; /* Board number (0 based) */
255 unsigned long info_ioport
; /* io port address */
256 unsigned long info_physaddr
; /* memory address */
257 unsigned long info_physsize
; /* Size of host mem window */
258 unsigned long info_memsize
; /* Amount of dual-port mem */
260 unsigned short info_bdtype
; /* Board type */
261 unsigned short info_nports
; /* number of ports */
262 char info_bdstate
; /* board state */
263 char info_reserved
[7]; /* for future expansion */
266 #define DIGI_GETBD ('d'<<8) | 249 /* get board info */
269 unsigned int info_chan
; /* Channel number (0 based) */
270 unsigned int info_brd
; /* Board number (0 based) */
271 unsigned long info_cflag
; /* cflag for channel */
272 unsigned long info_iflag
; /* iflag for channel */
273 unsigned long info_oflag
; /* oflag for channel */
274 unsigned long info_mstat
; /* mstat for channel */
275 unsigned long info_tx_data
; /* tx_data for channel */
276 unsigned long info_rx_data
; /* rx_data for channel */
277 unsigned long info_hflow
; /* hflow for channel */
278 unsigned long info_reserved
[8]; /* for future expansion */
281 #define DIGI_GETSTAT ('d'<<8) | 244 /* get board info */
282 /************************************************************************
284 * Structure used with ioctl commands for per-channel information
286 ************************************************************************/
288 unsigned long info_bdnum
; /* Board number (0 based) */
289 unsigned long info_channel
; /* Channel index number */
290 unsigned long info_ch_cflag
; /* Channel cflag */
291 unsigned long info_ch_iflag
; /* Channel iflag */
292 unsigned long info_ch_oflag
; /* Channel oflag */
293 unsigned long info_chsize
; /* Channel structure size */
294 unsigned long info_sleep_stat
; /* sleep status */
295 dev_t info_dev
; /* device number */
296 unsigned char info_initstate
; /* Channel init state */
297 unsigned char info_running
; /* Channel running state */
298 long reserved
[8]; /* reserved for future use */
302 * This structure is used with the DIGI_FEPCMD ioctl to
303 * tell the driver which port to send the command for.
309 int chan
; /* channel index (zero based) */
310 int bdid
; /* board index (zero based) */
314 * info_sleep_stat defines
316 #define INFO_RUNWAIT 0x0001
317 #define INFO_WOPEN 0x0002
318 #define INFO_TTIOW 0x0004
319 #define INFO_CH_RWAIT 0x0008
320 #define INFO_CH_WEMPTY 0x0010
321 #define INFO_CH_WLOW 0x0020
322 #define INFO_XXBUF_BUSY 0x0040
324 #define DIGI_GETCH ('d'<<8) | 245 /* get board info */
326 /* Board type definitions */
334 #define T_SP_PLUS 0005
344 #define T_PCLITE 0040
348 #define T_A2K_4_8 0070
350 #define T_ISABUS 0000
352 #define T_EISABUS 0200
353 #define T_PCIBUS 0400
355 /* Board State Definitions */
357 #define BD_RUNNING 0x0
358 #define BD_REASON 0x7f
359 #define BD_NOTFOUND 0x1
360 #define BD_NOIOPORT 0x2
362 #define BD_NOBIOS 0x4
364 #define BD_FAILED 0x6
365 #define BD_ALLOCATED 0x7
366 #define BD_TRIBOOT 0x8
367 #define BD_BADKME 0x80
369 #define DIGI_LOOPBACK ('d'<<8) | 252 /* Enable/disable UART internal loopback */
370 #define DIGI_SPOLL ('d'<<8) | 254 /* change poller rate */
372 #define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */
373 #define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */
374 #define DIGI_RESET_PORT ('e'<<8) | 93 /* Reset port */