|
|
1.1 ! root 1: #if DBG ! 2: ! 3: // ! 4: // CdAudio debug level global variable ! 5: // ! 6: ! 7: ULONG CdAudioDebug = 0; ! 8: ! 9: // ! 10: // Remap CdDump to local routine ! 11: // ! 12: ! 13: #define CdDump(X) CdAudioDebugPrint X ! 14: ! 15: VOID ! 16: CdAudioDebugPrint( ! 17: ULONG DebugPrintLevel, ! 18: PCCHAR DebugMessage, ! 19: ... ! 20: ); ! 21: ! 22: #else ! 23: ! 24: #define CdDump(X) ! 25: ! 26: #endif // DBG ! 27: ! 28: #include "class.h" ! 29: ! 30: #define CDAUDIO_NOT_ACTIVE 0 ! 31: #define CDAUDIO_NEC 1 ! 32: #define CDAUDIO_PIONEER 2 ! 33: #define CDAUDIO_DENON 3 ! 34: #define CDAUDIO_HITATCHI 4 ! 35: #define CDAUDIO_CDS535 5 ! 36: #define CDAUDIO_CDS435 6 ! 37: ! 38: ! 39: #define CDAUDIO_NOT_PAUSED 0 ! 40: #define CDAUDIO_PAUSED 1 ! 41: ! 42: // ! 43: // Device Extension ! 44: // ! 45: ! 46: typedef struct _CD_DEVICE_EXTENSION { ! 47: ! 48: // ! 49: // Class device extension. ! 50: // ! 51: ! 52: DEVICE_EXTENSION ClassDeviceExtension; ! 53: ! 54: // ! 55: // Target Device Object ! 56: // ! 57: ! 58: PDEVICE_OBJECT TargetDeviceObject; ! 59: ! 60: // ! 61: // Back pointer to device object ! 62: // ! 63: ! 64: PDEVICE_OBJECT DeviceObject; ! 65: ! 66: // ! 67: // CdAudio active for this drive ! 68: // ! 69: ! 70: UCHAR Active; ! 71: ! 72: // ! 73: // For drives that don't support ! 74: // PAUSE/RESUME (Denon), a flag ! 75: // to signify when the drive is ! 76: // paused. ! 77: // ! 78: ! 79: UCHAR Paused; ! 80: ! 81: // ! 82: // For drives that don't support ! 83: // PAUSE/RESUME (Denon), this is the ! 84: // current position on the disc when ! 85: // a pause was last executed. This is ! 86: // stored in either BCD or binary, ! 87: // depending on the drive. ! 88: // ! 89: ! 90: UCHAR PausedM; ! 91: UCHAR PausedS; ! 92: UCHAR PausedF; ! 93: ! 94: // ! 95: // For drives that don't support ! 96: // PAUSE/RESUME (Denon), this is the ! 97: // last "ending" position on the disc when ! 98: // a play was last executed. This is ! 99: // stored in BCD or binary, depending on ! 100: // the drive. ! 101: // ! 102: ! 103: UCHAR LastEndM; ! 104: UCHAR LastEndS; ! 105: UCHAR LastEndF; ! 106: ! 107: // ! 108: // Indicates the CD is currently playing music. ! 109: // ! 110: ! 111: BOOLEAN PlayActive; ! 112: ! 113: } CD_DEVICE_EXTENSION, *PCD_DEVICE_EXTENSION; ! 114: ! 115: #define AUDIO_TIMEOUT 10 ! 116: #define CD_DEVICE_EXTENSION_SIZE sizeof(CD_DEVICE_EXTENSION) ! 117: #define MAXIMUM_RETRIES 4 ! 118: ! 119: // ! 120: // Convert BCD character to decimal equivalent ! 121: // ! 122: ! 123: #define BCD_TO_DEC(x) ((((x & 0xF0)>>4)*10) + (x & 0x0F)) ! 124: #define DEC_TO_BCD(x) (((x / 10) << 4) + (x % 10)) ! 125: ! 126: // ! 127: // Defines for NEC CDR cdrom drives ! 128: // ! 129: ! 130: #define NEC_READ_TOC_CODE 0xDE ! 131: #define NEC_AUDIO_TRACK_SEARCH_CODE 0xD8 ! 132: #define NEC_PLAY_AUDIO_CODE 0xD9 ! 133: #define NEC_STILL_CODE 0xDA ! 134: #define NEC_EJECT_CODE 0xDC ! 135: #define NEC_READ_SUB_Q_CHANNEL_CODE 0xDD ! 136: #define NEC_Q_CHANNEL_TRANSFER_SIZE 10 ! 137: ! 138: #define NEC_ENTER_PLAY_MODE 0x01 ! 139: #define NEC_TYPE_LOGICAL 0x00 ! 140: #define NEC_TYPE_ATIME 0x40 ! 141: #define NEC_TYPE_TRACK_NUMBER 0x80 ! 142: #define NEC_TYPE_NO_CHANGE 0xC0 ! 143: #define NEC_PLAY_STEREO 0x03 ! 144: #define NEC_TRANSFER_WHOLE_TOC 0x03 ! 145: #define NEC_TOC_TYPE_DISK 0xA0 ! 146: #define NEC_TOC_TYPE_SESSION 0xB0 ! 147: ! 148: // ! 149: // The NEC cdrom TOC size is: ! 150: // 2 bytes for size ! 151: // 10 bytes first track data ! 152: // 10 bytes last track data ! 153: // 10 bytes total disk data ! 154: // 10 bytes per track 99 track maximum. ! 155: // ! 156: ! 157: #define NEC_CDROM_TOC_SIZE 1022 ! 158: ! 159: // ! 160: // NEC SENSE CODES ! 161: // ! 162: ! 163: #define NEC_SCSI_ERROR_NO_DISC 0x0B ! 164: #define NEC_SCSI_ERROR_ILLEGAL_DISC 0x0C ! 165: #define NEC_SCSI_ERROR_TRAY_OPEN 0x0D ! 166: #define NEC_SCSI_ERROR_SEEK_ERROR 0x15 ! 167: #define NEC_SCSI_ERROR_MUSIC_AREA 0x1D ! 168: #define NEC_SCSI_ERROR_DATA_AREA 0x1C ! 169: #define NEC_SCSI_ERROR_PARITY_ERROR 0x30 ! 170: #define NEC_SCSI_ERROR_INVALID_COMMAND 0x20 ! 171: #define NEC_SCSI_ERROR_INVALID_ADDRESS 0x21 ! 172: #define NEC_SCSI_ERROR_INVALID_PARAMETER 0x22 ! 173: #define NEC_SCSI_ERROR_INVALID_CMD_SEQUENCE 0x24 ! 174: #define NEC_SCSI_ERROR_END_OF_VOLUME 0x25 ! 175: #define NEC_SCSI_ERROR_MEDIA_CHANGED 0x28 ! 176: #define NEC_SCSI_ERROR_DEVICE_RESET 0x29 ! 177: ! 178: // ! 179: // NEC 10-byte cdb definitions. ! 180: // ! 181: ! 182: typedef union _NEC_CDB { ! 183: ! 184: // ! 185: // NEC Read TOC CDB ! 186: // ! 187: ! 188: struct _NEC_READ_TOC { ! 189: UCHAR OperationCode; ! 190: UCHAR Type : 2; ! 191: UCHAR Reserved1 : 6; ! 192: UCHAR TrackNumber; ! 193: UCHAR Reserved2[6]; ! 194: UCHAR Control; ! 195: } NEC_READ_TOC, *PNEC_READ_TOC; ! 196: ! 197: // ! 198: // NEC Play CDB ! 199: // ! 200: ! 201: struct _NEC_PLAY_AUDIO { ! 202: UCHAR OperationCode; ! 203: UCHAR PlayMode : 3; ! 204: UCHAR Reserved1 : 5; ! 205: UCHAR Minute; ! 206: UCHAR Second; ! 207: UCHAR Frame; ! 208: UCHAR Reserved2[4]; ! 209: UCHAR Control; ! 210: } NEC_PLAY_AUDIO, *PNEC_PLAY_AUDIO; ! 211: ! 212: // ! 213: // NEC Seek Audio ! 214: // ! 215: ! 216: struct _NEC_SEEK_AUDIO { ! 217: UCHAR OperationCode; ! 218: UCHAR Play : 1; ! 219: UCHAR Reserved1 : 7; ! 220: UCHAR Minute; ! 221: UCHAR Second; ! 222: UCHAR Frame; ! 223: UCHAR Reserved2[4]; ! 224: UCHAR Control; ! 225: } NEC_SEEK_AUDIO, *PNEC_SEEK_AUDIO; ! 226: ! 227: // ! 228: // NEC Pause Audio ! 229: // ! 230: ! 231: struct _NEC_PAUSE_AUDIO { ! 232: UCHAR OperationCode; ! 233: UCHAR Reserved1[8]; ! 234: UCHAR Control; ! 235: } NEC_PAUSE_AUDIO, *PNEC_PAUSE_AUDIO; ! 236: ! 237: // ! 238: // NEC Read Q Channel ! 239: // ! 240: ! 241: struct _NEC_READ_Q_CHANNEL { ! 242: UCHAR OperationCode; ! 243: UCHAR TransferSize : 5; ! 244: UCHAR Reserved1 : 3; ! 245: UCHAR Reserved2[7]; ! 246: UCHAR Control; ! 247: } NEC_READ_Q_CHANNEL, *PNEC_READ_Q_CHANNEL; ! 248: ! 249: // ! 250: // NEC Eject Disc ! 251: // ! 252: ! 253: struct _NEC_EJECT { ! 254: UCHAR OperationCode; ! 255: UCHAR Immediate : 1; ! 256: UCHAR Reserved1 : 7; ! 257: UCHAR Reserved2[7]; ! 258: UCHAR Control; ! 259: } NEC_EJECT, *PNEC_EJECT; ! 260: ! 261: } NEC_CDB, *PNEC_CDB; ! 262: ! 263: // ! 264: // Defines for PIONEER DRM-600 ! 265: // ! 266: ! 267: #define PIONEER_REZERO_UNIT_CODE 0x01 ! 268: #define PIONEER_EJECT_CODE 0xC0 ! 269: #define PIONEER_READ_TOC_CODE 0xC1 ! 270: #define PIONEER_READ_SUB_Q_CHANNEL_CODE 0xC2 ! 271: #define PIONEER_Q_CHANNEL_TRANSFER_SIZE 9 ! 272: #define PIONEER_AUDIO_STATUS_TRANSFER_SIZE 6 ! 273: #define PIONEER_AUDIO_TRACK_SEARCH_CODE 0xC8 ! 274: #define PIONEER_PLAY_AUDIO_CODE 0xC9 ! 275: #define PIONEER_PAUSE_CODE 0xCA ! 276: #define PIONEER_AUDIO_STATUS_CODE 0xCC ! 277: ! 278: #define PIONEER_READ_FIRST_AND_LAST 0x00 ! 279: #define PIONEER_READ_TRACK_INFO 0x02 ! 280: #define PIONEER_READ_LEAD_OUT_INFO 0x01 ! 281: #define PIONEER_TRANSFER_SIZE 0x04 ! 282: #define PIONEER_TYPE_ATIME 0x01 ! 283: #define PIONEER_STOP_ADDRESS 0x10 ! 284: ! 285: // ! 286: // Pioneer cdb definitions. ! 287: // ! 288: ! 289: typedef union _PIONEER_CDB { ! 290: ! 291: ! 292: // ! 293: // Pioneer Start/Stop Unit ! 294: // ! 295: ! 296: struct _PNR_START_STOP { ! 297: UCHAR OperationCode; ! 298: UCHAR Immediate : 1; ! 299: UCHAR Reserved1 : 4; ! 300: UCHAR Lun : 3; ! 301: UCHAR Reserved2 : 7; ! 302: UCHAR PCF : 1; ! 303: UCHAR Reserved3; ! 304: UCHAR Start : 1; ! 305: UCHAR Eject : 1; ! 306: UCHAR Reserved4 : 6; ! 307: UCHAR Link : 1; ! 308: UCHAR Flag : 1; ! 309: UCHAR Reserved5 : 4; ! 310: UCHAR Vendor : 2; ! 311: } PNR_START_STOP, *PPNR_START_STOP; ! 312: ! 313: // ! 314: // Pioneer Read TOC CDB ! 315: // ! 316: ! 317: struct _PNR_READ_TOC { ! 318: UCHAR OperationCode; ! 319: UCHAR Reserved1 : 5; ! 320: UCHAR Lun : 3; ! 321: UCHAR Reserved2[3]; ! 322: UCHAR TrackNumber; ! 323: UCHAR Reserved3; ! 324: UCHAR AssignedLength[2]; ! 325: UCHAR Link : 1; ! 326: UCHAR Flag : 1; ! 327: UCHAR Reserved4 : 4; ! 328: UCHAR Type : 2; ! 329: } PNR_READ_TOC, *PPNR_READ_TOC; ! 330: ! 331: // ! 332: // Pioneer Play CDB ! 333: // ! 334: ! 335: struct _PNR_PLAY_AUDIO { ! 336: UCHAR OperationCode; ! 337: UCHAR PlayMode : 4; ! 338: UCHAR StopAddr : 1; ! 339: UCHAR Lun : 3; ! 340: UCHAR Reserved1; ! 341: UCHAR Minute; ! 342: UCHAR Second; ! 343: UCHAR Frame; ! 344: UCHAR Reserved2[3]; ! 345: UCHAR Link : 1; ! 346: UCHAR Flag : 1; ! 347: UCHAR Reserved3 : 4; ! 348: UCHAR Type : 2; ! 349: } PNR_PLAY_AUDIO, *PPNR_PLAY_AUDIO; ! 350: ! 351: // ! 352: // Pioneer Seek Audio ! 353: // ! 354: ! 355: struct _PNR_SEEK_AUDIO { ! 356: UCHAR OperationCode; ! 357: UCHAR PlayMode : 4; ! 358: UCHAR PlayBack : 1; ! 359: UCHAR Lun : 3; ! 360: UCHAR Reserved1; ! 361: UCHAR Minute; ! 362: UCHAR Second; ! 363: UCHAR Frame; ! 364: UCHAR Reserved2[3]; ! 365: UCHAR Link : 1; ! 366: UCHAR Flag : 1; ! 367: UCHAR Reserved3 : 4; ! 368: UCHAR Type : 2; ! 369: } PNR_SEEK_AUDIO, *PPNR_SEEK_AUDIO; ! 370: ! 371: // ! 372: // Pioneer Pause Audio ! 373: // ! 374: ! 375: struct _PNR_PAUSE_AUDIO { ! 376: UCHAR OperationCode; ! 377: UCHAR Reserved1 : 4; ! 378: UCHAR Pause : 1; ! 379: UCHAR Lun : 3; ! 380: UCHAR Reserved2[7]; ! 381: UCHAR Link : 1; ! 382: UCHAR Flag : 1; ! 383: UCHAR Reserved3 : 4; ! 384: UCHAR Reserved4 : 2; ! 385: } PNR_PAUSE_AUDIO, *PPNR_PAUSE_AUDIO; ! 386: ! 387: // ! 388: // Pioneer Audio Status ! 389: // ! 390: ! 391: struct _PNR_AUDIO_STATUS { ! 392: UCHAR OperationCode; ! 393: UCHAR Reserved1 : 4; ! 394: UCHAR Reserved2 : 1; ! 395: UCHAR Lun : 3; ! 396: UCHAR Reserved3[6]; ! 397: UCHAR AssignedLength; ! 398: UCHAR Link : 1; ! 399: UCHAR Flag : 1; ! 400: UCHAR Reserved4 : 4; ! 401: UCHAR Reserved5 : 2; ! 402: } PNR_AUDIO_STATUS, *PPNR_AUDIO_STATUS; ! 403: ! 404: // ! 405: // Pioneer Read Q Channel ! 406: // ! 407: ! 408: struct _PNR_READ_Q_CHANNEL { ! 409: UCHAR OperationCode; ! 410: UCHAR Reserved1 : 4; ! 411: UCHAR Reserved2 : 1; ! 412: UCHAR Lun : 3; ! 413: UCHAR Reserved3[6]; ! 414: UCHAR AssignedLength; ! 415: UCHAR Link : 1; ! 416: UCHAR Flag : 1; ! 417: UCHAR Reserved4 : 4; ! 418: UCHAR Reserved5 : 2; ! 419: } PNR_READ_Q_CHANNEL, *PPNR_READ_Q_CHANNEL; ! 420: ! 421: // ! 422: // Pioneer Eject Disc ! 423: // ! 424: ! 425: struct _PNR_EJECT { ! 426: UCHAR OperationCode; ! 427: UCHAR Immediate : 1; ! 428: UCHAR Reserved1 : 4; ! 429: UCHAR Lun : 3; ! 430: UCHAR Reserved2[7]; ! 431: UCHAR Link : 1; ! 432: UCHAR Flag : 1; ! 433: UCHAR Reserved4 : 4; ! 434: UCHAR Reserved5 : 2; ! 435: } PNR_EJECT, *PPNR_EJECT; ! 436: ! 437: } PNR_CDB, *PPNR_CDB; ! 438: ! 439: ! 440: // ! 441: // Defines for DENON DRD-253 ! 442: // ! 443: ! 444: #define DENON_READ_TOC_CODE 0xE9 ! 445: #define DENON_EJECT_CODE 0xE6 ! 446: #define DENON_PLAY_AUDIO_EXTENDED_CODE 0x22 ! 447: #define DENON_STOP_AUDIO_CODE 0xE7 ! 448: #define DENON_READ_SUB_Q_CHANNEL_CODE 0xEB ! 449: ! 450: // ! 451: // Defines for HITATCHI 1750s ! 452: // ! 453: ! 454: #define HITATCHI_READ_TOC_CODE 0xE8 ! 455: #define HITATCHI_EJECT_CODE 0xE4 ! 456: #define HITATCHI_PLAY_AUDIO_MSF_CODE 0xE0 ! 457: #define HITATCHI_PAUSE_AUDIO_CODE 0xE1 ! 458: #define HITATCHI_READ_SUB_Q_CHANNEL_CODE 0xE5 ! 459: ! 460: // ! 461: // 12 byte cdbs for Hitatchi ! 462: // ! 463: ! 464: typedef union _CDB12 { ! 465: ! 466: // ! 467: // Disc Information ! 468: // ! 469: ! 470: struct _READ_DISC_INFO { ! 471: ! 472: UCHAR OperationCode; ! 473: UCHAR Reserved : 5; ! 474: UCHAR LogicalUnitNumber : 3; ! 475: UCHAR Reserved1[7]; ! 476: UCHAR AllocationLength[2]; ! 477: UCHAR Link : 1; ! 478: UCHAR Flag : 1; ! 479: UCHAR Reserved2 : 4; ! 480: UCHAR VendorUniqueBits : 2; ! 481: ! 482: } READ_DISC_INFO, *PREAD_DISC_INFO; ! 483: ! 484: // ! 485: // Play Audio ! 486: // ! 487: ! 488: struct _PLAY_AUDIO { ! 489: ! 490: UCHAR OperationCode; ! 491: UCHAR Immediate : 1; ! 492: UCHAR Right : 1; ! 493: UCHAR Left : 1; ! 494: UCHAR Reserved : 2; ! 495: UCHAR Lun : 3; ! 496: UCHAR StartingM; ! 497: UCHAR StartingS; ! 498: UCHAR StartingF; ! 499: UCHAR Reserved1[2]; ! 500: UCHAR EndingM; ! 501: UCHAR EndingS; ! 502: UCHAR EndingF; ! 503: UCHAR Reserved2; ! 504: UCHAR Link : 1; ! 505: UCHAR Flag : 1; ! 506: UCHAR Reserved3 : 4; ! 507: UCHAR VendorUniqueBits : 2; ! 508: ! 509: } PLAY_AUDIO, *PPLAY_AUDIO; ! 510: ! 511: // ! 512: // Pause Audio ! 513: // ! 514: ! 515: struct _PAUSE { ! 516: ! 517: UCHAR OperationCode; ! 518: UCHAR Reserved : 5; ! 519: UCHAR Lun : 3; ! 520: UCHAR Reserved1[9]; ! 521: UCHAR Link : 1; ! 522: UCHAR Flag : 1; ! 523: UCHAR Reserved2 : 4; ! 524: UCHAR VendorUnqiueBits : 2; ! 525: ! 526: } PAUSE_AUDIO, *PPAUSE_AUDIO; ! 527: ! 528: // ! 529: // Eject media ! 530: // ! 531: ! 532: struct _EJECT { ! 533: ! 534: UCHAR OperationCode; ! 535: UCHAR Reserved : 5; ! 536: UCHAR Lun : 3; ! 537: UCHAR Reserved1[8]; ! 538: UCHAR Eject : 1; ! 539: UCHAR Mode : 1; ! 540: UCHAR Reserved2 : 6; ! 541: UCHAR Link : 1; ! 542: UCHAR Flag : 1; ! 543: UCHAR Reserved3 : 4; ! 544: UCHAR VendorUnqiueBits : 2; ! 545: ! 546: } EJECT, *PEJECT; ! 547: ! 548: // ! 549: // Audio Status ! 550: // ! 551: ! 552: struct _AUDIO_STATUS { ! 553: ! 554: UCHAR OperationCode; ! 555: UCHAR Reserved : 5; ! 556: UCHAR Lun : 3; ! 557: UCHAR Reserved1[9]; ! 558: UCHAR Link : 1; ! 559: UCHAR Flag : 1; ! 560: UCHAR Reserved2 : 4; ! 561: UCHAR VendorUnqiueBits : 2; ! 562: ! 563: } AUDIO_STATUS, *PAUDIO_STATUS; ! 564: ! 565: } CDB12, *PCDB12; ! 566: ! 567: // ! 568: // Defines for Chinon CDS-535 CDROM Drive ! 569: // ! 570: ! 571: #define CDS535_READ_TOC_CODE 0x43 ! 572: #define CDS535_EJECT_CODE 0xC0 ! 573: #define CDS535_READ_SUB_Q_CHANNEL_CODE 0x42 ! 574: #define CDS535_STOP_AUDIO 0xC6 ! 575: #define CDS535_GET_LAST_SESSION 0x26 ! 576: ! 577: // ! 578: // Defines for Chinon CDS-435 CDROM Drive ! 579: // ! 580: ! 581: #define CDS435_READ_TOC_CODE 0x43 ! 582: #define CDS435_EJECT_CODE 0xC0 ! 583: #define CDS435_STOP_AUDIO_CODE 0xC6 ! 584: #define CDS435_PLAY_AUDIO_EXTENDED_CODE 0x47 ! 585: #define CDS435_READ_SUB_Q_CHANNEL_CODE 0x42 ! 586: ! 587:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.