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@
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
25 * IOATAPICDDrive.h - Generic ATAPI CD-ROM driver.
28 * Sep 2, 1999 jliu - Ported from AppleATAPIDrive.
31 #ifndef _IOATAPICDDRIVE_H
32 #define _IOATAPICDDRIVE_H
34 #include <IOKit/IOTypes.h>
35 #include <IOKit/storage/ata/IOATAPIHDDrive.h>
36 #include <IOKit/storage/IOCDTypes.h>
38 // ATAPI (inquiry) device type.
42 kIOATAPIDeviceTypeCDROM
= 0x05
45 // ATAPI packet commands.
49 kIOATAPICommandReadSubChannel
= 0x42,
50 kIOATAPICommandReadTOC
= 0x43,
51 kIOATAPICommandPlayAudioMSF
= 0x47,
52 kIOATAPICommandPauseResume
= 0x4b,
53 kIOATAPICommandStopPlay
= 0x4e,
54 kIOATAPICommandScan
= 0xba,
55 kIOATAPICommandReadCD
= 0xbe
58 //===========================================================================
60 //===========================================================================
62 class IOATAPICDDrive
: public IOATAPIHDDrive
64 OSDeclareDefaultStructors(IOATAPICDDrive
)
67 //-----------------------------------------------------------------------
68 // Given the device type from the ATAPI Inquiry data, returns true if
69 // the device type is supported by this driver.
71 virtual bool matchATAPIDeviceType(UInt8 type
, SInt32
* score
);
73 //----------------------------------------------------------------------
74 // ATAPI Read Subchannel command (42).
76 virtual IOATACommand
* atapiCommandReadSubChannel(
77 IOMemoryDescriptor
* buffer
,
81 //-----------------------------------------------------------------------
82 // ATAPI Read TOC command (43).
84 virtual IOATACommand
* atapiCommandReadTOC(
85 IOMemoryDescriptor
* buffer
,
88 UInt8 startTrackSession
);
90 //----------------------------------------------------------------------
91 // ATAPI Play Audio command (47).
93 virtual IOATACommand
* atapiCommandPlayAudioMSF(
97 //----------------------------------------------------------------------
98 // ATAPI Pause/Resume command (4b).
100 virtual IOATACommand
* atapiCommandPauseResume(
104 //----------------------------------------------------------------------
105 // ATAPI STOP PLAY/SCAN command (4e).
107 virtual IOATACommand
* atapiCommandStopPlay();
109 //----------------------------------------------------------------------
110 // ATAPI Read CD command (b9).
112 virtual IOATACommand
* atapiCommandReadCD(
113 IOMemoryDescriptor
* buffer
,
116 CDSectorArea sectorArea
,
117 CDSectorType sectorType
);
119 //----------------------------------------------------------------------
120 // ATAPI Scan command (ba).
122 virtual IOATACommand
* atapiCommandScan(
126 //-----------------------------------------------------------------------
127 // Overrides the method in IOATAPIHDDrive and returns an
128 // IOATAPICDDriveNub instance.
130 virtual IOService
* instantiateNub();
133 //-----------------------------------------------------------------------
134 // Handles read CD requests.
136 virtual IOReturn
doAsyncReadCD(IOMemoryDescriptor
* buffer
,
139 CDSectorArea sectorArea
,
140 CDSectorType sectorType
,
141 IOStorageCompletion completion
);
143 //-----------------------------------------------------------------------
144 // IOATAHDDrive override. Returns the device type.
146 virtual const char * getDeviceTypeName();
148 //-----------------------------------------------------------------------
149 // IOATAPIHDDrive override. Reports whether media is write protected.
151 virtual IOReturn
reportWriteProtection(bool * isWriteProtected
);
153 //-----------------------------------------------------------------------
154 // Read the Table of Contents.
156 virtual IOReturn
readTOC(IOMemoryDescriptor
* buffer
);
158 //-----------------------------------------------------------------------
161 virtual IOReturn
audioPause(bool pause
);
163 virtual IOReturn
audioPlay(CDMSF timeStart
, CDMSF timeStop
);
165 virtual IOReturn
audioScan(CDMSF timeStart
, bool reverse
);
167 virtual IOReturn
audioStop();
169 virtual IOReturn
getAudioStatus(CDAudioStatus
*status
);
171 virtual IOReturn
getAudioVolume(UInt8
* leftVolume
,
172 UInt8
* rightVolume
);
174 virtual IOReturn
setAudioVolume(UInt8 leftVolume
,
177 virtual IOReturn
readModeSense(UInt8
* buffer
,
178 UInt32 length
, UInt8 pageCode
,
179 UInt8 pageControl
= 0);
181 virtual IOReturn
writeModeSelect(UInt8
* buffer
,
184 virtual IOReturn
readSubChannel(UInt8
* buffer
,
189 virtual IOReturn
readMCN(CDMCN mcn
);
191 virtual IOReturn
readISRC(UInt8 track
, CDISRC isrc
);
194 #endif /* !_IOATAPICDDRIVE_H */