xref: /csrg-svn/sys/hp300/dev/dcmreg.h (revision 41480)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
4  * 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  * %sccs.include.redist.c%
11  *
12  * from: Utah $Hdr: dcmreg.h 1.3 89/08/23$
13  *
14  *	@(#)dcmreg.h	7.1 (Berkeley) 05/08/90
15  */
16 
17 struct dcmdevice {	   /* host address, only odd bytes addressed */
18 	u_char	dcm_pad0;
19 	volatile u_char	dcm_rsid;	/* Reset / ID			0001 */
20 	u_char	dcm_pad1;
21 	volatile u_char	dcm_ic;		/* Interrupt control register	0003 */
22 	u_char	dcm_pad2;
23 	volatile u_char	dcm_sem;	/* Semaphore register		0005 */
24 	u_char  dcm_pad3[0x7ffa];	/* Unaddressable   0006-7fff */
25 	u_char	dcm_pad4;
26 	volatile u_char	dcm_iir;	/* Interrupt ident register	8001 */
27 	u_char	dcm_pad5;
28 	volatile u_char	dcm_cr;		/* Command register		8003 */
29 	u_char  dcm_pad6[0x3fc];	/* Card scratch    8004-83ff */
30 	struct  {
31 	    u_char  ptr_pad1;
32 	    volatile u_char  data_char;
33 	    u_char  ptr_pad2;
34 	    volatile u_char  data_stat;
35 	} dcm_rfifos[4][0x80];	/* Receive queues		8400 */
36 	struct  {
37 	    u_char  ptr_pad1;
38 	    volatile u_char  data_data;
39 	} dcm_bmap[0x100];	/* Bitmap table			8c00 */
40 	struct  {
41 	    u_char  ptr_pad;
42 	    volatile u_char  ptr;
43 	} dcm_rhead[4];		/* Fifo head - receive		8e00 */
44 	struct  {
45 	    u_char  ptr_pad;
46 	    volatile u_char  ptr;
47 	} dcm_rtail[4];		/* Fifo tail - receive		8e08 */
48 	struct  {
49 	    u_char  ptr_pad;
50 	    volatile u_char  ptr;
51 	} dcm_thead[4];		/* Fifo head - transmit		8e10 */
52 	struct  {
53 	    u_char  ptr_pad;
54 	    volatile u_char  ptr;
55 	} dcm_ttail[4];		/* Fifo tail - transmit		8e18 */
56 	struct  {
57 		u_char pad1;
58 		volatile u_char dcm_conf;
59 		u_char pad2;
60 		volatile u_char dcm_baud;
61 	} dcm_data[4];		/* Configuration registers	8e20 */
62 	u_char  dcm_pad7;
63 	volatile u_char  dcm_mdmin;	/* Modem in			8e31 */
64 	u_char  dcm_pad8;
65 	volatile u_char  dcm_mdmout;	/* Modem out			8e33 */
66 	u_char  dcm_pad9;
67 	volatile u_char  dcm_mdmmsk;	/* Modem mask			8e35 */
68 	struct  {
69 		u_char pad1;
70 		volatile u_char dcm_data;
71 	} dcm_cmdtab[4];	/* Command tables		8e36 */
72 	struct  {
73 		u_char pad1;
74 		volatile u_char dcm_data;
75 	} dcm_icrtab[4];	/* Interrupt data		8e3e */
76 	u_char  dcm_pad10;
77 	volatile u_char  dcm_stcon;	/* Self test condition		8e47 */
78 	u_char  dcm_pad11[0x98];	/* Undef SR regs   8e48-8edf */
79 	struct  {
80 	    u_char  ptr_pad1;
81 	    volatile u_char  data_char;
82 	} dcm_tfifos[4][0x10];	/* Transmit queues		8ee0 */
83 };
84 
85 /* interface reset/id */
86 #define DCMCON          0x80	/* REMOTE/LOCAL switch, read */
87 #define	DCMID		0x5	/* hardwired card id, read */
88 #define	DCMRS		0x80	/* software reset, write */
89 
90 /* interrupt control */
91 #define	DCMIPL(x)	((((x) >> 4) & 3) + 3)	/* interupt level, read */
92 #define	IC_IR		0x40	/* interupt request, read */
93 #define	IC_IE		0x80	/* interupt enable, write */
94 #define	IC_ID		0x00	/* interupt disable, write */
95 
96 
97 /* Semaphore control */
98 #define	SEM_BSY		0x80	/* read */
99 #define SEM_CLR         0xFF	/* write */
100 #define SEM_LOCK(dcm)	while ((dcm)->dcm_sem & SEM_BSY)
101 #define SEM_UNLOCK(dcm)	(dcm)->dcm_sem = SEM_CLR
102 
103 /* command register */
104 #define	CR_PORT0	0x1
105 #define	CR_PORT1	0x2
106 #define	CR_PORT2	0x4
107 #define	CR_PORT3	0x8
108 #define	CR_MODM		0x10	/* change modem output lines */
109 #define	CR_TIMER	0x20	/* 16ms interrupt timer toggle */
110 #define	CR_SELFT	0x40	/* run self test */
111 #define CR_MASK		0x7f
112 
113 /* interrupt ident register */
114 #define	IIR_PORT0	0x1
115 #define	IIR_PORT1	0x2
116 #define	IIR_PORT2	0x4
117 #define	IIR_PORT3	0x8
118 #define	IIR_SELFT	0x10	/* self test completed */
119 #define	IIR_MODM	0x20	/* change in modem input lines */
120 #define	IIR_TIMEO	0x40	/* Time out */
121 #define IIR_MASK	0x7f
122 
123 /* self test cond reg */
124 #define ST_OK           0xe0
125 
126 /* Line configuration register */
127 #define	LC_PNO		0x00
128 #define	LC_PODD		0x01
129 #define	LC_PEVEN	0x02
130 #define	LC_PMSK		0x03
131 
132 #define	LC_1STOP	0x00
133 #define	LC_1HSTOP	0x04
134 #define	LC_2STOP	0x08
135 #define	LC_STOPMSK	0x0b
136 
137 #define	LC_8BITS	0x30
138 #define	LC_7BITS	0x20
139 #define	LC_6BITS	0x10
140 #define	LC_5BITS	0x00
141 #define	LC_BITMSK	0x30
142 
143 /* baud reg */
144 #define BR_0		0x00
145 #define BR_50		0x01
146 #define BR_75		0x02
147 #define BR_110		0x03
148 #define BR_134  	0x04
149 #define BR_150		0x05
150 #define BR_300		0x06
151 #define BR_600		0x07
152 #define BR_900		0x08
153 #define BR_1200		0x09
154 #define BR_1800		0x0a
155 #define BR_2400		0x0b
156 #define BR_3600		0x0c
157 #define BR_4800		0x0d
158 #define BR_7200		0x0e
159 #define BR_9600		0x0f
160 #define BR_19200	0x10
161 #define BR_38400	0x11
162 
163 /* modem input register */
164 #define	MI_CTS		0x08
165 #define	MI_DM		0x04
166 #define	MI_CD		0x02
167 #define	MI_RI		0x01
168 
169 /* modem output register */
170 #define	MO_SR		0x04
171 #define	MO_DTR		0x02
172 #define	MO_RTS		0x01
173 #define	MO_ON		((MO_DTR) | (MO_RTS))
174 #define	MO_OFF		0x00
175 
176 /* cmd-tab values, write */
177 #define CT_CON		0x1	/* configuration change */
178 #define CT_TX		0x2	/* transmit buffer not empty */
179 #define CT_BRK		0x4	/* toggle BREAK */
180 
181 /* icr-tab values, read */
182 #define IT_TX		0x1	/* transmit buffer empty */
183 #define IT_SPEC		0x2	/* special character received */
184 
185 /* data errors */
186 #define RD_OVF		0x08
187 #define RD_BD		0x10
188 #define RD_PE		0x20
189 #define RD_OE		0x40
190 #define RD_FE		0x80
191 #define RD_MASK		0xf8
192 
193 /* Transmit/Receive masks */
194 #define TX_MASK		0x0f
195 #define RX_MASK		0xff
196 
197 /*
198  * WARNING: Serial console is assumed to be at SC13
199  * and CONUNIT must be 1, signeled by REMOTE/LOCAL switch on card
200  */
201 #define CONADDR	((struct dcmdevice *)(IOV(EXTIOBASE + (13 * IOCARDSIZE))))
202 #define CONUNIT	(1)
203