Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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
16#ifndef _DIGI_H
17#define _DIGI_H
18
19#ifndef TIOCM_LE
20#define TIOCM_LE 0x01 /* line enable */
21#define TIOCM_DTR 0x02 /* data terminal ready */
22#define TIOCM_RTS 0x04 /* request to send */
23#define TIOCM_ST 0x08 /* secondary transmit */
24#define TIOCM_SR 0x10 /* secondary receive */
25#define TIOCM_CTS 0x20 /* clear to send */
26#define TIOCM_CAR 0x40 /* carrier detect */
27#define TIOCM_RNG 0x80 /* ring indicator */
28#define TIOCM_DSR 0x100 /* data set ready */
29#define TIOCM_RI TIOCM_RNG /* ring (alternate) */
30#define TIOCM_CD TIOCM_CAR /* carrier detect (alt) */
31#endif
32
33#if !defined(TIOCMSET)
34#define TIOCMSET (('d' << 8) | 252) /* set modem ctrl state */
35#define TIOCMGET (('d' << 8) | 253) /* set modem ctrl state */
36#endif
37
38#if !defined(TIOCMBIC)
39#define TIOCMBIC (('d' << 8) | 254) /* set modem ctrl state */
40#define TIOCMBIS (('d' << 8) | 255) /* set modem ctrl state */
41#endif
42
43#define DIGI_GETA (('e' << 8) | 94) /* Read params */
44#define DIGI_SETA (('e' << 8) | 95) /* Set params */
45#define DIGI_SETAW (('e' << 8) | 96) /* Drain & set params */
46#define DIGI_SETAF (('e' << 8) | 97) /* Drain, flush & set params */
47#define DIGI_GET_NI_INFO (('d' << 8) | 250) /* Non-intelligent state info */
48#define DIGI_LOOPBACK (('d' << 8) | 252) /* Enable/disable UART
49 * internal loopback
50 */
51#define DIGI_FAST 0x0002 /* Fast baud rates */
52#define RTSPACE 0x0004 /* RTS input flow control */
53#define CTSPACE 0x0008 /* CTS output flow control */
54#define DIGI_COOK 0x0080 /* Cooked processing done in FEP */
55#define DIGI_FORCEDCD 0x0100 /* Force carrier */
56#define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
57#define DIGI_PRINTER 0x0800 /* Hold port open for flow cntrl*/
58#define DIGI_DTR_TOGGLE 0x2000 /* Support DTR Toggle */
59#define DIGI_RTS_TOGGLE 0x8000 /* Support RTS Toggle */
60#define DIGI_PLEN 28 /* String length */
61#define DIGI_TSIZ 10 /* Terminal string len */
62
63/*
64 * Structure used with ioctl commands for DIGI parameters.
65 */
66/**
67 * struct digi_t - Ioctl commands for DIGI parameters.
68 * @digi_flags: Flags.
69 * @digi_maxcps: Maximum printer CPS.
70 * @digi_maxchar: Maximum characters in the print queue.
71 * @digi_bufsize: Buffer size.
72 * @digi_onlen: Length of ON string.
73 * @digi_offlen: Length of OFF string.
74 * @digi_onstr: Printer ON string.
75 * @digi_offstr: Printer OFF string.
76 * @digi_term: Terminal string.
77 */
78struct digi_t {
79 unsigned short digi_flags;
80 unsigned short digi_maxcps;
81 unsigned short digi_maxchar;
82 unsigned short digi_bufsize;
83 unsigned char digi_onlen;
84 unsigned char digi_offlen;
85 char digi_onstr[DIGI_PLEN];
86 char digi_offstr[DIGI_PLEN];
87 char digi_term[DIGI_TSIZ];
88};
89
90/**
91 * struct digi_dinfo - Driver status information.
92 * @dinfo_nboards: Number of boards configured.
93 * @dinfo_reserved: Not used, for future expansion.
94 * @dinfio_version: Driver version.
95 */
96struct digi_dinfo {
97 unsigned int dinfo_nboards;
98 char dinfo_reserved[12];
99 char dinfo_version[16];
100};
101
102#define DIGI_GETDD (('d' << 8) | 248) /* get driver info */
103
104/**
105 * struct digi_info - Ioctl commands for per board information.
106 *
107 * Physsize and memsize differ when board has "windowed" memory.
108 *
109 * @info_bdnum: Board number (0 based).
110 * @info_ioport: IO port address.
111 * @indo_physaddr: Memory address.
112 * @info_physize: Size of host memory window.
113 * @info_memsize: Amount of dual-port memory on board.
114 * @info_bdtype: Board type.
115 * @info_nports: Number of ports.
116 * @info_bdstate: Board state.
117 * @info_reserved: Not used, for future expansion.
118 */
119struct digi_info {
120 unsigned int info_bdnum;
121 unsigned int info_ioport;
122 unsigned int info_physaddr;
123 unsigned int info_physsize;
124 unsigned int info_memsize;
125 unsigned short info_bdtype;
126 unsigned short info_nports;
127 char info_bdstate;
128 char info_reserved[7];
129};
130
131#define DIGI_GETBD (('d' << 8) | 249) /* get board info */
132
133/**
134 * struct digi_getbuffer - Holds buffer use counts.
135 */
136struct digi_getbuffer {
137 unsigned long tx_in;
138 unsigned long tx_out;
139 unsigned long rxbuf;
140 unsigned long txbuf;
141 unsigned long txdone;
142};
143
144/**
145 * struct digi_getcounter
146 * @norun: Number of UART overrun errors.
147 * @noflow: Number of buffer overflow errors.
148 * @nframe: Number of framing errors.
149 * @nparity: Number of parity errors.
150 * @nbreak: Number of breaks received.
151 * @rbytes: Number of received bytes.
152 * @tbytes: Number of transmitted bytes.
153 */
154struct digi_getcounter {
155 unsigned long norun;
156 unsigned long noflow;
157 unsigned long nframe;
158 unsigned long nparity;
159 unsigned long nbreak;
160 unsigned long rbytes;
161 unsigned long tbytes;
162};
163
164/* Board State Definitions */
165#define BD_RUNNING 0x0
166#define BD_NOFEP 0x5
167
168#define DIGI_SETCUSTOMBAUD _IOW('e', 106, int) /* Set integer baud rate */
169#define DIGI_GETCUSTOMBAUD _IOR('e', 107, int) /* Get integer baud rate */
170
171#define DIGI_REALPORT_GETBUFFERS (('e' << 8) | 108)
172#define DIGI_REALPORT_SENDIMMEDIATE (('e' << 8) | 109)
173#define DIGI_REALPORT_GETCOUNTERS (('e' << 8) | 110)
174#define DIGI_REALPORT_GETEVENTS (('e' << 8) | 111)
175
176#define EV_OPU 0x0001 /* Output paused by client */
177#define EV_OPS 0x0002 /* Output paused by regular sw flowctrl */
178#define EV_IPU 0x0010 /* Input paused unconditionally by user */
179#define EV_IPS 0x0020 /* Input paused by high/low water marks */
180#define EV_TXB 0x0040 /* Transmit break pending */
181
182/**
183 * struct ni_info - intelligent <--> non-intelligent DPA translation.
184 */
185struct ni_info {
186 int board;
187 int channel;
188 int dtr;
189 int rts;
190 int cts;
191 int dsr;
192 int ri;
193 int dcd;
194 int curtx;
195 int currx;
196 unsigned short iflag;
197 unsigned short oflag;
198 unsigned short cflag;
199 unsigned short lflag;
200 unsigned int mstat;
201 unsigned char hflow;
202 unsigned char xmit_stopped;
203 unsigned char recv_stopped;
204 unsigned int baud;
205};
206
207#define T_CLASSIC 0002
208#define T_PCIBUS 0400
209#define T_NEO_EXPRESS 0001
210#define T_NEO 0000
211
212#define TTY_FLIPBUF_SIZE 512
213
214#endif /* _DIGI_H */