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 IOCDBlockStorageDevice
26 * @abstract
27 * This header contains the IOCDBlockStorageDevice class definition.
28 */
29
30#ifndef _IOCDBLOCKSTORAGEDEVICE_H
31#define _IOCDBLOCKSTORAGEDEVICE_H
32
33#include <IOKit/storage/IOCDTypes.h>
34
35/*!
36 * @defined kIOCDBlockStorageDeviceClass
37 * @abstract
38 * kIOCDBlockStorageDeviceClass is the name of the IOCDBlockStorageDevice class.
39 * @discussion
40 * kIOCDBlockStorageDeviceClass is the name of the IOCDBlockStorageDevice class.
41 */
42
43#define kIOCDBlockStorageDeviceClass "IOCDBlockStorageDevice"
44
45#ifdef KERNEL
46#ifdef __cplusplus
47
48/*
49 * Kernel
50 */
51
52#include <IOKit/storage/IOBlockStorageDevice.h>
53
54/* Property used for matching, so the generic driver gets the nub it wants. */
55#define	kIOBlockStorageDeviceTypeCDROM	"CDROM"
56
57/*!
58 * @class
59 * IOCDBlockStorageDevice : public IOBlockStorageDevice
60 * @abstract
61 * The IOCDBlockStorageDevice class is a generic CD block storage device
62 * abstraction.
63 * @discussion
64 * This class is the protocol for generic CD functionality, independent of
65 * the physical connection protocol (e.g. SCSI, ATA, USB).
66 *
67 * The APIs are the union of CD (block storage) data APIs and all
68 * necessary low-level CD APIs.
69 *
70 * A subclass implements relay methods that translate our requests into
71 * calls to a protocol- and device-specific provider.
72 */
73
74class IOCDBlockStorageDevice : public IOBlockStorageDevice {
75
76    OSDeclareAbstractStructors(IOCDBlockStorageDevice)
77
78protected:
79
80    struct ExpansionData { /* */ };
81    ExpansionData * _expansionData;
82
83public:
84
85    /* Overrides from IORegistryEntry */
86
87    virtual bool	init(OSDictionary * properties);
88
89    /*-----------------------------------------*/
90    /* CD APIs                                 */
91    /*-----------------------------------------*/
92
93    virtual IOReturn	doAsyncReadCD(IOMemoryDescriptor *buffer,
94                    	              UInt32 block,UInt32 nblks,
95                    	              CDSectorArea sectorArea,
96                    	              CDSectorType sectorType,
97                    	              IOStorageCompletion completion) = 0;
98    virtual UInt32	getMediaType(void)					= 0;
99    virtual IOReturn	readISRC(UInt8 track,CDISRC isrc)			= 0;
100    virtual IOReturn	readMCN(CDMCN mcn)					= 0;
101    virtual IOReturn	readTOC(IOMemoryDescriptor *buffer) = 0;
102
103#ifndef __LP64__
104    /*-----------------------------------------*/
105    /*  APIs exported by IOCDAudioControl      */
106    /*-----------------------------------------*/
107
108    virtual IOReturn	audioPause(bool pause)	__attribute__ ((deprecated));
109    virtual IOReturn	audioPlay(CDMSF timeStart,CDMSF timeStop)	__attribute__ ((deprecated));
110    virtual IOReturn	audioScan(CDMSF timeStart,bool reverse)	__attribute__ ((deprecated));
111    virtual IOReturn	audioStop()	__attribute__ ((deprecated));
112    virtual IOReturn	getAudioStatus(CDAudioStatus *status)	__attribute__ ((deprecated));
113    virtual IOReturn	getAudioVolume(UInt8 *leftVolume,UInt8 *rightVolume)	__attribute__ ((deprecated));
114    virtual IOReturn	setAudioVolume(UInt8 leftVolume,UInt8 rightVolume)	__attribute__ ((deprecated));
115#endif /* !__LP64__ */
116
117    /*-----------------------------------------*/
118    /* CD APIs                                 */
119    /*-----------------------------------------*/
120
121#ifdef __LP64__
122    virtual IOReturn	getSpeed(UInt16 * kilobytesPerSecond)	= 0;
123
124    virtual IOReturn	setSpeed(UInt16 kilobytesPerSecond)	= 0;
125
126    virtual IOReturn	readTOC(IOMemoryDescriptor *buffer,CDTOCFormat format,
127                    	        UInt8 msf,UInt8 trackSessionNumber,
128                    	        UInt16 *actualByteCount)	= 0;
129
130    virtual IOReturn	readDiscInfo(IOMemoryDescriptor *buffer,
131                    	             UInt16 *actualByteCount)	= 0;
132
133    virtual IOReturn	readTrackInfo(IOMemoryDescriptor *buffer,UInt32 address,
134                    	              CDTrackInfoAddressType addressType,
135                    	              UInt16 *actualByteCount)	= 0;
136#else /* !__LP64__ */
137    virtual IOReturn	getSpeed(UInt16 * kilobytesPerSecond); /* 10.1.0 */
138
139    virtual IOReturn	setSpeed(UInt16 kilobytesPerSecond); /* 10.1.0 */
140
141    virtual IOReturn	readTOC(IOMemoryDescriptor *buffer,CDTOCFormat format,
142                    	        UInt8 msf,UInt8 trackSessionNumber,
143                    	        UInt16 *actualByteCount); /* 10.1.3 */
144
145    virtual IOReturn	readDiscInfo(IOMemoryDescriptor *buffer,
146                    	             UInt16 *actualByteCount); /* 10.1.3 */
147
148    virtual IOReturn	readTrackInfo(IOMemoryDescriptor *buffer,UInt32 address,
149                    	              CDTrackInfoAddressType addressType,
150                    	              UInt16 *actualByteCount); /* 10.1.3 */
151#endif /* !__LP64__ */
152
153#ifdef __LP64__
154    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  0);
155    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  1);
156    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  2);
157    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  3);
158    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  4);
159#else /* !__LP64__ */
160    OSMetaClassDeclareReservedUsed(IOCDBlockStorageDevice,  0);
161    OSMetaClassDeclareReservedUsed(IOCDBlockStorageDevice,  1);
162    OSMetaClassDeclareReservedUsed(IOCDBlockStorageDevice,  2);
163    OSMetaClassDeclareReservedUsed(IOCDBlockStorageDevice,  3);
164    OSMetaClassDeclareReservedUsed(IOCDBlockStorageDevice,  4);
165#endif /* !__LP64__ */
166    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  5);
167    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  6);
168    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  7);
169    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  8);
170    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice,  9);
171    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice, 10);
172    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice, 11);
173    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice, 12);
174    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice, 13);
175    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice, 14);
176    OSMetaClassDeclareReservedUnused(IOCDBlockStorageDevice, 15);
177};
178
179#endif /* __cplusplus */
180#endif /* KERNEL */
181#endif /* !_IOCDBLOCKSTORAGEDEVICE_H */
182