4 * Minitape driver interface
6 * This file is part of the w32api package.
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 #pragma GCC system_header
37 #define MEDIA_ERASEABLE 0x00000001
38 #define MEDIA_WRITE_ONCE 0x00000002
39 #define MEDIA_READ_ONLY 0x00000004
40 #define MEDIA_READ_WRITE 0x00000008
41 #define MEDIA_WRITE_PROTECTED 0x00000100
42 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
44 typedef enum _TAPE_STATUS
{
45 TAPE_STATUS_SEND_SRB_AND_CALLBACK
,
47 TAPE_STATUS_CHECK_TEST_UNIT_READY
,
49 TAPE_STATUS_INSUFFICIENT_RESOURCES
,
50 TAPE_STATUS_NOT_IMPLEMENTED
,
51 TAPE_STATUS_INVALID_DEVICE_REQUEST
,
52 TAPE_STATUS_INVALID_PARAMETER
,
53 TAPE_STATUS_MEDIA_CHANGED
,
54 TAPE_STATUS_BUS_RESET
,
55 TAPE_STATUS_SETMARK_DETECTED
,
56 TAPE_STATUS_FILEMARK_DETECTED
,
57 TAPE_STATUS_BEGINNING_OF_MEDIA
,
58 TAPE_STATUS_END_OF_MEDIA
,
59 TAPE_STATUS_BUFFER_OVERFLOW
,
60 TAPE_STATUS_NO_DATA_DETECTED
,
61 TAPE_STATUS_EOM_OVERFLOW
,
63 TAPE_STATUS_IO_DEVICE_ERROR
,
64 TAPE_STATUS_UNRECOGNIZED_MEDIA
,
65 TAPE_STATUS_DEVICE_NOT_READY
,
66 TAPE_STATUS_MEDIA_WRITE_PROTECTED
,
67 TAPE_STATUS_DEVICE_DATA_ERROR
,
68 TAPE_STATUS_NO_SUCH_DEVICE
,
69 TAPE_STATUS_INVALID_BLOCK_LENGTH
,
70 TAPE_STATUS_IO_TIMEOUT
,
71 TAPE_STATUS_DEVICE_NOT_CONNECTED
,
72 TAPE_STATUS_DATA_OVERRUN
,
73 TAPE_STATUS_DEVICE_BUSY
,
74 TAPE_STATUS_REQUIRES_CLEANING
,
75 TAPE_STATUS_CLEANER_CARTRIDGE_INSTALLED
76 } TAPE_STATUS
, *PTAPE_STATUS
;
78 #define INQUIRYDATABUFFERSIZE 36
79 #ifndef _INQUIRYDATA_DEFINED /* also in scsi.h */
80 #define _INQUIRYDATA_DEFINED
81 typedef struct _INQUIRYDATA
{
83 UCHAR DeviceTypeQualifier
: 3;
84 UCHAR DeviceTypeModifier
: 7;
85 UCHAR RemovableMedia
: 1;
89 UCHAR ANSIVersion
: 3;
90 UCHAR ECMAVersion
: 3;
94 UCHAR ResponseDataFormat
: 4;
97 UCHAR TerminateTask
: 1;
99 UCHAR AdditionalLength
;
104 UCHAR MediumChanger
: 1;
106 UCHAR ReservedBit2
: 1;
107 UCHAR EnclosureServices
: 1;
108 UCHAR ReservedBit3
: 1;
110 UCHAR CommandQueue
: 1;
111 UCHAR TransferDisable
: 1;
112 UCHAR LinkedCommands
: 1;
113 UCHAR Synchronous
: 1;
116 UCHAR RelativeAddressing
: 1;
119 UCHAR ProductRevisionLevel
[4];
120 UCHAR VendorSpecific
[20];
122 } INQUIRYDATA
, *PINQUIRYDATA
;
125 typedef struct _MODE_CAPABILITIES_PAGE
{
149 UCHAR Reserved10
: 4;
151 UCHAR MaximumSpeedSupported
[2];
152 UCHAR MaximumStoredDefectedListEntries
[2];
153 UCHAR ContinuousTransferLimit
[2];
154 UCHAR CurrentSpeedSelected
[2];
157 } MODE_CAPABILITIES_PAGE
, *PMODE_CAPABILITIES_PAGE
;
159 typedef BOOLEAN DDKAPI
160 (*TAPE_VERIFY_INQUIRY_ROUTINE
)(
161 /*IN*/ PINQUIRYDATA InquiryData
,
162 /*IN*/ PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage
);
165 (*TAPE_EXTENSION_INIT_ROUTINE
)(
166 /*IN*/ PVOID MinitapeExtension
,
167 /*IN*/ PINQUIRYDATA InquiryData
,
168 /*IN*/ PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage
);
171 (*TAPE_ERROR_ROUTINE
)(
172 /*IN*/ PVOID MinitapeExtension
,
173 /*IN*/ PSCSI_REQUEST_BLOCK Srb
,
174 /*IN OUT*/ PTAPE_STATUS TapeStatus
);
176 typedef TAPE_STATUS DDKAPI
177 (*TAPE_PROCESS_COMMAND_ROUTINE
)(
178 /*IN OUT*/ PVOID MinitapeExtension
,
179 /*IN OUT*/ PVOID CommandExtension
,
180 /*IN OUT*/ PVOID CommandParameters
,
181 /*IN OUT*/ PSCSI_REQUEST_BLOCK Srb
,
182 /*IN*/ ULONG CallNumber
,
183 /*IN*/ TAPE_STATUS StatusOfLastCommand
,
184 /*IN OUT*/ PULONG RetryFlags
);
186 #define TAPE_RETRY_MASK 0x0000FFFF
187 #define IGNORE_ERRORS 0x00010000
188 #define RETURN_ERRORS 0x00020000
190 typedef struct _TAPE_INIT_DATA
{
191 TAPE_VERIFY_INQUIRY_ROUTINE VerifyInquiry
;
192 BOOLEAN QueryModeCapabilitiesPage
;
193 ULONG MinitapeExtensionSize
;
194 TAPE_EXTENSION_INIT_ROUTINE ExtensionInit
;
195 ULONG DefaultTimeOutValue
;
196 TAPE_ERROR_ROUTINE TapeError
;
197 ULONG CommandExtensionSize
;
198 TAPE_PROCESS_COMMAND_ROUTINE CreatePartition
;
199 TAPE_PROCESS_COMMAND_ROUTINE Erase
;
200 TAPE_PROCESS_COMMAND_ROUTINE GetDriveParameters
;
201 TAPE_PROCESS_COMMAND_ROUTINE GetMediaParameters
;
202 TAPE_PROCESS_COMMAND_ROUTINE GetPosition
;
203 TAPE_PROCESS_COMMAND_ROUTINE GetStatus
;
204 TAPE_PROCESS_COMMAND_ROUTINE Prepare
;
205 TAPE_PROCESS_COMMAND_ROUTINE SetDriveParameters
;
206 TAPE_PROCESS_COMMAND_ROUTINE SetMediaParameters
;
207 TAPE_PROCESS_COMMAND_ROUTINE SetPosition
;
208 TAPE_PROCESS_COMMAND_ROUTINE WriteMarks
;
209 TAPE_PROCESS_COMMAND_ROUTINE PreProcessReadWrite
/* OPTIONAL */;
210 } TAPE_INIT_DATA
, *PTAPE_INIT_DATA
;
212 typedef struct _TAPE_PHYS_POSITION
{
213 ULONG SeekBlockAddress
;
214 ULONG SpaceBlockCount
;
215 } TAPE_PHYS_POSITION
, PTAPE_PHYS_POSITION
;
223 #endif /* __MINITAPE_H */