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