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