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