xref: /netbsd-src/sys/dev/qbus/if_dmcreg.h (revision 95e1ffb15694e54f29f8baaa4232152b703c2a5a)
1 /*	$NetBSD: if_dmcreg.h,v 1.4 2005/12/11 12:23:29 christos 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. Neither the name of the University nor the names of its contributors
15  *    may be used to endorse or promote products derived from this software
16  *    without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  *	@(#)if_dmc.h	7.5 (Berkeley) 6/28/90
31  */
32 
33 /*
34  * DMC-11 Interface
35  */
36 
37 #ifdef notdef
38 struct dmcdevice {
39 	char	bsel0;
40 	char	bsel1;
41 	char	bsel2;
42 	char	bsel3;
43 	short	sel4;
44 	short	sel6;
45 };
46 #endif
47 
48 #define	DMC_BSEL0	0
49 #define DMC_BSEL1	1
50 #define DMC_BSEL2	2
51 #define DMC_BSEL3	3
52 #define DMC_SEL4	4
53 #define DMC_SEL6	6
54 
55 /*
56  * dmc software packet encapsulation.  This allows the dmc
57  * link to be multiplexed among several protocols.
58  * The first eight bytes of the dmc header are garbage,
59  * since on a vax the uba has been known to mung these
60  * bytes.  The next two bytes encapsulate packet type.
61  */
62 struct dmc_header {
63 	char	dmc_buf[8];	/* space for uba on vax */
64 	short	dmc_type;	/* encapsulate packet type */
65 };
66 
67 /* packet types */
68 #define	DMC_IPTYPE	1
69 #define	DMC_TRAILER	2
70 #define	DMC_NTRAILER	16
71 
72 /*
73  * DMCMTU includes space for data (1024) +
74  * protocol header (256) + trailer descriptor (4).
75  * The software link encapsulation header (dmc_header)
76  * is handled separately.
77 	#define DMCMTU  1284
78  */
79 #define DMCMTU  1500
80 
81 #define	RDYSCAN	16	/* loop delay for RDYI after RQI */
82 
83 /* defines for bsel0 */
84 #define	DMC_BACCI	0
85 #define	DMC_CNTLI	1
86 #define	DMC_PERR	2
87 #define	DMC_BASEI	3
88 #define	DMC_WRITE	0		/* transmit block */
89 #define	DMC_READ	4		/* read block */
90 #define	DMC_RQI		0040		/* port request bit */
91 #define	DMC_IEI		0100		/* enable input interrupts */
92 #define	DMC_RDYI	0200		/* port ready */
93 #define	DMC0BITS	"\10\10RDI\7IEI\6RQI"
94 
95 /* defines for bsel1 */
96 #define	DMC_MCLR	0100		/* DMC11 Master Clear */
97 #define	DMC_RUN		0200		/* clock running */
98 #define	DMC1BITS	"\10\10RUN\7MCLR"
99 
100 /* defines for bsel2 */
101 #define	DMC_BACCO	0
102 #define	DMC_CNTLO	1
103 #define	DMC_OUX		0		/* transmit block */
104 #define	DMC_OUR		4		/* read block */
105 #define	DMC_IEO		0100		/* enable output interrupts */
106 #define	DMC_RDYO	0200		/* port available */
107 #define	DMC2BITS	"\10\10RDO\7IEO"
108 
109 /* defines for CNTLI mode */
110 #define	DMC_HDPLX	02000		/* half duplex DDCMP operation */
111 #define	DMC_SEC		04000		/* half duplex secondary station */
112 #define	DMC_MAINT	00400		/* enter maintenance mode */
113 
114 /* defines for BACCI/O and BASEI mode */
115 #define	DMC_XMEM	0140000		/* xmem bit position */
116 #define	DMC_CCOUNT	0037777		/* character count mask */
117 #define	DMC_RESUME	0002000		/* resume (BASEI only) */
118 
119 /* defines for CNTLO */
120 #define	DMC_CNTMASK	01777
121 
122 #define	DMC_DATACK	01
123 #define	DMC_TIMEOUT	02
124 #define	DMC_NOBUFS	04
125 #define	DMC_MAINTREC	010
126 #define	DMC_LOSTDATA	020
127 #define	DMC_DISCONN	0100
128 #define	DMC_START	0200
129 #define	DMC_NEXMEM	0400
130 #define	DMC_ERROR	01000
131 
132 #define	DMC_FATAL (DMC_ERROR|DMC_NEXMEM|DMC_START|DMC_LOSTDATA|DMC_MAINTREC)
133 #define	CNTLO_BITS	\
134    "\10\12ERROR\11NEXMEM\10START\7DISC\5LSTDATA\4MAINT\3NOBUF\2TIMEO\1DATACK"
135