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