FreeBSD/Linux Kernel Cross Reference
sys/sys/ftape.h
1 /*
2 * Copyright (c) 1993 Steve Gerakines
3 *
4 * This is freely redistributable software. You may do anything you
5 * wish with it, so long as the above notice stays intact.
6 *
7 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
8 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
10 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
11 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
12 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
13 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
14 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
15 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
16 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
17 * POSSIBILITY OF SUCH DAMAGE.
18 *
19 * ftape.h - QIC-40/80 floppy tape driver functions
20 * 10/30/93 v0.3
21 * Set up constant values. Added support to get hardware info.
22 *
23 * 08/07/93 v0.2
24 * Header file that sits in /sys/sys, first revision. Support for
25 * ioctl functions added.
26 */
27
28 #ifndef _SYS_FTAPE_H_
29 #define _SYS_FTAPE_H_
30
31 #include <sys/ioccom.h>
32
33 /* Miscellaneous constant values */
34 #define QCV_BLKSIZE 1024 /* Size of a block */
35 #define QCV_SEGSIZE 32768 /* Size of a segment */
36 #define QCV_BLKSEG 32 /* Blocks per segment */
37 #define QCV_ECCSIZE 3072 /* Bytes ecc eats */
38 #define QCV_ECCBLKS 3 /* Blocks ecc eats */
39 #define QCV_NFMT 3 /* Number of tape formats */
40 #define QCV_NLEN 5 /* Number of tape lengths */
41 #define QCV_HDRMAGIC 0xaa55aa55 /* Magic for header segment */
42 #define QCV_FSMAGIC 0x33cc33cc /* Magic for fileset */
43
44 #define UCHAR unsigned char
45 #define USHORT unsigned short
46 #define ULONG unsigned long
47
48 /* Segment request structure. */
49 typedef struct qic_segment {
50 ULONG sg_trk; /* Track number */
51 ULONG sg_seg; /* Segment number */
52 ULONG sg_crcmap; /* Returned bitmap of CRC errors */
53 ULONG sg_badmap; /* Map of known bad sectors */
54 UCHAR *sg_data; /* Segment w/bad blocks discarded */
55 } QIC_Segment;
56
57 /* Tape geometry structure. */
58 typedef struct qic_geom {
59 int g_fmtno; /* Format number */
60 int g_lenno; /* Length number */
61 char *g_fmtdesc; /* Format text description */
62 char *g_lendesc; /* Length text description */
63 int g_trktape; /* Number of tracks per tape */
64 int g_segtrk; /* Number of segments per track */
65 int g_blktrk; /* Number of blocks per track */
66 int g_fdtrk; /* Floppy disk tracks */
67 int g_fdside; /* Floppy disk sectors/side */
68 } QIC_Geom;
69
70 /* Tape hardware info */
71 typedef struct qic_hwinfo {
72 int hw_make; /* 10-bit drive make */
73 int hw_model; /* 6-bit model */
74 int hw_rombeta; /* TRUE if beta rom */
75 int hw_romid; /* 8-bit rom ID */
76 } QIC_HWInfo;
77
78 /* Various ioctl() routines. */
79 #define QIOREAD _IOWR('q', 1, QIC_Segment) /* Read segment */
80 #define QIOWRITE _IOW('q', 2, QIC_Segment) /* Write segment */
81 #define QIOREWIND _IO('q', 3) /* Rewind tape */
82 #define QIOBOT _IO('q', 4) /* Seek beg of trk */
83 #define QIOEOT _IO('q', 5) /* Seek end of trk */
84 #define QIOTRACK _IOW('q', 6, int) /* Seek to track */
85 #define QIOSEEKLP _IO('q', 7) /* Seek load point */
86 #define QIOFORWARD _IO('q', 8) /* Move tape fwd */
87 #define QIOSTOP _IO('q', 9) /* Stop tape */
88 #define QIOPRIMARY _IO('q', 10) /* Primary mode */
89 #define QIOFORMAT _IO('q', 11) /* Format mode */
90 #define QIOVERIFY _IO('q', 12) /* Verify mode */
91 #define QIOWRREF _IO('q', 13) /* Write ref burst */
92 #define QIOSTATUS _IOR('q', 14, int) /* Get drive status */
93 #define QIOCONFIG _IOR('q', 15, int) /* Get tape config */
94 #define QIOGEOM _IOR('q', 16, QIC_Geom) /* Get geometry */
95 #define QIOHWINFO _IOR('q', 17, QIC_HWInfo) /* Get hardware inf */
96 #define QIOSENDHDR _IOW('q', 18, QIC_Segment) /* Send header */
97 #define QIORECVHDR _IOWR('q', 19, QIC_Segment) /* Receive header */
98
99 /* QIC drive status bits. */
100 #define QS_READY 0x01 /* Drive ready */
101 #define QS_ERROR 0x02 /* Error detected */
102 #define QS_CART 0x04 /* Tape in drive */
103 #define QS_RDONLY 0x08 /* Write protect */
104 #define QS_NEWCART 0x10 /* New tape inserted */
105 #define QS_FMTOK 0x20 /* Tape is formatted */
106 #define QS_BOT 0x40 /* Tape at beginning */
107 #define QS_EOT 0x80 /* Tape at end */
108
109 /* QIC configuration bits. */
110 #define QCF_RTMASK 0x18 /* Rate mask */
111 #define QCF_RT250 0x00 /* 250K bps */
112 #define QCF_RT2 0x01 /* 2M bps */
113 #define QCF_RT500 0x02 /* 500K bps */
114 #define QCF_RT1 0x03 /* 1M bps */
115 #define QCF_EXTRA 0x40 /* Extra length tape */
116 #define QCF_QIC80 0x80 /* QIC-80 detected */
117
118 /* QIC tape status bits. */
119 #define QTS_FMMASK 0x0f /* Tape format mask */
120 #define QTS_LNMASK 0xf0 /* Tape length mask */
121 #define QTS_QIC40 0x01 /* QIC-40 tape */
122 #define QTS_QIC80 0x02 /* QIC-80 tape */
123 #define QTS_QIC500 0x03 /* QIC-500 tape */
124 #define QTS_LEN1 0x10 /* 205 ft/550 Oe */
125 #define QTS_LEN2 0x20 /* 307.5 ft/550 Oe */
126 #define QTS_LEN3 0x30 /* 295 ft/900 Oe */
127 #define QTS_LEN4 0x40 /* 1100 ft/550 Oe */
128 #define QTS_LEN5 0x50 /* 1100 ft/900 Oe */
129
130 /* Tape header segment structure */
131 typedef struct qic_header {
132 ULONG qh_sig; /* Header signature 0x55aa55aa */
133 UCHAR qh_fmtc; /* Format code */
134 UCHAR qh_unused1;
135 USHORT qh_hseg; /* Header segment number */
136 USHORT qh_dhseg; /* Duplicate header segment number */
137 USHORT qh_first; /* First logical area data segment */
138 USHORT qh_last; /* Last logical area data segment */
139 UCHAR qh_fmtdate[4]; /* Most recent format date */
140 UCHAR qh_chgdate[4]; /* Most recent tape change date */
141 UCHAR qh_unused2[2];
142 USHORT qh_tstrk; /* Tape segments per track */
143 UCHAR qh_ttcart; /* Tape tracks per cartridge */
144 UCHAR qh_mfside; /* Max floppy sides */
145 UCHAR qh_mftrk; /* Max floppy tracks */
146 UCHAR qh_mfsect; /* Max floppy sector */
147 char qh_tname[44]; /* Tape name (ASCII, space filled) */
148 UCHAR qh_namdate[4]; /* Date tape was given a name */
149 USHORT qh_cprseg; /* Compression map start segment */
150 UCHAR qh_unused3[48];
151 UCHAR qh_refmt; /* Re-format flag */
152 UCHAR qh_unused4;
153 UCHAR qh_iocount[4]; /* I/O count for life of tape */
154 UCHAR qh_unused5[4];
155 UCHAR qh_ffmtdate[4]; /* Date first formatted */
156 USHORT qh_fmtcount; /* Number of times formatted */
157 USHORT qh_badsect; /* Failed sector count */
158 char qh_mfname[44]; /* Manufacturer name if pre-formatted */
159 char qh_mflot[44]; /* Manufacturer lot code */
160 UCHAR qh_unused6[22];
161 ULONG qh_fail[448]; /* Failed sector log */
162 ULONG qh_badmap[6912]; /* Bad sector map */
163 } QIC_Header;
164
165 /* Volume table of contents entry structure. */
166 typedef struct qic_vtbl {
167 UCHAR vt_sig[4]; /* Signature "VTBL" if entry used */
168 USHORT vt_first; /* Starting segment */
169 USHORT vt_last; /* Ending segment */
170 char vt_vname[44]; /* Set name */
171 UCHAR vt_savdate[4]; /* Date saved */
172 UCHAR vt_flags; /* Volume flags */
173 UCHAR vt_multi; /* Multi cartridge sequence no. */
174 UCHAR vt_vext[26]; /* Extension data */
175 char vt_passwd[8]; /* Password for volume */
176 UCHAR vt_dirsize[4]; /* Directory section size */
177 UCHAR vt_dtasize[4]; /* Data section size */
178 USHORT vt_osver; /* Operating System version */
179 char vt_label[16]; /* Source drive label */
180 UCHAR vt_ldev; /* Logical device origin */
181 UCHAR vt_pdev; /* Physical device origin */
182 UCHAR vt_cprtype; /* Compression type */
183 UCHAR vt_ostype; /* Operating System type */
184 UCHAR vt_ostype2; /* Always zero ?? */
185 UCHAR vt_isocpr; /* ISO compression type */
186 UCHAR vt_unused1[4];
187 } QIC_VTbl;
188
189 /* Data compression map structure. */
190 typedef struct qic_dcmap {
191 UCHAR dc_sig[4]; /* Signature "DCMS" */
192 USHORT dc_mlen; /* Total map length */
193 UCHAR dc_unused1[6];
194 ULONG dc_offset[7421]; /* Byte offsets to segments */
195 } QIC_DCMap;
196
197 /* System specific file set structures - Unix */
198 typedef struct qic_unix_set {
199 UCHAR fsu_perm; /* Permissions */
200 UCHAR fsu_attr2; /* More attributes */
201 UCHAR fsu_ctime[4]; /* Creation time */
202 UCHAR fsu_atime[4]; /* Last access time */
203 UCHAR fsu_inode[4]; /* i-node number */
204 UCHAR fsu_user[4]; /* User number */
205 UCHAR fsu_group[4]; /* Group number */
206 UCHAR fsu_major; /* Major device number */
207 UCHAR fsu_minor; /* Minor device number */
208 UCHAR fsu_nsize; /* Name size */
209 UCHAR fsu_name; /* Entry name starts here */
210 } QIC_Unix_Set;
211
212 /* File set structure */
213 typedef struct qic_fileset {
214 UCHAR fs_size; /* Size of fixed + system size - 1 */
215 UCHAR fs_attr; /* Attributes */
216 UCHAR fs_mtime; /* Modification time */
217 UCHAR fs_dsize[4]; /* Data size */
218 } QIC_FileSet;
219
220 #endif /* !_SYS_FTAPE_H_ */
Cache object: ab80cef41e5a327b42dcc013afe0a635
|