1 //////////////////////////////////////////////////////////////////// 2 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine 3 // All rights reserved 4 // This file was released under the GPLv2 on June 2015. 5 //////////////////////////////////////////////////////////////////// 6 /* 7 8 Module Name: 9 10 cdrw_hw.h 11 12 Abstract: 13 14 Here are the structures and defines used for device low level control. 15 16 Environment: 17 18 kernel mode only 19 20 */ 21 #ifndef __CDRW_DEVICE_H__ 22 #define __CDRW_DEVICE_H__ 23 24 #pragma pack(push, 1) 25 26 // Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus 27 28 typedef union _CDB { 29 30 // Generic 6-Byte CDB 31 struct _CDB6 { 32 UCHAR OperationCode; 33 UCHAR Immediate : 1; 34 UCHAR CommandUniqueBits : 4; 35 UCHAR Lun : 3; 36 UCHAR CommandUniqueBytes[3]; 37 UCHAR Link : 1; 38 UCHAR Flag : 1; 39 UCHAR Reserved : 4; 40 UCHAR VendorUnique : 2; 41 } CDB6, *PCDB6; 42 43 struct _REQUEST_SENSE { 44 UCHAR OperationCode; 45 UCHAR Reserved0 : 5; 46 UCHAR Lun : 3; 47 UCHAR Reserved1[2]; 48 UCHAR AllocationLength; 49 UCHAR Link : 1; 50 UCHAR Flag : 1; 51 UCHAR Reserved2 : 6; 52 } REQUEST_SENSE, *PREQUEST_SENSE; 53 54 // Standard 6-byte CDB 55 struct _CDB6READWRITE { 56 UCHAR OperationCode; 57 UCHAR LBA2 : 5; 58 UCHAR Lun : 3; 59 UCHAR LBA0[2]; 60 UCHAR NumOfBlocks; 61 UCHAR Control; 62 } CDB6READWRITE, *PCDB6READWRITE; 63 64 // SCSI Inquiry CDB 65 struct _CDB6INQUIRY { 66 UCHAR OperationCode; 67 UCHAR Reserved1 : 5; 68 UCHAR Lun : 3; 69 UCHAR PageCode; 70 UCHAR IReserved; 71 UCHAR AllocationLength; 72 UCHAR Control; 73 } CDB6INQUIRY, *PCDB6INQUIRY; 74 75 // SCSI Format CDB 76 77 struct _ERASE { 78 UCHAR OperationCode; 79 UCHAR Long : 1; 80 UCHAR Immediate : 1; 81 UCHAR Reserved1 : 3; 82 UCHAR Lun : 3; 83 UCHAR Reserved2[3]; 84 UCHAR Control; 85 } ERASE, *PERASE; 86 87 #define FormatUnit_Code_Mask 0x07 88 #define FormatUnit_Cmp 0x08 89 #define FormatUnit_Fmt 0x10 90 91 #define FormatUnit_Code_oldCDRW 0x07 92 #define FormatUnit_Code_CD_DVD 0x01 93 94 struct _CDB6FORMAT { 95 UCHAR OperationCode; 96 union { 97 UCHAR Flags; 98 struct { 99 UCHAR FormatCode : 3; 100 UCHAR Cmp:1; 101 UCHAR Fmt:1; 102 UCHAR Lun : 3; 103 } Fields; 104 } Byte1; 105 UCHAR FReserved1; 106 UCHAR Interleave[2]; 107 UCHAR FReserved2; 108 } CDB6FORMAT, *PCDB6FORMAT; 109 110 // Standard 10-byte CDB 111 struct _CDB10 { 112 UCHAR OperationCode; 113 UCHAR RelativeAddress : 1; 114 UCHAR Reserved1 : 2; 115 UCHAR ForceUnitAccess : 1; 116 UCHAR DisablePageOut : 1; 117 UCHAR Lun : 3; 118 UCHAR LBA[4]; 119 UCHAR Reserved2; 120 UCHAR TransferBlocks[2]; 121 UCHAR Control; 122 } CDB10, *PCDB10; 123 124 // CD Rom Audio CDBs 125 126 #define PauseResume_Pause 0x00 127 #define PauseResume_Resume 0x01 128 129 struct _PAUSE_RESUME { 130 UCHAR OperationCode; 131 UCHAR Reserved1 : 5; 132 UCHAR Lun : 3; 133 UCHAR Reserved2[6]; 134 UCHAR Action; 135 UCHAR Control; 136 } PAUSE_RESUME, *PPAUSE_RESUME; 137 138 // Read Table of Contents (TOC) 139 140 #define ReadTOC_Format_Mask 0x0f 141 #define ReadTOC_Format_TOC 0x00 142 #define ReadTOC_Format_SesInfo 0x01 143 #define ReadTOC_Format_FullTOC 0x02 144 #define ReadTOC_Format_PMA 0x03 145 #define ReadTOC_Format_ATIP 0x04 146 #define ReadTOC_Format_CdText 0x05 147 148 struct _READ_TOC { 149 UCHAR OperationCode; 150 UCHAR Reserved0 : 1; 151 UCHAR Msf : 1; // HMSF MMC-3 152 UCHAR Reserved1 : 3; 153 UCHAR Lun : 3; 154 155 union { 156 UCHAR Flags; 157 struct { 158 UCHAR Format : 4; 159 UCHAR Reserved : 4; 160 } Fields; 161 } Byte2; 162 163 UCHAR Reserved2[3]; 164 UCHAR Start_TrackSes; 165 UCHAR AllocationLength[2]; 166 UCHAR Control : 6; 167 UCHAR Format : 2; 168 } READ_TOC, *PREAD_TOC; 169 170 // Read Header 171 struct _READ_HEADER { 172 UCHAR OperationCode; 173 UCHAR Reserved0 : 1; 174 UCHAR Msf : 1; // HMSF MMC-3 175 UCHAR Reserved1 : 3; 176 UCHAR Lun : 3; 177 178 UCHAR LBA[4]; 179 UCHAR Reserved2; 180 UCHAR AllocationLength[2]; 181 UCHAR Control; 182 } READ_HEADER, *PREAD_HEADER; 183 184 // Play Audio MSF 185 struct _PLAY_AUDIO_MSF { 186 UCHAR OperationCode; 187 UCHAR Reserved1 : 5; 188 UCHAR Lun : 3; 189 UCHAR Reserved2; 190 UCHAR StartingMSF[3]; 191 UCHAR EndingMSF[3]; 192 UCHAR Control; 193 } PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF; 194 195 // Read SubChannel Data 196 197 #define SubChannel_SubQ_Header 0x00 198 #define SubChannel_SubQ_Block 0x01 199 200 struct _SUBCHANNEL { 201 UCHAR OperationCode; 202 UCHAR Reserved0 : 1; 203 UCHAR Msf : 1; 204 UCHAR Reserved1 : 3; 205 UCHAR Lun : 3; 206 UCHAR Reserved2 : 6; 207 UCHAR SubQ : 1; 208 UCHAR Reserved3 : 1; 209 UCHAR Format; 210 UCHAR Reserved4[2]; 211 UCHAR TrackNumber; 212 UCHAR AllocationLength[2]; 213 UCHAR Control; 214 } SUBCHANNEL, *PSUBCHANNEL; 215 216 #define SetStreaming_Type_Performance 0x00 217 #define SetStreaming_Type_DBICacheZone 0x05 218 219 struct _SET_STREAMING { 220 UCHAR OperationCode; 221 222 UCHAR Reserved0[7]; 223 UCHAR Type; 224 UCHAR AllocationLength[2]; 225 226 UCHAR Control; 227 } SET_STREAMING, *PSET_STREAMING; 228 229 // Read CD (by LBA/MSF). Used by Atapi for raw sector reads. 230 231 #define ReadCD_SecType_Mask 0x1c 232 #define ReadCD_SecType_Any 0x00 233 #define ReadCD_SecType_CDDA 0x04 234 #define ReadCD_SecType_M1 0x08 235 #define ReadCD_SecType_M2 0x0c 236 #define ReadCD_SecType_M2F1 0x10 237 #define ReadCD_SecType_M2F2 0x14 238 239 struct _READ_CD_MSF { 240 UCHAR OperationCode; 241 242 UCHAR Reserved0 : 1; 243 UCHAR DAP : 1; 244 UCHAR ExpectedSectorType : 3; 245 UCHAR Reserved1 : 3; 246 247 UCHAR Reserved2; 248 UCHAR Starting_MSF[3]; 249 UCHAR Ending_MSF[3]; 250 251 UCHAR Reserved3 : 1; 252 UCHAR ErrorFlags : 2; 253 UCHAR IncludeEDC : 1; 254 UCHAR IncludeUserData : 1; 255 UCHAR HeaderCode : 2; 256 UCHAR IncludeSyncData : 1; 257 258 UCHAR SubChannelSelection : 3; 259 UCHAR Reserved4 : 5; 260 261 UCHAR Control; 262 } READ_CD_MSF, *PREAD_CD_MSF; 263 264 struct _READ_CD { 265 UCHAR OperationCode; 266 267 UCHAR RelAdr : 1; // must be 0 268 UCHAR DAP : 1; // Digital Audio Play - enable mute & interpolate when reading CDDA 269 UCHAR ExpectedSectorType : 3; 270 UCHAR Reserved1 : 3; 271 272 UCHAR LBA[4]; 273 UCHAR NumOfBlocks[3]; 274 275 UCHAR Reserved3 : 1; 276 UCHAR ErrorFlags : 2; 277 UCHAR IncludeEDC : 1; 278 UCHAR IncludeUserData : 1; 279 UCHAR HeaderCode : 2; 280 UCHAR IncludeSyncData : 1; 281 282 UCHAR SubChannelSelection : 3; 283 UCHAR Reserved4 : 5; 284 285 UCHAR Control; 286 } READ_CD, *PREAD_CD; 287 288 #define WriteCd_RELADR 0x01 289 #define WriteCd_FUA 0x08 290 #define WriteCd_DPO 0x10 291 292 struct _WRITE_CD { 293 UCHAR OperationCode; 294 union { 295 UCHAR Flags; 296 struct { 297 UCHAR RELADR : 1; 298 UCHAR Reserved0 : 2; 299 UCHAR FUA : 1; 300 UCHAR DPO : 1; 301 UCHAR Reserved1 : 3; 302 } Fields; 303 } Byte1; 304 UCHAR LBA [4]; 305 UCHAR Reserved1; 306 UCHAR NumOfBlocks [2]; 307 UCHAR Reserved2 [3]; 308 } WRITE_CD, *PWRITE_CD; 309 310 // Mode sense 311 struct _MODE_SENSE { 312 UCHAR OperationCode; 313 UCHAR Reserved1 : 3; 314 UCHAR Dbd : 1; 315 UCHAR Reserved2 : 1; 316 UCHAR Lun : 3; 317 UCHAR PageCode : 6; 318 UCHAR Pc : 2; 319 UCHAR Reserved3; 320 UCHAR AllocationLength; 321 UCHAR Control; 322 } MODE_SENSE, *PMODE_SENSE; 323 324 // 10 bytes 325 struct _MODE_SENSE10 { 326 UCHAR OperationCode; 327 UCHAR Reserved1 : 3; 328 UCHAR Dbd : 1; 329 UCHAR Reserved2 : 1; 330 UCHAR Lun : 3; 331 UCHAR PageCode : 6; 332 UCHAR Pc : 2; 333 UCHAR Reserved3[4]; 334 UCHAR AllocationLength[2]; 335 UCHAR Control; 336 } MODE_SENSE10, *PMODE_SENSE10; 337 338 // 6 bytes 339 struct _MODE_SELECT { 340 UCHAR OperationCode; 341 UCHAR SPBit : 1; 342 UCHAR Reserved1 : 3; 343 UCHAR PFBit : 1; 344 UCHAR Lun : 3; 345 UCHAR Reserved2[2]; 346 UCHAR ParameterListLength; 347 UCHAR Control; 348 } MODE_SELECT, *PMODE_SELECT; 349 350 struct _MODE_SELECT10 { 351 UCHAR OperationCode; 352 UCHAR SPBit : 1; 353 UCHAR Reserved1 : 3; 354 UCHAR PFBit : 1; 355 UCHAR Lun : 3; 356 UCHAR Reserved2[5]; 357 UCHAR ParameterListLength[2]; 358 UCHAR Control; 359 } MODE_SELECT10, *PMODE_SELECT10; 360 361 struct _LOGSENSE { 362 UCHAR OperationCode; 363 UCHAR SPBit : 1; 364 UCHAR PPCBit : 1; 365 UCHAR Reserved1 : 3; 366 UCHAR Lun : 3; 367 UCHAR PageCode : 6; 368 UCHAR PCBit : 2; 369 UCHAR Reserved2; 370 UCHAR Reserved3; 371 UCHAR ParameterPointer[2]; // [0]=MSB, [1]=LSB 372 UCHAR AllocationLength[2]; // [0]=MSB, [1]=LSB 373 UCHAR Control; 374 } LOGSENSE, *PLOGSENSE; 375 376 struct _SEEK { 377 UCHAR OperationCode; 378 UCHAR Reserved1 : 5; 379 UCHAR Lun : 3; 380 UCHAR LBA[4]; 381 UCHAR Reserved2[3]; 382 UCHAR Control; 383 } SEEK, *PSEEK; 384 385 #define StartStop_Start 0x01 386 #define StartStop_Load 0x02 387 388 struct _START_STOP { 389 UCHAR OperationCode; 390 UCHAR Immediate: 1; 391 UCHAR Reserved1 : 4; 392 UCHAR Lun : 3; 393 UCHAR Reserved2[2]; 394 UCHAR Start : 1; 395 UCHAR LoadEject : 1; 396 UCHAR Reserved3 : 6; 397 UCHAR Control; 398 } START_STOP, *PSTART_STOP; 399 400 struct _MEDIA_REMOVAL { 401 UCHAR OperationCode; 402 UCHAR Reserved1 : 5; 403 UCHAR Lun : 3; 404 UCHAR Reserved2[2]; 405 UCHAR Prevent; 406 UCHAR Control; 407 } MEDIA_REMOVAL, *PMEDIA_REMOVAL; 408 409 //#ifndef WITHOUT_FORMATTER 410 // 10 bytes 411 struct _READ_FORMAT_CAPACITIES { 412 UCHAR OperationCode; 413 union { 414 UCHAR Flags; 415 struct { 416 UCHAR Reserved0 : 5; 417 UCHAR Reserved1 : 3; 418 } Fields; 419 } Byte1; 420 UCHAR Reserved0[5]; 421 UCHAR AllocationLength[2]; 422 UCHAR Control; 423 } READ_FORMAT_CAPACITIES, *PREAD_FORMAT_CAPACITIES; 424 //#endif //WITHOUT_FORMATTER 425 426 // Atapi 2.5 Changer 12-byte CDBs 427 #define LoadUnload_Start 0x01 428 #define LoadUnload_Load 0x02 429 430 struct _LOAD_UNLOAD { 431 UCHAR OperationCode; 432 UCHAR Immediate : 1; 433 UCHAR Reserved1 : 7; 434 UCHAR Reserved2[2]; 435 UCHAR Start : 1; 436 UCHAR LoadEject : 1; 437 UCHAR Reserved3: 6; 438 UCHAR Reserved4[3]; 439 UCHAR Slot; 440 UCHAR Reserved5[3]; 441 } LOAD_UNLOAD, *PLOAD_UNLOAD; 442 443 struct _MECH_STATUS { 444 UCHAR OperationCode; 445 UCHAR Reserved0[7]; 446 UCHAR AllocationLength[2]; 447 UCHAR Reserved2[2]; 448 } MECH_STATUS, *PMECH_STATUS; 449 450 struct _LOCK_DOOR { 451 UCHAR OperationCode; 452 UCHAR Reserved0[9]; 453 } LOCK_DOOR, *PLOCK_DOOR; 454 455 #define EventStat_Immed 0x01 456 457 #define EventStat_Class_OpChange 0x02 458 #define EventStat_Class_PM 0x04 459 #define EventStat_Class_ExternalReq 0x08 460 #define EventStat_Class_Media 0x10 461 #define EventStat_Class_MultiInit 0x20 462 #define EventStat_Class_DevBusy 0x40 463 464 struct _GET_EVENT_STATUS { 465 UCHAR OperationCode; 466 union { 467 UCHAR Flags; 468 struct { 469 UCHAR Immed : 1; 470 UCHAR Reserved0 : 7; 471 } Fields; 472 } Byte1; 473 UCHAR Reserved0[2]; 474 UCHAR NotificationClass; 475 UCHAR Reserved1[2]; 476 UCHAR AllocationLength[2]; 477 UCHAR Control; 478 } GET_EVENT_STATUS, *PGET_EVENT_STATUS; 479 480 #define ReadDiscInfo_Type_Mask 0x07 481 #define ReadDiscInfo_Type_Std 0x00 482 #define ReadDiscInfo_Type_TrkRes 0x01 // MMC-6 483 #define ReadDiscInfo_Type_POWRes 0x02 // MMC-6 484 485 struct _READ_DISC_INFO { 486 UCHAR OperationCode; 487 488 UCHAR DataType : 3; // MMC-6 489 UCHAR Reserved0 : 5; 490 491 UCHAR Reserved1[5]; 492 UCHAR AllocationLength[2]; 493 UCHAR Reserved2[3]; 494 } READ_DISC_INFO, *PREAD_DISC_INFO; 495 496 #define ReadTrackInfo_Type_Mask 0x01 497 #define ReadTrackInfo_Type_LBA 0x00 498 #define ReadTrackInfo_Type_Track 0x01 499 #define ReadTrackInfo_Type_POW 0x02 500 501 #define ReadTrackInfo_LastTrk 0xff 502 503 struct _READ_TRACK_INFO { 504 UCHAR OperationCode; 505 UCHAR Track : 1; 506 UCHAR Reserved0 : 7; 507 UCHAR LBA_TrkNum [4]; 508 UCHAR Reserved1; 509 UCHAR AllocationLength[2]; 510 UCHAR Reserved2[3]; 511 } READ_TRACK_INFO, *PREAD_TRACK_INFO; 512 513 #define ReadTrackInfo3_Type_Mask 0x03 514 #define ReadTrackInfo3_Type_LBA ReadTrackInfo_Type_LBA 515 #define ReadTrackInfo3_Type_Track ReadTrackInfo_Type_Track 516 #define ReadTrackInfo3_Type_Ses 0x02 517 518 #define ReadTrackInfo3_LastTrk ReadTrackInfo_LastTrk 519 #define ReadTrackInfo3_DiscLeadIn 0x00 // for Track type 520 521 struct _READ_TRACK_INFO_3 { 522 UCHAR OperationCode; 523 UCHAR DataType : 2; 524 UCHAR Reserved0 : 6; 525 UCHAR LBA_TrkNum [4]; 526 UCHAR Reserved1; 527 UCHAR AllocationLength[2]; 528 UCHAR Reserved2[3]; 529 } READ_TRACK_INFO_3, *PREAD_TRACK_INFO_3; 530 531 struct _RESERVE_TRACK { 532 UCHAR OperationCode; 533 534 UCHAR ARSV:1; // 0 - size format, 1 - start LBA 535 UCHAR RMZ:1; // 0 - logical track, 1 - U-RMZ (HD-DVD) 536 UCHAR Reserved0:6; 537 538 union { 539 struct { 540 UCHAR Reserved1[3]; 541 UCHAR Blocks[4]; 542 } Size; 543 struct { 544 UCHAR Start[4]; 545 UCHAR Reserved1[3]; 546 } LBA; 547 }; 548 UCHAR Control; 549 } RESERVE_TRACK, *PRESERVE_TRACK; 550 551 #define CloseTrkSes_Immed 0x01 552 553 #define CloseTrkSes_BGF 0x00 // DVD+RW only 554 #define CloseTrkSes_Trk 0x01 // also stops BGF on MRW disks 555 #define CloseTrkSes_BGF_QCompat 0x02 // ensures 30mm radius of recorded area 556 #define CloseTrkSes_Ses 0x02 557 #define CloseTrkSes_BGF_Compat 0x03 558 #define CloseTrkSes_SesSpec 0x03 559 #define CloseTrkSes_FinSpec 0x05 // MMC-5, DVD+R only 560 #define CloseTrkSes_Fin 0x06 // MMC-5, DVD+R only 561 562 #define CloseTrkSes_LastTrkSes 0xff 563 564 #define CloseTrkSes_Delay 3100000000I64 // 310 s 565 566 struct _CLOSE_TRACK_SESSION { 567 UCHAR OperationCode; 568 union { 569 UCHAR Flags; 570 struct { 571 UCHAR Immed : 1; 572 UCHAR Reserved0 : 7; 573 } Fields; 574 } Byte1; 575 union { 576 UCHAR Flags; 577 struct { 578 UCHAR Track : 1; 579 UCHAR Session : 1; 580 UCHAR Reserved0 : 6; 581 } Fields; 582 } Byte2; 583 UCHAR Reserved1 [2]; 584 UCHAR TrackNum; 585 UCHAR Reserved2 [6]; 586 587 } CLOSE_TRACK_SESSION, *PCLOSE_TRACK_SESSION; 588 589 struct _SET_CD_SPEED { 590 UCHAR OperationCode; 591 UCHAR RotCtrl : 2; 592 593 #define CdSpeed_RotCtrl_CLV 0x00 594 #define CdSpeed_RotCtrl_CAV 0x01 595 596 UCHAR Reserved0 : 6; 597 UCHAR ReadSpeed [2]; // Kbyte/sec 598 UCHAR WriteSpeed [2]; // Kbyte/sec 599 UCHAR Reserved1[6]; 600 } SET_CD_SPEED, *PSET_CD_SPEED; 601 602 #define SyncCache_RELADR 0x01 603 #define SyncCache_Immed 0x02 604 605 struct _SYNCHRONIZE_CACHE { 606 UCHAR OperationCode; 607 union { 608 UCHAR Flags; 609 struct { 610 UCHAR RELADR : 1; 611 UCHAR Immed : 1; 612 UCHAR Reserved0 : 6; // All these are unused by drive 613 } Fields; 614 } Byte1; 615 UCHAR LBA [4]; 616 UCHAR Reserved1; 617 UCHAR NumOfBlocks [2]; 618 UCHAR Reserved2 [3]; 619 /* 620 UCHAR Unused [11];*/ 621 } SYNCHRONIZE_CACHE, *PSYNCHRONIZE_CACHE; 622 623 #define BlankMedia_Mask 0x07 624 #define BlankMedia_Complete 0x00 625 #define BlankMedia_Minimal 0x01 626 #define BlankMedia_Track 0x02 627 #define BlankMedia_UnreserveTrack 0x03 628 #define BlankMedia_TrackTail 0x04 629 #define BlankMedia_UncloseLastSes 0x05 630 #define BlankMedia_EraseSes 0x06 631 #define BlankMedia_Immed 0x10 632 633 struct _BLANK_MEDIA { 634 UCHAR OperationCode; 635 union { 636 UCHAR Flags; 637 struct { 638 UCHAR BlankType : 3; 639 UCHAR Reserved0 : 1; 640 UCHAR Immed : 1; 641 UCHAR Reserved1 : 3; 642 } Fields; 643 } Byte1; 644 UCHAR StartAddr_TrkNum [4]; 645 UCHAR Reserved2 [6]; 646 } BLANK_MEDIA, *PBLANK_MEDIA; 647 648 #define SendKey_ReportAGID 0x00 649 #define SendKey_ChallengeKey 0x01 650 #define SendKey_Key1 0x02 651 #define SendKey_Key2 0x03 652 #define SendKey_TitleKey 0x04 653 #define SendKey_ReportASF 0x05 654 #define SendKey_InvalidateAGID 0x3F 655 656 struct _SEND_KEY { 657 UCHAR OperationCode; 658 UCHAR Reserved1 : 5; 659 UCHAR Lun : 3; 660 UCHAR Reserved2[6]; 661 UCHAR ParameterListLength[2]; 662 UCHAR KeyFormat : 6; 663 UCHAR AGID : 2; 664 UCHAR Control; 665 } SEND_KEY, *PSEND_KEY; 666 667 struct _REPORT_KEY { 668 UCHAR OperationCode; // 0xA4 669 UCHAR Reserved1 : 5; 670 UCHAR Lun : 3; 671 UCHAR LBA[4]; // for title key 672 UCHAR Reserved2[2]; 673 UCHAR AllocationLength[2]; 674 UCHAR KeyFormat : 6; 675 UCHAR AGID : 2; 676 UCHAR Control; 677 } REPORT_KEY, *PREPORT_KEY; 678 679 #define ReadDvdStruc_Fmt_PhInfo 0x00 680 #define ReadDvdStruc_Fmt_Copyright_LeadIn 0x01 681 #define ReadDvdStruc_Fmt_DiscKey 0x02 682 #define ReadDvdStruc_Fmt_BurstCuttingArea 0x03 683 #define ReadDvdStruc_Fmt_Manufacturer_LeadIn 0x04 684 #define ReadDvdStruc_Fmt_Copyright_Sector 0x05 685 #define ReadDvdStruc_Fmt_MediaId_BusKey 0x06 686 #define ReadDvdStruc_Fmt_MediaKeyBlock_BusKey 0x07 687 #define ReadDvdStruc_Fmt_DDS_RAM 0x08 688 #define ReadDvdStruc_Fmt_MediumStatus_RAM 0x09 689 #define ReadDvdStruc_Fmt_SpareArea_RAM 0x0a 690 // 0x0b 691 #define ReadDvdStruc_Fmt_LastRMD 0x0c 692 #define ReadDvdStruc_Fmt_RMD 0x0d 693 #define ReadDvdStruc_Fmt_PreRec_LeadIn 0x0e 694 #define ReadDvdStruc_Fmt_MediaId_R_RW 0x0f 695 #define ReadDvdStruc_Fmt_PhFmtInfo_R_RW 0x10 696 697 #define ReadDvdStruc_Fmt_DCB 0x30 //Disc Control Block 698 #define ReadDvdStruc_Fmt_MTA_ECC_pMRW 0x31 699 700 #define ReadDvdStruc_Fmt_WriteProtection 0xc0 701 #define ReadDvdStruc_Fmt_ReadSend_DvdStruc_cap 0xff 702 703 struct _READ_DVD_STRUCTURE { 704 UCHAR OperationCode; // 0xAD 705 UCHAR MediaType : 4; // =1 For BlueRay (BD) 706 UCHAR Reserved1 : 4; 707 UCHAR RMDBlockNumber[4]; 708 UCHAR LayerNumber; 709 UCHAR Format; 710 UCHAR AllocationLength[2]; // [0]=MSB, [1]=LSB 711 UCHAR Reserved3 : 6; 712 UCHAR AGID : 2; 713 UCHAR Control; 714 } READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE; 715 716 struct _READ_BUFFER_CAPACITY { 717 UCHAR OperationCode; 718 UCHAR Reserved0 [6]; 719 UCHAR AllocationLength[2]; 720 UCHAR Reserved1 [3]; 721 } READ_BUFFER_CAPACITY, *PREAD_BUFFER_CAPACITY; 722 723 struct _GET_CONFIGURATION { 724 UCHAR OperationCode; 725 union { 726 UCHAR Flags; 727 struct { 728 UCHAR RT : 2; 729 UCHAR Reserved0 : 6; 730 } Fields; 731 } Byte1; 732 UCHAR StartFeatureNum [2]; 733 UCHAR Reserved0 [3]; 734 UCHAR AllocationLength[2]; 735 UCHAR Control; 736 } GET_CONFIGURATION, *PGET_CONFIGURATION; 737 738 struct _SET_READ_AHEAD { 739 UCHAR OperationCode; 740 UCHAR Reserved0; 741 UCHAR TriggerLBA[4]; 742 UCHAR ReadAheadLBA[4]; 743 UCHAR Reserved1; 744 UCHAR Control; 745 } SET_READ_AHEAD, *PSET_READ_AHEAD; 746 747 #define SendOpc_DoOpc 0x01 748 749 struct _SEND_OPC_INFO { 750 UCHAR OperationCode; 751 union { 752 UCHAR Flags; 753 struct { 754 UCHAR DoOpc : 1; 755 UCHAR Reserved0 : 4; 756 UCHAR Reserved1 : 3; 757 } Fields; 758 } Byte1; 759 union { 760 UCHAR Flags; 761 struct { 762 UCHAR Exclude0 : 1; // exclude layer 0 763 UCHAR Exclude1 : 1; // exclude layer 0 764 UCHAR Reserved1 : 6; 765 } Fields; 766 } Byte2; 767 UCHAR Reserved0 [4]; 768 UCHAR AllocationLength[2]; 769 UCHAR Control; 770 } SEND_OPC_INFO, *PSEND_OPC_INFO; 771 772 struct _SEND_CUE_SHEET { 773 UCHAR OperationCode; 774 UCHAR Reserved0 [5]; 775 UCHAR AllocationLength[3]; 776 UCHAR Control; 777 } SEND_CUE_SHEET, *PSEND_CUE_SHEET; 778 779 struct _CDB12 { 780 UCHAR OperationCode; 781 UCHAR Params[11]; 782 } CDB12, *PCDB12; 783 784 struct _CDB12READWRITE { 785 UCHAR OperationCode; 786 union { 787 UCHAR Flags; 788 struct { 789 UCHAR RELADR : 1; 790 UCHAR Reserved0 : 2; 791 UCHAR FUA : 1; 792 UCHAR DPO : 1; 793 UCHAR Reserved1 : 3; 794 } Fields; 795 } Byte1; 796 UCHAR LBA [4]; 797 UCHAR NumOfBlocks [4]; 798 799 UCHAR Reserved1 : 7; 800 UCHAR Streaming : 1; 801 802 UCHAR Reserved2; 803 } CDB12READWRITE, *PCDB12READWRITE; 804 805 // Plextor Read CD-DA 806 struct _PLXTR_READ_CDDA { 807 UCHAR OperationCode; 808 UCHAR Reserved0 : 5; 809 UCHAR Lun :3; 810 UCHAR LBA[4]; 811 UCHAR TransferBlock[4]; 812 UCHAR SubCode; 813 UCHAR Control; 814 } PLXTR_READ_CDDA, *PPLXTR_READ_CDDA; 815 816 // NEC Read CD-DA 817 struct _NEC_READ_CDDA { 818 UCHAR OperationCode; 819 UCHAR Reserved0; 820 UCHAR LBA[4]; 821 UCHAR Reserved1; 822 UCHAR TransferBlock[2]; 823 UCHAR Control; 824 } NEC_READ_CDDA, *PNEC_READ_CDDA; 825 826 } CDB, *PCDB; 827 828 // Command Descriptor Block constants. 829 830 #define CDB6GENERIC_LENGTH 6 831 #define CDB10GENERIC_LENGTH 10 832 #define CDB12GENERIC_LENGTH 12 833 834 #define MAXIMUM_NUMBER_OF_TRACKS 100 835 #define MAXIMUM_NUMBER_OF_SESSIONS 1024 //maximal number of entries in Read Full TOC 836 837 #define SETBITON 1 838 #define SETBITOFF 0 839 840 // Mode Sense/Select page constants. 841 842 #define MODE_PAGE_ERROR_RECOVERY 0x01 843 #define MODE_PAGE_MRW2 0x03 // fuck, standard commitee claimed new standard 844 #define MODE_PAGE_WRITE_PARAMS 0x05 845 #define MODE_PAGE_VERIFY_ERROR 0x07 // shall not be used 846 #define MODE_PAGE_CACHING 0x08 // undocumented, but used by DirectCd 847 #define MODE_PAGE_MEDIUM_TYPES 0x0B // shall not be used 848 #define MODE_PAGE_CD_DEVICE_PARAMS 0x0D 849 #define MODE_PAGE_CD_AUDIO_CONTROL 0x0E 850 #define MODE_PAGE_POWER_CONDITION 0x1A 851 #define MODE_PAGE_FAIL_REPORT 0x1C 852 #define MODE_PAGE_TIMEOUT_AND_PROTECT 0x1D 853 #define MODE_PAGE_PHILIPS_SECTOR_TYPE 0x21 854 #define MODE_PAGE_CAPABILITIES 0x2A 855 #define MODE_PAGE_MRW 0x2C 856 857 #define MODE_SENSE_RETURN_ALL 0x3f 858 859 #define MODE_SENSE_CURRENT_VALUES 0x00 860 #define MODE_SENSE_CHANGEABLE_VALUES 0x40 861 #define MODE_SENSE_DEFAULT_VAULES 0x80 862 #define MODE_SENSE_SAVED_VALUES 0xc0 863 864 // SCSI CDB operation codes 865 866 #define SCSIOP_TEST_UNIT_READY 0x00 867 #define SCSIOP_REZERO_UNIT 0x01 868 #define SCSIOP_REWIND 0x01 869 #define SCSIOP_REQUEST_BLOCK_ADDR 0x02 870 #define SCSIOP_REQUEST_SENSE 0x03 871 #define SCSIOP_FORMAT_UNIT 0x04 872 #define SCSIOP_READ_BLOCK_LIMITS 0x05 873 #define SCSIOP_REASSIGN_BLOCKS 0x07 874 #define SCSIOP_READ6 0x08 875 #define SCSIOP_RECEIVE 0x08 876 #define SCSIOP_WRITE6 0x0A 877 #define SCSIOP_PRINT 0x0A 878 #define SCSIOP_SEND 0x0A 879 #define SCSIOP_SEEK6 0x0B 880 #define SCSIOP_TRACK_SELECT 0x0B 881 #define SCSIOP_SLEW_PRINT 0x0B 882 #define SCSIOP_SEEK_BLOCK 0x0C 883 #define SCSIOP_PARTITION 0x0D 884 #define SCSIOP_READ_REVERSE 0x0F 885 #define SCSIOP_WRITE_FILEMARKS 0x10 886 #define SCSIOP_FLUSH_BUFFER 0x10 887 #define SCSIOP_SPACE 0x11 888 #define SCSIOP_INQUIRY 0x12 889 #define SCSIOP_VERIFY6 0x13 890 #define SCSIOP_RECOVER_BUF_DATA 0x14 891 #define SCSIOP_MODE_SELECT 0x15 892 #define SCSIOP_RESERVE_UNIT 0x16 893 #define SCSIOP_RELEASE_UNIT 0x17 894 #define SCSIOP_COPY 0x18 895 #define SCSIOP_ERASE 0x19 896 #define SCSIOP_MODE_SENSE 0x1A 897 #define SCSIOP_START_STOP_UNIT 0x1B 898 #define SCSIOP_STOP_PRINT 0x1B 899 #define SCSIOP_LOAD_UNLOAD 0x1B 900 #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C 901 #define SCSIOP_SEND_DIAGNOSTIC 0x1D 902 #define SCSIOP_MEDIUM_REMOVAL 0x1E 903 #define SCSIOP_READ_FORMAT_CAPACITY 0x23 904 #define SCSIOP_READ_CAPACITY 0x25 905 #define SCSIOP_READ 0x28 906 #define SCSIOP_WRITE 0x2A 907 #define SCSIOP_WRITE_CD 0x2A 908 #define SCSIOP_SEEK 0x2B 909 #define SCSIOP_LOCATE 0x2B 910 #define SCSIOP_ERASE10 0x2C 911 #define SCSIOP_WRITE_VERIFY 0x2E 912 #define SCSIOP_VERIFY 0x2F 913 #define SCSIOP_SEARCH_DATA_HIGH 0x30 914 #define SCSIOP_SEARCH_DATA_EQUAL 0x31 915 #define SCSIOP_SEARCH_DATA_LOW 0x32 916 #define SCSIOP_SET_LIMITS 0x33 917 #define SCSIOP_READ_POSITION 0x34 918 #define SCSIOP_SYNCHRONIZE_CACHE 0x35 919 #define SCSIOP_COMPARE 0x39 920 #define SCSIOP_COPY_COMPARE 0x3A 921 #define SCSIOP_COPY_VERIFY 0x3A 922 #define SCSIOP_WRITE_DATA_BUFF 0x3B 923 #define SCSIOP_READ_DATA_BUFF 0x3C 924 #define SCSIOP_CHANGE_DEFINITION 0x40 925 #define SCSIOP_PLAY_AUDIO10 0x41 926 #define SCSIOP_READ_SUB_CHANNEL 0x42 927 #define SCSIOP_READ_TOC 0x43 928 #define SCSIOP_READ_HEADER 0x44 929 #define SCSIOP_PLAY_AUDIO 0x45 930 #define SCSIOP_GET_CONFIGURATION 0x46 931 #define SCSIOP_PLAY_AUDIO_MSF 0x47 932 #define SCSIOP_PLAY_TRACK_INDEX 0x48 933 #define SCSIOP_PLAY_TRACK_RELATIVE 0x49 934 #define SCSIOP_GET_EVENT_STATUS 0x4A 935 #define SCSIOP_PAUSE_RESUME 0x4B 936 #define SCSIOP_LOG_SELECT 0x4C 937 #define SCSIOP_LOG_SENSE 0x4D 938 #define SCSIOP_STOP_PLAY_SCAN 0x4E 939 #define SCSIOP_READ_DISC_INFO 0x51 940 #define SCSIOP_READ_TRACK_INFO 0x52 941 #define SCSIOP_RESERVE_TRACK 0x53 942 #define SCSIOP_SEND_OPC_INFO 0x54 943 #define SCSIOP_MODE_SELECT10 0x55 944 #define SCSIOP_REPAIR_TRACK 0x58 // obsolete 945 #define SCSIOP_READ_MASTER_CUE 0x59 946 #define SCSIOP_MODE_SENSE10 0x5A 947 #define SCSIOP_CLOSE_TRACK_SESSION 0x5B 948 #define SCSIOP_READ_BUFFER_CAPACITY 0x5C 949 #define SCSIOP_SEND_CUE_SHEET 0x5D 950 #define SCSIOP_BLANK 0xA1 951 #define SCSIOP_SEND_KEY 0xA3 952 #define SCSIOP_REPORT_KEY 0xA4 953 #define SCSIOP_PLAY_AUDIO12 0xA5 954 #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6 955 #define SCSIOP_SET_READ_AHEAD 0xA7 956 #define SCSIOP_READ12 0xA8 957 #define SCSIOP_WRITE12 0xAA 958 #define SCSIOP_SEEK12 0xAB 959 #define SCSIOP_GET_PERFORMANCE 0xAC 960 #define SCSIOP_READ_DVD_STRUCTURE 0xAD 961 #define SCSIOP_WRITE_VERIFY12 0xAE 962 #define SCSIOP_VERIFY12 0xAF 963 #define SCSIOP_SET_STREAMING 0xB6 964 #define SCSIOP_READ_CD_MSF 0xB9 965 #define SCSIOP_SET_CD_SPEED 0xBB 966 #define SCSIOP_MECHANISM_STATUS 0xBD 967 #define SCSIOP_READ_CD 0xBE 968 #define SCSIOP_SEND_DISK_STRUCTURE 0xBF 969 #define SCSIOP_SEND_DVD_STRUCTURE 0xBF // see sub-command field 970 #define SCSIOP_SEND_BD_STRUCTURE 0xBF // see sub-command field 971 #define SCSIOP_DOORLOCK 0xDE // lock door on removable drives 972 #define SCSIOP_DOORUNLOCK 0xDF // unlock door on removable drives 973 974 // If the IMMED bit is 1, status is returned as soon 975 // as the operation is initiated. If the IMMED bit 976 // is 0, status is not returned until the operation 977 // is completed. 978 979 #define CDB_RETURN_ON_COMPLETION 0 980 #define CDB_RETURN_IMMEDIATE 1 981 982 // end_ntminitape 983 984 // CDB Force media access used in extended read and write commands. 985 986 #define CDB_FORCE_MEDIA_ACCESS 0x08 987 988 // Denon CD ROM operation codes 989 990 #define SCSIOP_DENON_EJECT_DISC 0xE6 991 #define SCSIOP_DENON_STOP_AUDIO 0xE7 992 #define SCSIOP_DENON_PLAY_AUDIO 0xE8 993 #define SCSIOP_DENON_READ_TOC 0xE9 994 #define SCSIOP_DENON_READ_SUBCODE 0xEB 995 996 // Philips/Matshushita CD-R(W) operation codes 997 998 #define SCSIOP_PHILIPS_GET_NWA 0xE2 999 #define SCSIOP_PHILIPS_RESERVE_TRACK 0xE4 1000 #define SCSIOP_PHILIPS_WRITE_TRACK 0xE6 1001 #define SCSIOP_PHILIPS_LOAD_UNLOAD 0xE7 1002 #define SCSIOP_PHILIPS_CLOSE_TRACK_SESSION 0xE9 1003 #define SCSIOP_PHILIPS_RECOVER_BUF_DATA 0xEC 1004 #define SCSIOP_PHILIPS_READ_SESSION_INFO 0xEE 1005 1006 // Plextor operation codes 1007 1008 #define SCSIOP_PLEXTOR_READ_CDDA 0xD8 1009 1010 // NEC operation codes 1011 1012 #define SCSIOP_NEC_READ_CDDA 0xD4 1013 1014 // SCSI Bus Messages 1015 1016 #define SCSIMESS_ABORT 0x06 1017 #define SCSIMESS_ABORT_WITH_TAG 0x0D 1018 #define SCSIMESS_BUS_DEVICE_RESET 0X0C 1019 #define SCSIMESS_CLEAR_QUEUE 0X0E 1020 #define SCSIMESS_COMMAND_COMPLETE 0X00 1021 #define SCSIMESS_DISCONNECT 0X04 1022 #define SCSIMESS_EXTENDED_MESSAGE 0X01 1023 #define SCSIMESS_IDENTIFY 0X80 1024 #define SCSIMESS_IDENTIFY_WITH_DISCON 0XC0 1025 #define SCSIMESS_IGNORE_WIDE_RESIDUE 0X23 1026 #define SCSIMESS_INITIATE_RECOVERY 0X0F 1027 #define SCSIMESS_INIT_DETECTED_ERROR 0X05 1028 #define SCSIMESS_LINK_CMD_COMP 0X0A 1029 #define SCSIMESS_LINK_CMD_COMP_W_FLAG 0X0B 1030 #define SCSIMESS_MESS_PARITY_ERROR 0X09 1031 #define SCSIMESS_MESSAGE_REJECT 0X07 1032 #define SCSIMESS_NO_OPERATION 0X08 1033 #define SCSIMESS_HEAD_OF_QUEUE_TAG 0X21 1034 #define SCSIMESS_ORDERED_QUEUE_TAG 0X22 1035 #define SCSIMESS_SIMPLE_QUEUE_TAG 0X20 1036 #define SCSIMESS_RELEASE_RECOVERY 0X10 1037 #define SCSIMESS_RESTORE_POINTERS 0X03 1038 #define SCSIMESS_SAVE_DATA_POINTER 0X02 1039 #define SCSIMESS_TERMINATE_IO_PROCESS 0X11 1040 1041 // SCSI Extended Message operation codes 1042 1043 #define SCSIMESS_MODIFY_DATA_POINTER 0X00 1044 #define SCSIMESS_SYNCHRONOUS_DATA_REQ 0X01 1045 #define SCSIMESS_WIDE_DATA_REQUEST 0X03 1046 1047 // SCSI Extended Message Lengths 1048 1049 #define SCSIMESS_MODIFY_DATA_LENGTH 5 1050 #define SCSIMESS_SYNCH_DATA_LENGTH 3 1051 #define SCSIMESS_WIDE_DATA_LENGTH 2 1052 1053 // SCSI extended message structure 1054 1055 typedef struct _SCSI_EXTENDED_MESSAGE { 1056 UCHAR InitialMessageCode; 1057 UCHAR MessageLength; 1058 UCHAR MessageType; 1059 union _EXTENDED_ARGUMENTS { 1060 1061 struct { 1062 UCHAR Modifier[4]; 1063 } Modify; 1064 1065 struct { 1066 UCHAR TransferPeriod; 1067 UCHAR ReqAckOffset; 1068 } Synchronous; 1069 1070 struct{ 1071 UCHAR Width; 1072 } Wide; 1073 }ExtendedArguments; 1074 }SCSI_EXTENDED_MESSAGE, *PSCSI_EXTENDED_MESSAGE; 1075 1076 // SCSI bus status codes. 1077 1078 #define SCSISTAT_GOOD 0x00 1079 #define SCSISTAT_CHECK_CONDITION 0x02 1080 #define SCSISTAT_CONDITION_MET 0x04 1081 #define SCSISTAT_BUSY 0x08 1082 #define SCSISTAT_INTERMEDIATE 0x10 1083 #define SCSISTAT_INTERMEDIATE_COND_MET 0x14 1084 #define SCSISTAT_RESERVATION_CONFLICT 0x18 1085 #define SCSISTAT_COMMAND_TERMINATED 0x22 1086 #define SCSISTAT_QUEUE_FULL 0x28 1087 1088 // Enable Vital Product Data Flag (EVPD) 1089 // used with INQUIRY command. 1090 1091 #define CDB_INQUIRY_EVPD 0x01 1092 1093 // retry time (in deci-seconds) 1094 #define NOT_READY_RETRY_INTERVAL 20 1095 1096 // Defines for format CDB 1097 #define LUN0_FORMAT_SAVING_DEFECT_LIST 0 1098 #define USE_DEFAULTMSB 0 1099 #define USE_DEFAULTLSB 0 1100 1101 #define START_UNIT_CODE 0x01 1102 #define STOP_UNIT_CODE 0x00 1103 1104 // Inquiry buffer structure. This is the data returned from the target 1105 // after it receives an inquiry. 1106 // 1107 // This structure may be extended by the number of bytes specified 1108 // in the field AdditionalLength. The defined size constant only 1109 // includes fields through ProductRevisionLevel. 1110 // 1111 // The NT SCSI drivers are only interested in the first 36 bytes of data. 1112 1113 #define INQUIRYDATABUFFERSIZE 36 1114 1115 typedef struct _INQUIRYDATA { 1116 UCHAR DeviceType : 5; 1117 UCHAR DeviceTypeQualifier : 3; 1118 UCHAR DeviceTypeModifier : 7; 1119 UCHAR RemovableMedia : 1; 1120 UCHAR Versions; 1121 UCHAR ResponseDataFormat; 1122 UCHAR AdditionalLength; 1123 UCHAR Reserved[2]; 1124 UCHAR SoftReset : 1; 1125 UCHAR CommandQueue : 1; 1126 UCHAR Reserved2 : 1; 1127 UCHAR LinkedCommands : 1; 1128 UCHAR Synchronous : 1; 1129 UCHAR Wide16Bit : 1; 1130 UCHAR Wide32Bit : 1; 1131 UCHAR RelativeAddressing : 1; 1132 UCHAR VendorId[8]; 1133 UCHAR ProductId[16]; 1134 UCHAR ProductRevisionLevel[4]; 1135 UCHAR VendorSpecific[20]; 1136 UCHAR Reserved3[40]; 1137 } INQUIRYDATA, *PINQUIRYDATA; 1138 1139 // Inquiry defines. Used to interpret data returned from target as result 1140 // of inquiry command. 1141 1142 // DeviceType field 1143 1144 #define DIRECT_ACCESS_DEVICE 0x00 // disks 1145 #define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes 1146 #define PRINTER_DEVICE 0x02 // printers 1147 #define PROCESSOR_DEVICE 0x03 // scanners, printers, etc 1148 #define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms 1149 #define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms 1150 #define SCANNER_DEVICE 0x06 // scanners 1151 #define OPTICAL_DEVICE 0x07 // optical disks 1152 #define MEDIUM_CHANGER 0x08 // jukebox 1153 #define COMMUNICATION_DEVICE 0x09 // network 1154 #define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F 1155 #define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03 1156 1157 // DeviceTypeQualifier field 1158 1159 #define DEVICE_CONNECTED 0x00 1160 1161 // Sense Data Format 1162 1163 typedef struct _SENSE_DATA { 1164 UCHAR ErrorCode:7; 1165 UCHAR Valid:1; 1166 UCHAR SegmentNumber; 1167 UCHAR SenseKey:4; 1168 UCHAR Reserved:1; 1169 UCHAR IncorrectLength:1; 1170 UCHAR EndOfMedia:1; 1171 UCHAR FileMark:1; 1172 UCHAR Information[4]; 1173 UCHAR AdditionalSenseLength; 1174 UCHAR CommandSpecificInformation[4]; 1175 UCHAR AdditionalSenseCode; 1176 UCHAR AdditionalSenseCodeQualifier; 1177 UCHAR FieldReplaceableUnitCode; 1178 UCHAR SenseKeySpecific[3]; 1179 } SENSE_DATA, *PSENSE_DATA; 1180 1181 // Default request sense buffer size 1182 1183 #define SENSE_BUFFER_SIZE (sizeof(SENSE_DATA)) 1184 1185 // Sense keys 1186 1187 #define SCSI_SENSE_NO_SENSE 0x00 1188 #define SCSI_SENSE_RECOVERED_ERROR 0x01 1189 #define SCSI_SENSE_NOT_READY 0x02 1190 #define SCSI_SENSE_MEDIUM_ERROR 0x03 1191 #define SCSI_SENSE_HARDWARE_ERROR 0x04 1192 #define SCSI_SENSE_ILLEGAL_REQUEST 0x05 1193 #define SCSI_SENSE_UNIT_ATTENTION 0x06 1194 #define SCSI_SENSE_DATA_PROTECT 0x07 1195 #define SCSI_SENSE_BLANK_CHECK 0x08 1196 #define SCSI_SENSE_UNIQUE 0x09 1197 #define SCSI_SENSE_COPY_ABORTED 0x0A 1198 #define SCSI_SENSE_ABORTED_COMMAND 0x0B 1199 #define SCSI_SENSE_EQUAL 0x0C 1200 #define SCSI_SENSE_VOL_OVERFLOW 0x0D 1201 #define SCSI_SENSE_MISCOMPARE 0x0E 1202 #define SCSI_SENSE_RESERVED 0x0F 1203 1204 // Additional Sense codes 1205 1206 // SK = 0x00 1207 #define SCSI_ADSENSE_NO_SENSE 0x00 1208 1209 // SK = 0x01 1210 #define SCSI_ADSENSE_WARNING 0x0B 1211 #define SCSI_ADSENSE_REC_DATA_NOECC 0x17 1212 #define SCSI_ADSENSE_REC_DATA_ECC 0x18 1213 #define SCSI_ADSENSE_ROUNDED_PARAM 0x37 1214 #define SCSI_ADSENSE_FAILURE_PREDICTED 0x5D 1215 #define SCSI_ADSENSE_CD_CONTROL_ERR 0x73 1216 1217 // SK = 0x02 1218 #define SCSI_ADSENSE_LUN_NOT_READY 0x04 1219 #define SCSI_ADSENSE_INCOMPATIBLE_MEDIA 0x30 1220 #define SCSI_ADSENSE_INVALID_MEDIA SCSI_ADSENSE_INCOMPATIBLE_MEDIA // for w2k 1221 #define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3A 1222 #define SCSI_ADSENSE_POSITION_ERROR 0x3B 1223 #define SCSI_ADSENSE_NOT_SELF_CONFIGURED 0x3E 1224 1225 1226 // SK = 0x03 1227 #define SCSI_ADSENSE_NO_SEEK 0x02 1228 #define SCSI_ADSENSE_NO_REFERENCE 0x06 1229 #define SCSI_ADSENSE_CD_WRITE_ERROR 0x0C 1230 #define SCSI_ADSENSE_CD_READ_ERROR 0x11 1231 #define SCSI_ADSENSE_TRACK_ERROR 0x14 1232 #define SCSI_ADSENSE_SEEK_ERROR 0x15 1233 #define SCSI_ADSENSE_FORMAT_CORRUPTED 0x31 1234 #define SCSI_ADSENSE_ENCLOSURE_FAILURE 0x34 1235 #define SCSI_ADSENSE_ENCLOSURE_SERVICE 0x35 1236 #define SCSI_ADSENSE_ERASE_ERROR 0x51 1237 #define SCSI_ADSENSE_UNRECOVERED_TOC 0x57 1238 #define SCSI_ADSENSE_SESSION_FIXATION 0x71 1239 //#define SCSI_ADSENSE_CD_CONTROL_ERR 0x73 // redefinition 1240 1241 // SK = 0x04 1242 #define SCSI_ADSENSE_CLEAN_REQUEST 0x00 1243 #define SCSI_ADSENSE_SELECT 0x04 1244 #define SCSI_ADSENSE_COMMUNICATION 0x08 1245 #define SCSI_ADSENSE_LOST_STREAMING 0x09 1246 #define SCSI_ADSENSE_SYNC_ERROR 0x1B 1247 #define SCSI_ADSENSE_MECH_ERROR 0x3B 1248 #define SCSI_ADSENSE_LUN_ERROR 0x3E 1249 #define SCSI_ADSENSE_DIAGNOSTIC 0x40 1250 #define SCSI_ADSENSE_INTERNAL 0x44 1251 #define SCSI_ADSENSE_SOFT_RESET 0x46 1252 #define SCSI_ADSENSE_SCSI_PARITY 0x47 1253 #define SCSI_ADSENSE_CMD_PHASE 0x4A 1254 #define SCSI_ADSENSE_DATA_PHASE 0x4B 1255 #define SCSI_ADSENSE_SELF_CONFIG 0x4C 1256 #define SCSI_ADSENSE_MEDIUM_REMOVAL 0x53 1257 #define SCSI_ADSENSE_VOLTAGE 0x65 1258 1259 // SK = 0x05 1260 #define SCSI_ADSENSE_AUDIO_PLAY 0x00 1261 #define SCSI_ADSENSE_MULTISELECT 0x07 1262 #define SCSI_ADSENSE_INVALID_PARAM_LENGTH 0x1A 1263 #define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20 1264 #define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21 1265 #define SCSI_ADSENSE_INVALID_CDB 0x24 1266 #define SCSI_ADSENSE_INVALID_LUN 0x25 1267 #define SCSI_ADSENSE_INVALID_VALUE 0x26 1268 #define SCSI_ADSENSE_WRITE_PROTECT 0x27 1269 #define SCSI_ADSENSE_CANT_DISCONNECT 0x2B 1270 #define SCSI_ADSENSE_INVALID_CMD_SEQUENCE 0x2C 1271 #define SCSI_ADSENSE_INVALID_SESSION_MODE 0x30 1272 #define SCSI_ADSENSE_SAVE_NOT_SUPPORTED 0x35 1273 #define SCSI_ADSENSE_INVALID_BITS_IN_IDENT_MSG 0x3D 1274 #define SCSI_ADSENSE_MSG_ERROR 0x43 1275 //#define SCSI_ADSENSE_MEDIUM_REMOVAL 0x53 // redefinition 1276 #define SCSI_ADSENSE_SYS_RESOURCE_FAILURE 0x55 1277 #define SCSI_ADSENSE_OUT_OF_SPACE 0x63 1278 #define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64 1279 #define SCSI_ADSENSE_CD_COPY_ERROR 0x6F 1280 #define SCSI_ADSENSE_INCOMPLETE_DATA 0x72 1281 #define SCSI_ADSENSE_VENDOR_UNIQUE 0x80 1282 #define SCSI_ADSENSE_MUSIC_AREA 0xA0 1283 #define SCSI_ADSENSE_DATA_AREA 0xA1 1284 #define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7 1285 1286 // SK = 0x06 1287 #define SCSI_ADSENSE_LOG_OVERFLOW 0x0A 1288 #define SCSI_ADSENSE_MEDIUM_CHANGED 0x28 1289 #define SCSI_ADSENSE_BUS_RESET 0x29 1290 #define SCSI_ADSENSE_PARAM_CHANGE 0x2A 1291 #define SCSI_ADSENSE_CMD_CLEARED_BY_ANOTHER 0x2F 1292 #define SCSI_ADSENSE_MEDIA_STATE 0x3B 1293 #define SCSI_ADSENSE_FUNCTIONALTY_CHANGE 0x3F 1294 #define SCSI_ADSENSE_OPERATOR 0x5A 1295 #define SCSI_ADSENSE_MAX_LOG 0x5B 1296 #define SCSI_ADSENSE_POWER 0x5E 1297 1298 // SK = 0x0B 1299 #define SCSI_ADSENSE_READ_LOST_STREAMING 0x11 1300 #define SCSI_ADSENSE_RESELECT_FAILURE 0x45 1301 #define SCSI_ADSENSE_ERR_MSG_DETECTED 0x48 1302 #define SCSI_ADSENSE_INVALID_ERR_MSG 0x49 1303 #define SCSI_ADSENSE_TEGGED_OVERLAPPED 0x4D 1304 #define SCSI_ADSENSE_OVERLAPPED_ATTEMPT 0x4E 1305 1306 // Additional sense code qualifier 1307 1308 #define SCSI_SENSEQ_NO_SENSE 0x00 1309 1310 // SK:ASC = 02:04 1311 //#define SCSI_SENSEQ_NO_SENSE 0x00 1312 #define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00 1313 #define SCSI_SENSEQ_BECOMING_READY 0x01 1314 #define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02 1315 #define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03 1316 #define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04 1317 #define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07 1318 #define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08 1319 1320 // SK:ASC = 02:30 1321 #define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00 1322 #define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01 1323 #define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02 1324 #define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03 1325 #define SCSI_SENSEQ_WRITE_UNKNOWN_FORMAT 0x04 1326 #define SCSI_SENSEQ_WRITE_INCOMPATIBLE_FORMAT 0x05 1327 #define SCSI_SENSEQ_FORMAT_INCOMPATIBLE_MEDIUM 0x06 1328 #define SCSI_SENSEQ_CLEANING_FAILURE 0x07 1329 1330 // SK:ASC = 02:3A 1331 #define SCSI_SENSEQ_TRAY_CLOSED 0x01 1332 #define SCSI_SENSEQ_TRAY_OPEN 0x02 1333 1334 // SK:ASC = 03:0C 1335 #define SENSEQ_W_RECOVERY_NEEDED 0x07 1336 #define SENSEQ_W_RECOVERY_FAILED 0x08 1337 #define SENSEQ_LOST_STREAMING 0x09 1338 #define SENSEQ_PADDING_BLOCKS_ADDED 0x0A 1339 1340 // SK:ASC = 03:72, 05:72 1341 //#define SCSI_SENSEQ_NO_SENSE 0x00 1342 #define SCSI_SENSEQ_LEAD_IN_ERROR 0x01 1343 #define SCSI_SENSEQ_LEAD_OUT_ERRROR 0x02 1344 #define SCSI_SENSEQ_INCOMPLETE_TRACK 0x03 1345 #define SCSI_SENSEQ_INCOMPLETE_RESERVED_TRACK 0x04 1346 #define SCSI_SENSEQ_NO_MORE_RESERVATION 0x05 1347 1348 // SK:ASC = 04:3E 1349 #define SCSI_SENSEQ_LUN_FAILURE 0x01 1350 #define SCSI_SENSEQ_LUN_TIMEOUT 0x02 1351 1352 // SK:ASC = 05:21 1353 #define SCSI_SENSEQ_ADDR_OUT_OF_RANGE 0x00 1354 #define SCSI_SENSEQ_INVALID_ELEMENT_ADDR 0x01 1355 #define SCSI_SENSEQ_INVALID_WRITE_ADDR 0x02 1356 #define SCSI_SENSEQ_INVALID_WRITE_CROSS_LAYER_JUMP 0x03 1357 1358 // SK:ASC = 05:26 1359 #define SCSI_SENSEQ_PARAM_NOT_SUPPORTED 0x01 1360 #define SCSI_SENSEQ_PARAM_INVALID_VALUE 0x02 1361 #define SCSI_SENSEQ_THRESHOLD_PARAM_NOT_SUPPORTED 0x03 1362 #define SCSI_SENSEQ_INVALID_RELEASE_OF_PERSISTENT_RESERVATION 0x04 1363 1364 // SK:ASC = 05:27 1365 #define SCSI_SENSEQ_HW_PROTECTION 0x01 1366 #define SCSI_SENSEQ_LUN_SOFT_PROTECTION 0x02 1367 #define SCSI_SENSEQ_ASSOCIATED_PROTECTION 0x03 1368 #define SCSI_SENSEQ_PERSIST_PROTECTION 0x04 1369 #define SCSI_SENSEQ_PERMANENT_PROTECTION 0x05 1370 1371 // SK:ASC = 05:2C 1372 #define SCSI_SENSEQ_PROGRAMM_AREA_NOT_EMPTY 0x03 1373 #define SCSI_SENSEQ_PROGRAMM_AREA_EMPTY 0x04 1374 1375 // SK:ASC = 05:30 1376 //#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00 1377 //#define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01 1378 //#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02 1379 //#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03 1380 //#define SCSI_SENSEQ_WRITE_UNKNOWN_FORMAT 0x04 1381 //#define SCSI_SENSEQ_WRITE_INCOMPATIBLE_FORMAT 0x05 1382 //#define SCSI_SENSEQ_FORMAT_INCOMPATIBLE_MEDIUM 0x06 1383 //#define SCSI_SENSEQ_CLEANING_FAILURE 0x07 1384 #define SCSI_SENSEQ_APP_CODE_MISSMATCH 0x08 1385 #define SCSI_SENSEQ_NOT_FIXED_FOR_APPEND 0x09 1386 #define SCSI_SENSEQ_NOT_FORMATTED 0x10 1387 #define SCSI_SENSEQ_UNSUPPORTED_MEDIA_VERSION 0x11 1388 1389 // SK:ASC = 05:6F 1390 #define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00 1391 #define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01 1392 #define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02 1393 #define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03 1394 #define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04 1395 #define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05 1396 1397 // SK:ASC = 06:28 1398 #define SCSI_SENSEQ_IMPORT_OR_EXPERT_ELEMENT_ACCESS 0x01 1399 1400 // SK:ASC = 06:29 1401 #define SCSI_SENSEQ_POWER_ON 0x01 1402 #define SCSI_SENSEQ_SCSI_BUS 0x02 1403 #define SCSI_SENSEQ_BUS_DEVICE_FUNCTION 0x03 1404 #define SCSI_SENSEQ_DEVICE_INTERNAL 0x04 1405 1406 // SK:ASC = 06:2A 1407 #define SCSI_SENSEQ_MODE_PARAMETERS 0x01 1408 #define SCSI_SENSEQ_LOG_PARAMETERS 0x02 1409 #define SCSI_SENSEQ_RESERVATIONS_PREEMPTED 0x03 1410 1411 // SK:ASC = 06:3B 1412 #define SCSI_SENSEQ_DESTINATION_ELEMENT_FULL 0x0D 1413 #define SCSI_SENSEQ_SOURCE_ELEMENT_EMPTY 0x0E 1414 #define SCSI_SENSEQ_END_OF_MEDIUM 0x0F 1415 #define SCSI_SENSEQ_MAGAZINE_NOT_ACCESSIBLE 0x11 1416 #define SCSI_SENSEQ_MAGAZINE_REMOVED 0x12 1417 #define SCSI_SENSEQ_MAGAZINE_INSERTED 0x13 1418 #define SCSI_SENSEQ_MAGAZINE_LOCKED 0x14 1419 #define SCSI_SENSEQ_MAGAZINE_UNLOCKED 0x15 1420 1421 // SK:ASC = 06:3F 1422 #define SCSI_SENSEQ_MICROCODE 0x01 1423 #define SCSI_SENSEQ_OPERATION_DEFINITION 0x02 1424 #define SCSI_SENSEQ_INQUIRY_DATA 0x03 1425 1426 // SK:ASC = 06:5A 1427 #define SCSI_SENSEQ_MEDIUM_CHANGE_REQ 0x01 1428 #define SCSI_SENSEQ_W_PROTECT_SELECTED 0x02 1429 #define SCSI_SENSEQ_W_PROTECT_PERMITED 0x03 1430 1431 // SK:ASC = 06:5E 1432 #define SCSI_SENSEQ_LOW_POWER_COND 0x00 1433 #define SCSI_SENSEQ_IDLE_BY_TIMER 0x01 1434 #define SCSI_SENSEQ_STANDBY_BY_TIMER 0x02 1435 #define SCSI_SENSEQ_IDLE_BY_CMD 0x03 1436 #define SCSI_SENSEQ_STANDBY_BY_CMD 0x04 1437 1438 #define SCSI_SENSEQ_FILEMARK_DETECTED 0x01 1439 #define SCSI_SENSEQ_SETMARK_DETECTED 0x03 1440 #define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02 1441 #define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04 1442 1443 // SK:ASC = 0B:00 1444 #define SCSI_SENSEQ_IO_TERMINATED 0x06 1445 1446 1447 // SCSI IO Device Control Codes 1448 1449 #define FILE_DEVICE_SCSI 0x0000001b 1450 1451 #define IOCTL_SCSI_EXECUTE_IN ((FILE_DEVICE_SCSI << 16) + 0x0011) 1452 #define IOCTL_SCSI_EXECUTE_OUT ((FILE_DEVICE_SCSI << 16) + 0x0012) 1453 #define IOCTL_SCSI_EXECUTE_NONE ((FILE_DEVICE_SCSI << 16) + 0x0013) 1454 1455 // SMART support in atapi 1456 1457 #define IOCTL_SCSI_MINIPORT_SMART_VERSION ((FILE_DEVICE_SCSI << 16) + 0x0500) 1458 #define IOCTL_SCSI_MINIPORT_IDENTIFY ((FILE_DEVICE_SCSI << 16) + 0x0501) 1459 #define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS ((FILE_DEVICE_SCSI << 16) + 0x0502) 1460 #define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS ((FILE_DEVICE_SCSI << 16) + 0x0503) 1461 #define IOCTL_SCSI_MINIPORT_ENABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0504) 1462 #define IOCTL_SCSI_MINIPORT_DISABLE_SMART ((FILE_DEVICE_SCSI << 16) + 0x0505) 1463 #define IOCTL_SCSI_MINIPORT_RETURN_STATUS ((FILE_DEVICE_SCSI << 16) + 0x0506) 1464 #define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE ((FILE_DEVICE_SCSI << 16) + 0x0507) 1465 #define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES ((FILE_DEVICE_SCSI << 16) + 0x0508) 1466 #define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS ((FILE_DEVICE_SCSI << 16) + 0x0509) 1467 1468 // Read Capacity Data - returned in Big Endian format 1469 1470 typedef struct _READ_CAPACITY_DATA { 1471 ULONG LogicalBlockAddress; 1472 ULONG BytesPerBlock; 1473 } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA; 1474 1475 typedef struct _CD_SECTOR_HEADER { 1476 UCHAR MSF[3]; 1477 1478 // See WParam_SubHdr_xxx 1479 1480 /* 1481 #define WParam_SubHdr_Mode_Mask 0x03 1482 #define WParam_SubHdr_Mode0 0x00 1483 #define WParam_SubHdr_Mode1 0x01 1484 #define WParam_SubHdr_Mode2 0x02 1485 #define WParam_SubHdr_Format_Mask 0xe0 1486 #define WParam_SubHdr_Format_UserData 0x00 1487 #define WParam_SubHdr_Format_RunIn4 0x20 1488 #define WParam_SubHdr_Format_RunIn3 0x40 1489 #define WParam_SubHdr_Format_RunIn2 0x60 1490 #define WParam_SubHdr_Format_RunIn1 0x80 1491 #define WParam_SubHdr_Format_Link 0xa0 1492 #define WParam_SubHdr_Format_RunOut2 0xc0 1493 #define WParam_SubHdr_Format_RunOut1 0xe0 1494 */ 1495 union { 1496 UCHAR Flags; 1497 struct { 1498 UCHAR Mode : 2; 1499 UCHAR Reserved : 3; 1500 UCHAR Format : 3; 1501 } Fields; 1502 } Mode; 1503 } CD_SECTOR_HEADER, *PCD_SECTOR_HEADER; 1504 1505 // CD ROM Read Table Of Contents (TOC) structures 1506 // Format 0 - Get table of contents 1507 1508 #define TocControl_TrkMode_Mask WParam_TrkMode_Mask 1509 #define TocControl_TrkMode_Audio WParam_TrkMode_Audio 1510 #define TocControl_TrkMode_Audio_PreEmph WParam_TrkMode_Audio_PreEmph 1511 #define TocControl_TrkMode_Data WParam_TrkMode_Data 1512 #define TocControl_TrkMode_IncrData WParam_TrkMode_IncrData 1513 #define TocControl_TrkMode_QAudio_PreEmph WParam_TrkMode_QAudio_PreEmph 1514 #define TocControl_TrkMode_AllowCpy WParam_TrkMode_AllowCpy 1515 1516 typedef struct _TOC_TRACK_INFO { 1517 UCHAR Reserved; 1518 UCHAR Control : 4; 1519 UCHAR Adr : 4; 1520 UCHAR TrackNum; 1521 UCHAR Reserved1; 1522 UCHAR LBA[4]; 1523 } TOC_TRACK_INFO, *PTOC_TRACK_INFO; 1524 1525 typedef struct _READ_TOC_HEADER { 1526 UCHAR Length[2]; 1527 UCHAR First_TrackSes; 1528 UCHAR Last_TrackSes; 1529 } READ_TOC_HEADER, *PREAD_TOC_HEADER; 1530 1531 #define TOC_LastTrack_ID 0xAA 1532 1533 typedef struct _READ_TOC_TOC { 1534 READ_TOC_HEADER Tracks; 1535 TOC_TRACK_INFO TrackData[MAXIMUM_NUMBER_OF_TRACKS+1]; 1536 } READ_TOC_TOC, *PREAD_TOC_TOC; 1537 1538 // Format 1 - Session Info 1539 1540 typedef struct _READ_TOC_SES { 1541 READ_TOC_HEADER Sessions; 1542 TOC_TRACK_INFO LastSes_1stTrack; // First Track Number In Last Complete Session 1543 } READ_TOC_SES, *PREAD_TOC_SES; 1544 1545 // Format 2,3 - Full TOC, PMA 1546 1547 #define TOC_CTL_Normal 0x00 1548 //#define TOC_CTL_MRW 0x01 1549 #define TOC_CTL_MRWTrackInfo 0x06 1550 #define TOC_CTL_MRWLastSes 0x07 1551 1552 // Ctl = 0 1553 #define TOC_ADR_TrackInfo 0x01 1554 #define TOC_ADR_Internal 0x05 1555 // ?? // Ctl = 1 1556 1557 // ADR = 1 1558 #define POINT_StartPositionOfTrack_Min 0x01 1559 #define POINT_StartPositionOfTrack_Max 0x63 1560 #define POINT_FirstTrackNum 0xA0 1561 #define POINT_LastTrackNum 0xA1 1562 #define POINT_StartPositionOfLeadOut 0xA2 1563 // ADR = 5 1564 #define POINT_SkipInterval_Min 0x01 1565 #define POINT_SkipInterval_Max 0x40 1566 #define POINT_StartPositionOfNextProgramArea 0xB0 1567 #define POINT_NumOfSkips 0xB1 1568 #define POINT_SkipTrackAssignmet_Min 0xB2 1569 #define POINT_SkipTrackAssignmet_Max 0xB4 1570 #define POINT_StartPositionOfFirstLeadIn 0xC0 1571 #define POINT_CopyOfAdditionalAreaInATIP 0xC1 1572 // ADR = 6, Control = 1 1573 // POINT 0x01 - 0x63, 0xA0 - 0xA2 are treated like for ADR = 1 1574 // rest - like for ADR = 5 1575 1576 // ADR = 7, Control = 1 1577 // POINT 0x01 - 0x63 are treated as FirstTrackInLastSession 1578 1579 typedef struct _TOC_SES_INFO { 1580 UCHAR SesNumber; 1581 UCHAR Control : 4; 1582 UCHAR Adr : 4; 1583 UCHAR TNO; 1584 UCHAR POINT; 1585 1586 union { 1587 1588 struct { 1589 UCHAR MSF[3]; 1590 UCHAR Reserved; 1591 UCHAR P_MSF[3]; 1592 } GENERIC; 1593 1594 // ADR = 1 1595 // or 1596 // ADR = 6, Control = 1 1597 // or 1598 // ADR = 7, Control = 1: 1599 1600 //0x01 - 0x63 1601 struct { 1602 UCHAR ATIME[3]; 1603 UCHAR Zero; 1604 UCHAR MSF[3]; 1605 } StartPositionOfTrack; 1606 1607 // ADR = 1 1608 // or 1609 // ADR = 6, Control = 1: 1610 1611 //0xA0 1612 #define FullTOC_DiscType_CDDA_or_M1 WParam_SesFmt_CdRom // 0x00 1613 #define FullTOC_DiscType_CDI WParam_SesFmt_CdI // 0x10 1614 #define FullTOC_DiscType_CDXA_M2 WParam_SesFmt_CdRomXa // 0x20 1615 1616 struct { 1617 UCHAR ATIME[3]; 1618 UCHAR Zero; 1619 UCHAR FirstTrackNum; 1620 UCHAR DiscType; 1621 UCHAR Zero1; 1622 } FirstTrackNum; 1623 1624 //0xA1 1625 struct { 1626 UCHAR ATIME[3]; 1627 UCHAR Zero; 1628 UCHAR LastTrackNum; 1629 UCHAR Zero1[2]; 1630 } LastTrackNum; 1631 1632 //0xA2 1633 struct { 1634 UCHAR ATIME[3]; 1635 UCHAR Zero; 1636 UCHAR MSF[3]; 1637 } StartPositionOfLeadOut; 1638 1639 // ADR = 5: 1640 1641 //0x01 - 0x40 1642 struct { 1643 UCHAR End_MSF[3]; 1644 UCHAR Reserved; 1645 UCHAR Start_MSF[3]; 1646 } SkipInterval; 1647 1648 // ADR = 5 1649 // or 1650 // ADR = 6, Control = 1: 1651 1652 //0xB0 1653 struct { 1654 UCHAR Program_MSF[3]; 1655 UCHAR NumOfPointers_M5; 1656 UCHAR MaxLeadOut_MSF[3]; 1657 } StartPositionOfNextProgramArea; 1658 1659 //0xB1 1660 struct { 1661 UCHAR Zero[4]; 1662 UCHAR Intervals; 1663 UCHAR Tracks; 1664 UCHAR Zero1; 1665 } NumOfSkips; 1666 1667 //0xB2 - 0xB4 1668 struct { 1669 UCHAR SkipNum[7]; 1670 } SkipTrackAsignment; 1671 1672 //0xC0 1673 struct { 1674 UCHAR OptimumRecordingPower; 1675 UCHAR SpecInfoATIP[3]; 1676 UCHAR LeadIn_MSF[3]; 1677 } StartPositionOfFirstLeadIn; 1678 1679 //0xC1 1680 struct { 1681 UCHAR Bytes[7]; 1682 } AdditionalAreaInATIP; 1683 1684 } Params; 1685 } TOC_SES_INFO, *PTOC_SES_INFO; 1686 1687 typedef struct _READ_TOC_FULL_TOC { 1688 READ_TOC_HEADER Sessions; 1689 TOC_SES_INFO SessionData[MAXIMUM_NUMBER_OF_SESSIONS]; 1690 } READ_TOC_FULL_TOC, *PREAD_TOC_FULL_TOC; 1691 1692 typedef READ_TOC_FULL_TOC READ_TOC_PMA; 1693 typedef PREAD_TOC_FULL_TOC PREAD_TOC_PMA; 1694 1695 // Format 4 - ATIP 1696 1697 typedef struct _READ_TOC_ATIP { 1698 UCHAR Length[2]; 1699 UCHAR Reserved[2]; 1700 1701 #define ATIP_SpeedRef_Mask 0x07 1702 #define ATIP_SpeedRef_2X 0x01 1703 #define ATIP_WritingPower_Mask 0x07 1704 1705 union { 1706 UCHAR Flags; 1707 struct { 1708 UCHAR SpeedRef: 3; 1709 UCHAR Reserved: 1; 1710 UCHAR WritingPower: 3; 1711 UCHAR One: 1; 1712 } Fields; 1713 } Flags1; 1714 1715 #define ATIP_URU 0x40 1716 1717 union { 1718 UCHAR Flags; 1719 struct { 1720 UCHAR Reserved: 6; 1721 UCHAR URU: 1; 1722 UCHAR Zero: 1; 1723 } Fields; 1724 } Flags2; 1725 1726 #define ATIP_A1 0x01 // 16-18 are valid 1727 #define ATIP_A2 0x02 // 20-22 are valid 1728 #define ATIP_A3 0x04 // 24-26 are valid 1729 #define ATIP_SubType_Mask 0x38 // shall be set to zero 1730 #define ATIP_Type_Mask 0x40 1731 #define ATIP_Type_CDR 0x00 1732 #define ATIP_Type_CDRW 0x40 1733 1734 union { 1735 UCHAR Flags; 1736 struct { 1737 UCHAR A1: 1; 1738 UCHAR A2: 1; 1739 UCHAR A3: 1; 1740 UCHAR SubType: 3; 1741 UCHAR Type: 1; 1742 UCHAR One: 1; 1743 } Fields; 1744 } DiscType; 1745 1746 UCHAR Reserved0; 1747 UCHAR LeadIn_MSF[3]; 1748 UCHAR Reserved1; 1749 UCHAR LeadOut_MSF[3]; 1750 UCHAR Reserved2; 1751 1752 #define ATIP_MinSpeedCVL_Mask 0x70 1753 #define ATIP_MinSpeedCVL_2X 0x10 1754 #define ATIP_MaxSpeedCVL_Mask 0x0f 1755 #define ATIP_MaxSpeedCVL_2X 0x01 1756 #define ATIP_MaxSpeedCVL_4X 0x02 1757 #define ATIP_MaxSpeedCVL_6X 0x03 1758 #define ATIP_MaxSpeedCVL_8X 0x04 1759 1760 union { 1761 UCHAR Flags; 1762 struct { 1763 UCHAR MaxSpeedCVL: 4; 1764 UCHAR MinSpeedCVL: 3; 1765 UCHAR Zero: 1; 1766 } Fields; 1767 } Speed; 1768 1769 #define ATIP_Power_Y_Mask 0x0e 1770 #define ATIP_Power_P_Mask 0x70 1771 1772 union { 1773 UCHAR Flags; 1774 struct { 1775 UCHAR Reserved: 1; 1776 UCHAR Y_value: 3; 1777 UCHAR P_factor: 3; 1778 UCHAR Zero: 1; 1779 } Fields; 1780 } Power; 1781 1782 #define ATIP_PW_ratio_Mask 0x70 1783 1784 union { 1785 UCHAR Flags; 1786 struct { 1787 UCHAR Reserved: 4; 1788 UCHAR P_W_ratio: 3; 1789 UCHAR Zero: 1; 1790 } Fields; 1791 } ErasePower; 1792 1793 UCHAR Reserved3; 1794 UCHAR A1_value[3]; 1795 UCHAR Reserved4; 1796 UCHAR A2_value[3]; 1797 UCHAR Reserved5; 1798 UCHAR A3_value[3]; 1799 1800 } READ_TOC_ATIP, *PREAD_TOC_ATIP; 1801 1802 // Format 5 - CD-TEXT 1803 1804 typedef struct _CD_TEXT_PACK_DATA { 1805 1806 #define CdText_ID1_Title 0x80 // ID2 = 0 - Album, ID2 = 1-63 - Track 1807 #define CdText_ID1_Performer 0x81 1808 #define CdText_ID1_Songwriter 0x82 1809 #define CdText_ID1_Composer 0x83 1810 #define CdText_ID1_Arranger 0x84 1811 #define CdText_ID1_Message 0x85 1812 #define CdText_ID1_DiscID 0x86 1813 #define CdText_ID1_GenreInfo 0x87 1814 #define CdText_ID1_TOC 0x88 1815 #define CdText_ID1_TOC2 0x89 1816 #define CdText_ID1_Special 0x8D 1817 #define CdText_ID1_UPC_EAN_ISRC 0x8E 1818 #define CdText_ID1_BlockSizeInfo 0x8F 1819 1820 UCHAR ID1; 1821 UCHAR ID2; 1822 UCHAR ID3; 1823 1824 #define CdText_CharPos_Mask 0x0f 1825 #define CdText_BlkNum_Mask 0x70 1826 1827 union { 1828 UCHAR Flags; 1829 struct { 1830 UCHAR CharPos: 4; 1831 UCHAR BlkNum: 3; 1832 UCHAR DBCC: 1; // used to indicate Double Byte text encoding (Unicode ?) 1833 } Fields; 1834 } BlkNum_CharPos; 1835 1836 UCHAR TextData[12]; 1837 UCHAR CRC[2]; 1838 } CD_TEXT_PACK_DATA, *PCD_TEXT_PACK_DATA; 1839 1840 typedef struct _READ_TOC_CD_TEXT { 1841 UCHAR Length[2]; 1842 UCHAR Reserved[2]; 1843 CD_TEXT_PACK_DATA Chunk0; 1844 } READ_TOC_CD_TEXT, *PREAD_TOC_CD_TEXT; 1845 1846 // Read header 1847 1848 #define ReadHeader_CdMode_Audio 0x00 1849 #define ReadHeader_CdMode_Mode1 0x01 1850 #define ReadHeader_CdMode_Mode2 0x02 1851 1852 typedef struct _READ_HEADER_LBA { 1853 UCHAR CdDataMode; 1854 UCHAR Reserved[3]; 1855 UCHAR LBA[4]; 1856 } READ_HEADER_LBA, *PREAD_HEADER_LBA; 1857 1858 typedef struct _READ_HEADER_MSF { 1859 UCHAR CdDataMode; 1860 UCHAR Reserved[4]; 1861 UCHAR MSF[3]; 1862 } READ_HEADER_MSF, *PREAD_HEADER_MSF; 1863 1864 1865 // OPC block 1866 1867 typedef struct _OPC_INFO_BLOCK { 1868 UCHAR Speed[2]; 1869 UCHAR OpcValue[6]; 1870 } OPC_INFO_BLOCK, *POPC_INFO_BLOCK; 1871 1872 // Buffer Capacity format 1873 1874 typedef struct _BUFFER_CAPACITY_BLOCK { 1875 UCHAR DataLength[2]; 1876 UCHAR Reserved0[2]; 1877 UCHAR BufferLength[4]; 1878 UCHAR BlankBufferLength[4]; 1879 } BUFFER_CAPACITY_BLOCK, *PBUFFER_CAPACITY_BLOCK; 1880 1881 //#ifndef WITHOUT_FORMATTER 1882 // Format Unit structures 1883 1884 typedef struct _FORMAT_LIST_HEADER { 1885 UCHAR Reserved0; 1886 1887 #define FormatHeader_VS 0x01 1888 #define FormatHeader_Immed 0x02 1889 #define FormatHeader_DSP 0x04 1890 #define FormatHeader_IP 0x08 1891 #define FormatHeader_STPF 0x10 1892 #define FormatHeader_DCRT 0x20 1893 #define FormatHeader_DPRY 0x40 1894 #define FormatHeader_FOV 0x80 1895 1896 union { 1897 UCHAR Flags; 1898 struct { 1899 UCHAR VS: 1; 1900 UCHAR Immed: 1; 1901 UCHAR DSP: 1; 1902 UCHAR IP: 1; 1903 UCHAR STPF: 1; 1904 UCHAR DCRT: 1; 1905 UCHAR DPRY: 1; 1906 UCHAR FOV: 1; 1907 } Fields; 1908 } Flags; 1909 UCHAR FormatDescriptorLength[2]; // =0x0008 1910 } FORMAT_LIST_HEADER, *PFORMAT_LIST_HEADER; 1911 1912 typedef struct _CDRW_FORMAT_DESCRIPTOR { 1913 1914 #define FormatDesc_Grow 0x40 1915 #define FormatDesc_Ses 0x80 1916 1917 union { 1918 UCHAR Flags; 1919 struct { 1920 UCHAR Reserved0: 6; 1921 UCHAR Grow: 1; 1922 UCHAR Ses: 1; 1923 } Fields; 1924 } Flags; 1925 UCHAR Reserved1[3]; 1926 UCHAR FormatSize[4]; 1927 } CDRW_FORMAT_DESCRIPTOR, *PCDRW_FORMAT_DESCRIPTOR; 1928 1929 typedef struct _DVD_FORMAT_DESCRIPTOR { 1930 1931 UCHAR NumOfBlocks[4]; 1932 1933 #define DvdFormatType_Full 0x00 1934 #define DvdFormatType_SpareExpansion 0x01 1935 #define DvdFormatType_ZoneReformat 0x04 1936 #define DvdFormatType_ZoneFormat 0x05 1937 #define DvdFormatType_CD_DVD_RW_Full 0x10 1938 #define DvdFormatType_CD_DVD_RW_GrowSes 0x11 1939 #define DvdFormatType_CD_DVD_RW_AddSes 0x12 1940 #define DvdFormatType_DVD_RW_QuickGrowSes 0x13 1941 #define DvdFormatType_DVD_RW_QuickAddSes 0x14 1942 #define DvdFormatType_DVD_RW_Quick 0x15 1943 #define DvdFormatType_DVD_pRW_Full_3Gb 0x20 // obsolete 1944 #define DvdFormatType_CD_MRW_Full 0x24 1945 #define DvdFormatType_DVD_pRW_basic 0x26 1946 #define DvdFormatType_DDCD_RW_Quick 0x28 1947 #define DvdFormatType_BDRE_Full_Spare 0x30 1948 #define DvdFormatType_BDRE_Full 0x31 1949 #define DvdFormatType_BDR_Full_Spare 0x32 1950 1951 #define DvdFormatSubType_BDRE_QuickReformat 0x00 1952 #define DvdFormatSubType_BDRE_NoCert 0x01 1953 #define DvdFormatSubType_BDRE_FullCert 0x02 1954 #define DvdFormatSubType_BDRE_QuickCert 0x03 1955 1956 #define DvdFormatSubType_BDR_SRMpPOW 0x00 1957 #define DvdFormatSubType_BDR_SRM_POW 0x01 1958 #define DvdFormatSubType_BDR_RRM 0x02 1959 1960 union { 1961 UCHAR Flags; 1962 struct { 1963 UCHAR FormatSubType: 2; 1964 UCHAR FormatType: 6; 1965 } Fields; 1966 } Flags; 1967 1968 /* 1969 #define FormatUnit_MRW_SetNew(desc) { desc->TypeDependent[0] = 0; \ 1970 desc->TypeDependent[1] = 0; \ 1971 desc->TypeDependent[2] = 0; } 1972 1973 #define FormatUnit_MRW_SetRestart(desc) { desc->TypeDependent[0] = 0; \ 1974 desc->TypeDependent[1] = 0; \ 1975 desc->TypeDependent[2] = 1; } 1976 */ 1977 union { 1978 UCHAR BlockSize [3]; 1979 UCHAR TypeDependent [3]; 1980 struct { 1981 UCHAR Reserved1 [2]; 1982 UCHAR Restart : 1; 1983 UCHAR QuickStart : 1; // MMC-5 1984 UCHAR Reserved2 : 6; 1985 } MRW; 1986 }; 1987 1988 1989 } DVD_FORMAT_DESCRIPTOR, *PDVD_FORMAT_DESCRIPTOR; 1990 1991 typedef struct _FORMAT_UNIT_PARAMETER_LIST { 1992 FORMAT_LIST_HEADER Header; 1993 union { 1994 struct { 1995 UCHAR InitPatternDescr[4]; 1996 CDRW_FORMAT_DESCRIPTOR CdFormatDescr; 1997 }; 1998 DVD_FORMAT_DESCRIPTOR DvdFormatDescr; 1999 }; 2000 } FORMAT_UNIT_PARAMETER_LIST, *PFORMAT_UNIT_PARAMETER_LIST; 2001 2002 // define Read Format Capacities info blocks 2003 2004 typedef struct _CAPACITY_LIST_HEADER { 2005 UCHAR Reserved[3]; 2006 UCHAR Length; 2007 } CAPACITY_LIST_HEADER, *PCAPACITY_LIST_HEADER; 2008 2009 typedef struct _FORMATTABLE_CAPACITY_DESCRIPTOR { 2010 UCHAR NumOfBlocks [4]; 2011 union { 2012 UCHAR Flags; 2013 struct { 2014 2015 #define FormatCapcity_Descr_Reserved 0x00 2016 #define FormatCapcity_Descr_Unformatted 0x01 2017 #define FormatCapcity_Descr_Formatted 0x02 2018 #define FormatCapcity_Descr_NoMedia 0x03 2019 2020 // valid for the 1st descriptor only 2021 UCHAR DescType: 2; 2022 2023 // valid for all descriptors except the 1st one 2024 UCHAR FormatType: 6; 2025 2026 } Fields; 2027 } Flags; 2028 union { 2029 UCHAR BlockSize [3]; 2030 UCHAR TypeDependent [3]; 2031 }; 2032 } FORMATTABLE_CAPACITY_DESCRIPTOR, *PFORMATTABLE_CAPACITY_DESCRIPTOR; 2033 2034 typedef struct _FORMAT_CAPACITIES_DATA { 2035 CAPACITY_LIST_HEADER Header; 2036 2037 #define FormatCap_CurMaxDescrOffset 0x00 2038 #define FormatCap_FormatDescrOffset(i) (i+1) 2039 2040 FORMATTABLE_CAPACITY_DESCRIPTOR Descriptors[1]; 2041 } FORMAT_CAPACITIES_DATA, *PFORMAT_CAPACITIES_DATA; 2042 2043 //#endif //WITHOUT_FORMATTER 2044 2045 // Define Event Status info blocks 2046 2047 typedef struct _EVENT_STAT_HEADER { 2048 UCHAR DataLength[2]; 2049 2050 #define EventRetStat_Class_Mask 0x07 2051 #define EventRetStat_Class_OpChange 0x01 2052 #define EventRetStat_Class_PM 0x02 2053 #define EventRetStat_Class_ExternReq 0x03 2054 #define EventRetStat_Class_Media 0x04 2055 #define EventRetStat_Class_MultInitiators 0x05 2056 #define EventRetStat_Class_DevBusy 0x06 2057 #define EventRetStat_NEA 0x80 2058 2059 union { 2060 UCHAR Flags; 2061 struct { 2062 UCHAR Class: 3; 2063 UCHAR Reserved0: 4; 2064 UCHAR NEA: 1; 2065 } Fields; 2066 } Flags; 2067 2068 UCHAR SupportedClasses; // see command format 2069 2070 } EVENT_STAT_HEADER, *PEVENT_STAT_HEADER; 2071 2072 typedef struct _EVENT_STAT_OPERATIONAL_BLOCK { 2073 2074 EVENT_STAT_HEADER Header; 2075 2076 #define EventStat_OpEvent_Mask 0x0f 2077 2078 union { 2079 UCHAR Flags; 2080 struct { 2081 UCHAR OpEvent : 4; 2082 UCHAR Reserved0: 4; 2083 } Fields; 2084 } Byte0; 2085 2086 #define EventStat_OpStat_Mask 0x0f 2087 #define EventStat_OpStat_Ready 0x00 2088 #define EventStat_OpStat_TempBusy 0x01 2089 #define EventStat_OpStat_Busy 0x02 2090 2091 union { 2092 UCHAR Flags; 2093 struct { 2094 UCHAR OpStatus : 4; 2095 UCHAR Reserved0 : 3; 2096 UCHAR PersistentPrevent: 1; 2097 } Fields; 2098 } Byte1; 2099 2100 #define EventStat_OpReport_NoChg 0x00 2101 #define EventStat_OpReport_Change 0x01 2102 #define EventStat_OpReport_AddChg 0x02 2103 #define EventStat_OpReport_Reset 0x03 2104 #define EventStat_OpReport_FirmwareChg 0x04 // microcode change 2105 #define EventStat_OpReport_InquiryChg 0x05 2106 #define EventStat_OpReport_CtrlReq 0x06 2107 #define EventStat_OpReport_CtrlRelease 0x07 2108 2109 UCHAR OpReport[2]; 2110 2111 } EVENT_STAT_OPERATIONAL_BLOCK, *PEVENT_STAT_OPERATIONAL_BLOCK; 2112 2113 typedef struct _EVENT_STAT_PM_BLOCK { 2114 2115 EVENT_STAT_HEADER Header; 2116 2117 #define EventStat_PowerEvent_Mask 0x0f 2118 #define EventStat_PowerEvent_NoChg 0x00 2119 #define EventStat_PowerEvent_ChgOK 0x01 2120 #define EventStat_PowerEvent_ChgFail 0x02 2121 2122 union { 2123 UCHAR Flags; 2124 struct { 2125 UCHAR PowerEvent : 4; 2126 UCHAR Reserved0 : 4; 2127 } Fields; 2128 } Byte0; 2129 2130 #define EventStat_PowerStat_Mask 0x0f 2131 #define EventStat_PowerStat_Active 0x01 2132 #define EventStat_PowerStat_Idle 0x02 2133 #define EventStat_PowerStat_Standby 0x03 2134 #define EventStat_PowerStat_Sleep 0x04 2135 2136 union { 2137 UCHAR Flags; 2138 struct { 2139 UCHAR PowerStatus: 4; 2140 UCHAR Reserved0 : 4; 2141 } Fields; 2142 } Byte1; 2143 2144 UCHAR Reserved0[2]; 2145 2146 } EVENT_STAT_PM_BLOCK, *PEVENT_STAT_PM_BLOCK; 2147 2148 typedef struct _EVENT_STAT_EXT_REQ_BLOCK { 2149 2150 EVENT_STAT_HEADER Header; 2151 2152 #define EventStat_ExtrnReqEvent_Mask 0x0f 2153 #define EventStat_ExtrnReqEvent_None 0x00 2154 #define EventStat_ExtrnReqEvent_KeyDown 0x01 2155 #define EventStat_ExtrnReqEvent_KeyUp 0x02 2156 #define EventStat_ExtrnReqEvent_ExtrnReq 0x03 2157 2158 union { 2159 UCHAR Flags; 2160 struct { 2161 UCHAR ExtrnReqEvent : 4; 2162 UCHAR Reserved0 : 4; 2163 } Fields; 2164 } Byte0; 2165 2166 #define EventStat_ExtrnReqStatus_Mask 0x0f 2167 #define EventStat_ExtrnReqStatus_Ready 0x00 2168 #define EventStat_ExtrnReqStatus_OtherPrevent 0x01 2169 2170 union { 2171 UCHAR Flags; 2172 struct { 2173 UCHAR ExtrnReqStatus : 4; 2174 UCHAR Reserved0 : 3; 2175 UCHAR PersistentPrevent : 1; 2176 } Fields; 2177 } Byte1; 2178 2179 #define EventStat_ExtrnReq_None 0x000 2180 #define EventStat_ExtrnReq_Overrun 0x001 2181 #define EventStat_ExtrnReq_Play 0x101 2182 #define EventStat_ExtrnReq_Rewind 0x102 2183 #define EventStat_ExtrnReq_FastFwd 0x103 2184 #define EventStat_ExtrnReq_Pause 0x104 2185 #define EventStat_ExtrnReq_Stop 0x106 2186 #define EventStat_ExtrnReq_MinASCII 0x200 2187 #define EventStat_ExtrnReq_MaxASCII 0x2ff 2188 2189 UCHAR ExternalReq[2]; 2190 2191 } EVENT_STAT_EXT_REQ_BLOCK, *PEVENT_STAT_EXT_REQ_BLOCK; 2192 2193 typedef struct _EVENT_STAT_MEDIA_BLOCK { 2194 2195 EVENT_STAT_HEADER Header; 2196 2197 #define EventStat_MediaEvent_Mask 0x0f 2198 #define EventStat_MediaEvent_None 0x00 2199 #define EventStat_MediaEvent_EjectReq 0x01 2200 #define EventStat_MediaEvent_New 0x02 2201 #define EventStat_MediaEvent_Removal 0x03 2202 #define EventStat_MediaEvent_Chg 0x04 2203 #define EventStat_MediaEvent_BGFormatOk 0x05 2204 #define EventStat_MediaEvent_BGFormatRst 0x06 2205 2206 union { 2207 UCHAR Flags; 2208 struct { 2209 UCHAR MediaEvent : 4; 2210 UCHAR Reserved0 : 4; 2211 } Fields; 2212 } Byte0; 2213 2214 #define EventStat_MediaStat_DoorOpen 0x01 2215 #define EventStat_MediaStat_Present 0x02 2216 2217 union { 2218 UCHAR Flags; 2219 struct { 2220 UCHAR DoorOpen : 1; 2221 UCHAR Present : 1; 2222 UCHAR Reserved0 : 6; 2223 } Fields; 2224 } Byte1; 2225 2226 UCHAR StartSlot; 2227 UCHAR EndSlot; 2228 2229 } EVENT_STAT_MEDIA_BLOCK, *PEVENT_STAT_MEDIA_BLOCK; 2230 2231 typedef struct _EVENT_STAT_DEV_BUSY_BLOCK { 2232 2233 EVENT_STAT_HEADER Header; 2234 2235 #define EventStat_BusyEvent_Mask 0x0f 2236 #define EventStat_BusyEvent_None 0x00 2237 #define EventStat_BusyEvent_Busy 0x01 2238 2239 union { 2240 UCHAR Flags; 2241 struct { 2242 UCHAR BusyEvent : 4; 2243 UCHAR Reserved0 : 4; 2244 } Fields; 2245 } Byte0; 2246 2247 #define EventStat_BusyStat_Mask 0x0f 2248 #define EventStat_BusyStat_NoEvent 0x00 2249 #define EventStat_BusyStat_Power 0x01 2250 #define EventStat_BusyStat_Immed 0x02 2251 #define EventStat_BusyStat_Deferred 0x03 2252 2253 union { 2254 UCHAR Flags; 2255 struct { 2256 UCHAR BusyStatus: 4; 2257 UCHAR Reserved0 : 4; 2258 } Fields; 2259 } Byte1; 2260 2261 UCHAR Time[2]; 2262 2263 } EVENT_STAT_DEV_BUSY_BLOCK, *PEVENT_STAT_DEV_BUSY_BLOCK; 2264 2265 // Define mode disc info block. 2266 2267 typedef struct _DISC_INFO_BLOCK { // 2268 UCHAR DataLength [2]; 2269 2270 #define DiscInfo_Disk_Mask 0x03 2271 #define DiscInfo_Disk_Empty 0x00 2272 #define DiscInfo_Disk_Appendable 0x01 2273 #define DiscInfo_Disk_Complete 0x02 2274 #define DiscInfo_Disk_OtherRW 0x03 2275 2276 #define DiscInfo_Ses_Mask 0x0C 2277 #define DiscInfo_Ses_Empty 0x00 2278 #define DiscInfo_Ses_Incomplete 0x04 2279 #define DiscInfo_Ses_Complete 0x0C 2280 2281 #define DiscInfo_Disk_Erasable 0x10 2282 2283 union { 2284 UCHAR Flags; 2285 struct { 2286 UCHAR DiscStat : 2; 2287 UCHAR LastSesStat : 2; 2288 UCHAR Erasable : 1; 2289 UCHAR DiscInfoType : 3; 2290 } Fields; 2291 } DiscStat; 2292 2293 UCHAR FirstTrackNum; 2294 UCHAR NumOfSes; 2295 UCHAR FirstTrackNumLastSes; 2296 UCHAR LastTrackNumLastSes; 2297 2298 #define DiscInfo_BGF_Mask 0x03 2299 #define DiscInfo_BGF_None 0x00 2300 #define DiscInfo_BGF_Interrupted 0x01 // \ indicates that disk is MRW or Basic-formatted 2301 #define DiscInfo_BGF_InProgress 0x02 // } note, you should issue READ_TOC 2302 #define DiscInfo_BGF_Complete 0x03 // / to check MRW state on old drives 2303 2304 #define DiscInfo_DBit 0x04 // MRW structures may be not current (dirty) 2305 #define DiscInfo_DAC_V 0x10 // Disk Appclication Code valid 2306 #define DiscInfo_URU 0x20 // unrestricted use (1 for CD/DVD, 0 for DB) 2307 #define DiscInfo_DBC_V 0x40 // Disk Bar Code valid 2308 #define DiscInfo_DID_V 0x80 // DiskID valid 2309 2310 union { 2311 UCHAR Flags; 2312 struct { 2313 UCHAR BGFmtStatus: 2; 2314 UCHAR DBit: 1; 2315 UCHAR Reserved1: 1; 2316 UCHAR DAC_V : 1; 2317 UCHAR URU : 1; 2318 UCHAR DBC_V : 1; // 0 2319 UCHAR DID_V : 1; 2320 } Fields; 2321 } Flags; 2322 2323 #define DiscInfo_Type_cdrom 0x00 // CD-DA / CD-ROM 2324 #define DiscInfo_Type_cdi 0x10 // CD-I 2325 #define DiscInfo_Type_cdromxa 0x20 // CD-ROM XA 2326 #define DiscInfo_Type_unknown 0xFF // HZ ;) 2327 2328 UCHAR DiskType; 2329 UCHAR NumOfSes2; // MSB MMC-3 2330 UCHAR FirstTrackNumLastSes2; // MSB MMC-3 2331 UCHAR LastTrackNumLastSes2; // MSB MMC-3 2332 UCHAR DiskId [4]; 2333 UCHAR LastSesLeadInTime [4]; // MSF 2334 UCHAR LastSesLeadOutTime [4]; // MSF 2335 UCHAR DiskBarCode [8]; 2336 UCHAR Reserved3; 2337 UCHAR OPCNum; 2338 2339 } DISC_INFO_BLOCK, *PDISC_INFO_BLOCK; 2340 2341 typedef struct _DISC_INFO_TRACK_BLOCK { // 2342 UCHAR DataLength [2]; 2343 2344 UCHAR Reserved: 5; 2345 UCHAR InfoType: 3; 2346 UCHAR Reserved1; 2347 2348 UCHAR MaxLastTrackNum[2]; 2349 UCHAR NumOfTracks[2]; 2350 UCHAR MaxNumOfAppendableTracks[2]; 2351 UCHAR NumOfAppendableTracks[2]; 2352 2353 } DISC_INFO_TRACK_BLOCK, *PDISC_INFO_TRACK_BLOCK; 2354 2355 typedef struct _DISC_INFO_POW_BLOCK { // 2356 UCHAR DataLength [2]; 2357 2358 UCHAR Reserved: 5; 2359 UCHAR InfoType: 3; 2360 UCHAR Reserved1; 2361 2362 UCHAR RemainingPOWReplacements[4]; 2363 UCHAR RemainingPOWMapEntries[4]; 2364 UCHAR RemainingPOWUpdates[4]; 2365 2366 } DISC_INFO_POW_BLOCK, *PDISC_INFO_POW_BLOCK; 2367 2368 // Define track info block. 2369 2370 #define Trk_QSubChan_Type_Mask 0x0d 2371 #define Trk_QSubChan_Type_None 0x00 2372 #define Trk_QSubChan_Type_Audio 0x00 2373 #define Trk_QSubChan_Type_Audio_PreEmph 0x01 2374 #define Trk_QSubChan_Type_Data 0x04 2375 #define Trk_QSubChan_Type_IncrData 0x05 2376 #define Trk_QSubChan_Type_QAudio_PreEmph 0x08 2377 #define Trk_QSubChan_Type_AllowCpy 0x02 2378 2379 typedef struct _TRACK_INFO_BLOCK { 2380 UCHAR DataLength [2]; 2381 UCHAR TrackNum; 2382 UCHAR SesNum; 2383 UCHAR Reserved0; 2384 2385 #define TrkInfo_Trk_Mask Trk_QSubChan_Type_Mask 2386 #define TrkInfo_Trk_None Trk_QSubChan_Type_None 2387 #define TrkInfo_Trk_Mode1 Trk_QSubChan_Type_Audio_PreEmph 2388 #define TrkInfo_Trk_Mode2 (Trk_QSubChan_Type_Audio | Trk_QSubChan_Type_AllowCpy) 2389 #define TrkInfo_Trk_XA (Trk_QSubChan_Type_Audio | Trk_QSubChan_Type_AllowCpy) 2390 #define TrkInfo_Trk_DDCD Trk_QSubChan_Type_Data // MMC-3 2391 #define TrkInfo_Trk_NonCD Trk_QSubChan_Type_Data // MMC-3 2392 #define TrkInfo_Trk_Inc Trk_QSubChan_Type_IncrData // MMC-3 2393 #define TrkInfo_Trk_unknown 0x0F 2394 2395 #define TrkInfo_Copy 0x10 2396 #define TrkInfo_Damage 0x20 2397 /* Layer Jump state */ 2398 #define TrkInfo_LJ_Mask 0xc0 2399 #define TrkInfo_LJ_None 0x00 2400 #define TrkInfo_LJ_Ready 0x40 2401 #define TrkInfo_LJ_Manual 0x80 2402 #define TrkInfo_LJ_Regular 0xc0 2403 2404 UCHAR TrackParam; 2405 /* UCHAR TrackMode : 4; 2406 UCHAR Copy : 1; 2407 UCHAR Damage : 1; 2408 UCHAR LJRS : 2; */ 2409 2410 #define TrkInfo_Dat_Mask 0x0F 2411 #define TrkInfo_Dat_Mode1 0x01 2412 #define TrkInfo_Dat_Mode2 0x02 2413 #define TrkInfo_Dat_XA 0x02 2414 #define TrkInfo_Dat_DDCD 0x02 2415 #define TrkInfo_Dat_unknown 0x0F 2416 #define TrkInfo_Dat_Unknown TrkInfo_Dat_unknown 2417 #define TrkInfo_FP 0x10 2418 #define TrkInfo_Packet 0x20 2419 #define TrkInfo_Blank 0x40 2420 #define TrkInfo_RT 0x80 2421 2422 UCHAR DataParam; 2423 /* UCHAR DataMode : 4; 2424 UCHAR FP : 1; 2425 UCHAR Packet : 1; 2426 UCHAR Blank : 1; 2427 UCHAR RT : 1; */ 2428 2429 #define TrkInfo_NWA_V 0x01 2430 #define TrkInfo_LRA_V 0x02 // MMC-3 2431 2432 UCHAR NWA_V; 2433 /* UCHAR NWA_V : 1; 2434 UCHAR LRA_V : 1; 2435 UCHAR Reserved : 6; */ 2436 2437 UCHAR TrackStartAddr [4]; 2438 UCHAR NextWriteAddr [4]; 2439 UCHAR FreeBlocks [4]; 2440 UCHAR FixPacketSize [4]; 2441 UCHAR TrackLength [4]; 2442 2443 // MMC-3 2444 2445 UCHAR LastRecordedAddr [4]; 2446 UCHAR TrackNum2; // MSB 2447 UCHAR SesNum2; // MSB 2448 UCHAR Reserved2[2]; 2449 2450 // MMC-5 2451 2452 UCHAR ReadCompatLBA [4]; 2453 2454 // MMC-6 2455 2456 UCHAR NextLJ_LBA [4]; 2457 UCHAR LastLJ_LBA [4]; 2458 2459 } TRACK_INFO_BLOCK, *PTRACK_INFO_BLOCK; 2460 2461 // Mode data structures. 2462 2463 // Define Mode parameter header. 2464 2465 #define MediaType_Unknown 0x00 2466 #define MediaType_120mm_CDROM_DataOnly 0x01 2467 #define MediaType_120mm_CDROM_AudioOnly 0x02 //CDDA 2468 #define MediaType_120mm_CDROM_DataAudioCombined 0x03 2469 #define MediaType_120mm_CDROM_Hybrid_PhotoCD 0x04 2470 #define MediaType_80mm_CDROM_DataOnly 0x05 2471 #define MediaType_80mm_CDROM_AudioOnly 0x06 //CDDA 2472 #define MediaType_80mm_CDROM_DataAudioCombined 0x07 2473 #define MediaType_80mm_CDROM_Hybrid_PhotoCD 0x08 2474 2475 #define MediaType_UnknownSize_CDR 0x10 2476 #define MediaType_120mm_CDR_DataOnly 0x11 2477 #define MediaType_120mm_CDR_AudioOnly 0x12 //CDDA 2478 #define MediaType_120mm_CDR_DataAudioCombined 0x13 2479 #define MediaType_120mm_CDR_Hybrid_PhotoCD 0x14 2480 #define MediaType_80mm_CDR_DataOnly 0x15 2481 #define MediaType_80mm_CDR_AudioOnly 0x16 //CDDA 2482 #define MediaType_80mm_CDR_DataAudioCombined 0x17 2483 #define MediaType_80mm_CDR_Hybrid_Photo_CD 0x18 2484 2485 #define MediaType_UnknownSize_CDRW 0x20 2486 #define MediaType_120mm_CDRW_DataOnly 0x21 2487 #define MediaType_120mm_CDRW_AudioOnly 0x22 //CDDA 2488 #define MediaType_120mm_CDRW_DataAudioCombined 0x23 2489 #define MediaType_120mm_CDRW_Hybrid 0x24 2490 #define MediaType_80mm_CDRW_DataOnly 0x25 2491 #define MediaType_80mm_CDRW_AudioOnly 0x26 //CDDA 2492 #define MediaType_80mm_CDRW_DataAudioCombined 0x27 2493 #define MediaType_80mm_CDRW_Hybrid 0x28 2494 2495 #define MediaType_UnknownSize_Unknown 0x30 2496 2497 #define MediaType_120mm_DVDRW_DataOnly 0x41 2498 2499 #define MediaType_NoDiscPresent 0x70 2500 #define MediaType_DoorOpen 0x71 2501 2502 //********************************************************************************************* 2503 2504 typedef struct _MODE_PARAMETER_HEADER { 2505 UCHAR ModeDataLength; 2506 UCHAR MediumType; 2507 UCHAR DeviceSpecificParameter; 2508 UCHAR BlockDescriptorLength; 2509 } MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER; 2510 2511 typedef struct _MODE_PARAMETER_HEADER10 { 2512 UCHAR ModeDataLength[2]; 2513 UCHAR MediumType; 2514 UCHAR DeviceSpecificParameter; 2515 UCHAR Reserved[2]; 2516 UCHAR BlockDescriptorLength[2]; 2517 } MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10; 2518 2519 #define MODE_FD_SINGLE_SIDE 0x01 2520 #define MODE_FD_DOUBLE_SIDE 0x02 2521 #define MODE_FD_MAXIMUM_TYPE 0x1E 2522 #define MODE_DSP_FUA_SUPPORTED 0x10 2523 #define MODE_DSP_WRITE_PROTECT 0x80 2524 2525 // Define the mode parameter block. 2526 2527 typedef struct _MODE_PARAMETER_BLOCK { 2528 UCHAR DensityCode; 2529 UCHAR NumberOfBlocks[3]; 2530 UCHAR Reserved; 2531 UCHAR BlockLength[3]; 2532 } MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK; 2533 2534 typedef struct _MODE_PARM_READ_WRITE { 2535 2536 MODE_PARAMETER_HEADER ParameterListHeader; // List Header Format 2537 MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor 2538 2539 } MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA; 2540 2541 //********************************************************************************************* 2542 // Define read write recovery page 2543 2544 typedef struct _MODE_READ_WRITE_RECOVERY_PAGE { // 0x01 2545 2546 UCHAR PageCode : 6; 2547 UCHAR Reserved1 : 1; 2548 UCHAR PageSavable : 1; 2549 2550 UCHAR PageLength; 2551 2552 union { 2553 UCHAR Flags; 2554 struct { 2555 UCHAR DCRBit : 1; 2556 UCHAR DTEBit : 1; 2557 UCHAR PERBit : 1; 2558 UCHAR EERBit : 1; 2559 UCHAR RCBit : 1; 2560 UCHAR TBBit : 1; 2561 UCHAR ARRE : 1; 2562 UCHAR AWRE : 1; 2563 } Fields; 2564 } ErrorRecoveryParam; 2565 UCHAR ReadRetryCount; 2566 UCHAR CorrectionSpan; //SCSI CBS only 2567 UCHAR HeadOffsetCount; //SCSI CBS only 2568 UCHAR DataStrobOffsetCount; //SCSI CBS only 2569 union { 2570 UCHAR Flags; 2571 struct { 2572 UCHAR EMCDR : 2; 2573 UCHAR Reserved : 6; 2574 } Fields; 2575 } ErrorRecoveryParam2; 2576 UCHAR WriteRetryCount; 2577 union { 2578 struct { 2579 UCHAR Reserved5; 2580 UCHAR RecoveryTimeLimit[2]; // 0 2581 }; 2582 UCHAR ErrorReportingWindowSize[3]; 2583 }; 2584 2585 } MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE; 2586 2587 // Define Read Recovery page - cdrom 2588 2589 typedef struct _MODE_READ_RECOVERY_PAGE { // 0x01 2590 2591 UCHAR PageCode : 6; 2592 UCHAR Reserved1 : 1; 2593 UCHAR PageSavable : 1; 2594 2595 UCHAR PageLength; 2596 2597 UCHAR DCRBit : 1; 2598 UCHAR DTEBit : 1; 2599 UCHAR PERBit : 1; 2600 UCHAR Reserved2 : 1; 2601 UCHAR RCBit : 1; 2602 UCHAR TBBit : 1; 2603 UCHAR Reserved3 : 2; 2604 2605 UCHAR ReadRetryCount; 2606 UCHAR Reserved4[4]; 2607 2608 } MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE; 2609 2610 //********************************************************************************************* 2611 // Define mode write parameters page. 2612 2613 typedef struct _MODE_WRITE_PARAMS_PAGE { // 0x05 2614 UCHAR PageCode : 6; 2615 UCHAR Reserved1: 1; 2616 UCHAR PageSavable : 1; 2617 2618 UCHAR PageLength; // 0x32 2619 2620 #define WParam_WType_Mask 0x0f 2621 #define WParam_WType_Packet 0x00 2622 #define WParam_WType_TAO 0x01 2623 #define WParam_WType_Ses 0x02 2624 #define WParam_WType_Raw 0x03 2625 #define WParam_TestWrite 0x10 2626 #define WParam_LS_V 0x20 2627 #define WParam_BUFF 0x40 // buffer underrun protection 2628 2629 union { 2630 UCHAR Flags; 2631 struct { 2632 UCHAR WriteType: 4; // 1 2633 UCHAR TestWrite: 1; 2634 UCHAR LS_V: 1; 2635 UCHAR BUFF: 1; 2636 UCHAR Reserved1: 1; 2637 } Fields; 2638 } Byte2; 2639 2640 #define WParam_TrkMode_Mask Trk_QSubChan_Type_Mask //0x0d // xx0x 2641 #define WParam_TrkMode_None Trk_QSubChan_Type_None //0x00 2642 #define WParam_TrkMode_Audio Trk_QSubChan_Type_Audio //0x00 2643 #define WParam_TrkMode_Audio_PreEmph Trk_QSubChan_Type_Audio_PreEmph //0x01 2644 #define WParam_TrkMode_Data Trk_QSubChan_Type_Data //0x04 2645 #define WParam_TrkMode_IncrData Trk_QSubChan_Type_IncrData //0x05 2646 #define WParam_TrkMode_QAudio_PreEmph Trk_QSubChan_Type_QAudio_PreEmph //0x08 2647 #define WParam_TrkMode_AllowCpy Trk_QSubChan_Type_AllowCpy //0x02 2648 #define WParam_Copy 0x10 2649 #define WParam_FP 0x20 2650 #define WParam_MultiSes_Mask 0xc0 2651 #define WParam_Multises_None 0x00 2652 #define WParam_Multises_Final 0x80 2653 #define WParam_Multises_Multi 0xc0 2654 2655 union { 2656 UCHAR Flags; 2657 struct { 2658 UCHAR TrackMode: 4; // 4 2659 UCHAR Copy : 1; // 0 2660 UCHAR FP : 1; // 0 2661 UCHAR Multisession: 2; // 11 2662 } Fields; 2663 } Byte3; 2664 2665 #define WParam_BlkType_Mask 0x0f 2666 #define WParam_BlkType_Raw_2352 0x00 2667 #define WParam_BlkType_RawPQ_2368 0x01 2668 #define WParam_BlkType_RawPW_2448 0x02 2669 #define WParam_BlkType_RawPW_R_2448 0x03 2670 #define WParam_BlkType_VendorSpec1 0x07 2671 #define WParam_BlkType_M1_2048 0x08 2672 #define WParam_BlkType_M2_2336 0x09 2673 #define WParam_BlkType_M2XAF1_2048 0x0a 2674 #define WParam_BlkType_M2XAF1SH_2056 0x0b 2675 #define WParam_BlkType_M2XAF2_2324 0x0c 2676 #define WParam_BlkType_M2XAFXSH_2332 0x0d 2677 #define WParam_BlkType_VendorSpec2 0x0f 2678 2679 union { 2680 UCHAR Flags; 2681 struct { 2682 UCHAR DataBlockType: 4; // 8 2683 UCHAR Reserved2: 4; 2684 } Fields; 2685 } Byte4; 2686 2687 UCHAR LinkSize; 2688 UCHAR Reserved3; 2689 2690 union { 2691 UCHAR Flags; 2692 struct { 2693 UCHAR HostAppCode : 6; // 0 2694 UCHAR Reserved4 : 2; 2695 } Fields; 2696 } Byte7; 2697 2698 #define WParam_SesFmt_CdRom 0x00 2699 #define WParam_SesFmt_CdI 0x10 2700 #define WParam_SesFmt_CdRomXa 0x20 2701 2702 UCHAR SesFmt; // 0 2703 UCHAR Reserved5; 2704 UCHAR PacketSize[4]; // 0 2705 UCHAR AudioPause[2]; // 150 2706 2707 UCHAR Reserved6: 7; 2708 UCHAR MCVAL : 1; 2709 2710 UCHAR N[13]; 2711 UCHAR Zero; 2712 UCHAR AFRAME; 2713 2714 UCHAR Reserved7: 7; 2715 UCHAR TCVAL : 1; 2716 2717 UCHAR I[12]; 2718 UCHAR Zero_2; 2719 UCHAR AFRAME_2; 2720 UCHAR Reserved8; 2721 2722 struct { 2723 union { 2724 UCHAR MSF[3]; 2725 struct _SubHdrParams1 { 2726 UCHAR FileNum; 2727 UCHAR ChannelNum; 2728 2729 #define WParam_SubHdr_SubMode0 0x00 2730 #define WParam_SubHdr_SubMode1 0x08 2731 2732 UCHAR SubMode; 2733 } Params1; 2734 } Params; 2735 2736 #define WParam_SubHdr_Mode_Mask 0x03 2737 #define WParam_SubHdr_Mode0 0x00 2738 #define WParam_SubHdr_Mode1 0x01 2739 #define WParam_SubHdr_Mode2 0x02 2740 #define WParam_SubHdr_Format_Mask 0xe0 2741 #define WParam_SubHdr_Format_UserData 0x00 2742 #define WParam_SubHdr_Format_RunIn4 0x20 2743 #define WParam_SubHdr_Format_RunIn3 0x40 2744 #define WParam_SubHdr_Format_RunIn2 0x60 2745 #define WParam_SubHdr_Format_RunIn1 0x80 2746 #define WParam_SubHdr_Format_Link 0xa0 2747 #define WParam_SubHdr_Format_RunOut2 0xc0 2748 #define WParam_SubHdr_Format_RunOut1 0xe0 2749 2750 union { 2751 UCHAR Flags; 2752 struct { 2753 UCHAR Mode : 2; 2754 UCHAR Reserved : 3; 2755 UCHAR Format : 3; 2756 } Fields; 2757 } Mode; 2758 } SubHeader ; 2759 2760 } MODE_WRITE_PARAMS_PAGE, *PMODE_WRITE_PARAMS_PAGE; 2761 2762 typedef struct _MODE_WRITE_PARAMS_PAGE_3 { 2763 MODE_WRITE_PARAMS_PAGE Standard; 2764 UCHAR VendorSpec[4]; 2765 } MODE_WRITE_PARAMS_PAGE_3, *PMODE_WRITE_PARAMS_PAGE_3; 2766 2767 //********************************************************************************************* 2768 // Define Caching page. 2769 2770 typedef struct _MODE_CACHING_PAGE { // 0x08 2771 UCHAR PageCode : 6; 2772 UCHAR Reserved1: 1; 2773 UCHAR PageSavable : 1; 2774 2775 UCHAR PageLength; 2776 2777 UCHAR ReadDisableCache : 1; 2778 UCHAR MultiplicationFactor : 1; 2779 UCHAR WriteCacheEnable : 1; 2780 UCHAR Reserved2 : 5; 2781 2782 UCHAR WriteRetensionPriority : 4; 2783 UCHAR ReadRetensionPriority : 4; 2784 2785 UCHAR DisablePrefetchTransfer[2]; 2786 UCHAR MinimumPrefetch[2]; 2787 UCHAR MaximumPrefetch[2]; 2788 UCHAR MaximumPrefetchCeiling[2]; 2789 } MODE_CACHING_PAGE, *PMODE_CACHING_PAGE; 2790 2791 //********************************************************************************************* 2792 // Define CD Parameters page. 2793 2794 typedef struct _MODE_CD_PARAMS_PAGE { // 0x0D 2795 UCHAR PageCode : 6; 2796 UCHAR Reserved : 1; 2797 UCHAR PageSavable : 1; 2798 2799 UCHAR PageLength; // 0x06 2800 UCHAR Reserved1; 2801 2802 #define CdParams_InactvityTime_Mask 0x0f 2803 2804 union { 2805 UCHAR Flags; 2806 struct { 2807 UCHAR InactivityTime: 4; // 1 - 125ms, 2 - 250ms... 9 - 32s, A - 1min... 2808 UCHAR Reserved0 : 4; 2809 } Fields; 2810 } Byte2; 2811 2812 UCHAR SUnits_per_MUnit[2]; 2813 UCHAR FUnits_per_SUnit[2]; 2814 } MODE_CD_PARAMS_PAGE, *PMODE_CD_PARAMS_PAGE; 2815 2816 //********************************************************************************************* 2817 // Define CD Audio Control Mode page. 2818 2819 typedef struct _CDDA_PORT_CONTROL { 2820 2821 #define CddaPort_Channel_Mask 0x0f 2822 #define CddaPort_Channel_Mute 0x00 2823 #define CddaPort_Channel_0 0x01 2824 #define CddaPort_Channel_1 0x02 2825 #define CddaPort_Channel_0_1 0x03 2826 #define CddaPort_Channel_2 0x04 2827 #define CddaPort_Channel_3 0x08 2828 2829 UCHAR ChannelSelection; 2830 UCHAR Volume; 2831 } CDDA_PORT_CONTROL, *PCDDA_PORT_CONTROL; 2832 2833 typedef struct _MODE_CD_AUDIO_CONTROL_PAGE { // 0x0E 2834 UCHAR PageCode : 6; 2835 UCHAR Reserved1: 1; 2836 UCHAR PageSavable : 1; 2837 2838 UCHAR PageLength; // 0x0E 2839 2840 #define CdAudio_SOTC 0x02 2841 #define CdAudio_Immed 0x04 2842 2843 union { 2844 UCHAR Flags; 2845 struct { 2846 UCHAR Reserved0 : 1; 2847 UCHAR SOTC : 1; 2848 UCHAR Immed : 1; 2849 UCHAR Reserved1 : 5; 2850 } Fields; 2851 } Byte2; 2852 2853 UCHAR Reserved2[2]; 2854 UCHAR LbaFormat; 2855 UCHAR LogicalBlocksPerSecond[2]; 2856 CDDA_PORT_CONTROL Port[4]; 2857 } MODE_CD_AUDIO_CONTROL_PAGE, *PMODE_CD_AUDIO_CONTROL_PAGE; 2858 2859 //********************************************************************************************* 2860 // Define Power Condition Mode page. 2861 2862 typedef struct _MODE_POWER_CONDITION_PAGE { // 0x1A 2863 UCHAR PageCode : 6; 2864 UCHAR Reserved1: 1; 2865 UCHAR PageSavable : 1; 2866 2867 UCHAR PageLength; // 0x0A 2868 UCHAR Reserved2; 2869 2870 #define PowerCond_Standby 0x01 2871 #define PowerCond_Idle 0x02 2872 2873 union { 2874 UCHAR Flags; 2875 struct { 2876 UCHAR Standby : 1; 2877 UCHAR Idle : 1; 2878 UCHAR Reserved1 : 6; 2879 } Fields; 2880 } Byte3; 2881 2882 UCHAR IdleTimer[4]; // 1unit = 100ms 2883 UCHAR StandbyTimer[4]; // 1unit = 100ms 2884 } MODE_POWER_CONDITION_PAGE, *PMODE_POWER_CONDITION_PAGE; 2885 2886 //********************************************************************************************* 2887 // Define Fault/Failure Reporting Control page. 2888 2889 typedef struct _MODE_FAIL_REPORT_PAGE { // 0x1C 2890 UCHAR PageCode : 6; 2891 UCHAR Reserved1: 1; 2892 UCHAR PageSavable : 1; 2893 2894 UCHAR PageLength; // 0x0A 2895 2896 #define FailReport_LogErr 0x01 2897 #define FailReport_Test 0x04 2898 #define FailReport_DExcept 0x08 2899 #define FailReport_Perf 0x80 2900 2901 union { 2902 UCHAR Flags; 2903 struct { 2904 UCHAR LogErr : 1; 2905 UCHAR Reserved1 : 1; 2906 UCHAR Test : 1; 2907 UCHAR DExcept : 1; 2908 UCHAR Reserved2 : 3; 2909 UCHAR Perf : 1; 2910 } Fields; 2911 } Byte2; 2912 2913 union { 2914 UCHAR Flags; 2915 struct { 2916 UCHAR MRIE : 4; 2917 UCHAR Reserved1 : 4; 2918 } Fields; 2919 } Byte3; 2920 2921 UCHAR IntervalTimer[4]; // 1unit = 100ms 2922 UCHAR ReportCount[4]; 2923 } MODE_FAIL_REPORT_PAGE, *PMODE_FAIL_REPORT_PAGE; 2924 2925 //********************************************************************************************* 2926 // Define Time-out and Protect page. 2927 2928 typedef struct _MODE_TIMEOUT_AND_PROTECT_PAGE { // 0x1D 2929 UCHAR PageCode : 6; 2930 UCHAR Reserved1: 1; 2931 UCHAR PageSavable : 1; 2932 2933 UCHAR PageLength; // 0x08 2934 2935 UCHAR Reserved2[2]; 2936 2937 #define Timeout_SW 0x01 2938 #define Timeout_DISP 0x02 2939 #define Timeout_TMOE 0x04 2940 2941 union { 2942 UCHAR Flags; 2943 struct { 2944 UCHAR SW : 1; 2945 UCHAR DISP : 1; 2946 UCHAR TMOE : 1; 2947 UCHAR Reserved : 5; 2948 } Fields; 2949 } Byte4; 2950 2951 UCHAR Reserved3; 2952 2953 UCHAR Group1_Timeout[2]; // 1unit = 1s 2954 UCHAR Group2_Timeout[2]; // 1unit = 1s 2955 } MODE_TIMEOUT_AND_PROTECT_PAGE, *PMODE_TIMEOUT_AND_PROTECT_PAGE; 2956 2957 //********************************************************************************************* 2958 // Define Philips CD-R(W) Sector Mode page. 2959 2960 typedef struct _MODE_PHILIPS_SECTOR_TYPE_PAGE { // 0x21 2961 UCHAR PageCode : 6; 2962 UCHAR Reserved1 : 1; 2963 UCHAR PSBit : 1; 2964 2965 UCHAR PageLength; 2966 2967 UCHAR Reserved0[2]; 2968 2969 union { 2970 UCHAR Flags; 2971 struct { 2972 UCHAR DataBlockType: 4; // 8 2973 UCHAR Reserved2: 4; 2974 } Fields; 2975 } Byte4; 2976 2977 #define WParams_Philips_CreateNewTrack 0 2978 2979 UCHAR Track; 2980 UCHAR ISRC[9]; 2981 2982 UCHAR Reserved3[2]; 2983 } MODE_PHILIPS_SECTOR_TYPE_PAGE, *PMODE_PHILIPS_SECTOR_TYPE_PAGE; 2984 2985 //********************************************************************************************* 2986 // Define CD-X Capabilities and Mechanical Status page. 2987 2988 typedef struct _MODE_CAPABILITIES_PAGE2 { // 0x2A 2989 UCHAR PageCode : 6; 2990 UCHAR Reserved1 : 1; 2991 UCHAR PSBit : 1; 2992 2993 UCHAR PageLength; 2994 2995 #define DevCap_read_cd_r 0x01 // reserved in 1.2 2996 #define DevCap_read_cd_rw 0x02 // reserved in 1.2 2997 #define DevCap_method2 0x04 2998 #define DevCap_read_dvd_rom 0x08 2999 #define DevCap_read_dvd_r 0x10 3000 #define DevCap_read_dvd_ram 0x20 3001 3002 #define DevCap_read_dvd (DevCap_read_dvd_rom | DevCap_read_dvd_r | DevCap_read_dvd_ram) 3003 3004 UCHAR ReadCap; // DevCap_*_read // 0x02 3005 /* UCHAR cd_r_read : 1; // reserved in 1.2 3006 UCHAR cd_rw_read : 1; // reserved in 1.2 3007 UCHAR method2 : 1; 3008 UCHAR dvd_rom : 1; 3009 UCHAR dvd_r_read : 1; 3010 UCHAR dvd_ram_read : 1; 3011 UCHAR Reserved2 : 2;*/ 3012 3013 #define DevCap_write_cd_r 0x01 // reserved in 1.2 3014 #define DevCap_write_cd_rw 0x02 // reserved in 1.2 3015 #define DevCap_test_write 0x04 3016 #define DevCap_write_dvd_r 0x10 3017 #define DevCap_write_dvd_ram 0x20 3018 3019 UCHAR WriteCap; // DevCap_*_write // 0x03 3020 /* UCHAR cd_r_write : 1; // reserved in 1.2 3021 UCHAR cd_rw_write : 1; // reserved in 1.2 3022 UCHAR test_write : 1; 3023 UCHAR reserved3a : 1; 3024 UCHAR dvd_r_write : 1; 3025 UCHAR dvd_ram_write : 1; 3026 UCHAR Reserved3 : 2;*/ 3027 3028 #define DevCap_audio_play 0x01 3029 #define DevCap_composite 0x02 3030 #define DevCap_digport1 0x04 3031 #define DevCap_digport2 0x08 3032 #define DevCap_mode2_form1 0x10 3033 #define DevCap_mode2_form2 0x20 3034 #define DevCap_multisession 0x40 3035 3036 UCHAR Capabilities0; // 0x04 3037 /* UCHAR audio_play : 1; 3038 UCHAR composite : 1; 3039 UCHAR digport1 : 1; 3040 UCHAR digport2 : 1; 3041 UCHAR mode2_form1 : 1; 3042 UCHAR mode2_form2 : 1; 3043 UCHAR multisession : 1; 3044 UCHAR Reserved4 : 1;*/ 3045 3046 #define DevCap_cdda 0x01 3047 #define DevCap_cdda_accurate 0x02 3048 #define DevCap_rw_supported 0x04 3049 #define DevCap_rw_corr 0x08 3050 #define DevCap_c2_pointers 0x10 3051 #define DevCap_isrc 0x20 3052 #define DevCap_upc 0x40 3053 #define DevCap_read_bar_code 0x80 3054 3055 UCHAR Capabilities1; // 0x05 3056 /* UCHAR cdda : 1; 3057 UCHAR cdda_accurate : 1; 3058 UCHAR rw_supported : 1; 3059 UCHAR rw_corr : 1; 3060 UCHAR c2_pointers : 1; 3061 UCHAR isrc : 1; 3062 UCHAR upc : 1; 3063 UCHAR Reserved5 : 1;*/ 3064 3065 #define DevCap_lock 0x01 3066 #define DevCap_lock_state 0x02 3067 #define DevCap_prevent_jumper 0x04 3068 #define DevCap_eject 0x08 3069 #define DevCap_mechtype_mask 0xE0 3070 #define DevCap_mechtype_caddy 0x00 3071 #define DevCap_mechtype_tray (0x01<<5) 3072 #define DevCap_mechtype_popup (0x02<<5) 3073 #define DevCap_mechtype_individual_changer (0x04<<5) 3074 #define DevCap_mechtype_cartridge_changer (0x05<<5) 3075 3076 UCHAR Capabilities2; // 0x06 3077 /* UCHAR lock : 1; 3078 UCHAR lock_state : 1; 3079 UCHAR prevent_jumper : 1; 3080 UCHAR eject : 1; 3081 UCHAR Reserved6 : 1; 3082 UCHAR mechtype : 3;*/ 3083 3084 #define DevCap_separate_volume 0x01 3085 #define DevCap_separate_mute 0x02 3086 #define DevCap_disc_present 0x04 // reserved in 1.2 3087 #define DevCap_sw_slot_select 0x08 // reserved in 1.2 3088 #define DevCap_change_side_cap 0x10 3089 #define DevCap_rw_leadin_read 0x20 3090 3091 UCHAR Capabilities3; // 0x07 3092 /* UCHAR separate_volume : 1; 3093 UCHAR separate_mute : 1; 3094 UCHAR disc_present : 1; // reserved in 1.2 3095 UCHAR sss : 1; // reserved in 1.2 3096 UCHAR Reserved7 : 4;*/ 3097 3098 UCHAR MaximumSpeedSupported[2]; // 0x08 3099 UCHAR NumberVolumeLevels[2]; // 0x0a 3100 UCHAR BufferSize[2]; // 0x0c 3101 UCHAR CurrentSpeed[2]; // obsolete in MMC3 // 0x0e 3102 3103 UCHAR Reserved8; // 0x10 3104 3105 UCHAR SpecialParameters0; // 0x11 3106 /* UCHAR Reserved9 : 1; 3107 UCHAR BCK : 1; 3108 UCHAR RCK : 1; 3109 UCHAR LSBF : 1; 3110 UCHAR Length : 2; 3111 UCHAR Reserved10 : 2;*/ 3112 3113 UCHAR MaximumWriteSpeedSupported[2]; // obsolete in MMC3 3114 UCHAR CurrentWriteSpeed[2]; // obsolete in MMC3 3115 UCHAR CopyManagementRevision[2]; // 0x16 3116 UCHAR Reserved11[2]; // 0x18 3117 3118 // MMC3 3119 3120 UCHAR Reserved12; // 0x1a 3121 3122 UCHAR SpecialParameters1; // 0x1b 3123 /* UCHAR RCS : 2; // rotation control selected 3124 UCHAR Reserved13 : 6; */ 3125 3126 UCHAR CurrentWriteSpeed3[2]; // 0x1c 3127 UCHAR LunWPerfDescriptorCount[2]; // 0x1e 3128 3129 // LUN_WRITE_PERF_DESC LunWPerfDescriptor[0]; 3130 } MODE_CAPABILITIES_PAGE2, *PMODE_CAPABILITIES_PAGE2; 3131 3132 /*typedef struct _MODE_CAPABILITIES_PAGE3 { // 0x2A 3133 struct MODE_CAPABILITIES_PAGE2; 3134 3135 } MODE_CAPABILITIES_PAGE3, *PMODE_CAPABILITIES_PAGE3;*/ 3136 3137 typedef struct _LUN_WRITE_PERF_DESC { 3138 UCHAR Reserved; 3139 3140 #define LunWPerf_RotCtrl_Mask 0x07 3141 #define LunWPerf_RotCtrl_CLV 0x00 3142 #define LunWPerf_RotCtrl_CAV 0x01 3143 3144 UCHAR RotationControl; 3145 UCHAR WriteSpeedSupported[2]; // kbps 3146 3147 } LUN_WRITE_PERF_DESC, *PLUN_WRITE_PERF_DESC; 3148 3149 // Mode parameter list block descriptor - 3150 // set the block length for reading/writing 3151 3152 #define MODE_BLOCK_DESC_LENGTH 8 3153 #define MODE_HEADER_LENGTH 4 3154 #define MODE_HEADER_LENGTH10 8 3155 3156 #define CDB_USE_MSF 0x01 3157 3158 // Atapi 2.5 changer 3159 typedef struct _MECHANICAL_STATUS_INFORMATION_HEADER { 3160 UCHAR CurrentSlot : 5; 3161 UCHAR ChangerState : 2; 3162 UCHAR Fault : 1; 3163 UCHAR Reserved : 5; 3164 UCHAR MechanismState : 3; 3165 UCHAR CurrentLogicalBlockAddress[3]; 3166 UCHAR NumberAvailableSlots; 3167 UCHAR SlotTableLength[2]; 3168 } MECHANICAL_STATUS_INFORMATION_HEADER, *PMECHANICAL_STATUS_INFORMATION_HEADER; 3169 3170 typedef struct _SLOT_TABLE_INFORMATION { 3171 UCHAR DiscChanged : 1; 3172 UCHAR Reserved : 6; 3173 UCHAR DiscPresent : 1; 3174 UCHAR Reserved2[3]; 3175 } SLOT_TABLE_INFORMATION, *PSLOT_TABLE_INFORMATION; 3176 3177 typedef struct _MECHANICAL_STATUS { 3178 MECHANICAL_STATUS_INFORMATION_HEADER MechanicalStatusHeader; 3179 SLOT_TABLE_INFORMATION SlotTableInfo[1]; 3180 } MECHANICAL_STATUS, *PMECHANICAL_STATUS; 3181 3182 typedef struct _MODE_MRW_PAGE { // 0x2C 3183 UCHAR PageCode : 6; 3184 UCHAR Reserved1 : 1; 3185 UCHAR PSBit : 1; 3186 3187 UCHAR PageLength; 3188 3189 UCHAR Reserved2; 3190 3191 #define MrwPage_use_DMA 0x00 3192 #define MrwPage_use_GAA 0x01 3193 3194 UCHAR AddressMode; 3195 UCHAR Reserved3[4]; 3196 3197 } MODE_MRW_PAGE, *PMODE_MRW_PAGE; 3198 3199 #define MRW_DMA_OFFSET 0x500 3200 #define MRW_DA_SIZE (136*32) 3201 #define MRW_SA_SIZE (8*32) 3202 #define MRW_DMA_SEGMENT_SIZE (MRW_DA_SIZE+MRW_SA_SIZE) 3203 3204 // 3205 // SET STREAMING descriptors 3206 // 3207 3208 typedef struct _SET_STREAMING_PERFORMANCE_DESCRIPTOR { 3209 UCHAR RA : 1; // Random Access 3210 UCHAR Exact : 1; 3211 UCHAR RDD : 1; // Restore Defaults 3212 UCHAR WRC : 2; 3213 UCHAR Reserved0 : 3; 3214 3215 UCHAR Reserved1[3]; 3216 3217 UCHAR StartLBA[4]; 3218 UCHAR EndLBA[4]; 3219 3220 UCHAR ReadSize[4]; // KBytes 3221 UCHAR ReadTime[4]; // ms 3222 3223 UCHAR WriteSize[4]; // KBytes 3224 UCHAR WriteTime[4]; // ms 3225 3226 } SET_STREAMING_PERFORMANCE_DESCRIPTOR, *PSET_STREAMING_PERFORMANCE_DESCRIPTOR; 3227 3228 // 3229 // GET CONFIGURATION response format 3230 // 3231 3232 // Feature Request types 3233 #define RT_ALL 0x00 3234 #define RT_CURRENT 0x01 3235 #define RT_ONE 0x02 3236 #define RT_RESERVED 0x03 3237 3238 // Feature codes 3239 #define FC_PROFILE_LIST 0x0000 3240 #define FC_CORE 0x0001 3241 #define FC_MORPHING 0x0002 3242 #define FC_REMOVALE_MEDIUM 0x0003 3243 #define FC_WRITE_PROTECT_CTL 0x0004 3244 #define FC_RANDOM_READABLE 0x0010 3245 #define FC_MULTIREAD 0x001d 3246 #define FC_CDREAD 0x001e 3247 #define FC_DVDREAD 0x001f 3248 #define FC_RANDOM_WRITEABLE 0x0020 3249 #define FC_INCREMENTAL_STREAMING_WRITEABLE 0x0021 3250 #define FC_SECTOR_ERASABLE 0x0022 3251 #define FC_FORMATTABLE 0x0023 3252 #define FC_DEFECT_MANAGMENT 0x0024 3253 #define FC_WRITE_ONCE 0x0025 3254 #define FC_RESTRICTED_OWERWRITE 0x0026 3255 #define FC_CDRW_CAV_WRITE 0x0027 3256 #define FC_MRW 0x0028 3257 #define FC_ENHANCED_DEFECT_REPORTING 0x0029 3258 #define FC_DVDpRW 0x002a 3259 #define FC_DVDpR 0x002b // MMC-6 3260 #define FC_RIGID_RESTRICTED_OWERWRITE 0x002c 3261 #define FC_CD_TAO 0x002d 3262 #define FC_CD_MASTERING 0x002e 3263 #define FC_DVD_R_RW_WRITE 0x002f 3264 #define FC_DDCD_READ 0x0030 // removed from MMC-5 3265 #define FC_DDCDR_WRITE 0x0031 // removed from MMC-5 3266 #define FC_DDCDRW_WRITE 0x0032 // removed from MMC-5 3267 #define FC_LAYER_JUMP_RECORDING 0x0033 // MMC-6 3268 #define FC_CDRW_WRITE 0x0037 // MMC-5 3269 #define FC_BDR_POW 0x0038 // MMC-6 3270 #define FC_DVDpR_DL 0x003a // MMC-6 3271 #define FC_DVDpRW_DL 0x003b // MMC-5 3272 #define FC_BD_READ 0x0040 // MMC-5, BlueRay 3273 #define FC_BD_WRITE 0x0041 // MMC-6, BlueRay 3274 #define FC_TSR 0x0042 // MMC-6 3275 #define FC_HD_DVD_READ 0x0050 // MMC-6 3276 #define FC_HD_DVD_WRITE 0x0051 // MMC-6 3277 #define FC_HYBRID_DISC 0x0080 // MMC-6 3278 #define FC_POWER_MANAGMENT 0x0100 3279 #define FC_SMART 0x0101 3280 #define FC_EMBEDED_CHANGER 0x0102 3281 #define FC_CD_AUDIO_ANALOG_PLAY 0x0103 3282 #define FC_MICROCODE_UPGRADE 0x0104 3283 #define FC_TIMEOUT 0x0105 3284 #define FC_DVD_CSS 0x0106 3285 #define FC_REAL_TIME_STREAMING 0x0107 3286 #define FC_LU_SERIAL_NUMBER 0x0108 3287 #define FC_MEDIA_SERIAL_NUMBER 0x0109 3288 #define FC_DISK_CONTROL_BLOCK 0x010a 3289 #define FC_DVD_CPRM 0x010b 3290 #define FC_FIRMWARE_INFO 0x010c 3291 #define FC_AACS 0x010d 3292 3293 // Feature Header 3294 typedef struct _FEATURE_LIST_HEADER { 3295 UCHAR DataLength[4]; 3296 UCHAR Reserved[2]; 3297 UCHAR CurrentProfile[2]; 3298 } FEATURE_LIST_HEADER, *PFEATURE_LIST_HEADER; 3299 3300 // Profile List Feature 3301 3302 3303 // Profile list descriptor format 3304 typedef struct _PROFILE_LIST_DESCRIPTOR { 3305 UCHAR FC[2]; // Feature code 3306 UCHAR Current : 1; 3307 UCHAR Persistent: 1; 3308 UCHAR Version : 4; 3309 UCHAR Reserved : 2; 3310 UCHAR AdditionLen; 3311 } PROFILE_LIST_DESCRIPTOR, *PPROFILE_LIST_DESCRIPTOR; 3312 3313 // Profile descriptor format 3314 typedef struct _PROFILE_DESCRIPTOR { 3315 UCHAR ProfileNum[2]; // Profile Number 3316 UCHAR CurrentProfile : 1; // indicate that this Profile curently active 3317 UCHAR Reserved1 : 7; 3318 UCHAR Reserved; 3319 } PROFILE_DESCRIPTOR, *PPROFILE_DESCRIPTOR; 3320 3321 #define PFNUM_Min 0x0001 3322 #define PFNUM_NonRemovableDisk 0x0001 3323 #define PFNUM_RemovableDisk 0x0002 3324 #define PFNUM_MO_Erasable 0x0003 3325 #define PFNUM_MO_WORM 0x0004 3326 #define PFNUM_AS_MO 0x0005 3327 #define PFNUM_CDROM 0x0008 3328 #define PFNUM_CDR 0x0009 3329 #define PFNUM_CDRW 0x000a 3330 #define PFNUM_DVDROM 0x0010 3331 #define PFNUM_DVDR 0x0011 3332 #define PFNUM_DVDRAM 0x0012 3333 #define PFNUM_DVDRW_RESTRICTED_OVERWRITE 0x0013 3334 #define PFNUM_DVDRW_SEQUENTIAL 0x0014 3335 #define PFNUM_DVDR_DL_SEQUENTIAL 0x0015 // MMC-6 3336 #define PFNUM_DVDR_DL_JUMP_RECORDING 0x0016 // MMC-6 3337 #define PFNUM_DVDRW_DL 0x0017 // MMC-6 3338 #define PFNUM_DVDpRW 0x001a 3339 #define PFNUM_DVDpR 0x001b 3340 #define PFNUM_DDCDROM 0x0020 3341 #define PFNUM_DDCDR 0x0021 3342 #define PFNUM_DDCDRW 0x0022 3343 #define PFNUM_DVDpRW_DL 0x002a 3344 #define PFNUM_DVDpR_DL 0x002b 3345 #define PFNUM_BDROM 0x0040 // BlueRay 3346 #define PFNUM_BDR_SEQUENTIAL 0x0041 3347 #define PFNUM_BDR_RANDOM 0x0042 3348 #define PFNUM_BDRE 0x0043 // BlueRay 3349 #define PFNUM_HD_DVDROM 0x0050 3350 #define PFNUM_HD_DVDR 0x0051 3351 #define PFNUM_HD_DVDRAM 0x0052 3352 #define PFNUM_HD_DVDRW 0x0053 3353 #define PFNUM_HD_DVDR_DL 0x0058 3354 #define PFNUM_HD_DVDRW_DL 0x005a 3355 #define PFNUM_Max PFNUM_HD_DVDRW_DL 3356 // 3357 3358 // ** FC_REMOVALE_MEDIUM ** 3359 // Removable Media descriptor format 0x03 3360 typedef struct _REMOVABLE_MEDIA_DESCRIPTOR { 3361 PROFILE_LIST_DESCRIPTOR header; 3362 3363 UCHAR lock : 1; 3364 UCHAR Reserved0 : 1; // read current state from header.Current 3365 UCHAR prevent_jumper : 1; 3366 UCHAR eject : 1; 3367 UCHAR Reserved1 : 1; 3368 UCHAR mechtype : 3; // see Capabilities2 in MODE_CAPABILITIES_PAGE2 3369 3370 } REMOVABLE_MEDIA_DESCRIPTOR, *PREMOVABLE_MEDIA_DESCRIPTOR; 3371 3372 // ** FC_MULTIREAD ** 3373 // MultiRead descriptor format 0x1d 3374 typedef struct _MULTIREAD_DESCRIPTOR { 3375 PROFILE_LIST_DESCRIPTOR header; 3376 } MULTIREAD_DESCRIPTOR, *PMULTIREAD_DESCRIPTOR; 3377 3378 // ** FC_CDREAD ** 3379 // CD-Read descriptor format 0x1e 3380 typedef struct _CD_READ_DESCRIPTOR { 3381 PROFILE_LIST_DESCRIPTOR header; 3382 3383 UCHAR CdText : 1; 3384 UCHAR c2_pointers : 1; 3385 UCHAR Reserved2 : 5; 3386 UCHAR DAP : 1; // DAP bit support in READ_CD/READ_CD_MFS 3387 3388 UCHAR Reserved3[3]; 3389 } CD_READ_DESCRIPTOR, *PCD_READ_DESCRIPTOR; 3390 3391 // ** FC_FORMATTABLE ** 3392 // Formattable descriptor format 0x23 3393 typedef struct _FORMATTABLE_DESCRIPTOR { 3394 PROFILE_LIST_DESCRIPTOR header; 3395 // BD-RE options 3396 UCHAR Cert : 1; 3397 UCHAR QCert : 1; 3398 UCHAR Expand : 1; // Format Type 0x01 (Expand Spare) 3399 UCHAR RENoSA : 1; // Format Type 0x31 (NoSpare) 3400 UCHAR Reserved : 4; 3401 UCHAR Reserved2[3]; 3402 // BD-R options 3403 UCHAR RRM : 1; 3404 UCHAR Reserved3 : 7; 3405 UCHAR Reserved4[3]; 3406 } FORMATTABLE_DESCRIPTOR, *PFORMATTABLE_DESCRIPTOR; 3407 3408 // ** FC_CDRW_CAV_WRITE ** 3409 // CD-RW CAV descriptor format 0x27 3410 typedef struct _CDRW_CAV_DESCRIPTOR { 3411 PROFILE_LIST_DESCRIPTOR header; 3412 3413 UCHAR Reserved[4]; 3414 } CDRW_CAV_DESCRIPTOR, *PCDRW_CAV_DESCRIPTOR; 3415 3416 // ** FC_MRW ** 3417 // MRW descriptor format 0x28 3418 typedef struct _MRW_DESCRIPTOR { 3419 PROFILE_LIST_DESCRIPTOR header; 3420 3421 UCHAR Write : 1; 3422 UCHAR Reserved2 : 7; 3423 UCHAR Reserved3[3]; 3424 } MRW_DESCRIPTOR, *PMRW_DESCRIPTOR; 3425 3426 // ** FC_DVDpRW ** 3427 // DVD+RW descriptor format 3428 typedef struct _DVDpRW_DESCRIPTOR { 3429 PROFILE_LIST_DESCRIPTOR header; 3430 3431 UCHAR Write : 1; 3432 UCHAR Reserved1 : 7; 3433 3434 UCHAR CloseOnly : 1; 3435 UCHAR QuickStart : 1; 3436 UCHAR Reserved2 : 6; 3437 3438 UCHAR Reserved3[2]; 3439 } DVDpRW_DESCRIPTOR, *PDVDpRW_DESCRIPTOR; 3440 3441 // ** FC_DVDpR ** 3442 // DVD+R descriptor format 3443 typedef struct _DVDpR_DESCRIPTOR { 3444 PROFILE_LIST_DESCRIPTOR header; 3445 3446 UCHAR Write : 1; 3447 UCHAR Reserved2 : 7; 3448 UCHAR Reserved3[3]; 3449 } DVDpR_DESCRIPTOR, *PDVDpR_DESCRIPTOR; 3450 3451 // ** FC_DVD_R_RW_WRITE ** 3452 // DVD+R/RW writable descriptor format 3453 typedef struct _DVD_R_RW_WRITE_DESCRIPTOR { 3454 PROFILE_LIST_DESCRIPTOR header; 3455 3456 UCHAR Reserved1 : 1; 3457 UCHAR DvdRW : 1; 3458 UCHAR TestWrite : 1; 3459 UCHAR Reserved2 : 3; 3460 UCHAR BUF : 1; 3461 UCHAR Reserved3 : 1; 3462 3463 UCHAR Reserved4[3]; 3464 } DVD_R_RW_WRITE_DESCRIPTOR, *PDVD_R_RW_WRITE_DESCRIPTOR; 3465 3466 // ** FC_DVDpR_DL ** 3467 // DVD+R DL descriptor format 3468 typedef struct _DVDpR_DL_DESCRIPTOR { 3469 PROFILE_LIST_DESCRIPTOR header; 3470 3471 UCHAR Write : 1; 3472 UCHAR Reserved2 : 7; 3473 UCHAR Reserved3[3]; 3474 } DVDpR_DL_DESCRIPTOR, *PDVDpR_DL_DESCRIPTOR; 3475 3476 // ** FC_REAL_TIME_STREAMING ** 3477 // Real-time streaming descriptor format 3478 typedef struct _REAL_TIME_STREAMING_DESCRIPTOR { 3479 PROFILE_LIST_DESCRIPTOR header; 3480 3481 UCHAR SW : 1; // Stream Writing 3482 UCHAR WSPD : 1; // Write Speed (0x03) in GET_PREFORMANCE supported 3483 UCHAR MP2A : 1; // Mode page 2a (capabilities) supported 3484 UCHAR SCS : 1; // Set CD Speed supported 3485 UCHAR RBCB : 1; // Read Buffer Capacity supported 3486 UCHAR Reserved : 3; 3487 3488 UCHAR Reserved3[3]; 3489 } REAL_TIME_STREAMING_DESCRIPTOR, *PREAL_TIME_STREAMING_DESCRIPTOR; 3490 3491 // ** FC_BD_READ ** 3492 // BlueRay Read descriptor format 0x40 3493 typedef struct _BD_READ_DESCRIPTOR { 3494 PROFILE_LIST_DESCRIPTOR header; 3495 3496 UCHAR Reserved[4]; 3497 struct { 3498 UCHAR Class0[2]; 3499 UCHAR Class1[2]; 3500 UCHAR Class2[2]; 3501 UCHAR Class3[2]; 3502 } BD_RE_Bitmaps; 3503 struct { 3504 UCHAR Class0[2]; 3505 UCHAR Class1[2]; 3506 UCHAR Class2[2]; 3507 UCHAR Class3[2]; 3508 } BD_R_Bitmaps; 3509 struct { 3510 UCHAR Class0[2]; 3511 UCHAR Class1[2]; 3512 UCHAR Class2[2]; 3513 UCHAR Class3[2]; 3514 } BD_ROM_Bitmaps; 3515 3516 } BD_READ_DESCRIPTOR, *PBD_READ_DESCRIPTOR; 3517 3518 // ** FC_BD_WRITE ** 3519 // BlueRay Write descriptor format 0x41 3520 typedef struct _BD_WRITE_DESCRIPTOR { 3521 PROFILE_LIST_DESCRIPTOR header; 3522 3523 UCHAR SVNR : 1; 3524 UCHAR Reserved : 7; 3525 UCHAR Reserved2[3]; 3526 struct { 3527 UCHAR Class0[2]; 3528 UCHAR Class1[2]; 3529 UCHAR Class2[2]; 3530 UCHAR Class3[2]; 3531 } BD_RE_Bitmaps; 3532 struct { 3533 UCHAR Class0[2]; 3534 UCHAR Class1[2]; 3535 UCHAR Class2[2]; 3536 UCHAR Class3[2]; 3537 } BD_R_Bitmaps; 3538 3539 } BD_WRITE_DESCRIPTOR, *PBD_WRITE_DESCRIPTOR; 3540 3541 // DVD structure blocks 3542 3543 #define DvdBookType_ROM 0 3544 #define DvdBookType_RAM 1 3545 #define DvdBookType_R 2 3546 #define DvdBookType_RW 3 3547 #define DvdBookType_HD_ROM 4 3548 #define DvdBookType_HD_RAM 5 3549 #define DvdBookType_HD_R 6 3550 #define DvdBookType_pRold 8 // old spec ?? 3551 #define DvdBookType_pRW 9 3552 #define DvdBookType_pR 0x0a 3553 #define DvdBookType_pRW_DL 0x0d 3554 #define DvdBookType_pR_DL 0x0e 3555 3556 #define DvdDiskSize_120mm 0 3557 #define DvdDiskSize_80mm 1 3558 3559 #define DvdLayerType_ROM 0x01 3560 #define DvdLayerType_R 0x02 3561 #define DvdLayerType_RW 0x04 3562 3563 #define DvdMinimumRate_2_52 0x00 3564 #define DvdMinimumRate_5_04 0x01 3565 #define DvdMinimumRate_10_08 0x02 3566 #define DvdMinimumRate_20_16 0x03 3567 #define DvdMinimumRate_30_24 0x04 3568 #define DvdMinimumRate_NotSpecified 0x0f 3569 3570 typedef struct _DVD_COPYRIGHT_INFORMATION { 3571 UCHAR CopyrightProtectionSystemType; 3572 UCHAR RegionManagementInformation; 3573 UCHAR Reserved[2]; 3574 } DVD_COPYRIGHT_INFORMATION, *PDVD_COPYRIGHT_INFORMATION; 3575 3576 typedef struct _DVD_DISK_KEY_STRUCTURES { 3577 UCHAR DiskKeyData[2048]; 3578 } DVD_DISK_KEY_STRUCTURES, *PDVD_DISK_KEY_STRUCTURES; 3579 3580 typedef struct _CDVD_KEY_HEADER { 3581 UCHAR DataLength[2]; 3582 UCHAR Reserved[2]; 3583 } CDVD_KEY_HEADER, *PCDVD_KEY_HEADER; 3584 3585 typedef struct _CDVD_REPORT_AGID_DATA { 3586 CDVD_KEY_HEADER Header; 3587 UCHAR Reserved1[3]; 3588 UCHAR Reserved2 : 6; 3589 UCHAR AGID : 2; 3590 } CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA; 3591 3592 typedef struct _CDVD_CHALLENGE_KEY_DATA { 3593 CDVD_KEY_HEADER Header; 3594 UCHAR ChallengeKeyValue[10]; 3595 UCHAR Reserved[2]; 3596 } CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA; 3597 3598 typedef struct _CDVD_KEY_DATA { 3599 CDVD_KEY_HEADER Header; 3600 UCHAR Key[5]; 3601 UCHAR Reserved[3]; 3602 } CDVD_KEY_DATA, *PCDVD_KEY_DATA; 3603 3604 typedef struct _CDVD_REPORT_ASF_DATA { 3605 CDVD_KEY_HEADER Header; 3606 UCHAR Reserved1[3]; 3607 UCHAR Success : 1; 3608 UCHAR Reserved2 : 7; 3609 } CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA; 3610 3611 typedef struct _CDVD_TITLE_KEY_HEADER { 3612 CDVD_KEY_HEADER Header; 3613 UCHAR Reserved1[1]; 3614 UCHAR Reserved2 : 3; 3615 UCHAR CGMS : 2; 3616 UCHAR CP_SEC : 1; 3617 UCHAR CPM : 1; 3618 UCHAR Zero : 1; 3619 CDVD_KEY_DATA TitleKey; 3620 } CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER; 3621 3622 #pragma pack(pop) 3623 3624 #endif //__CDRW_DEVICE_H__ 3625