⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scsitypes.pas

📁 用于CD/DVD烧录的Delphi源码,包括source和demo
💻 PAS
📖 第 1 页 / 共 3 页
字号:
    Params10: array[0..51] of BYTE;
  end;

type
  TScsiModePageTemplate6 = packed record
    ModeDataLength6: BYTE; // full record length except itself
    MediumType6: BYTE; // Reserved - OBSOLETE
    DeviceSpecific6: BYTE; // Reserved - OBSOLETE
    DescriptorLength6: BYTE; // equal to 8*Number of Block Descriptors
    // must be zero when DBD=TRUE
    Params6: array[0..ScsiModeTemplateParamsLength - 1] of BYTE;
  end;

type
  TScsiModePageTemplate = packed record
    case boolean of
      True: (
        ModeDataLength6: BYTE; // full record length except itself
        MediumType6: BYTE; // Reserved - OBSOLETE
        DeviceSpecific6: BYTE; // Reserved - OBSOLETE
        DescriptorLength6: BYTE; // equal to 8*Number of Block Descriptors
        // must be zero when DBD=TRUE
        Params6: array[0..ScsiModeTemplateParamsLength - 1] of BYTE);

      False: (
        ModeDataLength10: WORD; // full record length except itself
        MediumType10: BYTE; // Reserved - OBSOLETE
        DeviceSpecific10: BYTE; // Reserved - OBSOLETE
        Reserved10: WORD;
        DescriptorLength10: WORD; // equal to 8*Number of Block Descriptors
        // must be zero when DBD=TRUE
        Params10: array[0..ScsiModeTemplateParamsLength - 1] of BYTE);
  end;

type
  TScsiPeripheralQualifier = (
    SPQconnected, // Peripheral device type is currently connected to this
    // logical unit. Especially for hot-swap devices. All fixed
    // devices shall also use this peripheral qualifier.
    SPQavailable, // The target is capable of supporting the device;
    // however, the physical device is not currently connected.
    SPQreserved2, // Reserved.
    SPQabsent, // The target is not capable of supporting a physical
    // device on this LUN. It's illegal LUN for all commands.
    SPQvendor4, SPQvendor5, SPQvendor6, SPQvendor7); // Vendor-specific codes.

  TScsiAnsiCompliance = (
    SANSInone, // The device does not claims compliance to any standard
    SANSIversion1, // The device complies to ANSI SCSI-1
    SANSIversion2, // The device complies to ANSI SCSI-2
    SANSIversion3, // The device complies to ANSI SCSI-3
    SANSIversion3a, // The device complies to ANSI SCSI-3 SPC-2/MMC-2
    SANSIreserved5, SANSIreserved6, SANSIreserved7);

  TScsiStandardCompliance = packed record
    ANSI: TScsiAnsiCompliance; // ANSI SCSI standard compliance level
    ECMA: BYTE; // 0=no compliance, 1=complies to ECMA-111
    ISO: BYTE; // 0=no compliance, 1=complies to ISO 9316:1995
  end;

  TScsiCommandSupportLevel = (
    SCSLunknown, // data about the command support is not available
    SCSLnosupport, // The requested command code is NOT supported
    SCSLreserved2,
    SCSLstandard, // Device supports the command in a standard manner
    SCSLreserved4,
    SCSLvendor, // Device supports the command in a vendor-specific
    // manner. All fields of TScsiCommandInfo are valid.
    SCSLreserved6, SCSLreserved7);

type
  TScsiDeviceCapabilities = set of (
    SDCremovableMedium, // Medium is removable
    SDCasyncEvent, // Asynchronous event reporting support
    SDCnormalACA, // Setting bit NACA in CDB to 1 support
    SDChierarchical, // Hierarchical addressing model support
    SDCsupportSCC, // Device contains an embedded storage array
    // controller (see SCSI-3 SCC-2 for details)
    SDCcommandQueuing, // tagged command queuing (all types) support
    SDCbasicQueuing, // command queuing basic task set support
    SDCenclosure, // Device contains an embedded enclosure services
    // component (see SCSI-3 SES for details)
    SDCmultiPort, // Device conforms to multi-port requirements
    SDCmediumChanger, // Device contains a meduim transport element
    SDCrelativeAddress, // Linked commands may use relative addressing
    SDClinkedCommands, // Execution of linked commands support
    SDCwideBus16, // 16-bit wide data transfers support (SPI-3 only)
    SDCaddress16, // 16-bit SCSI addressing support (SPI-3 only)
    SDCsynchTransfer, // Synchronous data transfers support (SPI-3 only)
    SDCtransferDisable // CONTINUE TASK and TARGET TRANSFER DISABLE
    ); // messages support (SPI-3 only)

type
  TScsiDeviceInfo = packed record
    PeriphQualifier: TScsiPeripheralQualifier;
    DeviceType: TScsiDeviceType;
    Version: TScsiStandardCompliance;
    Capabilities: TScsiDeviceCapabilities;
    ResponseDataFormat: BYTE; // indicates the INQUIRY data format is:
    // 0 = as specified in SCSI-1,
    // 1 = products that were designed prior to the SCSI-2,
    // 2 = as specified in SCSI-2 or SCSI-3,
    // 3..0Fh = reserved.
    VendorID: string[8];
    ProductID: string[16];
    ProductRev: string[4]; // Hardware/firmware revision code
    VendorSpecific: string[20];
    DriveLetter: Char;
  end;

type
  TCdRomCapability =
    (cdcReadCDR, // Device is capable to read CD-R media,
    // see CDSTATUS_READ_CD_R constant
    cdcReadCDRW, // --""-- CD-RW media, CDSTATUS_READ_CD_RW
    cdcReadMethod2, // --""-- CD-R written using fixed packet
    // tracks, CDSTATUS_READ_METHOD2
    cdcReadDVD, // --""-- DVD media, CDSTATUS_READ_DVD_ROM
    cdcReadDVDR, // --""-- DVD-R media, CDSTATUS_READ_DVD_R
    cdcReadDVDRAM, // --""-- DVD-RAM media, CDSTATUS_READ_DVD_RAM
    // ====== Bit constants for TScsiModePageCdStatus.Flags[1] ======
    cdcWriteCDR, // Device is capable to write CD-R media,
    // see CDSTATUS_WRITE_CD_R constant
    cdcWriteCDRW, // --""-- CD-RW media, CDSTATUS_WRITE_CD_RW
    cdcWriteDVDR, // --""-- DVD-R media, CDSTATUS_WRITE_DVD_R
    cdcWriteDVDRAM, // --""-- DVD-RAM media, CDSTATUS_WRITE_DVD_RAM
    cdcWriteTestMode, // Device is in test mode, CDSTATUS_TEST_MODE
    cdcWriteBurnProof, // Device Has Burn Proof, CDSTATUS_BURN_PROOF
    // ====== Bit constants for TScsiModePageCdStatus.Flags[2] ======
    cdcAudioPlay, // Device is capable to audio media playback,
    // see CDSTATUS_AUDIO_PLAY constant
    cdcAudioComposite, // Device is capable of delivering a composite
    // audio/video stream, CDSTATUS_AUDIO_COMPOSITE
    cdcAudioDigiPort1, // Device supports digital output on port 1,
    // CDSTATUS_AUDIO_DIGIPORT1
    cdcAudioDigiPort2, // --""-- on port 2, CDSTATUS_AUDIO_DIGIPORT2
    cdcReadMode2form1, // Device is capable to read Mode 2 Form 1
    // (CD-XA format), CDSTATUS_READ_MODE2_FORM1
    cdcReadMode2form2, // --""-- Form 2,  CDSTATUS_READ_MODE2_FORM2
    cdcReadMultisession, // Device is capable to read PhotoCD format
    // with multiple sessions on disc, CDSTATUS_READ_MULTISESSION
// ====== Bit constants for TScsiModePageCdStatus.Flags[3] ======
    cdcCDDAread, // Device supports an audio CD reading using
    // READ CD command, CDSTATUS_CDDA_CAPABLE
    cdcCDDAaccurate, // Device returns to an audio location without
    // losing place, CDSTATUS_CDDA_STREAM_ACCURATE
    cdcSubchannelRW, // Device supports an audio CD subchannel R-W
    // data reading, CDSTATUS_CDDA_RW_SUPPORT
    cdcSubchannelCorrect, // The subchannel data will be de-interleaved
    // error-corrected, CDSTATUS_CDDA_RW_CORRECTED
    cdcC2Pointers, // Device is capable to return C2 Error Pointers
    // and C2 Block Error Flags, CDSTATUS_CDDA_C2_POINTERS
    cdcCddaISRC, // Device can return ISRC, CDSTATUS_CDDA_ISRC
    cdcCddaUPC, // --""-- UPC,  CDSTATUS_CDDA_UPC
    cdcCddaBarCode, // --""-- disc bar code, CDSTATUS_CDDA_BARCODE
    // ====== Bit constants for TScsiModePageCdStatus.Flags[4] ======
    cdcLock, // Device is capable to locking the media into
    // drive, CDSTATUS_LOCK_CAPABLE
    cdcLocked, // Media is locked, CDSTATUS_LOCK_STATE
    cdcLockJumper, // Current state of the (optional) lock jumper,
    // CDSTATUS_PREVENT_JUMPER
    cdcEject, // Device is capable to eject media,
    // CDSTATUS_EJECT_CAPABLE
// ====== Bit constants for TScsiModePageCdStatus.Flags[5] ======
    cdcSeparateVolume, // Audio level control is separate for each
    // channel, CDSTATUS_SEPARATE_VOLUME
    cdcSeparateMute, // same for mute, CDSTATUS_SEPARATE_MUTE
    cdcDiskSensor, // MECHANISM STATUS/DiscPresent field is valid,
    // CDSTATUS_REPORTS_HAVE_DISK
    cdcSlotSelect, // Behavior of LOAD/UNLOAD command control,
    // CDSTATUS_SLOT_SELECTION
    cdcSideChange, // disc changers only, CDSTATUS_SIDE_CHANGE
    cdcCddaRwLeadIn); // Device supports an audio CD R-W subchannel
  // from the Lead-in, CDSTATUS_CDDA_RW_LEAD_IN

type
  TCdRomCapabilities = set of TCdRomCapability;

type
  TCDReadWriteSpeeds = packed record
    MaxReadSpeed: byte;
    CurrentReadSpeed: byte;
    MaxWriteSpeed: byte;
    CurrentWriteSpeed: byte;
    BufferSize: Byte;
  end;

type
  TScsiSubQinfoFlags = set of
    // ssqfADRxxx flags are mutually exclusive
  (ssqfADRnone, // Q sub-channel mode information not supplied
    ssqfADRposition, // --"-- encodes track, index, abs. & rel. addresses
    ssqfADRcatalogue, // --"-- encodes Media catalogue number
    ssqfADRISRC, // --"-- encodes ISRC
    ssqfPreEmphasis, // Audio track - recorded w/pre-emphasis of 50/15 uS,
    // Data track  - recorded incremental
    ssqfCopyPermit, // Audio track Digital copy permitted
    ssqfDataTrack, // Track is Data
    ssqfAudioTrack, // Track is Audio
    ssqfQuadAudio); // Track is 4-channel (? - reserved in CD-R/RW)

type
  TScsiTrackDescriptor = packed record
    Flags: TScsiSubQinfoFlags;
    TrackNumber: byte;
    AbsAddress: DWORD;
  end;

  TScsiTOC = packed record
    FirstTrack: integer;
    LastTrack: integer;
    TrackCount: integer; // Total tracks amount
    Tracks: array[0..99] of TScsiTrackDescriptor;
  end;

type
  TScsiSessionInfo = packed record
    Flags: TScsiSubQinfoFlags; // of sector where this TOC entry was found
    FirstSession, // 1st complete session number, should be =1
    LastSession, // last complete session number
    FirstTrack: BYTE; // 1st track in last complete session number
    FirstTrackLBA: DWORD; // ---"--- starting LBA as read from the TOC
  end;

type
  TScsiCDBufferInfo = packed record
    DataLength: Word;
    Reserved1: BYTE;
    Reserved2: BYTE;
    SizeOfBuffer: DWORD;
    BlankLength: DWORD;
  end;

type
  TScsiTrackDescriptorTemplate = packed record
    Reserved1: byte;
    ADR: byte;
    TrackNumber: byte;
    Reserved2: byte;
    AbsAddress: DWORD;
  end;

  TScsiTOCtemplate = packed record
    Length: WORD;
    FirstTrack: byte;
    LastTrack: byte;
    Tracks: array[0..99] of TScsiTrackDescriptorTemplate;
  end;

type
  TCDTextPacket = packed record
    idType: Byte; // packet type
    idTrk: Byte; // track number
    idSeq: Byte; // sequence
    idFlg: Byte; // flags
    txt: array[0..11] of Byte; // Text data (ASCII)
    CRC: array[0..1] of Byte; // CRC (Cyclic Redundancy Check)
  end;

type
  TDiscTrack = record
    StartAddress: DWord;
    StartAddressStr: ShortString;
    Length: DWord;
    LengthStr: ShortString;
    EndAddress: DWord;
    EndAddressStr: ShortString;
    fSizeMB: DWord;
    fType: DWord;
    fTypeStr: ShortString;
  end;

type
  TDiscSession = record
    fSize: DWord;
    fSizeMB: DWord;
    FirstTrack: Byte;
    LastTrack: Byte;
    Tracks: array[1..99] of TDiscTrack;
  end;

type
  TDiscLayout = record
    FirstSession: Byte;
    LastSession: Byte;
    Sessions: array of TDiscSession;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -