2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 * This header contains the IOCDMedia class definition.
33 * @defined kIOCDMediaClass
35 * kIOCDMediaClass is the name of the IOCDMedia class.
37 * kIOCDMediaClass is the name of the IOCDMedia class.
40 #define kIOCDMediaClass "IOCDMedia"
43 * @defined kIOCDMediaTOCKey
45 * kIOCDMediaTOCKey is a property of IOCDMedia objects. It has an OSData value
46 * and a CDTOC structure.
48 * The kIOCDMediaTOCKey property contains the CD's full table of contents,
49 * formatted as a CDTOC structure. The CDTOC structure is same as what is
50 * returned by a READ TOC command, format 0x02, but with BCD numbers converted
51 * to binary-encoded numbers, and the multi-byte fields converted to
55 #define kIOCDMediaTOCKey "TOC"
56 #define kIOCDMediaTOC "TOC" ///d:deprecated
59 * @defined kIOCDMediaTypeKey
61 * kIOCDMediaTypeKey is a property of IOCDMedia objects. It has an OSString
64 * The kIOCDMediaTypeKey property identifies the CD media type (CD-ROM, CD-R,
65 * CD-RW, etc). See the kIOCDMediaType contants for possible values.
68 #define kIOCDMediaTypeKey "Type"
71 * @defined kIOCDMediaTypeROM
72 * The kIOCDMediaTypeKey constant for CD-ROM media (inclusive of the CD-I,
73 * CD-ROM XA, and CD Audio standards, and mixed mode combinations thereof).
76 #define kIOCDMediaTypeROM "CD-ROM"
79 * @defined kIOCDMediaTypeR
80 * The kIOCDMediaTypeKey constant for CD Recordable (CD-R) media.
83 #define kIOCDMediaTypeR "CD-R"
86 * @defined kIOCDMediaTypeRW
87 * The kIOCDMediaTypeKey constant for CD ReWritable (CD-RW) media.
90 #define kIOCDMediaTypeRW "CD-RW"
96 #if defined(KERNEL) && defined(__cplusplus)
98 #include <IOKit/storage/IOCDBlockStorageDriver.h>
99 #include <IOKit/storage/IOMedia.h>
104 * The IOCDMedia class is a random-access disk device abstraction for CDs.
106 * The IOCDMedia class is a random-access disk device abstraction for CDs. It
107 * extends the IOMedia class by implementing special CD APIs, such as readCD,
108 * and publishing the TOC as a property of the IOCDMedia object.
111 class IOCDMedia
: public IOMedia
113 OSDeclareDefaultStructors(IOCDMedia
)
117 struct ExpansionData
{ /* */ };
118 ExpansionData
* _expansionData
;
122 ///m:2333367:workaround:commented:start
124 ///m:2333367:workaround:commented:stop
129 * Read data from the storage object at the specified byte offset into the
130 * specified buffer, asynchronously. When the read completes, the caller
131 * will be notified via the specified completion action.
133 * The buffer will be retained for the duration of the read.
135 * Client requesting the read.
137 * Starting byte offset for the data transfer.
139 * Buffer for the data transfer. The size of the buffer implies the size of
142 * Completion routine to call once the data transfer is complete.
145 virtual void read(IOService
* client
,
147 IOMemoryDescriptor
* buffer
,
148 IOStorageCompletion completion
);
153 * Read data from the CD media object at the specified byte offset into the
154 * specified buffer, asynchronously. Special areas of the CD sector can be
155 * read via this method, such as the header and subchannel data. When the
156 * read completes, the caller will be notified via the specified completion
159 * The buffer will be retained for the duration of the read.
161 * Client requesting the read.
163 * Starting byte offset for the data transfer (see withAreas parameter).
165 * Buffer for the data transfer. The size of the buffer implies the size of
168 * Sector area(s) to read. The sum of each area's size defines the "natural
169 * block size" of the media for the call, which should be taken into account
170 * when computing the address of byteStart. See IOCDTypes.h.
172 * Sector type that is expected. The data transfer is terminated as soon as
173 * data is encountered that does not match the expected type.
175 * Completion routine to call once the data transfer is complete.
178 virtual void readCD(IOService
* client
,
180 IOMemoryDescriptor
* buffer
,
181 CDSectorArea sectorArea
,
182 CDSectorType sectorType
,
183 IOStorageCompletion completion
);
188 * Read data from the CD media object at the specified byte offset into the
189 * specified buffer, synchronously. Special areas of the CD sector can be
190 * read via this method, such as the header and subchannel data. When the
191 * read completes, this method will return to the caller. The actual byte
192 * count field is optional.
194 * Client requesting the read.
196 * Starting byte offset for the data transfer.
198 * Buffer for the data transfer. The size of the buffer implies the size of
201 * Sector area(s) to read. The sum of each area's size defines the "natural
202 * block size" of the media for the call, which should be taken into account
203 * when computing the address of byteStart. See IOCDTypes.h.
205 * Sector type that is expected. The data transfer is terminated as soon as
206 * data is encountered that does not match the expected type.
207 * @param actualByteCount
208 * Returns the actual number of bytes transferred in the data transfer.
210 * Returns the status of the data transfer.
213 virtual IOReturn
readCD(IOService
* client
,
215 IOMemoryDescriptor
* buffer
,
216 CDSectorArea sectorArea
,
217 CDSectorType sectorType
,
218 UInt64
* actualByteCount
= 0);
223 * Read the International Standard Recording Code for the specified track.
225 * The track number from which to read the ISRC.
227 * The buffer for the ISRC data. Buffer contents will be zero-terminated.
230 virtual IOReturn
readISRC(UInt8 track
, CDISRC isrc
);
235 * Read the Media Catalog Number (also known as the Universal Product Code).
237 * The buffer for the MCN data. Buffer contents will be zero-terminated.
240 virtual IOReturn
readMCN(CDMCN mcn
);
245 * Get the full Table Of Contents.
247 * All CDTOC fields passed across I/O Kit APIs are guaranteed to be
248 * binary-encoded numbers (not BCD) and converted to host-endianess.
250 * Returns a pointer to the TOC buffer (do not deallocate).
253 virtual CDTOC
* getTOC();
256 * Obtain this object's provider. We override the superclass's method to
257 * return a more specific subclass of IOService -- IOCDBlockStorageDriver.
258 * This method serves simply as a convenience to subclass developers.
261 virtual IOCDBlockStorageDriver
* getProvider() const;
263 OSMetaClassDeclareReservedUnused(IOCDMedia
, 0);
264 OSMetaClassDeclareReservedUnused(IOCDMedia
, 1);
265 OSMetaClassDeclareReservedUnused(IOCDMedia
, 2);
266 OSMetaClassDeclareReservedUnused(IOCDMedia
, 3);
267 OSMetaClassDeclareReservedUnused(IOCDMedia
, 4);
268 OSMetaClassDeclareReservedUnused(IOCDMedia
, 5);
269 OSMetaClassDeclareReservedUnused(IOCDMedia
, 6);
270 OSMetaClassDeclareReservedUnused(IOCDMedia
, 7);
271 OSMetaClassDeclareReservedUnused(IOCDMedia
, 8);
272 OSMetaClassDeclareReservedUnused(IOCDMedia
, 9);
273 OSMetaClassDeclareReservedUnused(IOCDMedia
, 10);
274 OSMetaClassDeclareReservedUnused(IOCDMedia
, 11);
275 OSMetaClassDeclareReservedUnused(IOCDMedia
, 12);
276 OSMetaClassDeclareReservedUnused(IOCDMedia
, 13);
277 OSMetaClassDeclareReservedUnused(IOCDMedia
, 14);
278 OSMetaClassDeclareReservedUnused(IOCDMedia
, 15);
281 #endif /* defined(KERNEL) && defined(__cplusplus) */
283 #endif /* !_IOCDMEDIA_H */