home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / ceddcdrm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  19.4 KB  |  612 lines

  1. /*++ BUILD Version: 0001    // Increment this if a change has global effects
  2.  
  3. Copyright (c) 1990-1998  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     ceddcdrm.h
  8.  
  9. Abstract:
  10.  
  11.     This module contains structures and definitions
  12.     associated with CDROM IOCTls.
  13.  
  14. Author:
  15.  
  16.     Mike Glass
  17.  
  18. Revision History:
  19.  
  20. --*/
  21.  
  22. //
  23. // NtDeviceIoControlFile IoControlCode values for this device.
  24. //
  25. // Warning:  Remember that the low two bits of the code specify how the
  26. //           buffers are passed to the driver!
  27. //
  28.  
  29. #define IOCTL_CDROM_BASE                 FILE_DEVICE_CD_ROM
  30.  
  31. #define IOCTL_CDROM_UNLOAD_DRIVER        CTL_CODE(IOCTL_CDROM_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
  32.  
  33. //
  34. // CDROM Audio Device Control Functions
  35. //
  36.  
  37. #define IOCTL_CDROM_READ_TOC         CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
  38. #define IOCTL_CDROM_GET_CONTROL      CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
  39. #define IOCTL_CDROM_PLAY_AUDIO_MSF   CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
  40. #define IOCTL_CDROM_SEEK_AUDIO_MSF   CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
  41. #define IOCTL_CDROM_STOP_AUDIO       CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
  42. #define IOCTL_CDROM_PAUSE_AUDIO      CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
  43. #define IOCTL_CDROM_RESUME_AUDIO     CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
  44. #define IOCTL_CDROM_GET_VOLUME       CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
  45. #define IOCTL_CDROM_SET_VOLUME       CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
  46. #define IOCTL_CDROM_READ_Q_CHANNEL   CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
  47. #define IOCTL_CDROM_GET_LAST_SESSION CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
  48. #define IOCTL_CDROM_RAW_READ         CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT,  FILE_READ_ACCESS)
  49. #define IOCTL_CDROM_DISK_TYPE        CTL_CODE(IOCTL_CDROM_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
  50. #define IOCTL_CDROM_SCAN_AUDIO       CTL_CODE(IOCTL_CDROM_BASE, 0x0020, METHOD_BUFFERED, FILE_ANY_ACCESS)
  51.  
  52. #define IOCTL_CDROM_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
  53.  
  54. //
  55. // The following device control codes are common for all class drivers.  The
  56. // functions codes defined here must match all of the other class drivers.
  57. //
  58. // Warning: these codes will be replaced in the future with the IOCTL_STORAGE
  59. // codes included below
  60. //
  61.  
  62. #define IOCTL_CDROM_CHECK_VERIFY    CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
  63. #define IOCTL_CDROM_MEDIA_REMOVAL   CTL_CODE(IOCTL_CDROM_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
  64. #define IOCTL_CDROM_EJECT_MEDIA     CTL_CODE(IOCTL_CDROM_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
  65. #define IOCTL_CDROM_LOAD_MEDIA      CTL_CODE(IOCTL_CDROM_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
  66. #define IOCTL_CDROM_RESERVE         CTL_CODE(IOCTL_CDROM_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
  67. #define IOCTL_CDROM_RELEASE         CTL_CODE(IOCTL_CDROM_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
  68. #define IOCTL_CDROM_FIND_NEW_DEVICES CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
  69.  
  70. #define IOCTL_CDROM_READ_SG         CTL_CODE(IOCTL_CDROM_BASE, 0x0301, METHOD_BUFFERED, FILE_READ_ACCESS)
  71. #define IOCTL_CDROM_TEST_UNIT_READY CTL_CODE(IOCTL_CDROM_BASE, 0x0302, METHOD_BUFFERED, FILE_READ_ACCESS)
  72. #define IOCTL_CDROM_DISC_INFO       CTL_CODE(IOCTL_CDROM_BASE, 0x0303, METHOD_BUFFERED, FILE_READ_ACCESS)
  73. #define IOCTL_CDROM_TRACK_INFO      CTL_CODE(IOCTL_CDROM_BASE, 0x0304, METHOD_BUFFERED, FILE_READ_ACCESS)
  74. #define IOCTL_CDROM_SET_SPEED       CTL_CODE(IOCTL_CDROM_BASE, 0x0305, METHOD_BUFFERED, FILE_READ_ACCESS)
  75.  
  76.  
  77. //
  78. // The following file contains the IOCTL_STORAGE class ioctl definitions
  79. //
  80.  
  81. #include "ceddstor.h"
  82.  
  83. //
  84. // Maximum CD Rom size
  85. //
  86.  
  87. #define MAXIMUM_NUMBER_TRACKS 100
  88. #define MAXIMUM_CDROM_SIZE 804
  89.  
  90. //
  91. // CD ROM Table OF Contents (TOC)
  92. //
  93. // Format 0 - Get table of contents
  94. //
  95.  
  96. typedef struct _TRACK_DATA {
  97.     UCHAR Reserved;
  98.     UCHAR Control : 4;
  99.     UCHAR Adr : 4;
  100.     UCHAR TrackNumber;
  101.     UCHAR Reserved1;
  102.     UCHAR Address[4];
  103. } TRACK_DATA, *PTRACK_DATA;
  104.  
  105. typedef struct _CDROM_TOC {
  106.  
  107.     //
  108.     // Header
  109.     //
  110.  
  111.     UCHAR Length[2];
  112.     UCHAR FirstTrack;
  113.     UCHAR LastTrack;
  114.  
  115.     //
  116.     // Track data
  117.     //
  118.  
  119.     TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
  120. } CDROM_TOC, *PCDROM_TOC;
  121.  
  122. #define CDROM_TOC_SIZE sizeof(CDROM_TOC)
  123.  
  124. //
  125. // Play audio starting at MSF and ending at MSF
  126. //
  127.  
  128. typedef struct _CDROM_PLAY_AUDIO_MSF {
  129.     UCHAR StartingM;
  130.     UCHAR StartingS;
  131.     UCHAR StartingF;
  132.     UCHAR EndingM;
  133.     UCHAR EndingS;
  134.     UCHAR EndingF;
  135. } CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
  136.  
  137. //
  138. // Seek to MSF
  139. //
  140.  
  141. typedef struct _CDROM_SEEK_AUDIO_MSF {
  142.     UCHAR M;
  143.     UCHAR S;
  144.     UCHAR F;
  145. } CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
  146.  
  147.  
  148. //
  149. //  Flags for the disk type
  150. //
  151.  
  152. typedef struct _CDROM_DISK_DATA {
  153.  
  154.     ULONG DiskData;
  155.  
  156. } CDROM_DISK_DATA, *PCDROM_DISK_DATA;
  157.  
  158. #define CDROM_DISK_AUDIO_TRACK      (0x00000001)
  159. #define CDROM_DISK_DATA_TRACK       (0x00000002)
  160.  
  161. //
  162. // CD ROM Data Mode Codes, used with IOCTL_CDROM_READ_Q_CHANNEL
  163. //
  164.  
  165. #define IOCTL_CDROM_SUB_Q_CHANNEL    0x00
  166. #define IOCTL_CDROM_CURRENT_POSITION 0x01
  167. #define IOCTL_CDROM_MEDIA_CATALOG    0x02
  168. #define IOCTL_CDROM_TRACK_ISRC       0x03
  169.  
  170. typedef struct _CDROM_SUB_Q_DATA_FORMAT {
  171.     UCHAR Format;
  172.     UCHAR Track;
  173. } CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
  174.  
  175.  
  176. //
  177. // CD ROM Sub-Q Channel Data Format
  178. //
  179.  
  180. typedef struct _SUB_Q_HEADER {
  181.     UCHAR Reserved;
  182.     UCHAR AudioStatus;
  183.     UCHAR DataLength[2];
  184. } SUB_Q_HEADER, *PSUB_Q_HEADER;
  185.  
  186. typedef struct _SUB_Q_CURRENT_POSITION {
  187.     SUB_Q_HEADER Header;
  188.     UCHAR FormatCode;
  189.     UCHAR Control : 4;
  190.     UCHAR ADR : 4;
  191.     UCHAR TrackNumber;
  192.     UCHAR IndexNumber;
  193.     UCHAR AbsoluteAddress[4];
  194.     UCHAR TrackRelativeAddress[4];
  195. } SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
  196.  
  197. typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
  198.     SUB_Q_HEADER Header;
  199.     UCHAR FormatCode;
  200.     UCHAR Reserved[3];
  201.     UCHAR Reserved1 : 7;
  202.     UCHAR Mcval : 1;
  203.     UCHAR MediaCatalog[15];
  204. } SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
  205.  
  206. typedef struct _SUB_Q_TRACK_ISRC {
  207.     SUB_Q_HEADER Header;
  208.     UCHAR FormatCode;
  209.     UCHAR Reserved0;
  210.     UCHAR Track;
  211.     UCHAR Reserved1;
  212.     UCHAR Reserved2 : 7;
  213.     UCHAR Tcval : 1;
  214.     UCHAR TrackIsrc[15];
  215. } SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
  216.  
  217. typedef union _SUB_Q_CHANNEL_DATA {
  218.     SUB_Q_CURRENT_POSITION CurrentPosition;
  219.     SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
  220.     SUB_Q_TRACK_ISRC TrackIsrc;
  221. } SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
  222.  
  223. //
  224. // Audio Status Codes
  225. //
  226.  
  227. #define AUDIO_STATUS_NOT_SUPPORTED  0x00
  228. #define AUDIO_STATUS_IN_PROGRESS    0x11    // PLAY
  229. #define AUDIO_STATUS_PAUSED         0x12    // PAUSE
  230. #define AUDIO_STATUS_PLAY_COMPLETE  0x13
  231. #define AUDIO_STATUS_PLAY_ERROR     0x14
  232. #define AUDIO_STATUS_NO_STATUS      0x15    // STOP
  233.  
  234. //
  235. // ADR Sub-channel Q Field
  236. //
  237.  
  238. #define ADR_NO_MODE_INFORMATION     0x0
  239. #define ADR_ENCODES_CURRENT_POSITION 0x1
  240. #define ADR_ENCODES_MEDIA_CATALOG   0x2
  241. #define ADR_ENCODES_ISRC            0x3
  242.  
  243. //
  244. // Sub-channel Q Control Bits
  245. //
  246.  
  247. #define AUDIO_WITH_PREEMPHASIS      0x0
  248. #define DIGITAL_COPY_PERMITTED      0x2
  249. #define AUDIO_DATA_TRACK            0x4
  250. #define TWO_FOUR_CHANNEL_AUDIO      0x8
  251.  
  252. //
  253. // Get Audio control parameters
  254. //
  255.  
  256. typedef struct _CDROM_AUDIO_CONTROL {
  257.     UCHAR LbaFormat;
  258.     USHORT LogicalBlocksPerSecond;
  259. } CDROM_AUDIO_CONTROL, *PCDROM_AUDIO_CONTROL;
  260.  
  261. //
  262. // Volume control - Volume takes a value between 1 and 0xFF.
  263. // SCSI-II CDROM audio suppports up to 4 audio ports with
  264. // Independent volume control.
  265. //
  266.  
  267. typedef struct _VOLUME_CONTROL {
  268.     UCHAR PortVolume[4];
  269. } VOLUME_CONTROL, *PVOLUME_CONTROL;
  270.  
  271. typedef enum _TRACK_MODE_TYPE {
  272.     YellowMode2,
  273.     XAForm2,
  274.     CDDA
  275. } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
  276.  
  277. //
  278. // Passed to cdrom to describe the raw read, ie. Mode 2, Form 2, CDDA...
  279. //
  280.  
  281. typedef struct __RAW_READ_INFO {
  282.     LARGE_INTEGER DiskOffset;
  283.     ULONG    SectorCount;
  284.     TRACK_MODE_TYPE TrackMode;
  285. } RAW_READ_INFO, *PRAW_READ_INFO;
  286.  
  287. //
  288. // Scan audio starting at Address
  289. //
  290.  
  291. typedef struct _CDROM_SCAN_AUDIO {
  292.     UCHAR Reserved  : 4;
  293.     UCHAR Direction : 1;    // 0 = Fast Forward, 1 = Fast Reverse
  294.     UCHAR Reserved1 : 3;
  295.     UCHAR Address[4];
  296.     UCHAR Reserved2[3];
  297.     UCHAR Reserved3 : 6;
  298.     UCHAR AddressType : 2;  // 0 = LBA, 1 = MSF, 2 = Track Number
  299. } CDROM_SCAN_AUDIO, *PCDROM_SCAN_AUDIO;
  300.  
  301.  
  302. /***    Definitions for CD-ROM Disk Addresses
  303.  *
  304.  *    Two standards are available for addressing the disk, known as
  305.  *    the Redbook (MSF) or the High Sierra Group (HSG) addresses.
  306.  *    Redbook addresses are given as Minute, Second, and Frame numbers.
  307.  *    HSG addresses are just logical block addresses, as an unsigned long.
  308.  *    The term "LBA", for "logical block address", is preferred over HSG.
  309.  *    The standard conversion formula between these two formats is
  310.  *    Sector = (((Minute*60) + Second)*75) + Frame;
  311.  */
  312.  
  313.  
  314. /***    The MSF_ADDR structure describes a disk address in Redbook format.
  315.  *    The Minute, Second, and Frame are given as binary numbers.
  316.  *    BEWARE: In some cases, the MSF is given as 3 pairs of BCD digits
  317.  *    on disk.   This format only specifies the binary number version.
  318.  */
  319.  
  320. typedef struct    MSF_ADDR { /* */
  321.     UCHAR   msf_Frame;
  322.     UCHAR   msf_Second;
  323.     UCHAR   msf_Minute;
  324.     UCHAR   msf_Filler;
  325. } MSF_ADDR, *PMSF_ADDR;
  326.  
  327.  
  328. /***    The LBA_ADDR typedef describes a disk address in HSG format.
  329.  */
  330.  
  331. typedef ULONG    LBA_ADDR;
  332.  
  333.  
  334. /***    The MSF_LBA union combines both Redbook and HSG formats
  335.  */
  336.  
  337. typedef union    MSF_LBA { /* */
  338.     MSF_ADDR    msf;
  339.     LBA_ADDR    lba;
  340. } MSF_LBA;
  341.  
  342.  
  343. #define CDROM_ADDR_LBA    0
  344. #define CDROM_ADDR_MSF    1
  345.  
  346.  
  347. /***    The CDROM_ADDR structure is used to store addresses of either format.
  348.  */
  349.  
  350. typedef struct    CDROM_ADDR { /* */
  351.     ULONG   Mode;
  352.     MSF_LBA Address;
  353. } CDROM_ADDR, *PCDROM_ADDR;
  354.  
  355. /***    These macros convert either format of CDROM address to the other.
  356.  *    They are written as expressions rather than functions to simplify
  357.  *    callers.  Converting LBA to MSF format is more difficult, and
  358.  *    requires a temporary variable of type MSF_ADDR.
  359.  */
  360.  
  361. #define CDROM_MSF_TO_LBA(pcdra)         \
  362.     (((pcdra)-> Mode = CDROM_ADDR_LBA),     \
  363.      (((pcdra)-> Address.lba) = (LBA_ADDR) (       \
  364.        (((pcdra)-> Address.msf.msf_Minute) * 60 +  \
  365.     ((pcdra)-> Address.msf.msf_Second)) * 75 + \
  366.        ((pcdra)-> Address.msf.msf_Frame)) - 150))
  367.  
  368. #define CDROM_MSFCOMP_TO_LBA(min, sec, frame)     \
  369.     ((LBA_ADDR)((((min) * 60 + (sec)) * 75 + ((frame)) - 150)))
  370.        
  371. #define CDROM_LBA_TO_MSF(pcdra,msfTemp)             \
  372.     (                                \
  373.     ((pcdra)-> Mode = CDROM_ADDR_MSF),            \
  374.     (((pcdra)-> Address.lba) += 150),            \
  375.     (msfTemp.msf_Frame  = (UCHAR)(((pcdra)-> Address.lba) % 75)),    \
  376.     (((pcdra)-> Address.lba) /= 75),            \
  377.     (msfTemp.msf_Second = (UCHAR)(((pcdra)-> Address.lba) % 60)),    \
  378.     (((pcdra)-> Address.lba) /= 60),            \
  379.     (msfTemp.msf_Minute = (UCHAR)(((pcdra)-> Address.lba))),     \
  380.     (msfTemp.msf_Filler = 0),                \
  381.     ((pcdra)-> Address.msf.msf_Filler = msfTemp.msf_Filler),\
  382.     ((pcdra)-> Address.msf.msf_Minute = msfTemp.msf_Minute),\
  383.     ((pcdra)-> Address.msf.msf_Second = msfTemp.msf_Second),\
  384.     ((pcdra)-> Address.msf.msf_Frame  = msfTemp.msf_Frame)    \
  385.     )
  386.  
  387. typedef struct _SGX_BUF {
  388.     PUCHAR sb_buf;        // pointer to buffer
  389.     DWORD  sb_len;        // length of buffer
  390. } SGX_BUF, *PSGX_BUF; 
  391.  
  392. typedef struct    CDROM_READ { /* */
  393.     CDROM_ADDR        StartAddr;            // Sector number to read from
  394.     DWORD           TransferLength;     // Number of blocks to read
  395.     BOOL            bRawMode;           // Raw mode?
  396.     TRACK_MODE_TYPE TrackMode;          // Only used if bRawMode == TRUE
  397.     DWORD           sgcount;            // Count of scatter gather buffers
  398.     SGX_BUF         sglist[1];          // first scatter/gather buffer
  399. } CDROM_READ, *PCDROM_READ;
  400.  
  401. /***    CDROM_IOCTL_TEST_UNIT_READY 
  402.  *
  403.  *    CDROM_IOCTL_TEST_UNIT_READ - Check for unit ready
  404.  *
  405.  *    ENTRY
  406.  *
  407.  *    EXIT
  408.  *        Success
  409.  *        Returns NO_ERROR
  410.  *        CDROM_UNITREADY - filled
  411.  *
  412.  *        Failure
  413.  *        Returns an extended error code.
  414.  *        ERROR_UNKNOWN_COMMAND - The command is not supported
  415.  *        ERROR_INVALID_PARAMETER - The desired speed is not supported
  416.  *        Other Extended Errors may also be returned
  417.  *
  418.  */
  419.  
  420. typedef struct    CDROM_TESTUNITREADY { /* */
  421.     ULONG    Reserved;        // Reserved - must be zero
  422.     BOOL    bUnitReady;        // Is unit ready
  423. } CDROM_TESTUNITREADY, *PCDROM_TESTUNITREADY;
  424.  
  425. /***    CDROM_IOCTL_DISC_INFO - Get Disk Information
  426.  *
  427.  *    This function returns the TOC (table of contents) information
  428.  *    from the Q-channel in the lead-in track of the disc, which
  429.  *    indicates the starting and ending tracks and the start of
  430.  *    the lead-out track.
  431.  *
  432.  *    The first and last track number are binary values, not BCD.
  433.  *
  434.  *    It is recommended that the information from the TOC be read
  435.  *    in and cached on drive initialization so that when this function
  436.  *    is called, there is not need to interrupt drive play to get this
  437.  *    information.  Note that the first and last track numbers do not
  438.  *    include the lead-in and lead-out tracks of the session.
  439.  *
  440.  *    The SessionIndex is used to get TOC information from disks
  441.  *    with more than one recorded session.  Sessions are the same
  442.  *    as OrangeBook Volumes.    The first session has a SessionIndex
  443.  *    of zero, and the second session has a SessionIndex of one.
  444.  * A SessionIndex of DISC_INFO_LAST_SESSION (-1) requests the disc
  445.  * info for the last session recorded on the disc.
  446.  *
  447.  *    The LogicStartAddr is the logical sector address of the first
  448.  *    data sector of the first track in this session.
  449.  *
  450.  *    For standard Redbook and Yellowbook CD-ROMs, zero (0) is the
  451.  *    only valid SessionIndex value.    In this case, LogicStartAddr
  452.  *    should be returned as zero (0).
  453.  *
  454.  *    Note: The LogicStartAddr is normally used to locate the first
  455.  *    sector of the Volume Recognition Sequence for the indicated
  456.  *    session. The Volume Recognition Sequence for the session is
  457.  *    expected to start at Sector (LogicStartAddr + 16).
  458.  *
  459.  *    ENTRY
  460.  *        IOCTL Packet format specified by CDROM_DISCINFO structure.
  461.  *        Reserved - Reserved Zero
  462.  *        SessionIndex - Set to desired session number to query.
  463.  *        SessionIndex = 0 indicates a query for the first session
  464.  *        SessionIndex = 0xFFFFFFFF indicates a query for the last
  465.  *            session on the disk
  466.  *
  467.  *    EXIT
  468.  *        Success
  469.  *        Returns NO_ERROR
  470.  *        CDROM_DISCINFO structure filled in for indicated session
  471.  *
  472.  *        If SessionIndex was passed in as 0xFFFFFFFF, it may be
  473.  *        modified to contain the index of the last session on the
  474.  *        disk.  Because not all device drivers must scan through
  475.  *        all the sessions on the disk, this update may or may not
  476.  *        actually take place.
  477.  *
  478.  *        Failure
  479.  *        Returns an extended error code.
  480.  *        ERROR_UNKNOWN_COMMAND - The command is not supported
  481.  *        ERROR_INVALID_PARAMETER - The session number is invalid
  482.  *        Other Extended Errors may also be returned
  483.  */
  484.  
  485. typedef struct    CDROM_DISCINFO { /* */
  486.     ULONG    Reserved;        // Reserved - must be zero
  487.     ULONG    FirstTrack;        // First Track of Session
  488.     ULONG    LastTrack;        // Last Track of Session
  489.     MSF_ADDR    LeadOutTrackAddr;    // Address of Lead-out Track of Session
  490.     UCHAR    FirstSession;
  491.     UCHAR    LastSession;
  492.     UCHAR    ReqSession;
  493.     UCHAR    RetSession;
  494.     ULONG    LogicStartAddr;     // Session Logical Start Acdress
  495. } CDROM_DISCINFO, *PCDROM_DISCINFO;
  496.  
  497. #define DISC_INFO_LAST_SESSION 0xFF
  498.  
  499. /***    CDROM_IOCTL_TRACK_INFO - Get Track Parameters
  500.  *
  501.  *    This function takes a binary track number in the range
  502.  *    specified by the first and last track number for the disk
  503.  *    and returns the Redbook address for the starting point of
  504.  *    the track and control information for the track.  The control
  505.  *    information is contained in the 4 most significant bits of the
  506.  *    control information byte.  The definitions of the bit fields
  507.  *    are given below.
  508.  *
  509.  *    It is recommended that the information from the TOC be read
  510.  *    in and cached on drive initialization so that when this function
  511.  *    is called, there is not need to interrupt drive play to get this
  512.  *    information.
  513.  *
  514.  *    ENTRY
  515.  *        IOCTL Packet format specified by CDROM_TRACKINFO structure.
  516.  *        Reserved - Reserved Zero
  517.  *        TrackNumber - Set to desired track number to query.
  518.  *
  519.  *    EXIT
  520.  *        Success
  521.  *        Returns NO_ERROR
  522.  *        CDROM_TRACKINFO structure filled in for indicated track
  523.  *
  524.  *        Failure
  525.  *        Returns an extended error code.
  526.  *        ERROR_UNKNOWN_COMMAND - The command is not supported
  527.  *        ERROR_INVALID_PARAMETER - The track number is invalid
  528.  *        Other Extended Errors may also be returned
  529.  *
  530.  *    TrackControl Bit Definitions
  531.  *
  532.  *    Bit    Definition
  533.  *    0-3    ADR information
  534.  *    4    0 - No preemphasis on audio channels
  535.  *        1 - Preemphasis on audio channels
  536.  *    5    0 - Digital copy prohibited
  537.  *        1 - Digital copy allowed
  538.  *    6    0 - Audio Track
  539.  *        1 - Data Track
  540.  *    7    0 - 2 Audio channels
  541.  *        1 - 4 Audio channels
  542.  */
  543.  
  544. typedef struct    CDROM_TRACKINFO    { /* */
  545.     ULONG    Reserved;        // Reserved - must be zero
  546.     ULONG    TrackNumber;        // Desired Track Number
  547.     MSF_ADDR    TrackAddr;        // Track Starting Address
  548.     ULONG    TrackControl;        // Track Control Flags (CDTRACK_)
  549. } CDROM_TRACKINFO, *PCDROM_TRACKINFO;
  550.  
  551. #define CDTRACK_ADRMASK     0x0F    // ADR Information
  552. #define CDTRACK_PREEMPHASIS 0x10    // Audio Preemphasis Indicator
  553. #define CDTRACK_COPYOK        0x20    // Digital Copy Allowed
  554. #define CDTRACK_DATA        0x40    // Data Track
  555. #define CDTRACK_4CHANNEL    0x80    // 4 Audio Channels
  556.  
  557.  
  558. /***    CDROM_IOCTL_GET_AUDIO_STATE - Get Audio Pause State
  559.  *
  560.  *    CDROM_IOCTL_GET_AUDIO_STATE returns inforation about the current
  561.  *    audio state.
  562.  *
  563.  *    This function returns information about whether audio is playing
  564.  *    or paused on the drive.
  565.  *
  566.  *    If the audio is paused, the Redbook starting and ending addresses
  567.  *    for the resume audio operation are returned.
  568.  *
  569.  *    ENTRY
  570.  *        IOCTL Packet format specified by CDROM_AUDSTATE structure.
  571.  *        Reserved - Reserved Zero
  572.  *        CDROM_AUDSTATE contents = don't care
  573.  *
  574.  *    EXIT
  575.  *        Success
  576.  *        Returns NO_ERROR
  577.  *        CDROM_AUDSTATE structure filled in
  578.  *        Bits of AudioFlags set according to CDAUDSTAT definitions
  579.  *
  580.  *        Failure
  581.  *        Returns an extended error code.
  582.  *        ERROR_UNKNOWN_COMMAND - The command is not supported
  583.  *        Other Extended Errors may also be returned
  584.  *
  585.  *    AudioFlags Bit Definitions
  586.  *
  587.  *    Bit    Definition
  588.  *    0    0 - Audio is not paused
  589.  *        1 - Audio is paused
  590.  *    1    0 - Audio play request is in progress
  591.  *        1 - There are no play requests in progress
  592.  *    1-15    Reserved (must be zero)
  593.  *
  594.  */
  595.  
  596. typedef struct    CDROM_AUDSTATE { /* */
  597.     ULONG    Reserved;        // Reserved - must be zero
  598.     ULONG    AudioFlags;        // Audio Pause Flags
  599.     MSF_ADDR    StartAddress;        // Starting Address for Audio Resume
  600.     MSF_ADDR    EndAddress;        // Ending Address for Audio Resume
  601. } CDROM_AUDSTATE, *PCDROM_AUDSTATE;
  602.  
  603. #define CDAUDSTAT_PAUSED    0x0001
  604. #define CDAUDSTAT_PLAYING   0x0002
  605.  
  606. // Set spindle speed for reading data off the CD
  607.  
  608. typedef struct _CDROM_SPEED {
  609.     USHORT ReadSpeed;           // Drive read speed in KB/s, 0xFFFF for max
  610.     USHORT Reserved;
  611. } CDROM_SPEED, *PCDROM_SPEED;
  612.