[1166] | 1 | /*
|
---|
| 2 | * minitape.h
|
---|
| 3 | *
|
---|
| 4 | * Minitape driver interface
|
---|
| 5 | *
|
---|
| 6 | * This file is part of the w32api package.
|
---|
| 7 | *
|
---|
| 8 | * Contributors:
|
---|
| 9 | * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
| 10 | *
|
---|
| 11 | * THIS SOFTWARE IS NOT COPYRIGHTED
|
---|
| 12 | *
|
---|
| 13 | * This source code is offered for use in the public domain. You may
|
---|
| 14 | * use, modify or distribute it freely.
|
---|
| 15 | *
|
---|
| 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.
|
---|
| 20 | *
|
---|
| 21 | */
|
---|
| 22 | #ifndef __MINITAPE_H
|
---|
| 23 | #define __MINITAPE_H
|
---|
| 24 |
|
---|
| 25 | #ifdef __cplusplus
|
---|
| 26 | extern "C" {
|
---|
| 27 | #endif
|
---|
| 28 |
|
---|
| 29 | #pragma pack(push,4)
|
---|
| 30 |
|
---|
| 31 | #define MEDIA_ERASEABLE 0x00000001
|
---|
| 32 | #define MEDIA_WRITE_ONCE 0x00000002
|
---|
| 33 | #define MEDIA_READ_ONLY 0x00000004
|
---|
| 34 | #define MEDIA_READ_WRITE 0x00000008
|
---|
| 35 | #define MEDIA_WRITE_PROTECTED 0x00000100
|
---|
| 36 | #define MEDIA_CURRENTLY_MOUNTED 0x80000000
|
---|
| 37 |
|
---|
| 38 | typedef enum _TAPE_STATUS {
|
---|
| 39 | TAPE_STATUS_SEND_SRB_AND_CALLBACK,
|
---|
| 40 | TAPE_STATUS_CALLBACK,
|
---|
| 41 | TAPE_STATUS_CHECK_TEST_UNIT_READY,
|
---|
| 42 | TAPE_STATUS_SUCCESS,
|
---|
| 43 | TAPE_STATUS_INSUFFICIENT_RESOURCES,
|
---|
| 44 | TAPE_STATUS_NOT_IMPLEMENTED,
|
---|
| 45 | TAPE_STATUS_INVALID_DEVICE_REQUEST,
|
---|
| 46 | TAPE_STATUS_INVALID_PARAMETER,
|
---|
| 47 | TAPE_STATUS_MEDIA_CHANGED,
|
---|
| 48 | TAPE_STATUS_BUS_RESET,
|
---|
| 49 | TAPE_STATUS_SETMARK_DETECTED,
|
---|
| 50 | TAPE_STATUS_FILEMARK_DETECTED,
|
---|
| 51 | TAPE_STATUS_BEGINNING_OF_MEDIA,
|
---|
| 52 | TAPE_STATUS_END_OF_MEDIA,
|
---|
| 53 | TAPE_STATUS_BUFFER_OVERFLOW,
|
---|
| 54 | TAPE_STATUS_NO_DATA_DETECTED,
|
---|
| 55 | TAPE_STATUS_EOM_OVERFLOW,
|
---|
| 56 | TAPE_STATUS_NO_MEDIA,
|
---|
| 57 | TAPE_STATUS_IO_DEVICE_ERROR,
|
---|
| 58 | TAPE_STATUS_UNRECOGNIZED_MEDIA,
|
---|
| 59 | TAPE_STATUS_DEVICE_NOT_READY,
|
---|
| 60 | TAPE_STATUS_MEDIA_WRITE_PROTECTED,
|
---|
| 61 | TAPE_STATUS_DEVICE_DATA_ERROR,
|
---|
| 62 | TAPE_STATUS_NO_SUCH_DEVICE,
|
---|
| 63 | TAPE_STATUS_INVALID_BLOCK_LENGTH,
|
---|
| 64 | TAPE_STATUS_IO_TIMEOUT,
|
---|
| 65 | TAPE_STATUS_DEVICE_NOT_CONNECTED,
|
---|
| 66 | TAPE_STATUS_DATA_OVERRUN,
|
---|
| 67 | TAPE_STATUS_DEVICE_BUSY,
|
---|
| 68 | TAPE_STATUS_REQUIRES_CLEANING,
|
---|
| 69 | TAPE_STATUS_CLEANER_CARTRIDGE_INSTALLED
|
---|
| 70 | } TAPE_STATUS, *PTAPE_STATUS;
|
---|
| 71 |
|
---|
| 72 | #define INQUIRYDATABUFFERSIZE 36
|
---|
| 73 | #ifndef _INQUIRYDATA_DEFINED /* also in scsi.h */
|
---|
| 74 | #define _INQUIRYDATA_DEFINED
|
---|
| 75 | typedef struct _INQUIRYDATA {
|
---|
| 76 | UCHAR DeviceType : 5;
|
---|
| 77 | UCHAR DeviceTypeQualifier : 3;
|
---|
| 78 | UCHAR DeviceTypeModifier : 7;
|
---|
| 79 | UCHAR RemovableMedia : 1;
|
---|
| 80 | __GNU_EXTENSION union {
|
---|
| 81 | UCHAR Versions;
|
---|
| 82 | __GNU_EXTENSION struct {
|
---|
| 83 | UCHAR ANSIVersion : 3;
|
---|
| 84 | UCHAR ECMAVersion : 3;
|
---|
| 85 | UCHAR ISOVersion : 2;
|
---|
| 86 | };
|
---|
| 87 | };
|
---|
| 88 | UCHAR ResponseDataFormat : 4;
|
---|
| 89 | UCHAR HiSupport : 1;
|
---|
| 90 | UCHAR NormACA : 1;
|
---|
| 91 | UCHAR TerminateTask : 1;
|
---|
| 92 | UCHAR AERC : 1;
|
---|
| 93 | UCHAR AdditionalLength;
|
---|
| 94 | UCHAR Reserved;
|
---|
| 95 | UCHAR Addr16 : 1;
|
---|
| 96 | UCHAR Addr32 : 1;
|
---|
| 97 | UCHAR AckReqQ: 1;
|
---|
| 98 | UCHAR MediumChanger : 1;
|
---|
| 99 | UCHAR MultiPort : 1;
|
---|
| 100 | UCHAR ReservedBit2 : 1;
|
---|
| 101 | UCHAR EnclosureServices : 1;
|
---|
| 102 | UCHAR ReservedBit3 : 1;
|
---|
| 103 | UCHAR SoftReset : 1;
|
---|
| 104 | UCHAR CommandQueue : 1;
|
---|
| 105 | UCHAR TransferDisable : 1;
|
---|
| 106 | UCHAR LinkedCommands : 1;
|
---|
| 107 | UCHAR Synchronous : 1;
|
---|
| 108 | UCHAR Wide16Bit : 1;
|
---|
| 109 | UCHAR Wide32Bit : 1;
|
---|
| 110 | UCHAR RelativeAddressing : 1;
|
---|
| 111 | UCHAR VendorId[8];
|
---|
| 112 | UCHAR ProductId[16];
|
---|
| 113 | UCHAR ProductRevisionLevel[4];
|
---|
| 114 | UCHAR VendorSpecific[20];
|
---|
| 115 | UCHAR Reserved3[40];
|
---|
| 116 | } INQUIRYDATA, *PINQUIRYDATA;
|
---|
| 117 | #endif
|
---|
| 118 |
|
---|
| 119 | typedef struct _MODE_CAPABILITIES_PAGE {
|
---|
| 120 | UCHAR PageCode : 6;
|
---|
| 121 | UCHAR Reserved1 : 2;
|
---|
| 122 | UCHAR PageLength;
|
---|
| 123 | UCHAR Reserved2[2];
|
---|
| 124 | UCHAR RO : 1;
|
---|
| 125 | UCHAR Reserved3 : 4;
|
---|
| 126 | UCHAR SPREV : 1;
|
---|
| 127 | UCHAR Reserved4 : 2;
|
---|
| 128 | UCHAR Reserved5 : 3;
|
---|
| 129 | UCHAR EFMT : 1;
|
---|
| 130 | UCHAR Reserved6 : 1;
|
---|
| 131 | UCHAR QFA : 1;
|
---|
| 132 | UCHAR Reserved7 : 2;
|
---|
| 133 | UCHAR LOCK : 1;
|
---|
| 134 | UCHAR LOCKED : 1;
|
---|
| 135 | UCHAR PREVENT : 1;
|
---|
| 136 | UCHAR UNLOAD : 1;
|
---|
| 137 | UCHAR Reserved8 : 2;
|
---|
| 138 | UCHAR ECC : 1;
|
---|
| 139 | UCHAR CMPRS : 1;
|
---|
| 140 | UCHAR Reserved9 : 1;
|
---|
| 141 | UCHAR BLK512 : 1;
|
---|
| 142 | UCHAR BLK1024 : 1;
|
---|
| 143 | UCHAR Reserved10 : 4;
|
---|
| 144 | UCHAR SLOWB : 1;
|
---|
| 145 | UCHAR MaximumSpeedSupported[2];
|
---|
| 146 | UCHAR MaximumStoredDefectedListEntries[2];
|
---|
| 147 | UCHAR ContinuousTransferLimit[2];
|
---|
| 148 | UCHAR CurrentSpeedSelected[2];
|
---|
| 149 | UCHAR BufferSize[2];
|
---|
| 150 | UCHAR Reserved11[2];
|
---|
| 151 | } MODE_CAPABILITIES_PAGE, *PMODE_CAPABILITIES_PAGE;
|
---|
| 152 |
|
---|
| 153 | typedef BOOLEAN NTAPI
|
---|
| 154 | (*TAPE_VERIFY_INQUIRY_ROUTINE)(
|
---|
| 155 | IN PINQUIRYDATA InquiryData,
|
---|
| 156 | IN PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage);
|
---|
| 157 |
|
---|
| 158 | typedef VOID NTAPI
|
---|
| 159 | (*TAPE_EXTENSION_INIT_ROUTINE)(
|
---|
| 160 | IN PVOID MinitapeExtension,
|
---|
| 161 | IN PINQUIRYDATA InquiryData,
|
---|
| 162 | IN PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage);
|
---|
| 163 |
|
---|
| 164 | typedef VOID NTAPI
|
---|
| 165 | (*TAPE_ERROR_ROUTINE)(
|
---|
| 166 | IN PVOID MinitapeExtension,
|
---|
| 167 | IN PSCSI_REQUEST_BLOCK Srb,
|
---|
| 168 | IN OUT PTAPE_STATUS TapeStatus);
|
---|
| 169 |
|
---|
| 170 | typedef TAPE_STATUS NTAPI
|
---|
| 171 | (*TAPE_PROCESS_COMMAND_ROUTINE)(
|
---|
| 172 | IN OUT PVOID MinitapeExtension,
|
---|
| 173 | IN OUT PVOID CommandExtension,
|
---|
| 174 | IN OUT PVOID CommandParameters,
|
---|
| 175 | IN OUT PSCSI_REQUEST_BLOCK Srb,
|
---|
| 176 | IN ULONG CallNumber,
|
---|
| 177 | IN TAPE_STATUS StatusOfLastCommand,
|
---|
| 178 | IN OUT PULONG RetryFlags);
|
---|
| 179 |
|
---|
| 180 | #define TAPE_RETRY_MASK 0x0000FFFF
|
---|
| 181 | #define IGNORE_ERRORS 0x00010000
|
---|
| 182 | #define RETURN_ERRORS 0x00020000
|
---|
| 183 |
|
---|
| 184 | typedef struct _TAPE_INIT_DATA {
|
---|
| 185 | TAPE_VERIFY_INQUIRY_ROUTINE VerifyInquiry;
|
---|
| 186 | BOOLEAN QueryModeCapabilitiesPage;
|
---|
| 187 | ULONG MinitapeExtensionSize;
|
---|
| 188 | TAPE_EXTENSION_INIT_ROUTINE ExtensionInit;
|
---|
| 189 | ULONG DefaultTimeOutValue;
|
---|
| 190 | TAPE_ERROR_ROUTINE TapeError;
|
---|
| 191 | ULONG CommandExtensionSize;
|
---|
| 192 | TAPE_PROCESS_COMMAND_ROUTINE CreatePartition;
|
---|
| 193 | TAPE_PROCESS_COMMAND_ROUTINE Erase;
|
---|
| 194 | TAPE_PROCESS_COMMAND_ROUTINE GetDriveParameters;
|
---|
| 195 | TAPE_PROCESS_COMMAND_ROUTINE GetMediaParameters;
|
---|
| 196 | TAPE_PROCESS_COMMAND_ROUTINE GetPosition;
|
---|
| 197 | TAPE_PROCESS_COMMAND_ROUTINE GetStatus;
|
---|
| 198 | TAPE_PROCESS_COMMAND_ROUTINE Prepare;
|
---|
| 199 | TAPE_PROCESS_COMMAND_ROUTINE SetDriveParameters;
|
---|
| 200 | TAPE_PROCESS_COMMAND_ROUTINE SetMediaParameters;
|
---|
| 201 | TAPE_PROCESS_COMMAND_ROUTINE SetPosition;
|
---|
| 202 | TAPE_PROCESS_COMMAND_ROUTINE WriteMarks;
|
---|
| 203 | TAPE_PROCESS_COMMAND_ROUTINE PreProcessReadWrite; /* optional */
|
---|
| 204 | } TAPE_INIT_DATA, *PTAPE_INIT_DATA;
|
---|
| 205 |
|
---|
| 206 | typedef struct _TAPE_PHYS_POSITION {
|
---|
| 207 | ULONG SeekBlockAddress;
|
---|
| 208 | ULONG SpaceBlockCount;
|
---|
| 209 | } TAPE_PHYS_POSITION, PTAPE_PHYS_POSITION;
|
---|
| 210 |
|
---|
| 211 | #pragma pack(pop)
|
---|
| 212 |
|
---|
| 213 | #ifdef __cplusplus
|
---|
| 214 | }
|
---|
| 215 | #endif
|
---|
| 216 |
|
---|
| 217 | #endif /* __MINITAPE_H */
|
---|