1/*-
2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
3 *   based on work by Slawa Olhovchenkov
4 *                    John Prince <johnp@knight-trosoft.com>
5 *                    Eric Hernes
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD$
30 */
31
32struct global_data {
33	volatile u_short cin;
34	volatile u_short cout;
35	volatile u_short cstart;
36	volatile u_short cmax;
37	volatile u_short ein;
38	volatile u_short eout;
39	volatile u_short istart;
40	volatile u_short imax;
41};
42
43
44struct board_chan {
45	volatile u_short tpjmp;
46	volatile u_short tcjmp;
47	volatile u_short fil1;
48	volatile u_short rpjmp;
49
50	volatile u_short tseg;
51	volatile u_short tin;
52	volatile u_short tout;
53	volatile u_short tmax;
54
55	volatile u_short rseg;
56	volatile u_short rin;
57	volatile u_short rout;
58	volatile u_short rmax;
59
60	volatile u_short tlow;
61	volatile u_short rlow;
62	volatile u_short rhigh;
63	volatile u_short incr;
64
65	volatile u_short dev;
66	volatile u_short edelay;
67	volatile u_short blen;
68	volatile u_short btime;
69
70	volatile u_short iflag;
71	volatile u_short oflag;
72	volatile u_short cflag;
73	volatile u_short gmask;
74
75	volatile u_short col;
76	volatile u_short delay;
77	volatile u_short imask;
78	volatile u_short tflush;
79
80	volatile u_char _1[16];
81
82	volatile u_char num;
83	volatile u_char ract;
84	volatile u_char bstat;
85	volatile u_char tbusy;
86	volatile u_char iempty;
87	volatile u_char ilow;
88	volatile u_char idata;
89	volatile u_char eflag;
90
91	volatile u_char tflag;
92	volatile u_char rflag;
93	volatile u_char xmask;
94	volatile u_char xval;
95	volatile u_char mstat;
96	volatile u_char mchange;
97	volatile u_char mint;
98	volatile u_char lstat;
99
100	volatile u_char mtran;
101	volatile u_char orun;
102	volatile u_char startca;
103	volatile u_char stopca;
104	volatile u_char startc;
105	volatile u_char stopc;
106	volatile u_char vnext;
107	volatile u_char hflow;
108
109	volatile u_char fillc;
110	volatile u_char ochar;
111	volatile u_char omask;
112	volatile u_char _2;
113
114	volatile u_char _3[28];
115};
116
117#define SRXLWATER      0xe0
118#define SRXHWATER      0xe1
119#define STPTR          0xe2
120#define PAUSETX        0xe3
121#define RESUMETX       0xe4
122#define SAUXONOFFC     0xe6
123#define SENDBREAK      0xe8
124#define SETMODEM       0xe9
125#define SETIFLAGS      0xeA
126#define SONOFFC        0xeB
127#define STXLWATER      0xeC
128#define PAUSERX        0xeE
129#define RESUMERX       0xeF
130#define RESETCHAN      0xf0
131#define SETBUFFER      0xf2
132#define SETCOOKED      0xf3
133#define SETHFLOW       0xf4
134#define SETCFLAGS      0xf5
135#define SETVNEXT       0xf6
136#define SETBSLICE      0xf7
137#define SETRSMODE      0xfd
138#define SETCMDACK      0xfe
139#define RESERV         0xff
140
141#define BREAK_IND        0x01
142#define LOWTX_IND        0x02
143#define EMPTYTX_IND      0x04
144#define DATA_IND         0x08
145#define MODEMCHG_IND     0x20
146#define RECV_OVR_IND	 0x40
147#define CMD_ACK_IND	 0x40
148#define UART_OVR_IND	 0x80
149
150#define ALL_IND	(BREAK_IND|LOWTX_IND|EMPTYTX_IND|DATA_IND|MODEMCHG_IND)
151
152#define FEPTIMEOUT 2000
153
154#define FEPCLR	0x0
155#define FEPMEM	0x2
156#define FEPRST	0x4
157#define FEPREQ	0x8
158#define FEPWIN	0x80
159#define FEPMASK 0xe
160/* #define FEPMASK 0x4 */
161
162#define	BOTWIN		0x100L
163#define	TOPWIN		0xFF00L
164#define	MISCGLOBAL	0x0C00L
165#define	FEPCODESEG	0x0200L
166
167/* #define BIOSCODE   0xff800 */	/* Window 15, offset 7800h */
168#define FEPCODE    0x0d000
169
170#define	FEP_CSTART	0x400L
171#define	FEP_CMAX	0x800L
172#define	FEP_ISTART	0x800L
173#define	FEP_IMAX	0xC00L
174#define	MBOX		0xC40L
175#define	FEP_CIN		0xD10L
176#define	FEP_GLOBAL	0xD10L
177#define	FEP_EIN		0xD18L
178#define	FEPSTAT		0xD20L
179#define	CHANSTRUCT	0x1000L
180#define	RXTXBUF		0x4000L
181
182#define	BIOSOFFSET	0x1000L
183#define	BIOSCODE	0xf800L
184#define	FEPOFFSET	0x2000L
185
186/* c_cflag bits */
187#define	FEP_CSIZE	0x000030
188#define	FEP_CS5		0x000000
189#define	FEP_CS6		0x000010
190#define	FEP_CS7		0x000020
191#define	FEP_CS8		0x000030
192#define	FEP_CSTOPB	0x000040
193#define	FEP_CREAD	0x000080
194#define	FEP_PARENB	0x000100
195#define	FEP_PARODD	0x000200
196#define	FEP_CLOCAL	0x000800
197#define	FEP_FASTBAUD	0x000400
198
199/* c_iflag bits */
200#define	FEP_IGNBRK	0000001
201#define	FEP_BRKINT	0000002
202#define	FEP_IGNPAR	0000004
203#define	FEP_PARMRK	0000010
204#define	FEP_INPCK	0000020
205#define	FEP_ISTRIP	0000040
206#define	FEP_IXON	0002000
207#define	FEP_IXANY	0004000
208#define	FEP_IXOFF	0010000
209