author | William Roberts <williamr@symbian.org> |
Tue, 06 Jul 2010 13:05:35 +0100 | |
branch | GCC_SURGE |
changeset 195 | 3411883d8fcf |
parent 109 | b3a1d9898418 |
child 201 | 43365a9b78a3 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\include\drivers\locmedia.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#ifndef LOCMEDIA_H |
|
19 |
#define LOCMEDIA_H |
|
20 |
#include <plat_priv.h> |
|
21 |
#include <d32locd.h> |
|
22 |
||
23 |
#if defined(_DEBUG) && defined(__DEMAND_PAGING__) |
|
24 |
#define __CONCURRENT_PAGING_INSTRUMENTATION__ |
|
25 |
#endif |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
26 |
#ifdef __DEMAND_PAGING__ |
0 | 27 |
#define __DEMAND_PAGING_BENCHMARKS__ |
28 |
#endif |
|
29 |
||
30 |
#ifdef __WINS__ |
|
31 |
#define __EMULATOR_DMA_SUMULATION__ |
|
32 |
#endif |
|
33 |
||
34 |
/** |
|
35 |
@publishedPartner |
|
36 |
@released |
|
37 |
||
38 |
A media driver priority value. |
|
39 |
||
40 |
The value can be returned by a media driver's PDD factory Info() function, |
|
41 |
and allows Symbian OS to decide the order in which media drivers are to be opened. |
|
42 |
||
43 |
The value is relative to the other media driver priority values. |
|
44 |
||
45 |
@see DPhysicalDevice::Info() |
|
46 |
*/ |
|
47 |
const TInt KMediaDriverPriorityHigh=2; |
|
48 |
||
49 |
||
50 |
||
51 |
||
52 |
/** |
|
53 |
@publishedPartner |
|
54 |
@released |
|
55 |
||
56 |
A media driver priority value. |
|
57 |
||
58 |
The value can be returned by a media driver's PDD factory Info() function, |
|
59 |
and allows Symbian OS to decide the order in which media drivers are to be opened. |
|
60 |
||
61 |
The value is relative to the other media driver priority values, and is |
|
62 |
the one most commonly used. |
|
63 |
||
64 |
@see DPhysicalDevice::Info() |
|
65 |
*/ |
|
66 |
const TInt KMediaDriverPriorityNormal=1; |
|
67 |
||
68 |
||
69 |
||
70 |
||
71 |
/** |
|
72 |
@publishedPartner |
|
73 |
@released |
|
74 |
||
75 |
A media driver priority value. |
|
76 |
||
77 |
The value can be returned by a media driver's PDD factory Info() function, |
|
78 |
and allows Symbian OS to decide the order in which media drivers are to be opened. |
|
79 |
||
80 |
The value is relative to the other media driver priority values. |
|
81 |
||
82 |
@see DPhysicalDevice::Info() |
|
83 |
*/ |
|
84 |
const TInt KMediaDriverPriorityLow=0; |
|
85 |
||
86 |
||
87 |
||
88 |
||
89 |
/** |
|
90 |
@publishedPartner |
|
91 |
@released |
|
92 |
||
93 |
Media driver interface major version number. |
|
94 |
*/ |
|
95 |
const TInt KMediaDriverInterfaceMajorVersion=1; |
|
96 |
||
97 |
||
98 |
||
99 |
||
100 |
/** |
|
101 |
@publishedPartner |
|
102 |
@released |
|
103 |
||
104 |
Media driver interface minor version number. |
|
105 |
*/ |
|
106 |
const TInt KMediaDriverInterfaceMinorVersion=0; |
|
107 |
||
108 |
||
109 |
||
110 |
||
111 |
||
112 |
/** |
|
113 |
@publishedPartner |
|
114 |
@released |
|
115 |
||
116 |
Media driver interface build number. |
|
117 |
*/ |
|
118 |
const TInt KMediaDriverInterfaceBuildVersion=160; |
|
119 |
||
120 |
||
121 |
||
122 |
||
123 |
/** |
|
124 |
@publishedPartner |
|
125 |
@released |
|
126 |
*/ |
|
127 |
const TInt KMediaDriverDeferRequest=1; |
|
128 |
||
129 |
||
130 |
||
131 |
||
132 |
/** |
|
133 |
@internalTechnology |
|
134 |
*/ |
|
135 |
#define __TRACE_TIMING(x) |
|
136 |
//#define __TRACE_TIMING(x) *(TInt*)0x63000ff0=x |
|
137 |
||
138 |
/** |
|
139 |
@internalComponent |
|
140 |
*/ |
|
141 |
NONSHARABLE_CLASS(DLocalDriveFactory) : public DLogicalDevice |
|
142 |
{ |
|
143 |
public: |
|
144 |
DLocalDriveFactory(); |
|
145 |
virtual TInt Install(); |
|
146 |
virtual void GetCaps(TDes8 &aDes) const; |
|
147 |
virtual TInt Create(DLogicalChannelBase*& aChannel); |
|
148 |
}; |
|
149 |
||
150 |
class TLocDrv; |
|
151 |
class DLocalDrive; |
|
152 |
||
153 |
/** |
|
154 |
@internalComponent |
|
155 |
*/ |
|
156 |
NONSHARABLE_CLASS(TLocalDriveCleanup) : public TThreadCleanup |
|
157 |
{ |
|
158 |
public: |
|
159 |
TLocalDriveCleanup(); |
|
160 |
virtual void Cleanup(); |
|
161 |
inline DLocalDrive& LocalDrive(); |
|
162 |
}; |
|
163 |
||
164 |
||
165 |
||
166 |
class TLocDrvRequest; |
|
167 |
class DPrimaryMediaBase; |
|
168 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
169 |
/* |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
170 |
TCallBackLink |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
171 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
172 |
@internalComponent |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
173 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
174 |
Internal class which allows a list of callbacks to be linked together. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
175 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
176 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
177 |
NONSHARABLE_CLASS(TCallBackLink) |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
178 |
{ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
179 |
public: |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
180 |
enum TObjectType |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
181 |
{ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
182 |
EDLocalDriveObject, // object containing this TCallBackLink is a DLocalDrive |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
183 |
ETLocDrvObject, // object containing this TCallBackLink is a TLocDrv |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
184 |
}; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
185 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
186 |
public: |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
187 |
TCallBackLink(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
188 |
TCallBackLink(TInt (*aFunction)(TAny* aPtr, TInt aParam),TAny* aPtr, TObjectType aObjectType); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
189 |
TInt CallBack(TInt aParam) const; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
190 |
public: |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
191 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
192 |
A pointer to the callback function. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
193 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
194 |
TInt (*iFunction)(TAny* aPtr, TInt aParam); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
195 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
196 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
197 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
198 |
A pointer that is passed to the callback function when |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
199 |
the function is called. |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
200 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
201 |
TAny* iPtr; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
202 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
203 |
TObjectType iObjectType; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
204 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
205 |
SDblQueLink iLink; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
206 |
}; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
207 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
208 |
|
0 | 209 |
/** |
210 |
@publishedPartner |
|
211 |
@released |
|
212 |
||
213 |
This class is strictly internal to Symbian; the only part of this class that |
|
214 |
is publicly exposed to partners is the TRequestId enum. |
|
215 |
||
216 |
@see DLocalDrive::TRequestId |
|
217 |
*/ |
|
218 |
NONSHARABLE_CLASS(DLocalDrive) : public DLogicalChannelBase |
|
219 |
{ |
|
220 |
public: |
|
221 |
/** |
|
222 |
Identifies the specific local drive operation. |
|
223 |
*/ |
|
224 |
enum TRequestId |
|
225 |
{ |
|
226 |
/** |
|
227 |
Requests information about the size, type, and attributes of the media. |
|
228 |
*/ |
|
229 |
ECaps=0, |
|
230 |
||
231 |
/** |
|
232 |
Requests an asynchronous read from the media device. |
|
233 |
*/ |
|
234 |
ERead=1, |
|
235 |
||
236 |
/** |
|
237 |
Requests an asynchronous write to the media device. |
|
238 |
*/ |
|
239 |
EWrite=2, |
|
240 |
||
241 |
/** |
|
242 |
Requests the formatting of a section of the media |
|
243 |
*/ |
|
244 |
EFormat=3, |
|
245 |
||
246 |
/** |
|
247 |
A request to expand the total size of the media. |
|
248 |
*/ |
|
249 |
EEnlarge=4, |
|
250 |
||
251 |
/** |
|
252 |
A request to reduce the total size of the media. |
|
253 |
*/ |
|
254 |
EReduce=5, |
|
255 |
||
256 |
/** |
|
257 |
A request to force a remount of the media. |
|
258 |
*/ |
|
259 |
EForceMediaChange=6, |
|
260 |
||
261 |
/** |
|
262 |
Requests an attempt to lock the media with a password. |
|
263 |
*/ |
|
264 |
EPasswordLock=7, |
|
265 |
||
266 |
/** |
|
267 |
Requests an attempt to unlock the media. |
|
268 |
*/ |
|
269 |
EPasswordUnlock=8, |
|
270 |
||
271 |
/** |
|
272 |
Requests an attempt to remove the password from the media. |
|
273 |
*/ |
|
274 |
EPasswordClear=9, |
|
275 |
||
276 |
/** |
|
277 |
Requests an read of the password store. |
|
278 |
*/ |
|
279 |
EReadPasswordStore=10, |
|
280 |
||
281 |
/** |
|
282 |
Requests a write of the password store. |
|
283 |
*/ |
|
284 |
EWritePasswordStore=11, |
|
285 |
||
286 |
/** |
|
287 |
A request to get the length of the password store. |
|
288 |
*/ |
|
289 |
EPasswordStoreLengthInBytes=12, |
|
290 |
/** |
|
291 |
A Control IO request |
|
292 |
*/ |
|
293 |
EControlIO=13, |
|
294 |
/** |
|
295 |
A request to force an erase of the password from the media |
|
296 |
*/ |
|
297 |
EPasswordErase=14, |
|
298 |
||
299 |
/** |
|
300 |
A delete notification from the file system |
|
301 |
*/ |
|
302 |
EDeleteNotify=15, |
|
303 |
||
304 |
/** |
|
305 |
A request for information on the last error |
|
306 |
*/ |
|
307 |
EGetLastErrorInfo=16, |
|
308 |
||
309 |
EFirstReqNumberReservedForPaging=17, |
|
310 |
// DO NOT REUSE ANY OF THE REQUEST NUMBERS BETWEEN THIS AND THE LAST RESERVED REQ NUMBER |
|
311 |
// ALSO DO NOT INSERT ANY REQUEST NUMBERS BEFORE THIS, AS THIS WILL BE A COMPATIBILITY BREEAK |
|
312 |
ELastReqNumberReservedForPaging=31, |
|
313 |
||
314 |
/** |
|
315 |
Query device |
|
316 |
*/ |
|
317 |
EQueryDevice=32, |
|
318 |
}; |
|
319 |
public: |
|
320 |
DLocalDrive(); |
|
321 |
~DLocalDrive(); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
322 |
|
0 | 323 |
virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); /**< @internalComponent */ |
324 |
virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2); /**< @internalComponent */ |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
325 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
326 |
void NotifyChange(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
327 |
|
0 | 328 |
inline void Deque(); /**< @internalComponent */ |
329 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
330 |
static TInt MediaChangeCallback(TAny* aLocalDrive, TInt aNotifyType); /**< @internalComponent */ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
331 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
332 |
IMPORT_C static TInt Caps(TInt aDriveNumber, TDes8& aCaps); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
333 |
|
0 | 334 |
private: |
335 |
#ifdef __DEMAND_PAGING__ |
|
336 |
TInt LockMountInfo(DPrimaryMediaBase& aPrimaryMedia, TLocDrvRequest& aReq); |
|
337 |
void UnlockMountInfo(DPrimaryMediaBase& aPrimaryMedia); |
|
338 |
#endif |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
339 |
TInt ReadPasswordData(TLocDrvRequest& aReq, TLocalDrivePasswordData& aPswData, TMediaPassword& aOldPasswd, TMediaPassword& aNewPasswd); |
0 | 340 |
|
341 |
public: |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
342 |
TLocDrv* iDrive; /**< @internalComponent */ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
343 |
TCallBackLink iMediaChangeObserver; /**< @internalComponent */ |
0 | 344 |
TClientDataRequest<TBool>* iNotifyChangeRequest; /**< @internalComponent */ |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
345 |
TLocalDriveCleanup iCleanup; /**< @internalComponent */ |
0 | 346 |
}; |
347 |
||
348 |
/** |
|
349 |
@internalComponent |
|
350 |
*/ |
|
351 |
inline DLocalDrive& TLocalDriveCleanup::LocalDrive() |
|
352 |
{ return *_LOFF(this,DLocalDrive,iCleanup); } |
|
353 |
||
354 |
||
355 |
||
356 |
||
357 |
/** |
|
358 |
@publishedPartner |
|
359 |
@released |
|
360 |
||
361 |
A class that encapsulates the request information received from the client, |
|
362 |
and gives the media driver access to the request ID and other associated |
|
363 |
parameters, such as the request length, offset, the requesting thread, |
|
364 |
source and destination address etc. |
|
365 |
||
366 |
An object of this type is passed to DMediaDriver::Request(). |
|
367 |
||
368 |
@see DMediaDriver::Request() |
|
369 |
*/ |
|
370 |
class TLocDrvRequest : public TThreadMessage |
|
371 |
{ |
|
372 |
public: |
|
373 |
||
374 |
/** |
|
375 |
@internalComponent |
|
376 |
*/ |
|
377 |
enum TFlags |
|
378 |
{ |
|
379 |
EWholeMedia=1, |
|
380 |
EAdjusted=2, |
|
381 |
EPhysAddr=0x04, |
|
382 |
EPaging=0x08, // a paging request |
|
383 |
EBackgroundPaging=0x10, // a background paging request. @see DMediaPagingDevice::Write() |
|
384 |
ECodePaging=0x20, // a code paging request |
|
385 |
EDataPaging=0x40, // a data paging request |
|
386 |
ETClientBuffer=0x80, // RemoteDes() points to a TClientBuffer |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
387 |
EKernelBuffer=0x100, // RemoteDes() points to a kernel-side buffer : set for all paging requests and media extension requests |
0 | 388 |
}; |
389 |
public: |
|
390 |
||
391 |
/** |
|
392 |
Gets a reference to the object containing the request information. |
|
393 |
||
394 |
@return The request information. |
|
395 |
*/ |
|
396 |
inline static TLocDrvRequest& Get() |
|
397 |
{return (TLocDrvRequest&)Kern::Message();} |
|
398 |
||
399 |
||
400 |
/** |
|
401 |
Gets the request ID. |
|
402 |
||
403 |
For media drivers, this is one of the DLocalDrive::TRequestId enumerated values. |
|
404 |
||
405 |
@return The request ID. |
|
406 |
||
407 |
@see DLocalDrive::TRequestId |
|
408 |
*/ |
|
409 |
inline TInt& Id() |
|
410 |
{return *(TInt*)&iValue;} |
|
411 |
||
412 |
||
413 |
/** |
|
414 |
Gets the position on the media on which the request operates. |
|
415 |
||
416 |
This applies to operations ERead, EWrite and EFormat. |
|
417 |
||
418 |
Note that the partition offset is taken into account by the underlying |
|
419 |
local media subsystem. |
|
420 |
||
421 |
@return The position on the media. |
|
422 |
||
423 |
@see TRequestId::ERead |
|
424 |
@see TRequestId::EWrite |
|
425 |
@see TRequestId::EFormat |
|
426 |
*/ |
|
427 |
inline Int64& Pos() |
|
428 |
{return *(Int64*)&iArg[0];} |
|
429 |
||
430 |
||
431 |
/** |
|
432 |
Gets the length associated with the operation. |
|
433 |
||
434 |
This is the number of bytes associated with the media request. |
|
435 |
It applies to operations ERead, EWrite and EFormat. |
|
436 |
||
437 |
@return The length, in bytes. |
|
438 |
||
439 |
@see TRequestId::ERead |
|
440 |
@see TRequestId::EWrite |
|
441 |
@see TRequestId::EFormat |
|
442 |
*/ |
|
443 |
inline Int64& Length() |
|
444 |
{return *(Int64*)&iArg[2];} |
|
445 |
||
446 |
||
447 |
/** |
|
448 |
Gets a pointer to the remote thread that requested the operation. |
|
449 |
||
450 |
This may be used to access the data to be read from the remote thread's process, |
|
451 |
or the area to which data is to be written in the remote thread's process. |
|
452 |
However, it is recommended that such operations be performed |
|
453 |
using ReadRemote() and WriteRemote() |
|
454 |
||
455 |
@return A reference to a pointer to the remote thread. |
|
456 |
||
457 |
@see TLocDrvRequest::ReadRemote() |
|
458 |
@see TLocDrvRequest::WriteRemote() |
|
459 |
*/ |
|
460 |
inline DThread*& RemoteThread() |
|
461 |
{return *(DThread**)&iArg[4];} |
|
462 |
||
463 |
||
464 |
/** |
|
465 |
Gets a pointer to the descriptor in the remote thread's process that |
|
466 |
contains the data to be read, or is the target for data to be written. |
|
467 |
||
468 |
However, it is recommended that such read or write operations be performed |
|
469 |
using ReadRemote() and WriteRemote(). |
|
470 |
||
471 |
@return A reference to a pointer to the remote descriptor. |
|
472 |
||
473 |
@see TLocDrvRequest::ReadRemote() |
|
474 |
@see TLocDrvRequest::WriteRemote() |
|
475 |
*/ |
|
476 |
inline TAny*& RemoteDes() |
|
477 |
{return *(TAny**)&iArg[5];} |
|
478 |
||
479 |
||
480 |
/** |
|
481 |
Gets the offset within the descriptor in the remote thread's process. |
|
482 |
||
483 |
@return The offset within the descriptor. |
|
484 |
*/ |
|
485 |
inline TInt& RemoteDesOffset() |
|
486 |
{return *(TInt*)&iArg[6];} |
|
487 |
||
488 |
||
489 |
/** |
|
490 |
@internalComponent |
|
491 |
*/ |
|
492 |
inline TInt& Flags() |
|
493 |
{return *(TInt*)&iArg[7];} |
|
494 |
||
495 |
||
496 |
/** |
|
497 |
@internalComponent |
|
498 |
*/ |
|
499 |
inline TLocDrv*& Drive() |
|
500 |
{return *(TLocDrv**)&iArg[8];} |
|
501 |
||
502 |
||
503 |
/** |
|
504 |
@internalComponent |
|
505 |
*/ |
|
506 |
inline TInt& DriverFlags() |
|
507 |
{return *(TInt*)&iArg[9];} |
|
508 |
||
509 |
||
510 |
/** |
|
511 |
Returns true if Physical memory addresses are available for this TLocDrvRequest. |
|
512 |
@return ETrue if a physical memory address is available. |
|
513 |
*/ |
|
514 |
inline TBool IsPhysicalAddress() |
|
515 |
{return Flags() & EPhysAddr;} |
|
516 |
public: |
|
517 |
TInt ProcessMessageData(TAny* args); |
|
518 |
void CloseRemoteThread(); |
|
519 |
IMPORT_C TInt ReadRemote(TDes8* aDes, TInt anOffset); |
|
520 |
IMPORT_C TInt ReadRemote(const TAny* aSrc, TDes8* aDes); |
|
521 |
IMPORT_C TInt ReadRemoteRaw(TAny* aDes, TInt aSize); |
|
522 |
IMPORT_C TInt WriteRemote(const TDesC8* aDes, TInt anOffset); |
|
523 |
IMPORT_C TInt WriteRemoteRaw(const TAny* aSrc, TInt aSize); |
|
524 |
IMPORT_C TInt CheckAndAdjustForPartition(); |
|
525 |
#if !defined(__WINS__) |
|
526 |
IMPORT_C TInt WriteToPageHandler(const TAny* aSrc, TInt aSize, TInt anOffset); |
|
527 |
IMPORT_C TInt ReadFromPageHandler(TAny* aDst, TInt aSize, TInt anOffset); |
|
528 |
#endif // __WINS__ |
|
529 |
IMPORT_C TInt GetNextPhysicalAddress(TPhysAddr& aPhysAddr, TInt& aLength); |
|
530 |
}; |
|
531 |
||
532 |
||
533 |
||
534 |
||
535 |
/** |
|
536 |
@internalComponent |
|
537 |
*/ |
|
538 |
inline void DLocalDrive::Deque() |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
539 |
{ iMediaChangeObserver.iLink.Deque(); } |
0 | 540 |
|
541 |
||
542 |
||
543 |
||
544 |
/** |
|
545 |
@publishedPartner |
|
546 |
@released |
|
547 |
||
548 |
Defines a structure used to contain information that describes an individual |
|
549 |
partition. |
|
550 |
||
551 |
There is one of these for each partition that exists on a media device. |
|
552 |
||
553 |
@see TPartitionInfo |
|
554 |
*/ |
|
555 |
class TPartitionEntry |
|
556 |
{ |
|
557 |
public: |
|
558 |
||
559 |
/** |
|
560 |
The start address of the partition, described as a relative offset, |
|
561 |
in bytes, from the start of the media. |
|
562 |
||
563 |
This value is used by the local media subsystem to calculate |
|
564 |
the absolute address on the media whenever an access such as a Read, |
|
565 |
Write or Format request is made. |
|
566 |
*/ |
|
567 |
Int64 iPartitionBaseAddr; |
|
568 |
||
569 |
||
570 |
/** |
|
571 |
The length of the partition, in bytes. |
|
572 |
*/ |
|
573 |
Int64 iPartitionLen; |
|
574 |
||
575 |
||
576 |
/** |
|
577 |
The Boot Indicator record, as described in the Master Boot Record on |
|
578 |
FAT Partitioned devices. |
|
579 |
||
580 |
This is currently unused by the local media subsystem. |
|
581 |
*/ |
|
582 |
TUint16 iBootIndicator; |
|
583 |
||
584 |
||
585 |
/** |
|
586 |
Describes the type of partition. |
|
587 |
||
588 |
The File Server uses this to decide the type of filesystem to be mounted |
|
589 |
on the partition. |
|
590 |
||
591 |
Symbian OS supports many partition types, as defined in partitions.h. |
|
592 |
You are, however, free to invent your own partition type, on which |
|
593 |
you could, for example, mount your own filesystem. However, make sure |
|
594 |
that your partition type does not clash with an existing partition type. |
|
595 |
||
596 |
Note that a media driver does not does not have to verify that |
|
597 |
the partition actually contains a file system of this type; it just sets |
|
598 |
this value to indicate the intended use for this partition. |
|
599 |
*/ |
|
600 |
TUint16 iPartitionType; |
|
601 |
}; |
|
602 |
||
603 |
||
604 |
||
605 |
||
606 |
/** |
|
607 |
@publishedPartner |
|
608 |
@released |
|
609 |
||
610 |
A constant that defines the maximum number of partitions that can exist on |
|
611 |
a media device. |
|
612 |
||
613 |
@see TPartitionInfo::iPartitionCount |
|
614 |
*/ |
|
615 |
const TInt KMaxPartitionEntries=0x10; |
|
616 |
||
617 |
||
618 |
||
619 |
||
620 |
/** |
|
621 |
@publishedPartner |
|
622 |
@released |
|
623 |
||
624 |
Contains partition information for a media device. |
|
625 |
||
626 |
An object of this type is passed to the media driver's implementation of |
|
627 |
DMediaDriver::PartitionInfo() to be filled in. |
|
628 |
||
629 |
@see DMediaDriver::PartitionInfo() |
|
630 |
*/ |
|
631 |
class TPartitionInfo |
|
632 |
{ |
|
633 |
public: |
|
634 |
||
635 |
/** |
|
636 |
Default constructor that clears this object's memory to binary zeroes. |
|
637 |
*/ |
|
638 |
TPartitionInfo(); |
|
639 |
public: |
|
640 |
||
641 |
/** |
|
642 |
The total size of the media, in bytes. |
|
643 |
*/ |
|
644 |
Int64 iMediaSizeInBytes; |
|
645 |
||
646 |
||
647 |
/** |
|
648 |
The total number of partitions that exist on the media. |
|
649 |
||
650 |
This is always less than or equal to KMaxPartitionEntries. |
|
651 |
||
652 |
@see KMaxPartitionEntries |
|
653 |
*/ |
|
654 |
TInt iPartitionCount; |
|
655 |
||
656 |
||
657 |
/** |
|
658 |
Information that describes each individual partition on the device. |
|
659 |
||
660 |
Each partition is represented by an array of TPartitionEntry objects. |
|
661 |
Each entry must be created in the order of the start offset, so that |
|
662 |
iEntry[0] specifies the partition with |
|
663 |
the smallest iPartitionBaseAddr value. |
|
664 |
||
665 |
@see TPartitionEntry::iPartitionBaseAddr |
|
666 |
@see TPartitionEntry |
|
667 |
*/ |
|
668 |
TPartitionEntry iEntry[KMaxPartitionEntries]; |
|
669 |
}; |
|
670 |
||
671 |
||
672 |
||
673 |
||
674 |
class DMedia; |
|
675 |
class DPrimaryMediaBase; |
|
676 |
class DMediaDriver; |
|
677 |
#ifdef __DEMAND_PAGING__ |
|
678 |
class DFragmentationPagingLock; |
|
679 |
#endif |
|
680 |
class DDmaHelper; |
|
681 |
||
682 |
/** |
|
683 |
@internalComponent |
|
684 |
*/ |
|
685 |
class TLocDrv : public TPartitionEntry |
|
686 |
{ |
|
687 |
public: |
|
688 |
TLocDrv(TInt aDriveNumber); |
|
689 |
public: |
|
690 |
inline TInt Connect(DLocalDrive* aLocalDrive); |
|
691 |
inline void Disconnect(DLocalDrive* aLocalDrive); |
|
692 |
inline TInt Request(TLocDrvRequest& aRequest); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
693 |
static TInt MediaChangeCallback(TAny* aLocDrv, TInt aNotifyType); |
0 | 694 |
public: |
695 |
TInt iDriveNumber; |
|
696 |
DMedia* iMedia; |
|
697 |
DPrimaryMediaBase* iPrimaryMedia; |
|
698 |
TInt iPartitionNumber; |
|
699 |
TErrorInfo iLastErrorInfo; |
|
700 |
#ifdef __DEMAND_PAGING__ |
|
701 |
TInt iSpare0; |
|
702 |
TUint8 iPagingDrv; |
|
703 |
TUint8 iSpare1; |
|
704 |
TUint8 iSpare2; |
|
705 |
TUint8 iSpare3; |
|
706 |
#endif |
|
707 |
DDmaHelper* iDmaHelper; |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
708 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
709 |
// Media extension stuff: |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
710 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
711 |
/** ptr to the next TLocDrv object in the chain. Null if not a media extension */ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
712 |
TLocDrv* iNextDrive; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
713 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
714 |
/** media change callback - called when the next media in the chain has a media change */ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
715 |
TCallBackLink iMediaChangeObserver; |
0 | 716 |
}; |
717 |
||
718 |
/** |
|
719 |
@publishedPartner |
|
720 |
@released |
|
721 |
||
722 |
Kernel-side representation of a media entity. A DMedia object instantiates a |
|
723 |
media driver to provide access to the physical media. |
|
724 |
||
725 |
Multiple DMedia objects may be required by some devices, e.g. multi-media cards |
|
726 |
with combined SRAM and Flash or cards containing user and protected areas. |
|
727 |
*/ |
|
728 |
class DMedia : public DBase |
|
729 |
{ |
|
730 |
public: |
|
731 |
/** |
|
732 |
Declaration of all legal states for the media driver. |
|
733 |
*/ |
|
734 |
enum TMediaState |
|
735 |
{ |
|
736 |
/** |
|
737 |
Media is powered down and the media drivers are closed. This is the |
|
738 |
initial state when a media driver is created and the final state when |
|
739 |
the driver is closed. |
|
740 |
*/ |
|
741 |
EClosed=0, |
|
742 |
||
743 |
/** Media driver has started powerup sequence. */ |
|
744 |
EPoweringUp1=1, |
|
745 |
||
746 |
/** Media is being opened. */ |
|
747 |
EOpening=2, |
|
748 |
||
749 |
/** Media is open and the partition information is being read. */ |
|
750 |
EReadPartitionInfo=3, |
|
751 |
||
752 |
/** The media driver is open and ready to accept commands. */ |
|
753 |
EReady=4, |
|
754 |
||
755 |
/** Not used. */ |
|
756 |
EAborted=5, |
|
757 |
||
758 |
/** Powering up with media drivers open. */ |
|
759 |
EPoweringUp2=6, |
|
760 |
||
761 |
/** Not used. */ |
|
762 |
ERecovering=7, |
|
763 |
||
764 |
/** The media is powered down, but the media driver still exists. */ |
|
765 |
EPoweredDown=8 // powered down with media drivers open |
|
766 |
}; |
|
767 |
||
768 |
public: |
|
769 |
IMPORT_C virtual TInt Create(TMediaDevice aDevice, TInt aMediaId, TInt); |
|
770 |
void Close(); |
|
771 |
public: |
|
772 |
inline Int64 MediaLenInBytes(); |
|
773 |
inline TMediaDevice DeviceType(); |
|
774 |
inline TInt PartitionCount(); |
|
775 |
inline Int64 PartitionBaseAddr(TInt aPartition); |
|
776 |
inline Int64 PartitionLen(TInt aPartition); |
|
777 |
public: |
|
778 |
/** Not used. */ |
|
779 |
static TInt MediaCallBack(TAny *aPtr); |
|
780 |
public: |
|
781 |
/** |
|
782 |
The unique ID associated with this media entity. |
|
783 |
ID allocated when the media is first created. |
|
784 |
||
785 |
@see LocDrv::RegisterMediaDevice |
|
786 |
*/ |
|
787 |
TInt iMediaId; |
|
788 |
||
789 |
/** |
|
790 |
The unique ID for the device. |
|
791 |
||
792 |
@see TMediaDevice |
|
793 |
*/ |
|
794 |
TMediaDevice iDevice; |
|
795 |
||
796 |
/** |
|
797 |
Partition information for the media device. |
|
798 |
||
799 |
@see TPartitionInfo |
|
800 |
*/ |
|
801 |
TPartitionInfo iPartitionInfo; |
|
802 |
||
803 |
/** |
|
804 |
The media's physical device driver. |
|
805 |
||
806 |
@see DMediaDriver |
|
807 |
*/ |
|
808 |
DMediaDriver *iDriver; |
|
809 |
||
810 |
/** |
|
811 |
Mount information for the media device. |
|
812 |
||
813 |
@see TMountInfoData |
|
814 |
*/ |
|
815 |
TMountInfoData iMountInfo; |
|
816 |
}; |
|
817 |
||
818 |
#ifdef __DEMAND_PAGING__ |
|
819 |
class DFragmentationPagingLock; |
|
820 |
class DMediaPagingDevice; |
|
821 |
#endif |
|
822 |
||
823 |
||
824 |
/** |
|
825 |
@publishedPartner |
|
826 |
@released |
|
827 |
The DPrimaryMedia base class which is derived from DMedia class is responsible for controlling the overall state of the media |
|
828 |
(for example whether the power is applied or the partition information has been determined and so on). |
|
829 |
Each media driver or extension that registers for a set of local drives also has to register for a set of DMedia objects at the same time. |
|
830 |
This media set must contain just one primary media object. |
|
831 |
The driver that performs drive registration is responsible for creating the primary media object itself, |
|
832 |
which it then passes over to the local media sub-system for ownership. |
|
833 |
If further media objects are specified in the set, then the local media sub-system itself creates DMedia instances for these on behalf of the driver. |
|
834 |
*/ |
|
835 |
class DPrimaryMediaBase : public DMedia |
|
836 |
{ |
|
837 |
public: |
|
838 |
enum TMsgId |
|
839 |
{ |
|
840 |
EConnect=-1, |
|
841 |
EDisconnect=-2, |
|
842 |
}; |
|
843 |
||
844 |
enum TForceMediaChangeFlags |
|
845 |
{ |
|
846 |
/** |
|
847 |
Specifying zero as the flag for DPrimaryMediaBase::ForceMediaChange(), |
|
848 |
results in all media drivers associated with the primary media being |
|
849 |
closed and reopened. |
|
850 |
All pending requests on all logical drives associated with the primary |
|
851 |
media will be cancelled. |
|
852 |
||
853 |
@see DPrimaryMediaBase::ForceMediaChange() |
|
854 |
@see RLocalDrive::ForceMediaChange() |
|
855 |
*/ |
|
856 |
KForceMediaChangeReOpenAllMediaDrivers = 0, |
|
857 |
/** |
|
858 |
This flag is used to simulate ejecting and re-inserting the media. |
|
859 |
All pending requests on all logical drives associated with the primary |
|
860 |
media will be cancelled. |
|
861 |
N.B. This is asynchronous in behaviour i.e. the caller will need to wait |
|
862 |
for (two) media change notifications before the drive is ready for use |
|
863 |
||
864 |
@see DPBusPrimaryMedia::ForceMediaChange() |
|
865 |
@see RLocalDrive::ForceMediaChange() |
|
866 |
*/ |
|
867 |
KMediaRemountForceMediaChange = 0x00000001, |
|
868 |
/** |
|
869 |
This flag is used to force the media driver for the specified logical |
|
870 |
drive to be closed and reopened. |
|
871 |
It should not affect any pending requests on other logical drives |
|
872 |
associated with the primary media. |
|
873 |
||
874 |
@see DPrimaryMediaBase::ForceMediaChange() |
|
875 |
@see RLocalDrive::ForceMediaChange() |
|
876 |
*/ |
|
877 |
KForceMediaChangeReOpenMediaDriver = 0x80000000 |
|
878 |
}; |
|
879 |
||
880 |
public: |
|
881 |
IMPORT_C DPrimaryMediaBase(); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
882 |
|
0 | 883 |
// provided by implementation |
884 |
IMPORT_C virtual TInt Create(TMediaDevice aDevice, TInt aMediaId, TInt aLastMediaId); |
|
885 |
IMPORT_C virtual TInt Connect(DLocalDrive* aLocalDrive); |
|
886 |
IMPORT_C virtual void Disconnect(DLocalDrive* aLocalDrive); |
|
887 |
IMPORT_C virtual TInt Request(TLocDrvRequest& aRequest); |
|
888 |
IMPORT_C virtual TInt QuickCheckStatus(); |
|
889 |
IMPORT_C virtual TInt ForceMediaChange(TInt aMode); |
|
890 |
IMPORT_C virtual TInt InitiatePowerUp(); |
|
891 |
IMPORT_C virtual TInt DoInCritical(); |
|
892 |
IMPORT_C virtual void DoEndInCritical(); |
|
893 |
IMPORT_C virtual void DeltaCurrentConsumption(TInt aCurrent); |
|
894 |
IMPORT_C virtual void DefaultDriveCaps(TLocalDriveCapsV2& aCaps); |
|
895 |
IMPORT_C virtual TBool IsRemovableDevice(TInt& aSocketNum); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
896 |
|
0 | 897 |
// used by implementation |
898 |
IMPORT_C void NotifyMediaChange(); |
|
899 |
IMPORT_C void NotifyPowerDown(); |
|
900 |
IMPORT_C void NotifyEmergencyPowerDown(); |
|
901 |
IMPORT_C void NotifyPsuFault(TInt anError); |
|
902 |
IMPORT_C void NotifyMediaPresent(); |
|
903 |
IMPORT_C void PowerUpComplete(TInt anError); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
904 |
|
0 | 905 |
IMPORT_C virtual void HandleMsg(TLocDrvRequest& aRequest); |
906 |
IMPORT_C virtual TInt DoRequest(TLocDrvRequest& aRequest); |
|
907 |
TInt OpenMediaDriver(); |
|
908 |
void CloseMediaDrivers(DMedia* aMedia = NULL); |
|
909 |
void StartOpenMediaDrivers(); |
|
910 |
void OpenNextMediaDriver(); |
|
911 |
void DoOpenMediaDriverComplete(TInt anError); |
|
912 |
void DoPartitionInfoComplete(TInt anError); |
|
913 |
void CompleteCurrent(TInt anError); |
|
914 |
void CompleteRequest(TLocDrvRequest& aMsg, TInt aResult); |
|
915 |
IMPORT_C void RunDeferred(); |
|
916 |
void SetClosed(TInt anError); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
917 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
918 |
enum TNotifyType {EMediaChange, EMediaPresent}; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
919 |
void NotifyClients(TNotifyType aNotifyType, TLocDrv* aLocDrv=NULL); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
920 |
|
0 | 921 |
TInt InCritical(); |
922 |
void EndInCritical(); |
|
923 |
void UpdatePartitionInfo(); |
|
924 |
void MediaReadyHandleRequest(); |
|
925 |
TInt SendReceive(TLocDrvRequest& aReq, TLinAddr aLinAddress = NULL); |
|
926 |
||
927 |
#ifdef __DEMAND_PAGING__ |
|
928 |
TInt PinSendReceive(TLocDrvRequest& aReq, TLinAddr aStart = NULL); |
|
929 |
TInt PinFragmentSendReceive(TLocDrvRequest& aReq, TLinAddr aLinAddress, TInt aLength); |
|
930 |
||
931 |
TBool PagingMediaPinAddress(TLinAddr aLinAddress, TInt aSize); |
|
932 |
void PagingMediaUnpinAddress(); |
|
933 |
#endif |
|
934 |
||
935 |
#ifdef __DEMAND_PAGING__ |
|
936 |
void RequestCountInc(); |
|
937 |
void RequestCountDec(); |
|
938 |
#endif |
|
939 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
940 |
// called by LocDrv::RegisterMediaDevice() for media extensions |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
941 |
TInt Connect(TLocDrv* aLocDrv); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
942 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
943 |
void MediaChange(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
944 |
TInt HandleMediaNotPresent(TLocDrvRequest& aReq); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
945 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
946 |
|
0 | 947 |
public: |
948 |
TInt iLastMediaId; /**< @internalComponent */ |
|
949 |
TMessageQue iMsgQ; |
|
950 |
TDfcQue* iDfcQ; |
|
951 |
SDblQue iConnectionQ; /**< @internalComponent */ |
|
952 |
TMessageQue iDeferred; /**< @internalComponent */ |
|
953 |
TMessageQue iWaitMedChg; /**< @internalComponent */ |
|
954 |
TInt iState; /**< @internalComponent */ |
|
955 |
TInt iCritical; /**< @internalComponent */ |
|
956 |
TLocDrvRequest* iCurrentReq; |
|
957 |
TDfc iAsyncDfc; /**< @internalComponent */ |
|
958 |
TInt iAsyncErrorCode; /**< @internalComponent */ |
|
959 |
RPhysicalDeviceArray iPhysDevArray; /**< @internalComponent */ |
|
960 |
||
961 |
class DBody; |
|
962 |
DBody* iBody; /**< @internalComponent */ |
|
963 |
||
964 |
TInt iNextMediaId; /**< @internalComponent */ |
|
965 |
TInt iTotalPartitionsOpened; /**< @internalComponent */ |
|
966 |
TInt iMediaDriversOpened; /**< @internalComponent */ |
|
967 |
DMediaDriver* iNextMediaDriver; /**< @internalComponent */ |
|
968 |
||
969 |
||
970 |
#ifdef __DEMAND_PAGING__ |
|
971 |
// keep the size of class as it is used as base for PBus and may not want to bother building DP specific version. |
|
972 |
TUint8 iPagingMedia; /**< @internalComponent */ |
|
973 |
TUint8 iDataPagingMedia; /**< @internalComponent */ |
|
974 |
TUint8 iRomPagingMedia; /**< @internalComponent */ |
|
975 |
TUint8 iRunningDeferred; /**< @internalComponent */ |
|
976 |
#else |
|
977 |
TInt iRunningDeferred; /**< @internalComponent */ |
|
978 |
#endif |
|
979 |
}; |
|
980 |
||
981 |
#ifdef __DEMAND_PAGING__ |
|
982 |
||
983 |
/** |
|
984 |
@internalComponent |
|
985 |
@prototype |
|
986 |
*/ |
|
987 |
NONSHARABLE_CLASS(DMediaPagingDevice) : public DPagingDevice |
|
988 |
{ |
|
989 |
public: |
|
990 |
enum TPagingRequestId |
|
991 |
{ |
|
992 |
/** |
|
993 |
Identifies any middle fragment of a Write request on a partition of a media that supports paging. |
|
994 |
@deprecated |
|
995 |
*/ |
|
996 |
EWriteRequestFragment = DLocalDrive::EFirstReqNumberReservedForPaging, |
|
997 |
||
998 |
/** |
|
999 |
Identifies the last fragment of a Write request on a partition of a media that supports paging. |
|
1000 |
@deprecated |
|
1001 |
*/ |
|
1002 |
EWriteRequestFragmentLast = DLocalDrive::EFirstReqNumberReservedForPaging+1, |
|
1003 |
||
1004 |
/** |
|
1005 |
Request for paging in (read) data from the ROM store area. |
|
1006 |
*/ |
|
1007 |
ERomPageInRequest = DLocalDrive::EFirstReqNumberReservedForPaging+2, |
|
1008 |
||
1009 |
/** |
|
1010 |
Request for paging in (read) data from the code store area. |
|
1011 |
*/ |
|
1012 |
ECodePageInRequest = DLocalDrive::EFirstReqNumberReservedForPaging+3, |
|
1013 |
||
1014 |
/** |
|
1015 |
Provided to allow the following compile time assert. |
|
1016 |
*/ |
|
1017 |
EPagingRequestHighWaterMark |
|
1018 |
}; |
|
1019 |
__ASSERT_COMPILE(EPagingRequestHighWaterMark <= DLocalDrive::ELastReqNumberReservedForPaging + 1); |
|
1020 |
||
1021 |
enum TQueue |
|
1022 |
{ |
|
1023 |
EMainQ = 0x01, |
|
1024 |
EDeferredQ=0x02 |
|
1025 |
}; |
|
1026 |
||
1027 |
public: |
|
1028 |
DMediaPagingDevice(DPrimaryMediaBase* aPtr); |
|
1029 |
virtual ~DMediaPagingDevice(); |
|
1030 |
||
1031 |
// from DPagingDevice |
|
1032 |
virtual TInt Read(TThreadMessage* aReq,TLinAddr aBuffer,TUint aOffset,TUint aSize,TInt aDrvNumber); |
|
1033 |
virtual TInt Write(TThreadMessage* aReq,TLinAddr aBuffer,TUint aOffset,TUint aSize, TBool aBackground); |
|
1034 |
virtual TInt DeleteNotify(TThreadMessage* aReq,TUint aOffset,TUint aSize); |
|
1035 |
||
1036 |
void CompleteRequest(TThreadMessage* aMsg, TInt aResult); |
|
1037 |
void SendToMainQueueDfcAndBlock(TThreadMessage* aMsg); |
|
1038 |
void SendToDeferredQ(TThreadMessage* aMsg); |
|
1039 |
inline static TBool PageInRequest(TLocDrvRequest& aReq); |
|
1040 |
inline static TBool PageOutRequest(TLocDrvRequest& aReq); |
|
1041 |
inline static TBool PagingRequest(TLocDrvRequest& aReq); |
|
1042 |
public: |
|
1043 |
TMessageQue iMainQ; |
|
1044 |
TMessageQue iDeferredQ; |
|
1045 |
DPrimaryMediaBase* iPrimaryMedia; |
|
1046 |
||
1047 |
TUint8 iEmptyingQ; |
|
1048 |
TUint8 iDeleteNotifyNotSupported; |
|
1049 |
TUint8 iSpare1; |
|
1050 |
TUint8 iSpare2; |
|
1051 |
||
1052 |
TAny* iMountInfoDataLock; |
|
1053 |
TAny* iMountInfoDescHdrLock; |
|
1054 |
TAny* iMountInfoDescLenLock; |
|
1055 |
||
1056 |
TInt iFirstLocalDriveNumber; |
|
1057 |
TInt iRomPagingDriveNumber; |
|
1058 |
TInt iDataPagingDriveNumber; |
|
1059 |
||
1060 |
NFastMutex iInstrumentationLock; // To protect instrumentation data |
|
1061 |
||
1062 |
#ifdef __CONCURRENT_PAGING_INSTRUMENTATION__ |
|
1063 |
TUint8 iServicingROM; |
|
1064 |
TUint8 iServicingCode; |
|
1065 |
TUint8 iServicingDataIn; |
|
1066 |
TUint8 iServicingDataOut; |
|
1067 |
||
1068 |
SMediaROMPagingConcurrencyInfo iROMStats; |
|
1069 |
SMediaCodePagingConcurrencyInfo iCodeStats; |
|
1070 |
SMediaDataPagingConcurrencyInfo iDataStats; |
|
1071 |
#endif |
|
1072 |
||
1073 |
#ifdef __DEMAND_PAGING_BENCHMARKS__ |
|
1074 |
SPagingBenchmarkInfo iROMBenchmarkData; |
|
1075 |
SPagingBenchmarkInfo iCodeBenchmarkData; |
|
1076 |
SPagingBenchmarkInfo iDataInBenchmarkData; |
|
1077 |
SPagingBenchmarkInfo iDataOutBenchmarkData; |
|
1078 |
SMediaPagingInfo iMediaPagingInfo; |
|
1079 |
#endif |
|
1080 |
}; |
|
1081 |
||
1082 |
inline TBool DMediaPagingDevice::PageInRequest(TLocDrvRequest& aReq) |
|
1083 |
{ |
|
1084 |
return |
|
1085 |
(aReq.Flags() & TLocDrvRequest::EPaging) && |
|
1086 |
(aReq.Id() == ERomPageInRequest || |
|
1087 |
aReq.Id() == ECodePageInRequest || |
|
1088 |
aReq.Id() == DLocalDrive::ERead);} |
|
1089 |
||
1090 |
inline TBool DMediaPagingDevice::PageOutRequest(TLocDrvRequest& aReq) |
|
1091 |
{ |
|
1092 |
return |
|
1093 |
(aReq.Flags() & TLocDrvRequest::EPaging) && |
|
1094 |
(aReq.Id() == DLocalDrive::EWrite);} |
|
1095 |
||
1096 |
inline TBool DMediaPagingDevice::PagingRequest(TLocDrvRequest& aReq) |
|
1097 |
{ |
|
1098 |
return (aReq.Flags() & TLocDrvRequest::EPaging); |
|
1099 |
} |
|
1100 |
||
1101 |
||
1102 |
/** |
|
1103 |
@internalComponent |
|
1104 |
@prototype |
|
1105 |
*/ |
|
1106 |
class DFragmentationPagingLock: public DDemandPagingLock |
|
1107 |
{ |
|
1108 |
public: |
|
1109 |
TInt Construct(TUint aNumPages); |
|
1110 |
void Cleanup(); |
|
1111 |
void LockFragmentation() |
|
1112 |
{ |
|
1113 |
__ASSERT_CRITICAL; |
|
1114 |
__ASSERT_DEBUG(iFragmentationMutex, Kern::Fault("LOCMEDIA_H",__LINE__)); |
|
1115 |
// called in CS |
|
1116 |
Kern::MutexWait(*iFragmentationMutex); |
|
1117 |
} |
|
1118 |
void UnlockFragmentation() |
|
1119 |
{ |
|
1120 |
__ASSERT_CRITICAL; |
|
1121 |
__ASSERT_DEBUG(iFragmentationMutex, Kern::Fault("LOCMEDIA_H",__LINE__)); |
|
1122 |
// called in CS |
|
1123 |
Kern::MutexSignal(*iFragmentationMutex); |
|
1124 |
} |
|
1125 |
||
1126 |
||
1127 |
public: |
|
1128 |
TUint iFragmentGranularity; |
|
1129 |
private: |
|
1130 |
DMutex* iFragmentationMutex; // to protect Kernel memory locking |
|
1131 |
}; |
|
1132 |
#endif //__DEMAND_PAGING__ |
|
1133 |
||
1134 |
/** |
|
1135 |
@publishedPartner |
|
1136 |
@released |
|
1137 |
||
1138 |
An abstract base class for all media drivers in the local drive system. |
|
1139 |
||
1140 |
All media drivers, whether associated with fixed media, such as the internal |
|
1141 |
drive, or removable media, such as a PC Card or MultiMediaCard, must define |
|
1142 |
and implement a class derived from this one. |
|
1143 |
||
1144 |
An instance of this class is created by the media driver's PDD factory, |
|
1145 |
an instance of a class derived from DPhysicalDevice. |
|
1146 |
||
1147 |
@see DPhysicalDevice::Create() |
|
1148 |
@see DPhysicalDevice |
|
1149 |
*/ |
|
1150 |
class DMediaDriver : public DBase |
|
1151 |
{ |
|
1152 |
public: |
|
1153 |
IMPORT_C DMediaDriver(TInt aMediaId); |
|
1154 |
IMPORT_C virtual ~DMediaDriver(); |
|
1155 |
IMPORT_C virtual void Close(); |
|
1156 |
// Pure virtual |
|
1157 |
IMPORT_C virtual void Disconnect(DLocalDrive* aLocalDrive, TThreadMessage* aMsg); |
|
1158 |
||
1159 |
/** |
|
1160 |
A function called by the local media subsystem to deal with a request, |
|
1161 |
and which must be implemented by the media driver. |
|
1162 |
||
1163 |
@param aRequest An object that encapsulates information about the request. |
|
1164 |
||
1165 |
@return A value indicating the result: |
|
1166 |
KErrNone, if the request has been sucessfully initiated; |
|
1167 |
KErrNotSupported, if the request cannot be handled by the device; |
|
1168 |
KMediaDriverDeferRequest, if the request cannot be handled |
|
1169 |
immediately because of an outstanding request (this request will be |
|
1170 |
deferred until the outstanding request has completed); |
|
1171 |
otherwise one of the other system-wide error codes. |
|
1172 |
*/ |
|
1173 |
virtual TInt Request(TLocDrvRequest& aRequest)=0; |
|
1174 |
||
1175 |
/** |
|
1176 |
A function called by the local media subsystem to get partition information |
|
1177 |
for the media device. |
|
1178 |
||
1179 |
It is called once the subsystem has been notified that the media driver |
|
1180 |
is open and has been succesfully initialised. |
|
1181 |
||
1182 |
This function must be implemented by the media driver. |
|
1183 |
||
1184 |
@param anInfo An object that, on successful return, contains |
|
1185 |
the partition information. |
|
1186 |
||
1187 |
@return KErrNone, if retrieval of partition information is to be |
|
1188 |
done asynchronously; |
|
1189 |
KErrCompletion, if retrieval of partition information has been |
|
1190 |
done synchronously, and successfully; |
|
1191 |
one of the other system-wide error codes, if retrieval of partition |
|
1192 |
information has been done synchronously, but unsuccessfully. |
|
1193 |
*/ |
|
1194 |
virtual TInt PartitionInfo(TPartitionInfo &anInfo)=0; |
|
1195 |
||
1196 |
/** |
|
1197 |
A function called by the local media subsystem to inform the media driver |
|
1198 |
that the device should power down. |
|
1199 |
||
1200 |
This function must be implemented by the media driver. |
|
1201 |
*/ |
|
1202 |
virtual void NotifyPowerDown()=0; |
|
1203 |
||
1204 |
/** |
|
1205 |
A function called by the local media subsystem to inform the media driver |
|
1206 |
that the device is to be immediately powered down. |
|
1207 |
||
1208 |
This function must be implemented by the media driver. |
|
1209 |
*/ |
|
1210 |
virtual void NotifyEmergencyPowerDown()=0; |
|
1211 |
public: |
|
1212 |
IMPORT_C void SetTotalSizeInBytes(Int64 aTotalSizeInBytes, TLocDrv* aLocDrv=NULL); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1213 |
IMPORT_C void SetTotalSizeInBytes(TLocalDriveCapsV4& aCaps); |
0 | 1214 |
IMPORT_C Int64 TotalSizeInBytes(); |
1215 |
IMPORT_C void SetCurrentConsumption(TInt aValue); |
|
1216 |
IMPORT_C TInt InCritical(); |
|
1217 |
IMPORT_C void EndInCritical(); |
|
1218 |
IMPORT_C void Complete(TLocDrvRequest& aRequest, TInt aResult); |
|
1219 |
IMPORT_C void OpenMediaDriverComplete(TInt anError); |
|
1220 |
IMPORT_C void PartitionInfoComplete(TInt anError); |
|
1221 |
public: |
|
1222 |
DPhysicalDevice* iPhysicalDevice;/**< @internalComponent */ |
|
1223 |
Int64 iTotalSizeInBytes; /**< @internalComponent */ |
|
1224 |
TInt iCurrentConsumption; /**< @internalComponent */ |
|
1225 |
DPrimaryMediaBase* iPrimaryMedia;/**< @internalComponent */ |
|
1226 |
TBool iCritical; /**< @internalComponent */ |
|
1227 |
TMountInfoData* iMountInfo; /**< @internalComponent */ |
|
1228 |
}; |
|
1229 |
||
1230 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1231 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1232 |
@internalTechnology |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1233 |
@prototype |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1234 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1235 |
An abstract base class for media driver 'extensions' within the local media subsystem |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1236 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1237 |
class DMediaDriverExtension : public DMediaDriver |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1238 |
{ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1239 |
public: |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1240 |
IMPORT_C DMediaDriverExtension(TInt aMediaId); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1241 |
IMPORT_C virtual ~DMediaDriverExtension(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1242 |
IMPORT_C virtual void Close(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1243 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1244 |
virtual TInt Request(TLocDrvRequest& aRequest) = 0; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1245 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1246 |
virtual TInt PartitionInfo(TPartitionInfo &anInfo) = 0; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1247 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1248 |
IMPORT_C virtual void NotifyPowerDown(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1249 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1250 |
IMPORT_C virtual void NotifyEmergencyPowerDown(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1251 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1252 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1253 |
Retrieve partition info from all the attached drives |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1254 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1255 |
IMPORT_C TInt DoDrivePartitionInfo(TPartitionInfo &anInfo); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1256 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1257 |
Forward a request to the next attached drive |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1258 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1259 |
IMPORT_C TInt ForwardRequest(TLocDrvRequest& aRequest); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1260 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1261 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1262 |
Read from the specified attached drive |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1263 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1264 |
IMPORT_C TInt Read(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1265 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1266 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1267 |
Write to the specified attached drive |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1268 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1269 |
IMPORT_C TInt Write(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1270 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1271 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1272 |
Get the Caps from the specified attached drive |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1273 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1274 |
IMPORT_C TInt Caps(TInt aDriveNumber, TDes8& aCaps); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1275 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1276 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1277 |
Return whether the media is busy i.e. if it has any pending requests or DFCs |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1278 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1279 |
IMPORT_C TBool MediaBusy(TInt aDriveNumber); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1280 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1281 |
#ifdef __DEMAND_PAGING__ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1282 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1283 |
Send a paging read request to the specified attached drive |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1284 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1285 |
IMPORT_C TInt ReadPaged(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1286 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1287 |
/** |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1288 |
Send a paging write request to the specified attached drive |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1289 |
*/ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1290 |
IMPORT_C TInt WritePaged(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1291 |
#endif |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1292 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1293 |
private: |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1294 |
TInt SendRequest(TInt aReqId, TBool aPagingRequest, TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1295 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1296 |
}; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1297 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
1298 |
|
0 | 1299 |
|
1300 |
||
1301 |
/** |
|
1302 |
@publishedPartner |
|
1303 |
@released |
|
1304 |
||
1305 |
A structure that a media driver may find useful in its implementation, |
|
1306 |
and is used to contain the information required when registering |
|
1307 |
the media driver with the Local Media Subsystem. |
|
1308 |
||
1309 |
@see LocDrv::RegisterMediaDevice() |
|
1310 |
*/ |
|
1311 |
struct SMediaDeviceInfo |
|
1312 |
{ |
|
1313 |
||
1314 |
/** |
|
1315 |
The unique Media ID for a device. |
|
1316 |
||
1317 |
This can take one of the enumerated values defined |
|
1318 |
by the TMediaDevice enum. |
|
1319 |
*/ |
|
1320 |
TMediaDevice iDevice; |
|
1321 |
||
1322 |
||
1323 |
/** |
|
1324 |
Specifies the number of local drive objects to be assigned to the media driver. |
|
1325 |
||
1326 |
Drives that support more than one partition must specify a number greater than 1. |
|
1327 |
*/ |
|
1328 |
TInt iDriveCount; |
|
1329 |
||
1330 |
||
1331 |
/** |
|
1332 |
A pointer to an array of TInt values, which define the drive numbers that |
|
1333 |
are to be allocated to each partition. |
|
1334 |
||
1335 |
0 signifies Drive C, 1 signifies drive D, etc. For example, to allocate |
|
1336 |
drive letters J and K, specify an array containing the values [7,8]. |
|
1337 |
Note that the size of this array must be the same as the value specified |
|
1338 |
by iDriveCount. |
|
1339 |
*/ |
|
1340 |
const TInt* iDriveList; |
|
1341 |
||
1342 |
||
1343 |
/** |
|
1344 |
Specifies the total number of DMedia objects to be associated with |
|
1345 |
the media driver. |
|
1346 |
||
1347 |
This number includes the primary DPrimaryMedia object, plus all of |
|
1348 |
the DMedia objects that are created for each additional drive, and |
|
1349 |
which hold basic information about partitions. |
|
1350 |
*/ |
|
1351 |
TInt iNumMedia; |
|
1352 |
||
1353 |
||
1354 |
/** |
|
1355 |
A pointer to a descriptor containing the name of the media driver, |
|
1356 |
for example: PCCard |
|
1357 |
*/ |
|
1358 |
const TDesC* iDeviceName; |
|
1359 |
}; |
|
1360 |
||
1361 |
||
1362 |
||
1363 |
||
1364 |
/** |
|
1365 |
@publishedPartner |
|
1366 |
@released |
|
1367 |
||
1368 |
A set of utility functions used in the management of local media drivers. |
|
1369 |
*/ |
|
1370 |
class LocDrv |
|
1371 |
{ |
|
1372 |
public: |
|
1373 |
IMPORT_C static TInt RegisterMediaDevice(TMediaDevice aDevice, TInt aDriveCount, const TInt* aDriveList, DPrimaryMediaBase* aPrimaryMedia, TInt aNumMedia, const TDesC& aName); |
|
1374 |
IMPORT_C static TInt RegisterPasswordStore(TPasswordStore* aStore); |
|
1375 |
IMPORT_C static TPasswordStore* PasswordStore(); |
|
1376 |
#if !defined(__WINS__) |
|
1377 |
IMPORT_C static TInt RegisterPagingDevice(DPrimaryMediaBase* aPrimaryMedia, const TInt* aPagingDriveList, TInt aDriveCount, TUint aPagingType, TInt aReadShift, TUint aNumPages); |
|
1378 |
#endif // __WINS__ |
|
1379 |
IMPORT_C static TInt RegisterDmaDevice(DPrimaryMediaBase* aPrimaryMedia, |
|
1380 |
TInt aMediaBlockSize, |
|
1381 |
TInt aDmaMaxAddressable, |
|
1382 |
TInt aDmaAlignment); |
|
1383 |
}; |
|
1384 |
||
1385 |
/** |
|
1386 |
@internalComponent |
|
1387 |
*/ |
|
1388 |
inline TInt TLocDrv::Connect(DLocalDrive* aLocalDrive) |
|
1389 |
{ return iPrimaryMedia->Connect(aLocalDrive); } |
|
1390 |
||
1391 |
/** |
|
1392 |
@internalComponent |
|
1393 |
*/ |
|
1394 |
inline void TLocDrv::Disconnect(DLocalDrive* aLocalDrive) |
|
1395 |
{ iPrimaryMedia->Disconnect(aLocalDrive); } |
|
1396 |
||
1397 |
/** |
|
1398 |
@internalComponent |
|
1399 |
*/ |
|
1400 |
inline TInt TLocDrv::Request(TLocDrvRequest& aRequest) |
|
1401 |
{ return iPrimaryMedia->Request(aRequest); } |
|
1402 |
||
1403 |
/** |
|
1404 |
Returns the length of the media, in bytes, according to the partition information. |
|
1405 |
||
1406 |
@return Total length of the media, in bytes. |
|
1407 |
||
1408 |
@see TPartitionInfo |
|
1409 |
*/ |
|
1410 |
inline Int64 DMedia::MediaLenInBytes() |
|
1411 |
{return(iPartitionInfo.iMediaSizeInBytes);} |
|
1412 |
||
1413 |
/** |
|
1414 |
Returns the unique media ID for this device. |
|
1415 |
||
1416 |
@return The device ID that was set in the call to DMedia::Create(). |
|
1417 |
The return value will be one of the enumerators declared in TMediaDevice |
|
1418 |
||
1419 |
@see TMediaDevice |
|
1420 |
*/ |
|
1421 |
inline TMediaDevice DMedia::DeviceType() |
|
1422 |
{return(iDevice);} |
|
1423 |
||
1424 |
/** |
|
1425 |
Returns the total number of partitions that exist on the media according to the |
|
1426 |
partition information. |
|
1427 |
||
1428 |
This will always be less than or equal to KMaxPartitionEntries. |
|
1429 |
||
1430 |
@return Number of partitions that exist on the media. |
|
1431 |
||
1432 |
@see KMaxPartitionEntries |
|
1433 |
@see TPartitionInfo |
|
1434 |
*/ |
|
1435 |
inline TInt DMedia::PartitionCount() |
|
1436 |
{return(iPartitionInfo.iPartitionCount);} |
|
1437 |
||
1438 |
/** |
|
1439 |
The start address of the partition, described as a relative offset, in bytes, |
|
1440 |
from the start of the media. |
|
1441 |
||
1442 |
This value is used by the local media subsystem to calculate the absolute |
|
1443 |
address on the media whenever an access such as a Read, Write or Format request |
|
1444 |
is made. |
|
1445 |
||
1446 |
@param aPartition The partition whose start address is to be returned. |
|
1447 |
||
1448 |
@return The start address of the partition. |
|
1449 |
||
1450 |
@see TPartitionEntry |
|
1451 |
@see TPartitionInfo |
|
1452 |
*/ |
|
1453 |
inline Int64 DMedia::PartitionBaseAddr(TInt aPartition) |
|
1454 |
{return(iPartitionInfo.iEntry[aPartition].iPartitionBaseAddr);} |
|
1455 |
||
1456 |
/** |
|
1457 |
Returns the length of the partition, in bytes. |
|
1458 |
||
1459 |
@param aPartition The partition whose length is to be returned. |
|
1460 |
||
1461 |
@return The length of the partition. |
|
1462 |
||
1463 |
@see TPartitionEntry |
|
1464 |
@see TPartitionInfo |
|
1465 |
*/ |
|
1466 |
inline Int64 DMedia::PartitionLen(TInt aPartition) |
|
1467 |
{return(iPartitionInfo.iEntry[aPartition].iPartitionLen);} |
|
1468 |
||
1469 |
||
1470 |
/** |
|
1471 |
@internalTechnology |
|
1472 |
||
1473 |
A utility class for scanning MBR/EBR partition tables. |
|
1474 |
*/ |
|
1475 |
class TPartitionTableScanner |
|
1476 |
{ |
|
1477 |
public: |
|
1478 |
enum {ESectorShift=9, ESectorSize=512}; |
|
1479 |
enum {EMaxNest=4}; |
|
1480 |
struct SPart |
|
1481 |
{ |
|
1482 |
SPart(const TUint8* a); |
|
1483 |
TUint8 iBootInd; |
|
1484 |
TUint8 iType; |
|
1485 |
TUint32 iRSS; |
|
1486 |
TUint32 iSectors; |
|
1487 |
}; |
|
1488 |
struct SEBR |
|
1489 |
{ |
|
1490 |
TInt64 iRSS; |
|
1491 |
TInt64 iSectors; |
|
1492 |
}; |
|
1493 |
public: |
|
1494 |
IMPORT_C void Set(TUint8* aSectorBuffer, TPartitionEntry* aEntry, TInt aMaxPartitions, TInt64 aMediaSize); |
|
1495 |
IMPORT_C TInt64 NextLBA(); |
|
1496 |
IMPORT_C TInt NumberOfPartitionsFound() const; |
|
1497 |
TInt MakeEntry(const SPart& aP); |
|
1498 |
public: |
|
1499 |
TInt64 iMediaSize; // Total media size in sectors |
|
1500 |
TInt64 iLBA; // LBA currently in sector buffer |
|
1501 |
TInt64 iFirstEBR; // LBA of first EBR if any |
|
1502 |
SEBR iStack[EMaxNest]; |
|
1503 |
TInt iStackPointer; |
|
1504 |
TUint8* iSectorBuffer; // Pointer to 512 byte area where sector data is stored |
|
1505 |
TPartitionEntry* iFirstEntry; // Where first scanned partition is stored |
|
1506 |
TPartitionEntry* iNextEntry; // Where next scanned partition will be stored |
|
1507 |
TPartitionEntry* iLimit; // iFirstEntry + max partitions |
|
1508 |
}; |
|
1509 |
||
1510 |
||
1511 |
||
1512 |
#endif |