1/*
2 * Copyright (c) 2006-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	_BDTYPES_H
25#define	_BDTYPES_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    kBDMediaTypeUnknown   = 0x0300,
38    kBDMediaTypeROM       = 0x0302, /* BD-ROM */
39    kBDMediaTypeRE        = 0x0303, /* BD-RE  */
40    kBDMediaTypeR         = 0x0304, /* BD-R   */
41
42    kBDMediaTypeMin       = 0x0300,
43    kBDMediaTypeMax       = 0x03FF
44};
45
46typedef UInt32 BDMediaType;
47
48/*
49 * Media Speed (kB/s)
50 */
51
52#define kBDSpeedMin 0x1126
53#define kBDSpeedMax 0xFFFF
54
55/*
56 * MMC Formats
57 */
58
59// Read Disc Information Format
60struct BDDiscInfo
61{
62    UInt16 dataLength;
63#ifdef __LITTLE_ENDIAN__
64    UInt8  discStatus:2;
65    UInt8  stateOfLastSession:2;
66    UInt8  erasable:1;
67    UInt8  dataType:3;
68#else /* !__LITTLE_ENDIAN__ */
69    UInt8  dataType:3;
70    UInt8  erasable:1;
71    UInt8  stateOfLastSession:2;
72    UInt8  discStatus:2;
73#endif /* !__LITTLE_ENDIAN__ */
74    UInt8  reserved2;
75    UInt8  numberOfSessionsLSB;
76    UInt8  firstTrackNumberInLastSessionLSB;
77    UInt8  lastTrackNumberInLastSessionLSB;
78    UInt8  reserved4[2];
79    UInt8  numberOfSessionsMSB;
80    UInt8  firstTrackNumberInLastSessionMSB;
81    UInt8  lastTrackNumberInLastSessionMSB;
82    UInt8  reserved6[22];
83};
84typedef struct BDDiscInfo BDDiscInfo;
85
86// Read Track Information Format
87struct BDTrackInfo
88{
89    UInt16 dataLength;
90    UInt8  trackNumberLSB;
91    UInt8  sessionNumberLSB;
92    UInt8  reserved;
93#ifdef __LITTLE_ENDIAN__
94    UInt8  reserved2:5;
95    UInt8  damage:1;
96    UInt8  reserved3:2;
97
98    UInt8  reserved4:6;
99    UInt8  blank:1;
100    UInt8  reservedTrack:1;
101
102    UInt8  nextWritableAddressValid:1;
103    UInt8  lastRecordedAddressValid:1;
104    UInt8  reserved5:6;
105#else /* !__LITTLE_ENDIAN__ */
106    UInt8  reserved3:2;
107    UInt8  damage:1;
108    UInt8  reserved2:5;
109
110    UInt8  reservedTrack:1;
111    UInt8  blank:1;
112    UInt8  reserved4:6;
113
114    UInt8  reserved5:6;
115    UInt8  lastRecordedAddressValid:1;
116    UInt8  nextWritableAddressValid:1;
117#endif /* !__LITTLE_ENDIAN__ */
118    UInt32 trackStartAddress;
119    UInt32 nextWritableAddress;
120    UInt32 freeBlocks;
121    UInt32 clusterSize;
122    UInt32 trackSize;
123    UInt32 lastRecordedAddress;
124    UInt8  trackNumberMSB;
125    UInt8  sessionNumberMSB;
126    UInt8  reserved6;
127    UInt8  reserved7;
128};
129typedef struct BDTrackInfo BDTrackInfo;
130
131#pragma pack(pop)                        /* (reset to default struct packing) */
132
133#endif /* _BDTYPES_H */
134