dcmreg.h revision 1.3 1 /*
2 * Copyright (c) 1988 University of Utah.
3 * Copyright (c) 1982, 1986, 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the Systems Programming Group of the University of Utah Computer
8 * Science Department.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * from: Utah $Hdr: dcmreg.h 1.7 92/01/21$
39 *
40 * from: @(#)dcmreg.h 8.1 (Berkeley) 6/10/93
41 * $Id: dcmreg.h,v 1.3 1994/05/23 05:58:43 mycroft Exp $
42 */
43
44 #include <hp300/dev/iotypes.h> /* XXX */
45
46 struct dcmdevice { /* host address, only odd bytes addressed */
47 u_char dcm_pad0;
48 vu_char dcm_rsid; /* Reset / ID 0001 */
49 u_char dcm_pad1;
50 vu_char dcm_ic; /* Interrupt control register 0003 */
51 u_char dcm_pad2;
52 vu_char dcm_sem; /* Semaphore register 0005 */
53 u_char dcm_pad3[0x7ffa]; /* Unaddressable 0006-7fff */
54 u_char dcm_pad4;
55 vu_char dcm_iir; /* Interrupt ident register 8001 */
56 u_char dcm_pad5;
57 vu_char dcm_cr; /* Command register 8003 */
58 u_char dcm_pad6[0x3fc]; /* Card scratch 8004-83ff */
59 struct dcmrfifo {
60 u_char ptr_pad1;
61 vu_char data_char;
62 u_char ptr_pad2;
63 vu_char data_stat;
64 } dcm_rfifos[4][0x80]; /* Receive queues 8400 */
65 struct {
66 u_char ptr_pad1;
67 vu_char data_data;
68 } dcm_bmap[0x100]; /* Bitmap table 8c00 */
69 struct {
70 u_char ptr_pad;
71 vu_char ptr;
72 } dcm_rhead[4]; /* Fifo head - receive 8e00 */
73 struct {
74 u_char ptr_pad;
75 vu_char ptr;
76 } dcm_rtail[4]; /* Fifo tail - receive 8e08 */
77 struct {
78 u_char ptr_pad;
79 vu_char ptr;
80 } dcm_thead[4]; /* Fifo head - transmit 8e10 */
81 struct {
82 u_char ptr_pad;
83 vu_char ptr;
84 } dcm_ttail[4]; /* Fifo tail - transmit 8e18 */
85 struct {
86 u_char pad1;
87 vu_char dcm_conf;
88 u_char pad2;
89 vu_char dcm_baud;
90 } dcm_data[4]; /* Configuration registers 8e20 */
91 struct modemreg {
92 u_char pad0;
93 vu_char mdmin; /* Modem in 8e31 */
94 u_char pad1;
95 vu_char mdmout; /* Modem out 8e33 */
96 u_char pad2;
97 vu_char mdmmsk; /* Modem mask 8e35 */
98 } dcm_modem0;
99 struct {
100 u_char pad1;
101 vu_char dcm_data;
102 } dcm_cmdtab[4]; /* Command tables 8e36 */
103 struct {
104 u_char pad1;
105 vu_char dcm_data;
106 } dcm_icrtab[4]; /* Interrupt data 8e3e */
107 u_char dcm_pad10;
108 vu_char dcm_stcon; /* Self test condition 8e47 */
109 struct modemreg dcm_modem1; /* 638 Modem port1 8e48 */
110 struct modemreg dcm_modem2; /* 638 Modem port2 8e4e */
111 struct modemreg dcm_modem3; /* 638 Modem port3 8e54 */
112 u_char dcm_pad11;
113 vu_char dcm_modemchng; /* 638 Modem change mask 8e5b */
114 u_char dcm_pad12;
115 vu_char dcm_modemintr; /* 638 Modem interrupt mask 8e5d */
116 u_char dcm_pad13[0x82]; /* Undef Shared Ram 8e5e-8edf */
117 struct dcmtfifo {
118 u_char ptr_pad1;
119 vu_char data_char;
120 } dcm_tfifos[4][0x10]; /* Transmit queues 8ee0 */
121 };
122
123 /*
124 * Overlay structure for port specific queue "registers".
125 * Starts at offset 0x8E00+(port*2).
126 */
127 struct dcmpreg {
128 u_char pad0; /* +00 */
129 vu_char r_head; /* +01 */
130 u_char pad1[7]; /* +02 */
131 vu_char r_tail; /* +09 */
132 u_char pad2[7]; /* +0A */
133 vu_char t_head; /* +11 */
134 u_char pad3[7]; /* +12 */
135 vu_char t_tail; /* +19 */
136 };
137 #define dcm_preg(d, p) ((struct dcmpreg *)((u_int)(d)+0x8e00+(p)*2))
138
139 /* interface reset/id */
140 #define DCMCON 0x80 /* REMOTE/LOCAL switch, read */
141 #define DCMID 0x5 /* hardwired card id, read */
142 #define DCMRS 0x80 /* software reset, write */
143
144 /* interrupt control */
145 #define DCMIPL(x) ((((x) >> 4) & 3) + 3) /* interupt level, read */
146 #define IC_IR 0x40 /* interupt request, read */
147 #define IC_IE 0x80 /* interupt enable, write */
148 #define IC_ID 0x00 /* interupt disable, write */
149
150
151 /* Semaphore control */
152 #define SEM_BSY 0x80 /* read */
153 #define SEM_CLR 0xFF /* write */
154 #define SEM_LOCK(dcm) while ((dcm)->dcm_sem & SEM_BSY)
155 #define SEM_UNLOCK(dcm) (dcm)->dcm_sem = SEM_CLR
156
157 /* command register */
158 #define CR_PORT0 0x1
159 #define CR_PORT1 0x2
160 #define CR_PORT2 0x4
161 #define CR_PORT3 0x8
162 #define CR_MODM 0x10 /* change modem output lines */
163 #define CR_TIMER 0x20 /* 16ms interrupt timer toggle */
164 #define CR_SELFT 0x40 /* run self test */
165 #define CR_MASK 0x7f
166
167 /* interrupt ident register */
168 #define IIR_PORT0 0x1
169 #define IIR_PORT1 0x2
170 #define IIR_PORT2 0x4
171 #define IIR_PORT3 0x8
172 #define IIR_SELFT 0x10 /* self test completed */
173 #define IIR_MODM 0x20 /* change in modem input lines */
174 #define IIR_TIMEO 0x40 /* Time out */
175 #define IIR_MASK 0x7f
176
177 /* self test cond reg */
178 #define ST_OK 0xe0
179
180 /* Line configuration register */
181 #define LC_PNO 0x00
182 #define LC_PODD 0x01
183 #define LC_PEVEN 0x02
184 #define LC_PMSK 0x03
185
186 #define LC_1STOP 0x00
187 #define LC_1HSTOP 0x04
188 #define LC_2STOP 0x08
189 #define LC_STOPMSK 0x0b
190
191 #define LC_8BITS 0x30
192 #define LC_7BITS 0x20
193 #define LC_6BITS 0x10
194 #define LC_5BITS 0x00
195 #define LC_BITMSK 0x30
196
197 /* baud reg */
198 #define BR_0 0x00
199 #define BR_50 0x01
200 #define BR_75 0x02
201 #define BR_110 0x03
202 #define BR_134 0x04
203 #define BR_150 0x05
204 #define BR_300 0x06
205 #define BR_600 0x07
206 #define BR_900 0x08
207 #define BR_1200 0x09
208 #define BR_1800 0x0a
209 #define BR_2400 0x0b
210 #define BR_3600 0x0c
211 #define BR_4800 0x0d
212 #define BR_7200 0x0e
213 #define BR_9600 0x0f
214 #define BR_19200 0x10
215 #define BR_38400 0x11
216
217 /* modem input register */
218 #define MI_CTS 0x08
219 #define MI_DM 0x04
220 #define MI_CD 0x02
221 #define MI_RI 0x01
222
223 /* modem output register */
224 #define MO_SR 0x04
225 #define MO_DTR 0x02
226 #define MO_RTS 0x01
227 #define MO_ON ((MO_DTR) | (MO_RTS))
228 #define MO_OFF 0x00
229
230 /* cmd-tab values, write */
231 #define CT_CON 0x1 /* configuration change */
232 #define CT_TX 0x2 /* transmit buffer not empty */
233 #define CT_BRK 0x4 /* toggle BREAK */
234
235 /* icr-tab values, read */
236 #define IT_TX 0x1 /* transmit buffer empty */
237 #define IT_SPEC 0x2 /* special character received */
238
239 /* data errors */
240 #define RD_OVF 0x08
241 #define RD_BD 0x10
242 #define RD_PE 0x20
243 #define RD_OE 0x40
244 #define RD_FE 0x80
245 #define RD_MASK 0xf8
246
247 /* Transmit/Receive masks */
248 #define TX_MASK 0x0f
249 #define RX_MASK 0xff
250
251 /*
252 * WARNING: Serial console is assumed to be the lowest select-code card
253 * and that card must be logical unit 0 in the kernel. Also, CONUNIT must
254 * be 1, the port affected by the REMOTE/LOCAL switch.
255 */
256 #define CONUNIT (1)
257