xref: /netbsd-src/sys/arch/hp300/dev/ctreg.h (revision cda4f8f6ee55684e8d311b86c99ea59191e6b74f)
1 /*
2  * Copyright (c) 1982, 1990 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by the University of
16  *	California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *	@(#)ctreg.h	7.1 (Berkeley) 5/8/90
34  */
35 
36 struct	ct_iocmd {
37 	char	unit;
38 	char	saddr;
39 	short	addr0;
40 	long	addr;
41 	char	nop2;
42 	char	slen;
43 	long	len;
44 	char	nop3;
45 	char	cmd;
46 };
47 
48 struct	ct_rscmd {
49 	char	unit;
50 	char	cmd;
51 };
52 
53 struct	ct_stat {
54 	char	c_vu;
55 	char	c_pend;
56 	short	c_ref;
57 	short	c_fef;
58 	short	c_aef;
59 	short	c_ief;
60 	short	c_blk0;
61 	long	c_blk;
62 	char	c_pad[4];
63 };
64 
65 struct	ct_ssmcmd {
66 	char	unit;
67 	char	cmd;
68 	short	refm;
69 	short	fefm;
70 	short	aefm;
71 	short	iefm;
72 };
73 
74 struct	ct_srcmd {
75 	char	unit;
76 	char	nop;
77 	char	cmd;
78 	char	param;
79 };
80 
81 struct	ct_soptcmd {
82 	char	unit;
83 	char	nop;
84 	char	cmd;
85 	char	opt;
86 };
87 
88 struct	ct_ulcmd {
89 	char	unit;
90 	char	cmd;
91 };
92 
93 struct	ct_wfmcmd {
94 	char	unit;
95 	char	cmd;
96 };
97 
98 struct	ct_clearcmd {
99 	char	unit;
100 	char	cmd;
101 };
102 
103 struct ct_describe {
104 	u_int	d_iuw:16,	/* controller: installed unit word */
105 		d_cmaxxfr:16,	/* controller: max transfer rate (Kb) */
106 		d_ctype:8,	/* controller: controller type */
107 		d_utype:8,	/* unit: unit type */
108 		d_name:24,	/* unit: name (6 BCD digits) */
109 		d_sectsize:16,	/* unit: # of bytes per block (sector) */
110 		d_blkbuf:8,	/* unit: # of blocks which can be buffered */
111 		d_burstsize:8,	/* unit: recommended burst size */
112 		d_blocktime:16,	/* unit: block time (u-sec) */
113 		d_uavexfr:16,	/* unit: average transfer rate (Kb) */
114 		d_retry:16,	/* unit: optimal retry time (1/100-sec) */
115 		d_access:16,	/* unit: access time param (1/100-sec) */
116 		d_maxint:8,	/* unit: maximum interleave */
117 		d_fvbyte:8,	/* unit: fixed volume byte */
118 		d_rvbyte:8,	/* unit: removeable volume byte */
119 		d_maxcyl:24,	/* volume: maximum cylinder */
120 		d_maxhead:8,	/* volume: maximum head */
121 		d_maxsect:16,	/* volume: maximum sector on track */
122 		d_maxvsecth:16,	/* volume: maximum sector on volume (MSW) */
123 		d_maxvsectl:32,	/* volume: maximum sector on volume (LSWs) */
124 		d_interleave:8;	/* volume: current interleave */
125  };
126 
127 #define	CT7946ID	0x220
128 #define CT9145ID	0x268
129 #define	CT9144ID	0x260
130 #define	CT9144		0
131 #define	CT7912PID	0x209
132 #define	CT7914PID	0x20B
133 #define	CT88140		1
134 
135 /* convert bytes to 1k tape block and back */
136 #define CTBTOK(x)	((x) >> 10)
137 #define CTKTOB(x)	((x) << 10)
138 
139 #define	CTCTLR		15
140 
141 #define	REF_MASK	0x0
142 #define	FEF_MASK	0x0
143 #define	AEF_MASK	0x0
144 #define	IEF_MASK	0xF970
145 
146 #define	FEF_PF		0x0002
147 #define	FEF_REXMT	0x0001
148 #define	AEF_EOF		0x0010
149 #define	AEF_EOV		0x0008
150 
151 #define	C_READ		0x00
152 #define	C_WRITE		0x02
153 #define	C_CLEAR		0x08
154 #define	C_STATUS	0x0d
155 #define	C_SADDR		0x10
156 #define	C_SLEN		0x18
157 #define	C_SUNIT(x)	(0x20 | (x))
158 #define	C_SVOL(x)	(0x40 | (x))
159 #define	C_NOP		0x34
160 #define C_DESC		0x35
161 #define	C_SOPT		0x38
162 #define	C_SREL		0x3b
163 #define	C_SSM		0x3e
164 #define	C_WFM		0x49
165 #define	C_UNLOAD	0x4a
166 #define	C_REL		0x140
167 
168 #define	C_CMD		0x05
169 #define	C_EXEC		0x0e
170 #define	C_QSTAT		0x10
171 #define	C_TCMD		0x12
172 
173 #define C_CC            1
174 #define C_SKSPAR        2
175 #define	C_OPT		4
176 #define C_SPAR          4
177 #define C_IMRPT         8
178