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

  1. /**************************************************************************
  2.  *
  3.  * SOURCE FILE NAME = CDIOCTL.H
  4.  *
  5.  * DESCRIPTIVE NAME = Internal data structures for IOCTL handling in
  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.  *
  41.  ****************************************************************************/
  42.  
  43. /*----------------------------------------*
  44.  * Category 0x80 CD-ROM IOCTL Definitions *
  45.  *----------------------------------------*/
  46. #define IOC_CDROM            0x80         /* CD-ROM Category Code           */
  47.  
  48. #define IOCD_RESET           0x40         /* Reset Drive                    */
  49. #define IOCD_EJECT           0x44         /* Eject Disk                     */
  50. #define IOCD_CLOSE_TRAY      0x45         /* Close Tray                     */
  51. #define IOCD_LOCK_UNLOCK     0x46         /* Lock/Unlock Drive Door         */
  52. #define IOCD_SET_ACTIVE_TRAY 0x47         /* set specific tray active       */
  53. #define IOCD_WRITE_CTRL      0x4F         /* Write Drive Control String     */
  54. #define IOCD_SEEK            0x50         /* Seek                           */
  55. #define IOCD_WRITE_LONG      0x52         /* Write Long                     */
  56. #define IOCD_WRITEV_LONG     0x53         /* Write Long Verify              */
  57. #define IOCD_DEVICE_STATUS   0x60         /* Device Status                  */
  58. #define IOCD_IDENTIFY        0x61         /* Identify CD-ROM Driver         */
  59. #define IOCD_SECTOR_SIZE     0x63         /* Return sector size             */
  60. #define IOCD_TRAY_STATUS     0x67         /* Return tray status on changers */
  61. #define IOCD_READ_CTRL       0x6F         /* Read Drive Control String      */
  62. #define IOCD_HEAD_LOCATION   0x70         /* Ret Current Head Location      */
  63. #define IOCD_READ_PREFETCH   0x71         /* Read Prefetch                  */
  64. #define IOCD_READ_LONG       0x72         /* Read Long                      */
  65. #define IOCD_READ_LONG_PRE   0x73         /* Read Long Prefetch             */
  66. #define IOCD_VOLUME_SIZE     0x78         /* Return Volume Size             */
  67. #define IOCD_UPC             0x79         /* Return UPC/EAN code            */
  68.  
  69. /*----------------------------------------------*
  70.  * Category 0x81 CD-ROM AUDIO IOCTL Definitions *
  71.  *----------------------------------------------*/
  72. #define IOC_CDROM_AUDIO      0x81         /* CD-ROM Audio Category Code     */
  73.  
  74. #define IOCD_CHANNEL_CTRL    0x40         /* Audio Channel Control          */
  75. #define IOCD_PLAY            0x50         /* Play Audio                     */
  76. #define IOCD_STOP            0x51         /* Stop Audio                     */
  77. #define IOCD_RESUME          0x52         /* Resume Audio                   */
  78. #define IOCD_CHANNEL_INFO    0x60         /* Return Audio Info              */
  79. #define IOCD_DISK_INFO       0x61         /* Return Disk Info               */
  80. #define IOCD_TRACK_INFO      0x62         /* Return Track Info              */
  81. #define IOCD_QCHANNEL_INFO   0x63         /* Return Q-channel Info          */
  82. #define IOCD_SUBCHANNEL_INFO 0x64         /* Return Sub-channel info        */
  83. #define IOCD_STATUS_INFO     0x65         /* Audio Status Info              */
  84.  
  85.  
  86. /*----------------------------------------------*
  87.  * Category 0x82 CD-ROM DRIVE LETTER IOCTL      *
  88.  *----------------------------------------------*/
  89. #define IOC_CDROM_2                 0x82  /* CD-ROM 2 Category Code         */
  90. #define IOCD_RETURN_DRIVE_LETTER    0x60  /* Return drive letter info       */
  91.  
  92. /*------------------------------------*
  93.  * Misc constants                     *
  94.  *------------------------------------*/
  95. #define CD01                        0x31304443L
  96. #define CD                          0x4443
  97. #define OK                          0
  98.  
  99. #define NO_TABLE_ENTRY              0
  100. #define MINIMUM_TABLE_ENTRY         FUNCTION_CODE_BASE
  101. #define MAXIMUM_TABLE_ENTRY         0x7F
  102. #define MAX_81H_TABLE_ENTRY         0x6F
  103.  
  104. /*
  105. ** VMLOCK flag equates
  106. */
  107. #define VMDHL_NOBLOCK           0x0001
  108. #define VMDHL_CONTIGUOUS        0x0002
  109. #define VMDHL_16M               0x0004
  110. #define VMDHL_WRITE             0x0008
  111. #define VMDHL_LONG              0x0010
  112. #define VMDHL_VERIFY            0x0020
  113.  
  114. #define DP_DEVICEATTR_NON_REMOVABLE     0x0001
  115. #define DP_DEVICEATTR_CHANGELINE        0x0002
  116. #define DP_DEVICEATTR_GT16MBSUPPORT     0x0004
  117. /*------------------------------------------------*
  118.  * Cat 0x80, Func 0x40:  Reset Drive              *
  119.  *------------------------------------------------*/
  120. struct ResetDrive {
  121.         ULONG       ID_code;
  122. };
  123.  
  124. /*------------------------------------------------*
  125.  * Cat 0x80, Func 0x44:  Eject Disk               *
  126.  *------------------------------------------------*/
  127. struct EjectDisk {
  128.         ULONG       ID_code;
  129. };
  130.  
  131. /*------------------------------------------------*
  132.  * Cat 0x80, Func 0x45:  Close Tray               *
  133.  *------------------------------------------------*/
  134. struct CloseTray {
  135.         ULONG       ID_code;
  136. };
  137.  
  138. /*------------------------------------------------*
  139.  * Cat 0x80, Func 0x46:  Lock/Unlock Door         *
  140.  *------------------------------------------------*/
  141. struct LockUnlock {
  142.         ULONG       ID_code;
  143.         UCHAR       lock_flag;
  144. };
  145.  
  146. /*------------------------------------------------*
  147.  * Cat 0x80, Func 0x47:  Set Active Tray          *
  148.  *------------------------------------------------*/
  149. struct SetTray_Parm    {
  150.         UCHAR       Newtray;
  151. };
  152.  
  153. /*------------------------------------------------*
  154.  * Cat 0x80, Func 0x50:  Seek                     *
  155.  *------------------------------------------------*/
  156. struct Seek  {
  157.         ULONG       ID_code;
  158.         UCHAR       address_mode;
  159.         ULONG       start_sector;
  160. };
  161.  
  162. /*------------------------------------------------------------*
  163.  * Cat 0x80, Func 0x52/0x53:  Write Long & Write Long Verify  *
  164.  *------------------------------------------------------------*/
  165. struct WriteLong {
  166.         ULONG       ID_code;
  167.         UCHAR       address_mode;
  168.         USHORT      transfer_count;
  169.         ULONG       start_sector;
  170.         UCHAR       reserved;
  171.         UCHAR       interleave_size;
  172.         UCHAR       interleave_skip_factor;
  173. };
  174.  
  175. /*------------------------------------------------*
  176.  * Cat 0x80, Func 0x60:  Device Status            *
  177.  *------------------------------------------------*/
  178. struct DeviceStatus {
  179.         ULONG       ID_code;
  180. };
  181.  
  182. struct DeviceStatus_Data {
  183.         ULONG   device_status;
  184. };
  185.  
  186. /*
  187. ** device_status flags
  188. */
  189. #define DSF_DOOR_OPEN           0x00000001L
  190. #define DSF_DOOR_UNLOCKED       0x00000002L
  191. #define DSF_LONG_SECTORS        0x00000004L /*MSCDEX:Supports raw sector reads*/
  192. #define DSF_READ_WRITE          0x00000008L
  193. #define DSF_PLAY_AUDIO          0x00000010L
  194. #define DSF_INTERLEAVING        0x00000020L
  195. #define DSF_RESERVED1           0x00000040L
  196. #define DSF_PREFETCHING         0x00000080L
  197. #define DSF_AUDIO_CHANNEL       0x00000100L
  198. #define DSF_RED_BOOK            0x00000200L
  199. #define DSF_XA_SUPPORT          0x00000400L /* Can read CD-ROM XA sectors     */
  200. #define DSF_NO_DISK_PRESENT     0x00000800L
  201. #define DSF_PLAYING             0x00001000L /*MSCDEX:Supports R/W sub-channels*/
  202. #define DSF_CARTRIDGE_CHANGER   0x00002000L /*for ATAPI Changer device        */
  203. #define DSF_INDIVIDUAL_CHANGER  0x00004000L /*for ATAPI Changer device        */
  204. #define DSF_SINGLE_MODE         0x00008000L /*for ATAPI Changer device        */
  205. #define DSF_CDDA_SUPPORT        0x40000000L /*Can read 2352 byte CD-DA sectors*/
  206. #define DSF_RIIP                0x80000000L /*Read interleave in progress     */
  207.  
  208. #define DSF_DEFAULT             0x0312L
  209.  
  210. /*------------------------------------------------*
  211.  * Cat 0x80, Func 0x61:  Identify CD-ROM Driver   *
  212.  *------------------------------------------------*/
  213. struct IdentifyCDROMdriver {
  214.         ULONG       ID_code;
  215. };
  216.  
  217. struct IdentifyCDROMdriver_Data {
  218.         ULONG       ID_code;
  219. };
  220.  
  221. /*------------------------------------------------*
  222.  * Cat 0x80, Func 0x63:  Return Sector Size       *
  223.  *------------------------------------------------*/
  224. struct ReturnSectorSize {
  225.         ULONG       ID_code;
  226. };
  227.  
  228. struct ReturnSectorSize_Data {
  229.         USHORT      sector_size;
  230. };
  231.  
  232. /*--------------------------------------------------*
  233.  * Cat 0x80, Func 0x67:  Return Changer Tray status *
  234.  *--------------------------------------------------*/
  235. struct ReturnTrayStatus_Data {
  236.         UCHAR       Count;
  237.         UCHAR       Current;
  238.         UCHAR       AssignedSLot;
  239. };
  240.  
  241. /*------------------------------------------------*
  242.  * Cat 0x80, Func 0x70:  Location of Head         *
  243.  *------------------------------------------------*/
  244. struct LocationOfHead {
  245.         ULONG       ID_code;
  246.         UCHAR       address_mode;
  247. };
  248.  
  249. struct LocationOfHead_Data {
  250.         ULONG   location_of_head;
  251. };
  252.  
  253. /*------------------------------------------------*
  254.  * Cat 0x80, Func 0x71: Read Prefetch             *
  255.  *------------------------------------------------*/
  256. struct ReadPrefetch {
  257.         ULONG       ID_code;
  258.         UCHAR       address_mode;
  259.         USHORT      transfer_count;
  260.         ULONG       start_sector;
  261.         UCHAR       reserved;
  262.         UCHAR       interleave_size;
  263.         UCHAR       interleave_skip_factor;
  264. };
  265.  
  266. /*------------------------------------------------*
  267.  * Cat 0x80, Func 0x72: Read Long                 *
  268.  *------------------------------------------------*/
  269. struct ReadLong {
  270.         ULONG       ID_code;
  271.         UCHAR       address_mode;
  272.         USHORT      transfer_count;
  273.         ULONG       start_sector;
  274.         UCHAR       reserved;
  275.         UCHAR       interleave_size;
  276.         UCHAR       interleave_skip_factor;
  277. };
  278.  
  279. /*------------------------------------------------*
  280.  * Cat 0x80, Func 0x73: Read Long Prefetch        *
  281.  *------------------------------------------------*/
  282. struct ReadLongPrefetch {
  283.         ULONG       ID_code;
  284.         UCHAR       address_mode;
  285.         USHORT      transfer_count;
  286.         ULONG       start_sector;
  287.         UCHAR       reserved;
  288.         UCHAR       interleave_size;
  289.         UCHAR       interleave_skip_factor;
  290. };
  291.  
  292. /*------------------------------------------------*
  293.  * Cat 0x80, Func 0x78: Return Volume Size        *
  294.  *------------------------------------------------*/
  295.  
  296. struct ReturnVolumeSize {
  297.         ULONG       ID_code;
  298. };
  299.  
  300. struct ReturnVolumeSize_Data {
  301.         ULONG       volume_size;
  302. };
  303.  
  304. /*------------------------------------------------*
  305.  * Cat 0x80, Func 0x79: Return UPC/EAN Code       *
  306.  *------------------------------------------------*/
  307. struct UPCCode {
  308.         ULONG       ID_code;
  309. };
  310.  
  311. struct UPCCodeBytes  {
  312.         UCHAR       upc_byte0;
  313.         UCHAR       upc_byte1;
  314.         UCHAR       upc_byte2;
  315.         UCHAR       upc_byte3;
  316.         UCHAR       upc_byte4;
  317.         UCHAR       upc_byte5;
  318.         UCHAR       upc_byte6;
  319. };
  320.  
  321. struct UPCCode_Data {
  322.         UCHAR        adr_control;
  323.         struct
  324.         UPCCodeBytes upc_ean_code;
  325.         UCHAR        zero;
  326.         UCHAR        aframe;
  327. };
  328.  
  329. /*------------------------------------------------*
  330.  * Cat 0x81, Func 0x40:  Audio Channel Control    *
  331.  *------------------------------------------------*/
  332. struct AudioChannelControl {
  333.         ULONG       ID_code;
  334.  
  335. };
  336.  
  337. struct AudioChannelControl_Data {
  338.         UCHAR       input_0;
  339.         UCHAR       volume_0;
  340.         UCHAR       input_1;
  341.         UCHAR       volume_1;
  342.         UCHAR       input_2;
  343.         UCHAR       volume_2;
  344.         UCHAR       input_3;
  345.         UCHAR       volume_3;
  346. };
  347.  
  348. /*------------------------------------------------*
  349.  * Cat 0x81, Func 0x50:  Play Audio               *
  350.  *------------------------------------------------*/
  351. struct PlayAudio {
  352.         ULONG       ID_code;
  353.         UCHAR       address_mode;
  354.         ULONG       start_sector;
  355.         ULONG       end_sector;
  356. };
  357.  
  358. /*------------------------------------------------*
  359.  * Cat 0x81, Func 0x51:  Stop Audio               *
  360.  *------------------------------------------------*/
  361. struct StopAudio {
  362.         ULONG       ID_code;
  363. };
  364.  
  365. /*------------------------------------------------*
  366.  * Cat 0x81, Func 0x52:  Resume Audio             *
  367.  *------------------------------------------------*/
  368. struct ResumeAudio {
  369.         ULONG       ID_code;
  370. };
  371.  
  372. /*------------------------------------------------*
  373.  * Cat 0x81, Func 0x60:  Audio Channel Info       *
  374.  *------------------------------------------------*/
  375. struct AudioChannelInfo {
  376.         ULONG       ID_code;
  377. };
  378.  
  379. struct AudioChannelInfo_Data {
  380.         UCHAR       input_0;
  381.         UCHAR       volume_0;
  382.         UCHAR       input_1;
  383.         UCHAR       volume_1;
  384.         UCHAR       input_2;
  385.         UCHAR       volume_2;
  386.         UCHAR       input_3;
  387.         UCHAR       volume_3;
  388. };
  389.  
  390. /*------------------------------------------------*
  391.  * Cat 0x81, Func 0x61:  Audio Disk Info          *
  392.  *------------------------------------------------*/
  393. struct AudioDiskInfo {
  394.         ULONG       ID_code;
  395. };
  396.  
  397. struct AudioDiskInfo_Data {
  398.         UCHAR       lowest_track;
  399.         UCHAR       highest_track;
  400.         UCHAR       frame;                      /* leadout track start  */
  401.         UCHAR       sec;
  402.         UCHAR       min;
  403.         UCHAR       zero;
  404. };
  405.  
  406. /*------------------------------------------------*
  407.  * Cat 0x81, Func 0x62:  Audio Track Info         *
  408.  *------------------------------------------------*/
  409. struct AudioTrackInfo {
  410.         ULONG       ID_code;
  411.         UCHAR       track_number;
  412. };
  413.  
  414. struct AudioTrackInfo_Data {
  415.         UCHAR       frame;                      /* track start          */
  416.         UCHAR       sec;
  417.         UCHAR       min;
  418.         UCHAR       zero;
  419.         UCHAR       control;
  420. };
  421.  
  422. /*------------------------------------------------*
  423.  * Cat 0x81, Func 0x63:  Audio Q-Channel Info     *
  424.  *------------------------------------------------*/
  425. struct AudioQChannelInfo {
  426.         ULONG       ID_code;
  427. };
  428.  
  429. struct AudioQChannelInfo_Data {
  430.         UCHAR       control;
  431.         UCHAR       tno;
  432.         UCHAR       point;
  433.                                            /* running time on the track */
  434.         UCHAR       min;
  435.         UCHAR       sec;
  436.         UCHAR       frame;
  437.         UCHAR       zero;
  438.                                            /*  running time on the disk */
  439.         UCHAR       amin;
  440.         UCHAR       asec;
  441.         UCHAR       aframe;
  442. };
  443.  
  444. /*------------------------------------------------*
  445.  * Cat 0x81, Func 0x64:  Audio Sub-Channel Info   *
  446.  *------------------------------------------------*/
  447. struct AudioSubChannelInfo {
  448.         ULONG       ID_code;
  449.         ULONG       start_frame;
  450.         ULONG       frame_count;
  451. };
  452.  
  453. struct AudioSubChannelInfo_Data {
  454.         UCHAR       subchannel_info[96];
  455. };
  456.  
  457. /*------------------------------------------------*
  458.  * Cat 0x81, Func 0x65:  Audio Status Info        *
  459.  *------------------------------------------------*/
  460. struct AudioStatusInfo {
  461.         ULONG       ID_code;
  462. };
  463.  
  464. struct AudioStatusInfo_Data {
  465.         USHORT      audio_status;
  466.         ULONG       last_start_location;
  467.         ULONG       last_end_location;
  468. };
  469.  
  470. /*------------------------------------------------*
  471.  * Cat 0x82, Func 0x60:  Return Drive Letter Info *
  472.  *------------------------------------------------*/
  473.  
  474. struct DriveLetter_Data {
  475.         USHORT      drive_count;
  476.         USHORT      first_drive_number;
  477. };
  478.  
  479.  
  480. typedef struct _LOCKSTRUC FAR *PLOCKSTRUC;
  481.  
  482. /*------------------------------------------------*
  483.  * Function declarations and pragma statements    *
  484.  *------------------------------------------------*/
  485. USHORT NEAR CD_GetDeviceParms8(PRP_GENIOCTL, NPUNITCB);
  486. USHORT NEAR CD_GetDeviceParms9(PRP_GENIOCTL, NPUNITCB);
  487. USHORT NEAR CD_RemovableMediaControl(PRP_GENIOCTL, NPUNITCB);
  488. USHORT NEAR CD_RemovableDeviceStatus(PRP_GENIOCTL, NPUNITCB);
  489. USHORT NEAR CD_ResetDrive(PRP_GENIOCTL, NPUNITCB);
  490. USHORT NEAR CD_EjectDisk(PRP_GENIOCTL, NPUNITCB);
  491. USHORT NEAR CD_CloseTray(PRP_GENIOCTL, NPUNITCB);
  492. USHORT NEAR CD_LockUnlock(PRP_GENIOCTL, NPUNITCB);
  493. USHORT NEAR CD_SetActiveTray(PRP_GENIOCTL, NPUNITCB);
  494. USHORT NEAR CD_Seek(PRP_GENIOCTL, NPUNITCB);
  495. USHORT NEAR CD_WriteLong(PRP_GENIOCTL, NPUNITCB);
  496. USHORT NEAR CD_WriteVLong(PRP_GENIOCTL, NPUNITCB);
  497. USHORT NEAR CD_DeviceStatus(PRP_GENIOCTL, NPUNITCB);
  498. USHORT NEAR CD_TrayStatus(PRP_GENIOCTL, NPUNITCB);
  499. USHORT NEAR CD_Identify(PRP_GENIOCTL, NPUNITCB);
  500. USHORT NEAR CD_ReturnSectorSize(PRP_GENIOCTL, NPUNITCB);
  501. USHORT NEAR CD_HeadLocation(PRP_GENIOCTL, NPUNITCB);
  502. USHORT NEAR CD_ReadPrefetch(PRP_GENIOCTL, NPUNITCB);
  503. USHORT NEAR CD_ReadLong(PRP_GENIOCTL, NPUNITCB);
  504. USHORT NEAR CD_ReadLongPre(PRP_GENIOCTL, NPUNITCB);
  505. USHORT NEAR CD_ReturnVolumeSize(PRP_GENIOCTL, NPUNITCB);
  506. USHORT NEAR CD_GetUPC(PRP_GENIOCTL, NPUNITCB);
  507. USHORT NEAR CD_AudioChannelCtrl(PRP_GENIOCTL, NPUNITCB);
  508. USHORT NEAR CD_Play(PRP_GENIOCTL, NPUNITCB);
  509. USHORT NEAR CD_Stop(PRP_GENIOCTL, NPUNITCB);
  510. USHORT NEAR CD_Resume(PRP_GENIOCTL, NPUNITCB);
  511. USHORT NEAR CD_AudioChannelInfo(PRP_GENIOCTL, NPUNITCB);
  512. USHORT NEAR CD_AudioDiskInfo(PRP_GENIOCTL, NPUNITCB);
  513. USHORT NEAR CD_AudioTrackInfo(PRP_GENIOCTL, NPUNITCB);
  514. USHORT NEAR CD_AudioQChannelInfo(PRP_GENIOCTL, NPUNITCB);
  515. USHORT NEAR CD_AudioSubChannelInfo(PRP_GENIOCTL, NPUNITCB);
  516. USHORT NEAR CD_AudioStatusInfo(PRP_GENIOCTL, NPUNITCB);
  517. USHORT NEAR VerifyParameters (PRP_GENIOCTL, USHORT, USHORT, PLOCKSTRUC);
  518. USHORT NEAR MakeSlotActive(NPUNITCB,UCHAR);
  519.