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/*!
25 * @header IODVDMedia
26 * @abstract
27 * This header contains the IODVDMedia class definition.
28 */
29
30#ifndef _IODVDMEDIA_H
31#define _IODVDMEDIA_H
32
33/*!
34 * @defined kIODVDMediaClass
35 * @abstract
36 * kIODVDMediaClass is the name of the IODVDMedia class.
37 * @discussion
38 * kIODVDMediaClass is the name of the IODVDMedia class.
39 */
40
41#define kIODVDMediaClass "IODVDMedia"
42
43/*!
44 * @defined kIODVDMediaTypeKey
45 * @abstract
46 * kIODVDMediaTypeKey is a property of IODVDMedia objects.  It has an OSString
47 * value.
48 * @discussion
49 * The kIODVDMediaTypeKey property identifies the DVD media type (DVD-ROM,
50 * DVD-R, DVD-RW, DVD+RW, DVD-RAM, etc).  See the kIODVDMediaType contants
51 * for possible values.
52 */
53
54#define kIODVDMediaTypeKey "Type"
55
56/*!
57 * @defined kIODVDMediaTypeROM
58 * The kIODVDMediaTypeKey constant for DVD-ROM media.
59 */
60
61#define kIODVDMediaTypeROM "DVD-ROM"
62
63/*!
64 * @defined kIODVDMediaTypeR
65 * The kIODVDMediaTypeKey constant for DVD Recordable (DVD-R) media.
66 */
67
68#define kIODVDMediaTypeR "DVD-R"
69
70/*!
71 * @defined kIODVDMediaTypeRW
72 * The kIODVDMediaTypeKey constant for DVD ReWritable (DVD-RW) media.
73 */
74
75#define kIODVDMediaTypeRW "DVD-RW"
76
77/*!
78 * @defined kIODVDMediaTypePlusR
79 * The kIODVDMediaTypeKey constant for DVD "Plus" Recordable (DVD+R) media.
80 */
81
82#define kIODVDMediaTypePlusR "DVD+R"
83
84/*!
85 * @defined kIODVDMediaTypePlusRW
86 * The kIODVDMediaTypeKey constant for DVD "Plus" ReWritable (DVD+RW) media.
87 */
88
89#define kIODVDMediaTypePlusRW "DVD+RW"
90
91/*!
92 * @defined kIODVDMediaTypeRAM
93 * The kIODVDMediaTypeKey constant for DVD-RAM media.
94 */
95
96#define kIODVDMediaTypeRAM "DVD-RAM"
97
98/*!
99 * @defined kIODVDMediaTypeHDROM
100 * The kIODVDMediaTypeKey constant for HD DVD-ROM media.
101 */
102
103#define kIODVDMediaTypeHDROM "HD DVD-ROM"
104
105/*!
106 * @defined kIODVDMediaTypeHDR
107 * The kIODVDMediaTypeKey constant for HD DVD Recordable (HD DVD-R) media.
108 */
109
110#define kIODVDMediaTypeHDR "HD DVD-R"
111
112/*!
113 * @defined kIODVDMediaTypeHDRW
114 * The kIODVDMediaTypeKey constant for HD DVD ReWritable (HD DVD-RW) media.
115 */
116
117#define kIODVDMediaTypeHDRW "HD DVD-RW"
118
119/*!
120 * @defined kIODVDMediaTypeHDRAM
121 * The kIODVDMediaTypeKey constant for HD DVD-RAM media.
122 */
123
124#define kIODVDMediaTypeHDRAM "HD DVD-RAM"
125
126#ifdef KERNEL
127#ifdef __cplusplus
128
129/*
130 * Kernel
131 */
132
133#include <IOKit/storage/IODVDBlockStorageDriver.h>
134#include <IOKit/storage/IOMedia.h>
135
136/*!
137 * @class IODVDMedia
138 * @abstract
139 * The IODVDMedia class is a random-access disk device abstraction for DVDs.
140 * @discussion
141 * The IODVDMedia class is a random-access disk device abstraction for DVDs.
142 */
143
144class IODVDMedia : public IOMedia
145{
146    OSDeclareDefaultStructors(IODVDMedia)
147
148protected:
149
150    struct ExpansionData { /* */ };
151    ExpansionData * _expansionData;
152
153public:
154
155    /*
156     * Obtain this object's provider.   We override the superclass's method to
157     * return a more specific subclass of IOService -- IODVDBlockStorageDriver.
158     * This method serves simply as a convenience to subclass developers.
159     */
160
161    virtual IODVDBlockStorageDriver * getProvider() const;
162
163    /*
164     * Compare the properties in the supplied table to this object's properties.
165     */
166
167    virtual bool matchPropertyTable(OSDictionary * table, SInt32 * score);
168
169    /*!
170     * @function reportKey
171     * @discussion
172     * Issue an MMC REPORT KEY command.
173     * @param buffer
174     * Buffer for the data transfer.  The size of the buffer implies the size of
175     * the data transfer.  Pass null for the kDVDKeyFormatAGID_Invalidate format
176     * case.
177     * @param keyClass
178     * As documented by MMC.
179     * @param address
180     * As documented by MMC.
181     * @param grantID
182     * As documented by MMC.
183     * @param format
184     * As documented by MMC.
185     * @result
186     * Returns the status of the data transfer.
187     */
188
189    virtual IOReturn reportKey( IOMemoryDescriptor * buffer,
190                                const DVDKeyClass    keyClass,
191                                const UInt32         address,
192                                const UInt8          grantID,
193                                const DVDKeyFormat   format ); /* 10.1.0 */
194
195    /*!
196     * @function sendKey
197     * @discussion
198     * Issue an MMC SEND KEY command.
199     * @param buffer
200     * Buffer for the data transfer.  The size of the buffer implies the size of
201     * the data transfer.  Pass null for the kDVDKeyFormatAGID_Invalidate format
202     * case.
203     * @param keyClass
204     * As documented by MMC.
205     * @param grantID
206     * As documented by MMC.
207     * @param format
208     * As documented by MMC.
209     * @result
210     * Returns the status of the data transfer.
211     */
212
213    virtual IOReturn sendKey( IOMemoryDescriptor * buffer,
214                              const DVDKeyClass    keyClass,
215                              const UInt8          grantID,
216                              const DVDKeyFormat   format ); /* 10.1.0 */
217
218    /*!
219     * @function readStructure
220     * @discussion
221     * Issue an MMC READ DVD STRUCTURE command.
222     * @param buffer
223     * Buffer for the data transfer.  The size of the buffer implies the size of
224     * the data transfer.
225     * @param format
226     * As documented by MMC.
227     * @param address
228     * As documented by MMC.
229     * @param layer
230     * As documented by MMC.
231     * @param grantID
232     * As documented by MMC.
233     * @result
234     * Returns the status of the data transfer.
235     */
236
237    virtual IOReturn readStructure( IOMemoryDescriptor *     buffer,
238                                    const DVDStructureFormat format,
239                                    const UInt32             address,
240                                    const UInt8              layer,
241                                    const UInt8              grantID ); /* 10.1.0 */
242
243    /*!
244     * @function getSpeed
245     * @discussion
246     * Get the current speed used for data transfers.
247     * @param kilobytesPerSecond
248     * Returns the current speed used for data transfers, in kB/s.
249     *
250     * kDVDSpeedMin specifies the minimum speed for all DVD media (1X).
251     * kDVDSpeedMax specifies the maximum speed supported in hardware.
252     * @result
253     * Returns the status of the operation.
254     */
255
256    virtual IOReturn getSpeed(UInt16 * kilobytesPerSecond); /* 10.1.0 */
257
258    /*!
259     * @function setSpeed
260     * @discussion
261     * Set the speed to be used for data transfers.
262     * @param kilobytesPerSecond
263     * Speed to be used for data transfers, in kB/s.
264     *
265     * kDVDSpeedMin specifies the minimum speed for all DVD media (1X).
266     * kDVDSpeedMax specifies the maximum speed supported in hardware.
267     * @result
268     * Returns the status of the operation.
269     */
270
271    virtual IOReturn setSpeed(UInt16 kilobytesPerSecond); /* 10.1.0 */
272
273    /*!
274     * @function readDiscInfo
275     * @discussion
276     * Issue an MMC READ DISC INFORMATION command.
277     * @param buffer
278     * Buffer for the data transfer.  The size of the buffer implies the size of
279     * the data transfer.
280     * @param actualByteCount
281     * Returns the actual number of bytes transferred in the data transfer.
282     * @result
283     * Returns the status of the data transfer.
284     */
285
286    virtual IOReturn readDiscInfo( IOMemoryDescriptor * buffer,
287                                   UInt16 *             actualByteCount ); /* 10.2.0 */
288
289    /*!
290     * @function readRZoneInfo
291     * @discussion
292     * Issue an MMC READ RZONE INFORMATION (READ TRACK INFORMATION) command.
293     * @param buffer
294     * Buffer for the data transfer.  The size of the buffer implies the size of
295     * the data transfer.
296     * @param address
297     * As documented by MMC.
298     * @param addressType
299     * As documented by MMC.
300     * @param actualByteCount
301     * Returns the actual number of bytes transferred in the data transfer.
302     * @result
303     * Returns the status of the data transfer.
304     */
305
306    virtual IOReturn readRZoneInfo( IOMemoryDescriptor *    buffer,
307                                    UInt32                  address,
308                                    DVDRZoneInfoAddressType addressType,
309                                    UInt16 *                actualByteCount ); /* 10.2.0 */
310
311#ifdef __LP64__
312    OSMetaClassDeclareReservedUnused(IODVDMedia,  0);
313    OSMetaClassDeclareReservedUnused(IODVDMedia,  1);
314    OSMetaClassDeclareReservedUnused(IODVDMedia,  2);
315    OSMetaClassDeclareReservedUnused(IODVDMedia,  3);
316    OSMetaClassDeclareReservedUnused(IODVDMedia,  4);
317    OSMetaClassDeclareReservedUnused(IODVDMedia,  5);
318    OSMetaClassDeclareReservedUnused(IODVDMedia,  6);
319#else /* !__LP64__ */
320    OSMetaClassDeclareReservedUsed(IODVDMedia,  0);
321    OSMetaClassDeclareReservedUsed(IODVDMedia,  1);
322    OSMetaClassDeclareReservedUsed(IODVDMedia,  2);
323    OSMetaClassDeclareReservedUsed(IODVDMedia,  3);
324    OSMetaClassDeclareReservedUsed(IODVDMedia,  4);
325    OSMetaClassDeclareReservedUsed(IODVDMedia,  5);
326    OSMetaClassDeclareReservedUsed(IODVDMedia,  6);
327#endif /* !__LP64__ */
328    OSMetaClassDeclareReservedUnused(IODVDMedia,  7);
329    OSMetaClassDeclareReservedUnused(IODVDMedia,  8);
330    OSMetaClassDeclareReservedUnused(IODVDMedia,  9);
331    OSMetaClassDeclareReservedUnused(IODVDMedia, 10);
332    OSMetaClassDeclareReservedUnused(IODVDMedia, 11);
333    OSMetaClassDeclareReservedUnused(IODVDMedia, 12);
334    OSMetaClassDeclareReservedUnused(IODVDMedia, 13);
335    OSMetaClassDeclareReservedUnused(IODVDMedia, 14);
336    OSMetaClassDeclareReservedUnused(IODVDMedia, 15);
337    OSMetaClassDeclareReservedUnused(IODVDMedia, 16);
338    OSMetaClassDeclareReservedUnused(IODVDMedia, 17);
339    OSMetaClassDeclareReservedUnused(IODVDMedia, 18);
340    OSMetaClassDeclareReservedUnused(IODVDMedia, 19);
341    OSMetaClassDeclareReservedUnused(IODVDMedia, 20);
342    OSMetaClassDeclareReservedUnused(IODVDMedia, 21);
343    OSMetaClassDeclareReservedUnused(IODVDMedia, 22);
344    OSMetaClassDeclareReservedUnused(IODVDMedia, 23);
345    OSMetaClassDeclareReservedUnused(IODVDMedia, 24);
346    OSMetaClassDeclareReservedUnused(IODVDMedia, 25);
347    OSMetaClassDeclareReservedUnused(IODVDMedia, 26);
348    OSMetaClassDeclareReservedUnused(IODVDMedia, 27);
349    OSMetaClassDeclareReservedUnused(IODVDMedia, 28);
350    OSMetaClassDeclareReservedUnused(IODVDMedia, 29);
351    OSMetaClassDeclareReservedUnused(IODVDMedia, 30);
352    OSMetaClassDeclareReservedUnused(IODVDMedia, 31);
353};
354
355#endif /* __cplusplus */
356#endif /* KERNEL */
357#endif /* !_IODVDMEDIA_H */
358