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