1/* 2 * Copyright (c) 1998-2012 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24#ifndef _IODVDTYPES_H 25#define _IODVDTYPES_H 26 27#include <IOKit/IOTypes.h> 28 29#pragma pack(push, 1) /* (enable 8-bit struct packing) */ 30 31/* 32 * Media Types 33 */ 34 35enum 36{ 37 kDVDMediaTypeUnknown = 0x0200, 38 kDVDMediaTypeROM = 0x0202, /* DVD-ROM */ 39 kDVDMediaTypeRAM = 0x0203, /* DVD-RAM */ 40 kDVDMediaTypeR = 0x0204, /* DVD-R */ 41 kDVDMediaTypeRW = 0x0205, /* DVD-RW */ 42 kDVDMediaTypePlusRW = 0x0206, /* DVD+RW */ 43 kDVDMediaTypePlusR = 0x0207, /* DVD+R */ 44 kDVDMediaTypeHDROM = 0x0212, /* HD DVD-ROM */ 45 kDVDMediaTypeHDRAM = 0x0213, /* HD DVD-RAM */ 46 kDVDMediaTypeHDR = 0x0214, /* HD DVD-R */ 47 kDVDMediaTypeHDRW = 0x0215, /* HD DVD-RW */ 48 49 kDVDMediaTypeMin = 0x0200, 50 kDVDMediaTypeMax = 0x02FF 51}; 52 53typedef UInt32 DVDMediaType; 54 55/* 56 * Media Speed (kB/s) 57 */ 58 59#define kDVDSpeedMin 0x0546 60#define kDVDSpeedMax 0xFFFF 61 62/* 63 * MMC Formats 64 */ 65 66typedef UInt8 DVDCPRMRegionCode; 67enum 68{ 69 kDVDCPRMRegion1 = 0xFE, 70 kDVDCPRMRegion2 = 0xFD, 71 kDVDCPRMRegion3 = 0xFB, 72 kDVDCPRMRegion4 = 0xF7, 73 kDVDCPRMRegion5 = 0xEF, 74 kDVDCPRMRegion6 = 0xDF 75}; 76 77typedef UInt8 DVDRegionalPlaybackControlScheme; 78enum 79{ 80 kDVDRegionalPlaybackControlSchemePhase1 = 0x00, 81 kDVDRegionalPlaybackControlSchemePhase2 = 0x01 82}; 83 84typedef UInt8 DVDBookType; 85enum 86{ 87 kDVDBookTypeROM = 0x0, 88 kDVDBookTypeRAM = 0x1, 89 kDVDBookTypeR = 0x2, 90 kDVDBookTypeRW = 0x3, 91 kDVDBookTypeHDROM = 0x4, 92 kDVDBookTypeHDRAM = 0x5, 93 kDVDBookTypeHDR = 0x6, 94 kDVDBookTypeHDRW = 0x7, 95 kDVDBookTypePlusRW = 0x9, 96 kDVDBookTypePlusR = 0xA, 97 kDVDBookTypePlusRWDoubleLayer = 0xD, 98 kDVDBookTypePlusRDoubleLayer = 0xE 99}; 100 101#ifdef __LP64__ 102typedef UInt8 DVDKeyClass; 103enum 104#else /* !__LP64__ */ 105enum DVDKeyClass 106#endif /* !__LP64__ */ 107{ 108 kDVDKeyClassCSS_CPPM_CPRM = 0x00, 109 kDVDKeyClassRSSA = 0x01 110}; 111#ifndef __LP64__ 112typedef enum DVDKeyClass DVDKeyClass; 113#endif /* !__LP64__ */ 114 115#ifdef __LP64__ 116typedef UInt8 DVDKeyFormat; 117enum 118#else /* !__LP64__ */ 119enum DVDKeyFormat 120#endif /* !__LP64__ */ 121{ 122 kDVDKeyFormatAGID_CSS = 0x00, 123 kDVDKeyFormatChallengeKey = 0x01, 124 kDVDKeyFormatKey1 = 0x02, 125 kDVDKeyFormatKey2 = 0x03, 126 kDVDKeyFormatTitleKey = 0x04, 127 kDVDKeyFormatASF = 0x05, 128 kDVDKeyFormatSetRegion = 0x06, 129 kDVDKeyFormatRegionState = 0x08, 130 kDVDKeyFormatAGID_CSS2 = 0x10, 131 kDVDKeyFormatAGID_CPRM = 0x11, 132 kDVDKeyFormatAGID_Invalidate = 0x3F 133}; 134#ifndef __LP64__ 135typedef enum DVDKeyFormat DVDKeyFormat; 136#endif /* !__LP64__ */ 137 138typedef UInt8 DVDStructureFormat; 139enum 140{ 141 kDVDStructureFormatPhysicalFormatInfo = 0x00, 142 kDVDStructureFormatCopyrightInfo = 0x01, 143 kDVDStructureFormatDiscKeyInfo = 0x02, 144 // skip BCA 145 kDVDStructureFormatManufacturingInfo = 0x04 146}; 147 148// Read DVD Structures Format 0x00 149struct DVDPhysicalFormatInfo 150{ 151 UInt8 dataLength[2]; 152 UInt8 reserved[2]; 153#ifdef __LITTLE_ENDIAN__ 154 // Byte 0 155 UInt8 partVersion:4; 156 UInt8 bookType:4; 157 158 // Byte 1 159 UInt8 minimumRate:4; 160 UInt8 discSize:4; 161 162 // Byte 2 163 UInt8 layerType:4; 164 UInt8 trackPath:1; 165 UInt8 numberOfLayers:2; 166 UInt8 reserved2:1; 167 168 // Byte 3 169 UInt8 trackDensity:4; 170 UInt8 linearDensity:4; 171#else /* !__LITTLE_ENDIAN__ */ 172 // Byte 0 173 UInt8 bookType:4; 174 UInt8 partVersion:4; 175 176 // Byte 1 177 UInt8 discSize:4; 178 UInt8 minimumRate:4; 179 180 // Byte 2 181 UInt8 reserved2:1; 182 UInt8 numberOfLayers:2; 183 UInt8 trackPath:1; 184 UInt8 layerType:4; 185 186 // Byte 3 187 UInt8 linearDensity:4; 188 UInt8 trackDensity:4; 189#endif /* !__LITTLE_ENDIAN__ */ 190 191 // Bytes 4-15 192 UInt8 zero1; // always 0x00 193 UInt8 startingPhysicalSectorNumberOfDataArea[3]; 194 UInt8 zero2; // always 0x00 195 UInt8 endPhysicalSectorNumberOfDataArea[3]; 196 UInt8 zero3; // always 0x00 197 UInt8 endSectorNumberInLayerZero[3]; 198 199 // Byte 16 200#ifdef __LITTLE_ENDIAN__ 201 UInt8 reserved1:7; 202 UInt8 bcaFlag:1; 203#else /* !__LITTLE_ENDIAN__ */ 204 UInt8 bcaFlag:1; 205 UInt8 reserved1:7; 206#endif /* !__LITTLE_ENDIAN__ */ 207 208 // Bytes 17-2047 209 UInt8 mediaSpecific[2031]; 210}; 211typedef struct DVDPhysicalFormatInfo DVDPhysicalFormatInfo; 212 213// Read DVD Structures Format 0x01 214struct DVDCopyrightInfo 215{ 216 UInt8 dataLength[2]; 217 UInt8 reserved[2]; 218 UInt8 copyrightProtectionSystemType; 219 DVDCPRMRegionCode regionMask; 220 UInt8 reserved2[2]; 221}; 222typedef struct DVDCopyrightInfo DVDCopyrightInfo; 223 224// Read DVD Structures Format 0x02 225struct DVDDiscKeyInfo 226{ 227 UInt8 dataLength[2]; 228 UInt8 reserved[2]; 229 UInt8 discKeyStructures[2048]; 230}; 231typedef struct DVDDiscKeyInfo DVDDiscKeyInfo; 232 233// Read DVD Structures Format 0x04 234struct DVDManufacturingInfo 235{ 236 UInt8 dataLength[2]; 237 UInt8 reserved[2]; 238 UInt8 discManufacturingInfo[2048]; 239}; 240typedef struct DVDManufacturingInfo DVDManufacturingInfo; 241 242// ReportKey Format 0x00 243struct DVDAuthenticationGrantIDInfo 244{ 245 UInt8 dataLength[2]; 246 UInt8 reserved[2]; 247 UInt8 reserved2[3]; 248#ifdef __LITTLE_ENDIAN__ 249 UInt8 reservedBits:6; 250 UInt8 grantID:2; 251#else /* !__LITTLE_ENDIAN__ */ 252 UInt8 grantID:2; 253 UInt8 reservedBits:6; 254#endif /* !__LITTLE_ENDIAN__ */ 255}; 256typedef struct DVDAuthenticationGrantIDInfo DVDAuthenticationGrantIDInfo; 257 258// ReportKey and SendKey Format 0x01 259struct DVDChallengeKeyInfo 260{ 261 UInt8 dataLength[2]; 262 UInt8 reserved[2]; 263 UInt8 challengeKeyValue[10]; 264 UInt8 reserved2[2]; 265}; 266typedef struct DVDChallengeKeyInfo DVDChallengeKeyInfo; 267 268// ReportKey Format 0x02 269struct DVDKey1Info 270{ 271 UInt8 dataLength[2]; 272 UInt8 reserved[2]; 273 UInt8 key1Value[5]; 274 UInt8 reserved2[3]; 275}; 276typedef struct DVDKey1Info DVDKey1Info; 277 278// SendKey Format 0x03 279struct DVDKey2Info 280{ 281 UInt8 dataLength[2]; 282 UInt8 reserved[2]; 283 UInt8 key2Value[5]; 284 UInt8 reserved2[3]; 285}; 286typedef struct DVDKey2Info DVDKey2Info; 287 288// ReportKey Format 0x04 289struct DVDTitleKeyInfo 290{ 291 UInt8 dataLength[2]; 292 UInt8 reserved[2]; 293#ifdef __LITTLE_ENDIAN__ 294 UInt8 CP_MOD:4; 295 UInt8 CGMS:2; 296 UInt8 CP_SEC:1; 297 UInt8 CPM:1; 298#else /* !__LITTLE_ENDIAN__ */ 299 UInt8 CPM:1; 300 UInt8 CP_SEC:1; 301 UInt8 CGMS:2; 302 UInt8 CP_MOD:4; 303#endif /* !__LITTLE_ENDIAN__ */ 304 UInt8 titleKeyValue[5]; 305 UInt8 reserved2[2]; 306}; 307typedef struct DVDTitleKeyInfo DVDTitleKeyInfo; 308 309// ReportKey Format 0x05 310struct DVDAuthenticationSuccessFlagInfo 311{ 312 UInt8 dataLength[2]; 313 UInt8 reserved[2]; 314 UInt8 reserved2[3]; 315#ifdef __LITTLE_ENDIAN__ 316 UInt8 successFlag:1; 317 UInt8 reservedBits:7; 318#else /* !__LITTLE_ENDIAN__ */ 319 UInt8 reservedBits:7; 320 UInt8 successFlag:1; 321#endif /* !__LITTLE_ENDIAN__ */ 322}; 323typedef struct DVDAuthenticationSuccessFlagInfo DVDAuthenticationSuccessFlagInfo; 324 325// ReportKey Format 0x08 326struct DVDRegionPlaybackControlInfo 327{ 328 UInt8 dataLength[2]; 329 UInt8 reserved[2]; 330#ifdef __LITTLE_ENDIAN__ 331 UInt8 numberUserResets:3; 332 UInt8 numberVendorResets:3; 333 UInt8 typeCode:2; 334#else /* !__LITTLE_ENDIAN__ */ 335 UInt8 typeCode:2; 336 UInt8 numberVendorResets:3; 337 UInt8 numberUserResets:3; 338#endif /* !__LITTLE_ENDIAN__ */ 339 DVDCPRMRegionCode driveRegion; 340 DVDRegionalPlaybackControlScheme rpcScheme; 341 UInt8 reserved2; 342}; 343typedef struct DVDRegionPlaybackControlInfo DVDRegionPlaybackControlInfo; 344 345// Read Disc Information Format 346struct DVDDiscInfo 347{ 348 UInt16 dataLength; 349#ifdef __LITTLE_ENDIAN__ 350 UInt8 discStatus:2; 351 UInt8 stateOfLastBorder:2; 352 UInt8 erasable:1; 353 UInt8 reserved:3; 354#else /* !__LITTLE_ENDIAN__ */ 355 UInt8 reserved:3; 356 UInt8 erasable:1; 357 UInt8 stateOfLastBorder:2; 358 UInt8 discStatus:2; 359#endif /* !__LITTLE_ENDIAN__ */ 360 UInt8 reserved2; 361 UInt8 numberOfBordersLSB; 362 UInt8 firstRZoneNumberInLastBorderLSB; 363 UInt8 lastRZoneNumberInLastBorderLSB; 364#ifdef __LITTLE_ENDIAN__ 365 UInt8 reserved3:5; 366 UInt8 unrestrictedUse:1; 367 UInt8 discBarCodeValid:1; 368 UInt8 reserved4:1; 369#else /* !__LITTLE_ENDIAN__ */ 370 UInt8 reserved4:1; 371 UInt8 discBarCodeValid:1; 372 UInt8 unrestrictedUse:1; 373 UInt8 reserved3:5; 374#endif /* !__LITTLE_ENDIAN__ */ 375 UInt8 reserved5; 376 UInt8 numberOfBordersMSB; 377 UInt8 firstRZoneNumberInLastBorderMSB; 378 UInt8 lastRZoneNumberInLastBorderMSB; 379 UInt8 reserved6[4]; 380 UInt8 reserved7[4]; 381 UInt8 reserved8[4]; 382 UInt8 discBarCode[8]; 383 UInt8 reserved9; 384 UInt8 numberOfOPCTableEntries; 385 UInt8 opcTableEntries[0]; 386}; 387typedef struct DVDDiscInfo DVDDiscInfo; 388 389// Read RZone Information Address Types 390typedef UInt8 DVDRZoneInfoAddressType; 391enum 392{ 393 kDVDRZoneInfoAddressTypeLBA = 0x00, 394 kDVDRZoneInfoAddressTypeRZoneNumber = 0x01, 395 kDVDRZoneInfoAddressTypeBorderNumber = 0x02, 396}; 397 398// Read RZone Information Format 399struct DVDRZoneInfo 400{ 401 UInt16 dataLength; 402 UInt8 rzoneNumberLSB; 403 UInt8 borderNumberLSB; 404 UInt8 reserved; 405#ifdef __LITTLE_ENDIAN__ 406 UInt8 reserved2:4; 407 UInt8 copy:1; 408 UInt8 damage:1; 409 UInt8 reserved3:2; 410 411 UInt8 reserved4:4; 412 UInt8 restrictedOverwrite:1; 413 UInt8 incremental:1; 414 UInt8 blank:1; 415 UInt8 reservedRZone:1; 416 417 UInt8 nextWritableAddressValid:1; 418 UInt8 lastRecordedAddressValid:1; 419 UInt8 reserved5:6; 420#else /* !__LITTLE_ENDIAN__ */ 421 UInt8 reserved3:2; 422 UInt8 damage:1; 423 UInt8 copy:1; 424 UInt8 reserved2:4; 425 426 UInt8 reservedRZone:1; 427 UInt8 blank:1; 428 UInt8 incremental:1; 429 UInt8 restrictedOverwrite:1; 430 UInt8 reserved4:4; 431 432 UInt8 reserved5:6; 433 UInt8 lastRecordedAddressValid:1; 434 UInt8 nextWritableAddressValid:1; 435#endif /* !__LITTLE_ENDIAN__ */ 436 UInt32 rzoneStartAddress; 437 UInt32 nextWritableAddress; 438 UInt32 freeBlocks; 439 UInt32 blockingFactor; 440 UInt32 rzoneSize; 441 UInt32 lastRecordedAddress; 442 UInt8 rzoneNumberMSB; 443 UInt8 borderNumberMSB; 444 UInt8 reserved6; 445 UInt8 reserved7; 446}; 447typedef struct DVDRZoneInfo DVDRZoneInfo; 448 449#pragma pack(pop) /* (reset to default struct packing) */ 450 451#endif /* _IODVDTYPES_H */ 452