]>
Commit | Line | Data |
---|---|---|
1c79356b A |
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 | * IOCDBlockStorageDriver.h | |
24 | * | |
25 | * This class implements CD functionality, independent of | |
26 | * the physical connection protocol (e.g. SCSI, ATA, USB). | |
27 | * | |
28 | * A protocol-specific provider implements the functionality using an appropriate | |
29 | * protocol and commands. | |
30 | */ | |
31 | ||
32 | #ifndef _IOCDBLOCKSTORAGEDRIVER_H | |
33 | #define _IOCDBLOCKSTORAGEDRIVER_H | |
34 | ||
35 | #include <IOKit/IOTypes.h> | |
36 | #include <IOKit/storage/IOCDBlockStorageDevice.h> | |
37 | #include <IOKit/storage/IOCDTypes.h> | |
38 | #include <IOKit/storage/IOBlockStorageDriver.h> | |
39 | ||
40 | /*! | |
41 | * @defined kIOCDBlockStorageDriverClass | |
42 | * @abstract | |
43 | * kIOCDBlockStorageDriverClass is the name of the IOCDBlockStorageDriver class. | |
44 | * @discussion | |
45 | * kIOCDBlockStorageDriverClass is the name of the IOCDBlockStorageDriver class. | |
46 | */ | |
47 | ||
48 | #define kIOCDBlockStorageDriverClass "IOCDBlockStorageDriver" | |
49 | ||
50 | class IOCDAudioControl; | |
51 | class IOCDMedia; | |
52 | class IOCDBlockStorageDevice; | |
53 | ||
54 | class IOCDBlockStorageDriver : public IOBlockStorageDriver { | |
55 | ||
56 | OSDeclareDefaultStructors(IOCDBlockStorageDriver) | |
57 | ||
58 | public: | |
59 | ||
60 | static const UInt64 kBlockSizeCD = 2352; | |
61 | static const UInt8 kBlockTypeCD = 0x01; | |
62 | ||
63 | /* Overrides of IORegistryEntry */ | |
64 | ||
65 | virtual bool init(OSDictionary * properties); | |
66 | ||
67 | /* Overrides of IOBlockStorageDriver: */ | |
68 | ||
69 | virtual IOReturn ejectMedia(void); | |
70 | virtual void executeRequest(UInt64 byteStart, | |
71 | IOMemoryDescriptor *buffer, | |
72 | IOStorageCompletion completion, | |
73 | Context *context); | |
74 | virtual const char * getDeviceTypeName(void); | |
75 | virtual IOMedia * instantiateDesiredMediaObject(void); | |
76 | virtual IOMedia * instantiateMediaObject(UInt64 base,UInt64 byteSize, | |
77 | UInt32 blockSize,char *mediaName); | |
78 | ||
79 | /* End of IOBlockStorageDriver overrides. */ | |
80 | ||
81 | /* | |
82 | * @function getMediaType | |
83 | * @abstract | |
84 | * Get the current type of media inserted in the CD drive. | |
85 | * @discussion | |
86 | * Certain I/O operations may not be allowed depending on the type of | |
87 | * media currently inserted. For example, one cannot issue write operations | |
88 | * if CD-ROM media is inserted. | |
89 | * @result | |
90 | * See the kCDMediaType constants in IOCDTypes.h. | |
91 | */ | |
92 | virtual UInt32 getMediaType(void); | |
93 | ||
94 | /* -------------------------------------------------*/ | |
95 | /* APIs implemented here, exported by IOCDMedia: */ | |
96 | /* -------------------------------------------------*/ | |
97 | ||
98 | virtual CDTOC * getTOC(void); | |
99 | virtual void readCD(IOService *client, | |
100 | UInt64 byteStart, | |
101 | IOMemoryDescriptor *buffer, | |
102 | CDSectorArea sectorArea, | |
103 | CDSectorType sectorType, | |
104 | IOStorageCompletion completion); | |
105 | virtual IOReturn readISRC(UInt8 track,CDISRC isrc); | |
106 | virtual IOReturn readMCN(CDMCN mcn); | |
107 | ||
108 | /* end of IOCDMedia APIs */ | |
109 | ||
110 | /* --------------------------------------------------------*/ | |
111 | /* APIs implemented here, exported by IOCDAudioControl: */ | |
112 | /* --------------------------------------------------------*/ | |
113 | ||
114 | virtual IOReturn audioPause(bool pause); | |
115 | virtual IOReturn audioPlay(CDMSF timeStart,CDMSF timeStop); | |
116 | virtual IOReturn audioScan(CDMSF timeStart,bool reverse); | |
117 | virtual IOReturn audioStop(); | |
118 | virtual IOReturn getAudioStatus(CDAudioStatus *status); | |
119 | virtual IOReturn getAudioVolume(UInt8 *leftVolume,UInt8 *rightVolume); | |
120 | virtual IOReturn setAudioVolume(UInt8 leftVolume,UInt8 rightVolume); | |
121 | ||
122 | /* end of IOCDAudioControl APIs */ | |
123 | ||
124 | /* | |
125 | * Obtain this object's provider. We override the superclass's method to | |
126 | * return a more specific subclass of IOService -- IOCDBlockStorageDevice. | |
127 | * This method serves simply as a convenience to subclass developers. | |
128 | */ | |
129 | ||
130 | virtual IOCDBlockStorageDevice * getProvider() const; | |
131 | ||
132 | protected: | |
133 | ||
134 | /* Overrides of IOBlockStorageDriver behavior. */ | |
135 | ||
136 | /* When CD media is inserted, we want to create multiple nubs for the data and | |
137 | * audio tracks, for sessions, and the entire media. We override the methods | |
138 | * that manage nubs. | |
139 | */ | |
140 | virtual IOReturn acceptNewMedia(void); | |
141 | virtual IOReturn decommissionMedia(bool forcible); | |
142 | ||
143 | /* End of IOBlockStorageDriver overrides. */ | |
144 | ||
145 | /* Internally used methods: */ | |
146 | ||
147 | virtual IOReturn cacheTocInfo(void); | |
148 | virtual UInt64 getMediaBlockSize(CDSectorArea area,CDSectorType type); | |
149 | virtual void prepareRequest(UInt64 byteStart, | |
150 | IOMemoryDescriptor *buffer, | |
151 | CDSectorArea sectorArea, | |
152 | CDSectorType sectorType, | |
153 | IOStorageCompletion completion); | |
154 | ||
155 | /* ------- */ | |
156 | ||
157 | struct ExpansionData { /* */ }; | |
158 | ExpansionData * _expansionData; | |
159 | ||
160 | IOCDAudioControl * _acNub; | |
161 | ||
162 | /* We keep the TOC here because we'll always need it, so what the heck. | |
163 | * | |
164 | * There are possible "point" track entries for 0xa0..a2, 0xb0..b4, and 0xc0..0xc1. | |
165 | * Tracks need not start at 1, as long as they're between 1 and 99, and have contiguous | |
166 | * numbers. | |
167 | */ | |
168 | ||
169 | CDTOC * _toc; | |
170 | UInt32 _tocSize; | |
171 | ||
172 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 0); | |
173 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 1); | |
174 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 2); | |
175 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 3); | |
176 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 4); | |
177 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 5); | |
178 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 6); | |
179 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 7); | |
180 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 8); | |
181 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 9); | |
182 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 10); | |
183 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 11); | |
184 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 12); | |
185 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 13); | |
186 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 14); | |
187 | OSMetaClassDeclareReservedUnused(IOCDBlockStorageDriver, 15); | |
188 | }; | |
189 | #endif |