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