2 * dgreg.h $FreeBSD: src/sys/gnu/i386/isa/dgreg.h,v 1.9 1999/08/28 00:43:05 peter Exp $
6 * Stage 1. "Better than nothing".
8 * Based on sio driver by Bruce Evans and on Linux driver by Troy
9 * De Jongh <troyd@digibd.com> or <troyd@skypoint.com>
10 * which is under GNU General Public License version 2 so this driver
11 * is forced to be under GPL 2 too.
13 * Written by Serge Babkin,
14 * Joint Stock Commercial Bank "Chelindbank"
15 * (Chelyabinsk, Russia)
16 * babkin@hq.icb.chel.su
19 #define MAX_DGB_PORTS 32
22 /* Definitions for DigiBoard ditty(1) command. */
24 #if !defined(TIOCMODG)
25 #define TIOCMODG ('d'<<8) | 250 /* get modem ctrl state */
26 #define TIOCMODS ('d'<<8) | 251 /* set modem ctrl state */
29 #if !defined(TIOCMSET)
30 #define TIOCMSET ('d'<<8) | 252 /* set modem ctrl state */
31 #define TIOCMGET ('d'<<8) | 253 /* set modem ctrl state */
34 #if !defined(TIOCMBIC)
35 #define TIOCMBIC ('d'<<8) | 254 /* set modem ctrl state */
36 #define TIOCMBIS ('d'<<8) | 255 /* set modem ctrl state */
39 #if !defined(TIOCSDTR)
40 #define TIOCSDTR ('e'<<8) | 0 /* set DTR */
41 #define TIOCCDTR ('e'<<8) | 1 /* clear DTR */
44 /************************************************************************
45 * Ioctl command arguments for DIGI parameters.
46 ************************************************************************/
47 #define DIGI_GETA ('e'<<8) | 94 /* Read params */
49 #define DIGI_SETA ('e'<<8) | 95 /* Set params */
50 #define DIGI_SETAW ('e'<<8) | 96 /* Drain & set params */
51 #define DIGI_SETAF ('e'<<8) | 97 /* Drain, flush & set params */
53 #define DIGI_GETFLOW ('e'<<8) | 99 /* Get startc/stopc flow */
54 /* control characters */
55 #define DIGI_SETFLOW ('e'<<8) | 100 /* Set startc/stopc flow */
56 /* control characters */
57 #define DIGI_GETAFLOW ('e'<<8) | 101 /* Get Aux. startc/stopc */
58 /* flow control chars */
59 #define DIGI_SETAFLOW ('e'<<8) | 102 /* Set Aux. startc/stopc */
60 /* flow control chars */
62 struct digiflow_struct {
63 unsigned char startc; /* flow cntl start char */
64 unsigned char stopc; /* flow cntl stop char */
67 typedef struct digiflow_struct digiflow_t;
70 /************************************************************************
71 * Values for digi_flags
72 ************************************************************************/
73 #define DIGI_IXON 0x0001 /* Handle IXON in the FEP */
74 #define DIGI_FAST 0x0002 /* Fast baud rates */
75 #define RTSPACE 0x0004 /* RTS input flow control */
76 #define CTSPACE 0x0008 /* CTS output flow control */
77 #define DSRPACE 0x0010 /* DSR output flow control */
78 #define DCDPACE 0x0020 /* DCD output flow control */
79 #define DTRPACE 0x0040 /* DTR input flow control */
80 #define DIGI_FORCEDCD 0x0100 /* Force carrier */
81 #define DIGI_ALTPIN 0x0200 /* Alternate RJ-45 pin config */
82 #define DIGI_AIXON 0x0400 /* Aux flow control in fep */
85 /************************************************************************
86 * Structure used with ioctl commands for DIGI parameters.
87 ************************************************************************/
89 unsigned short digi_flags; /* Flags (see above) */
92 typedef struct digi_struct digi_t;
96 #define FEP_CSTART 0x400L
97 #define FEP_CMAX 0x800L
98 #define FEP_ISTART 0x800L
99 #define FEP_IMAX 0xC00L
100 #define FEP_CIN 0xD10L
101 #define FEP_GLOBAL 0xD10L
102 #define FEP_EIN 0xD18L
103 #define FEPSTAT 0xD20L
104 #define CHANSTRUCT 0x1000L
105 #define RXTXBUF 0x4000L
110 volatile ushort cout;
111 volatile ushort cstart;
112 volatile ushort cmax;
114 volatile ushort eout;
115 volatile ushort istart;
116 volatile ushort imax;
123 volatile ushort tseg;
125 volatile ushort tout;
126 volatile ushort tmax;
128 volatile ushort rseg;
130 volatile ushort rout;
131 volatile ushort rmax;
133 volatile ushort tlow;
134 volatile ushort rlow;
135 volatile ushort rhigh;
136 volatile ushort incr;
138 volatile ushort etime;
139 volatile ushort edelay;
140 volatile u_char *dev;
142 volatile ushort iflag;
143 volatile ushort oflag;
144 volatile ushort cflag;
145 volatile ushort gmask;
148 volatile ushort delay;
149 volatile ushort imask;
150 volatile ushort tflush;
158 volatile u_char ract;
159 volatile u_char bstat;
160 volatile u_char tbusy;
161 volatile u_char iempty;
162 volatile u_char ilow;
163 volatile u_char idata;
164 volatile u_char eflag;
166 volatile u_char tflag;
167 volatile u_char rflag;
168 volatile u_char xmask;
169 volatile u_char xval;
170 volatile u_char mstat;
171 volatile u_char mchange;
172 volatile u_char mint;
173 volatile u_char lstat;
175 volatile u_char mtran;
176 volatile u_char orun;
177 volatile u_char startca;
178 volatile u_char stopca;
179 volatile u_char startc;
180 volatile u_char stopc;
181 volatile u_char vnext;
182 volatile u_char hflow;
184 volatile u_char fillc;
185 volatile u_char ochar;
186 volatile u_char omask;
193 #define SRXLWATER 0xE0
194 #define SRXHWATER 0xE1
197 #define RESUMETX 0xE4
198 #define SAUXONOFFC 0xE6
199 #define SENDBREAK 0xE8
200 #define SETMODEM 0xE9
201 #define SETIFLAGS 0xEA
203 #define STXLWATER 0xEC
205 #define RESUMERX 0xEF
206 #define SETBUFFER 0xF2
207 #define SETCOOKED 0xF3
208 #define SETHFLOW 0xF4
209 #define SETCTRLFLAGS 0xF5
210 #define SETVNEXT 0xF6
214 #define BREAK_IND 0x01
215 #define LOWTX_IND 0x02
216 #define EMPTYTX_IND 0x04
217 #define DATA_IND 0x08
218 #define MODEMCHG_IND 0x20
220 #define ALL_IND (BREAK_IND|LOWTX_IND|EMPTYTX_IND|DATA_IND|MODEMCHG_IND)
232 #define FEPCODESEG 0x0200L
233 #define FEPCODE 0x2000L
234 #define BIOSCODE 0xf800L
236 #define MISCGLOBAL 0x0C00L
237 #define NPORT 0x0C22L
239 #define PORTBASE 0x0C90L
240 #define BOTWIN 0x100L
241 #define TOPWIN 0xFF00L
254 static char * const board_desc[] = {
262 #define IAIXON 0x2000
275 #define TXSTOPPED 0x1
277 #define EMPTYWAIT 0x4
284 #define FEPTIMEOUT 200000
285 #define SERIAL_TYPE_NORMAL 1
286 #define SERIAL_TYPE_CALLOUT 2
287 #define PCXE_EVENT_HANGUP 1
290 u_char unit; /* board unit number */
291 u_char omodem; /* FEP output modem status */
292 u_char imodem; /* FEP input modem status */
293 u_char modemfake; /* Modem values to be forced */
294 u_char modem; /* Force values */
330 struct board_info *board;
331 struct board_chan *brdchan;
332 struct digi_struct digiext;
334 struct termios normal_termios;
335 struct termios callout_termios;
336 volatile struct global_data *mailbox;
339 /* flags for configuring */
341 #define DGBFLAG_ALTPIN 0x0001 /* chande DCD and DCD */
342 #define DGBFLAG_NOWIN 0x0002 /* use windowed PC/Xe as non-windowed */
346 #define DB_WIN 0x0004
347 #define DB_INFO 0x0008
348 #define DB_EXCEPT 0x0010
349 #define DB_OPEN 0x0100
350 #define DB_CLOSE 0x0200
351 #define DB_DATA 0x0400
352 #define DB_RXDATA 0x0401
353 #define DB_TXDATA 0x0402
354 #define DB_EVENT 0x0800
355 #define DB_MODEM 0x1000
356 #define DB_BREAK 0x2000
357 #define DB_PARAM 0x4000
358 #define DB_FEP 0x8000
360 /* debugging printout */
363 #define DPRINT1(l,a1) (dgbdebug&l ? printf(a1) : 0)
364 #define DPRINT2(l,a1,a2) (dgbdebug&l ? printf(a1,a2) : 0)
365 #define DPRINT3(l,a1,a2,a3) (dgbdebug&l ? printf(a1,a2,a3) : 0)
366 #define DPRINT4(l,a1,a2,a3,a4) (dgbdebug&l ? printf(a1,a2,a3,a4) : 0)
367 #define DPRINT5(l,a1,a2,a3,a4,a5) (dgbdebug&l ? printf(a1,a2,a3,a4,a5) : 0)
368 #define DPRINT6(l,a1,a2,a3,a4,a5,a6) (dgbdebug&l ? printf(a1,a2,a3,a4,a5,a6) : 0)
369 #define DPRINT7(l,a1,a2,a3,a4,a5,a6,a7) (dgbdebug&l ? printf(a1,a2,a3,a4,a5,a6,a7) : 0)
371 #define DPRINT1(l,a1)
372 #define DPRINT2(l,a1,a2)
373 #define DPRINT3(l,a1,a2,a3)
374 #define DPRINT4(l,a1,a2,a3,a4)
375 #define DPRINT5(l,a1,a2,a3,a4,a5)
376 #define DPRINT6(l,a1,a2,a3,a4,a5,a6)
377 #define DPRINT7(l,a1,a2,a3,a4,a5,a6,a7)
381 /* These are termios bits as the FEP understands them */
384 #define FEP_CBAUD 0x00000f
385 #define FEP_B0 0x000000 /* hang up */
386 #define FEP_B50 0x000001
387 #define FEP_B75 0x000002
388 #define FEP_B110 0x000003
389 #define FEP_B134 0x000004
390 #define FEP_B150 0x000005
391 #define FEP_B200 0x000006
392 #define FEP_B300 0x000007
393 #define FEP_B600 0x000008
394 #define FEP_B1200 0x000009
395 #define FEP_B1800 0x00000a
396 #define FEP_B2400 0x00000b
397 #define FEP_B4800 0x00000c
398 #define FEP_B9600 0x00000d
399 #define FEP_B19200 0x00000e
400 #define FEP_B38400 0x00000f
401 #define FEP_EXTA FEP_B19200
402 #define FEP_EXTB FEP_B38400
403 #define FEP_CSIZE 0x000030
404 #define FEP_CS5 0x000000
405 #define FEP_CS6 0x000010
406 #define FEP_CS7 0x000020
407 #define FEP_CS8 0x000030
408 #define FEP_CSTOPB 0x000040
409 #define FEP_CREAD 0x000080
410 #define FEP_PARENB 0x000100
411 #define FEP_PARODD 0x000200
412 #define FEP_CLOCAL 0x000800
413 #define FEP_FASTBAUD 0x000400
415 #define FEP_IGNBRK 0000001
416 #define FEP_BRKINT 0000002
417 #define FEP_IGNPAR 0000004
418 #define FEP_PARMRK 0000010
419 #define FEP_INPCK 0000020
420 #define FEP_ISTRIP 0000040
421 #define FEP_IXON 0002000
422 #define FEP_IXANY 0004000
423 #define FEP_IXOFF 0010000