Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / dev / disk / wt / wtreg.h
1 /*
2  * Streamer tape driver for 386bsd and FreeBSD.
3  * Supports Archive and Wangtek compatible QIC-02/QIC-36 boards.
4  *
5  * Copyright (C) 1993 by:
6  *      Sergey Ryzhkov       <sir@kiae.su>
7  *      Serge Vakulenko      <vak@zebub.msk.su>
8  *
9  * This software is distributed with NO WARRANTIES, not even the implied
10  * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * Authors grant any other persons or organizations permission to use
13  * or modify this software as long as this message is kept with the software,
14  * all derivative works or modified versions.
15  *
16  * This driver is derived from the old 386bsd Wangtek streamer tape driver,
17  * made by Robert Baron at CMU, based on Intel sources.
18  * Authors thank Robert Baron, CMU and Intel and retain here
19  * the original CMU copyright notice.
20  *
21  * Version 1.3, Thu Nov 11 12:09:13 MSK 1993
22  * $FreeBSD: src/sys/i386/isa/wtreg.h,v 1.11 1999/08/28 00:45:06 peter Exp $
23  *
24  */
25
26 /*
27  * Copyright (c) 1989 Carnegie-Mellon University.
28  * All rights reserved.
29  *
30  * Authors: Robert Baron
31  *
32  * Permission to use, copy, modify and distribute this software and
33  * its documentation is hereby granted, provided that both the copyright
34  * notice and this permission notice appear in all copies of the
35  * software, derivative works or modified versions, and any portions
36  * thereof, and that both notices appear in supporting documentation.
37  *
38  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
39  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
40  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
41  *
42  * Carnegie Mellon requests users of this software to return to
43  *
44  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
45  *  School of Computer Science
46  *  Carnegie Mellon University
47  *  Pittsburgh PA 15213-3890
48  *
49  * any improvements or extensions that they make and grant Carnegie the
50  * rights to redistribute these changes.
51  */
52
53 /* internal QIC-02 commands */
54 #define QIC_ERASE       0x22    /* erase the tape */
55 #define QIC_RETENS      0x24    /* retension the tape */
56 #define QIC_RDDATA      0x80    /* read data */
57 #define QIC_READFM      0xa0    /* read file mark */
58 #define QIC_WRTDATA     0x40    /* write data */
59 #define QIC_WRITEFM     0x60    /* write file mark */
60 #define QIC_RDSTAT      0xc0    /* read status command */
61 #define QIC_REWIND      0x21    /* rewind command (position+bot) */
62 #define QIC_FMT11       0x26    /* set format QIC-11 */
63 #define QIC_FMT24       0x27    /* set format QIC-24 */
64 #define QIC_FMT120      0x28    /* set format QIC-120 */
65 #define QIC_FMT150      0x29    /* set format QIC-150 */
66 #define QIC_FMT300      0x2a    /* set format QIC-300/QIC-2100 */
67 #define QIC_FMT600      0x2b    /* set format QIC-600/QIC-2200 */
68
69 /* tape driver flags */
70 #define TPINUSE         0x0001  /* tape is already open */
71 #define TPREAD          0x0002  /* tape is only open for reading */
72 #define TPWRITE         0x0004  /* tape is only open for writing */
73 #define TPSTART         0x0008  /* tape must be rewound and reset */
74 #define TPRMARK         0x0010  /* read file mark command outstanding */
75 #define TPWMARK         0x0020  /* write file mark command outstanding */
76 #define TPREW           0x0040  /* rewind command outstanding */
77 #define TPEXCEP         0x0080  /* i/o exception flag */
78 #define TPVOL           0x0100  /* read file mark or hit end of tape */
79 #define TPWO            0x0200  /* write command outstanding */
80 #define TPRO            0x0400  /* read command outstanding */
81 #define TPWANY          0x0800  /* write command requested */
82 #define TPRANY          0x1000  /* read command requested */
83 #define TPWP            0x2000  /* write protect error seen */
84 #define TPTIMER         0x4000  /* timer() is active */
85 #define TPACTIVE        0x8000  /* dma i/o active */
86
87 /* controller error register bits */
88 #define TP_FIL          0x0001  /* File mark detected */
89 #define TP_BNL          0x0002  /* Block not located */
90 #define TP_UDA          0x0004  /* Unrecoverable data error */
91 #define TP_EOM          0x0008  /* End of media */
92 #define TP_WRP          0x0010  /* Write protected cartridge */
93 #define TP_USL          0x0020  /* Unselected drive */
94 #define TP_CNI          0x0040  /* Cartridge not in place */
95 #define TP_ST0          0x0080  /* Status byte 0 bits */
96 #define TP_ST0MASK      0x00ff  /* Status byte 0 mask */
97 #define TP_POR          0x0100  /* Power on/reset occurred */
98 #define TP_ERM          0x0200  /* Reserved for end of recorded media */
99 #define TP_BPE          0x0400  /* Reserved for bus parity error */
100 #define TP_BOM          0x0800  /* Beginning of media */
101 #define TP_MBD          0x1000  /* Marginal block detected */
102 #define TP_NDT          0x2000  /* No data detected */
103 #define TP_ILL          0x4000  /* Illegal command - should not happen! */
104 #define TP_ST1          0x8000  /* Status byte 1 bits */
105 #define TP_ST1MASK      0xff00  /* Status byte 1 mask */
106
107 /* device minor number */
108 #define WT_BSIZE        0100    /* long block flag */
109 #define WT_DENSEL       0070    /* density select mask */
110 #define WT_DENSDFLT     0000    /* default density */
111 #define WT_QIC11        0010    /* 11 megabytes? */
112 #define WT_QIC24        0020    /* 60 megabytes */
113 #define WT_QIC120       0030    /* 120 megabytes */
114 #define WT_QIC150       0040    /* 150 megabytes */
115 #define WT_QIC300       0050    /* 300 megabytes? */
116 #define WT_QIC600       0060    /* 600 megabytes? */