1
2 #ifndef _ST_H
3 #define _ST_H
4
5
6
7
8 #ifndef _SCSI_H
9 #include "scsi.h"
10 #endif
11
12
13 typedef struct {
14 unsigned char in_use;
15 unsigned char dma;
16 int buffer_size;
17 int buffer_blocks;
18 int buffer_bytes;
19 int read_pointer;
20 int writing;
21 int last_result;
22 int last_result_fatal;
23 unsigned char *b_data;
24 int orig_size;
25 unsigned char *orig_b_data;
26 } ST_buffer;
27
28
29
30 typedef struct {
31 unsigned char defined;
32 unsigned char do_async_writes;
33 unsigned char do_buffer_writes;
34 unsigned char defaults_for_writes;
35 unsigned char default_compression;
36 short default_density;
37 int default_blksize;
38 } ST_mode;
39
40 #define ST_NBR_MODE_BITS 2
41 #define ST_NBR_MODES (1 << ST_NBR_MODE_BITS)
42 #define ST_MODE_SHIFT (7 - ST_NBR_MODE_BITS)
43 #define ST_MODE_MASK ((ST_NBR_MODES - 1) << ST_MODE_SHIFT)
44
45
46 typedef struct {
47 kdev_t devt;
48 unsigned capacity;
49 struct wait_queue * waiting;
50 Scsi_Device* device;
51 Scsi_Cmnd SCpnt;
52 struct semaphore sem;
53 ST_buffer * buffer;
54
55
56 unsigned char do_read_ahead;
57 unsigned char do_auto_lock;
58 unsigned char can_bsr;
59 unsigned char two_fm;
60 unsigned char fast_mteom;
61 unsigned char restr_dma;
62 unsigned char default_drvbuffer;
63 int write_threshold;
64
65
66 ST_mode modes[ST_NBR_MODES];
67 int current_mode;
68
69
70 unsigned char dirty;
71 unsigned char rw;
72 unsigned char ready;
73 unsigned char eof;
74 unsigned char write_prot;
75 unsigned char drv_write_prot;
76 unsigned char in_use;
77 unsigned char eof_hit;
78 unsigned char moves_after_eof;
79 unsigned char at_sm;
80 unsigned char blksize_changed;
81 unsigned char density_changed;
82 unsigned char compression_changed;
83 unsigned char drv_buffer;
84 unsigned char density;
85 unsigned char door_locked;
86 unsigned char rew_at_close;
87 int block_size;
88 int min_block;
89 int max_block;
90 int recover_count;
91 int drv_block;
92 struct mtget * mt_status;
93
94 #if DEBUG
95 unsigned char write_pending;
96 int nbr_finished;
97 int nbr_waits;
98 #endif
99 } Scsi_Tape;
100
101 extern Scsi_Tape * scsi_tapes;
102
103
104 #define ST_NOEOF 0
105 #define ST_FM 1
106 #define ST_EOM_OK 2
107 #define ST_EOM_ERROR 3
108 #define ST_EOD 4
109
110
111 #define ST_IDLE 0
112 #define ST_READING 1
113 #define ST_WRITING 2
114
115
116 #define ST_READY 0
117 #define ST_NOT_READY 1
118 #define ST_NO_TAPE 2
119
120
121 #define ST_UNLOCKED 0
122 #define ST_LOCKED_EXPLICIT 1
123 #define ST_LOCKED_AUTO 2
124 #define ST_LOCK_FAILS 3
125
126
127 #define QFA_REQUEST_BLOCK 0x02
128 #define QFA_SEEK_BLOCK 0x0c
129
130
131 #define ST_DONT_TOUCH 0
132 #define ST_NO 1
133 #define ST_YES 2
134
135 #endif
136