]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/storage/ata/IOATAPICDDrive.h
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / IOKit / storage / ata / IOATAPICDDrive.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
24 *
25 * IOATAPICDDrive.h - Generic ATAPI CD-ROM driver.
26 *
27 * HISTORY
28 * Sep 2, 1999 jliu - Ported from AppleATAPIDrive.
29 */
30
31 #ifndef _IOATAPICDDRIVE_H
32 #define _IOATAPICDDRIVE_H
33
34 #include <IOKit/IOTypes.h>
35 #include <IOKit/storage/ata/IOATAPIHDDrive.h>
36 #include <IOKit/storage/IOCDTypes.h>
37
38 // ATAPI (inquiry) device type.
39 //
40 enum
41 {
42 kIOATAPIDeviceTypeCDROM = 0x05
43 };
44
45 // ATAPI packet commands.
46 //
47 enum
48 {
49 kIOATAPICommandReadSubChannel = 0x42,
50 kIOATAPICommandReadTOC = 0x43,
51 kIOATAPICommandPlayAudioMSF = 0x47,
52 kIOATAPICommandPauseResume = 0x4b,
53 kIOATAPICommandStopPlay = 0x4e,
54 kIOATAPICommandScan = 0xba,
55 kIOATAPICommandReadCD = 0xbe
56 };
57
58 //===========================================================================
59 // IOATAPICDDrive
60 //===========================================================================
61
62 class IOATAPICDDrive : public IOATAPIHDDrive
63 {
64 OSDeclareDefaultStructors(IOATAPICDDrive)
65
66 protected:
67 //-----------------------------------------------------------------------
68 // Given the device type from the ATAPI Inquiry data, returns true if
69 // the device type is supported by this driver.
70
71 virtual bool matchATAPIDeviceType(UInt8 type, SInt32 * score);
72
73 //----------------------------------------------------------------------
74 // ATAPI Read Subchannel command (42).
75
76 virtual IOATACommand * atapiCommandReadSubChannel(
77 IOMemoryDescriptor * buffer,
78 UInt8 dataFormat,
79 UInt8 trackNumber);
80
81 //-----------------------------------------------------------------------
82 // ATAPI Read TOC command (43).
83
84 virtual IOATACommand * atapiCommandReadTOC(
85 IOMemoryDescriptor * buffer,
86 bool msf,
87 UInt8 format,
88 UInt8 startTrackSession);
89
90 //----------------------------------------------------------------------
91 // ATAPI Play Audio command (47).
92
93 virtual IOATACommand * atapiCommandPlayAudioMSF(
94 CDMSF timeStart,
95 CDMSF timeStop);
96
97 //----------------------------------------------------------------------
98 // ATAPI Pause/Resume command (4b).
99
100 virtual IOATACommand * atapiCommandPauseResume(
101 bool resume);
102
103
104 //----------------------------------------------------------------------
105 // ATAPI STOP PLAY/SCAN command (4e).
106
107 virtual IOATACommand * atapiCommandStopPlay();
108
109 //----------------------------------------------------------------------
110 // ATAPI Read CD command (b9).
111
112 virtual IOATACommand * atapiCommandReadCD(
113 IOMemoryDescriptor * buffer,
114 UInt32 block,
115 UInt32 nblks,
116 CDSectorArea sectorArea,
117 CDSectorType sectorType);
118
119 //----------------------------------------------------------------------
120 // ATAPI Scan command (ba).
121
122 virtual IOATACommand * atapiCommandScan(
123 CDMSF timeStart,
124 bool reverse);
125
126 //-----------------------------------------------------------------------
127 // Overrides the method in IOATAPIHDDrive and returns an
128 // IOATAPICDDriveNub instance.
129
130 virtual IOService * instantiateNub();
131
132 public:
133 //-----------------------------------------------------------------------
134 // Handles read CD requests.
135
136 virtual IOReturn doAsyncReadCD(IOMemoryDescriptor * buffer,
137 UInt32 block,
138 UInt32 nblks,
139 CDSectorArea sectorArea,
140 CDSectorType sectorType,
141 IOStorageCompletion completion);
142
143 //-----------------------------------------------------------------------
144 // IOATAHDDrive override. Returns the device type.
145
146 virtual const char * getDeviceTypeName();
147
148 //-----------------------------------------------------------------------
149 // IOATAPIHDDrive override. Reports whether media is write protected.
150
151 virtual IOReturn reportWriteProtection(bool * isWriteProtected);
152
153 //-----------------------------------------------------------------------
154 // Read the Table of Contents.
155
156 virtual IOReturn readTOC(IOMemoryDescriptor * buffer);
157
158 //-----------------------------------------------------------------------
159 // Play audio
160
161 virtual IOReturn audioPause(bool pause);
162
163 virtual IOReturn audioPlay(CDMSF timeStart, CDMSF timeStop);
164
165 virtual IOReturn audioScan(CDMSF timeStart, bool reverse);
166
167 virtual IOReturn audioStop();
168
169 virtual IOReturn getAudioStatus(CDAudioStatus *status);
170
171 virtual IOReturn getAudioVolume(UInt8 * leftVolume,
172 UInt8 * rightVolume);
173
174 virtual IOReturn setAudioVolume(UInt8 leftVolume,
175 UInt8 rightVolume);
176
177 virtual IOReturn readModeSense(UInt8 * buffer,
178 UInt32 length, UInt8 pageCode,
179 UInt8 pageControl = 0);
180
181 virtual IOReturn writeModeSelect(UInt8 * buffer,
182 UInt32 length);
183
184 virtual IOReturn readSubChannel(UInt8 * buffer,
185 UInt32 length,
186 UInt8 dataFormat,
187 UInt8 trackNumber);
188
189 virtual IOReturn readMCN(CDMCN mcn);
190
191 virtual IOReturn readISRC(UInt8 track, CDISRC isrc);
192 };
193
194 #endif /* !_IOATAPICDDRIVE_H */