test: tape.h Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# tape.h

Go to the documentation of this file.

    00001 /*++
    00002
    00003 Copyright (c) 1992  Microsoft Corporation
    00004
    00005 Module Name:
    00006
    00007     tape.h
    00008
    00009 Abstract:
    00010
    00011     These are the structures and defines that are used in the
    00012     SCSI tape class drivers. The tape class driver is separated
    00013     into two modules. Tape.c contains code common to all tape
    00014     class drivers including the driver's major entry points.
    00015     The major entry point names each begin with the prefix
    00016     'ScsiTape.' The second module is the device specific code.
    00017     It provides support for a set of functions. Each device
    00018     specific function name is prefixed by 'Tape.'
    00019
    00020 Author:
    00021
    00022     Mike Glass
    00023
    00024 Revision History:
    00025
    00026 --*/
    00027
    00028 #include "scsi.h"
    00029 #include "class.h"
    00030
    00031 //
    00032 // Define the maximum inquiry data length.
    00033 //
    00034
    00035 #define MAXIMUM_TAPE_INQUIRY_DATA 252
    00036
    00037 //
    00038 // Tape device data
    00039 //
    00040
    00041 typedef struct _TAPE_DATA {
    00042      ULONG        Flags;
    00043      ULONG        CurrentPartition;
    00044      PVOID        DeviceSpecificExtension;
    00045      PSCSI_INQUIRY_DATA InquiryData;
    00046 } TAPE_DATA, *PTAPE_DATA;
    00047
    00048 #define DEVICE_EXTENSION_SIZE sizeof(DEVICE_EXTENSION) + sizeof(TAPE_DATA)
    00049
    00050
    00051 //
    00052 // Define Device Configuration Page
    00053 //
    00054
    00055 typedef struct _MODE_DEVICE_CONFIGURATION_PAGE {
    00056
    00057     UCHAR PageCode : 6;
    00058     UCHAR Reserved1 : 1;
    00059     UCHAR PS : 1;
    00060     UCHAR PageLength;
    00061     UCHAR ActiveFormat : 5;
    00062     UCHAR CAFBit : 1;
    00063     UCHAR CAPBit : 1;
    00064     UCHAR Reserved2 : 1;
    00065     UCHAR ActivePartition;
    00066     UCHAR WriteBufferFullRatio;
    00067     UCHAR ReadBufferEmptyRatio;
    00068     UCHAR WriteDelayTime[2];
    00069     UCHAR REW : 1;
    00070     UCHAR RBO : 1;
    00071     UCHAR SOCF : 2;
    00072     UCHAR AVC : 1;
    00073     UCHAR RSmk : 1;
    00074     UCHAR BIS : 1;
    00075     UCHAR DBR : 1;
    00076     UCHAR GapSize;
    00077     UCHAR Reserved3 : 3;
    00078     UCHAR SEW : 1;
    00079     UCHAR EEG : 1;
    00080     UCHAR EODdefined : 3;
    00081     UCHAR BufferSize[3];
    00082     UCHAR DCAlgorithm;
    00083     UCHAR Reserved4;
    00084
    00085 } MODE_DEVICE_CONFIGURATION_PAGE, *PMODE_DEVICE_CONFIGURATION_PAGE;
    00086
    00087 //
    00088 // Define Medium Partition Page
    00089 //
    00090
    00091 typedef struct _MODE_MEDIUM_PARTITION_PAGE {
    00092
    00093     UCHAR PageCode : 6;
    00094     UCHAR Reserved1 : 1;
    00095     UCHAR PSBit : 1;
    00096     UCHAR PageLength;
    00097     UCHAR MaximumAdditionalPartitions;
    00098     UCHAR AdditionalPartitionDefined;
    00099     UCHAR Reserved2 : 3;
    00100     UCHAR PSUMBit : 2;
    00101     UCHAR IDPBit : 1;
    00102     UCHAR SDPBit : 1;
    00103     UCHAR FDPBit : 1;
    00104     UCHAR MediumFormatRecognition;
    00105     UCHAR Reserved3[2];
    00106     UCHAR Partition0Size[2];
    00107     UCHAR Partition1Size[2];
    00108
    00109 } MODE_MEDIUM_PARTITION_PAGE, *PMODE_MEDIUM_PARTITION_PAGE;
    00110
    00111 //
    00112 // Define Data Compression Page
    00113 //
    00114
    00115 typedef struct _MODE_DATA_COMPRESSION_PAGE {
    00116
    00117     UCHAR PageCode : 6;
    00118     UCHAR Reserved1 : 2;
    00119     UCHAR PageLength;
    00120     UCHAR Reserved2 : 6;
    00121     UCHAR DCC : 1;
    00122     UCHAR DCE : 1;
    00123     UCHAR Reserved3 : 5;
    00124     UCHAR RED : 2;
    00125     UCHAR DDE : 1;
    00126     UCHAR CompressionAlgorithm[4];
    00127     UCHAR DecompressionAlgorithm[4];
    00128     UCHAR Reserved4[4];
    00129
    00130 } MODE_DATA_COMPRESSION_PAGE, *PMODE_DATA_COMPRESSION_PAGE;
    00131
    00132 //
    00133 // Mode parameter list header and medium partition page -
    00134 // used in creating partitions
    00135 //
    00136
    00137 typedef struct _MODE_MEDIUM_PART_PAGE {
    00138
    00139    MODE_PARAMETER_HEADER       ParameterListHeader;
    00140    MODE_MEDIUM_PARTITION_PAGE  MediumPartPage;
    00141
    00142 } MODE_MEDIUM_PART_PAGE, *PMODE_MEDIUM_PART_PAGE;
    00143
    00144
    00145 //
    00146 // Mode parameters for retrieving tape or media information
    00147 //
    00148
    00149 typedef struct _MODE_TAPE_MEDIA_INFORMATION {
    00150
    00151    MODE_PARAMETER_HEADER       ParameterListHeader;
    00152    MODE_PARAMETER_BLOCK        ParameterListBlock;
    00153    MODE_MEDIUM_PARTITION_PAGE  MediumPartPage;
    00154
    00155 } MODE_TAPE_MEDIA_INFORMATION, *PMODE_TAPE_MEDIA_INFORMATION;
    00156
    00157 //
    00158 // Mode parameter list header and device configuration page -
    00159 // used in retrieving device configuration information
    00160 //
    00161
    00162 typedef struct _MODE_DEVICE_CONFIG_PAGE {
    00163
    00164    MODE_PARAMETER_HEADER       ParameterListHeader;
    00165    MODE_DEVICE_CONFIGURATION_PAGE  DeviceConfigPage;
    00166
    00167 } MODE_DEVICE_CONFIG_PAGE, *PMODE_DEVICE_CONFIG_PAGE;
    00168
    00169
    00170 //
    00171 // Mode parameter list header and data compression page -
    00172 // used in retrieving data compression information
    00173 //
    00174
    00175 typedef struct _MODE_DATA_COMPRESS_PAGE {
    00176
    00177    MODE_PARAMETER_HEADER       ParameterListHeader;
    00178    MODE_DATA_COMPRESSION_PAGE  DataCompressPage;
    00179
    00180 } MODE_DATA_COMPRESS_PAGE, *PMODE_DATA_COMPRESS_PAGE;
    00181
    00182
    00183
    00184 //
    00185 // The following routines are the exported entry points for
    00186 // all tape class drivers. Note all these routines name start
    00187 // with 'ScsiTape.'
    00188 //
    00189
    00190 NTSTATUS
    00191 DriverEntry(
    00192     IN PDRIVER_OBJECT DriverObject,
    00193     IN PUNICODE_STRING RegistryPath
    00194     );
    00195
    00196 NTSTATUS
    00197 ScsiTapeInitialize(
    00198     IN PDRIVER_OBJECT DriverObject
    00199     );
    00200
    00201 NTSTATUS
    00202 ScsiTapeCreate (
    00203     IN PDEVICE_OBJECT DeviceObject,
    00204     IN PIRP Irp
    00205     );
    00206
    00207 NTSTATUS
    00208 ScsiTapeReadWrite (
    00209     IN PDEVICE_OBJECT DeviceObject,
    00210     IN PIRP Irp
    00211     );
    00212
    00213 NTSTATUS
    00214 ScsiTapeDeviceControl(
    00215     IN PDEVICE_OBJECT DeviceObject,
    00216     IN PIRP Irp
    00217     );
    00218
    00219
    00220
    00221 //
    00222 // The following routines are provided by the tape
    00223 // device-specific module. Each routine name is
    00224 // prefixed with 'Tape.'
    00225
    00226 NTSTATUS
    00227 TapeCreatePartition(
    00228     IN PDEVICE_OBJECT DeviceObject,
    00229     IN PIRP Irp
    00230     );
    00231
    00232 NTSTATUS
    00233 TapeErase(
    00234     IN PDEVICE_OBJECT DeviceObject,
    00235     IN PIRP Irp
    00236     );
    00237
    00238 VOID
    00239 TapeError(
    00240     PDEVICE_OBJECT DeviceObject,
    00241     PSCSI_REQUEST_BLOCK Srb,
    00242     NTSTATUS *Status,
    00243     BOOLEAN *Retry
    00244     );
    00245
    00246 NTSTATUS
    00247 TapeGetDriveParameters(
    00248     IN PDEVICE_OBJECT DeviceObject,
    00249     IN PIRP Irp
    00250     );
    00251
    00252 NTSTATUS
    00253 TapeGetMediaParameters(
    00254     IN PDEVICE_OBJECT DeviceObject,
    00255     IN PIRP Irp
    00256     );
    00257
    00258 NTSTATUS
    00259 TapeGetPosition(
    00260     IN PDEVICE_OBJECT DeviceObject,
    00261     IN PIRP Irp
    00262     );
    00263
    00264 NTSTATUS
    00265 TapeGetStatus(
    00266     IN PDEVICE_OBJECT DeviceObject,
    00267     IN PIRP Irp
    00268     );
    00269
    00270 NTSTATUS
    00271 TapePrepare(
    00272     IN PDEVICE_OBJECT DeviceObject,
    00273     IN PIRP Irp
    00274     );
    00275
    00276 NTSTATUS
    00277 TapeReadWrite(
    00278     IN PDEVICE_OBJECT DeviceObject,
    00279     IN PIRP Irp
    00280     );
    00281
    00282 NTSTATUS
    00283 TapeSetDriveParameters(
    00284     IN PDEVICE_OBJECT DeviceObject,
    00285     IN PIRP Irp
    00286     );
    00287
    00288 NTSTATUS
    00289 TapeSetMediaParameters(
    00290     IN PDEVICE_OBJECT DeviceObject,
    00291     IN PIRP Irp
    00292     );
    00293
    00294 NTSTATUS
    00295 TapeSetPosition(
    00296     IN PDEVICE_OBJECT DeviceObject,
    00297     IN PIRP Irp
    00298     );
    00299
    00300 BOOLEAN
    00301 TapeVerifyInquiry(
    00302     IN PSCSI_INQUIRY_DATA LunInfo
    00303     );
    00304
    00305 NTSTATUS
    00306 TapeWriteMarks(
    00307     IN PDEVICE_OBJECT DeviceObject,
    00308     IN PIRP Irp
    00309     );
    00310
    00311