reactos/drivers/storage/inc/tape.h

313 lines
5.9 KiB
C
Raw Normal View History

/*++
Copyright (c) 1992 Microsoft Corporation
Module Name:
tape.h
Abstract:
These are the structures and defines that are used in the
SCSI tape class drivers. The tape class driver is separated
into two modules. Tape.c contains code common to all tape
class drivers including the driver's major entry points.
The major entry point names each begin with the prefix
'ScsiTape.' The second module is the device specific code.
It provides support for a set of functions. Each device
specific function name is prefixed by 'Tape.'
Author:
Mike Glass
Revision History:
--*/
#include "scsi.h"
#include "class.h"
//
// Define the maximum inquiry data length.
//
#define MAXIMUM_TAPE_INQUIRY_DATA 252
//
// Tape device data
//
typedef struct _TAPE_DATA {
ULONG Flags;
ULONG CurrentPartition;
PVOID DeviceSpecificExtension;
PSCSI_INQUIRY_DATA InquiryData;
} TAPE_DATA, *PTAPE_DATA;
#define DEVICE_EXTENSION_SIZE sizeof(DEVICE_EXTENSION) + sizeof(TAPE_DATA)
//
// Define Device Configuration Page
//
typedef struct _MODE_DEVICE_CONFIGURATION_PAGE {
UCHAR PageCode : 6;
UCHAR Reserved1 : 1;
UCHAR PS : 1;
UCHAR PageLength;
UCHAR ActiveFormat : 5;
UCHAR CAFBit : 1;
UCHAR CAPBit : 1;
UCHAR Reserved2 : 1;
UCHAR ActivePartition;
UCHAR WriteBufferFullRatio;
UCHAR ReadBufferEmptyRatio;
UCHAR WriteDelayTime[2];
UCHAR REW : 1;
UCHAR RBO : 1;
UCHAR SOCF : 2;
UCHAR AVC : 1;
UCHAR RSmk : 1;
UCHAR BIS : 1;
UCHAR DBR : 1;
UCHAR GapSize;
UCHAR Reserved3 : 3;
UCHAR SEW : 1;
UCHAR EEG : 1;
UCHAR EODdefined : 3;
UCHAR BufferSize[3];
UCHAR DCAlgorithm;
UCHAR Reserved4;
} MODE_DEVICE_CONFIGURATION_PAGE, *PMODE_DEVICE_CONFIGURATION_PAGE;
//
// Define Medium Partition Page
//
typedef struct _MODE_MEDIUM_PARTITION_PAGE {
UCHAR PageCode : 6;
UCHAR Reserved1 : 1;
UCHAR PSBit : 1;
UCHAR PageLength;
UCHAR MaximumAdditionalPartitions;
UCHAR AdditionalPartitionDefined;
UCHAR Reserved2 : 3;
UCHAR PSUMBit : 2;
UCHAR IDPBit : 1;
UCHAR SDPBit : 1;
UCHAR FDPBit : 1;
UCHAR MediumFormatRecognition;
UCHAR Reserved3[2];
UCHAR Partition0Size[2];
UCHAR Partition1Size[2];
} MODE_MEDIUM_PARTITION_PAGE, *PMODE_MEDIUM_PARTITION_PAGE;
//
// Define Data Compression Page
//
typedef struct _MODE_DATA_COMPRESSION_PAGE {
UCHAR PageCode : 6;
UCHAR Reserved1 : 2;
UCHAR PageLength;
UCHAR Reserved2 : 6;
UCHAR DCC : 1;
UCHAR DCE : 1;
UCHAR Reserved3 : 5;
UCHAR RED : 2;
UCHAR DDE : 1;
UCHAR CompressionAlgorithm[4];
UCHAR DecompressionAlgorithm[4];
UCHAR Reserved4[4];
} MODE_DATA_COMPRESSION_PAGE, *PMODE_DATA_COMPRESSION_PAGE;
//
// Mode parameter list header and medium partition page -
// used in creating partitions
//
typedef struct _MODE_MEDIUM_PART_PAGE {
MODE_PARAMETER_HEADER ParameterListHeader;
MODE_MEDIUM_PARTITION_PAGE MediumPartPage;
} MODE_MEDIUM_PART_PAGE, *PMODE_MEDIUM_PART_PAGE;
//
// Mode parameters for retrieving tape or media information
//
typedef struct _MODE_TAPE_MEDIA_INFORMATION {
MODE_PARAMETER_HEADER ParameterListHeader;
MODE_PARAMETER_BLOCK ParameterListBlock;
MODE_MEDIUM_PARTITION_PAGE MediumPartPage;
} MODE_TAPE_MEDIA_INFORMATION, *PMODE_TAPE_MEDIA_INFORMATION;
//
// Mode parameter list header and device configuration page -
// used in retrieving device configuration information
//
typedef struct _MODE_DEVICE_CONFIG_PAGE {
MODE_PARAMETER_HEADER ParameterListHeader;
MODE_DEVICE_CONFIGURATION_PAGE DeviceConfigPage;
} MODE_DEVICE_CONFIG_PAGE, *PMODE_DEVICE_CONFIG_PAGE;
//
// Mode parameter list header and data compression page -
// used in retrieving data compression information
//
typedef struct _MODE_DATA_COMPRESS_PAGE {
MODE_PARAMETER_HEADER ParameterListHeader;
MODE_DATA_COMPRESSION_PAGE DataCompressPage;
} MODE_DATA_COMPRESS_PAGE, *PMODE_DATA_COMPRESS_PAGE;
//
// The following routines are the exported entry points for
// all tape class drivers. Note all these routines name start
// with 'ScsiTape.'
//
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
);
NTSTATUS
ScsiTapeInitialize(
IN PDRIVER_OBJECT DriverObject
);
NTSTATUS
ScsiTapeCreate (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
ScsiTapeReadWrite (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
ScsiTapeDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
//
// The following routines are provided by the tape
// device-specific module. Each routine name is
// prefixed with 'Tape.'
NTSTATUS
TapeCreatePartition(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeErase(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
VOID
TapeError(
PDEVICE_OBJECT DeviceObject,
PSCSI_REQUEST_BLOCK Srb,
NTSTATUS *Status,
BOOLEAN *Retry
);
NTSTATUS
TapeGetDriveParameters(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeGetMediaParameters(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeGetPosition(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeGetStatus(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapePrepare(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeReadWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeSetDriveParameters(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeSetMediaParameters(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
NTSTATUS
TapeSetPosition(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
BOOLEAN
TapeVerifyInquiry(
IN PSCSI_INQUIRY_DATA LunInfo
);
NTSTATUS
TapeWriteMarks(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);