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 / cdgencb.h < prev    next >
C/C++ Source or Header  |  1996-06-18  |  12KB  |  327 lines

  1.  
  2. /**************************************************************************
  3.  *
  4.  * SOURCE FILE NAME = CDGENCB.H
  5.  *
  6.  * DESCRIPTIVE NAME = Internal control blocks for 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.  *  05/27/96  @V156096           Sam Detweiler - HP update
  42.  ****************************************************************************/
  43.  
  44. struct vendor_id_entry {
  45.         UCHAR   *vendor_id_string;
  46.         USHORT  vendor_id_code;
  47. };
  48.  
  49. struct product_id_entry {
  50.         UCHAR   *product_id_string;
  51.         USHORT  product_id_code;
  52. };
  53.  
  54. struct drive_caps_entry {
  55.         USHORT  product_id_code;
  56.         USHORT  capabilities;
  57. };
  58.  
  59. /*
  60. ** vendor_id_code definitions
  61. */
  62. #define TOSHIBA         0x01
  63. #define SONY            0x02
  64. #define HITACHI         0x03
  65. #define NEC             0x04
  66. #define TEXEL           0x05
  67. #define MATSHITA        0x06                    /* PANASONIC            */
  68. #define CHINON          0x07
  69. #define PIONEER         0x08
  70. #define IBM             0x09
  71. #define LMS             0x0A
  72. #define TORISAN         0x0B    /* SD@135221 */
  73. #define TEAC            0x0C    // JSM
  74.  
  75. /*
  76. ** product_id_code definitions
  77. */
  78. #define TOSHIBA_3201    0x01
  79. #define TOSHIBA_3301    0x02
  80. #define TOSHIBA_3401    0x03
  81. #define SONY_541        0x11    /* Sony 541, 7211                       */
  82. #define SONY_561        0x12
  83. #define HITACHI_3750    0x21    /* Hitachi 3750                         */
  84. #define HITACHI_6750    0x22    /* Hitachi 6750                         */
  85. #define NEC_84_1        0x31    /* NEC 84-1                             */
  86. #define NEC_260_17B     0x32    /* NEC 260 drive not ATAPI 1.2          */
  87. #define NEC_251_250     0x33    /* NEC 260 drive not ATAPI 2.5 135221   */
  88. #define TEXEL_3024      0x41    /* Texel 3024, 5024                     */
  89. #define TEXEL_3024K     0x42    /* Texel 3024, 5024 with Kodak Photo CD */
  90. #define PANASONIC_501   0x51    /* Panasonic 501                        */
  91. #define PANASONIC_57x   0x52    /* Panasonic 574                        *//*@V156096*/
  92. #define PANASONIC_58x   0x53    /* Panasonic 581                        *//*@V156096*/
  93. #define CHINON_535      0x61    /* Chinon 535                           */
  94. #define PIONEER_604X    0x71    /* Pioneer 604X                         */
  95. #define LMS_215         0x91    /* LMS 215                              */
  96. #define TORISAN_C3G     0xB1    /* Sanyo 3cd Atapi changer preATAPI spec*//* SD@135221 */
  97. #define TEAC_CD40E      0xC1    /* Thinkpad TEAC CD40E */ //JSM
  98. #define HP_C4324        0xC1    /* Hewlett-Packard C4324 CD-Writer      *//*@V156096*/
  99.  
  100.  
  101. struct  Channel {                               /* audio channel info   */
  102.         UCHAR   input_0;
  103.         UCHAR   volume_0;
  104.         UCHAR   input_1;
  105.         UCHAR   volume_1;
  106.         UCHAR   input_2;
  107.         UCHAR   volume_2;
  108.         UCHAR   input_3;
  109.         UCHAR   volume_3;
  110. };
  111.  
  112. struct Status {                                 /* audio status info    */
  113.         USHORT          paused          : 1;
  114.         USHORT          bits1           : 15;
  115.         struct
  116.         RedBookAddress  last_start_location;
  117.         struct
  118.         RedBookAddress  last_end_location;
  119. };
  120.  
  121. struct Audio {                                  /* all audio info       */
  122.         struct
  123.         Status  status;
  124.         struct
  125.         Channel channel;
  126.         ULONG   capabilities;                   /*SD@135221*/
  127. };
  128.  
  129. struct Slots {                                  /*SD@135221*/
  130.        UCHAR LoadInProgress;                    /*SD@135221*/
  131.        UCHAR Maximum;                           /*SD@135221*/
  132.        UCHAR Current;                           /*SD@135221*/
  133. };                                              /*SD@135221*/
  134.  
  135. /* Drive capabilities bit definitions */
  136.  
  137. #define DCAPS_DOOR_LOCKED                0x00000001L            /*SD@135221*/
  138. #define DCAPS_UNCERTAIN_MEDIA            0x00000002L            /*SD@135221*/
  139. #define DCAPS_VARIABLE_VOLUME            0x00000004L            /*SD@135221*/
  140. #define DCAPS_MUTE                       0x00000008L            /*SD@135221*/
  141. #define DCAPS_INDEPENDENT_VOLUME_LEVELS  0x00000010L            /*SD@135221*/
  142. #define DCAPS_NO_AUDIO_CTRL_DURING_PLAY  0x00000020L            /*SD@135221*/
  143. #define DCAPS_NO_CHANNEL_SWAP            0x00000040L            /*SD@135221*/
  144. #define DCAPS_XA                         0x00000080L            /*SD@135221*/
  145. #define DCAPS_CDDA                       0x00000100L            /*SD@135221*/
  146. #define DCAPS_NO_ADR_RETURNED            0x00000200L            /*SD@135221*/
  147. #define DCAPS_UPC                        0x00000400L            /*SD@135221*/
  148. #define DCAPS_UPC_IN_BCD                 0x00000800L            /*SD@135221*/
  149. #define DCAPS_UPC_IN_ASCII               0x00001000L            /*SD@135221*/
  150. #define DCAPS_MODE_WITH_ERR_RECOV        0x00002000L            /*SD@135221*/
  151. #define DCAPS_MULTISESSION               0x00004000L            /*SD@135221*/
  152. #define DCAPS_MULTISESSION_MOUNTED       0x00008000L            /*SD@135221*/
  153. #define DCAPS_INDIVIDUAL_CHANGER         0x00010000L            /*SD@135221*/
  154. #define DCAPS_CARTRIDGE_CHANGER          0x00020000L            /*SD@135221*/
  155. #define DCAPS_SINGLE_MODE                0x00040000L            /*SD@135221*/
  156.                                                                 /*SD@135221*/
  157. /*
  158.         ULONG   door_locked                : 1,
  159.                 uncertain_media            : 1,
  160.                 variable_volume            : 1,
  161.                 mute_support               : 1,
  162.                 independent_volume_levels  : 1,
  163.                 no_audio_ctrl_during_play  : 1,
  164.                 no_channel_swap            : 1,
  165.                 xa_support                 : 1,
  166.                 cdda_support               : 1,
  167.                 no_adr_returned            : 1,
  168.                 upc_supported              : 1,
  169.                 upc_in_bcd                 : 1,
  170.                 upc_in_ascii               : 1,
  171.                 mode_with_err_recov        : 1,
  172.                 multi_session_support      : 1,
  173.                 multi_session_mounted      : 1;
  174.                 individual_changer         : 1;
  175.                 cartridge_changer          : 1;
  176. };
  177. */
  178.  
  179. struct DeviceInfo {
  180.         USHORT vendor_id_code;
  181.         USHORT product_id_code;
  182.         USHORT interface_type;
  183.         USHORT current_block_size;
  184.         USHORT raw_block_size;
  185.         USHORT current_density;
  186.         USHORT disk_density;
  187.         USHORT current_disk_type;
  188.         ULONG  last_session_addr;
  189.         ULONG  volume_descr_terminator;
  190.         USHORT last_cmd;
  191.         USHORT playing;
  192.         USHORT Parentplaying;                                   /*SD@135221*/
  193.         struct
  194.         Audio  Audio;
  195.         union
  196.         AddressType leadout;
  197.         struct                                                  /*SD@135221*/
  198.         Slots Slots;                                            /*SD@135221*/
  199.         USHORT Slot;                                            /*SD@135221*/
  200. };
  201.  
  202. #define DISK_TYPE_CDROM 0
  203. #define DISK_TYPE_CDXA  1
  204. #define DISK_TYPE_CDDA  2
  205.  
  206. /* interface_type definitions */
  207. #define  INTERFACE_SCSI         0x01
  208. #define  INTERFACE_ATAPI        0x02
  209. #define  INTERFACE_PROPRIETARY  0x03
  210.  
  211.  
  212.  
  213. struct  BlockParameters {
  214.         union
  215.         USHORTB   block_size;
  216.         USHORT    density_code;
  217. };
  218.  
  219.  
  220. /*
  221. **
  222. ** Unit Control Block
  223. ** ------------------
  224. **
  225. ** This control blocks relates hardware devices to the Adapter
  226. ** Dependent Driver which manages them.
  227. **
  228. */
  229.  
  230. typedef struct _PRTYQ
  231. {
  232.   NPIORB    Head;
  233.   NPIORB    Tail;
  234. } PRTYQ;
  235.  
  236. #define  NUM_RLE_QUEUES        9
  237. #define  NUM_RP_QUEUES         2
  238.  
  239. typedef struct _UnitControlBlock
  240. {
  241.   NPUNITCB    pNextUnitCB;                /* Pointer to Next UnitCB       */
  242.   NPUNITCB    pParentUnitCB;              /* Pointer to parent Unit for Atapi Changers  *//*SD@135221*/
  243.   USHORT      Flags;                      /* UnitCB Flags                 */
  244.   USHORT      LogDriveNum;                /* Logical  Drive Number        */
  245.   USHORT      PhysDriveNum;               /* Physical Drive Number        */
  246.   UNITINFO    UnitInfo;                   /* Additional Driver Info       */
  247.   struct
  248.   DeviceInfo  DeviceInfo;                 /* Device Information Block     */
  249.   struct
  250.   Inquiry_Data InquiryData;               /* Device Inquiry Data          */
  251.   UCHAR       Pad;                        /* Word align                   */
  252.   USHORT      ADDHandle;                  /* ADD handle                   */
  253.   USHORT      AdapterNumber;              /* Logical Adapter Number       */
  254.   ULONG       TotalSectors;               /* Total Sectors for this drive */
  255.   ULONG       Reserved;                   /* Read capacity Block Length   */
  256.   USHORT      MaxHWSGList;                /* Max HW scatter/gather list   */
  257.   NPIORBH     pDedicatedIORB;             /* Dedicated IORB for this unit */
  258.   VOID (FAR * AdapterDriverEP)();         /* ADD Entry Point              */
  259.   USHORT      NumReqsInProgress;          /* # of requests in progress    */
  260.   USHORT      NumReqsWaiting;             /* Number of requests waiting   */
  261.   NPIORBH     InProgressQueue;            /* Queue of in progress requests*/
  262.   PRTYQ       WaitingQueue;               /* Priority Queues              */
  263.   ULONG       Semaphore;                  /* semaphore for ATAPI changers *//*SD@135221*/
  264.  
  265. } UNITCB;
  266.  
  267. /* Flag definitions for Flags field in UNITCB */
  268. #define UCF_IORB_ALLOCATED  0x0001        /* Dedicated IORB allocated       */
  269. #define UCF_HW_SCATGAT      0x0002        /* Unit supports ScatGat in HW    */
  270. #define UCF_16M             0x0004        /* Unit supports > 16M addressing */
  271. #define UCF_CHS_ADDRESSING  0x0008        /* Unit supports CHS Addressing   */
  272. #define UCF_REMOVABLE_NON_FLOPPY  0x0010  /* Removable, non floppy          */
  273. #define UCF_UNCERTAIN_MEDIA 0x0020        /* Uncertain media                */
  274. #define UCF_AUDIO_SUPPORTED 0x0040        /* Audio command set supported    */
  275.  
  276.  
  277. /*
  278. ** IORB DMWorkSpace Structure
  279. */
  280.  
  281. typedef struct _IORB_DMWORK
  282. {
  283.    NPUNITCB      pUnitCB;
  284.    USHORT        Reserved_1;
  285.    PBYTE         pRequest;
  286.    SCATGATENTRY  SGList;
  287.    NPIORB        WaitingQueueLink;
  288.    NPIORB        pCoReqIORB;
  289.  
  290. } IORB_DMWORK, FAR *PIORB_DMWORK, NEAR *NPIORB_DMWORK;
  291.  
  292.  
  293.  
  294. typedef struct _DRIVERENTRY
  295. {
  296.    UCHAR        DriverName[17];
  297.    PFN          AdapterDriverEP;
  298. } DRIVERENTRY;
  299.  
  300.  
  301. typedef struct _DRIVERTABLE
  302. {
  303.    USHORT       NumDrivers;
  304.    DRIVERENTRY  DriverEntry[MAX_DRIVERS];
  305. } DRIVERTABLE;
  306.  
  307.  
  308. /*
  309. ** Init data allocated at the end of the data segment has the
  310. ** following structure:
  311. */
  312.  
  313. #define MAX_DEVICE_TABLE_SIZE 1024
  314. /*
  315. **      (sizeof(DEVICETABLE) + ((MAX_ADAPTERS_PER_ADD - 1) * 2) +
  316. **      ((sizeof(ADAPTERINFO) - sizeof(UNITINFO)) * MAX_ADAPTERS_PER_ADD) +
  317. **      sizeof(UNITINFO) * MAX_UNITS_PER_ADD)
  318. */
  319. typedef struct _INITDATA
  320. {
  321.    UCHAR           ScratchBuffer2[MAX_DEVICE_TABLE_SIZE];  /* Scratch buffer  */
  322.    UCHAR           ScratchIORB[MAX_IORB_SIZE]; /* IORB used during init       */
  323.    RP_RWV          InitPkt;                    /* RP used during init         */
  324. } INITDATA;
  325.  
  326.  
  327.