Fixed printf's so that they announce them selfs correctly (ie aha%d: before
[unix-history] / sys / scsi / scsi_tape.h
CommitLineData
15637ed4
RG
1/*
2 * SCSI tape interface description
3 */
4
5/*
6 * Written by Julian Elischer (julian@tfs.com)
7 * for TRW Financial Systems.
8 *
9 * TRW Financial Systems, in accordance with their agreement with Carnegie
10 * Mellon University, makes this software available to CMU to distribute
11 * or use in any manner that they see fit as long as this message is kept with
12 * the software. For this reason TFS also grants any other persons or
13 * organisations permission to use or modify this software.
14 *
15 * TFS supplies this software to be publicly redistributed
16 * on the understanding that TFS is not responsible for the correct
17 * functioning of this software in any circumstances.
18 *
15637ed4 19 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
98639498
RG
20 *
21 * $Id$
15637ed4
RG
22 */
23
24/*
25 * SCSI command format
26 */
27
15637ed4
RG
28struct scsi_rw_tape
29{
30 u_char op_code;
869c4419
RG
31 u_char byte2;
32#define SRWT_FIXED 0x01
15637ed4 33 u_char len[3];
869c4419 34 u_char control;
15637ed4
RG
35} rw_tape;
36
37struct scsi_space
38{
39 u_char op_code;
869c4419
RG
40 u_char byte2;
41#define SS_CODE 0x03
15637ed4 42 u_char number[3];
869c4419 43 u_char control;
15637ed4
RG
44} space;
45#define SP_BLKS 0
46#define SP_FILEMARKS 1
47#define SP_SEQ_FILEMARKS 2
48#define SP_EOM 3
49
50struct scsi_write_filemarks
51{
52 u_char op_code;
869c4419 53 u_char byte2;
15637ed4 54 u_char number[3];
869c4419 55 u_char control;
15637ed4
RG
56} write_filemarks;
57
58struct scsi_rewind
59{
60 u_char op_code;
869c4419
RG
61 u_char byte2;
62#define SR_IMMED 0x01
15637ed4 63 u_char unused[3];
869c4419 64 u_char control;
15637ed4
RG
65} rewind;
66
67struct scsi_load
68{
69 u_char op_code;
869c4419
RG
70 u_char byte2;
71#define SL_IMMED 0x01
15637ed4 72 u_char unused[2];
869c4419
RG
73 u_char how;
74 u_char control;
15637ed4
RG
75} load;
76#define LD_UNLOAD 0
77#define LD_LOAD 1
869c4419
RG
78#define LD_RETEN 2
79
15637ed4
RG
80
81struct scsi_blk_limits
82{
83 u_char op_code;
869c4419 84 u_char byte2;
15637ed4 85 u_char unused[3];
869c4419 86 u_char control;
15637ed4
RG
87} blk_limits;
88
89/*
90 * Opcodes
91 */
92
93#define REWIND 0x01
94#define READ_BLK_LIMITS 0x05
95#define READ_COMMAND_TAPE 0x08
96#define WRITE_COMMAND_TAPE 0x0a
97#define WRITE_FILEMARKS 0x10
98#define SPACE 0x11
99#define LOAD_UNLOAD 0x1b /* same as above */
100
101
102
103struct scsi_blk_limits_data
104{
105 u_char reserved;
106 u_char max_length_2; /* Most significant */
107 u_char max_length_1;
108 u_char max_length_0; /* Least significant */
109 u_char min_length_1; /* Most significant */
110 u_char min_length_0; /* Least significant */
111};
112
869c4419
RG
113/* defines for the device specific byte in the mode select/sense header */
114#define SMH_DSP_SPEED 0x0F
115#define SMH_DSP_BUFF_MODE 0x70
116#define SMH_DSP_BUFF_MODE_OFF 0x00
117#define SMH_DSP_BUFF_MODE_ON 0x10
118#define SMH_DSP_BUFF_MODE_MLTI 0x20
119#define SMH_DSP_WRITE_PROT 0x80
15637ed4 120
a0becc21
NW
121/* A special for the CIPHER ST150S(old drive) */
122struct blk_desc_cipher
123{
124 u_char density;
125 u_char nblocks[3];
126 u_char reserved;
127 u_char blklen[3];
869c4419
RG
128 u_char other;
129#define ST150_SEC 0x01 /* soft error count */
130#define SR150_AUI 0x02 /* autoload inhibit */
a0becc21
NW
131};
132
133
15637ed4 134
a0becc21
NW
135/**********************************************************************
136 from the scsi2 spec
137 Value Tracks Density(bpi) Code Type Reference Note
138 0x1 9 800 NRZI R X3.22-1983 2
139 0x2 9 1600 PE R X3.39-1986 2
140 0x3 9 6250 GCR R X3.54-1986 2
141 0x5 4/9 8000 GCR C X3.136-1986 1
142 0x6 9 3200 PE R X3.157-1987 2
143 0x7 4 6400 IMFM C X3.116-1986 1
144 0x8 4 8000 GCR CS X3.158-1986 1
145 0x9 18 37871 GCR C X3B5/87-099 2
146 0xA 22 6667 MFM C X3B5/86-199 1
147 0xB 4 1600 PE C X3.56-1986 1
148 0xC 24 12690 GCR C HI-TC1 1,5
149 0xD 24 25380 GCR C HI-TC2 1,5
150 0xF 15 10000 GCR C QIC-120 1,5
151 0x10 18 10000 GCR C QIC-150 1,5
152 0x11 26 16000 GCR C QIC-320(525?) 1,5
153 0x12 30 51667 RLL C QIC-1350 1,5
154 0x13 1 61000 DDS CS X3B5/88-185A 4
155 0x14 1 43245 RLL CS X3.202-1991 4
156 0x15 1 45434 RLL CS ECMA TC17 4
157 0x16 48 10000 MFM C X3.193-1990 1
158 0x17 48 42500 MFM C X3B5/91-174 1
159
160 where Code means:
161 NRZI Non Return to Zero, change on ones
162 GCR Group Code Recording
163 PE Phase Encoded
164 IMFM Inverted Modified Frequency Modulation
165 MFM Modified Frequency Modulation
166 DDS Dat Data Storage
167 RLL Run Length Encoding
168
169 where Type means:
170 R Real-to-Real
171 C Cartridge
172 CS cassette
173
174 where Notes means:
175 1 Serial Recorded
176 2 Parallel Recorded
177 3 Old format know as QIC-11
178 4 Helical Scan
179 5 Not ANSI standard, rather industry standard.
180
181********************************************************************/
182
183#define HALFINCH_800 0x01
184#define HALFINCH_1600 0x02
185#define HALFINCH_6250 0x03
186#define QIC_24 0x05 /* may be bad, works for CIPHER ST150S XXX */
187#define QIC_120 0x0f
188#define QIC_150 0x10
189#define QIC_320 0x11
190#define QIC_525 0x11
191#define QIC_1320 0x12
15637ed4
RG
192
193