tsreg.h revision 1.3 1 1.3 simonb /* $NetBSD: tsreg.h,v 1.3 2005/02/26 12:45:06 simonb Exp $ */
2 1.1 ragge /*
3 1.1 ragge * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
4 1.1 ragge * All rights reserved.
5 1.1 ragge *
6 1.1 ragge * This code is derived from software contributed to Ludd by
7 1.1 ragge * Bertram Barth.
8 1.1 ragge *
9 1.1 ragge * Redistribution and use in source and binary forms, with or without
10 1.1 ragge * modification, are permitted provided that the following conditions
11 1.1 ragge * are met:
12 1.1 ragge * 1. Redistributions of source code must retain the above copyright
13 1.1 ragge * notice, this list of conditions and the following disclaimer.
14 1.1 ragge * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 ragge * notice, this list of conditions and the following disclaimer in the
16 1.1 ragge * documentation and/or other materials provided with the distribution.
17 1.1 ragge * 3. All advertising materials mentioning features or use of this software
18 1.1 ragge * must display the following acknowledgement:
19 1.3 simonb * This product includes software developed at Ludd, University of
20 1.1 ragge * Lule}, Sweden and its contributors.
21 1.1 ragge * 4. The name of the author may not be used to endorse or promote products
22 1.1 ragge * derived from this software without specific prior written permission
23 1.1 ragge *
24 1.1 ragge * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 1.1 ragge * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 1.1 ragge * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 1.1 ragge * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 1.1 ragge * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 1.1 ragge * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 1.1 ragge * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 1.1 ragge * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 1.1 ragge * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 1.1 ragge * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 1.1 ragge */
35 1.1 ragge
36 1.1 ragge /*
37 1.1 ragge * TSV05 u.g. 5-11:
38 1.3 simonb *
39 1.1 ragge * The TSV05 Subsystem has four device registers that occupy only two
40 1.1 ragge * LSI-11 Bus word locations: a Data Buffer (TSDB), a Bus Address
41 1.1 ragge * Register (TSBA), a Status Register (TSSR), and an Extended Data
42 1.1 ragge * Bufffer (TSDBX). The TSDB is an 18-bit register that is ...
43 1.1 ragge */
44 1.1 ragge
45 1.2 ragge #ifdef notdef
46 1.1 ragge struct tsdevice {
47 1.1 ragge unsigned short tsdb;/* Data Buffer (TSDB)/Bus Address Register (TSBA) */
48 1.1 ragge unsigned short tssr;/* Status Reg. (TSSR)/Extended Data Buffer(TSDBX) */
49 1.1 ragge };
50 1.2 ragge #endif
51 1.2 ragge #define TSDB 0
52 1.2 ragge #define TSBA 0
53 1.2 ragge #define TSSR 2
54 1.2 ragge #define TSDBX 3
55 1.1 ragge
56 1.1 ragge /*
57 1.3 simonb * TSSR Register bit definitions
58 1.1 ragge */
59 1.1 ragge #define TS_SC 0x8000 /* Special Condition */
60 1.1 ragge #define TS_UPE 0x4000 /* not used in TSV05, UPE in TS11 */
61 1.1 ragge #define TS_SCE 0x2000 /* Sanity Check Error, SPE in TS11 */
62 1.1 ragge #define TS_RMR 0x1000 /* Register Modification Refused */
63 1.1 ragge #define TS_NXM 0x0800 /* Nonexistent Memory */
64 1.1 ragge #define TS_NBA 0x0400 /* Need Buffer Address */
65 1.1 ragge #define TS_A11 0x0300 /* Address Bits 17-16 */
66 1.3 simonb #define TS_SSR 0x0080 /* Subsystem Ready */
67 1.1 ragge #define TS_OFL 0x0040 /* Off Line */
68 1.1 ragge #define TS_FTC 0x0030 /* Fatal Termination Class Code */
69 1.1 ragge #define TS_TC 0x000E /* Termination Class Code */
70 1.1 ragge #define TS_NU 0x0001 /* Not Used */
71 1.1 ragge
72 1.1 ragge #define TS_TSSR_BITS "\20\20SC\17UPE\16SCE\15RMR\14NXM\13NBA\12A17\11A16" \
73 1.1 ragge "\10SSR\7OFL\6FTC\5FTC\4FTL\3ERR\2ATTN\1NU"
74 1.1 ragge
75 1.3 simonb /*
76 1.1 ragge * Termination Codes
77 1.1 ragge */
78 1.1 ragge #define TS_FTC_IDF (0<<4) /* internal diagnostic failure */
79 1.1 ragge #define TS_FTC_RSVD (1<<4) /* Reserved */
80 1.1 ragge #define TS_FTC_NU (2<<4) /* Not Used */
81 1.1 ragge #define TS_FTC_DPD (3<<4) /* Detection of Power Down (not implemented) */
82 1.1 ragge
83 1.1 ragge #define TS_TC_NORM (0<<1) /* Normal Termination */
84 1.1 ragge #define TS_TC_ATTN (1<<1) /* Attention Condition */
85 1.1 ragge #define TS_TC_TSA (2<<1) /* Tape status alert */
86 1.1 ragge #define TS_TC_FR (3<<1) /* Function reject */
87 1.1 ragge #define TS_TC_TPD (4<<1) /* Tape position is one record down (recov.) */
88 1.1 ragge #define TS_TC_TNM (5<<1) /* Tape not moved (recoverable) */
89 1.1 ragge #define TS_TC_TPL (6<<1) /* Tape position lost (unrecoverable) */
90 1.1 ragge #define TS_TC_FCE (7<<1) /* Fatal Controller Error (see FTC) */
91 1.1 ragge
92 1.2 ragge struct cmd { /* command packet (not all words required) */
93 1.1 ragge unsigned short cmdr; /* command word */
94 1.1 ragge unsigned short cw1; /* low order data pointer address (A15-00) */
95 1.1 ragge unsigned short cw2; /* high order data pointer address (A21-16) */
96 1.1 ragge unsigned short cw3; /* count parameter */
97 1.1 ragge };
98 1.1 ragge
99 1.1 ragge /*
100 1.1 ragge * Command flags
101 1.1 ragge */
102 1.1 ragge #define TS_CF_ACK (1<<15) /* Acknowledge */
103 1.1 ragge #define TS_CF_CVC (1<<14) /* Clear Volume Check */
104 1.1 ragge #define TS_CF_OPP (1<<13) /* Opposite */
105 1.1 ragge #define TS_CF_SWB (1<<12) /* Swap Bytes */
106 1.1 ragge #define TS_CF_IE (1<< 7) /* Interrupt Enable */
107 1.1 ragge #define TS_CF_CMODE 0x0F00 /* Command Mode Field */
108 1.1 ragge #define TS_CF_CCODE 0x001F /* Command Code (major) */
109 1.1 ragge #define TS_CF_CMASK 0x0F1F /* mask for complete command */
110 1.1 ragge
111 1.1 ragge #define TS_CMD(cMode,cCode) ((cMode<<8)|cCode)
112 1.1 ragge
113 1.1 ragge #define TS_CC_READ 0x01 /* READ */
114 1.1 ragge #define TS_CMD_RNF TS_CMD(0,TS_CC_READ) /* Read Next (Forward) */
115 1.1 ragge #define TS_CMD_RPR TS_CMD(1,TS_CC_READ) /* Read Previous (Reverse) */
116 1.3 simonb #define TS_CMD_RPF TS_CMD(2,TS_CC_READ) /* Read Previous (Forward) */
117 1.1 ragge #define TS_CMD_RNR TS_CMD(3,TS_CC_READ) /* Read Next (Reverse) */
118 1.1 ragge
119 1.1 ragge #define TS_CC_WCHAR 0x04 /* WRITE CHARACTERISTICS */
120 1.1 ragge #define TS_CMD_WCHAR TS_CMD(0,TS_CC_WCHAR) /* Load msg-buffer etc. */
121 1.1 ragge
122 1.1 ragge #define TS_CC_WRITE 0x05 /* WRITE */
123 1.1 ragge #define TS_CMD_WD TS_CMD(0,TS_CC_WRITE) /* Write Data (Next) */
124 1.1 ragge #define TS_CMD_WDR TS_CMD(1,TS_CC_WRITE) /* Write Data (Retry) */
125 1.1 ragge
126 1.1 ragge #define TS_CC_WSM 0x06 /* WRITE SUBSYSTEM MEMORY */
127 1.1 ragge #define TS_CMD_WSM TS_CMD(0,TS_CC_WSM) /* (diagnostics only) */
128 1.1 ragge
129 1.1 ragge #define TS_CC_POS 0x08 /* POSITION */
130 1.1 ragge #define TS_CMD_SRF TS_CMD(0,TS_CC_POS) /* Space Records Forward */
131 1.1 ragge #define TS_CMD_SRR TS_CMD(1,TS_CC_POS) /* Space Records Reverse */
132 1.1 ragge #define TS_CMD_STMF TS_CMD(2,TS_CC_POS) /* Skip Tape Marks Forward */
133 1.1 ragge #define TS_CMD_STMR TS_CMD(3,TS_CC_POS) /* Skip Tape Marks Reverse */
134 1.1 ragge #define TS_CMD_RWND TS_CMD(4,TS_CC_POS) /* Rewind */
135 1.1 ragge
136 1.1 ragge #define TS_CC_FRMT 0x09 /* FORMAT */
137 1.1 ragge #define TS_CMD_WTM TS_CMD(0,TS_CC_FRMT) /* Write Tape Mark */
138 1.1 ragge #define TS_CMD_ETM TS_CMD(1,TS_CC_FRMT) /* Erase */
139 1.1 ragge #define TS_CMD_WTMR TS_CMD(2,TS_CC_FRMT) /* Write Tape Mark (Retry) */
140 1.1 ragge
141 1.1 ragge #define TS_CC_CTRL 0x0A /* CONTROL */
142 1.1 ragge #define TS_CMD_MBR TS_CMD(0,TS_CC_CTRL) /* Message Buffer Release */
143 1.1 ragge #define TS_CMD_RWUL TS_CMD(1,TS_CC_CTRL) /* Rewind and Unload */
144 1.1 ragge #define TS_CMD_NOP TS_CMD(2,TS_CC_CTRL) /* NO-OP (TS11: clean tape) */
145 1.1 ragge #define TS_CMD_RWII TS_CMD(4,TS_CC_CTRL) /* Rewind with intermediate */
146 1.1 ragge /* interrupt (TS11: N.A.) */
147 1.1 ragge #define TS_CC_INIT 0x0B /* INITIALIZE */
148 1.1 ragge #define TS_CMD_INIT TS_CMD(0,TS_CC_INIT) /* Controller/Drive Initial. */
149 1.1 ragge
150 1.1 ragge #define TS_CC_STAT 0x0F /* GET STATUS */
151 1.1 ragge #define TS_CMD_STAT TS_CMD(0,TS_CC_STAT) /* Get Status (END) */
152 1.1 ragge
153 1.2 ragge struct status { /* message packet */
154 1.1 ragge unsigned short hdr; /* ACK, class-code, format 1, message type */
155 1.1 ragge unsigned short dfl; /* data field length (8 bit) */
156 1.1 ragge unsigned short rbpcr; /* residual b/r/tm count word */
157 1.1 ragge unsigned short xst0; /* Extended Status Registers 0-4 */
158 1.1 ragge unsigned short xst1;
159 1.1 ragge unsigned short xst2;
160 1.1 ragge unsigned short xst3;
161 1.1 ragge unsigned short xst4; /* total size: 16 bytes */
162 1.1 ragge };
163 1.1 ragge
164 1.2 ragge struct chr {
165 1.2 ragge unsigned short sadrl; /* low-word of status addr */
166 1.2 ragge unsigned short sadrh;
167 1.2 ragge unsigned short onesix; /* 016/020 */
168 1.2 ragge unsigned short chrw; /* Characteristics word */
169 1.2 ragge unsigned short xchrw; /* TS05 extra word */
170 1.2 ragge };
171 1.1 ragge /*
172 1.1 ragge * Flags used in write-characteristics command
173 1.1 ragge */
174 1.1 ragge #define TS_WC_ESS (1<<7) /* Enable Skip Tape Marks Stop */
175 1.1 ragge #define TS_WC_ENB (1<<6) /* Enable Tape Mark Stop at Bot */
176 1.1 ragge #define TS_WC_EAI (1<<5) /* Enable Attention interrupts */
177 1.1 ragge #define TS_WC_ERI (1<<4) /* Enable Message Buffer Release interrupts */
178 1.2 ragge #define TS_WCX_HSP (1<<5) /* High Speed Select (25 in/s vs. 100 in/s) */
179 1.2 ragge #define TS_WCX_RBUF (1<<4) /* Enable read buffering */
180 1.2 ragge #define TS_WCX_WBUF (1<<3) /* Enable write buffering */
181 1.1 ragge
182 1.1 ragge /*
183 1.1 ragge * Status flags
184 1.1 ragge *
185 1.3 simonb * Extended Status register 0 (XST0) -- XST0 appears as the fourth word
186 1.3 simonb * in the message buffer stored by the TSV05 subsystem upon completion of
187 1.1 ragge * a command or an ATTN
188 1.1 ragge */
189 1.1 ragge #define TS_SF_TMK (1<<15) /* Tape Mark Detected */
190 1.1 ragge #define TS_SF_RLS (1<<14) /* Record Length Short */
191 1.1 ragge #define TS_SF_LET (1<<13) /* Logical End of Tape */
192 1.1 ragge #define TS_SF_RLL (1<<12) /* Record Length Long */
193 1.1 ragge #define TS_SF_WLE (1<<11) /* Write Lock Error */
194 1.1 ragge #define TS_SF_NEF (1<<10) /* Nonexecutable Function */
195 1.1 ragge #define TS_SF_ILC (1<< 9) /* Illegal Command */
196 1.1 ragge #define TS_SF_ILA (1<< 8) /* Illegal Address */
197 1.1 ragge #define TS_SF_MOT (1<< 7) /* Motion */
198 1.1 ragge #define TS_SF_ONL (1<< 6) /* On-Line */
199 1.1 ragge #define TS_SF_IE (1<< 5) /* Interrupt Enable */
200 1.1 ragge #define TS_SF_VCK (1<< 4) /* Volume Check */
201 1.1 ragge #define TS_SF_PED (1<< 3) /* Phase Encoded Drive */
202 1.1 ragge #define TS_SF_WLK (1<< 2) /* Write Locked */
203 1.1 ragge #define TS_SF_BOT (1<< 1) /* Beginning of Tape */
204 1.1 ragge #define TS_SF_EOT (1<< 0) /* End of Tape */
205 1.1 ragge
206 1.1 ragge #define TS_XST0_BITS "\20\20TMK\17RLS\16LET\15RLL\14WLE\13NEF\12ILC\11ILA" \
207 1.1 ragge "\10MOT\07ONL\06IE \05VCK\04PED\03WLK\02BOT\01EOT"
208 1.1 ragge /*
209 1.3 simonb * Extended Status register 1 (XST1) -- XST1 appears as the fifth word
210 1.3 simonb * in the message buffer stored by the TSV05 subsystem upon completion of
211 1.1 ragge * a command or an ATTN
212 1.1 ragge */
213 1.1 ragge #define TS_SF_DLT (1<<15) /* Data Late */
214 1.1 ragge #define TS_SF_COR (1<<13) /* Correctable Data */
215 1.1 ragge #define TS_SF_CRS (1<<12) /* TS11: Crease Detected */
216 1.1 ragge #define TS_SF_TIG (1<<11) /* TS11: Trash in Gap */
217 1.1 ragge #define TS_SF_DBF (1<<10) /* TS11: Desckew Buffer Fail */
218 1.1 ragge #define TS_SF_SCK (1<< 9) /* TS11: Speed Check */
219 1.1 ragge #define TS_SF_RBP (1<< 8) /* Read Bus Parity Error */
220 1.1 ragge #define TS_SF_IPR (1<< 7) /* TS11: Invalid Preamble */
221 1.1 ragge #define TS_SF_IPO (1<< 6) /* TS11: Invalid Postamble */
222 1.1 ragge #define TS_SF_SYN (1<< 5) /* TS11: Sync Failure */
223 1.1 ragge #define TS_SF_IED (1<< 4) /* TS11: Invalid End Data */
224 1.1 ragge #define TS_SF_POS (1<< 3) /* TS11: Postamble short */
225 1.1 ragge #define TS_SF_POL (1<< 2) /* TS11: Postamble long */
226 1.1 ragge #define TS_SF_UNC (1<< 1) /* Uncorrectable Data or Hard Error */
227 1.1 ragge #define TS_SF_MTE (1<< 0) /* TS11: Multitrack Error */
228 1.1 ragge
229 1.1 ragge #define TS_XST1_BITS "\20\20DLT\16COR\15CRS\14TIG\13DBF\12SCK\11RBP" \
230 1.1 ragge "\10IPR\07IPO\06SYN\05IED\04POS\03POL\02UNC\01MTE"
231 1.1 ragge
232 1.1 ragge /*
233 1.3 simonb * Extended Status register 2 (XST2) -- sixth word
234 1.1 ragge */
235 1.1 ragge #define TS_SF_OPM (1<<15) /* Operation in Progress (tape moving) */
236 1.1 ragge #define TS_SF_RCE (1<<14) /* RAM Checksum Error */
237 1.1 ragge #define TS_SF_SBP (1<<13) /* TS11: Serial 08 bus parity */
238 1.1 ragge #define TS_SF_CAF (1<<12) /* TS11: Capstan Acceleration fail */
239 1.2 ragge #define TS_SF_TU80 (1<<11) /* Is a TU80 */
240 1.1 ragge #define TS_SF_WCF (1<<10) /* Write Clock Failure */
241 1.1 ragge #define TS_SF_PDT (1<< 8) /* TS11: Parity Dead Track */
242 1.1 ragge #define TS_SF_RL 0x00FF /* Revision Level */
243 1.1 ragge #define TS_SF_EFES (1<< 7) /* extended features enable switch */
244 1.1 ragge #define TS_SF_BES (1<< 6) /* Buffering enable switch */
245 1.1 ragge #define TS_SF_MCRL 0x003F /* micro-code revision level */
246 1.1 ragge #define TS_SF_UNIT 0x0003 /* unit number of selected transport */
247 1.1 ragge
248 1.1 ragge #define TS_XST2_BITS "\20\20OPM\17RCE\16SBP\15CAF\13WCF\11PDT\10EFES\7BES"
249 1.1 ragge
250 1.1 ragge /*
251 1.3 simonb * Extended Status register 3 (XST3)) -- seventh word
252 1.1 ragge */
253 1.1 ragge #define TS_SF_MDE 0xFF00 /* Micro-Diagnostics Error Code */
254 1.1 ragge #define TS_SF_LMX (1<< 7) /* TS11: Tension Arm Limit Exceeded */
255 1.1 ragge #define TS_SF_OPI (1<< 6) /* Operation Incomplete */
256 1.1 ragge #define TS_SF_REV (1<< 5) /* Revers */
257 1.1 ragge #define TS_SF_CRF (1<< 4) /* TS11: Capstan Response Failure */
258 1.1 ragge #define TS_SF_DCK (1<< 3) /* Density Check */
259 1.1 ragge #define TS_SF_NBE (1<< 2) /* TS11: Noise Bit during Erase */
260 1.1 ragge #define TS_SF_LSA (1<< 1) /* TS11: Limit Switch Activated */
261 1.1 ragge #define TS_SF_RIB (1<< 0) /* Reverse into BOT */
262 1.1 ragge
263 1.1 ragge #define TS_XST3_BITS "\20\10LMX\07OPI\06REV\05CRF\04DCK\03NBE\02LSA\01RIB"
264 1.1 ragge
265 1.1 ragge /*
266 1.3 simonb * Extended Status register 4 (XST4)) -- eighth word
267 1.1 ragge */
268 1.1 ragge #define TS_SF_HSP (1<<15) /* High Speed */
269 1.1 ragge #define TS_SF_RCX (1<<14) /* Retry Count Exceeded */
270 1.1 ragge #define TS_SF_WRC 0x00FF /* Write Retry Count Statistics */
271 1.1 ragge
272 1.1 ragge #define TS_XST4_BITS "\20\20HSP\17RCX"
273 1.1 ragge
274 1.1 ragge
275