home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cdrom.zip / DDK / BASE / SRC / DEV / DASD / CDROM / OS2CDROM / cdbscsi.h < prev    next >
C/C++ Source or Header  |  1996-06-18  |  43KB  |  1,640 lines

  1. /**************************************************************************
  2.  *
  3.  * SOURCE FILE NAME = CDBSCSI.H
  4.  *
  5.  * DESCRIPTIVE NAME = SCSI Command Descriptor Block definitions for
  6.  *                    the OS/2 CD-ROM Device Mgr.
  7.  *
  8.  * Copyright : COPYRIGHT IBM CORPORATION, 1991, 1992
  9.  *             LICENSED MATERIAL - PROGRAM PROPERTY OF IBM
  10.  *             REFER TO COPYRIGHT INSTRUCTION FORM#G120-2083
  11.  *             RESTRICTED MATERIALS OF IBM
  12.  *             IBM CONFIDENTIAL
  13.  *
  14.  * VERSION = V2.0
  15.  *
  16.  * DATE
  17.  *
  18.  * DESCRIPTION
  19.  *
  20.  *
  21.  * FUNCTIONS
  22.  *
  23.  * ENTRY POINTS:
  24.  *
  25.  * DEPENDENCIES:
  26.  *
  27.  * NOTES
  28.  *
  29.  *
  30.  * STRUCTURES
  31.  *
  32.  * EXTERNAL REFERENCES
  33.  *
  34.  * EXTERNAL FUNCTIONS
  35.  *
  36.  * CHANGE ACTIVITY =
  37.  *  DATE      FLAG        APAR   CHANGE DESCRIPTION
  38.  *  --------  ----------  -----  --------------------------------------
  39.  *  09/08/95  @V135221           Sam Detweiler - CD-ROM changer support
  40.  *  01/06/96  @JSM       147578  Stan Morrow - Teac CD40E sleep mode support
  41.  *
  42.  ****************************************************************************/
  43.  
  44. /*
  45. **    CD-ROM device specific data structures
  46. */
  47. union ULONGB  {                           /* to pick apart a long */
  48.         ULONG           dword;
  49.         struct {
  50.                 USHORT  word_0;
  51.                 USHORT  word_1;
  52.         } ulbwords;
  53.         struct {
  54.                 UCHAR   byte_0;
  55.                 UCHAR   byte_1;
  56.                 UCHAR   byte_2;
  57.                 UCHAR   byte_3;
  58.         } ulbytes;
  59. };
  60.  
  61.  
  62. union ULONGW  {
  63.         ULONG           dword;
  64.         struct {
  65.                 USHORT  word_0;
  66.                 USHORT  word_1;
  67.         } ulwords;
  68. };
  69.  
  70. struct  bytes     {
  71.         UCHAR     byte_0;
  72.         UCHAR     byte_1;
  73. };
  74.  
  75. union   USHORTB {
  76.         USHORT          word;
  77.         struct {
  78.                 UCHAR   byte_0;
  79.                 UCHAR   byte_1;
  80.         } usbytes;
  81. };
  82.  
  83. struct ul_RedBookAddress {
  84.         UCHAR       frame;
  85.         UCHAR       sec;
  86.         UCHAR       min;
  87.         UCHAR       zero;
  88. };
  89.  
  90. struct HSGaddress {
  91.         UCHAR       byte_0;
  92.         UCHAR       byte_1;
  93.         UCHAR       byte_2;
  94.         UCHAR       byte_3;
  95. };
  96.  
  97. struct RedBookAddress {
  98.         UCHAR    zero;
  99.         UCHAR    min;
  100.         UCHAR    sec;
  101.         UCHAR    frame;
  102. };
  103.  
  104.  
  105. struct MSF0 {
  106.         UCHAR    min;
  107.         UCHAR    sec;
  108.         UCHAR    frame;
  109.         UCHAR    zero;
  110. };
  111.  
  112.  
  113. union AddressType {
  114.         struct
  115.         ul_RedBookAddress ul_redbook;
  116.         struct
  117.         HSGaddress        hsg;
  118.         struct
  119.         RedBookAddress    redbook;
  120.         struct
  121.         MSF0              msf0;
  122.         ULONG             dword;
  123.  
  124. };
  125.  
  126.  
  127.  
  128. struct SCSI_command {
  129.         UCHAR   byte_0;
  130.         UCHAR   byte_1;
  131.         UCHAR   byte_2;
  132.         UCHAR   byte_3;
  133.         UCHAR   byte_4;
  134.         UCHAR   byte_5;
  135.         UCHAR   byte_6;
  136.         UCHAR   byte_7;
  137.         UCHAR   byte_8;
  138.         UCHAR   byte_9;
  139.         UCHAR   byte_10;
  140.         UCHAR   byte_11;
  141.         UCHAR   byte_12;
  142.         UCHAR   byte_13;
  143.         UCHAR   byte_14;
  144.         UCHAR   byte_15;
  145. };
  146.  
  147. /************************************************
  148.  * SCSI Test Unit Ready  (0x00)                 *
  149.  ************************************************/
  150. struct CDB_TestUnitReady {
  151.  
  152.         UCHAR   OpCode;
  153.  
  154.         UCHAR   Reserved_1 : 5;
  155.         UCHAR   LUN        : 3;
  156.  
  157.         UCHAR   Reserved_2;
  158.         UCHAR   Reserved_3;
  159.         UCHAR   Reserved_4;
  160.         UCHAR   Control;
  161. };
  162.  
  163. /*
  164. ** CDB Control Bit Flags
  165. */
  166. #define CDB_CONTROL_LINK   0x01
  167. #define CDB_CONTROL_FLAG   0x02
  168.  
  169. /*
  170. ** CDB Control Bits - IBM vendor specific field in bits 6 & 7
  171. */
  172. #define CDB_CONTROL_LBA    0x00
  173. #define CDB_CONTROL_HEADER 0x40
  174. #define CDB_CONTROL_TRACK  0x80
  175.  
  176.  
  177.  
  178. /************************************************
  179.  * SCSI Rezero Unit      (0x01)                 *
  180.  ************************************************/
  181. struct CDB_RezeroUnit {
  182.  
  183.         UCHAR   OpCode;
  184.  
  185.         UCHAR   reserved_1 : 5;
  186.         UCHAR   LUN        : 3;
  187.  
  188.         UCHAR   reserved_2;
  189.         UCHAR   reserved_3;
  190.         UCHAR   reserved_4;
  191.         UCHAR   control;
  192. };
  193.  
  194. /************************************************
  195.  * SCSI Request Sense    (0x03)                 *
  196.  ************************************************/
  197. struct CDB_RequestSense {
  198.  
  199.         UCHAR   OpCode;
  200.  
  201.         UCHAR   reserved_1 : 5;
  202.         UCHAR   LUN        : 3;
  203.  
  204.         UCHAR   reserved_2;
  205.         UCHAR   reserved_3;
  206.         UCHAR   alloc_length;
  207.         UCHAR   control;
  208. };
  209.  
  210.  
  211. struct Sense_Data
  212. {
  213.         USHORT  error_code                  : 7;
  214.         USHORT  valid                       : 1;
  215.         USHORT  segment_number              : 8;
  216.  
  217.         UCHAR   sense_key                   : 4;
  218.         UCHAR   reserved_1                  : 1;
  219.         UCHAR   ILI                         : 1;
  220.         UCHAR   EOM                         : 1;
  221.         UCHAR   filemark                    : 1;
  222.  
  223.         ULONG   information;
  224.         UCHAR   additional_sense_length;
  225.         UCHAR   command_specific_info[4];
  226.         UCHAR   additional_sense_code;
  227.         UCHAR   additional_sense_code_qualifier;
  228.         UCHAR   FRU_Code;
  229.         UCHAR   sensekey_specific[3];
  230. };
  231.  
  232. /************************************************
  233.  * SCSI Read(6)          (0x08)                 *
  234.  ************************************************/
  235. struct CDB_Read_6 {
  236.  
  237.         UCHAR   OpCode;
  238.  
  239.         UCHAR   LBA_msb     : 5;
  240.         UCHAR   LUN         : 3;
  241.  
  242.         union
  243.         USHORTB LBA;
  244.         UCHAR   transfer_length;
  245.         UCHAR   control;
  246. };
  247.  
  248. /************************************************
  249.  * SCSI Read(10)         (0x28)                 *
  250.  ************************************************/
  251. struct CDB_Read_10 {
  252.         UCHAR   OpCode;
  253.  
  254.         UCHAR   RelAdr      : 1;
  255.         UCHAR   Reserved_1  : 2;
  256.         UCHAR   FUA         : 1;
  257.         UCHAR   DPO         : 1;
  258.         UCHAR   LUN         : 3;
  259.  
  260.         union
  261.         ULONGB  LBA;
  262.         UCHAR   reserved_2;
  263.         union
  264.         USHORTB transfer_length;
  265.         UCHAR   control;
  266. };
  267.  
  268. /************************************************
  269.  * SCSI Read(12)         (0xA8)                 *
  270.  ************************************************/
  271. struct CDB_Read_12 {
  272.         UCHAR   OpCode;
  273.  
  274.         UCHAR   RelAdr      : 1;
  275.         UCHAR   reserved_1  : 7;
  276.  
  277.         union
  278.         ULONGB  LBA;
  279.         union
  280.         ULONGB  transfer_length;
  281.         UCHAR   reserved_2;
  282.         UCHAR   control;
  283. };
  284.  
  285. /************************************************
  286.  * SCSI Seek(6)          (0x0B)                 *
  287.  ************************************************/
  288. struct CDB_Seek_6 {
  289.  
  290.         UCHAR   OpCode;
  291.  
  292.         UCHAR   LBA_msb     : 5;
  293.         UCHAR   LUN         : 3;
  294.  
  295.         union
  296.         USHORTB LBA;
  297.         UCHAR   reserved_1;
  298.         UCHAR   control;
  299. };
  300.  
  301. /************************************************
  302.  * SCSI Seek(10)         (0x2B)                 *
  303.  ************************************************/
  304. struct CDB_Seek_10 {
  305.  
  306.         UCHAR   OpCode;
  307.  
  308.         UCHAR   reserved_1  : 5;
  309.         UCHAR   LUN         : 3;
  310.  
  311.         union
  312.         ULONGB  LBA;
  313.         UCHAR   reserved_2;
  314.         UCHAR   reserved_3;
  315.         UCHAR   reserved_4;
  316.         UCHAR   control;
  317. };
  318.  
  319. /************************************************
  320.  * SCSI Inquiry Command  (0x12)                 *
  321.  ************************************************/
  322. struct CDB_Inquiry {
  323.  
  324.         UCHAR   OpCode;
  325.  
  326.         UCHAR   EVPD       : 1;
  327.         UCHAR   reserved_1 : 4;
  328.         UCHAR   LUN        : 3;
  329.  
  330.         UCHAR   page_code;
  331.         UCHAR   reserved_2;
  332.         UCHAR   alloc_length;
  333.         UCHAR   control;
  334. };
  335.  
  336. struct Inquiry_Data
  337. {
  338.         USHORT  peripheral_device_type      : 8;
  339.         USHORT  device_type_qualifier       : 7;
  340.         USHORT  removable_medium            : 1;
  341.         USHORT  ansi_version                : 3;
  342.         USHORT  ecma_version                : 3;
  343.         USHORT  iso_version                 : 2;
  344.         USHORT  response_data_format        : 4;
  345.         USHORT  bits                        : 4;
  346.         UCHAR   additional_length;
  347.         UCHAR   zeros [3];
  348.         UCHAR   vendor_id [8];
  349.         UCHAR   product_id [16];
  350.         UCHAR   revision_level [4];
  351.         UCHAR   scsi_firmware_date [8];
  352. //      UCHAR   zero;
  353. };
  354.  
  355. /************************************************
  356.  * SCSI Mode Select Command(6)   (0x15)         *
  357.  ************************************************/
  358.  
  359. struct CDB_ModeSelect {
  360.  
  361.         UCHAR   OpCode;
  362.  
  363.         UCHAR   SP         : 1;
  364.         UCHAR   reserved_1 : 3;
  365.         UCHAR   PF         : 1;
  366.         UCHAR   LUN        : 3;
  367.  
  368.         UCHAR   reserved_2;
  369.         UCHAR   reserved_3;
  370.         UCHAR   parm_length;
  371.         UCHAR   control;
  372. };
  373.  
  374.  
  375. /************************************************
  376.  * SCSI Mode Select Command(10)     (0x55)      *
  377.  ************************************************/
  378.  
  379. struct CDB_ModeSelect_10 {
  380.  
  381.         UCHAR   OpCode;
  382.  
  383.         UCHAR   SP         : 1;
  384.         UCHAR   reserved_1 : 3;
  385.         UCHAR   PF         : 1;
  386.         UCHAR   LUN        : 3;
  387.  
  388.         UCHAR   reserved_2;
  389.         UCHAR   reserved_3;
  390.         UCHAR   reserved_4;
  391.         UCHAR   reserved_5;
  392.         UCHAR   reserved_6;
  393.         union
  394.         USHORTB parm_length;
  395.         UCHAR   control;
  396. };
  397.  
  398.  
  399. /*  Mode Parameter Header for 6 byte Mode Select command*/
  400.  
  401. struct ModeSelectHdr {
  402.         UCHAR     mode_data_length;
  403.         UCHAR     medium_type;
  404.         UCHAR     device_specific_parm;
  405.         UCHAR     block_descriptor_len;
  406. };
  407.  
  408.  
  409. /*  Mode Parameter Header for 10 byte Mode Select command */
  410.  
  411. struct ModeSelectHdr_10 {
  412.         union
  413.         USHORTB   mode_data_length;
  414.         UCHAR     medium_type;
  415.         UCHAR     device_specific_parm;
  416.         UCHAR     reserved_1;
  417.         UCHAR     reserved_2;
  418.         union
  419.         USHORTB   block_descriptor_len;
  420. };
  421.  
  422.  
  423.  
  424. /*
  425. ** CD-ROM Medium Type Codes
  426. */
  427. #define CD_MEDIUM_DEFAULT              0x00
  428. #define CD_MEDIUM_120_CDROM_DATA       0x01
  429. #define CD_MEDIUM_120_CDDA_AUDIO       0x02
  430. #define CD_MEDIUM_120_CDROM_COMBINED   0x03
  431. #define CD_MEDIUM_RESERVED             0x04
  432. #define CD_MEDIUM_80_CDROM_DATA        0x05
  433. #define CD_MEDIUM_80_CDDA_AUDIO        0x06
  434. #define CD_MEDIUM_80_CDROM_COMBINED    0x07
  435.  
  436. #define CD_MEDIUM_CLOSED_NODISC        0x70     /* ATAPI ONLY */
  437. #define CD_MEDIUM_OPEN_NOCADDY         0x71     /* ATAPI ONLY */
  438. #define CD_MEDIUM_CLOSED_MEDIUM_ERROR  0x72     /* ATAPI ONLY */
  439.  
  440.  
  441.  
  442. struct BlockDescriptor {
  443.         UCHAR     density_code;
  444.         UCHAR     block_count_0;
  445.         UCHAR     block_count_1;
  446.         UCHAR     block_count_2;
  447.         UCHAR     reserved_1;
  448.         UCHAR     block_length_0;
  449.         UCHAR     block_length_1;
  450.         UCHAR     block_length_2;
  451. };
  452.  
  453. /*
  454. ** CD-ROM Density Codes
  455. */
  456. #define CD_DENSITY_DEFAULT             0x00
  457. #define CD_DENSITY_USER_DATA           0x01    /* 2048 bytes per sector */
  458. #define CD_DENSITY_AUX_DATA            0x02    /* 2336 bytes per sector */
  459. #define CD_DENSITY_TAG                 0x03    /* 2340 bytes per sector */
  460. #define CD_DENSITY_AUDIO               0x04    /* 1/75 of a second      */
  461.  
  462. #define CD_DENSITY_CDXA                0X81    /* CD-ROM XA             */
  463. #define CD_DENSITY_CDDA                0x82    /* CD-DA                 */
  464. #define CD_DENSITY_CDXA_83             0x83    /* CD-ROM XA on Tosh3401 */
  465.  
  466. /*
  467. ** CD-ROM Audio Control Parameters Page -  Page Code 0x0E
  468. */
  469. struct Page_AudioCtrl {
  470.  
  471.         UCHAR     page_code   : 6;
  472.         UCHAR     reserved_1  : 1;
  473.         UCHAR     PS          : 1;
  474.  
  475.         UCHAR     page_length;
  476.  
  477.         UCHAR     reserved_2  : 1;
  478.         UCHAR     SOTC        : 1;
  479.         UCHAR     Immed       : 1;
  480.         UCHAR     reserved_3  : 5;
  481.  
  482.         UCHAR     reserved_4;
  483.         UCHAR     reserved_5;
  484.  
  485.         UCHAR     LBA_format  : 4;
  486.         UCHAR     reserved_6  : 3;
  487.         UCHAR     APRVal      : 1;
  488.  
  489.         union
  490.         USHORTB   LBAsPerSec;
  491.  
  492.         UCHAR     output0_select : 4;
  493.         UCHAR     reserved_7     : 4;
  494.         UCHAR     output0_volume;
  495.  
  496.         UCHAR     output1_select : 4;
  497.         UCHAR     reserved_8     : 4;
  498.         UCHAR     output1_volume;
  499.  
  500.         UCHAR     output2_select : 4;
  501.         UCHAR     reserved_9     : 4;
  502.         UCHAR     output2_volume;
  503.  
  504.         UCHAR     output3_select : 4;
  505.         UCHAR     reserved_10    : 4;
  506.         UCHAR     output3_volume;
  507. };
  508.  
  509. /*
  510. ** Output Port Channel Selection
  511. */
  512. #define  PCS_MUTED              0x00
  513. #define  PCS_CHANNEL0           0x01
  514. #define  PCS_CHANNEL1           0x02
  515. #define  PCS_CHANNEL0_1         0x03
  516. #define  PCS_CHANNEL2           0x04
  517. #define  PCS_CHANNEL3           0x08
  518.  
  519. /*
  520. ** CD-ROM Parameters Page -  Page Code 0x0D
  521. */
  522. struct Page_CDROM {
  523.  
  524.         UCHAR     page_code   : 6;
  525.         UCHAR     reserved_1  : 1;
  526.         UCHAR     PS          : 1;
  527.  
  528.         UCHAR     page_length;
  529.         UCHAR     reserved_2;
  530.  
  531.         UCHAR     inactivity_timer : 4;
  532.         UCHAR     reserved_3       : 4;
  533.  
  534.         union
  535.         USHORTB   Num_S_per_M;
  536.  
  537.         union
  538.         USHORTB   Num_F_per_S;
  539. };
  540.  
  541. /*
  542. ** Read Error Recovery Parameters Page -  Page Code 0x01
  543. */
  544. struct Page_ReadError {
  545.  
  546.         UCHAR     page_code   : 6;
  547.         UCHAR     reserved_1  : 1;
  548.         UCHAR     PS          : 1;
  549.  
  550.         UCHAR     page_length;
  551.         UCHAR     error_parm;
  552.         UCHAR     retry_count;
  553.  
  554.         UCHAR     reserved_2;
  555.         UCHAR     reserved_3;
  556.         UCHAR     reserved_4;
  557.         UCHAR     reserved_5;
  558. };
  559.  
  560.  
  561. /* Read Error Recovery Parm definitions  (error_parm)        */
  562.  
  563. #define RE_DCR   0x01           /* Transfer Block            */
  564. #define RE_DTE   0x02           /* Read Continuous           */
  565. #define RE_PER   0x04           /* Post Error                */
  566. #define RE_RC    0x10           /* Disable Transfer on Error */
  567. #define RE_TB    0x20           /* Disable Correction        */
  568.  
  569.  
  570.  
  571. /*
  572. ** Verify Error Recovery Parameters Page -  Page Code 0x07
  573. */
  574. struct Page_VerifyError {
  575.  
  576.         UCHAR     page_code   : 6;
  577.         UCHAR     reserved_1  : 1;
  578.         UCHAR     PS          : 1;
  579.  
  580.         UCHAR     page_length;
  581.         UCHAR     error_parm;
  582.         UCHAR     retry_count;
  583.  
  584.         UCHAR     reserved_2;
  585.         UCHAR     reserved_3;
  586.         UCHAR     reserved_4;
  587.         UCHAR     reserved_5;
  588. };
  589.  
  590. /*
  591. ** ATAPI CD-ROM Capabilites and Mechanical Status Page - Page Code 0x2A **
  592. */
  593. struct Page_Capabilities {
  594.  
  595.         UCHAR     page_code   : 6;
  596.         UCHAR     reserved_1  : 1;
  597.         UCHAR     PS          : 1;
  598.  
  599.         UCHAR     page_length;
  600.         UCHAR     reserved_2;
  601.         UCHAR     reserved_3;
  602.         ULONG     capabilities;
  603.  
  604.         union
  605.         USHORTB   max_speed;
  606.  
  607.         union
  608.         USHORTB   num_volume_levels;
  609.  
  610.         union
  611.         USHORTB   drive_buffer_size;
  612.  
  613.         union
  614.         USHORTB   current_drive_speed;
  615.  
  616.         UCHAR     num_adpcm_decoders;
  617.         UCHAR     reserved_4;
  618.         UCHAR     reserved_5;
  619.         UCHAR     reserved_6;
  620. };
  621.  
  622. /* Capabilities bit field definitions */
  623.  
  624. #define CP_AUDIO_PLAY                0x00000001
  625. #define CP_XA                        0x00000002
  626. #define CP_RESERVED_1                0x00000004
  627. #define CP_RESERVED_2                0x00000008
  628. #define CP_MODE2_FORM1               0x00000010
  629. #define CP_MODE2_FORM2               0x00000020
  630. #define CP_MULTISESSION              0x00000040
  631. #define CP_RESERVED_3                0x00000080
  632. #define CP_CDDA                      0x00000100
  633. #define CP_CDDA_ACCURATE             0x00000200
  634. #define CP_RW_CHANNEL_SUPPORT        0x00000400
  635. #define CP_RW_DEINTERLEAVED          0x00000800
  636. #define CP_C2_POINTERS               0x00001000
  637. #define CP_ISRC                      0x00002000
  638. #define CP_UPC                       0x00004000
  639. #define CP_RESERVED_4                0x00008000
  640. #define CP_LOCK                      0x00010000
  641. #define CP_LOCK_STATE                0x00020000
  642. #define CP_PREVENT_JUMPER            0x00040000
  643. #define CP_EJECT                     0x00080000
  644. #define CP_RESERVED_5                0x00100000
  645. #define CP_TRAY_LOADER               0x00200000
  646. #define CP_POPUP_LOADER              0x00400000
  647. #define CP_RESERVED_LOADER           0x00800000
  648. #define CP_INDIVIDUAL_CHANGER        0x00800000
  649. #define CP_CARTRIDGE_CHANGER         0x00A00000
  650. #define CP_INDEPENDENT_VOLUME_LEVELS 0x01000000
  651. #define CP_SEPARATE_CHANNEL_MUTE     0x02000000
  652. #define CP_CHANGER_DISC_PRESENT      0x04000000
  653. #define CP_RESERVED_7                0x08000000
  654. #define CP_RESERVED_8                0x10000000
  655. #define CP_RESERVED_9                0x20000000
  656. #define CP_RESERVED_10               0x40000000
  657. #define CP_RESERVED_11               0x80000000
  658.  
  659.  
  660. union ModeSelectDescriptors  {
  661.         struct BlockDescriptor  BlockDescriptor;
  662.         struct Page_AudioCtrl   audio_control;
  663.         struct Page_CDROM       CDROM;
  664.         struct Page_ReadError   ReadError;
  665.         struct Page_VerifyError VerifyError;
  666. };
  667.  
  668. struct ModeSelectParmList {
  669.         struct ModeSelectHdr          ModeSelectHdr;
  670.         union  ModeSelectDescriptors  Descriptors;
  671. };
  672.  
  673.  
  674. struct ModeSelectParmList_10 {
  675.         struct ModeSelectHdr_10       ModeSelectHdr;
  676.         union  ModeSelectDescriptors  Descriptors;
  677. };
  678.  
  679. struct CapabilitiesParmList_10 {
  680.         struct ModeSelectHdr_10       ModeParmHdr;
  681.         struct Page_Capabilities      CapPage;
  682. };
  683.  
  684. struct ModeSelectBlockError {
  685.         struct ModeSelectHdr          ModeSelectHdr;
  686.         struct BlockDescriptor        BlockDescriptor;
  687.         struct Page_ReadError         ReadError;
  688. };
  689.  
  690. /*
  691. ** Mode Page Codes
  692. */
  693. #define PAGE_READ_ERROR         0x01
  694. #define PAGE_DISCONNECT         0x02
  695. #define PAGE_VERIFY_ERROR       0x07
  696. #define PAGE_CACHING            0x08
  697. #define PAGE_PERIPHERAL         0x09
  698. #define PAGE_CONTROL_MODE       0x0A
  699. #define PAGE_MEDIUM             0x0B
  700. #define PAGE_CDROM              0x0D
  701. #define PAGE_AUDIO_CONTROL      0x0E
  702. #define PAGE_CAPABILITIES       0x2A
  703. #define PAGE_ALL                0x3F
  704.  
  705.  
  706.  
  707. /************************************************
  708.  * SCSI Reserve Command (0x16)                  *
  709.  ************************************************/
  710.  
  711. struct CDB_Reserve {
  712.  
  713.         UCHAR   OpCode;
  714.  
  715.         UCHAR   extent     : 1;
  716.         UCHAR   device_ID  : 3;
  717.         UCHAR   ThirdPty   : 1;
  718.         UCHAR   LUN        : 3;
  719.  
  720.         UCHAR   reservation_ID;
  721.         union
  722.         USHORTB extent_list_length;
  723.         UCHAR   control;
  724. };
  725.  
  726. /************************************************
  727.  * SCSI Release Command (0x17)                  *
  728.  ************************************************/
  729.  
  730. struct CDB_Release {
  731.  
  732.         UCHAR   OpCode;
  733.  
  734.         UCHAR   extent     : 1;
  735.         UCHAR   device_ID  : 3;
  736.         UCHAR   ThirdPty   : 1;
  737.         UCHAR   LUN        : 3;
  738.  
  739.         UCHAR   reservation_ID;
  740.         UCHAR   reserved_1;
  741.         UCHAR   reserved_2;
  742.         UCHAR   control;
  743. };
  744.  
  745.  
  746. /************************************************
  747.  * SCSI Mode Sense(6)   (0x1A)                  *
  748.  ************************************************/
  749.  
  750. struct CDB_ModeSense_6 {
  751.  
  752.         UCHAR   OpCode;
  753.  
  754.         UCHAR   reserved_1 : 3;
  755.         UCHAR   DBD        : 1;
  756.         UCHAR   reserved_2 : 1;
  757.         UCHAR   LUN        : 3;
  758.  
  759.         UCHAR   page_code  : 6;
  760.         UCHAR   PC         : 2;
  761.  
  762.         UCHAR   reserved_3;
  763.         UCHAR   alloc_length;
  764.         UCHAR   control;
  765. };
  766.  
  767. /************************************************
  768.  * SCSI Mode Sense(10)  (0x5A)                  *
  769.  ************************************************/
  770.  
  771. struct CDB_ModeSense_10 {
  772.  
  773.         UCHAR   OpCode;
  774.  
  775.         UCHAR   reserved_1 : 3;
  776.         UCHAR   DBD        : 1;
  777.         UCHAR   reserved_2 : 1;
  778.         UCHAR   LUN        : 3;
  779.  
  780.         UCHAR   page_code  : 6;
  781.         UCHAR   PC         : 2;
  782.  
  783.         UCHAR   reserved_3;
  784.         UCHAR   reserved_4;
  785.         UCHAR   reserved_5;
  786.         UCHAR   reserved_6;
  787.  
  788.         union
  789.         USHORTB alloc_length;
  790.         UCHAR   control;
  791. };
  792.  
  793. /* Page Control Field Definitions for Mode Sense */
  794.  
  795. #define PC_CURRENT     0x00
  796. #define PC_CHANGEABLE  0x01
  797. #define PC_DEFAULT     0x02
  798. #define PC_SAVED       0x03
  799.  
  800.  
  801. /************************************************
  802.  * SCSI Start Stop Unit Command (0x1B)          *
  803.  ************************************************/
  804.  
  805. struct CDB_StartStopUnit {
  806.  
  807.         UCHAR   OpCode;
  808.  
  809.         UCHAR   Immed     : 1;
  810.         UCHAR   reserved_1: 4;
  811.         UCHAR   LUN       : 3;
  812.  
  813.         UCHAR   reserved_2;
  814.         UCHAR   reserved_3;
  815.  
  816.         UCHAR   start     : 1;
  817.         UCHAR   LoEj      : 1;
  818.         UCHAR   reserved_4: 6;
  819.  
  820.         UCHAR   control;
  821. };
  822.  
  823. /************************************************
  824.  * SCSI Send Diagnostic Command (0x1D)          *
  825.  ************************************************/
  826.  
  827. struct CDB_SendDiagnostic {
  828.  
  829.         UCHAR   OpCode;
  830.  
  831.         UCHAR   UnitOfL    : 1;
  832.         UCHAR   DevOfL     : 1;
  833.         UCHAR   SelfTest   : 1;
  834.         UCHAR   reserved_1 : 1;
  835.         UCHAR   PF         : 1;
  836.         UCHAR   LUN        : 3;
  837.  
  838.         UCHAR   reserved_2;
  839.         union
  840.         USHORTB parm_length;
  841.         UCHAR   control;
  842. };
  843.  
  844.  
  845. /************************************************
  846.  * SCSI Prevent Allow Medium Removal (0x1E)     *
  847.  ************************************************/
  848.  
  849. struct CDB_PreventAllowRemoval {
  850.  
  851.         UCHAR   OpCode;
  852.  
  853.         UCHAR   reserved_1    : 5;
  854.         UCHAR   LUN           : 3;
  855.  
  856.         UCHAR   reserved_2;
  857.         UCHAR   reserved_3;
  858.  
  859.         UCHAR   prevent       : 1;
  860.         UCHAR   reserved_4    : 7;
  861.  
  862.         UCHAR   control;
  863.  
  864. };
  865.  
  866. /************************************************
  867.  * SCSI Read Capacity Command (0x25)            *
  868.  ************************************************/
  869.  
  870. struct CDB_ReadCapacity {
  871.  
  872.         UCHAR   OpCode;
  873.  
  874.         UCHAR   RelAdr     : 1;
  875.         UCHAR   reserved_1 : 4;
  876.         UCHAR   LUN        : 3;
  877.  
  878.         union
  879.         ULONGB  LBA;
  880.         UCHAR   reserved_2;
  881.         UCHAR   reserved_3;
  882.  
  883.         UCHAR   PMI        : 1;
  884.         UCHAR   reserved_4 : 7;
  885.  
  886.         UCHAR   control;
  887. };
  888.  
  889.  
  890. struct ReadCapacity_Data {
  891.         union
  892.         ULONGB  capacity_LBA;
  893.         union
  894.         ULONGB  capacity_block_length;
  895. };
  896.  
  897.  
  898. /************************************************
  899.  * SCSI Prefetch Command (0x34)                 *
  900.  ************************************************/
  901. struct CDB_Prefetch {
  902.  
  903.         UCHAR   OpCode;
  904.  
  905.         UCHAR   RelAdr      : 1;
  906.         UCHAR   Immed       : 1;
  907.         UCHAR   Reserved_1  : 3;
  908.         UCHAR   LUN         : 3;
  909.  
  910.         union
  911.         ULONGB  LBA;
  912.         UCHAR   reserved_2;
  913.         union
  914.         USHORTB transfer_length;
  915.         UCHAR   Control;
  916. };
  917.  
  918.  
  919.  
  920. /************************************************
  921.  * SCSI Read Sub-Channel Command  (0x42)        *
  922.  ************************************************/
  923.  
  924. struct CDB_ReadSubChannel {
  925.  
  926.         UCHAR   OpCode;
  927.  
  928.         UCHAR   reserved_1  : 1;
  929.         UCHAR   MSF         : 1;
  930.         UCHAR   reserved_2  : 3;
  931.         UCHAR   LUN         : 3;
  932.  
  933.         UCHAR   reserved_3  : 6;
  934.         UCHAR   SubQ        : 1;
  935.         UCHAR   reserved_4  : 1;
  936.  
  937.         UCHAR   data_format;
  938.         UCHAR   reserved_5;
  939.         UCHAR   reserved_6;
  940.         UCHAR   track_number;
  941.         union
  942.         USHORTB alloc_length;
  943.         UCHAR   control;
  944. };
  945.  
  946. /*
  947. ** SubChannel Data Format Codes
  948. */
  949. #define RSC_Q_SUB_CHANNEL            0X00
  950. #define RSC_CURRENT_POSITION         0X01
  951. #define RSC_MEDIA_CAT_NUM            0x02
  952. #define RSC_TRACK_ISRC               0x03
  953.  
  954.  
  955. struct SubChannel_Hdr {
  956.         UCHAR     reserved_1;
  957.         UCHAR     audio_status;
  958.         union
  959.         USHORTB   data_length;
  960. };
  961.  
  962. /*
  963. ** Audio Status Codes
  964. */
  965. #define AS_NOT_SUPPORTED              0x00
  966. #define AS_PLAY_IN_PROGRESS           0X11
  967. #define AS_PLAY_PAUSED                0x12
  968. #define AS_PLAY_COMPLETE              0x13
  969. #define AS_PLAY_ERROR                 0x14
  970. #define AS_NO_STATUS                  0x15
  971.  
  972. /*
  973. ** ADR Sub-channel Q Field
  974. */
  975. #define ADR_NO_Q_INFO                 0x00
  976. #define ADR_CURRENT_POSITION          0x01
  977. #define ADR_MEDIA_CAT_NUM             0x02
  978. #define ADR_TRACK_ISRC                0x03
  979.  
  980. /*
  981. ** Sub-channel Q Control Bits
  982. */
  983. #define QCTL_PRE_EMPHASIS             0x01
  984. #define QCTL_COPY_PERMITTED           0x02
  985. #define QCTL_DATA_TRACK               0x04
  986. #define QCTL_FOUR_CHANNEL             0x08
  987.  
  988.  
  989. struct SubQ_Channel_Data {
  990.         struct
  991.         SubChannel_Hdr  sub_channel_hdr;
  992.  
  993.         UCHAR        data_format_code;
  994.  
  995.         UCHAR        control  : 4;
  996.         UCHAR        ADR      : 4;
  997.  
  998.         UCHAR        track_number;
  999.         UCHAR        index_number;
  1000.         union
  1001.         AddressType  abs_address,
  1002.                      rel_address;
  1003.         UCHAR        reserved_1  : 7;
  1004.         UCHAR        mcval       : 1;
  1005.         UCHAR        media_catalog_no [15];
  1006.         UCHAR        tcval_zero;
  1007.         UCHAR        isrc [15];
  1008. };
  1009.  
  1010.  
  1011. struct SubChannel_Position {
  1012.  
  1013.         struct
  1014.         SubChannel_Hdr  sub_channel_hdr;
  1015.  
  1016.         UCHAR            data_format_code;
  1017.  
  1018.         UCHAR            control  : 4;
  1019.         UCHAR            ADR      : 4;
  1020.  
  1021.         UCHAR            track_number;
  1022.         UCHAR            index_number;
  1023.         union
  1024.         AddressType      abs_address,
  1025.                          rel_address;
  1026. };
  1027.  
  1028. struct SubChannel_Media_Cat {
  1029.         struct
  1030.         SubChannel_Hdr    sub_channel_hdr;
  1031.         UCHAR             data_format_code;
  1032.         UCHAR             reserved_1;
  1033.         UCHAR             reserved_2;
  1034.         UCHAR             reserved_3;
  1035.         UCHAR             reserved_4  : 7;
  1036.         UCHAR             mcval       : 1;
  1037.         UCHAR             media_catalog_no [15];
  1038. };
  1039.  
  1040. struct SubChannel_ISRC {
  1041.         struct
  1042.         SubChannel_Hdr  sub_channel_hdr;
  1043.         UCHAR           data_format_code;
  1044.         UCHAR           control;
  1045.         UCHAR           track_number;
  1046.         UCHAR           reserved_1;
  1047.         UCHAR           tcval;
  1048.         UCHAR           media_catalog_number [15];
  1049. };
  1050.  
  1051.  
  1052.  
  1053. union CDROM_SubChannel_Info {
  1054.         struct SubQ_Channel_Data     q_sub_channel;
  1055.         struct SubChannel_Position   current_position;
  1056.         struct SubChannel_Media_Cat  media_cat_number;
  1057.         struct SubChannel_ISRC       track_ISRC;
  1058. };
  1059.  
  1060.  
  1061.  
  1062. /************************************************
  1063.  * SCSI Read TOC Command          (0x43)        *
  1064.  ************************************************/
  1065.  
  1066. struct CDB_ReadTOC {
  1067.  
  1068.         UCHAR   OpCode;
  1069.  
  1070.         UCHAR   Reserved_1   : 1;
  1071.         UCHAR   MSF          : 1;
  1072.         UCHAR   Reserved     : 3;
  1073.         UCHAR   LUN          : 3;
  1074.  
  1075.         UCHAR   Reserved_2;
  1076.         UCHAR   Reserved_3;
  1077.         UCHAR   Reserved_4;
  1078.         UCHAR   Reserved_5;
  1079.  
  1080.         UCHAR   starting_track;
  1081.         union
  1082.         USHORTB alloc_length;
  1083.         UCHAR   control;
  1084. };
  1085.  
  1086. struct TOC_Hdr {
  1087.         union
  1088.         USHORTB toc_datalength;
  1089.         UCHAR   first_track;
  1090.         UCHAR   last_track;
  1091. };
  1092.  
  1093. struct TOC_Descriptor {
  1094.         UCHAR   reserved_1;
  1095.         UCHAR   control   : 4;
  1096.         UCHAR   ADR       : 4;
  1097.         UCHAR   track_num;
  1098.         UCHAR   reserved_3;
  1099.         union
  1100.         AddressType abs_address;
  1101. };
  1102.  
  1103. struct ReadTOC_Data {
  1104.         struct
  1105.         TOC_Hdr        toc_hdr;
  1106.         struct
  1107.         TOC_Descriptor toc_descriptor[1];
  1108. };
  1109.  
  1110. /************************************************
  1111.  * SCSI Read Header Command       (0x44)        *
  1112.  ************************************************/
  1113.  
  1114. struct CDB_ReadHeader {
  1115.  
  1116.         UCHAR   OpCode;
  1117.  
  1118.         UCHAR   reserved_1   : 1;
  1119.         UCHAR   MSF          : 1;
  1120.         UCHAR   reserved_2   : 3;
  1121.         UCHAR   LUN          : 3;
  1122.  
  1123.         union
  1124.         ULONGB  LBA;
  1125.         UCHAR   reserved_3;
  1126.         union
  1127.         USHORTB alloc_length;
  1128.         UCHAR   control;
  1129. };
  1130.  
  1131.  
  1132.  
  1133. struct ReadHeader_Data {
  1134.         UCHAR   cdrom_data_mode;
  1135.         UCHAR   reserved_1;
  1136.         UCHAR   reserved_2;
  1137.         UCHAR   reserved_3;
  1138.         union
  1139.         AddressType abs_address;
  1140. };
  1141.  
  1142.  
  1143. /* CD-ROM Data Mode Codes (cdrom_data_mode) */
  1144.  
  1145. #define RH_MODE_ZERO     0x00
  1146. #define RH_MODE_LEC      0x01
  1147. #define RH_MODE_DATA     0x02
  1148.  
  1149.  
  1150. /************************************************
  1151.  * SCSI Play Audio(10) Command    (0x45)        *
  1152.  ************************************************/
  1153.  
  1154. struct CDB_PlayAudio_10 {
  1155.  
  1156.         UCHAR   OpCode;
  1157.  
  1158.         UCHAR   RelAdr      : 1;
  1159.         UCHAR   reserved_1  : 4;
  1160.         UCHAR   LUN         : 3;
  1161.  
  1162.         union
  1163.         ULONGB  LBA;
  1164.         UCHAR   reserved_2;
  1165.         union
  1166.         USHORTB transfer_length;
  1167.         UCHAR   control;
  1168. };
  1169.  
  1170.  
  1171. /************************************************
  1172.  * SCSI Play Audio(12) Command    (0xA5)        *
  1173.  ************************************************/
  1174.  
  1175. struct CDB_PlayAudio_12 {
  1176.  
  1177.         UCHAR   OpCode;
  1178.  
  1179.         UCHAR   RelAdr      : 1;
  1180.         UCHAR   reserved_1  : 4;
  1181.         UCHAR   LUN         : 3;
  1182.  
  1183.         union
  1184.         ULONGB  LBA;
  1185.         union
  1186.         ULONGB  transfer_length;
  1187.         UCHAR   reserved_2;
  1188.         UCHAR   control;
  1189. };
  1190.  
  1191. /************************************************
  1192.  * SCSI Play Audio MSF Command    (0x47)        *
  1193.  ************************************************/
  1194.  
  1195. struct CDB_PlayAudio_MSF {
  1196.  
  1197.         UCHAR   OpCode;
  1198.  
  1199.         UCHAR   reserved_1  : 5;
  1200.         UCHAR   LUN         : 3;
  1201.  
  1202.         UCHAR   reserved_2;
  1203.         UCHAR   starting_M;
  1204.         UCHAR   starting_S;
  1205.         UCHAR   starting_F;
  1206.         UCHAR   ending_M;
  1207.         UCHAR   ending_S;
  1208.         UCHAR   ending_F;
  1209.         UCHAR   control;
  1210. };
  1211.  
  1212. /************************************************
  1213.  * SCSI Play Audio Track Index  Command (0x48)  *
  1214.  ************************************************/
  1215.  
  1216. struct CDB_PlayAudio_TrackIndex {
  1217.  
  1218.         UCHAR   OpCode;
  1219.  
  1220.         UCHAR   reserved_1   : 5;
  1221.         UCHAR   LUN          : 3;
  1222.  
  1223.         UCHAR   reserved_2;
  1224.         UCHAR   reserved_3;
  1225.         UCHAR   starting_track;
  1226.         UCHAR   starting_index;
  1227.         UCHAR   reserved_4;
  1228.         UCHAR   ending_track;
  1229.         UCHAR   ending_index;
  1230.         UCHAR   control;
  1231. };
  1232.  
  1233. /************************************************
  1234.  * SCSI Play Audio Track Relative (10)  (0x49)  *
  1235.  ************************************************/
  1236.  
  1237. struct CDB_PlayAudio_TrackRel_10 {
  1238.  
  1239.         UCHAR   OpCode;
  1240.  
  1241.         UCHAR   reserved_1   : 5;
  1242.         UCHAR   LUN          : 3;
  1243.  
  1244.         union
  1245.         ULONGB  track_rel_LBA;
  1246.         UCHAR   starting_track;
  1247.         union
  1248.         USHORTB transfer_length;
  1249.         UCHAR   control;
  1250. };
  1251.  
  1252.  
  1253. /************************************************
  1254.  * SCSI Play Audio Track Relative (12)  (0xA9)  *
  1255.  ************************************************/
  1256.  
  1257. struct CDB_PlayAudio_TrackRel_12 {
  1258.  
  1259.         UCHAR   OpCode;
  1260.  
  1261.         UCHAR   reserved_1   : 5;
  1262.         UCHAR   LUN          : 3;
  1263.  
  1264.         union
  1265.         ULONGB  track_rel_LBA;
  1266.         union
  1267.         ULONGB  transfer_length;
  1268.         UCHAR   starting_track;
  1269.         UCHAR   control;
  1270. };
  1271.  
  1272.  
  1273. /************************************************
  1274.  * SCSI Pause Resume Command            (0x4B)  *
  1275.  ************************************************/
  1276.  
  1277. struct CDB_PauseResume {
  1278.  
  1279.         UCHAR   OpCode;
  1280.  
  1281.         UCHAR   reserved_1  : 5;
  1282.         UCHAR   LUN         : 3;
  1283.  
  1284.         UCHAR   reserved_2;
  1285.         UCHAR   reserved_3;
  1286.         UCHAR   reserved_4;
  1287.         UCHAR   reserved_5;
  1288.         UCHAR   reserved_6;
  1289.         UCHAR   reserved_7;
  1290.  
  1291.         UCHAR   resume     : 1;
  1292.         UCHAR   reserved_8 : 7;
  1293.  
  1294.         UCHAR   control;
  1295. };
  1296.  
  1297.  
  1298.  
  1299. /************************************************
  1300.  * ATAPI  Unique Command Packets                *
  1301.  ************************************************/
  1302. #define ATAPI_CDB_LENGTH        0x0C         /* All CDBs are 12 bytes */
  1303. #define ATAPI_STOP_PLAYSCAN     0x4E         /* Stop Play Scan   */
  1304. #define ATAPI_READ_CD           0xBE         /* Read CD          */
  1305. #define ATAPI_READ_CD_MSF       0xB9         /* Read CD MSF      */
  1306. #define ATAPI_AUDIO_SCAN        0xBA         /* Audio Scan       */
  1307. #define ATAPI_SET_CDROM_SPEED   0xBB         /* Set CD-ROM Speed */
  1308.  
  1309. #define ATA_ENABLE_PM_MODE      0xC1         /* Enable Power Management */ // JSM
  1310.  
  1311.  
  1312. /************************************************
  1313.  * ATAPI  Stop Play Scan Command        (0x4E)  *
  1314.  ************************************************/
  1315.  
  1316. struct CDB_StopPlayScan  {
  1317.  
  1318.         UCHAR   OpCode;
  1319.         UCHAR   reserved_1;
  1320.         UCHAR   reserved_2;
  1321.         UCHAR   reserved_3;
  1322.         UCHAR   reserved_4;
  1323.         UCHAR   reserved_5;
  1324.         UCHAR   reserved_6;
  1325.         UCHAR   reserved_7;
  1326.         UCHAR   reserved_8;
  1327.         UCHAR   reserved_9;
  1328.         UCHAR   reserved_10;
  1329.         UCHAR   reserved_11;
  1330. };
  1331.  
  1332. #define ATAPI_MECHANISM_STATUS 0xBD                             /*SD@135221*/
  1333.                                                                 /*SD@135221*/
  1334. struct CDB_MechanismStatus {                                    /*SD@135221*/
  1335.                                                                 /*SD@135221*/
  1336.         UCHAR OpCode;                                           /*SD@135221*/
  1337.         UCHAR Reserved_1;                                       /*SD@135221*/
  1338.         UCHAR Reserved_2;                                       /*SD@135221*/
  1339.         UCHAR Reserved_3;                                       /*SD@135221*/
  1340.         UCHAR Reserved_4;                                       /*SD@135221*/
  1341.         UCHAR Reserved_5;                                       /*SD@135221*/
  1342.         UCHAR Reserved_6;                                       /*SD@135221*/
  1343.         UCHAR Reserved_7;                                       /*SD@135221*/
  1344.         union                                                   /*SD@135221*/
  1345.         USHORTB Allocation_Length;                              /*SD@135221*/
  1346.         UCHAR Reserved_10;                                      /*SD@135221*/
  1347.         UCHAR Reserved_11;                                      /*SD@135221*/
  1348.                                                                 /*SD@135221*/
  1349. };                                                              /*SD@135221*/
  1350.                                                                 /*SD@135221*/
  1351. struct SlotTableEntry {                                         /*SD@135221*/
  1352.         UCHAR DiscPresent :1;                                   /*SD@135221*/
  1353.         UCHAR Reserved_1  :6;                                   /*SD@135221*/
  1354.         UCHAR DiscChanged :1;                                   /*SD@135221*/
  1355.         UCHAR Reserved_2[3];                                    /*SD@135221*/
  1356. };                                                              /*SD@135221*/
  1357.                                                                 /*SD@135221*/
  1358. struct Mechanism_Hdr {                                          /*SD@135221*/
  1359.         UCHAR Fault        :1;                                  /*SD@135221*/
  1360.         UCHAR ChangerState :2;                                  /*SD@135221*/
  1361.         UCHAR CurrentSlot  :5;                                  /*SD@135221*/
  1362.         UCHAR CD_MachanismState :3;                             /*SD@135221*/
  1363.         UCHAR Reserved_1   :5;                                  /*SD@135221*/
  1364.         UCHAR LBA[3];                                           /*SD@135221*/
  1365.         UCHAR Number_Of_Slots;                                  /*SD@135221*/
  1366.         union                                                   /*SD@135221*/
  1367.         USHORTB SlotTableLength;                                /*SD@135221*/
  1368. };                                                              /*SD@135221*/
  1369.                                                                 /*SD@135221*/
  1370. struct MechanismStatusList {                                    /*SD@135221*/
  1371.         struct                                                  /*SD@135221*/
  1372.         Mechanism_Hdr Mechanism_Header;                         /*SD@135221*/
  1373.         struct                                                  /*SD@135221*/
  1374.         SlotTableEntry SlotTableEntry;                          /*SD@135221*/
  1375. };                                                              /*SD@135221*/
  1376.                                                                 /*SD@135221*/
  1377. #define ATAPI_CHANGER_LOAD 0xA6                                 /*SD@135221*/
  1378. #define SANYO_ATAPI_CHANGER_LOAD SCSI_TEST_UNIT_READY           /*SD@135221*/
  1379.                                                                 /*SD@135221*/
  1380. struct CDB_LoadSLot {                                           /*SD@135221*/
  1381.         UCHAR OpCode;                                           /*SD@135221*/
  1382.         UCHAR Immed :1;                                         /*SD@135221*/
  1383.         UCHAR Reserved_1 :7;                                    /*SD@135221*/
  1384.         UCHAR Reserved_2[2];                                    /*SD@135221*/
  1385.         UCHAR Start  :1;                                        /*SD@135221*/
  1386.         UCHAR LoUnLo :1;                                        /*SD@135221*/
  1387.         UCHAR Reserved_3 :6;                                    /*SD@135221*/
  1388.         UCHAR Reserved_4[3];                                    /*SD@135221*/
  1389.         UCHAR NewSlot;                                          /*SD@135221*/
  1390.         UCHAR Reserved_5[3];                                    /*SD@135221*/
  1391. };                                                              /*SD@135221*/
  1392.  
  1393.  
  1394.  
  1395. /************************************************
  1396.  * ATAPI  READ CD Command               (0xD4)  *
  1397.  ************************************************/
  1398.  
  1399. struct CDB_ReadCD {
  1400.  
  1401.         UCHAR   OpCode;
  1402.  
  1403.         UCHAR   reserved_1  : 2;
  1404.         UCHAR   data_type   : 3;
  1405.         UCHAR   reserved_2  : 3;
  1406.  
  1407.         union
  1408.         ULONGB  LBA;
  1409.  
  1410.         UCHAR transfer_length_msb;
  1411.         UCHAR transfer_length;
  1412.         UCHAR transfer_length_lsb;
  1413.  
  1414.         USHORT reserved_3   : 1;
  1415.         USHORT error_flag   : 2;
  1416.         USHORT edc_ecc      : 1;
  1417.         USHORT user_data    : 1;
  1418.         USHORT headers      : 2;
  1419.         USHORT sync         : 1;
  1420.         USHORT subchannel   : 4;
  1421.         USHORT reserved_4   : 4;
  1422.  
  1423.         USHORT reserved_5;
  1424. };
  1425.  
  1426. /************************************************
  1427.  * ATAPI  READ CD MSF Command           (0xD5)  *
  1428.  ************************************************/
  1429.  
  1430. struct CDB_ReadCD_MSF {
  1431.  
  1432.         UCHAR   OpCode;
  1433.  
  1434.         UCHAR   reserved_1  : 2;
  1435.         UCHAR   data_type   : 3;
  1436.         UCHAR   reserved_2  : 3;
  1437.  
  1438.         UCHAR   reserved_3;
  1439.         UCHAR   starting_M;
  1440.         UCHAR   starting_S;
  1441.         UCHAR   starting_F;
  1442.         UCHAR   ending_M;
  1443.         UCHAR   ending_S;
  1444.         UCHAR   ending_F;
  1445.  
  1446.         USHORT reserved_4   : 1;
  1447.         USHORT error_flag   : 2;
  1448.         USHORT edc_ecc      : 1;
  1449.         USHORT user_data    : 1;
  1450.         USHORT headers      : 2;
  1451.         USHORT sync         : 1;
  1452.         USHORT subchannel   : 4;
  1453.         USHORT reserved_5   : 4;
  1454.  
  1455.         USHORT reserved_6;
  1456. };
  1457.  
  1458. /* READ CD Expected User Data Type Defitions- (data_type) */
  1459.  
  1460. #define RCD_TYPE_ANY     0x00    /* Any data type     */
  1461. #define RCD_TYPE_CDDA    0x01    /* CDDA audio sector */
  1462. #define RCD_TYPE_2048    0x02    /* 2048 byte data sector - Mode 1 or Form 1 */
  1463. #define RCD_TYPE_2336    0x03    /* 2336 byte Mode 2 data  */
  1464. #define RCD_TYPE_2328    0x04    /* 2328 byte Mode 2 Form 2 */
  1465.  
  1466. /* READ CD Header Code Definitions (headers) */
  1467.  
  1468. #define RCD_HEADER_NONE       0x00    /* No header data */
  1469. #define RCD_HEADER_HEADER     0x01    /* 4 byte Mode 1 or Form 1 header */
  1470. #define RCD_HEADER_SUBHEADER  0x02    /* 8 byte Mode 2 subheader */
  1471. #define RCD_HEADER_ALL        0x03    /* Both header and subheader */
  1472.  
  1473. /* READ CD Error Flag Definitions (error_flag) */
  1474.  
  1475. #define RCD_ERRFLG_NONE       0x00    /* No error info */
  1476. #define RCD_ERRFLG_C2         0x01    /* C2 Error Flag Pointer bits */
  1477. #define RCD_ERRFLG_C2_BLOCK   0x02    /* C2 Error Flags and Block Error Byte */
  1478.  
  1479. /* READ CD Sub-channel Data Selection Definitions (subchannel) */
  1480.  
  1481. #define RCD_SUB_NONE          0x00    /* No subchannel data */
  1482. #define RCD_SUB_RAW           0x01    /* Raw subchannel data */
  1483. #define RCD_SUB_Q             0x02    /* Q data */
  1484. #define RCD_R_W               0x04    /* R-W subchannel data */
  1485.  
  1486.  
  1487. /************************************************
  1488.  * ATAPI  AUDIO SCAN Command            (0xD8)  *
  1489.  ************************************************/
  1490.  
  1491. struct CDB_AudioScan {
  1492.  
  1493.         UCHAR   OpCode;
  1494.  
  1495.         UCHAR   reserved_1  : 4;
  1496.         UCHAR   direct      : 1;
  1497.         UCHAR   reserved_2  : 3;
  1498.  
  1499.         union
  1500.         AddressType scan_address;
  1501.  
  1502.         UCHAR   reserved_3;
  1503.         UCHAR   reserved_4;
  1504.         UCHAR   reserved_5;
  1505.  
  1506.         UCHAR   reserved_6  : 6;
  1507.         UCHAR   type        : 2;
  1508.  
  1509.         UCHAR   reserved_7;
  1510.         UCHAR   reserved_8;
  1511. };
  1512.  
  1513. /************************************************
  1514.  * ATAPI  Set CD-ROM Speed Command      (0xDA)  *
  1515.  ************************************************/
  1516.  
  1517. struct CDB_SetSpeed  {
  1518.  
  1519.         UCHAR   OpCode;
  1520.  
  1521.         UCHAR   reserved_1;
  1522.  
  1523.         union
  1524.         USHORTB drive_speed;
  1525.  
  1526.         UCHAR   reserved_2;
  1527.         UCHAR   reserved_3;
  1528.         UCHAR   reserved_4;
  1529.         UCHAR   reserved_5;
  1530.         UCHAR   reserved_6;
  1531.         UCHAR   reserved_7;
  1532.         UCHAR   reserved_8;
  1533.         UCHAR   reserved_9;
  1534. };
  1535.  
  1536. /************************************************
  1537.  * ATA  Enable Power Managementd        (0xC1)  *
  1538.  ************************************************/
  1539.  
  1540. struct CDB_EnablePMMode  {
  1541.  
  1542.         UCHAR   OpCode;
  1543.         UCHAR   reserved_1;
  1544.         UCHAR   reserved_2;
  1545.         UCHAR   reserved_3;
  1546.         UCHAR   reserved_4;
  1547.         UCHAR   reserved_5;
  1548.         UCHAR   reserved_6;
  1549.         UCHAR   reserved_7;
  1550.         UCHAR   reserved_8;
  1551.         UCHAR   reserved_9;
  1552.         UCHAR   reserved_10;
  1553.         UCHAR   reserved_11;
  1554. };
  1555.  
  1556.  
  1557. /************************************************
  1558.  *  Adapter Device Driver Vendor unique command *
  1559.  *                                              *
  1560.  *  Read Disk Information               (0xF0)  *
  1561.  ************************************************/
  1562. #define ADD_READ_DISK_INFO  0xF0
  1563.  
  1564.  
  1565. struct ADD_CDB_ReadDiskInfo {
  1566.  
  1567.         UCHAR   OpCode;
  1568.  
  1569.         UCHAR   type         : 2;
  1570.         UCHAR   reserved_1   : 3;
  1571.         UCHAR   LUN          : 3;
  1572.  
  1573.  
  1574.         UCHAR   reserved_2;
  1575.         UCHAR   reserved_3;
  1576.         UCHAR   reserved_4;
  1577.         UCHAR   reserved_5;
  1578.         UCHAR   reserved_6;
  1579.         UCHAR   reserved_7;
  1580.         UCHAR   reserved_8;
  1581.  
  1582.         UCHAR   control;
  1583. };
  1584.  
  1585. #define TYPE_CAPABILITIES_INFO 0x00
  1586. #define TYPE_LASTSESSION_INFO  0x01
  1587.  
  1588.  
  1589. struct RDI_Capabilities {
  1590.         UCHAR   read_capabilities;
  1591.         UCHAR   reserved_1;
  1592.         union
  1593.         USHORTB max_block_length;
  1594. };
  1595.  
  1596. /*
  1597. ** read_capabilities bit flag definitions
  1598. */
  1599. #define CAP_MULTISESSION   0x01
  1600. #define CAP_MODE2_FORM1    0x02
  1601. #define CAP_MODE2_FORM2    0x04
  1602. #define CAP_CDDA           0x08
  1603.  
  1604.  
  1605. struct RDI_LastSession {
  1606.         UCHAR   reserved;
  1607.         UCHAR   amin;
  1608.         UCHAR   asec;
  1609.         UCHAR   aframe;
  1610. };
  1611.  
  1612. union ADD_ReadDiskInfo_Data
  1613. {
  1614.         struct RDI_Capabilities   capabilities;
  1615.         struct RDI_LastSession    last_session;
  1616. };
  1617.  
  1618.  
  1619.  
  1620. /***********************************************************************
  1621.  * ADAPTER PASS THROUGH IORB           (for IOCC_ADAPTER_PASSTHRU)     *
  1622.  ***********************************************************************/
  1623. #define FILTER_WORKSPACE_SIZE   24
  1624.  
  1625. typedef struct _IORB_CDB           {  /* IOCDB */
  1626.  
  1627.   IORB_ADAPTER_PASSTHRU  apt;
  1628.   SCSI_STATUS_BLOCK      status_block;
  1629.   UCHAR                  pad;
  1630.   struct Sense_Data      sense_data;
  1631.   struct SCSI_command    CDB;
  1632.   UCHAR                  CDB_data[64];
  1633.   UCHAR                  filter_workspace[FILTER_WORKSPACE_SIZE];
  1634.  
  1635. } IORB_CDB, FAR *PIORB_CDB, *NPIORB_CDB;
  1636.  
  1637.  
  1638.  
  1639.  
  1640.