2 * $FreeBSD: src/sys/dev/dgb/dgmreg.h,v 1.4.2.1 2001/09/23 19:54:54 brian Exp $
6 * Stage 1. "Better than nothing".
7 * Stage 2. "Gee, it works!".
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions, and the following disclaimer,
14 * without modification, immediately at the beginning of the file.
15 * 2. Redistributions of binary code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification, in the accompanying documentation.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * Written by Sergey Babkin,
34 * Joint Stock Commercial Bank "Chelindbank"
35 * (Chelyabinsk, Russia)
39 #define MAX_DGM_PORTS 64
42 /* Definitions for DigiBoard ditty(1) command. */
44 #if !defined(TIOCMODG)
45 #define TIOCMODG ('d'<<8) | 250 /* get modem ctrl state */
46 #define TIOCMODS ('d'<<8) | 251 /* set modem ctrl state */
49 #if !defined(TIOCMSET)
50 #define TIOCMSET ('d'<<8) | 252 /* set modem ctrl state */
51 #define TIOCMGET ('d'<<8) | 253 /* set modem ctrl state */
54 #if !defined(TIOCMBIC)
55 #define TIOCMBIC ('d'<<8) | 254 /* set modem ctrl state */
56 #define TIOCMBIS ('d'<<8) | 255 /* set modem ctrl state */
59 #if !defined(TIOCSDTR)
60 #define TIOCSDTR ('e'<<8) | 0 /* set DTR */
61 #define TIOCCDTR ('e'<<8) | 1 /* clear DTR */
64 /************************************************************************
65 * Ioctl command arguments for DIGI parameters.
66 ************************************************************************/
67 #define DIGI_GETA ('e'<<8) | 94 /* Read params */
69 #define DIGI_SETA ('e'<<8) | 95 /* Set params */
70 #define DIGI_SETAW ('e'<<8) | 96 /* Drain & set params */
71 #define DIGI_SETAF ('e'<<8) | 97 /* Drain, flush & set params */
73 #define DIGI_GETFLOW ('e'<<8) | 99 /* Get startc/stopc flow */
74 /* control characters */
75 #define DIGI_SETFLOW ('e'<<8) | 100 /* Set startc/stopc flow */
76 /* control characters */
77 #define DIGI_GETAFLOW ('e'<<8) | 101 /* Get Aux. startc/stopc */
78 /* flow control chars */
79 #define DIGI_SETAFLOW ('e'<<8) | 102 /* Set Aux. startc/stopc */
80 /* flow control chars */
82 struct digiflow_struct {
83 unsigned char startc; /* flow cntl start char */
84 unsigned char stopc; /* flow cntl stop char */
87 typedef struct digiflow_struct digiflow_t;
90 /************************************************************************
91 * Values for digi_flags
92 ************************************************************************/
93 #define DIGI_IXON 0x0001 /* Handle IXON in the FEP */
94 #define DIGI_FAST 0x0002 /* Fast baud rates */
95 #define RTSPACE 0x0004 /* RTS input flow control */
96 #define CTSPACE 0x0008 /* CTS output flow control */
97 #define DSRPACE 0x0010 /* DSR output flow control */
98 #define DCDPACE 0x0020 /* DCD output flow control */
99 #define DTRPACE 0x0040 /* DTR input flow control */
100 #define DIGI_FORCEDCD 0x0100 /* Force carrier */
101 #define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
102 #define DIGI_AIXON 0x0400 /* Aux flow control in fep */
105 /************************************************************************
106 * Structure used with ioctl commands for DIGI parameters.
107 ************************************************************************/
109 unsigned short digi_flags; /* Flags (see above) */
112 typedef struct digi_struct digi_t;
116 #define FEP_CSTART 0x400L
117 #define FEP_CMAX 0x800L
118 #define FEP_ISTART 0x800L
119 #define FEP_IMAX 0xC00L
120 #define FEP_CIN 0xD10L
121 #define FEP_GLOBAL 0xD10L
122 #define FEP_EIN 0xD18L
123 #define FEPSTAT 0xD20L
124 #define CHANSTRUCT 0x1000L
125 #define RXTXBUF 0x4000L
130 volatile ushort cout;
131 volatile ushort cstart;
132 volatile ushort cmax;
134 volatile ushort eout;
135 volatile ushort istart;
136 volatile ushort imax;
143 volatile ushort tseg;
145 volatile ushort tout;
146 volatile ushort tmax;
148 volatile ushort rseg;
150 volatile ushort rout;
151 volatile ushort rmax;
153 volatile ushort tlow;
154 volatile ushort rlow;
155 volatile ushort rhigh;
156 volatile ushort incr;
158 volatile ushort etime;
159 volatile ushort edelay;
160 volatile u_char *dev;
162 volatile ushort iflag;
163 volatile ushort oflag;
164 volatile ushort cflag;
165 volatile ushort gmask;
168 volatile ushort delay;
169 volatile ushort imask;
170 volatile ushort tflush;
178 volatile u_char ract;
179 volatile u_char bstat;
180 volatile u_char tbusy;
181 volatile u_char iempty;
182 volatile u_char ilow;
183 volatile u_char idata;
184 volatile u_char eflag;
186 volatile u_char tflag;
187 volatile u_char rflag;
188 volatile u_char xmask;
189 volatile u_char xval;
190 volatile u_char mstat;
191 volatile u_char mchange;
192 volatile u_char mint;
193 volatile u_char lstat;
195 volatile u_char mtran;
196 volatile u_char orun;
197 volatile u_char startca;
198 volatile u_char stopca;
199 volatile u_char startc;
200 volatile u_char stopc;
201 volatile u_char vnext;
202 volatile u_char hflow;
204 volatile u_char fillc;
205 volatile u_char ochar;
206 volatile u_char omask;
213 #define SRXLWATER 0xE0
214 #define SRXHWATER 0xE1
217 #define RESUMETX 0xE4
218 #define SAUXONOFFC 0xE6
219 #define SENDBREAK 0xE8
220 #define SETMODEM 0xE9
221 #define SETIFLAGS 0xEA
223 #define STXLWATER 0xEC
225 #define RESUMERX 0xEF
226 #define SETBUFFER 0xF2
227 #define SETCOOKED 0xF3
228 #define SETHFLOW 0xF4
229 #define SETCTRLFLAGS 0xF5
230 #define SETVNEXT 0xF6
234 #define BREAK_IND 0x01
235 #define LOWTX_IND 0x02
236 #define EMPTYTX_IND 0x04
237 #define DATA_IND 0x08
238 #define MODEMCHG_IND 0x20
240 #define ALL_IND (BREAK_IND|LOWTX_IND|EMPTYTX_IND|DATA_IND|MODEMCHG_IND)
249 #define FEPCODESEG 0x0200L
250 #define FEPCODE 0x2000L
251 #define BIOSCODE 0xf800L
252 #define BIOSOFFSET 0x1000L
254 #define MISCGLOBAL 0x0C00L
255 #define NPORT 0x0C02L
257 #define BOTWIN 0x100L
258 #define TOPWIN 0xFF00L
272 static char * const board_desc[] = {
281 #define IAIXON 0x2000
294 #define TXSTOPPED 0x1
296 #define EMPTYWAIT 0x4
303 #define FEPTIMEOUT 200000
304 #define SERIAL_TYPE_NORMAL 1
305 #define SERIAL_TYPE_CALLOUT 2
306 #define PCXE_EVENT_HANGUP 1
309 u_char unit; /* board unit number */
310 u_char omodem; /* FEP output modem status */
311 u_char imodem; /* FEP input modem status */
312 u_char modemfake; /* Modem values to be forced */
313 u_char modem; /* Force values */
349 struct board_info *board;
350 struct board_chan *brdchan;
351 struct digi_struct digiext;
353 struct termios normal_termios;
354 struct termios callout_termios;
355 volatile struct global_data *mailbox;
358 /* flags for configuring */
360 #define DGBFLAG_ALTPIN 0x0001 /* chande DCD and DCD */
361 #define DGBFLAG_NOWIN 0x0002 /* use windowed PC/Xe as non-windowed */
365 #define DB_WIN 0x0004
366 #define DB_INFO 0x0008
367 #define DB_EXCEPT 0x0010
368 #define DB_OPEN 0x0100
369 #define DB_CLOSE 0x0200
370 #define DB_DATA 0x0400
371 #define DB_RXDATA 0x0401
372 #define DB_TXDATA 0x0402
373 #define DB_EVENT 0x0800
374 #define DB_MODEM 0x1000
375 #define DB_BREAK 0x2000
376 #define DB_PARAM 0x4000
377 #define DB_FEP 0x8000
379 /* debugging printout */
382 #define DPRINT1(l,a1) (dgmdebug&l ? printf(a1) : 0)
383 #define DPRINT2(l,a1,a2) (dgmdebug&l ? printf(a1,a2) : 0)
384 #define DPRINT3(l,a1,a2,a3) (dgmdebug&l ? printf(a1,a2,a3) : 0)
385 #define DPRINT4(l,a1,a2,a3,a4) (dgmdebug&l ? printf(a1,a2,a3,a4) : 0)
386 #define DPRINT5(l,a1,a2,a3,a4,a5) (dgmdebug&l ? printf(a1,a2,a3,a4,a5) : 0)
387 #define DPRINT6(l,a1,a2,a3,a4,a5,a6) (dgmdebug&l ? printf(a1,a2,a3,a4,a5,a6) : 0)
388 #define DPRINT7(l,a1,a2,a3,a4,a5,a6,a7) (dgmdebug&l ? printf(a1,a2,a3,a4,a5,a6,a7) : 0)
390 #define DPRINT1(l,a1)
391 #define DPRINT2(l,a1,a2)
392 #define DPRINT3(l,a1,a2,a3)
393 #define DPRINT4(l,a1,a2,a3,a4)
394 #define DPRINT5(l,a1,a2,a3,a4,a5)
395 #define DPRINT6(l,a1,a2,a3,a4,a5,a6)
396 #define DPRINT7(l,a1,a2,a3,a4,a5,a6,a7)
400 /* These are termios bits as the FEP understands them */
403 #define FEP_CBAUD 0x00000f
404 #define FEP_B0 0x000000 /* hang up */
405 #define FEP_B50 0x000001
406 #define FEP_B75 0x000002
407 #define FEP_B110 0x000003
408 #define FEP_B134 0x000004
409 #define FEP_B150 0x000005
410 #define FEP_B200 0x000006
411 #define FEP_B300 0x000007
412 #define FEP_B600 0x000008
413 #define FEP_B1200 0x000009
414 #define FEP_B1800 0x00000a
415 #define FEP_B2400 0x00000b
416 #define FEP_B4800 0x00000c
417 #define FEP_B9600 0x00000d
418 #define FEP_B19200 0x00000e
419 #define FEP_B38400 0x00000f
420 #define FEP_EXTA FEP_B19200
421 #define FEP_EXTB FEP_B38400
422 #define FEP_CSIZE 0x000030
423 #define FEP_CS5 0x000000
424 #define FEP_CS6 0x000010
425 #define FEP_CS7 0x000020
426 #define FEP_CS8 0x000030
427 #define FEP_CSTOPB 0x000040
428 #define FEP_CREAD 0x000080
429 #define FEP_PARENB 0x000100
430 #define FEP_PARODD 0x000200
431 #define FEP_CLOCAL 0x000800
432 #define FEP_FASTBAUD 0x000400
434 #define FEP_IGNBRK 0000001
435 #define FEP_BRKINT 0000002
436 #define FEP_IGNPAR 0000004
437 #define FEP_PARMRK 0000010
438 #define FEP_INPCK 0000020
439 #define FEP_ISTRIP 0000040
440 #define FEP_IXON 0002000
441 #define FEP_IXANY 0004000
442 #define FEP_IXOFF 0010000