Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Modules/i386/include/IOKit/storage/IODVDTypes.h

1/*
2 * Copyright (c) 1998-2009 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 UInt8DVDCPRMRegionCode;
67enum
68{
69kDVDCPRMRegion1= 0xFE,
70kDVDCPRMRegion2= 0xFD,
71kDVDCPRMRegion3= 0xFB,
72kDVDCPRMRegion4= 0xF7,
73kDVDCPRMRegion5= 0xEF,
74kDVDCPRMRegion6= 0xDF
75};
76
77typedef UInt8DVDRegionalPlaybackControlScheme;
78enum
79{
80kDVDRegionalPlaybackControlSchemePhase1= 0x00,
81kDVDRegionalPlaybackControlSchemePhase2= 0x01
82};
83
84typedef UInt8DVDBookType;
85enum
86{
87kDVDBookTypeROM= 0x0,
88kDVDBookTypeRAM= 0x1,
89kDVDBookTypeR= 0x2,
90kDVDBookTypeRW= 0x3,
91kDVDBookTypeHDROM= 0x4,
92kDVDBookTypeHDRAM= 0x5,
93kDVDBookTypeHDR= 0x6,
94kDVDBookTypeHDRW= 0x7,
95kDVDBookTypePlusRW= 0x9,
96kDVDBookTypePlusR= 0xA,
97kDVDBookTypePlusRWDoubleLayer= 0xD,
98kDVDBookTypePlusRDoubleLayer= 0xE
99};
100
101#ifdef __LP64__
102typedef UInt8DVDKeyClass;
103enum
104#else /* !__LP64__ */
105enum DVDKeyClass
106#endif /* !__LP64__ */
107{
108kDVDKeyClassCSS_CPPM_CPRM= 0x00,
109kDVDKeyClassRSSA= 0x01
110};
111#ifndef __LP64__
112typedef enum DVDKeyClass DVDKeyClass;
113#endif /* !__LP64__ */
114
115#ifdef __LP64__
116typedef UInt8DVDKeyFormat;
117enum
118#else /* !__LP64__ */
119enum DVDKeyFormat
120#endif /* !__LP64__ */
121{
122kDVDKeyFormatAGID_CSS= 0x00,
123kDVDKeyFormatChallengeKey= 0x01,
124kDVDKeyFormatKey1= 0x02,
125kDVDKeyFormatKey2= 0x03,
126kDVDKeyFormatTitleKey= 0x04,
127kDVDKeyFormatASF= 0x05,
128kDVDKeyFormatSetRegion= 0x06,
129kDVDKeyFormatRegionState= 0x08,
130kDVDKeyFormatAGID_CSS2= 0x10,
131kDVDKeyFormatAGID_CPRM= 0x11,
132kDVDKeyFormatAGID_Invalidate= 0x3F
133};
134#ifndef __LP64__
135typedef enum DVDKeyFormat DVDKeyFormat;
136#endif /* !__LP64__ */
137
138typedef UInt8DVDStructureFormat;
139enum
140{
141kDVDStructureFormatPhysicalFormatInfo= 0x00,
142kDVDStructureFormatCopyrightInfo= 0x01,
143kDVDStructureFormatDiscKeyInfo= 0x02,
144// skip BCA
145kDVDStructureFormatManufacturingInfo= 0x04
146};
147
148// Read DVD Structures Format 0x00
149struct DVDPhysicalFormatInfo
150{
151UInt8dataLength[2];
152UInt8reserved[2];
153#ifdef __LITTLE_ENDIAN__
154// Byte 0
155UInt8partVersion:4;
156UInt8bookType:4;
157
158// Byte 1
159UInt8minimumRate:4;
160UInt8discSize:4;
161
162// Byte 2
163UInt8layerType:4;
164UInt8trackPath:1;
165UInt8numberOfLayers:2;
166UInt8reserved2:1;
167
168// Byte 3
169UInt8trackDensity:4;
170UInt8linearDensity:4;
171#else /* !__LITTLE_ENDIAN__ */
172// Byte 0
173UInt8bookType:4;
174UInt8partVersion:4;
175
176// Byte 1
177UInt8discSize:4;
178UInt8minimumRate:4;
179
180// Byte 2
181UInt8reserved2:1;
182UInt8numberOfLayers:2;
183UInt8trackPath:1;
184UInt8layerType:4;
185
186// Byte 3
187UInt8linearDensity:4;
188UInt8trackDensity:4;
189#endif /* !__LITTLE_ENDIAN__ */
190
191// Bytes 4-15
192UInt8zero1;// always 0x00
193UInt8startingPhysicalSectorNumberOfDataArea[3];
194UInt8zero2;// always 0x00
195UInt8endPhysicalSectorNumberOfDataArea[3];
196UInt8zero3;// always 0x00
197UInt8endSectorNumberInLayerZero[3];
198
199// Byte 16
200#ifdef __LITTLE_ENDIAN__
201UInt8reserved1:7;
202UInt8bcaFlag:1;
203#else /* !__LITTLE_ENDIAN__ */
204UInt8bcaFlag:1;
205UInt8reserved1:7;
206#endif /* !__LITTLE_ENDIAN__ */
207
208// Bytes 17-2047
209UInt8mediaSpecific[2031];
210};
211typedef struct DVDPhysicalFormatInfo DVDPhysicalFormatInfo;
212
213// Read DVD Structures Format 0x01
214struct DVDCopyrightInfo
215{
216UInt8dataLength[2];
217UInt8reserved[2];
218UInt8copyrightProtectionSystemType;
219DVDCPRMRegionCoderegionMask;
220UInt8reserved2[2];
221};
222typedef struct DVDCopyrightInfo DVDCopyrightInfo;
223
224// Read DVD Structures Format 0x02
225struct DVDDiscKeyInfo
226{
227UInt8dataLength[2];
228UInt8reserved[2];
229UInt8discKeyStructures[2048];
230};
231typedef struct DVDDiscKeyInfo DVDDiscKeyInfo;
232
233// Read DVD Structures Format 0x04
234struct DVDManufacturingInfo
235{
236UInt8dataLength[2];
237UInt8reserved[2];
238UInt8discManufacturingInfo[2048];
239};
240typedef struct DVDManufacturingInfo DVDManufacturingInfo;
241
242// ReportKey Format 0x00
243struct DVDAuthenticationGrantIDInfo
244{
245UInt8dataLength[2];
246UInt8reserved[2];
247UInt8reserved2[3];
248#ifdef __LITTLE_ENDIAN__
249UInt8reservedBits:6;
250UInt8grantID:2;
251#else /* !__LITTLE_ENDIAN__ */
252UInt8grantID:2;
253UInt8reservedBits:6;
254#endif /* !__LITTLE_ENDIAN__ */
255};
256typedef struct DVDAuthenticationGrantIDInfo DVDAuthenticationGrantIDInfo;
257
258// ReportKey and SendKey Format 0x01
259struct DVDChallengeKeyInfo
260{
261UInt8dataLength[2];
262UInt8reserved[2];
263UInt8challengeKeyValue[10];
264UInt8reserved2[2];
265};
266typedef struct DVDChallengeKeyInfo DVDChallengeKeyInfo;
267
268// ReportKey Format 0x02
269struct DVDKey1Info
270{
271UInt8dataLength[2];
272UInt8reserved[2];
273UInt8key1Value[5];
274UInt8reserved2[3];
275};
276typedef struct DVDKey1Info DVDKey1Info;
277
278// SendKey Format 0x03
279struct DVDKey2Info
280{
281UInt8dataLength[2];
282UInt8reserved[2];
283UInt8key2Value[5];
284UInt8reserved2[3];
285};
286typedef struct DVDKey2Info DVDKey2Info;
287
288// ReportKey Format 0x04
289struct DVDTitleKeyInfo
290{
291UInt8dataLength[2];
292UInt8reserved[2];
293#ifdef __LITTLE_ENDIAN__
294UInt8CP_MOD:4;
295UInt8CGMS:2;
296UInt8CP_SEC:1;
297UInt8CPM:1;
298#else /* !__LITTLE_ENDIAN__ */
299UInt8CPM:1;
300UInt8CP_SEC:1;
301UInt8CGMS:2;
302UInt8CP_MOD:4;
303#endif /* !__LITTLE_ENDIAN__ */
304UInt8titleKeyValue[5];
305UInt8reserved2[2];
306};
307typedef struct DVDTitleKeyInfo DVDTitleKeyInfo;
308
309// ReportKey Format 0x05
310struct DVDAuthenticationSuccessFlagInfo
311{
312UInt8dataLength[2];
313UInt8reserved[2];
314UInt8reserved2[3];
315#ifdef __LITTLE_ENDIAN__
316UInt8successFlag:1;
317UInt8reservedBits:7;
318#else /* !__LITTLE_ENDIAN__ */
319UInt8reservedBits:7;
320UInt8successFlag:1;
321#endif /* !__LITTLE_ENDIAN__ */
322};
323typedef struct DVDAuthenticationSuccessFlagInfo DVDAuthenticationSuccessFlagInfo;
324
325// ReportKey Format 0x08
326struct DVDRegionPlaybackControlInfo
327{
328UInt8dataLength[2];
329UInt8reserved[2];
330#ifdef __LITTLE_ENDIAN__
331UInt8numberUserResets:3;
332UInt8numberVendorResets:3;
333UInt8typeCode:2;
334#else /* !__LITTLE_ENDIAN__ */
335UInt8typeCode:2;
336UInt8numberVendorResets:3;
337UInt8numberUserResets:3;
338#endif /* !__LITTLE_ENDIAN__ */
339DVDCPRMRegionCodedriveRegion;
340DVDRegionalPlaybackControlSchemerpcScheme;
341UInt8reserved2;
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

Archive Download this file

Revision: 1621