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

📄 scsitypes.pas

📁 用于CD/DVD烧录的Delphi源码,包括source和demo
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  end;

type
  TCDText = packed record
    dummy: array[0..3] of Byte; // Header
    CDText: array[0..255] of TCDTextPacket; // CD-Text packets
  end;

type
  TScsiReadCdSectorType =
    (csfAnyType, // no checking of data type is performed by device
    csfAudio, // only IEC 908:1987 (CD-DA) sectors
    csfDataMode1, // only Yellow Book (user data of 2048 bytes)
    csfDataMode2, // only Yellow Book (expanded user data of 2336 bytes)
    csfXaForm1, // only CD-XA Mode 2 Form1 (user data of 2048 bytes)
    csfXaForm2); // same, Form2 (user data of 2324 bytes + 4 spare bytes)

type
  TScsiReadCdFormatFlags = set of
    //  Field size in bytes for various modes :
//      Data      XA mode2      CD
//  mode1 mode2  form1 form2  audio
  (cffSync, //   12    12     12    12      --
    cffHeader, //    4     4      4     4      --
    cffSubheader, //   --    --      8     8      --
    cffUserData, //  2048  2336   2048  2324+4  2352
    cffEDCandECC, // 4+8+276 --   4+276   --      --
    cffC2errorBits, //   294   294    294   294     294
    cffBlockErrByte, //   1+1   1+1    1+1   1+1     1+1
    // Subchannel is for all types; this flags are mutually exclusive.
    cffSubchannelRaw, // Raw (not de-interleaved) P-W data
    cffSubchannelQ, // Subchannel Q only
    cffSubchannelPW); // de-interleaved and error-corrected P-W data
  // Helper function. Return value is number of bytes per sector for ReadCD
  //   command, or -1 if combination of arguments is illegal.

type
  TScsiAudioStatus =
    (sasInvalid, // Audio status byte not supported or not valid
    sasPlay, // Audio play operation in progress
    sasPause, // Audio play operation paused
    sasCompleted, // Audio play operation successfully completed
    sasError, // Audio play operation stopped due to error
    sasStop, // No current audio status to return
    sasUnknown); // ASPI returns the 'reserved' code value

type
  TScsiISRC = packed record
    Status: TScsiAudioStatus;
    Flags: TScsiSubQinfoFlags;
    IsrcNumber: string[12]; // ISRC (DIN-31-621) Number, or '' if fails
    FrameNumber: byte; // Number (0..4Ad) of frame where MCN was found
  end;

  // new added dvd functions

type
  TScsiProfileDeviceDiscTypes = record
    TypeNum: Integer;
    DType,
      SubType: string;
  end;

type
  TScsiDVDLayerDescriptor = packed record
    DataLength: Word;
    Reserved1: Byte;
    Reserved2: Byte;
    BookType_PartVersion: Byte; // BookType Nibble
    //    0000    = DVD-ROM = $00
    //    0001    = DVD-RAM = $01
    //    0010    = DVD-R   = $02
    //    0011    = DVD-RW  = $03
    //    1001    = DVD+RW  = $09
    //    1010    = DVD+R   = $0A
    //    Others  = Reserved
    DiscSize_MaximumRate: Byte; // DiscSize Nibble
    //    0000    = 120mm   = $00
    //    0001    = 80mm    = $01
    // MaximumRate Nibble
    //    0000    = 2.52 Mbps     = $00
    //    0001    = 5.04 Mbps     = $01
    //    0010    = 10.08 Mbps    = $02
    //    1111    = Not Specified = $0F
    //    Others  = Reserved
    NumberOfLayers_TrackPath_LayerType: Byte; // LayerType Bit
    //    0 = Layer contains embossed data    = $01
    //    1 = Layer contains recordable area  = $02
    //    2 = Layer contains rewritable area  = $04
    //    3 = Reserved                        = $08
    LinearDensity_TrackDensity: Byte; // LinearDensity Nibble
    //    0000    = 0.267 um/bit          = $00
    //    0001    = 0.293 um/bit          = $01
    //    0010    = 0.409 to 0.435 um/bit = $02
    //    0100    = 0.280 to 0.291 um/bit = $04
    //    1000    = 0.353 um/bit          = $08
    //    Others  = Reserved
    // TrackDensity Nibble
    //    0000    = 0.74 um/track   = $00
    //    0001    = 0.80 um/track   = $01
    //    0010    = 0.615 um/track  = $02
    //    Others  = Reserved
    StartingPhysicalSector: DWORD;
    EndPhysicalSector: DWORD;
    EndPhysicalSectorInLayerZero: DWORD;
    (*
        Reserved3                           : Byte;
        StartingPhysicalSector              : Array [0..2] of Byte;
                                                    //    30000h DVD-ROM, DVD-R/-RW, DVD+RW
                                                    //    31000h DVD-RAM
                                                    //    Others Reserved
        Reserved4                           : Byte;
        EndPhysicalSector                   : Array [0..2] of Byte;
        Reserved5                           : Byte;
        EndPhysicalSectorInLayerZero        : Array [0..2] of Byte;
    *)
    BCA: Byte;
  end;


type
  TScsiDeviceConfigHeader = packed record
    // from ntddmmc.h - MMC 3 Feature structures
    DataLength: Cardinal;
    Reserved: Word;
    CurrentProfile: Word; // further described with TScsiProfileDiscTypes below
    FeatureCode: Word;
    Version: Byte;
    AdditionalLength: Byte;
    OtherData: array[0..101] of Byte;
  end;



  TDiscInformation = packed record
    DiscInformationLength: Word;
    Status: Byte;
    NumberOfFirstTrack: Byte;
    NumberOfSessionsLSB: Byte;
    FirstTrackInLastSessionLSB: Byte;
    LastTrackInLastSessionLSB: Byte;
    DiscInfo: Byte;
    DiscType: Byte;
    NumberOfSessionsMSB: Byte;
    FirstTrackInLastSessionMSB: Byte;
    LastTrackInLastSessionMSB: Byte;
    DiscIdentification: Cardinal;
    LastSessionLeadinStartAddress: Cardinal;
    LastPossibleLeadoutStartAddress: Cardinal;
    DiscBarCode: array[0..7] of Byte;
    DiscApplicationCode: Byte;
    NumberOfOPCTables: Byte;
  end;

  TScsiDVDLayerDescriptorInfo = record
    BookType,
      DiscSize,
      MaximumRate,
      LinearDensity,
      TrackDensity,
      LayerType,
      NoLayer: string;
    Sectors: Integer;
    // total sectors - result of  (EndPhysicalSector minus StartingPhysicalSector)
  end;

  TCapacityListHeader = packed record
    Reserved1: Byte;
    Reserved2: Byte;
    Reserved3: Byte;
    CapacityListLength: Byte;
  end;

  TCurrentMaximumCapacityDescriptor = packed record
    NumberOfBlocks: Cardinal;
    DescriptorType: Byte;
    BlockLength: array[0..2] of Byte;
  end;

  TFormattableCD = packed record
    NumberOfBlocks: Cardinal;
    FormatType: Byte;
    TypeDependentParamter: array[0..2] of Byte;
  end;

  TFormatCapacity = packed record
    CapacityListHeader: TCapacityListHeader;
    CapacityDescriptor: TCurrentMaximumCapacityDescriptor;
    FormattableCD: array[0..32] of TFormattableCD;
    Unused: Byte;
  end;

  TTrackInformation = packed record
    DataLength: Word;
    TrackNumber: Byte;
    SessionNumber: Byte;
    Reserved: Byte;
    TrackMode: Byte;
    DataMode: Byte;
    Reserved2: Byte;
    TrackStartAddress: LongWord;
    NextWritableAddress: LongWord;
    FreeBlocks: LongWord;
    FixedPacketSize: LongWord;
    TrackSize: LongWord;
    LastRecordedAddress: LongWord;
    TrackNumber2: Byte;
    SessionNumber2: Byte;
    Reserved3: Byte;
    Reserved4: Byte;
    Reserved5: Byte;
    Reserved6: Byte;
  end; // this is for DVD minus RW & CD-RW discs - DVD plus RWs write-over previous session/track

type
  TScsiSessionInfoTemplate = packed record
    Length: WORD;
    FirstSession: byte;
    LastSession: byte;
    Reserved1: byte;
    ADR: byte;
    TrackNumber: byte;
    Reserved2: byte;
    AbsAddress: DWORD;
  end;

type
  TScsiISRCTemplate = packed record
    sitReserved,
      sitStatus: BYTE;
    sitLength: WORD;
    sitFormat,
      sitADR,
      sitTrackNumber,
      sitReserved2,
      sitValid: BYTE;
    sitNumber: array[0..11] of Char;
    sitReserved3,
      sitAFrame,
      sitReserved4: BYTE;
  end;

type
  TScsiWriteModePage = packed record
    PSPageCode: byte; {8 PS bit 7} {PageCode bits 0-6}
    PageLength: byte; {9 page length = $32}
    TestFlagWriteType: byte; {10 Write type bits 0-3} {TestFlag bit 4}
    {link size bit 5}{buffer free bit 6}
    MSFPCopyTrackMode: byte; {11 MS (Multisession) bits 6-7} {FP bit 5}
    {Copy bit 4}{Track mode bits 0-3}
    DataBlockType: byte; {12 datablock type bits 0-3}
    LinkSize: Byte; {13 link size = 7}
    Reserved1: Byte; {14}
    HostApplicationCode: byte; {15 bits 0-5}
    SessionFormat: byte; {16}
    Reserved2: byte; {17}
    PacketSize: LongWord; {18 19 20 21}
    AudioPauseLength: Word;
    MediaCatalogNumber: array[1..16] of byte;
    InternationalStandardRecordingCode: array[1..14] of Char;
    SubHeader: array[1..4] of byte;
    Vendor_uniq: array[1..4] of byte;
  end;

var
  SCSI_DEF: TScsiDefaults =
  (Timeout: 1000;
    ReadTimeout: 10000;
    AudioTimeout: 10000;
    SpindleTimeout: 10000;
    fOnCommandSending: nil;
    fOnCommandSent: nil;
    ModePageType: MPTcurrent;
    Sense: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));

implementation

end.

⌨️ 快捷键说明

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