xref: /netbsd/sys/dev/qbus/if_dmcreg.h (revision bf9ec67e)
1 /*	$NetBSD: if_dmcreg.h,v 1.1 2001/05/06 17:36:04 ragge Exp $	*/
2 /*
3  * Copyright (c) 1982, 1986 Regents of the University of California.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  *    must display the following acknowledgement:
16  *	This product includes software developed by the University of
17  *	California, Berkeley and its contributors.
18  * 4. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR 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
32  * SUCH DAMAGE.
33  *
34  *	@(#)if_dmc.h	7.5 (Berkeley) 6/28/90
35  */
36 
37 /*
38  * DMC-11 Interface
39  */
40 
41 #ifdef notdef
42 struct dmcdevice {
43         char    bsel0;
44 	char 	bsel1;
45 	char	bsel2;
46 	char 	bsel3;
47 	short	sel4;
48 	short	sel6;
49 };
50 #endif
51 
52 #define	DMC_BSEL0	0
53 #define DMC_BSEL1	1
54 #define DMC_BSEL2	2
55 #define DMC_BSEL3	3
56 #define DMC_SEL4	4
57 #define DMC_SEL6	6
58 
59 /*
60  * dmc software packet encapsulation.  This allows the dmc
61  * link to be multiplexed among several protocols.
62  * The first eight bytes of the dmc header are garbage,
63  * since on a vax the uba has been known to mung these
64  * bytes.  The next two bytes encapsulate packet type.
65  */
66 struct dmc_header {
67 	char	dmc_buf[8];	/* space for uba on vax */
68 	short	dmc_type;	/* encapsulate packet type */
69 };
70 
71 /* packet types */
72 #define	DMC_IPTYPE	1
73 #define	DMC_TRAILER	2
74 #define	DMC_NTRAILER	16
75 
76 /*
77  * DMCMTU includes space for data (1024) +
78  * protocol header (256) + trailer descriptor (4).
79  * The software link encapsulation header (dmc_header)
80  * is handled separately.
81 	#define DMCMTU  1284
82  */
83 #define DMCMTU  1500
84 
85 #define	RDYSCAN	16	/* loop delay for RDYI after RQI */
86 
87 /* defines for bsel0 */
88 #define	DMC_BACCI	0
89 #define	DMC_CNTLI	1
90 #define	DMC_PERR	2
91 #define	DMC_BASEI	3
92 #define	DMC_WRITE	0		/* transmit block */
93 #define	DMC_READ	4		/* read block */
94 #define	DMC_RQI		0040		/* port request bit */
95 #define	DMC_IEI		0100		/* enable input interrupts */
96 #define	DMC_RDYI	0200		/* port ready */
97 #define	DMC0BITS	"\10\10RDI\7IEI\6RQI"
98 
99 /* defines for bsel1 */
100 #define	DMC_MCLR	0100		/* DMC11 Master Clear */
101 #define	DMC_RUN		0200		/* clock running */
102 #define	DMC1BITS	"\10\10RUN\7MCLR"
103 
104 /* defines for bsel2 */
105 #define	DMC_BACCO	0
106 #define	DMC_CNTLO	1
107 #define	DMC_OUX		0		/* transmit block */
108 #define	DMC_OUR		4		/* read block */
109 #define	DMC_IEO		0100		/* enable output interrupts */
110 #define	DMC_RDYO	0200		/* port available */
111 #define	DMC2BITS	"\10\10RDO\7IEO"
112 
113 /* defines for CNTLI mode */
114 #define	DMC_HDPLX	02000		/* half duplex DDCMP operation */
115 #define	DMC_SEC		04000		/* half duplex secondary station */
116 #define	DMC_MAINT	00400		/* enter maintenance mode */
117 
118 /* defines for BACCI/O and BASEI mode */
119 #define	DMC_XMEM	0140000		/* xmem bit position */
120 #define	DMC_CCOUNT	0037777		/* character count mask */
121 #define	DMC_RESUME	0002000		/* resume (BASEI only) */
122 
123 /* defines for CNTLO */
124 #define	DMC_CNTMASK	01777
125 
126 #define	DMC_DATACK	01
127 #define	DMC_TIMEOUT	02
128 #define	DMC_NOBUFS	04
129 #define	DMC_MAINTREC	010
130 #define	DMC_LOSTDATA	020
131 #define	DMC_DISCONN	0100
132 #define	DMC_START	0200
133 #define	DMC_NEXMEM	0400
134 #define	DMC_ERROR	01000
135 
136 #define	DMC_FATAL (DMC_ERROR|DMC_NEXMEM|DMC_START|DMC_LOSTDATA|DMC_MAINTREC)
137 #define	CNTLO_BITS	\
138    "\10\12ERROR\11NEXMEM\10START\7DISC\5LSTDATA\4MAINT\3NOBUF\2TIMEO\1DATACK"
139