author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 26 | c734af59ce98 |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1999-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 |
// Generic MMC controller types and standard classes for MMC manipulation |
|
15 |
// This controller follows MMC spec V2.1 |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
/** |
|
20 |
@file |
|
21 |
@internalComponent |
|
22 |
*/ |
|
23 |
||
24 |
#if !defined(__MMC_H__) |
|
25 |
#define __MMC_H__ |
|
26 |
||
27 |
#include <drivers/pbus.h> |
|
28 |
#include <d32locd.h> |
|
29 |
||
30 |
// MMC Card maximum system settings |
|
31 |
||
32 |
const TInt KMaxMmcSockets = KMaxPBusSockets; |
|
33 |
||
34 |
// Forward type declarations |
|
35 |
||
36 |
class TMMC; |
|
37 |
class TCID; |
|
38 |
class TCSD; |
|
39 |
class TExtendedCSD; |
|
40 |
class TRCA; |
|
41 |
class TDSR; |
|
42 |
class TMMCStatus; |
|
43 |
class TMMCArgument; |
|
44 |
class TMMCard; |
|
45 |
class TMMCCommandDesc; |
|
46 |
class TMMCBusConfig; |
|
47 |
class TMMCStackConfig; |
|
48 |
class TMMCRCAPool; |
|
49 |
class TMMCSessRing; |
|
50 |
class TMMCStateMachine; |
|
51 |
class DMMCSocket; |
|
52 |
class DMMCSession; |
|
53 |
class DMMCStack; |
|
54 |
class TMMCMachineInfo; |
|
55 |
class TMapping; |
|
56 |
class TMMCPasswordStore; |
|
57 |
class TMMCEraseInfo; |
|
58 |
class TMMCMachineInfoV4; |
|
59 |
typedef TPckg<TMMCMachineInfoV4> TMMCMachineInfoV4Pckg; |
|
60 |
||
61 |
enum TMMCAppCommand {EMMCNormalCmd,EMMCApplicationCmd}; |
|
62 |
||
63 |
// Typedefs |
|
64 |
||
65 |
/** |
|
66 |
@publishedPartner |
|
67 |
@released |
|
68 |
||
69 |
Represents the MultiMediaCard error code bit set. |
|
70 |
||
71 |
MultiMediaCard error codes are defined as bit masks, mainly for use with |
|
72 |
the state machine where the error trap mask may be used. |
|
73 |
The function DMMCSession::EpocErrorCode() converts these error bit values |
|
74 |
into standard Symbian OS error values. |
|
75 |
||
76 |
@see KMMCErrNone |
|
77 |
@see KMMCErrResponseTimeOut |
|
78 |
@see KMMCErrDataTimeOut |
|
79 |
@see KMMCErrBusyTimeOut |
|
80 |
@see KMMCErrBusTimeOut |
|
81 |
@see KMMCErrTooManyCards |
|
82 |
@see KMMCErrResponseCRC |
|
83 |
@see KMMCErrDataCRC |
|
84 |
@see KMMCErrCommandCRC |
|
85 |
@see KMMCErrStatus |
|
86 |
@see KMMCErrNoCard |
|
87 |
@see KMMCErrBrokenLock |
|
88 |
@see KMMCErrPowerDown |
|
89 |
@see KMMCErrAbort |
|
90 |
@see KMMCErrStackNotReady |
|
91 |
@see KMMCErrNotSupported |
|
92 |
@see KMMCErrHardware |
|
93 |
@see KMMCErrBusInconsistent |
|
94 |
@see KMMCErrBypass |
|
95 |
@see KMMCErrInitContext |
|
96 |
@see KMMCErrArgument |
|
97 |
@see KMMCErrSingleBlock |
|
98 |
@see KMMCErrLocked |
|
99 |
@see KMMCErrNotFound |
|
100 |
@see KMMCErrAlreadyExists |
|
101 |
@see KMMCErrGeneral |
|
102 |
@see KMMCErrAll |
|
103 |
@see KMMCErrBasic |
|
104 |
*/ |
|
105 |
typedef TUint32 TMMCErr; |
|
106 |
||
107 |
// MMC Enums and inline functions |
|
108 |
||
109 |
||
110 |
||
111 |
||
112 |
/** |
|
113 |
@publishedPartner |
|
114 |
@released |
|
115 |
||
116 |
Defines a set of symbols corresponding to the MultiMediaCard bus commands. |
|
117 |
||
118 |
A command is one of the parameter values inserted into a TMMCCommandDesc object. |
|
119 |
The commands themselves are defined by the MultiMediaCard specification. |
|
120 |
||
121 |
@see TMMCCommandDesc |
|
122 |
*/ |
|
123 |
enum TMMCCommandEnum |
|
124 |
{ |
|
125 |
/** |
|
126 |
CMD0; reset all cards to idle state. |
|
127 |
*/ |
|
128 |
ECmdGoIdleState =0, |
|
129 |
||
130 |
||
131 |
/** |
|
132 |
CMD1; all cards in the idle state send their operating conditions. |
|
133 |
*/ |
|
134 |
ECmdSendOpCond =1, |
|
135 |
||
136 |
||
137 |
/** |
|
138 |
CMD2; all cards send their CID number. |
|
139 |
*/ |
|
140 |
ECmdAllSendCID =2, |
|
141 |
||
142 |
||
143 |
/** |
|
144 |
CMD3; assign relative address to a card. |
|
145 |
*/ |
|
146 |
ECmdSetRelativeAddr =3, |
|
147 |
||
148 |
||
149 |
/** |
|
150 |
CMD4; program the DSR register of all cards. |
|
151 |
*/ |
|
152 |
ECmdSetDSR =4, |
|
153 |
||
154 |
||
155 |
/** |
|
156 |
CMD5; toggle device between Sleep and Awake states. |
|
157 |
*/ |
|
158 |
ECmd5 =5, |
|
159 |
ECmdSleepAwake =5, |
|
160 |
||
161 |
||
162 |
/** |
|
163 |
CMD6; Switch |
|
164 |
*/ |
|
165 |
ECmd6 =6, |
|
166 |
ECmdSwitch =6, |
|
167 |
||
168 |
||
169 |
/** |
|
170 |
CMD7; toggle a card between standby and transfer state, or between |
|
171 |
programming and disconnected state. |
|
172 |
||
173 |
The card is selected by its RCA and deselected by any other address. |
|
174 |
*/ |
|
175 |
ECmdSelectCard =7, |
|
176 |
||
177 |
||
178 |
/** |
|
179 |
CMD8; addressed card sends its extended CSD. |
|
180 |
*/ |
|
181 |
ECmd8 =8, |
|
182 |
ECmdSendExtendedCSD =8, |
|
183 |
||
184 |
||
185 |
/** |
|
186 |
CMD9; addressed card sends its CSD. |
|
187 |
*/ |
|
188 |
ECmdSendCSD =9, |
|
189 |
||
190 |
||
191 |
/** |
|
192 |
CMD10; addressed card sends its CID. |
|
193 |
*/ |
|
194 |
ECmdSendCID =10, |
|
195 |
||
196 |
||
197 |
/** |
|
198 |
CMD11; read data stream from the card starting at the given address until |
|
199 |
an ECmdStopTransmission follows. |
|
200 |
||
201 |
@see ECmdStopTransmission |
|
202 |
*/ |
|
203 |
ECmdReadDatUntilStop =11, |
|
204 |
||
205 |
||
206 |
/** |
|
207 |
CMD12; force the card to stop transmission. |
|
208 |
*/ |
|
209 |
ECmdStopTransmission =12, |
|
210 |
||
211 |
||
212 |
/** |
|
213 |
CMD13; addressed card sends its status register. |
|
214 |
*/ |
|
215 |
ECmdSendStatus =13, |
|
216 |
||
217 |
||
218 |
/** |
|
219 |
CMD14; BUSTEST_R - Reads the reversed bus testing data pattern from the card. |
|
220 |
||
221 |
@see ECmdBustest_W |
|
222 |
*/ |
|
223 |
ECmd14 =14, |
|
224 |
ECmdBustest_R =14, |
|
225 |
||
226 |
||
227 |
/** |
|
228 |
CMD15; set the card to the inactive state. |
|
229 |
*/ |
|
230 |
ECmdGoInactiveState =15, |
|
231 |
||
232 |
||
233 |
/** |
|
234 |
CMD16; set the block length for all following block commands. |
|
235 |
*/ |
|
236 |
ECmdSetBlockLen =16, |
|
237 |
||
238 |
||
239 |
/** |
|
240 |
CMD17; read a single data block from the card. |
|
241 |
*/ |
|
242 |
ECmdReadSingleBlock =17, |
|
243 |
||
244 |
||
245 |
/** |
|
246 |
CMD18; continuously transfer data blocks from the card until interrupted |
|
247 |
by ECmdStopTransmission. |
|
248 |
||
249 |
@see ECmdStopTransmission |
|
250 |
*/ |
|
251 |
ECmdReadMultipleBlock =18, |
|
252 |
||
253 |
||
254 |
/** |
|
255 |
CMD19; BUSTEST_W - Sends a test data pattern to the card to determine the bus characteristics |
|
256 |
||
257 |
@see ECmdBustest_R |
|
258 |
*/ |
|
259 |
ECmd19 =19, |
|
260 |
ECmdBustest_W =19, |
|
261 |
||
262 |
||
263 |
/** |
|
264 |
CMD20; write data stream from the host starting at the given address |
|
265 |
until interrupted by ECmdStopTransmission. |
|
266 |
||
267 |
@see ECmdStopTransmission |
|
268 |
*/ |
|
269 |
ECmdWriteDatUntilStop =20, |
|
270 |
||
271 |
||
272 |
/** |
|
273 |
CMD21; reserved for future use. |
|
274 |
*/ |
|
275 |
ECmd21 =21, |
|
276 |
||
277 |
||
278 |
/** |
|
279 |
CMD22; reserved for future use. |
|
280 |
*/ |
|
281 |
ECmd22 =22, |
|
282 |
||
283 |
||
284 |
/** |
|
285 |
CMD23; define the number of blocks to be transferred in the following |
|
286 |
multiple block read or write command. |
|
287 |
*/ |
|
288 |
ECmdSetBlockCount =23, |
|
289 |
||
290 |
||
291 |
/** |
|
292 |
CMD24; write a single block to the card. |
|
293 |
*/ |
|
294 |
ECmdWriteBlock =24, |
|
295 |
||
296 |
||
297 |
/** |
|
298 |
CMD25; continuously transfer data blocks to the card until interrupted |
|
299 |
by ECmdStopTransmission. |
|
300 |
||
301 |
@see ECmdStopTransmission |
|
302 |
*/ |
|
303 |
ECmdWriteMultipleBlock =25, |
|
304 |
||
305 |
||
306 |
/** |
|
307 |
CMD26; programming of the CID. |
|
308 |
||
309 |
This is issued once per card, and is normally reserved for |
|
310 |
the manufacturer. |
|
311 |
*/ |
|
312 |
ECmdProgramCID =26, |
|
313 |
||
314 |
||
315 |
/** |
|
316 |
CMD27; programming of the programmable bits of the CSD. |
|
317 |
*/ |
|
318 |
ECmdProgramCSD =27, |
|
319 |
||
320 |
||
321 |
/** |
|
322 |
CMD28; set the write protect bit of the addressed group, if the card has |
|
323 |
write protection features. |
|
324 |
*/ |
|
325 |
ECmdSetWriteProt =28, |
|
326 |
||
327 |
||
328 |
/** |
|
329 |
CMD29; clear the write protect bit of the addressed group, if the card has |
|
330 |
write protection features. |
|
331 |
*/ |
|
332 |
ECmdClearWriteProt =29, |
|
333 |
||
334 |
||
335 |
/** |
|
336 |
CMD30; ask the card to send the status of the write protect bit, if |
|
337 |
the card has write protection features. |
|
338 |
*/ |
|
339 |
ECmdSendWriteProt =30, |
|
340 |
||
341 |
||
342 |
/** |
|
343 |
CMD31; reserved for future use. |
|
344 |
*/ |
|
345 |
ECmd31 =31, |
|
346 |
||
347 |
||
348 |
/** |
|
349 |
CMD32; set the address of the first sector of the erase group. |
|
350 |
*/ |
|
351 |
ECmdTagSectorStart =32, |
|
352 |
||
353 |
||
354 |
/** |
|
355 |
CMD33; set the address of the last sector in a continuous range within |
|
356 |
the selected erase group, or the address of a single sector to be |
|
357 |
selected for erase. |
|
358 |
*/ |
|
359 |
ECmdTagSectorEnd =33, |
|
360 |
||
361 |
||
362 |
/** |
|
363 |
CMD34; remove one previously selected sector from the erase selection. |
|
364 |
*/ |
|
365 |
ECmdUntagSector =34, |
|
366 |
||
367 |
||
368 |
/** |
|
369 |
CMD35; set the the address of the first erase group within a continuous |
|
370 |
range to be selected for erase. |
|
371 |
*/ |
|
372 |
ECmdTagEraseGroupStart =35, |
|
373 |
||
374 |
||
375 |
/** |
|
376 |
CMD36; set the address of the last erase group within a continuous range |
|
377 |
to be selected for erase. |
|
378 |
*/ |
|
379 |
ECmdTagEraseGroupEnd =36, |
|
380 |
||
381 |
||
382 |
/** |
|
383 |
CMD37; removes one previously selected erase group from the erase selection. |
|
384 |
*/ |
|
385 |
ECmdUntagEraseGroup =37, |
|
386 |
||
387 |
||
388 |
/** |
|
389 |
CMD38; erase all previously selected sectors. |
|
390 |
*/ |
|
391 |
ECmdErase =38, |
|
392 |
||
393 |
||
394 |
/** |
|
395 |
CMD39; read and write 8 bit (register) data fields. |
|
396 |
*/ |
|
397 |
ECmdFastIO =39, |
|
398 |
||
399 |
||
400 |
/** |
|
401 |
CMD40; set the system into interrupt mode. |
|
402 |
*/ |
|
403 |
ECmdGoIRQState =40, |
|
404 |
||
405 |
||
406 |
/** |
|
407 |
CMD41; reserved for future use. |
|
408 |
*/ |
|
409 |
ECmd41 =41, |
|
410 |
||
411 |
||
412 |
/** |
|
413 |
CMD42; set/reset the password or lock/unlock the card. |
|
414 |
*/ |
|
415 |
ECmdLockUnlock =42, |
|
416 |
||
417 |
||
418 |
/** |
|
419 |
CMD43; reserved for future use. |
|
420 |
*/ |
|
421 |
ECmd43 =43, |
|
422 |
||
423 |
||
424 |
/** |
|
425 |
CMD44; reserved for future use. |
|
426 |
*/ |
|
427 |
ECmd44 =44, |
|
428 |
||
429 |
||
430 |
/** |
|
431 |
CMD45; reserved for future use. |
|
432 |
*/ |
|
433 |
ECmd45 =45, |
|
434 |
||
435 |
||
436 |
/** |
|
437 |
CMD46; reserved for future use. |
|
438 |
*/ |
|
439 |
ECmd46 =46, |
|
440 |
||
441 |
||
442 |
/** |
|
443 |
CMD47; reserved for future use. |
|
444 |
*/ |
|
445 |
ECmd47 =47, |
|
446 |
||
447 |
||
448 |
/** |
|
449 |
CMD48; reserved for future use. |
|
450 |
*/ |
|
451 |
ECmd48 =48, |
|
452 |
||
453 |
||
454 |
/** |
|
455 |
CMD49; reserved for future use. |
|
456 |
*/ |
|
457 |
ECmd49 =49, |
|
458 |
||
459 |
||
460 |
/** |
|
461 |
CMD50; reserved for future use. |
|
462 |
*/ |
|
463 |
ECmd50 =50, |
|
464 |
||
465 |
||
466 |
/** |
|
467 |
CMD51; reserved for future use. |
|
468 |
*/ |
|
469 |
ECmd51 =51, |
|
470 |
||
471 |
||
472 |
/** |
|
473 |
CMD52; reserved for future use. |
|
474 |
*/ |
|
475 |
ECmd52 =52, |
|
476 |
||
477 |
||
478 |
/** |
|
479 |
CMD53; reserved for future use. |
|
480 |
*/ |
|
481 |
ECmd53 =53, |
|
482 |
||
483 |
||
484 |
/** |
|
485 |
CMD54; reserved for future use. |
|
486 |
*/ |
|
487 |
ECmd54 =54, |
|
488 |
||
489 |
||
490 |
/** |
|
491 |
CMD55; indicate to the card that the next command is an application |
|
492 |
specific command rather than a standard command. |
|
493 |
*/ |
|
494 |
ECmdAppCmd =55, |
|
495 |
||
496 |
||
497 |
/** |
|
498 |
CMD56; transfer a data block to the card, or get a data block from the card, |
|
499 |
for general purpose/application specific commands. |
|
500 |
*/ |
|
501 |
ECmdGenCmd =56, |
|
502 |
||
503 |
||
504 |
/** |
|
505 |
CMD57; reserved for future use. |
|
506 |
*/ |
|
507 |
ECmd57 =57, |
|
508 |
||
509 |
||
510 |
/** |
|
511 |
CMD58; reserved for future use. |
|
512 |
*/ |
|
513 |
ECmd58 =58, |
|
514 |
||
515 |
||
516 |
/** |
|
517 |
CMD59; reserved for future use. |
|
518 |
*/ |
|
519 |
ECmd59 =59, |
|
520 |
||
521 |
||
522 |
/** |
|
523 |
CMD60; reserved for future use. |
|
524 |
*/ |
|
525 |
ECmd60 =60, |
|
526 |
||
527 |
||
528 |
/** |
|
529 |
CMD61; reserved for future use. |
|
530 |
*/ |
|
531 |
ECmd61 =61, |
|
532 |
||
533 |
||
534 |
/** |
|
535 |
CMD62; reserved for future use. |
|
536 |
*/ |
|
537 |
ECmd62 =62, |
|
538 |
||
539 |
||
540 |
/** |
|
541 |
CMD63; reserved for future use. |
|
542 |
*/ |
|
543 |
ECmd63 =63 |
|
544 |
}; |
|
545 |
||
546 |
enum TMMCCommandTypeEnum |
|
547 |
{ |
|
548 |
ECmdTypeUK, // UnKnown command type |
|
549 |
ECmdTypeBC, // Broadcast Command |
|
550 |
ECmdTypeBCR, // Broadcast Command with Response |
|
551 |
ECmdTypeAC, // Addressed Command |
|
552 |
ECmdTypeACS, // Addressed Command to a Selected card |
|
553 |
ECmdTypeADTCS, // Addressed Data Transfer Command to a Selected card |
|
554 |
ECmdTypeADC // Addressed Direct Command to a Selected card |
|
555 |
}; |
|
556 |
||
557 |
enum TMMCResponseTypeEnum |
|
558 |
{ |
|
559 |
ERespTypeNone, |
|
560 |
ERespTypeUnknown, |
|
561 |
ERespTypeR1, // 32 bits Status |
|
562 |
ERespTypeR1B, // 32 bits Status with possible busy signal |
|
563 |
ERespTypeR2, // 128 bits CID or CSD register |
|
564 |
ERespTypeR3, // 32 bits OCR register |
|
565 |
ERespTypeR4, // 32 bits Fast I/O |
|
566 |
ERespTypeR5, // 32 bits IRQ |
|
567 |
ERespTypeR6, |
|
568 |
ERespTypeR7 // not currently defined for MMC |
|
569 |
}; |
|
570 |
||
571 |
||
572 |
/** |
|
573 |
@publishedPartner |
|
574 |
@released |
|
575 |
||
576 |
Defines the set of media types for a MultiMediaCard. |
|
577 |
*/ |
|
578 |
enum TMMCMediaTypeEnum |
|
579 |
{ |
|
580 |
/** |
|
581 |
A read only card. |
|
582 |
*/ |
|
583 |
EMultiMediaROM, |
|
584 |
||
585 |
||
586 |
/** |
|
587 |
A writable card. |
|
588 |
*/ |
|
589 |
EMultiMediaFlash, |
|
590 |
||
591 |
||
592 |
/** |
|
593 |
An I/O card. |
|
594 |
*/ |
|
595 |
EMultiMediaIO, |
|
596 |
||
597 |
||
598 |
/** |
|
599 |
A card type that is neither read only, writable nor I/O. |
|
600 |
*/ |
|
601 |
EMultiMediaOther, |
|
602 |
||
603 |
||
604 |
/** |
|
605 |
A card type that is not supported. |
|
606 |
*/ |
|
607 |
EMultiMediaNotSupported |
|
608 |
}; |
|
609 |
||
610 |
enum TMMCSessionTypeEnum |
|
611 |
{ |
|
612 |
ECIMNakedSession =0, |
|
613 |
ECIMUpdateAcq =1, |
|
614 |
ECIMInitStack =2, |
|
615 |
ECIMCheckStack =3, |
|
616 |
ECIMSetupCard =4, |
|
617 |
ECIMReadBlock =5, |
|
618 |
ECIMWriteBlock =6, |
|
619 |
ECIMReadMBlock =7, |
|
620 |
ECIMWriteMBlock =8, |
|
621 |
ECIMEraseSector =9, |
|
622 |
ECIMEraseGroup =10, |
|
623 |
ECIMReadIO =11, |
|
624 |
ECIMWriteIO =12, |
|
625 |
ECIMLockUnlock =13, |
|
626 |
ECIMLockStack =14, |
|
627 |
ECIMInitStackAfterUnlock =15, |
|
628 |
ECIMAutoUnlock =16, |
|
629 |
ECIMSleep =17 |
|
630 |
}; |
|
631 |
||
632 |
const TUint KMMCMaxSessionTypeNumber = 18; |
|
633 |
const TUint KMMCMinCustomSession = 1024; |
|
634 |
||
635 |
const TUint KMMCCmdDirDirBitPosition= KBit0; //fixed - dont change it |
|
636 |
const TUint KMMCCmdDirIndBitPosition= (KBit5-KBit0); //fixed - dont change it |
|
637 |
const TUint KMMCCmdDirWBitArgument= KBit5; |
|
638 |
const TUint KMMCCmdDirNegate= KBit6; |
|
639 |
const TUint KMMCCmdDirWBitDirect= KBit7; |
|
640 |
||
641 |
const TUint KMMCCmdReliableWrite = KBit31; |
|
642 |
||
643 |
||
644 |
/** |
|
645 |
@publishedPartner |
|
646 |
@released |
|
647 |
||
648 |
An enum whose values specify the data transfer direction. |
|
649 |
||
650 |
@see TMMCCommandSpec |
|
651 |
*/ |
|
652 |
enum TMMCCmdDirEnum |
|
653 |
{ |
|
654 |
EDirNone = 0, |
|
655 |
EDirRead = KMMCCmdDirWBitDirect, |
|
656 |
EDirWrite = KMMCCmdDirWBitDirect|KMMCCmdDirDirBitPosition, |
|
657 |
EDirWBit0 = KMMCCmdDirWBitArgument + 0, |
|
658 |
EDirRBit0 = (KMMCCmdDirWBitArgument|KMMCCmdDirNegate) + 0 |
|
659 |
}; |
|
660 |
||
661 |
||
662 |
||
663 |
||
664 |
/** |
|
665 |
@publishedPartner |
|
666 |
@released |
|
667 |
||
668 |
An enum whose values specify the width of the data bus |
|
669 |
||
670 |
This enum is used by the DMMCStack::SetBusWidth() and TMMCMachineInfo.iMaxBusWidth. |
|
671 |
*/ |
|
672 |
enum TBusWidth |
|
673 |
{ |
|
674 |
EBusWidth1 = 0x00, |
|
675 |
EBusWidth4 = 0x02, |
|
676 |
EBusWidth8 = 0x03, |
|
677 |
EBusWidthInvalid = KMaxTUint32 |
|
678 |
}; |
|
679 |
||
680 |
/** |
|
681 |
@publishedPartner |
|
682 |
@released |
|
683 |
*/ |
|
684 |
const TUint8 KMMCLockUnlockErase = KBit3; // In first byte of CMD42 data block |
|
685 |
||
686 |
/** |
|
687 |
@publishedPartner |
|
688 |
@released |
|
689 |
*/ |
|
690 |
const TUint8 KMMCLockUnlockLockUnlock = KBit2; |
|
691 |
||
692 |
/** |
|
693 |
@publishedPartner |
|
694 |
@released |
|
695 |
*/ |
|
696 |
const TUint8 KMMCLockUnlockClrPwd = KBit1; |
|
697 |
||
698 |
/** |
|
699 |
@publishedPartner |
|
700 |
@released |
|
701 |
*/ |
|
702 |
const TUint8 KMMCLockUnlockSetPwd = KBit0; |
|
703 |
||
704 |
||
705 |
||
706 |
||
707 |
/** |
|
708 |
@publishedPartner |
|
709 |
@released |
|
710 |
||
711 |
A utility class that contains convenience functions to handle conversion |
|
712 |
to and from big-endian format. |
|
713 |
*/ |
|
714 |
class TMMC |
|
715 |
{ |
|
716 |
public: |
|
717 |
static inline TUint32 BigEndian32(const TUint8*); |
|
718 |
static inline void BigEndian4Bytes(TUint8* aPtr, TUint32 aVal); |
|
719 |
}; |
|
720 |
||
721 |
||
722 |
// Generic MMC layer constants |
|
723 |
||
724 |
const TInt KMaxMMCStacks=1; // Number of separate MMC buses |
|
725 |
const TUint KMaxMMCardsPerStack=4; // Limits the number of cards in each stack |
|
726 |
||
727 |
const TUint KBroadcastToAllCards=0xFFFFFFFF; |
|
728 |
||
729 |
// MMC Spec related constants |
|
730 |
||
731 |
const TUint KMMCMaxResponseLength=16; // in bytes |
|
732 |
const TUint KMMCCIDLength=16; |
|
733 |
const TUint KMMCCSDLength=16; |
|
734 |
const TUint KMMCExtendedCSDLength=512; |
|
735 |
const TUint KMMCBusClockFOD=400; // Identification clock in kiloherz |
|
736 |
const TUint KMMCCommandMask = 63; // Size of TMMCCommandEnum enumerator |
|
737 |
||
738 |
// Command Classes Bit Set |
|
739 |
||
740 |
/** |
|
741 |
@publishedPartner |
|
742 |
@released |
|
743 |
*/ |
|
744 |
const TUint32 KMMCCmdClassNone= 0; |
|
745 |
||
746 |
/** |
|
747 |
@publishedPartner |
|
748 |
@released |
|
749 |
*/ |
|
750 |
const TUint32 KMMCCmdClassBasic= KBit0; |
|
751 |
||
752 |
/** |
|
753 |
@publishedPartner |
|
754 |
@released |
|
755 |
*/ |
|
756 |
const TUint32 KMMCCmdClassStreamRead= KBit1; |
|
757 |
||
758 |
/** |
|
759 |
@publishedPartner |
|
760 |
@released |
|
761 |
*/ |
|
762 |
const TUint32 KMMCCmdClassBlockRead= KBit2; |
|
763 |
||
764 |
/** |
|
765 |
@publishedPartner |
|
766 |
@released |
|
767 |
*/ |
|
768 |
const TUint32 KMMCCmdClassStreamWrite= KBit3; |
|
769 |
||
770 |
/** |
|
771 |
@publishedPartner |
|
772 |
@released |
|
773 |
*/ |
|
774 |
const TUint32 KMMCCmdClassBlockWrite= KBit4; |
|
775 |
||
776 |
/** |
|
777 |
@publishedPartner |
|
778 |
@released |
|
779 |
*/ |
|
780 |
const TUint32 KMMCCmdClassErase= KBit5; |
|
781 |
||
782 |
/** |
|
783 |
@publishedPartner |
|
784 |
@released |
|
785 |
*/ |
|
786 |
const TUint32 KMMCCmdClassWriteProtection=KBit6; |
|
787 |
||
788 |
/** |
|
789 |
@publishedPartner |
|
790 |
@released |
|
791 |
*/ |
|
792 |
const TUint32 KMMCCmdClassLockCard= KBit7; |
|
793 |
||
794 |
/** |
|
795 |
@publishedPartner |
|
796 |
@released |
|
797 |
*/ |
|
798 |
const TUint32 KMMCCmdClassApplication= KBit8; |
|
799 |
||
800 |
/** |
|
801 |
@publishedPartner |
|
802 |
@released |
|
803 |
*/ |
|
804 |
const TUint32 KMMCCmdClassIOMode= KBit9; |
|
805 |
||
806 |
/** |
|
807 |
@publishedPartner |
|
808 |
@released |
|
809 |
*/ |
|
810 |
const TUint32 KMMCCmdClassReserved10= KBit10; |
|
811 |
const TUint32 KMMCCmdClassSwitch= KBit10; |
|
812 |
||
813 |
/** |
|
814 |
@publishedPartner |
|
815 |
@released |
|
816 |
*/ |
|
817 |
const TUint32 KMMCCmdClassReserved11= KBit11; |
|
818 |
||
819 |
// Specific MMC implementation constants |
|
820 |
||
821 |
const TUint KMaxMMCMachineStackDepth=20; // TMMCStateMachine stack depth |
|
822 |
const TUint KMaxMMCCommandStackDepth=9; // Session TMMCCommandDesc stack depth |
|
823 |
const TUint KMMCIdleCommandsAtRestart=2; // Number of CMD0s to be issued at initialisation |
|
824 |
const TUint KMMCMaxJobsInStackWorkSet=8; // Number of sessions simultaneously served |
|
825 |
const TUint KMMCPollGapInMilliseconds=40; |
|
826 |
const TUint KMMCMaxPollAttempts=5; // 40*5 = 200ms |
|
827 |
const TUint KMMCRetryGapInMilliseconds=10; |
|
828 |
const TUint KMMCMaxTimeOutRetries=1; |
|
829 |
const TUint KMMCMaxCRCRetries=1; |
|
830 |
const TUint16 KMMCMaxUnlockRetries=4; |
|
831 |
const TUint16 KMMCMaxAutoUnlockRetries=25; |
|
832 |
const TUint KMMCMaxGlobalRetries=1; |
|
833 |
const TUint16 KMMCSpecOpCondBusyTimeout=100 ; //MMC/SD Standard OCR timeout 1 second |
|
834 |
const TUint16 KMMCMaxOpCondBusyTimeout=150; // 10*150 = 1500ms |
|
835 |
const TUint KMMCLowVoltagePowerUpTimeoutInMilliseconds=2; // 1ms + 74 400KHz clock cycles |
|
836 |
const TUint KMMCUnlockRetryGapInMilliseconds = 200; // Unlock retry gap |
|
837 |
||
838 |
// DMMCStack Modes Bit Set |
|
839 |
const TUint32 KMMCModeEnableClientConfig = KBit0; // Merge with session iConfig |
|
840 |
const TUint32 KMMCModeEnableTimeOutRetry = KBit1; // Auto retry on response time-outs |
|
841 |
const TUint32 KMMCModeTimeOutRetryGap = KBit2; // Force timer delay between retries |
|
842 |
const TUint32 KMMCModeEnableCRCRetry = KBit3; // Command or response CRC errors |
|
843 |
const TUint32 KMMCModeCRCRetryGap = KBit4; |
|
844 |
const TUint32 KMMCModeDataCRCRetry = KBit5; // Repeat data transaction from the last valid position |
|
845 |
const TUint32 KMMCModeEnableUnlockRetry = KBit6; // Resend CMD42 for unreliable cards |
|
846 |
const TUint32 KMMCModeEnablePreemption = KBit7; // Allow sessions to share the MMC bus |
|
847 |
const TUint32 KMMCModePreemptOnBusy = KBit8; // Release bus control if busy |
|
848 |
const TUint32 KMMCModePreemptOnRetry = KBit9; // Release bus control before timeout/crc retries |
|
849 |
const TUint32 KMMCModePreemptInGaps = KBit10; // Preempt whenever gap timer is invoked |
|
850 |
const TUint32 KMMCModeEnqueIfLocked = KBit11; // Enque session if DMMCStack is locked |
|
851 |
const TUint32 KMMCModeCardControlled = KBit12; // Use Session CardP to get RCAs etc. |
|
852 |
const TUint32 KMMCModeCompleteInStackDFC = KBit13; // Run DMMCStack in DFC when completing |
|
853 |
const TUint32 KMMCModeEnableBusyPoll = KBit14; // Enables mechanism recovering from busy timeouts |
|
854 |
const TUint32 KMMCModeBusyPollGap = KBit15; |
|
855 |
const TUint32 KMMCModeEnableRetries = KBit16; // This mode removed disables all retries/polls |
|
856 |
const TUint32 KMMCModeMask = KBit17 - KBit0; |
|
857 |
||
858 |
// The following modes are effective for MasterConfig only |
|
859 |
const TUint32 KMMCModeClientPollAttempts = KBit20; |
|
860 |
const TUint32 KMMCModeClientTimeOutRetries = KBit21; |
|
861 |
const TUint32 KMMCModeClientCRCRetries = KBit22; |
|
862 |
const TUint32 KMMCModeClientUnlockRetries = KBit23; |
|
863 |
const TUint32 KMMCModeClientBusClock = KBit24; |
|
864 |
const TUint32 KMMCModeClientClockIn = KBit25; |
|
865 |
const TUint32 KMMCModeClientClockOut = KBit26; |
|
866 |
const TUint32 KMMCModeClientResponseTimeOut = KBit27; |
|
867 |
const TUint32 KMMCModeClientDataTimeOut = KBit28; |
|
868 |
const TUint32 KMMCModeClientBusyTimeOut = KBit29; |
|
869 |
const TUint32 KMMCModeClientiOpCondBusyTimeout = KBit30; |
|
870 |
const TUint32 KMMCModeClientMask = KBit31 - KBit20; |
|
871 |
||
872 |
// The following modes cannot be enabled by a client if disabled in MasterConfig |
|
873 |
const TUint32 KMMCModeMasterOverrides= |
|
874 |
KMMCModeEnableClientConfig | |
|
875 |
KMMCModeEnablePreemption | |
|
876 |
KMMCModeEnqueIfLocked | |
|
877 |
KMMCModeClientMask; |
|
878 |
||
879 |
// The following modes are always effective, even if the ClientConfig is disabled |
|
880 |
const TUint32 KMMCModeClientOverrides= |
|
881 |
KMMCModeEnableClientConfig | |
|
882 |
KMMCModeCardControlled; |
|
883 |
||
884 |
||
885 |
// The default MasterConfig modes |
|
886 |
const TUint32 KMMCModeDefault= KMMCModeEnableClientConfig | |
|
887 |
KMMCModeEnableRetries | |
|
888 |
KMMCModeEnableTimeOutRetry | |
|
889 |
KMMCModeTimeOutRetryGap | |
|
890 |
KMMCModeEnableCRCRetry | |
|
891 |
KMMCModeCRCRetryGap | |
|
892 |
KMMCModeDataCRCRetry | |
|
893 |
KMMCModeEnableUnlockRetry | |
|
894 |
KMMCModeEnablePreemption | |
|
895 |
KMMCModePreemptInGaps | |
|
896 |
KMMCModeEnqueIfLocked | |
|
897 |
KMMCModeCardControlled | |
|
898 |
KMMCModeClientMask; |
|
899 |
||
900 |
||
901 |
// MMC Error Code Bit Set |
|
902 |
||
903 |
/** |
|
904 |
@publishedPartner |
|
905 |
@released |
|
906 |
||
907 |
A MultiMediaCard error code. |
|
908 |
||
909 |
Indicates no error. |
|
910 |
||
911 |
@see TMMCErr |
|
912 |
*/ |
|
913 |
const TUint32 KMMCErrNone=0; |
|
914 |
||
915 |
||
916 |
/** |
|
917 |
@publishedPartner |
|
918 |
@released |
|
919 |
||
920 |
A MultiMediaCard error code. |
|
921 |
||
922 |
Timed out waiting for a response from the card after issuing a command. |
|
923 |
||
924 |
@see TMMCErr |
|
925 |
*/ |
|
926 |
const TUint32 KMMCErrResponseTimeOut=KBit0; |
|
927 |
||
928 |
||
929 |
/** |
|
930 |
@publishedPartner |
|
931 |
@released |
|
932 |
||
933 |
A MultiMediaCard error code. |
|
934 |
||
935 |
Timed out waiting for a data block to be received during a data read command. |
|
936 |
||
937 |
@see TMMCErr |
|
938 |
*/ |
|
939 |
const TUint32 KMMCErrDataTimeOut= KBit1; |
|
940 |
||
941 |
||
942 |
/** |
|
943 |
@publishedPartner |
|
944 |
@released |
|
945 |
||
946 |
A MultiMediaCard error code. |
|
947 |
||
948 |
Timed out waiting for a data block to be requested during a data write command. |
|
949 |
||
950 |
@see TMMCErr |
|
951 |
*/ |
|
952 |
const TUint32 KMMCErrBusyTimeOut= KBit2; |
|
953 |
||
954 |
||
955 |
/** |
|
956 |
@publishedPartner |
|
957 |
@released |
|
958 |
||
959 |
A MultiMediaCard error code. |
|
960 |
||
961 |
Timed out during the CIM_UPDATE_ACQ macro waiting for a card to power up. |
|
962 |
Cards that are still powering up return busy in response to a SEND_OP_COND command. |
|
963 |
||
964 |
@see TMMCErr |
|
965 |
*/ |
|
966 |
const TUint32 KMMCErrBusTimeOut= KBit3; |
|
967 |
||
968 |
||
969 |
/** |
|
970 |
@publishedPartner |
|
971 |
@released |
|
972 |
||
973 |
A MultiMediaCard error code. |
|
974 |
||
975 |
The host has detected more cards in a stack that it can handle, or it has |
|
976 |
detected more cards than it was expecting, for example, more cards than physical slots. |
|
977 |
||
978 |
@see TMMCErr |
|
979 |
*/ |
|
980 |
const TUint32 KMMCErrTooManyCards= KBit4; |
|
981 |
||
982 |
||
983 |
/** |
|
984 |
@publishedPartner |
|
985 |
@released |
|
986 |
||
987 |
A MultiMediaCard error code. |
|
988 |
||
989 |
The host has detected a CRC error in a response received from a card. |
|
990 |
||
991 |
@see TMMCErr |
|
992 |
*/ |
|
993 |
const TUint32 KMMCErrResponseCRC= KBit5; |
|
994 |
||
995 |
||
996 |
/** |
|
997 |
@publishedPartner |
|
998 |
@released |
|
999 |
||
1000 |
A MultiMediaCard error code. |
|
1001 |
||
1002 |
The host has detected a CRC error in a data block received from a card. |
|
1003 |
||
1004 |
@see TMMCErr |
|
1005 |
*/ |
|
1006 |
const TUint32 KMMCErrDataCRC= KBit6; |
|
1007 |
||
1008 |
||
1009 |
/** |
|
1010 |
@publishedPartner |
|
1011 |
@released |
|
1012 |
||
1013 |
A MultiMediaCard error code. |
|
1014 |
||
1015 |
The card has detected a CRC error in a command received from the host. |
|
1016 |
||
1017 |
@see TMMCErr |
|
1018 |
*/ |
|
1019 |
const TUint32 KMMCErrCommandCRC= KBit7; |
|
1020 |
||
1021 |
||
1022 |
/** |
|
1023 |
@publishedPartner |
|
1024 |
@released |
|
1025 |
||
1026 |
A MultiMediaCard error code. |
|
1027 |
||
1028 |
An R1 response was received from the card with one or more of the error flags |
|
1029 |
set in the card status field. |
|
1030 |
||
1031 |
@see TMMCErr |
|
1032 |
*/ |
|
1033 |
const TUint32 KMMCErrStatus= KBit8; |
|
1034 |
||
1035 |
||
1036 |
/** |
|
1037 |
@publishedPartner |
|
1038 |
@released |
|
1039 |
||
1040 |
A MultiMediaCard error code. |
|
1041 |
||
1042 |
A session was submitted without first being set-up with a card object, |
|
1043 |
or was set-up with a card object that is no longer present. |
|
1044 |
||
1045 |
@see TMMCErr |
|
1046 |
*/ |
|
1047 |
const TUint32 KMMCErrNoCard= KBit9; |
|
1048 |
||
1049 |
||
1050 |
/** |
|
1051 |
@publishedPartner |
|
1052 |
@released |
|
1053 |
||
1054 |
A MultiMediaCard error code. |
|
1055 |
||
1056 |
The session had the stack locked but the MultiMediaCard controller had |
|
1057 |
to override the lock to perform some other bus activity. |
|
1058 |
||
1059 |
@see TMMCErr |
|
1060 |
*/ |
|
1061 |
const TUint32 KMMCErrBrokenLock= KBit10; |
|
1062 |
||
1063 |
||
1064 |
/** |
|
1065 |
@publishedPartner |
|
1066 |
@released |
|
1067 |
||
1068 |
A MultiMediaCard error code. |
|
1069 |
||
1070 |
The card was powered down. |
|
1071 |
||
1072 |
@see TMMCErr |
|
1073 |
*/ |
|
1074 |
const TUint32 KMMCErrPowerDown= KBit11; |
|
1075 |
||
1076 |
||
1077 |
/** |
|
1078 |
@publishedPartner |
|
1079 |
@released |
|
1080 |
||
1081 |
A MultiMediaCard error code. |
|
1082 |
||
1083 |
The session was stopped. |
|
1084 |
||
1085 |
@see TMMCErr |
|
1086 |
*/ |
|
1087 |
const TUint32 KMMCErrAbort= KBit12; |
|
1088 |
||
1089 |
||
1090 |
/** |
|
1091 |
@publishedPartner |
|
1092 |
@released |
|
1093 |
||
1094 |
A MultiMediaCard error code. |
|
1095 |
||
1096 |
The stack has not yet been initialised. |
|
1097 |
||
1098 |
@see TMMCErr |
|
1099 |
*/ |
|
1100 |
const TUint32 KMMCErrStackNotReady= KBit13; |
|
1101 |
||
1102 |
||
1103 |
/** |
|
1104 |
@publishedPartner |
|
1105 |
@released |
|
1106 |
||
1107 |
A MultiMediaCard error code. |
|
1108 |
||
1109 |
The session requested a service or feature that is not supported. |
|
1110 |
||
1111 |
@see TMMCErr |
|
1112 |
*/ |
|
1113 |
const TUint32 KMMCErrNotSupported= KBit14; |
|
1114 |
||
1115 |
||
1116 |
/** |
|
1117 |
@publishedPartner |
|
1118 |
@released |
|
1119 |
||
1120 |
A MultiMediaCard error code. |
|
1121 |
||
1122 |
Indicates a general hardware related error. |
|
1123 |
||
1124 |
@see TMMCErr |
|
1125 |
*/ |
|
1126 |
const TUint32 KMMCErrHardware= KBit15; |
|
1127 |
||
1128 |
||
1129 |
/** |
|
1130 |
@publishedPartner |
|
1131 |
@released |
|
1132 |
||
1133 |
A MultiMediaCard error code. |
|
1134 |
||
1135 |
An unexpected or inconsistent bus state has been detected. |
|
1136 |
||
1137 |
@see TMMCErr |
|
1138 |
*/ |
|
1139 |
const TUint32 KMMCErrBusInconsistent=KBit16; |
|
1140 |
||
1141 |
||
1142 |
||
1143 |
||
1144 |
// SM control error codes |
|
1145 |
||
1146 |
/** |
|
1147 |
@publishedPartner |
|
1148 |
@released |
|
1149 |
||
1150 |
A MultiMediaCard error code. |
|
1151 |
||
1152 |
This is used interally by the MultiMediaCard controller. |
|
1153 |
||
1154 |
@see TMMCErr |
|
1155 |
*/ |
|
1156 |
const TUint32 KMMCErrBypass= KBit17; |
|
1157 |
||
1158 |
||
1159 |
/** |
|
1160 |
@publishedPartner |
|
1161 |
@released |
|
1162 |
||
1163 |
A MultiMediaCard error code. |
|
1164 |
||
1165 |
This is used internally by the MultiMediaCard controller in the process |
|
1166 |
of re-initialising a card to recover from an inconsistent bus state. |
|
1167 |
||
1168 |
@see TMMCErr |
|
1169 |
*/ |
|
1170 |
const TUint32 KMMCErrInitContext= KBit18; |
|
1171 |
||
1172 |
||
1173 |
/** |
|
1174 |
@publishedPartner |
|
1175 |
@released |
|
1176 |
||
1177 |
A MultiMediaCard error code. |
|
1178 |
||
1179 |
Indicates a bad argument. |
|
1180 |
||
1181 |
@see TMMCErr |
|
1182 |
*/ |
|
1183 |
const TUint32 KMMCErrArgument= KBit19; |
|
1184 |
||
1185 |
||
1186 |
/** |
|
1187 |
@publishedPartner |
|
1188 |
@released |
|
1189 |
||
1190 |
A MultiMediaCard error code. |
|
1191 |
||
1192 |
A multiple block operation was requested, but the length specified was |
|
1193 |
less than that of a block. |
|
1194 |
||
1195 |
@see TMMCErr |
|
1196 |
*/ |
|
1197 |
const TUint32 KMMCErrSingleBlock= KBit20; |
|
1198 |
||
1199 |
||
1200 |
||
1201 |
/** |
|
1202 |
@internalComponent |
|
1203 |
*/ |
|
1204 |
const TUint32 KMMCErrUpdPswd= KBit21; |
|
1205 |
||
1206 |
||
1207 |
||
1208 |
||
1209 |
// General error codes |
|
1210 |
||
1211 |
/** |
|
1212 |
@publishedPartner |
|
1213 |
@released |
|
1214 |
||
1215 |
A MultiMediaCard error code. |
|
1216 |
||
1217 |
The card is locked. |
|
1218 |
||
1219 |
@see TMMCErr |
|
1220 |
*/ |
|
1221 |
const TUint32 KMMCErrLocked= KBit22; |
|
1222 |
||
1223 |
||
1224 |
/** |
|
1225 |
@publishedPartner |
|
1226 |
@released |
|
1227 |
||
1228 |
A MultiMediaCard error code. |
|
1229 |
||
1230 |
Indicates a general 'not found' type error. |
|
1231 |
||
1232 |
@see TMMCErr |
|
1233 |
*/ |
|
1234 |
const TUint32 KMMCErrNotFound= KBit23; |
|
1235 |
||
1236 |
||
1237 |
/** |
|
1238 |
@publishedPartner |
|
1239 |
@released |
|
1240 |
||
1241 |
An MultiMediaCard error code: |
|
1242 |
||
1243 |
Indicates a general already 'exists type' error. |
|
1244 |
||
1245 |
@see TMMCErr |
|
1246 |
*/ |
|
1247 |
const TUint32 KMMCErrAlreadyExists= KBit24; |
|
1248 |
||
1249 |
||
1250 |
/** |
|
1251 |
@publishedPartner |
|
1252 |
@released |
|
1253 |
||
1254 |
An MultiMediaCard error code: |
|
1255 |
||
1256 |
Indicates an unspecified error. |
|
1257 |
||
1258 |
@see TMMCErr |
|
1259 |
*/ |
|
1260 |
const TUint32 KMMCErrGeneral= KBit25; |
|
1261 |
||
1262 |
||
1263 |
/** |
|
1264 |
@publishedPartner |
|
1265 |
@released |
|
1266 |
||
1267 |
A bitmask of all MultiMediaCard error codes. |
|
1268 |
*/ |
|
1269 |
const TUint32 KMMCErrAll = (KBit26 - KBit0); |
|
1270 |
||
1271 |
/** |
|
1272 |
@publishedPartner |
|
1273 |
@released |
|
1274 |
||
1275 |
A subset of MultiMediaCard error codes. |
|
1276 |
*/ |
|
1277 |
const TUint32 KMMCErrBasic = (KMMCErrAll & ~( |
|
1278 |
KMMCErrBypass | |
|
1279 |
KMMCErrUpdPswd | |
|
1280 |
KMMCErrInitContext | |
|
1281 |
KMMCErrArgument | |
|
1282 |
KMMCErrSingleBlock | |
|
1283 |
KMMCErrLocked | |
|
1284 |
KMMCErrNotFound | |
|
1285 |
KMMCErrAlreadyExists| |
|
1286 |
KMMCErrGeneral)); |
|
1287 |
||
1288 |
// DMMC Stack and Session control bits |
|
1289 |
||
1290 |
// Stack State bits |
|
1291 |
const TUint32 KMMCStackStateRunning= KBit0; // Stack scheduler active |
|
1292 |
const TUint32 KMMCStackStateWaitingToLock= KBit1; // |
|
1293 |
const TUint32 KMMCStackStateLocked= KBit2; // |
|
1294 |
const TUint32 KMMCStackStateWaitingDFC= KBit3; |
|
1295 |
const TUint32 KMMCStackStateInitInProgress= KBit4; |
|
1296 |
const TUint32 KMMCStackStateReScheduled= KBit5; |
|
1297 |
const TUint32 KMMCStackStateJobChooser= KBit6; |
|
1298 |
const TUint32 KMMCStackStateDoDeselect= KBit7; |
|
1299 |
const TUint32 KMMCStackStateBusInconsistent=KBit8; |
|
1300 |
const TUint32 KMMCStackStateInitPending= KBit9; |
|
1301 |
const TUint32 KMMCStackStateCardRemoved= KBit10; |
|
1302 |
const TUint32 KMMCStackStateSleepinProgress=KBit11; |
|
1303 |
const TUint32 KMMCStackStateSleep= KBit12; |
|
1304 |
const TUint32 KMMCStackStateYielding= KBit13; |
|
1305 |
||
1306 |
// Session Blocking bits definition |
|
1307 |
||
1308 |
/** |
|
1309 |
@publishedPartner |
|
1310 |
@released |
|
1311 |
||
1312 |
A bit, which when set in a call to DMMCStack::BlockCurrentSession(), indicates |
|
1313 |
that the current session is to be blocked, awaiting an event that is to |
|
1314 |
be handled at the platform specific level. |
|
1315 |
||
1316 |
For example, the session may be waiting for: |
|
1317 |
||
1318 |
- a response following a command |
|
1319 |
- an interrupt indicating that data transfer is required |
|
1320 |
- a platform specific layer specific timer. |
|
1321 |
||
1322 |
@see DMMCStack::BlockCurrentSession() |
|
1323 |
*/ |
|
1324 |
const TUint32 KMMCBlockOnASSPFunction= KBit0; |
|
1325 |
||
1326 |
const TUint32 KMMCBlockOnPollTimer = KBit1; |
|
1327 |
const TUint32 KMMCBlockOnRetryTimer = KBit2; |
|
1328 |
const TUint32 KMMCBlockOnNoRun = KBit3; |
|
1329 |
const TUint32 KMMCBlockOnDoor = KBit4; |
|
1330 |
const TUint32 KMMCBlockOnWaitToLock = KBit5; |
|
1331 |
const TUint32 KMMCBlockOnCardInUse = KBit6; |
|
1332 |
const TUint32 KMMCBlockOnPgmTimer = KBit7; |
|
1333 |
const TUint32 KMMCBlockOnInterrupt = KBit8; |
|
1334 |
const TUint32 KMMCBlockOnDataTransfer = KBit9; |
|
1335 |
const TUint32 KMMCBlockOnMoreData = KBit10; |
|
1336 |
const TUint32 KMMCBlockOnYielding = KBit11; // Yielding to other commands |
|
1337 |
||
1338 |
const TUint32 KMMCBlockOnAsynchMask = KMMCBlockOnASSPFunction | |
|
1339 |
KMMCBlockOnPollTimer | |
|
1340 |
KMMCBlockOnRetryTimer | |
|
1341 |
KMMCBlockOnPgmTimer | |
|
1342 |
KMMCBlockOnInterrupt | |
|
1343 |
KMMCBlockOnDataTransfer | |
|
1344 |
KMMCBlockOnMoreData; |
|
1345 |
||
1346 |
const TUint32 KMMCBlockOnGapTimersMask = KMMCBlockOnPollTimer | |
|
1347 |
KMMCBlockOnRetryTimer | |
|
1348 |
KMMCBlockOnPgmTimer; |
|
1349 |
||
1350 |
// Session State bits definition |
|
1351 |
const TUint32 KMMCSessStateEngaged = KBit0; // Processed by DMMCStack |
|
1352 |
const TUint32 KMMCSessStateInProgress = KBit1; // No longer safe to restart |
|
1353 |
const TUint32 KMMCSessStateCritical = KBit2; // Re-initialise the stack if aborted |
|
1354 |
const TUint32 KMMCSessStateSafeInGaps = KBit3; |
|
1355 |
const TUint32 KMMCSessStateDoReSchedule= KBit4; |
|
1356 |
||
1357 |
/** |
|
1358 |
@publishedPartner |
|
1359 |
@released |
|
1360 |
||
1361 |
A bit that when set into DMMCSession::iState before calling |
|
1362 |
DMMCStack::UnBlockCurrentSession(), causes a DFC to be queued in order |
|
1363 |
to resume the state machine at some later stage. |
|
1364 |
*/ |
|
1365 |
const TUint32 KMMCSessStateDoDFC = KBit5; |
|
1366 |
const TUint32 KMMCSessStateBlockOnDoor = KBit6; |
|
1367 |
const TUint32 KMMCSessStateCardIsGone = KBit7; |
|
1368 |
const TUint32 KMMCSessStateASSPEngaged = KBit8; |
|
1369 |
const TUint32 KMMCSessStateAllowDirectCommands = KBit9; // Allow Direct Commands (Using CMD) during Data Transfer |
|
1370 |
||
1371 |
class TCID |
|
1372 |
/** |
|
1373 |
CID class |
|
1374 |
||
1375 |
@publishedPartner |
|
1376 |
@released |
|
1377 |
*/ |
|
1378 |
{ |
|
1379 |
public: |
|
1380 |
inline TCID() {} // Default constructor |
|
1381 |
inline TCID(const TUint8*); |
|
1382 |
inline TCID& operator=(const TCID&); |
|
1383 |
inline TCID& operator=(const TUint8*); |
|
1384 |
inline TBool operator==(const TCID&) const; |
|
1385 |
inline TBool operator==(const TUint8*) const; |
|
1386 |
inline void Copy(TUint8*) const; // Copies big endian 16 bytes CID |
|
1387 |
inline TUint8 At(TUint anIndex) const; // Byte from CID at anIndex |
|
1388 |
private: |
|
1389 |
TUint8 iData[KMMCCIDLength]; // Big endian 128 bit bitfield representing CID |
|
1390 |
}; |
|
1391 |
||
1392 |
||
1393 |
class TCSD |
|
1394 |
/** |
|
1395 |
CSD class |
|
1396 |
||
1397 |
@publishedPartner |
|
1398 |
@released |
|
1399 |
*/ |
|
1400 |
{ |
|
1401 |
public: |
|
1402 |
inline TCSD() {memclr(this, sizeof(*this));} // Default constructor |
|
1403 |
inline TCSD(const TUint8*); |
|
1404 |
inline TCSD& operator=(const TCSD&); |
|
1405 |
inline TCSD& operator=(const TUint8*); |
|
1406 |
inline void Copy(TUint8*) const; // Copies big endian 16 bytes CSD |
|
1407 |
inline TUint8 At(TUint anIndex) const; // Byte from CSD at anIndex |
|
1408 |
public: |
|
1409 |
inline TUint CSDStructure() const; |
|
1410 |
inline TUint SpecVers() const; |
|
1411 |
inline TUint Reserved120() const; |
|
1412 |
inline TUint TAAC() const; |
|
1413 |
inline TUint NSAC() const; |
|
1414 |
inline TUint TranSpeed() const; |
|
1415 |
inline TUint CCC() const; |
|
1416 |
inline TUint ReadBlLen() const; |
|
1417 |
inline TBool ReadBlPartial() const; |
|
1418 |
inline TBool WriteBlkMisalign() const; |
|
1419 |
inline TBool ReadBlkMisalign() const; |
|
1420 |
inline TBool DSRImp() const; |
|
1421 |
inline TUint Reserved74() const; |
|
1422 |
inline TUint CSize() const; |
|
1423 |
inline TUint VDDRCurrMin() const; |
|
1424 |
inline TUint VDDRCurrMax() const; |
|
1425 |
inline TUint VDDWCurrMin() const; |
|
1426 |
inline TUint VDDWCurrMax() const; |
|
1427 |
inline TUint CSizeMult() const; |
|
1428 |
inline TUint EraseGrpSize() const; |
|
1429 |
inline TUint EraseGrpMult() const; |
|
1430 |
inline TUint WPGrpSize() const; |
|
1431 |
inline TBool WPGrpEnable() const; |
|
1432 |
inline TUint DefaultECC() const; |
|
1433 |
inline TUint R2WFactor() const; |
|
1434 |
inline TUint WriteBlLen() const; |
|
1435 |
inline TBool WriteBlPartial() const; |
|
1436 |
inline TUint Reserved16() const; |
|
1437 |
inline TBool FileFormatGrp() const; |
|
1438 |
inline TBool Copy() const; |
|
1439 |
inline TBool PermWriteProtect() const; |
|
1440 |
inline TBool TmpWriteProtect() const; |
|
1441 |
inline TUint FileFormat() const; |
|
1442 |
inline TUint ECC() const; |
|
1443 |
inline TUint CRC() const; |
|
1444 |
public: |
|
1445 |
IMPORT_C TUint DeviceSize() const; // Uses functions above to calculate device capacity |
|
1446 |
IMPORT_C TMMCMediaTypeEnum MediaType() const; |
|
1447 |
IMPORT_C TUint ReadBlockLength() const; // Read Block Length in bytes |
|
1448 |
IMPORT_C TUint WriteBlockLength() const;// Write Block Length in bytes |
|
1449 |
IMPORT_C TUint EraseSectorSize() const; // Erase sector size (default 512 bytes) |
|
1450 |
IMPORT_C TUint EraseGroupSize() const; // Erase group size (default 16*<sector size> bytes) |
|
1451 |
IMPORT_C TUint MinReadCurrentInMilliamps() const; |
|
1452 |
IMPORT_C TUint MinWriteCurrentInMilliamps() const; |
|
1453 |
IMPORT_C TUint MaxReadCurrentInMilliamps() const; |
|
1454 |
IMPORT_C TUint MaxWriteCurrentInMilliamps() const; |
|
1455 |
IMPORT_C TUint MaxTranSpeedInKilohertz() const; |
|
1456 |
public: |
|
1457 |
IMPORT_C TUint CSDField(const TUint& aTopBit, const TUint& aBottomBit) const; /**< @internalComponent */ |
|
1458 |
TUint8 iData[KMMCCSDLength]; /**< @internalComponent */ // Big endian 128 bit bitfield representing CSD |
|
1459 |
}; |
|
1460 |
||
1461 |
||
1462 |
class TExtendedCSD |
|
1463 |
/** |
|
1464 |
Extended CSD register class. |
|
1465 |
For more information about this register, see the MultimediaCard System |
|
1466 |
Specification, Version 4.1+ |
|
1467 |
||
1468 |
@publishedPartner |
|
1469 |
@released |
|
1470 |
*/ |
|
1471 |
{ |
|
1472 |
public: |
|
1473 |
/** |
|
1474 |
An enum used by TExtendedCSD::GetWriteArg() to construct a TMMCArgument object. |
|
1475 |
The value chosen defines how the register or command set is to be modified. |
|
1476 |
*/ |
|
1477 |
enum TExtCSDAccessBits |
|
1478 |
{ |
|
1479 |
/** Change the card's command set */ |
|
1480 |
ECmdSet, |
|
1481 |
/** Set the specified bits */ |
|
1482 |
ESetBits, |
|
1483 |
/** Clear the specified bits */ |
|
1484 |
EClearBits, |
|
1485 |
/** Write the specified byte */ |
|
1486 |
EWriteByte |
|
1487 |
}; |
|
1488 |
/** |
|
1489 |
This enum defines various field offsets into the Modes Segment (i.e. |
|
1490 |
the writable part) of the Extended CSD register. |
|
1491 |
*/ |
|
1492 |
enum TExtCSDModesFieldIndex |
|
1493 |
{ |
|
1494 |
/** Offset of the CMD_SET field */ |
|
1495 |
ECmdSetIndex = 191, |
|
1496 |
/** Offset of the CMD_SET_REV field */ |
|
1497 |
ECmdSetRevIndex = 189, |
|
1498 |
/** Offset of the POWER_CLASS field */ |
|
1499 |
EPowerClassIndex = 187, |
|
1500 |
/** Offset of the HS_TIMING field */ |
|
1501 |
EHighSpeedInterfaceTimingIndex = 185, |
|
1502 |
/** Offset of the BUS_WIDTH field */ |
|
1503 |
EBusWidthModeIndex = 183, |
|
1504 |
/** Offset of the BOOT_CONFIG field */ |
|
1505 |
EBootConfigIndex = 179, |
|
1506 |
/** Offset of the BOOT_BUS_WIDTH field */ |
|
1507 |
EBootBusWidthIndex = 177, |
|
1508 |
/** Offset of the ERASE_GROUP_DEF field */ |
|
1509 |
EEraseGroupDefIndex = 175 |
|
1510 |
}; |
|
1511 |
||
1512 |
/** |
|
1513 |
This enum defines various field offsets into the Properties Segment (i.e. |
|
1514 |
the read-only part) of the Extended CSD register. |
|
1515 |
*/ |
|
1516 |
enum TExtCSDPropertiesFieldIndex |
|
1517 |
{ |
|
1518 |
/** Offset of the EXT_CSD_REV field */ |
|
1519 |
EExtendedCSDRevIndex = 192, |
|
1520 |
/** Offset of the CARD_TYPE field */ |
|
1521 |
ECardTypeIndex = 196, |
|
1522 |
/** Offset of the ACC_SIZE field */ |
|
1523 |
EAccessSizeIndex = 225, |
|
1524 |
/** Offset of the HC_ERASE_GRP_SIZE field */ |
|
1525 |
EHighCapacityEraseGroupSizeIndex = 224 |
|
1526 |
}; |
|
1527 |
||
1528 |
/** This enum defines the bus width encoding used by the BUS_WIDTH field */ |
|
1529 |
enum TExtCSDBusWidths |
|
1530 |
{ |
|
1531 |
EExtCsdBusWidth1 = 0x00, |
|
1532 |
EExtCsdBusWidth4 = 0x01, |
|
1533 |
EExtCsdBusWidth8 = 0x02 |
|
1534 |
}; |
|
1535 |
||
1536 |
/** |
|
1537 |
This enum defines the different MMCV4.x card types available as defined |
|
1538 |
in the CARD_TYPE field |
|
1539 |
*/ |
|
1540 |
enum TCardTypes |
|
1541 |
{ |
|
1542 |
EHighSpeedCard26Mhz = 0x01, |
|
26
c734af59ce98
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1543 |
EHighSpeedCard52Mhz = 0x02, |
c734af59ce98
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1544 |
ECardTypeMsk = 0x03 |
0 | 1545 |
}; |
1546 |
||
1547 |
/** |
|
1548 |
This enum defines the boot config encoding used by the BOOT_CONFIG field |
|
1549 |
*/ |
|
1550 |
enum TExtCSDBootConfig |
|
1551 |
{ |
|
1552 |
ESelectUserArea = 0x00, |
|
1553 |
ESelectBootPartition1 = 0x01, |
|
1554 |
ESelectBootPartition2 = 0x02, |
|
1555 |
EEnableBootPartition1forBoot = 0x08, |
|
1556 |
EEnableBootPartition2forBoot = 0x10, |
|
1557 |
EEnableUserAreaforBoot = 0x38, |
|
1558 |
EEnableBootAck = 0x40 |
|
1559 |
}; |
|
1560 |
||
1561 |
/** |
|
1562 |
This enum defines the Boot Bus Width encoding used by the BOOT_BUS_WIDTH field |
|
1563 |
*/ |
|
1564 |
enum TExtCSDBootBusWidth |
|
1565 |
{ |
|
1566 |
EBootBusWidth1Bit = 0x00, |
|
1567 |
EBootBusWidth4Bit = 0x01, |
|
1568 |
EBootBusWidth8Bit = 0x02, |
|
1569 |
EResetBusWidthafterBoot = 0x08 |
|
1570 |
}; |
|
1571 |
||
1572 |
/** |
|
1573 |
This enum defines the Erase Group Definition encoding |
|
1574 |
used by the ERASE_GROUP_DEF field |
|
1575 |
*/ |
|
1576 |
enum TExtCSDEraseGroupDef |
|
1577 |
{ |
|
1578 |
||
1579 |
EEraseGrpDefEnableOldSizes = 0x00, |
|
1580 |
EEraseGrpDefEnableHighCapSizes = 0x01 |
|
1581 |
}; |
|
1582 |
||
1583 |
public: |
|
1584 |
/** Default constructor */ |
|
1585 |
inline TExtendedCSD(); |
|
1586 |
/** |
|
1587 |
Constructor |
|
1588 |
@param aPtr a byte buffer containing the contents of the register |
|
1589 |
*/ |
|
1590 |
inline TExtendedCSD(const TUint8* aPtr); |
|
1591 |
/** |
|
1592 |
Copy constructor |
|
1593 |
@param aCSD a reference to another instance of the same class |
|
1594 |
*/ |
|
1595 |
inline TExtendedCSD& operator=(const TExtendedCSD& aCSD); |
|
1596 |
/** |
|
1597 |
Copy constructor |
|
1598 |
@param aPtr a byte buffer containing the contents of the register |
|
1599 |
*/ |
|
1600 |
inline TExtendedCSD& operator=(const TUint8* aPtr); |
|
1601 |
||
1602 |
/** Returns the byte at a particular offset into the register |
|
1603 |
@param anIndex the offset into the register |
|
1604 |
*/ |
|
1605 |
inline TUint8 At(TUint anIndex) const; |
|
1606 |
||
1607 |
/** returns a pointer to the raw data */ |
|
1608 |
inline TUint8* Ptr(); |
|
1609 |
||
1610 |
/** |
|
1611 |
Constructs and then returns a TMMCArgument which can be used to |
|
1612 |
write to the register using the SWITCH command (CMD6) |
|
1613 |
@param aAccess specifies how the register or command set is to be modified. |
|
1614 |
@param aIndex the offset into the register |
|
1615 |
@param aValue the value to write to the field in the register |
|
1616 |
@param aCmdSet The command set to write. Valid if aAccess = ECmdSet |
|
1617 |
*/ |
|
1618 |
inline static TMMCArgument GetWriteArg(TExtCSDAccessBits aAccess, TExtCSDModesFieldIndex aIndex, TUint aValue, TUint aCmdSet); |
|
1619 |
||
1620 |
/** returns the contents of the CMD_SET field */ |
|
1621 |
inline TUint SupportedCmdSet() const; |
|
1622 |
||
1623 |
/** returns the contents of the SEC_COUNT field */ |
|
1624 |
inline TUint SectorCount() const; |
|
1625 |
||
1626 |
/** returns the contents of the MIN_PERF_W_8_52 field */ |
|
1627 |
inline TUint MinPerfWrite8Bit52Mhz() const; |
|
1628 |
||
1629 |
/** returns the contents of the MIN_PERF_R_8_52 field */ |
|
1630 |
inline TUint MinPerfRead8Bit52Mhz() const; |
|
1631 |
||
1632 |
/** returns the contents of the MIN_PERF_W_8_26_4_52 field */ |
|
1633 |
inline TUint MinPerfWrite8Bit26Mhz_4Bit52Mhz() const; |
|
1634 |
||
1635 |
/** returns the contents of the MIN_PERF_R_8_26_4_52 field */ |
|
1636 |
inline TUint MinPerfRead8Bit26Mhz_4Bit52Mhz() const; |
|
1637 |
||
1638 |
/** returns the contents of the MIN_PERF_W_4_26 field */ |
|
1639 |
inline TUint MinPerfWrite4Bit26Mhz() const; |
|
1640 |
||
1641 |
/** returns the contents of the MIN_PERF_R_4_26 field */ |
|
1642 |
inline TUint MinPerfRead4Bit26Mhz() const; |
|
1643 |
||
1644 |
/** returns the contents of the PWR_CL_26_360 field */ |
|
1645 |
inline TUint PowerClass26Mhz360V() const; |
|
1646 |
||
1647 |
/** returns the contents of the PWR_CL_52_360 field */ |
|
1648 |
inline TUint PowerClass52Mhz360V() const; |
|
1649 |
||
1650 |
/** returns the contents of the PWR_CL_26_195 field */ |
|
1651 |
inline TUint PowerClass26Mhz195V() const; |
|
1652 |
||
1653 |
/** returns the contents of the PWR_CL_52_195 field */ |
|
1654 |
inline TUint PowerClass52Mhz195V() const; |
|
1655 |
||
1656 |
/** returns the contents of the CARD_TYPE field */ |
|
1657 |
inline TUint CardType() const; |
|
1658 |
||
1659 |
/** returns the contents of the CSD_STRUCTURE field */ |
|
1660 |
inline TUint CSDStructureVer() const; |
|
1661 |
||
1662 |
/** returns the contents of the EXT_CSD_REV field */ |
|
1663 |
inline TUint ExtendedCSDRev() const; |
|
1664 |
||
1665 |
/** returns the contents of the CMD_SET field */ |
|
1666 |
inline TUint CmdSet() const; |
|
1667 |
||
1668 |
/** returns the contents of the CMD_SET_REV field */ |
|
1669 |
inline TUint CmdSetRev() const; |
|
1670 |
||
1671 |
/** returns the contents of the POWER_CLASS field */ |
|
1672 |
inline TUint PowerClass() const; |
|
1673 |
||
1674 |
/** returns the contents of the HS_TIMING field */ |
|
1675 |
inline TUint HighSpeedTiming() const; |
|
1676 |
||
1677 |
/** returns the contents of the BUS_WIDTH field */ |
|
1678 |
inline TUint BusWidthMode() const; |
|
1679 |
||
1680 |
/** returns the contents of the BOOT_CONFIG field */ |
|
1681 |
inline TUint BootConfig() const; |
|
1682 |
||
1683 |
/** returns the contents of the BOOT_BUS_WIDTH field */ |
|
1684 |
inline TUint BootBusWidth() const; |
|
1685 |
||
1686 |
/** returns the contents of the ERASE_GROUP_DEF field */ |
|
1687 |
inline TUint EraseGroupDef() const; |
|
1688 |
||
1689 |
/** returns the contents of the ACC_SIZE field */ |
|
1690 |
inline TUint AccessSize() const; |
|
1691 |
||
1692 |
/** returns the contents of the HC_ERASE_GRP_SIZE field */ |
|
1693 |
inline TUint HighCapacityEraseGroupSize() const; |
|
1694 |
||
1695 |
/** returns the contents of the BOOT_INFO field */ |
|
1696 |
inline TUint BootInfo() const; |
|
1697 |
||
1698 |
/** returns the contents of the BOOT_SIZE_MUTLI field */ |
|
1699 |
inline TUint BootSizeMultiple() const; |
|
1700 |
||
1701 |
/** returns the contents of the ERASE_TIMEOUT_MULT field */ |
|
1702 |
inline TUint EraseTimeoutMultiple() const; |
|
1703 |
||
1704 |
/** returns the contents of the REL_WR_SEC_C field */ |
|
1705 |
inline TUint ReliableWriteSector() const; |
|
1706 |
||
1707 |
/** returns the contents of the HC_WP_GRP_SIZE field */ |
|
1708 |
inline TUint HighCapacityWriteProtectGroupSize() const; |
|
1709 |
||
1710 |
/** returns the contents of the S_C_VCC field */ |
|
1711 |
inline TUint SleepCurrentVcc() const; |
|
1712 |
||
1713 |
/** returns the contents of the S_C_VCCQ field */ |
|
1714 |
inline TUint SleepCurrentVccQ() const; |
|
1715 |
||
1716 |
/** returns the contents of the S_A_TIMEOUT field */ |
|
1717 |
inline TUint SleepAwakeTimeout() const; |
|
26
c734af59ce98
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1718 |
|
c734af59ce98
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1719 |
/** returns True if the CARD_TYPE field conatains a valid value **/ |
c734af59ce98
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1720 |
inline TBool IsSupportedCardType() const; |
0 | 1721 |
|
1722 |
private: |
|
1723 |
/** |
|
1724 |
@internalComponent little endian 512 byte field representing extended CSD |
|
1725 |
*/ |
|
1726 |
TUint8 iData[KMMCExtendedCSDLength]; |
|
1727 |
}; |
|
1728 |
||
1729 |
||
1730 |
// 32 bit MMC card status field (response R1) |
|
1731 |
||
1732 |
const TUint32 KMMCStatAppCmd= KBit5; |
|
1733 |
const TUint32 KMMCStatSwitchError= KBit7; |
|
1734 |
const TUint32 KMMCStatReadyForData= KBit8; |
|
1735 |
const TUint32 KMMCStatCurrentStateMask= (KBit13-KBit9); |
|
1736 |
const TUint32 KMMCStatEraseReset= KBit13; |
|
1737 |
const TUint32 KMMCStatCardECCDisabled= KBit14; |
|
1738 |
const TUint32 KMMCStatWPEraseSkip= KBit15; |
|
1739 |
const TUint32 KMMCStatErrCSDOverwrite= KBit16; |
|
1740 |
const TUint32 KMMCStatErrOverrun= KBit17; |
|
1741 |
const TUint32 KMMCStatErrUnderrun= KBit18; |
|
1742 |
const TUint32 KMMCStatErrUnknown= KBit19; |
|
1743 |
const TUint32 KMMCStatErrCCError= KBit20; |
|
1744 |
const TUint32 KMMCStatErrCardECCFailed= KBit21; |
|
1745 |
const TUint32 KMMCStatErrIllegalCommand=KBit22; |
|
1746 |
const TUint32 KMMCStatErrComCRCError= KBit23; |
|
1747 |
const TUint32 KMMCStatErrLockUnlock= KBit24; |
|
1748 |
const TUint32 KMMCStatCardIsLocked= KBit25; |
|
1749 |
const TUint32 KMMCStatErrWPViolation= KBit26; |
|
1750 |
const TUint32 KMMCStatErrEraseParam= KBit27; |
|
1751 |
const TUint32 KMMCStatErrEraseSeqError= KBit28; |
|
1752 |
const TUint32 KMMCStatErrBlockLenError= KBit29; |
|
1753 |
const TUint32 KMMCStatErrAddressError= KBit30; |
|
1754 |
const TUint32 KMMCStatErrOutOfRange= KBit31; |
|
1755 |
||
1756 |
const TUint32 KMMCStatErrorMask= KMMCStatErrOutOfRange | |
|
1757 |
KMMCStatErrAddressError | |
|
1758 |
KMMCStatErrBlockLenError| |
|
1759 |
KMMCStatErrEraseSeqError| |
|
1760 |
KMMCStatErrEraseParam | |
|
1761 |
KMMCStatErrWPViolation | |
|
1762 |
KMMCStatErrLockUnlock | |
|
1763 |
KMMCStatErrCardECCFailed| |
|
1764 |
KMMCStatErrCCError | |
|
1765 |
KMMCStatErrUnknown | |
|
1766 |
KMMCStatErrUnderrun | |
|
1767 |
KMMCStatErrOverrun | |
|
1768 |
KMMCStatErrCSDOverwrite; |
|
1769 |
||
1770 |
||
1771 |
const TUint32 KMMCStatClearByReadMask= KMMCStatErrOutOfRange | |
|
1772 |
KMMCStatErrAddressError | |
|
1773 |
KMMCStatErrBlockLenError| |
|
1774 |
KMMCStatErrEraseSeqError| |
|
1775 |
KMMCStatErrEraseParam | |
|
1776 |
KMMCStatErrWPViolation | |
|
1777 |
KMMCStatErrLockUnlock | |
|
1778 |
KMMCStatErrCardECCFailed| |
|
1779 |
KMMCStatErrCCError | |
|
1780 |
KMMCStatErrUnknown | |
|
1781 |
KMMCStatErrUnderrun | |
|
1782 |
KMMCStatErrOverrun | |
|
1783 |
KMMCStatErrCSDOverwrite | |
|
1784 |
KMMCStatWPEraseSkip | |
|
1785 |
KMMCStatEraseReset | |
|
1786 |
KMMCStatAppCmd; |
|
1787 |
||
1788 |
enum TMMCardStateEnum |
|
1789 |
{ |
|
1790 |
ECardStateIdle = 0, |
|
1791 |
ECardStateReady = (1 << 9), |
|
1792 |
ECardStateIdent = (2 << 9), |
|
1793 |
ECardStateStby = (3 << 9), |
|
1794 |
ECardStateTran = (4 << 9), |
|
1795 |
ECardStateData = (5 << 9), |
|
1796 |
ECardStateRcv = (6 << 9), |
|
1797 |
ECardStatePrg = (7 << 9), |
|
1798 |
ECardStateDis = (8 << 9), |
|
1799 |
ECardStateBtst = (9 << 9), |
|
1800 |
ECardStateSlp = (10 << 9) |
|
1801 |
}; |
|
1802 |
||
1803 |
class TMMCStatus |
|
1804 |
/** |
|
1805 |
MMC Status class. |
|
1806 |
This class can be used to get the MMC card state machine and response status. |
|
1807 |
For the details of MMC card state machine and command response refer to MMC card specification. |
|
1808 |
||
1809 |
@see DMMCStack |
|
1810 |
@publishedPartner |
|
1811 |
@released |
|
1812 |
*/ |
|
1813 |
{ |
|
1814 |
public: |
|
1815 |
/** |
|
1816 |
* Default constructor. |
|
1817 |
*/ |
|
1818 |
inline TMMCStatus() {} |
|
1819 |
inline TMMCStatus(const TUint8*); |
|
1820 |
inline TMMCStatus(const TUint32&); |
|
1821 |
inline operator TUint32() const; |
|
1822 |
inline TUint32 Error() const; |
|
1823 |
inline TMMCardStateEnum State() const; |
|
1824 |
inline void UpdateState(TMMCardStateEnum aState); |
|
1825 |
private: |
|
1826 |
TUint32 iData; // 32 bit bitfield representing status register |
|
1827 |
}; |
|
1828 |
||
1829 |
||
1830 |
||
1831 |
const TUint32 KMMCOCRBusy = KBit31; // OCR Busy Bit (Response R3) |
|
1832 |
const TUint32 KMMCOCRAccessModeHCS = KBit30; // OCR Access Mode + SD HCS Bit (Response R3) |
|
1833 |
const TUint32 KMMCOCRLowVoltage = KBit7; // 1.65 - 1.95 volt support |
|
1834 |
const TUint32 KMMCOCRAccessModeMask = KBit30 | KBit29; // OCR Access Mode : [00 : Byte], [10 : Block] |
|
1835 |
||
1836 |
||
1837 |
||
1838 |
/** |
|
1839 |
Defines the bit value that can be used in TPBusPsuInfo::iVoltageSupported |
|
1840 |
to indicate that the MultiMediaCard PSU supports voltage adjustment. |
|
1841 |
||
1842 |
@publishedPartner |
|
1843 |
@released |
|
1844 |
*/ |
|
1845 |
#define KMMCAdjustableOpVoltage KMMCOCRBusy // Use same bit to flag ASSP PSU supports voltage adjustment. |
|
1846 |
||
1847 |
||
1848 |
class TMMCArgument |
|
1849 |
/** |
|
1850 |
MMC Argument class |
|
1851 |
||
1852 |
@publishedPartner |
|
1853 |
@released |
|
1854 |
*/ |
|
1855 |
{ |
|
1856 |
public: |
|
1857 |
inline TMMCArgument(); |
|
1858 |
inline TMMCArgument(const TUint32&); |
|
1859 |
inline TMMCArgument(TRCA); |
|
1860 |
inline TMMCArgument(TDSR); |
|
1861 |
inline operator TUint32() const; |
|
1862 |
inline void SetRCA(TRCA); |
|
1863 |
private: |
|
1864 |
TUint32 iData; // 32 bit bitfield representing the argument |
|
1865 |
}; |
|
1866 |
||
1867 |
||
1868 |
class TRCA |
|
1869 |
/** |
|
1870 |
MMC RCA (Relative Card Address) class |
|
1871 |
*/ |
|
1872 |
{ |
|
1873 |
public: |
|
1874 |
inline TRCA() {} |
|
1875 |
inline TRCA(TUint16); |
|
1876 |
inline TRCA(TInt); |
|
1877 |
inline TRCA(TMMCArgument); |
|
1878 |
inline operator TUint16() const; |
|
1879 |
private: |
|
1880 |
TUint16 iData; // 16 bit bitfield representing MultiMedia Card's RCA |
|
1881 |
}; |
|
1882 |
||
1883 |
||
1884 |
class TDSR |
|
1885 |
/** |
|
1886 |
MMC DSR (Driver Stage Register) class |
|
1887 |
*/ |
|
1888 |
{ |
|
1889 |
public: |
|
1890 |
inline TDSR(); |
|
1891 |
inline TDSR(TUint16); |
|
1892 |
inline operator TUint16() const; |
|
1893 |
private: |
|
1894 |
TUint16 iData; // 16 bit bitfield representing MultiMedia Card's DSR |
|
1895 |
}; |
|
1896 |
||
1897 |
||
1898 |
// Card specific information and context |
|
1899 |
||
1900 |
/** |
|
1901 |
@publishedPartner |
|
1902 |
@released |
|
1903 |
*/ |
|
1904 |
const TUint32 KMMCardHasPassword= KBit0; |
|
1905 |
||
1906 |
/** |
|
1907 |
@publishedPartner |
|
1908 |
@released |
|
1909 |
*/ |
|
1910 |
const TUint32 KMMCardIsWriteProtected= KBit1; |
|
1911 |
||
1912 |
/** |
|
1913 |
@publishedPartner |
|
1914 |
@released |
|
1915 |
*/ |
|
1916 |
const TUint32 KMMCardIsLockable= KBit2; |
|
1917 |
const TUint32 KMMCardIsHighCapacity= KBit3; |
|
1918 |
const TUint32 KMMCardIsHighSpeed= KBit4; |
|
1919 |
||
1920 |
const TUint32 KMMCardMMCFlagMask= 0x0000ffff; |
|
1921 |
||
1922 |
const TUint32 KMMCardFirstCustomFlag= KBit16; |
|
1923 |
const TUint32 KMMCardCustomFlagMask= 0xffff0000; |
|
1924 |
||
1925 |
const TUint32 KMMCardHighCapBlockSize= 512; |
|
1926 |
const TUint32 KMMCardHighCapBlockSizeLog2= 9; |
|
1927 |
||
1928 |
NONSHARABLE_CLASS(TMMCard) |
|
1929 |
/** |
|
1930 |
MMC card class |
|
1931 |
*/ |
|
1932 |
{ |
|
1933 |
public: |
|
1934 |
inline TBool IsHighCapacity() const; |
|
1935 |
||
1936 |
/** @publishedPartner |
|
1937 |
@released */ |
|
1938 |
TMMCard(); |
|
1939 |
||
1940 |
/** @publishedPartner |
|
1941 |
@released */ |
|
1942 |
inline TBool IsPresent() const; |
|
1943 |
||
1944 |
/** @publishedPartner |
|
1945 |
@released */ |
|
1946 |
IMPORT_C TBool IsReady() const; |
|
1947 |
||
1948 |
/** @publishedPartner |
|
1949 |
@released */ |
|
1950 |
IMPORT_C TBool IsLocked() const; |
|
1951 |
||
1952 |
/** @publishedPartner |
|
1953 |
@released */ |
|
1954 |
inline TMMCMediaTypeEnum MediaType() const; |
|
1955 |
||
1956 |
/** @publishedPartner |
|
1957 |
@released */ |
|
1958 |
inline TUint DeviceSize() const; |
|
1959 |
||
1960 |
/** @publishedPartner |
|
1961 |
@released */ |
|
1962 |
inline const TCID& CID() const; |
|
1963 |
||
1964 |
/** @publishedPartner |
|
1965 |
@released */ |
|
1966 |
inline const TCSD& CSD() const; |
|
1967 |
||
1968 |
/** @publishedPartner |
|
1969 |
@released */ |
|
1970 |
inline const TExtendedCSD& ExtendedCSD() const; |
|
1971 |
||
1972 |
/** @publishedPartner |
|
1973 |
@released */ |
|
1974 |
inline TRCA RCA() const; |
|
1975 |
||
1976 |
/** @publishedPartner |
|
1977 |
@released */ |
|
1978 |
inline TBool HasPassword() const; |
|
1979 |
||
1980 |
/** @publishedPartner |
|
1981 |
@released */ |
|
1982 |
inline TBool IsWriteProtected() const; // Always EFalse in MMC build |
|
1983 |
||
1984 |
/** @publishedPartner |
|
1985 |
@released */ |
|
1986 |
inline TInt BusWidth() const; |
|
1987 |
||
1988 |
/** @publishedPartner |
|
1989 |
@released */ |
|
1990 |
inline void SetBusWidth(TInt aBusWidth); |
|
1991 |
||
1992 |
/** @internalTechnology */ |
|
1993 |
inline void SetHighSpeedClock(TUint32 aHighSpeedClock); |
|
1994 |
||
1995 |
/** @internalTechnology */ |
|
1996 |
inline TUint32 HighSpeedClock() const; |
|
1997 |
||
1998 |
/** @publishedPartner |
|
1999 |
@released */ |
|
2000 |
virtual TUint32 PreferredWriteGroupLength() const; |
|
2001 |
||
2002 |
/** @publishedPartner |
|
2003 |
@released */ |
|
2004 |
virtual TInt GetFormatInfo(TLDFormatInfo& aFormatInfo) const; |
|
2005 |
||
2006 |
/** @publishedPartner |
|
2007 |
@released */ |
|
2008 |
virtual TUint32 MinEraseSectorSize() const; |
|
2009 |
||
2010 |
/** @publishedPartner |
|
2011 |
@released */ |
|
2012 |
virtual TUint32 EraseSectorSize() const; |
|
2013 |
||
2014 |
virtual TUint MaxTranSpeedInKilohertz() const; |
|
2015 |
||
2016 |
virtual TInt GetEraseInfo(TMMCEraseInfo& anEraseInfo) const; |
|
2017 |
||
2018 |
/** @publishedPartner |
|
2019 |
@released |
|
2020 |
||
2021 |
Returns the maximum block length supported by the card encoded as a logarithm. |
|
2022 |
This may be less than the READ_BL_LEN field in the CSD |
|
2023 |
register depending on the type of card and it's capacity. |
|
2024 |
*/ |
|
2025 |
virtual TInt MaxReadBlLen() const; |
|
2026 |
||
2027 |
/** @publishedPartner |
|
2028 |
@released |
|
2029 |
||
2030 |
Returns the maximum write block length supported by the card encoded as a logarithm. |
|
2031 |
This may be less than the WRITE_BL_LEN field in the CSD |
|
2032 |
register depending on the type of card and it's capacity. |
|
2033 |
*/ |
|
2034 |
virtual TInt MaxWriteBlLen() const; |
|
2035 |
||
2036 |
/** @publishedPartner |
|
2037 |
@released */ |
|
2038 |
virtual TInt64 DeviceSize64() const; |
|
2039 |
||
2040 |
private: |
|
2041 |
inline TInt Number() const; |
|
2042 |
public: |
|
2043 |
TInt iIndex; |
|
2044 |
TMMCStatus iStatus; // last card's status |
|
2045 |
TUint32 iSetBlockLen; // current block length set for the card |
|
2046 |
TMMCCommandEnum iLastCommand; // Last Command code issued for the card |
|
2047 |
TCID iCID; |
|
2048 |
TCSD iCSD; |
|
2049 |
TRCA iRCA; |
|
2050 |
DMMCSession* iUsingSessionP; // session which has this card attached |
|
2051 |
TUint32 iFlags; |
|
2052 |
TExtendedCSD iExtendedCSD; |
|
2053 |
private: |
|
2054 |
TUint32 iHighSpeedClock; |
|
2055 |
TInt iSpare[4]; |
|
2056 |
TInt iBusWidth; |
|
2057 |
friend class DMMCStack; |
|
2058 |
friend class TMMCardArray; |
|
2059 |
}; |
|
2060 |
||
2061 |
class TMMCardArray |
|
2062 |
/** |
|
2063 |
MMC card array class |
|
2064 |
*/ |
|
2065 |
{ |
|
2066 |
public: |
|
2067 |
inline TMMCardArray(DMMCStack* anOwningStack); |
|
2068 |
||
2069 |
/** @publishedPartner |
|
2070 |
@released */ |
|
2071 |
IMPORT_C virtual TInt AllocCards(); |
|
2072 |
||
2073 |
void InitNewCardScan(); |
|
2074 |
||
2075 |
/** @publishedPartner |
|
2076 |
@released */ |
|
2077 |
IMPORT_C void AddNewCard(const TUint8* aCID,TRCA* aNewRCA); |
|
2078 |
||
2079 |
inline TUint NewCardCount(); |
|
2080 |
inline TInt CardsPresent(); |
|
2081 |
inline TMMCard* NewCardP(TUint aNewCardNumber); |
|
2082 |
inline TMMCard* CardP(TUint aCardNumber); |
|
2083 |
inline TMMCard& Card(TUint aCardNumber); |
|
2084 |
inline TMMCard& NewCard(TUint aCardNumber); |
|
2085 |
TInt MergeCards(TBool aFirstPass); |
|
2086 |
void UpdateAcquisitions(TUint* aMaxClock); |
|
2087 |
||
2088 |
/** @internalTechnology */ |
|
2089 |
TInt CardIndex(const TMMCard* aCard); |
|
2090 |
||
2091 |
/** @publishedPartner |
|
2092 |
@released */ |
|
2093 |
IMPORT_C virtual void DeclareCardAsGone(TUint aCardNumber); |
|
2094 |
||
2095 |
protected: // initialized by AllocCards() |
|
2096 |
void MoveCardAndLockRCA(TMMCard& aSrc,TMMCard& aDest,TInt aDestIndex); |
|
2097 |
DMMCStack* iOwningStack; |
|
2098 |
TInt iCardsPresent; |
|
2099 |
TUint iNewCardsCount; |
|
2100 |
TMMCard* iCards[KMaxMMCardsPerStack]; |
|
2101 |
TMMCard* iNewCards[KMaxMMCardsPerStack]; |
|
2102 |
}; |
|
2103 |
||
2104 |
// MMC Command descriptor |
|
2105 |
||
2106 |
const TUint32 KMMCCmdFlagBytesValid= KBit0; // iBytesDone has a valid data |
|
2107 |
const TUint32 KMMCCmdFlagTransStopped= KBit1; // CMD12 has been successfully issued |
|
2108 |
const TUint32 KMMCCmdFlagStatusReceived=KBit2; // Raised by ASSP layer, cleared by ExecCommandSM() |
|
2109 |
const TUint32 KMMCCmdFlagExecTopBusy= KBit3; // ExecCommandSM() flag |
|
2110 |
const TUint32 KMMCCmdFlagExecSelBusy= KBit4; // ExecCommandSM() flag |
|
2111 |
const TUint32 KMMCCmdFlagBlockAddress= KBit5; // Block addressing mode |
|
2112 |
const TUint32 KMMCCmdFlagDMARamValid= KBit6; // Memory is DMA'able flag |
|
2113 |
const TUint32 KMMCCmdFlagDoubleBuffer= KBit7; // The current DT command is double-buffered |
|
2114 |
const TUint32 KMMCCmdFlagPhysAddr= KBit8; // Address is a physical address |
|
2115 |
const TUint32 KMMCCmdFlagReliableWrite= KBit9; // Current command is Reliable Write |
|
2116 |
||
2117 |
const TUint32 KMMCCmdFlagASSPFlags= KMMCCmdFlagBytesValid | |
|
2118 |
KMMCCmdFlagTransStopped | |
|
2119 |
KMMCCmdFlagStatusReceived; |
|
2120 |
||
2121 |
||
2122 |
||
2123 |
||
2124 |
/** |
|
2125 |
The MultiMediaCard command specification. |
|
2126 |
||
2127 |
@publishedPartner |
|
2128 |
@released |
|
2129 |
*/ |
|
2130 |
class TMMCCommandSpec |
|
2131 |
{ |
|
2132 |
public: |
|
2133 |
/** |
|
2134 |
The command class as defined by the MultiMediaCard System Specification. |
|
2135 |
*/ |
|
2136 |
TUint32 iCommandClass; |
|
2137 |
||
2138 |
/** |
|
2139 |
The command type as defined by the MultiMediaCard System Specification. |
|
2140 |
*/ |
|
2141 |
TMMCCommandTypeEnum iCommandType; |
|
2142 |
||
2143 |
/** |
|
2144 |
The data transfer direction. |
|
2145 |
*/ |
|
2146 |
TMMCCmdDirEnum iDirection; |
|
2147 |
||
2148 |
/** |
|
2149 |
ETrue indicates more than one data block is to be tranferred. |
|
2150 |
*/ |
|
2151 |
TBool iMultipleBlocks; |
|
2152 |
||
2153 |
/** |
|
2154 |
ETrue indicates use standard stop transmission mode. |
|
2155 |
*/ |
|
2156 |
TBool iUseStopTransmission; // CMD12 has to be used in the end |
|
2157 |
||
2158 |
/** |
|
2159 |
The expected response type. |
|
2160 |
||
2161 |
Note: |
|
2162 |
||
2163 |
- if this is EResponseTypeNone, then no response is expected. |
|
2164 |
- if this is ERespTypeR2, then a long (128-bit) response is expected. |
|
2165 |
- for all other types, a standard (32-bit) response is expected. |
|
2166 |
*/ |
|
2167 |
TMMCResponseTypeEnum iResponseType; |
|
2168 |
||
2169 |
/** |
|
2170 |
Expected response length (currently 4 or 16 bytes). |
|
2171 |
*/ |
|
2172 |
TUint iResponseLength; |
|
2173 |
}; |
|
2174 |
||
2175 |
class TMMCIdxCommandSpec |
|
2176 |
/** |
|
2177 |
MMC Index command spec class |
|
2178 |
*/ |
|
2179 |
{ |
|
2180 |
public: |
|
2181 |
TInt iIdx; |
|
2182 |
TMMCCommandSpec iSpec; |
|
2183 |
}; |
|
2184 |
||
2185 |
||
2186 |
||
2187 |
||
2188 |
/** |
|
2189 |
MMC command description. |
|
2190 |
||
2191 |
When issuing an individual command over the bus, the MultiMediaCard |
|
2192 |
controller uses an object of this type to specify the parameters |
|
2193 |
for the command, and to receive back any response. |
|
2194 |
||
2195 |
Commands are issued by passing an object of this type to |
|
2196 |
the DMMCStack::IssueMMCCommandSM() function, which is implemented by |
|
2197 |
the platform specific layer. |
|
2198 |
||
2199 |
@publishedPartner |
|
2200 |
@released |
|
2201 |
*/ |
|
2202 |
class TMMCCommandDesc |
|
2203 |
{ |
|
2204 |
public: |
|
2205 |
IMPORT_C TInt Direction() const; // returns -1/0/+1 for read/none/write |
|
2206 |
||
2207 |
inline TBool IsBlockCmd() const; |
|
2208 |
inline TUint32 NumBlocks() const; |
|
2209 |
inline TInt64 Arg64() const; |
|
2210 |
inline TBool IsDoubleBuffered() const; |
|
2211 |
inline TUint32 BufferLength() const; |
|
2212 |
inline TUint32 BlockLength() const; |
|
2213 |
inline TBool IsPhysicalAddress() const; |
|
2214 |
TBool AdjustForBlockOrByteAccess(const DMMCSession& aSession); |
|
2215 |
||
2216 |
void Dump(TUint8* aResponseP, TMMCErr aErr); |
|
2217 |
||
2218 |
public: |
|
2219 |
/** |
|
2220 |
@internalComponent |
|
2221 |
*/ |
|
2222 |
TUint32 iFlags; |
|
2223 |
||
2224 |
/** |
|
2225 |
The command code. |
|
2226 |
||
2227 |
This can be written directly to the MMC controller hardware. |
|
2228 |
*/ |
|
2229 |
TMMCCommandEnum iCommand; |
|
2230 |
||
2231 |
/** |
|
2232 |
The argument to be supplied with the command. |
|
2233 |
||
2234 |
This can be written directly to the MMC controller hardware. |
|
2235 |
*/ |
|
2236 |
TMMCArgument iArgument; |
|
2237 |
||
2238 |
/** |
|
2239 |
The total length of the data to be tranferred. |
|
2240 |
*/ |
|
2241 |
TUint32 iTotalLength; |
|
2242 |
||
2243 |
/** |
|
2244 |
A pointer to the location from where the data is to be read, or written. |
|
2245 |
*/ |
|
2246 |
TUint8* iDataMemoryP; |
|
2247 |
||
2248 |
/** |
|
2249 |
The block length to be used in a data transaction. |
|
2250 |
*/ |
|
2251 |
TUint32 iBlockLength; |
|
2252 |
||
2253 |
/** |
|
2254 |
The MultiMediaCard command specification. |
|
2255 |
*/ |
|
2256 |
TMMCCommandSpec iSpec; |
|
2257 |
||
2258 |
/** |
|
2259 |
The number of bytes transferred since the last time the card was selected. |
|
2260 |
*/ |
|
2261 |
TUint32 iBytesDone; |
|
2262 |
||
2263 |
/** |
|
2264 |
@internalComponent |
|
2265 |
*/ |
|
2266 |
TUint iPollAttempts; // Retry counters |
|
2267 |
||
2268 |
/** |
|
2269 |
@internalComponent |
|
2270 |
*/ |
|
2271 |
TUint iTimeOutRetries; |
|
2272 |
||
2273 |
/** |
|
2274 |
@internalComponent |
|
2275 |
*/ |
|
2276 |
TUint iCRCRetries; |
|
2277 |
||
2278 |
/** |
|
2279 |
@internalComponent |
|
2280 |
*/ |
|
2281 |
TUint16 iUnlockRetries; |
|
2282 |
||
2283 |
/** |
|
2284 |
@internalComponent |
|
2285 |
*/ |
|
2286 |
TUint16 iOpCondBusyTimeout; // Units of 10mS |
|
2287 |
||
2288 |
/** |
|
2289 |
@internalComponent |
|
2290 |
*/ |
|
2291 |
TUint iCustomRetries; |
|
2292 |
||
2293 |
/** |
|
2294 |
@internalComponent |
|
2295 |
*/ |
|
2296 |
TUint32 iExecNotHandle; // error codes to not handle in ExecCommandSM() |
|
2297 |
||
2298 |
/** |
|
2299 |
The area into which the command response is put. |
|
2300 |
||
2301 |
This is in big-endian format. |
|
2302 |
*/ |
|
2303 |
TUint8 iResponse[KMMCMaxResponseLength]; |
|
2304 |
}; |
|
2305 |
||
2306 |
||
2307 |
||
2308 |
||
2309 |
/** |
|
2310 |
MMC bus configuration. |
|
2311 |
||
2312 |
An object of this type is passed to the Variant implementation |
|
2313 |
of DMMCStack::SetBusConfigDefaults(), which should fill the public data |
|
2314 |
members with appropriate information and values. |
|
2315 |
||
2316 |
@publishedPartner |
|
2317 |
@released |
|
2318 |
*/ |
|
2319 |
class TMMCBusConfig |
|
2320 |
{ |
|
2321 |
public: |
|
2322 |
/** |
|
2323 |
The hardware interface clock, in KHz. |
|
2324 |
*/ |
|
2325 |
TUint iBusClock; |
|
2326 |
||
2327 |
||
2328 |
/** |
|
2329 |
The bus clock when clocking in data, in KHz. |
|
2330 |
*/ |
|
2331 |
TUint iClockIn; |
|
2332 |
||
2333 |
||
2334 |
/** |
|
2335 |
The bus clock when clocking out data, in KHz. |
|
2336 |
*/ |
|
2337 |
TUint iClockOut; |
|
2338 |
||
2339 |
||
2340 |
/** |
|
2341 |
The response timeout value, in uS. |
|
2342 |
*/ |
|
2343 |
TUint iResponseTimeOut; |
|
2344 |
||
2345 |
||
2346 |
/** |
|
2347 |
The data timeout value, in uS. |
|
2348 |
*/ |
|
2349 |
TUint iDataTimeOut; |
|
2350 |
||
2351 |
||
2352 |
/** |
|
2353 |
The busy timeout value, in uS. |
|
2354 |
*/ |
|
2355 |
TUint iBusyTimeOut; |
|
2356 |
}; |
|
2357 |
||
2358 |
||
2359 |
class TMMCStackConfig |
|
2360 |
/** |
|
2361 |
@publishedPartner |
|
2362 |
@released |
|
2363 |
||
2364 |
Holds the stack configuration settings on behalf of a session. |
|
2365 |
||
2366 |
Each DMMCSession object contains the public member DMMCSession::iConfig - an instance of the TMMCStackConfig class. |
|
2367 |
By changing these settings, the client can override the master (i.e. default) stack configuration settings. |
|
2368 |
||
2369 |
However, these changes only remain in effect for the period that the session remains the current session. |
|
2370 |
In this way, the client is able to change the settings employed by the Controller (e.g. bus clock, enable retries, |
|
2371 |
change time-out values, restore defaults etc) while it performs that client's request. |
|
2372 |
||
2373 |
The client would generally set-up the stack configuration it requires prior to submitting the session. |
|
2374 |
*/ |
|
2375 |
{ |
|
2376 |
public: |
|
2377 |
inline TMMCStackConfig(); |
|
2378 |
inline void SetMode(TUint32 aMask); |
|
2379 |
inline void RemoveMode(TUint32 aMask); |
|
2380 |
inline void UseDefault(TUint32 aMask); |
|
2381 |
inline void SetPollAttempts(TUint aData); |
|
2382 |
inline void SetTimeOutRetries(TUint aData); |
|
2383 |
inline void SetCRCRetries(TUint aData); |
|
2384 |
inline void SetBusClockInKhz(TUint aParam); // In kilohertz |
|
2385 |
inline void SetTicksClockIn(TUint aParam); // Number of clock ticks in ClockIn phase |
|
2386 |
inline void SetTicksClockOut(TUint aParam); // Number of clock ticks in ClockOut phase |
|
2387 |
inline void SetResponseTimeOutInTicks(TUint aParam); // Timeout in bus clock ticks |
|
2388 |
inline void SetDataTimeOutInMcs(TUint aParam); // in microseconds |
|
2389 |
inline void SetBusyTimeOutInMcs(TUint aParam); // in microseconds |
|
2390 |
inline void SetOpCondBusyTimeout(TUint16 aData); // Units of 10mS |
|
2391 |
inline TInt OpCondBusyTimeout(); |
|
2392 |
TUint iPollAttempts; |
|
2393 |
private: |
|
2394 |
TUint32 iModes; |
|
2395 |
TUint32 iUpdateMask; |
|
2396 |
TUint32 iClientMask; |
|
2397 |
TUint iTimeOutRetries; |
|
2398 |
TUint iCRCRetries; |
|
2399 |
TUint16 iUnlockRetries; |
|
2400 |
TUint16 iOpCondBusyTimeout; // Units of 10mS |
|
2401 |
TMMCBusConfig iBusConfig; |
|
2402 |
friend class DMMCStack; |
|
2403 |
}; |
|
2404 |
||
2405 |
||
2406 |
class TMMCRCAPool |
|
2407 |
/** |
|
2408 |
MMC RCA Pool |
|
2409 |
*/ |
|
2410 |
{ |
|
2411 |
public: |
|
2412 |
inline TMMCRCAPool(); |
|
2413 |
TRCA GetFreeRCA(); |
|
2414 |
inline void LockRCA(TRCA); |
|
2415 |
inline void UnlockRCA(TRCA); |
|
2416 |
inline void ReleaseUnlocked(); |
|
2417 |
private: |
|
2418 |
TUint32 iPool; |
|
2419 |
TUint32 iLocked; |
|
2420 |
}; |
|
2421 |
||
2422 |
||
2423 |
class TMMCSessRing |
|
2424 |
/** |
|
2425 |
MMC session ring |
|
2426 |
*/ |
|
2427 |
{ |
|
2428 |
public: |
|
2429 |
TMMCSessRing(); |
|
2430 |
inline TBool IsEmpty() const; |
|
2431 |
void Erase(); |
|
2432 |
inline void SetMarker(); // Sets Marker into Point position |
|
2433 |
inline void AdvanceMarker(); // Moves Marker one position forward |
|
2434 |
inline void Point(); // Sets Point into Marker position |
|
2435 |
TBool Point(DMMCSession* aSessP); // Finds aSessP and sets Point to it |
|
2436 |
void Add(DMMCSession* aSessP); // Inserts aSessP before the Marker; Point moves to Marker |
|
2437 |
void Add(TMMCSessRing& aRing); |
|
2438 |
DMMCSession* Remove(); // Removes at Point; Point moves forward |
|
2439 |
void Remove(DMMCSession* aSessP); // Points aSessP first, then remove() |
|
2440 |
inline TUint Size() const; |
|
2441 |
inline operator DMMCSession*() const; |
|
2442 |
DMMCSession* operator++(TInt); // returns Point and moves it forward; stops at Marker |
|
2443 |
private: |
|
2444 |
DMMCSession* iPMark; |
|
2445 |
DMMCSession* iPoint; |
|
2446 |
DMMCSession* iPrevP; |
|
2447 |
TUint iSize; |
|
2448 |
}; |
|
2449 |
||
2450 |
||
2451 |
// |
|
2452 |
// DMMCStack State Machine Functions are supported by TMMCStateMachine class |
|
2453 |
// |
|
2454 |
// The structure of state machine functions is assumed to be as follows |
|
2455 |
// |
|
2456 |
// TMMCErr DMMCStack::FunctionNameSMST( TAny* aPtr ) |
|
2457 |
// { return( STATIC_CAST(DMMCStack*,aPtr)->FunctionNameSM() ); } |
|
2458 |
// |
|
2459 |
// TMMCErr DMMCStack::FunctionNameSM() |
|
2460 |
// { |
|
2461 |
// enum states {EStBegin=0, ..., EStEnd }; |
|
2462 |
// DMMCSession& s = Session(); |
|
2463 |
// TMMCStateMachine& m = Machine(); |
|
2464 |
// const TMMCErr err = m.SetExitCode( 0 ); |
|
2465 |
// |
|
2466 |
// for(;;) |
|
2467 |
// { |
|
2468 |
// switch(m.State()) |
|
2469 |
// { |
|
2470 |
// case EStBegin: |
|
2471 |
// { |
|
2472 |
// .... |
|
2473 |
// } |
|
2474 |
// case EStNext: |
|
2475 |
// { |
|
2476 |
// ..... |
|
2477 |
// } |
|
2478 |
// case EStEnd: break; |
|
2479 |
// default: Panic(...); |
|
2480 |
// } |
|
2481 |
// break; |
|
2482 |
// } |
|
2483 |
// return(m.Pop()); |
|
2484 |
// } |
|
2485 |
// |
|
2486 |
// State Machine remembers the next state number and function name and goes there as soon |
|
2487 |
// as the control is returned to the session. To release the control and wait for the next |
|
2488 |
// re-entrance (which will happen immediately if the session is not blocked or, as soon as |
|
2489 |
// an asynchronous event removes the blocking condition), a state machine function has to |
|
2490 |
// return( 0 ); Returning non-zero exit code will result in the session being completed with |
|
2491 |
// that error code unless a caller state machine function has explicitly intercepted such |
|
2492 |
// an error with m.SetTraps( TMMCErr aMask ). |
|
2493 |
// |
|
2494 |
// To make a state machine function code more readable, the following macros are provided: |
|
2495 |
// |
|
2496 |
// SMF_NEXTS(nexts) - set the next state to "nexts" |
|
2497 |
// SMF_CALL(func) - invoke SM function "func", then go to the next state |
|
2498 |
// SMF_CALLWAIT(func) - the same as above, but sleep at the entry point |
|
2499 |
// SMF_CALLMYS(nexts,retst) - invoke current SM function at "nexts" entry point |
|
2500 |
// SMF_CALLMEWR(retst) - invoke me right here with return state retst |
|
2501 |
// SMF_INVOKES(func,nexts) - invoke SM function "func", then go to the state "nexts" |
|
2502 |
// SMF_INVOKEWAITS(func,nexts) - the same as above, but sleep at the entry point |
|
2503 |
// SMF_WAIT - sleep at the next state |
|
2504 |
// SMF_WAITS(nexts) - set next state to "nexts", then sleep |
|
2505 |
// SMF_RETURN(value) - return an error to the caller SM function |
|
2506 |
// SMF_EXIT - return to the caller SM function |
|
2507 |
// SMF_EXITWAIT - the same as above, but sleep at the exit point |
|
2508 |
// SMF_JUMP(func) - transfer the control to SM function "func" |
|
2509 |
// SMF_JUMPWAIT(func) - the same as above, but sleep at the entry point |
|
2510 |
// SMF_GOTONEXTS - goto the next state |
|
2511 |
// SMF_GOTOS(nexts) - set the next state to "nexts", then go to it |
|
2512 |
// SMF_STATE(sname) - declare the state name "sname" |
|
2513 |
// SMF_BPOINT(sname) - declare the state "sname" and sleep here if blocked statically |
|
2514 |
// |
|
2515 |
||
2516 |
/** |
|
2517 |
@publishedPartner |
|
2518 |
@released |
|
2519 |
||
2520 |
Declares the start of a state machine case switch statement. |
|
2521 |
||
2522 |
The macro assumes that the first state defined by the state machine |
|
2523 |
function is EStBegin. |
|
2524 |
||
2525 |
NOTES: |
|
2526 |
||
2527 |
- the code generates an opening curly brace that must be matched by |
|
2528 |
a closing curly brace. Typically, this is provided by the SMF_STATE or |
|
2529 |
the SMF_END macros. |
|
2530 |
||
2531 |
@see SMF_STATE |
|
2532 |
@see SMF_END |
|
2533 |
*/ |
|
2534 |
#define SMF_BEGIN TMMCStateMachine& m=Machine();const TMMCErr err=m.SetExitCode(0);\ |
|
2535 |
for(;;){switch(m.State()){case EStBegin:{if(err) (void)0; |
|
2536 |
||
2537 |
/** |
|
2538 |
@publishedPartner |
|
2539 |
@released |
|
2540 |
||
2541 |
Declares the end of a state machine case switch statement. |
|
2542 |
||
2543 |
The macro assumes that the last state defined by the state machine |
|
2544 |
function is EStEnd. |
|
2545 |
||
2546 |
NOTES: |
|
2547 |
||
2548 |
- the code generated assumes that there are earlier calls to SMF_BEGIN, |
|
2549 |
and zero or more calls to SMF_STATE. |
|
2550 |
||
2551 |
@see SMF_BEGIN |
|
2552 |
@see SMF_STATE |
|
2553 |
*/ |
|
2554 |
#define SMF_END }case EStEnd:break;default:DMMCSocket::Panic(DMMCSocket::EMMCMachineState);}break;}\ |
|
2555 |
return(m.Pop()); |
|
2556 |
||
2557 |
||
2558 |
/** |
|
2559 |
@publishedPartner |
|
2560 |
@released |
|
2561 |
||
2562 |
Sets the next state when the current state machine |
|
2563 |
function is re-entered. |
|
2564 |
||
2565 |
@param nexts The next state to be entered in the current state machine. |
|
2566 |
*/ |
|
2567 |
#define SMF_NEXTS(nexts) m.SetState(nexts); |
|
2568 |
||
2569 |
||
2570 |
/** |
|
2571 |
@publishedPartner |
|
2572 |
@released |
|
2573 |
||
2574 |
Pushes a state machine entry onto the stack, specifying the child state machine |
|
2575 |
function to be invoked. |
|
2576 |
||
2577 |
The child function will be entered at state 0 (EStBegin), when the state machine |
|
2578 |
is next dispatched. |
|
2579 |
||
2580 |
Control returns from this state machine function after completion of |
|
2581 |
all functions coded by this macro. |
|
2582 |
||
2583 |
@param func The child state machine function to be invoked. |
|
2584 |
*/ |
|
2585 |
#define SMF_CALL(func) return(m.Push(func)); |
|
2586 |
||
2587 |
||
2588 |
/** |
|
2589 |
@publishedPartner |
|
2590 |
@released |
|
2591 |
||
2592 |
Pushes a state machine entry onto the stack, specifying the child state machine |
|
2593 |
function to be invoked. |
|
2594 |
||
2595 |
The state machine is blocked before entry to the child function, but when |
|
2596 |
it becomes unblocked, the child function will be entered at state 0 (EStBegin) |
|
2597 |
when the state machine is next dispatched. |
|
2598 |
||
2599 |
Control returns from this state machine function after completion of |
|
2600 |
all functions coded by this macro. |
|
2601 |
||
2602 |
@param func The child state machine function to be invoked. |
|
2603 |
*/ |
|
2604 |
#define SMF_CALLWAIT(func) return(m.Push(func,ETrue)); |
|
2605 |
||
2606 |
||
2607 |
/** |
|
2608 |
@publishedPartner |
|
2609 |
@released |
|
2610 |
||
2611 |
Sets the next state for the current state machine function - control will |
|
2612 |
flow to this state on completion of all functions coded by this macro. |
|
2613 |
||
2614 |
The macro also pushes a state machine entry onto the stack, specifying |
|
2615 |
the CURRENT state machine function as the child state machine function to be |
|
2616 |
invoked, and sets the state in which this child state machine function will |
|
2617 |
be entered, when it gains control. |
|
2618 |
||
2619 |
NOTES: |
|
2620 |
||
2621 |
- the child function is the same as the parent function. |
|
2622 |
- the state machine is blocked on return from the current state machine function. |
|
2623 |
||
2624 |
@param nexts The state in which the child state machine function will |
|
2625 |
gain control. |
|
2626 |
@param retst The next state for the current state machine function. |
|
2627 |
*/ |
|
2628 |
#define SMF_CALLMYS(nexts,retst) {m.SetState(retst);m.PushMe();m.SetState(nexts);continue;} |
|
2629 |
||
2630 |
||
2631 |
/** |
|
2632 |
@publishedPartner |
|
2633 |
@released |
|
2634 |
||
2635 |
Sets the next state for the current state machine function - control flows to |
|
2636 |
the next instruction on completion of all functions coded by this macro. |
|
2637 |
||
2638 |
The macro also pushes a state machine entry onto the stack, specifying |
|
2639 |
the CURRENT state machine function as the child state machine function to be |
|
2640 |
invoked. The child function will be entered at state 0 (EStBegin), when the state machine |
|
2641 |
is next dispatched. |
|
2642 |
||
2643 |
NOTES: |
|
2644 |
||
2645 |
- the child function is the same as the parent function. |
|
2646 |
- the state machine is blocked on return from the current state machine function. |
|
2647 |
||
2648 |
@param retst The next state for the current state machine function. |
|
2649 |
*/ |
|
2650 |
#define SMF_CALLMEWR(retst) {m.SetState(retst);m.PushMe();} |
|
2651 |
||
2652 |
||
2653 |
/** |
|
2654 |
@publishedPartner |
|
2655 |
@released |
|
2656 |
||
2657 |
Sets the next state for the current state machine function. |
|
2658 |
||
2659 |
The macro also pushes a state machine entry onto the stack, specifying |
|
2660 |
the child state machine function to be |
|
2661 |
invoked. The child function will be entered at state 0 (EStBegin), when the state machine |
|
2662 |
is next dispatched. |
|
2663 |
||
2664 |
Control returns from the current state machine function after completion of |
|
2665 |
all functions coded by this macro. |
|
2666 |
||
2667 |
@param func The child state machine function to be invoked. |
|
2668 |
@param nexts The next state for the current state machine function. |
|
2669 |
*/ |
|
2670 |
#define SMF_INVOKES(func,nexts) {m.SetState(nexts);return(m.Push(func));} |
|
2671 |
||
2672 |
||
2673 |
/** |
|
2674 |
@publishedPartner |
|
2675 |
@released |
|
2676 |
||
2677 |
Sets the next state for the current state machine function. |
|
2678 |
||
2679 |
The macro also pushes a state machine entry onto the stack, specifying |
|
2680 |
the child state machine function to be |
|
2681 |
invoked. The child function will be entered at state 0 (EStBegin), when the state machine |
|
2682 |
is next dispatched. |
|
2683 |
||
2684 |
Control returns from the current state machine function after completion of |
|
2685 |
all functions coded by this macro. |
|
2686 |
||
2687 |
NOTES: |
|
2688 |
||
2689 |
- the state machine is blocked on return from the current state machine function. |
|
2690 |
||
2691 |
@param func The child state machine function to be invoked. |
|
2692 |
@param nexts The next state for the current state machine function. |
|
2693 |
*/ |
|
2694 |
#define SMF_INVOKEWAITS(func,nexts) {m.SetState(nexts);return(m.Push(func,ETrue));} |
|
2695 |
||
2696 |
||
2697 |
/** |
|
2698 |
@publishedPartner |
|
2699 |
@released |
|
2700 |
||
2701 |
Returns from the current state machine function, and the state machine then blocks (waits). |
|
2702 |
*/ |
|
2703 |
#define SMF_WAIT return(0); |
|
2704 |
||
2705 |
||
2706 |
/** |
|
2707 |
@publishedPartner |
|
2708 |
@released |
|
2709 |
||
2710 |
Sets the next state for the current state machine function; control then returns |
|
2711 |
from the current state machine function, and the state machine blocks (waits). |
|
2712 |
||
2713 |
@param nexts The next state for the current state machine function. |
|
2714 |
*/ |
|
2715 |
#define SMF_WAITS(nexts) return(m.SetState(nexts)); |
|
2716 |
||
2717 |
||
2718 |
/** |
|
2719 |
@publishedPartner |
|
2720 |
@released |
|
2721 |
||
2722 |
Returns the specified error value to the calling (parent) state machine function. |
|
2723 |
||
2724 |
@param value The error value to be returned. |
|
2725 |
*/ |
|
2726 |
#define SMF_RETURN(value) {m.Pop();return(value);} |
|
2727 |
||
2728 |
||
2729 |
/** |
|
2730 |
@publishedPartner |
|
2731 |
@released |
|
2732 |
||
2733 |
Returns to the calling state machine function. |
|
2734 |
*/ |
|
2735 |
#define SMF_EXIT break; |
|
2736 |
||
2737 |
||
2738 |
/** |
|
2739 |
@publishedPartner |
|
2740 |
@released |
|
2741 |
||
2742 |
Returns to the calling state machine function, and the state machine blocks (waits). |
|
2743 |
*/ |
|
2744 |
#define SMF_EXITWAIT return(m.Pop(ETrue)); |
|
2745 |
||
2746 |
||
2747 |
/** |
|
2748 |
@publishedPartner |
|
2749 |
@released |
|
2750 |
||
2751 |
Transfers control to the specified state machine function. |
|
2752 |
||
2753 |
NOTES: |
|
2754 |
||
2755 |
- this function is executed at the same stack entry level as the current state machine function. |
|
2756 |
||
2757 |
@param func The state machine function to which control is to be transferred. |
|
2758 |
*/ |
|
2759 |
#define SMF_JUMP(func) return(m.Jump(func)); |
|
2760 |
||
2761 |
||
2762 |
/** |
|
2763 |
@publishedPartner |
|
2764 |
@released |
|
2765 |
||
2766 |
Transfers control to the specified state machine function, and waits |
|
2767 |
at its entry point. |
|
2768 |
||
2769 |
@param func The state machine function to which control is to be transferred. |
|
2770 |
*/ |
|
2771 |
#define SMF_JUMPWAIT(func) return(m.Jump(func,ETrue)); |
|
2772 |
||
2773 |
||
2774 |
/** |
|
2775 |
@publishedPartner |
|
2776 |
@released |
|
2777 |
||
2778 |
Goes to the next state. |
|
2779 |
*/ |
|
2780 |
#define SMF_GOTONEXTS continue; |
|
2781 |
||
2782 |
||
2783 |
/** |
|
2784 |
@publishedPartner |
|
2785 |
@released |
|
2786 |
||
2787 |
Sets the next state and then goes to that state. |
|
2788 |
||
2789 |
@param nexts The next state. |
|
2790 |
*/ |
|
2791 |
#define SMF_GOTOS(nexts) {m.SetState(nexts);continue;} |
|
2792 |
||
2793 |
||
2794 |
/** |
|
2795 |
@publishedPartner |
|
2796 |
@released |
|
2797 |
||
2798 |
Declares the name of a state. |
|
2799 |
||
2800 |
This is used to generate a case statement based on the state name. |
|
2801 |
||
2802 |
@param sname The state name. |
|
2803 |
*/ |
|
2804 |
#define SMF_STATE(sname) }case sname:{ |
|
2805 |
||
2806 |
||
2807 |
/** |
|
2808 |
@publishedPartner |
|
2809 |
@released |
|
2810 |
||
2811 |
Declares the name of a state, and sleeps here |
|
2812 |
if blocked statically. |
|
2813 |
||
2814 |
@param sname The state name. |
|
2815 |
*/ |
|
2816 |
#define SMF_BPOINT(sname) }case sname: if(StaticBlocks()) return(m.SetState(sname));{ |
|
2817 |
||
2818 |
||
2819 |
||
2820 |
||
2821 |
class TMMCStateMachine |
|
2822 |
/** |
|
2823 |
The MultiMediaCard state machine. |
|
2824 |
||
2825 |
@publishedPartner |
|
2826 |
@released |
|
2827 |
*/ |
|
2828 |
{ |
|
2829 |
public: |
|
2830 |
inline void Setup(TMMCErr (*anEntry)(TAny*), TAny* aContextP); |
|
2831 |
IMPORT_C void Reset(); |
|
2832 |
IMPORT_C TMMCErr Dispatch(); |
|
2833 |
inline TMMCErr ExitCode(); |
|
2834 |
inline TMMCErr SetExitCode(TMMCErr aCode); |
|
2835 |
inline TUint State(); |
|
2836 |
inline TMMCErr SetState(TUint aState); |
|
2837 |
inline void SuppressSuspension(); |
|
2838 |
inline void SetTraps(TMMCErr aMask); |
|
2839 |
inline void ResetTraps(); |
|
2840 |
inline void Abort(); |
|
2841 |
inline TMMCErr Pop(TBool aSuspend=EFalse); |
|
2842 |
inline TMMCErr PushMe(); |
|
2843 |
IMPORT_C TMMCErr Push(TMMCErr (*anEntry)(TAny*), TBool aSuspend=EFalse); |
|
2844 |
IMPORT_C TMMCErr Jump(TMMCErr (*anEntry)(TAny*), TBool aSuspend=EFalse); |
|
2845 |
private: |
|
2846 |
class TMMCMachineStackEntry |
|
2847 |
{ |
|
2848 |
public: |
|
2849 |
TMMCErr (*iFunction)(TAny*); |
|
2850 |
TUint iState; |
|
2851 |
TMMCErr iTrapMask; |
|
2852 |
}; |
|
2853 |
TBool iAbort; |
|
2854 |
TBool iSuspend; |
|
2855 |
TAny* iContextP; |
|
2856 |
TMMCErr iExitCode; |
|
2857 |
TInt iSP; |
|
2858 |
TMMCMachineStackEntry iStack[KMaxMMCMachineStackDepth]; |
|
2859 |
}; |
|
2860 |
||
2861 |
class TMMCCallBack |
|
2862 |
/** |
|
2863 |
This class is used to notify the request completion as a callback function for the clients of DMMCSession. |
|
2864 |
The callback function will be called on session completion. |
|
2865 |
Callback function is used to indicate Asynchronous Completion. |
|
2866 |
||
2867 |
@see DMMCSession |
|
2868 |
@publishedPartner |
|
2869 |
@released |
|
2870 |
*/ |
|
2871 |
{ |
|
2872 |
public: |
|
2873 |
inline TMMCCallBack(); |
|
2874 |
inline TMMCCallBack(void (*aFunction)(TAny* aPtr)); |
|
2875 |
inline TMMCCallBack(void (*aFunction)(TAny* aPtr), TAny* aPtr); |
|
2876 |
inline void CallBack() const; |
|
2877 |
public: |
|
2878 |
/** |
|
2879 |
A pointer to the callback function. |
|
2880 |
*/ |
|
2881 |
void (*iFunction)(TAny* aPtr); |
|
2882 |
||
2883 |
/** |
|
2884 |
A pointer that is passed to the callback function when |
|
2885 |
the callback function is called. |
|
2886 |
*/ |
|
2887 |
TAny* iPtr; |
|
2888 |
}; |
|
2889 |
||
2890 |
// DMMCStack serves an incoming queue of session requests. |
|
2891 |
// Each queue element is represented by an instance of the following class |
|
2892 |
||
2893 |
typedef TMMCErr (*TMMCSMSTFunc)(TAny*); |
|
2894 |
||
2895 |
class DMMCSession : public DBase |
|
2896 |
/** |
|
2897 |
Provides the main interface between the client and the MMC Socket, allowing commands and responses |
|
2898 |
to be processed asynchronously on the stack. |
|
2899 |
||
2900 |
Each client creates it own instance of this class. It is then able to make MultiMediaCard requests |
|
2901 |
on the selected stack by configuring the DMMCSession object with relevant information for the request |
|
2902 |
and then submitting (or engaging) this session object. |
|
2903 |
||
2904 |
The session is used to pass commands either to the entire stack (a broadcast command), or to individual |
|
2905 |
cards in the stack. The class contains functions for initiating macro functions as laid down by the |
|
2906 |
MultiMediaCard Association (MMCA) as well as lower level functions allowing a client to control the |
|
2907 |
stack in a more explicit manner. |
|
2908 |
||
2909 |
All requests on the MultiMediaCard stack which involve bus activity are inherently asynchronous. When |
|
2910 |
creating a DMMCSession object, a client supplies a call-back function as part of the constructor. |
|
2911 |
Once a client has engaged a session on the stack, it is informed of the completion of the request by |
|
2912 |
the Controller calling this call-back function. |
|
2913 |
||
2914 |
@publishedPartner |
|
2915 |
@released |
|
2916 |
*/ |
|
2917 |
{ |
|
2918 |
public: |
|
2919 |
IMPORT_C virtual ~DMMCSession(); |
|
2920 |
IMPORT_C DMMCSession(const TMMCCallBack& aCallBack); |
|
2921 |
||
2922 |
// Object initialisation |
|
2923 |
inline void SetStack(DMMCStack* aStackP); |
|
2924 |
IMPORT_C void SetCard(TMMCard* aCardP); |
|
2925 |
||
2926 |
// Control macros setup |
|
2927 |
inline void SetupCIMUpdateAcq(); |
|
2928 |
inline void SetupCIMInitStack(); |
|
2929 |
inline void SetupCIMCheckStack(); |
|
2930 |
inline void SetupCIMSetupCard(); |
|
2931 |
inline void SetupCIMLockStack(); |
|
2932 |
inline void SetupCIMInitStackAfterUnlock(); |
|
2933 |
inline void SetupCIMAutoUnlock(); |
|
2934 |
||
2935 |
// Data transfer macros setup |
|
2936 |
IMPORT_C void SetupCIMReadBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP); |
|
2937 |
IMPORT_C void SetupCIMWriteBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP); |
|
2938 |
IMPORT_C void SetupCIMReadMBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen); |
|
2939 |
IMPORT_C void SetupCIMWriteMBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen); |
|
2940 |
IMPORT_C void SetupCIMEraseSector(TMMCArgument aDevAddr, TUint32 aLength); |
|
2941 |
IMPORT_C void SetupCIMEraseGroup(TMMCArgument aDevAddr, TUint32 aLength); |
|
2942 |
IMPORT_C void SetupCIMReadIO(TUint8 aRegAddr, TUint32 aLength, TUint8* aMemoryP); |
|
2943 |
IMPORT_C void SetupCIMWriteIO(TUint8 aRegAddr, TUint32 aLength, TUint8* aMemoryP); |
|
2944 |
IMPORT_C void SetupCIMLockUnlock(TUint32 aLength, TUint8* aMemoryP); |
|
2945 |
||
2946 |
// Data transfer macros setup (block mode) |
|
2947 |
inline void SetupCIMReadBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1); |
|
2948 |
inline void SetupCIMWriteBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1); |
|
2949 |
inline void SetupCIMEraseMSector(TMMCArgument aBlockAddr, TUint32 aBlocks = 1); |
|
2950 |
inline void SetupCIMEraseMGroup(TMMCArgument aBlockAddr, TUint32 aBlocks = 1); |
|
2951 |
||
2952 |
// Raw commands (must be used in the locked bus state only) |
|
2953 |
// Known commands with or without (with a default) argument |
|
2954 |
IMPORT_C void SetupCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument=0); |
|
2955 |
||
2956 |
// Generic unknown command with unknown response type |
|
2957 |
IMPORT_C void SetupRSCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument, |
|
2958 |
TUint32 aResponseLength, TMMCCommandTypeEnum aCommandType=ECmdTypeUK, |
|
2959 |
TMMCResponseTypeEnum aResponseType=ERespTypeUnknown, |
|
2960 |
TUint32 aCommandClass=KMMCCmdClassNone); |
|
2961 |
||
2962 |
// Generic data transfer command |
|
2963 |
IMPORT_C void SetupDTCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument, |
|
2964 |
TUint32 aTotalLength, TUint8* aMemoryAddress, TUint32 aBlockLength=0, |
|
2965 |
TBool aStopTransmission=EFalse, TMMCCmdDirEnum aDir=EDirNone, |
|
2966 |
TUint32 aCommandClass=KMMCCmdClassNone); |
|
2967 |
// Actions |
|
2968 |
IMPORT_C TInt Engage(); // Enque session for execution |
|
2969 |
inline void UnlockStack(); // Unlock the bus |
|
2970 |
inline void Stop(); // Signal session to complete (stop and complete) |
|
2971 |
inline void Abort(); // Abort only (no completion) |
|
2972 |
||
2973 |
// Info retrieval |
|
2974 |
IMPORT_C TInt EpocErrorCode() const; // Derived from MMCExitCode and LastStatus |
|
2975 |
inline TMMCSessionTypeEnum SessionID() const; |
|
2976 |
inline DMMCStack* StackP() const; // DMMCStack serving this session |
|
2977 |
inline TMMCard* CardP() const; // The current card pointer |
|
2978 |
inline TBool IsEngaged() const; // Session is being served by DMMCStack |
|
2979 |
inline TMMCErr MMCExitCode() const; // MMC specific error code returned by DMMCStack |
|
2980 |
inline TMMCStatus LastStatus() const; // Last R1 response received from the card |
|
2981 |
inline TUint32 BytesTransferred() const;// The actual amount of data transferred in this session |
|
2982 |
inline TUint8* ResponseP(); // Current command response (&iCommand[iCmdSP].iResponse) |
|
2983 |
inline TUint32 EffectiveModes() const; // Modes which DMMCStack will consider as effective |
|
2984 |
// |
|
2985 |
inline void ResetCommandStack(); |
|
2986 |
private: |
|
2987 |
void SetupCIMControl(TInt aSessNum); |
|
2988 |
protected: |
|
2989 |
IMPORT_C virtual TMMCSMSTFunc GetMacro(TInt aSessNum) const; |
|
2990 |
inline void Block(TUint32 aFlag); |
|
2991 |
inline void UnBlock(TUint32 aFlag, TMMCErr anExitCode); |
|
2992 |
private: |
|
2993 |
#ifdef __EPOC32__ |
|
2994 |
static void PollTimerCallBack(TAny* aSessP); |
|
2995 |
static void RetryTimerCallBack(TAny* aSessP); |
|
2996 |
static void ProgramTimerCallBack(TAny* aSessP); |
|
2997 |
#endif |
|
2998 |
inline void SwapMe(); |
|
2999 |
void SynchBlock(TUint32 aFlag); |
|
3000 |
void SynchUnBlock(TUint32 aFlag); |
|
3001 |
public: |
|
3002 |
static const TMMCCommandSpec& FindCommandSpec(const TMMCIdxCommandSpec aSpecs[], TInt aIdx); |
|
3003 |
IMPORT_C void FillCommandDesc(); |
|
3004 |
IMPORT_C void FillCommandDesc(TMMCCommandEnum aCommand); |
|
3005 |
IMPORT_C void FillCommandDesc(TMMCCommandEnum aCommand, TMMCArgument anArgument); |
|
3006 |
IMPORT_C void FillCommandArgs(TMMCArgument anArgument, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen); |
|
3007 |
inline TMMCCommandDesc& Command(); // The current command descriptor |
|
3008 |
||
3009 |
inline void PushCommandStack(); |
|
3010 |
inline void PopCommandStack(); |
|
3011 |
||
3012 |
// Methods for double-buffered data transfer: |
|
3013 |
inline TBool RequestMoreData(); |
|
3014 |
inline void EnableDoubleBuffering(TUint32 aNumBlocks); /**< @internalTechnology */ |
|
3015 |
inline void SetDataTransferCallback(TMMCCallBack& aCallback); /**< @internalTechnology */ |
|
3016 |
inline void MoreDataAvailable(TUint32 aNumBlocks, TUint8* aMemoryP, TInt aError); /**< @internalTechnology */ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3017 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3018 |
inline void SaveCard(); /**< @internalTechnology */ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3019 |
inline void RestoreCard(); /**< @internalTechnology */ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3020 |
|
0 | 3021 |
public: |
3022 |
/** |
|
3023 |
The last R1 response. |
|
3024 |
*/ |
|
3025 |
TMMCStatus iLastStatus; |
|
3026 |
||
3027 |
/** |
|
3028 |
A pointer to the card object. |
|
3029 |
*/ |
|
3030 |
TMMCard* iCardP; // Pointer to Card Info object |
|
3031 |
IMPORT_C TRCA CardRCA(); // Checks that card is still ready - otherwise returns 0 |
|
3032 |
TMMCSessionTypeEnum iSessionID; |
|
3033 |
private: |
|
3034 |
DMMCSession* iLinkP; // |
|
3035 |
protected: |
|
3036 |
TMMCCallBack iCallBack; // Where to report the completion |
|
3037 |
private: |
|
3038 |
DMMCStack* iStackP; // Pointer to Stack Controller |
|
3039 |
TCID iCID; // Card ID to ensure we are still talking to the same card |
|
3040 |
TUint32 iBytesTransferred; // The actual amount of data transferred in this session |
|
3041 |
TMMCErr iMMCExitCode; // State Machine exit code (MMC specific) |
|
3042 |
public: |
|
3043 |
/** |
|
3044 |
Session state flags (synchronous). |
|
3045 |
*/ |
|
3046 |
TUint32 iState; |
|
3047 |
private: |
|
3048 |
TUint iInitContext; // Stack Initialiser pass number |
|
3049 |
TUint iGlobalRetries; // Global retry counter |
|
3050 |
||
3051 |
// Asynchronous flags analysed by scheduler |
|
3052 |
TBool volatile iDoAbort; // Marks the session for abort |
|
3053 |
TBool volatile iDoStop; // Stop the session as soon as it's safe |
|
3054 |
TBool volatile iDoComplete; // Completion callback is now to be invoked |
|
3055 |
TBool iBrokenLock; // Stack lock is broken by force major |
|
3056 |
// |
|
3057 |
TUint32 iBlockOn; // blocking reasons |
|
3058 |
TInt iCmdSP; // Current Command stack index |
|
3059 |
||
3060 |
TMMCCommandDesc iCommand[KMaxMMCCommandStackDepth]; // Command stack |
|
3061 |
||
3062 |
TMMCCallBack iDataTransferCallback; // A callback function, used to request more data when performing double-buffering |
|
3063 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3064 |
TUint32 iSpare[21]; // Spare data (stolen from iCommand) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3065 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3066 |
TMMCard* iSavedCardP; // Saved copy of iCardP |
0 | 3067 |
|
3068 |
TMMCStateMachine iMachine; // State Machine context |
|
3069 |
#ifdef __EPOC32__ |
|
3070 |
NTimer iPollTimer; |
|
3071 |
NTimer iRetryTimer; |
|
3072 |
NTimer iProgramTimer; |
|
3073 |
#endif |
|
3074 |
public: |
|
3075 |
TMMCStackConfig iConfig; // Client configuration parameters |
|
3076 |
friend class DMMCStack; |
|
3077 |
friend class TMMCSessRing; |
|
3078 |
friend class TMMCardArray; |
|
3079 |
}; |
|
3080 |
||
3081 |
||
3082 |
class DMMCStack : public DBase |
|
3083 |
/** |
|
3084 |
This object controls access to the MultiMediaCard stack. |
|
3085 |
The DMMCSocket owns an instance of this class for the MultiMediaCard stack that it manages. |
|
3086 |
||
3087 |
@publishedPartner |
|
3088 |
@released |
|
3089 |
*/ |
|
3090 |
{ |
|
3091 |
public: |
|
3092 |
/** extension interfaces Ids */ |
|
3093 |
enum TInterfaceId |
|
3094 |
{ |
|
3095 |
KInterfaceMachineInfo, |
|
3096 |
KInterfaceSwitchToLowVoltageSM, |
|
3097 |
KInterfaceSetBusWidth, |
|
3098 |
KInterfaceDemandPagingInfo, |
|
3099 |
KInterfaceCancelSession, |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3100 |
KInterfaceDoWakeUpSM, |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3101 |
KInterfaceAddressCard, |
0 | 3102 |
}; |
3103 |
||
3104 |
/** generic interface */ |
|
3105 |
class MInterface |
|
3106 |
{ |
|
3107 |
public: |
|
3108 |
virtual TInt Function() = 0; |
|
3109 |
}; |
|
3110 |
||
3111 |
/** |
|
3112 |
Demand paging support |
|
3113 |
@see KInterfaceDemandPagingInfo |
|
3114 |
*/ |
|
3115 |
class TDemandPagingInfo |
|
3116 |
{ |
|
3117 |
public: |
|
3118 |
const TInt* iPagingDriveList; |
|
3119 |
TInt iDriveCount; |
|
3120 |
TUint iPagingType; |
|
3121 |
TInt iReadShift; |
|
3122 |
TUint iNumPages; |
|
3123 |
TBool iWriteProtected; |
|
3124 |
TInt iSlotNumber; |
|
3125 |
TUint iSpare[2]; |
|
3126 |
} ; |
|
3127 |
/** |
|
3128 |
* An optional interface implemented by the PSL for returning demand-paging information. |
|
3129 |
* @see KInterfaceDemandPagingInfo |
|
3130 |
*/ |
|
3131 |
class MDemandPagingInfo |
|
3132 |
{ |
|
3133 |
public: |
|
3134 |
virtual TInt DemandPagingInfo(TDemandPagingInfo& aInfo) = 0; |
|
3135 |
}; |
|
3136 |
||
3137 |
/** |
|
3138 |
* An optional interface State machine implemented by the PSL for handling asynchronous VccCore powerup |
|
3139 |
* @see KInterfaceDoWakeUpSM |
|
3140 |
*/ |
|
3141 |
class MDoWakeUp |
|
3142 |
{ |
|
3143 |
public: |
|
3144 |
virtual TMMCErr DoWakeUpSM()=0; |
|
3145 |
}; |
|
3146 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3147 |
/** |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3148 |
* An optional interface implemented by the derived class. Used when the stack supports more than one |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3149 |
* card and the cards are individually selectable, i.e. iMultiplexedBus is true |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3150 |
* @see KInterfaceAddressCard |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3151 |
*/ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3152 |
class MAddressCard |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3153 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3154 |
public: |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3155 |
virtual void AddressCard(TInt aCardNumber)=0; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3156 |
}; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3157 |
|
0 | 3158 |
|
3159 |
public: |
|
3160 |
IMPORT_C DMMCStack(TInt aBus, DMMCSocket* aSocket); |
|
3161 |
IMPORT_C virtual TInt Init(); |
|
3162 |
// |
|
3163 |
// Actions |
|
3164 |
inline void ReportPowerUp(); |
|
3165 |
inline void ReportPowerDown(); |
|
3166 |
inline void Reset(); // Discard all requests and clear up |
|
3167 |
inline void CompleteAll(TMMCErr aCode); // Complete all operations with an error |
|
3168 |
inline void CancelSession(DMMCSession* aSession); |
|
3169 |
||
3170 |
IMPORT_C void PowerUpStack(); |
|
3171 |
IMPORT_C void PowerDownStack(); |
|
3172 |
void QSleepStack(); |
|
3173 |
IMPORT_C TInt Stop(TMMCard* aCardP); |
|
3174 |
// |
|
3175 |
// Inquiries |
|
3176 |
inline TUint MaxCardsInStack() const; |
|
3177 |
inline TMMCard* CardP(TUint aCardNumber); |
|
3178 |
inline DMMCSocket* MMCSocket() const; |
|
3179 |
inline TMMCPasswordStore* PasswordStore() const; |
|
3180 |
inline TBool InitStackInProgress() const; |
|
3181 |
inline TBool HasSessionsQueued() const; |
|
3182 |
inline TBool HasCardsPresent(); |
|
3183 |
inline void BufferInfo(TUint8*& aBuf, TInt& aBufLen, TInt& aMinorBufLen); |
|
3184 |
inline TInt DemandPagingInfo(TDemandPagingInfo& aInfo); |
|
3185 |
inline TBool StackRunning() const; |
|
3186 |
||
3187 |
||
3188 |
#ifdef __EPOC32__ |
|
3189 |
||
3190 |
/** |
|
3191 |
Defines the period for the poll timer. |
|
3192 |
||
3193 |
The poll timer is used by the generic layer for platforms |
|
3194 |
that do not provide an interrupt to indicate |
|
3195 |
when programming mode is finished. |
|
3196 |
||
3197 |
@return The poll timer period, in milliseconds. |
|
3198 |
*/ |
|
3199 |
virtual TInt ProgramPeriodInMilliSeconds() const =0; |
|
3200 |
#endif |
|
3201 |
||
3202 |
/** |
|
3203 |
* Calculates the minimum range that must be read off a card, an optimisation that takes advantage |
|
3204 |
* of the partial read feature found on some cards. It takes the logical range that the media driver |
|
3205 |
* wants to read from the card, and increases it to take into account factors such as FIFO width and |
|
3206 |
* minimum DMA transfer size. |
|
3207 |
* @param aCard A pointer to the MMC Card |
|
3208 |
* @param aStart The required start position |
|
3209 |
* @param aEnd The required end position |
|
3210 |
* @param aPhysStart The adjusted start position |
|
3211 |
* @param aPhysEnd The adjusted end position |
|
3212 |
*/ |
|
3213 |
virtual void AdjustPartialRead(const TMMCard* aCard, TUint32 aStart, TUint32 aEnd, TUint32* aPhysStart, TUint32* aPhysEnd) const =0; |
|
3214 |
||
3215 |
/** |
|
3216 |
* Returns the details of the buffer allocated by the socket for data transfer operations. The buffer |
|
3217 |
* is allocated and configured at the variant layer to allow , for example, contiguous pages to be |
|
3218 |
* allocated for DMA transfers. |
|
3219 |
* @param aMDBuf A pointer to the allocated buffer |
|
3220 |
* @param aMDBufLen The length of the allocated buffer |
|
3221 |
*/ |
|
3222 |
virtual void GetBufferInfo(TUint8** aMDBuf, TInt* aMDBufLen) =0; |
|
3223 |
||
3224 |
/** |
|
3225 |
* Gets the platform specific configuration information. |
|
3226 |
* @see TMMCMachineInfo |
|
3227 |
*/ |
|
3228 |
virtual void MachineInfo(TMMCMachineInfo& aMachineInfo) =0; |
|
3229 |
||
3230 |
/** |
|
3231 |
* Creates the session object |
|
3232 |
*/ |
|
3233 |
IMPORT_C virtual DMMCSession* AllocSession(const TMMCCallBack& aCallBack) const; |
|
3234 |
||
3235 |
protected: |
|
3236 |
// Platform layer service |
|
3237 |
inline TMMCBusConfig& BusConfig(); |
|
3238 |
inline TMMCBusConfig& MasterBusConfig(); |
|
3239 |
inline DMMCSession& Session(); // Current session |
|
3240 |
inline TMMCCommandDesc& Command(); // Current command descriptor of current session |
|
3241 |
inline TMMCStateMachine& Machine(); // State machine of current session |
|
3242 |
inline void BlockCurrentSession(TUint32 aFlag); |
|
3243 |
inline void UnBlockCurrentSession(TUint32 aFlag, TMMCErr anExitCode); |
|
3244 |
inline void ReportInconsistentBusState(); |
|
3245 |
inline void ReportASSPEngaged(); |
|
3246 |
inline void ReportASSPDisengaged(); |
|
3247 |
inline TRCA CurrentSessCardRCA(); // Checks that card is still ready - otherwise returns 0 |
|
3248 |
inline void CurrentSessPushCmdStack(); |
|
3249 |
inline void CurrentSessPopCmdStack(); |
|
3250 |
inline void CurrentSessFillCmdDesc(TMMCCommandEnum aCommand); |
|
3251 |
inline void CurrentSessFillCmdDesc(TMMCCommandEnum aCommand,TMMCArgument anArgument); |
|
3252 |
inline void CurrentSessFillCmdArgs(TMMCArgument anArgument,TUint32 aLength,TUint8* aMemoryP,TUint32 aBlkLen); |
|
3253 |
inline TRCA SelectedCard() const; |
|
3254 |
inline void YieldStack(TMMCCommandTypeEnum aCommand); |
|
3255 |
||
3256 |
void DoSetClock(TUint32 aClock); |
|
3257 |
void DoSetBusWidth(TUint32 aBusWidth); |
|
3258 |
TBusWidth BusWidthEncoding(TInt aBusWidth) const; |
|
3259 |
TUint MaxTranSpeedInKilohertz(const TMMCard& aCard) const; |
|
3260 |
||
3261 |
// Stack service provided by platform/variant layer. |
|
3262 |
||
3263 |
/** |
|
3264 |
* Returns the default master settings for the platform. |
|
3265 |
* @param aConfig A TMMCBusConfig reference to be filled in with the default settings. |
|
3266 |
* @param aClock The requested clock frequency (may be ignored if the hardware cannot support it). |
|
3267 |
*/ |
|
3268 |
virtual void SetBusConfigDefaults(TMMCBusConfig& aConfig, TUint aClock)=0; |
|
3269 |
||
3270 |
/** |
|
3271 |
* Switches from identification mode of operation to data transfer mode operation. |
|
3272 |
* |
|
3273 |
* Note that at this point the clock information in iBusConfig will not have been updated |
|
3274 |
* to the new data transfer rate. This function should generally just switch from open drain |
|
3275 |
* to push-pull bus mode - with the clock rate being changed at the start of IssueMMCCommandSM, |
|
3276 |
* where iBusConfig will be valid. |
|
3277 |
*/ |
|
3278 |
virtual void InitClockOff()=0; |
|
3279 |
||
3280 |
/** |
|
3281 |
* Stop all activities on the host stack. |
|
3282 |
* |
|
3283 |
* This will generally perform the same operations as for ASSPDisengage() but this will additionally |
|
3284 |
* turn off the clock to the hardware interface and release any requested power requirements made on |
|
3285 |
* the power model. (That is release any power requirements made as part of the InitClockOnSM() function). |
|
3286 |
* |
|
3287 |
* Called from the platform independent layer when it is required to immediately cancel any PSL asynchronous |
|
3288 |
* activity because the current session has been aborted. |
|
3289 |
* |
|
3290 |
* This function should normally include a call to ReportAsspDisengaged() at the end, to report to the PIL |
|
3291 |
* that the PSL level resources have been disengaged. |
|
3292 |
*/ |
|
3293 |
virtual void ASSPReset()=0; |
|
3294 |
||
3295 |
/** |
|
3296 |
* Called each time a session which has engaged PSL resources has completed or has been aborted. |
|
3297 |
* |
|
3298 |
* This should disable any activities which were required to perform the session just completed/aborted. |
|
3299 |
* It shouldn't however turn off the clock to the hardware interface (which will be turned off instead |
|
3300 |
* by the inactivity timer). This typically disables DMA and interface interrupts and forces the hardware |
|
3301 |
* interface into idle. |
|
3302 |
* |
|
3303 |
* This function should normally include a call to ReportAsspDisengaged() at the end, to report to the PIL |
|
3304 |
* that the PSL level resources have been disengaged. |
|
3305 |
*/ |
|
3306 |
virtual void ASSPDisengage()=0; |
|
3307 |
||
3308 |
/** |
|
3309 |
* Called as part of the bus power down sequence. It stops all activities on the host stack, turns off the clock |
|
3310 |
* to the hardware interface and releases any requested power requirements made on the power model |
|
3311 |
* (i.e. very often a straight call of ASSPReset()). |
|
3312 |
* |
|
3313 |
* This shouldn't turn off the MMC PSU as this will be performed immediately afterwards by the PSU class. |
|
3314 |
*/ |
|
3315 |
virtual void DoPowerDown()=0; |
|
3316 |
||
3317 |
IMPORT_C virtual TBool CardDetect(TUint aCardNumber); |
|
3318 |
IMPORT_C virtual TBool WriteProtected(TUint aCardNumber); |
|
3319 |
// |
|
3320 |
// State Machine functions implemented in platform layer. |
|
3321 |
||
3322 |
/** |
|
3323 |
* Called as a child function at the start of the CIM_UPDATE_ACQ macro state machine. |
|
3324 |
* |
|
3325 |
* It should perform the necessary PSL level actions associated with powering up the bus. This includes |
|
3326 |
* turning on the MMC PSU. However, the hardware interface clock should not be turned on as part of this function. |
|
3327 |
* |
|
3328 |
* If the Controller has to request power resources from the power model (e.g a fast system clock required all the |
|
3329 |
* time the bus is powered) then this state machine function can be used to asynchronously wait for this resource |
|
3330 |
* to become available. |
|
3331 |
* |
|
3332 |
* Upon completion, DMMCStack::ReportPowerUp() should be called. |
|
3333 |
* |
|
3334 |
* @return KMMCErrNone if completed successfully or standard TMMCErr code otherwise |
|
3335 |
*/ |
|
3336 |
virtual TMMCErr DoPowerUpSM()=0; |
|
3337 |
||
3338 |
/** |
|
3339 |
* Turns on the clock to the hardware interface. |
|
3340 |
* |
|
3341 |
* This state machine function is called as a child function as part of the CIM_UPDATE_ACQ macro state machine. |
|
3342 |
* |
|
3343 |
* It is implemented as a state machine function since it may be necessary to include a short delay after the |
|
3344 |
* clock has been turned on to allow it to stabilise, or in some cases it may be necessary to wait for a power |
|
3345 |
* resource to become available. |
|
3346 |
* |
|
3347 |
* This function should normally include a call to ReportAsspEngaged() at the start, to report to the PIL that the PSL |
|
3348 |
* level resources have been engaged. |
|
3349 |
* |
|
3350 |
* @return KMMCErrNone if completed successfully or standard TMMCErr code otherwise |
|
3351 |
*/ |
|
3352 |
virtual TMMCErr InitClockOnSM()=0; |
|
3353 |
||
3354 |
/** |
|
3355 |
* Executes a single command over the bus. |
|
3356 |
* |
|
3357 |
* The input parameters are passed via the current command descriptor on the session's command stack |
|
3358 |
* (TMMCCommandDesc class), which specifies the type of command, response type, arguments etc.. |
|
3359 |
* |
|
3360 |
* @return KMMCErrNone if completed successfully or standard TMMCErr code otherwise |
|
3361 |
*/ |
|
3362 |
IMPORT_C virtual TMMCErr IssueMMCCommandSM()=0; |
|
3363 |
||
3364 |
TBool StaticBlocks(); |
|
3365 |
||
3366 |
/** |
|
3367 |
* Indicates that the PSL should change the bus width. |
|
3368 |
* Must be implemented by the Platform Specific Layer if MMCV4 4/8-bit bus mode is required |
|
3369 |
*/ |
|
3370 |
IMPORT_C virtual void SetBusWidth(TUint32 aBusWidth); |
|
3371 |
||
3372 |
/** |
|
3373 |
* Retrieves a TMMCMachineInfoV4 from the PSL |
|
3374 |
* Must be implemented by the Platform Specific Layer if MMCV4 support is required |
|
3375 |
*/ |
|
3376 |
public: |
|
3377 |
IMPORT_C virtual void MachineInfo(TDes8& aMachineInfo); |
|
3378 |
||
3379 |
protected: |
|
3380 |
/** |
|
3381 |
* Switches the MMC bus to low voltage mode |
|
3382 |
*/ |
|
3383 |
TMMCErr SwitchToLowVoltageSM(); |
|
3384 |
||
3385 |
||
3386 |
private: |
|
3387 |
// |
|
3388 |
// Session service |
|
3389 |
void Add(DMMCSession* aSessP); |
|
3390 |
void Abort(DMMCSession* aSessP); |
|
3391 |
void Stop(DMMCSession* aSessP); |
|
3392 |
void UnlockStack(DMMCSession* aSessP); |
|
3393 |
void MarkComplete(DMMCSession* aSessP, TMMCErr anExitCode); |
|
3394 |
// |
|
3395 |
// Stack control and operations support |
|
3396 |
// Scheduler and its supplementary functions |
|
3397 |
enum TMMCStackSchedStateEnum |
|
3398 |
{ |
|
3399 |
ESchedContinue=0, |
|
3400 |
ESchedLoop=1, |
|
3401 |
ESchedExit, |
|
3402 |
ESchedChooseJob |
|
3403 |
}; |
|
3404 |
void Scheduler(volatile TBool& aFlag); |
|
3405 |
void DoSchedule(); |
|
3406 |
TMMCStackSchedStateEnum SchedGetOnDFC(); |
|
3407 |
void SchedSetContext(DMMCSession* aSessP); |
|
3408 |
void SchedDoAbort(DMMCSession* aSessP); |
|
3409 |
TMMCStackSchedStateEnum SchedResolveStatBlocks(DMMCSession* aSessP); |
|
3410 |
TMMCStackSchedStateEnum SchedGroundDown(DMMCSession* aSessP, TMMCErr aReason); |
|
3411 |
TMMCStackSchedStateEnum SchedEnqueStackSession(TMMCSessionTypeEnum aSessID); |
|
3412 |
void SchedGrabEntries(); |
|
3413 |
void SchedDisengage(); |
|
3414 |
TBool SchedAllowDirectCommands(DMMCSession* aSessP); |
|
3415 |
TBool SchedYielding(DMMCSession* aSessP); |
|
3416 |
inline TMMCStackSchedStateEnum SchedAbortPass(); |
|
3417 |
inline TMMCStackSchedStateEnum SchedCompletionPass(); |
|
3418 |
inline TMMCStackSchedStateEnum SchedInitStack(); |
|
3419 |
inline TMMCStackSchedStateEnum SchedSleepStack(); |
|
3420 |
inline TBool SchedPreemptable(); |
|
3421 |
inline TMMCStackSchedStateEnum SchedSession(); |
|
3422 |
inline TMMCStackSchedStateEnum SchedChooseJob(); |
|
3423 |
// |
|
3424 |
// Miscellaneous SM function service |
|
3425 |
protected: |
|
3426 |
void MergeConfig(DMMCSession* aSessP); |
|
3427 |
private: |
|
3428 |
inline void DeselectsToIssue(TUint aNumber); |
|
3429 |
||
3430 |
// Static Completion routines. |
|
3431 |
static void StackDFC(TAny* aStackP); |
|
3432 |
static void StackSessionCBST(TAny* aStackP); |
|
3433 |
TInt StackSessionCB(); |
|
3434 |
static void AutoUnlockCBST(TAny *aStackP); |
|
3435 |
TInt AutoUnlockCB(); |
|
3436 |
||
3437 |
protected: |
|
3438 |
IMPORT_C void Block(DMMCSession* aSessP, TUint32 aFlag); |
|
3439 |
IMPORT_C void UnBlock(DMMCSession* aSessP, TUint32 aFlag, TMMCErr anExitCode); |
|
3440 |
||
3441 |
protected: |
|
3442 |
// State machines. The adapter functions just call the non-static versions. |
|
3443 |
// Top-level state machines. |
|
3444 |
static TMMCErr NakedSessionSMST(TAny* aStackP); // ECIMNakedSession |
|
3445 |
inline TMMCErr NakedSessionSM(); |
|
3446 |
static TMMCErr CIMUpdateAcqSMST(TAny* aStackP); // ECIMUpdateAcq |
|
3447 |
TMMCErr CIMUpdateAcqSM(); |
|
3448 |
static TMMCErr CIMInitStackSMST(TAny* aStackP); // ECIMInitStack |
|
3449 |
inline TMMCErr CIMInitStackSM(); |
|
3450 |
static TMMCErr CIMCheckStackSMST(TAny* aStackP); // ECIMCheckStack |
|
3451 |
inline TMMCErr CIMCheckStackSM(); |
|
3452 |
static TMMCErr CIMSetupCardSMST(TAny* aStackP); // ECIMSetupCard |
|
3453 |
inline TMMCErr CIMSetupCardSM(); |
|
3454 |
IMPORT_C static TMMCErr CIMReadWriteBlocksSMST(TAny* aStackP); // ECIMReadBlock, ECIMWriteBlock, ECIMReadMBlock, ECIMWriteMBlock |
|
3455 |
IMPORT_C virtual TMMCErr CIMReadWriteBlocksSM(); |
|
3456 |
static TMMCErr CIMEraseSMST(TAny* aStackP); // ECIMEraseSector, ECIMEraseGroup |
|
3457 |
inline TMMCErr CIMEraseSM(); |
|
3458 |
static TMMCErr CIMReadWriteIOSMST(TAny* aStackP); // ECIMReadIO, ECIMWriteIO |
|
3459 |
inline TMMCErr CIMReadWriteIOSM(); |
|
3460 |
static TMMCErr CIMLockUnlockSMST(TAny *aStackP); // ECIMLockUnlock |
|
3461 |
inline TMMCErr CIMLockUnlockSM(); |
|
3462 |
static TMMCErr NoSessionSMST(TAny* aStackP); // ECIMLockStack |
|
3463 |
inline TMMCErr NoSessionSM(); |
|
3464 |
static TMMCErr AcquireStackSMST(TAny* aStackP); |
|
3465 |
IMPORT_C virtual TMMCErr AcquireStackSM(); |
|
3466 |
static TMMCErr CheckStackSMST(TAny* aStackP); // ECIMCheckStack |
|
3467 |
inline TMMCErr CheckStackSM(); |
|
3468 |
static TMMCErr CheckLockStatusSMST(TAny* aStackP); |
|
3469 |
inline TMMCErr CheckLockStatusSM(); |
|
3470 |
static TMMCErr ModifyCardCapabilitySMST(TAny* aStackP); |
|
3471 |
IMPORT_C virtual TMMCErr ModifyCardCapabilitySM(); |
|
3472 |
static TMMCErr BaseModifyCardCapabilitySMST(TAny* aStackP); |
|
3473 |
static TMMCErr DoPowerUpSMST(TAny* aStackP); |
|
3474 |
static TMMCErr InitClockOnSMST(TAny* aStackP); |
|
3475 |
IMPORT_C static TMMCErr IssueMMCCommandSMST(TAny* aStackP); |
|
3476 |
||
3477 |
static TMMCErr CIMAutoUnlockSMST(TAny* aStackP); |
|
3478 |
inline TMMCErr CIMAutoUnlockSM(); |
|
3479 |
||
3480 |
static TMMCErr InitStackAfterUnlockSMST(TAny* aStackP); // ECIMInitStackAfterUnlock |
|
3481 |
IMPORT_C virtual TMMCErr InitStackAfterUnlockSM(); |
|
3482 |
||
3483 |
static TMMCErr InitCurrentCardAfterUnlockSMST(TAny* aStackP); |
|
3484 |
||
3485 |
static TMMCErr AttachCardSMST(TAny* aStackP); |
|
3486 |
inline TMMCErr AttachCardSM(); |
|
3487 |
static TMMCErr ExecCommandSMST(TAny* aStackP); |
|
3488 |
inline TMMCErr ExecCommandSM(); |
|
3489 |
static TMMCErr IssueCommandCheckResponseSMST(TAny* aStackP); |
|
3490 |
inline TMMCErr IssueCommandCheckResponseSM(); |
|
3491 |
static TMMCErr PollGapTimerSMST(TAny* aStackP); |
|
3492 |
inline TMMCErr PollGapTimerSM(); |
|
3493 |
static TMMCErr RetryGapTimerSMST(TAny* aStackP); |
|
3494 |
inline TMMCErr RetryGapTimerSM(); |
|
3495 |
static TMMCErr ProgramTimerSMST(TAny *aStackP); |
|
3496 |
inline TMMCErr ProgramTimerSM(); |
|
3497 |
static TMMCErr GoIdleSMST(TAny* aStackP); |
|
3498 |
inline TMMCErr GoIdleSM(); |
|
3499 |
||
3500 |
static TMMCErr SwitchToLowVoltageSMST(TAny* aStackP); |
|
3501 |
||
3502 |
static TMMCErr DoWakeUpSMST(TAny* aStackP); |
|
3503 |
||
3504 |
||
3505 |
private: |
|
3506 |
static TMMCErr ConfigureHighSpeedSMST(TAny* aStackP); |
|
3507 |
inline TMMCErr ConfigureHighSpeedSM(); |
|
3508 |
||
3509 |
static TMMCErr DetermineBusWidthAndClockSMST(TAny* aStackP); |
|
3510 |
inline TMMCErr DetermineBusWidthAndClockSM(); |
|
3511 |
||
3512 |
static TMMCErr ExecSwitchCommandST(TAny* aStackP); |
|
3513 |
inline TMMCErr ExecSwitchCommand(); |
|
3514 |
||
3515 |
static TMMCErr ExecSleepCommandSMST(TAny* aStackP); |
|
3516 |
inline TMMCErr ExecSleepCommandSM(); |
|
3517 |
||
3518 |
static TMMCErr ExecAwakeCommandSMST(TAny* aStackP); |
|
3519 |
inline TMMCErr ExecAwakeCommandSM(); |
|
3520 |
||
3521 |
static TMMCErr LowVoltagePowerupTimerSMST(TAny *aStackP); |
|
3522 |
TMMCErr LowVoltagePowerupTimerSM(); |
|
3523 |
||
3524 |
static TMMCErr ExecBusTestSMST(TAny* aStackP); |
|
3525 |
inline TMMCErr ExecBusTestSM(); |
|
3526 |
||
3527 |
enum TBusWidthAndClock |
|
3528 |
{ |
|
3529 |
E1Bit20Mhz = 0x0000, |
|
3530 |
||
3531 |
E4Bits26Mhz = 0x0001, |
|
3532 |
E4Bits52Mhz = 0x0002, |
|
3533 |
||
3534 |
E8Bits26Mhz = 0x0004, |
|
3535 |
E8Bits52Mhz = 0x0008, |
|
3536 |
}; |
|
3537 |
enum TBusWidthAndClockMasks |
|
3538 |
{ |
|
3539 |
E4BitMask = E4Bits26Mhz | E4Bits52Mhz, |
|
3540 |
E8BitMask = E8Bits26Mhz | E8Bits52Mhz, |
|
3541 |
E26MhzMask = E4Bits26Mhz | E8Bits26Mhz, |
|
3542 |
E52MhzMask = E4Bits52Mhz | E8Bits52Mhz |
|
3543 |
}; |
|
3544 |
||
3545 |
void DetermineBusWidthAndClock(const TMMCard& aCard, TBool aLowVoltage, TUint& aPowerClass, TBusWidthAndClock& aBusWidthAndClock); |
|
3546 |
TUint GetPowerClass(const TMMCard& aCard, TBusWidthAndClock aWidthAndClock, TBool aLowVoltage); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3547 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3548 |
void DoAddressCard(TInt aCardNumber); |
0 | 3549 |
|
3550 |
||
3551 |
// ----------- Data Members ------------- |
|
3552 |
private: |
|
3553 |
// |
|
3554 |
// Synchronous status, data structures and control info. |
|
3555 |
TUint32 iStackState; |
|
3556 |
TUint iInitContext; // Stack Initialiser pass number |
|
3557 |
DMMCSession* iLockingSessionP; |
|
3558 |
TMMCSessRing iWorkSet; |
|
3559 |
TMMCSessRing iReadyQueue; |
|
3560 |
TMMCSessRing iEntryQueue; |
|
3561 |
TDfc iStackDFC; |
|
3562 |
TRCA iSelectedCard; |
|
3563 |
DMMCSocket* iSocket; |
|
3564 |
DMMCSession* iStackSession; |
|
3565 |
DMMCSession iAutoUnlockSession; |
|
3566 |
TInt iAutoUnlockIndex; // index into iCards |
|
3567 |
protected: |
|
3568 |
TUint8* iPSLBuf; |
|
3569 |
private: |
|
3570 |
TInt iPSLBufLen; |
|
3571 |
TInt iMinorBufLen; |
|
3572 |
TUint8 iSpare[2]; |
|
3573 |
TBool volatile iSleep; |
|
3574 |
DThread* iNotifierThread; |
|
3575 |
TRequestStatus* iNotifierReqStat; |
|
3576 |
enum TInitState {EISPending, EISDone}; |
|
3577 |
TInitState iInitState; |
|
3578 |
// |
|
3579 |
// Stack and Scheduler control |
|
3580 |
// Asynchronous sheduler attention flags |
|
3581 |
TBool volatile iAttention; // There are ready sessions |
|
3582 |
TBool volatile iAbortReq; // There are sessions marked for abort |
|
3583 |
TBool volatile iCompReq; // There are sessions to complete |
|
3584 |
TBool volatile iInitialise; // Enforce InitStack (after enforced PowerDown) |
|
3585 |
TBool volatile iUpdate; // Enque InitStack into iWorkSet |
|
3586 |
// Other asynchronous flags |
|
3587 |
TBool volatile iPoweredUp; |
|
3588 |
TBool volatile iDFCRunning; |
|
3589 |
TBool volatile iAbortAll; |
|
3590 |
TMMCErr volatile iCompleteAllExitCode; |
|
3591 |
// |
|
3592 |
// Session context |
|
3593 |
protected: |
|
3594 |
DMMCSession* iSessionP; |
|
3595 |
private: |
|
3596 |
// |
|
3597 |
// Bus control |
|
3598 |
TDSR iCurrentDSR; |
|
3599 |
// |
|
3600 |
// Stack data structures and Session/StateMachine miscellaneous |
|
3601 |
TUint iDeselectsToIssue; |
|
3602 |
TInt iCxDeselectCount; |
|
3603 |
TUint8 iCMD42CmdByte; |
|
3604 |
TMediaPassword iMPTgt; |
|
3605 |
public: |
|
3606 |
IMPORT_C TUint32 EffectiveModes(const TMMCStackConfig& aClientConfig); |
|
3607 |
TUint32 iCurrentOpRange; |
|
3608 |
TInt iCxCardCount; |
|
3609 |
TInt iCxPollRetryCount; |
|
3610 |
TMMCStackConfig iConfig; |
|
3611 |
TUint iMaxCardsInStack; |
|
3612 |
TMMCRCAPool iRCAPool; |
|
3613 |
TMMCardArray* iCardArray; |
|
3614 |
TMMCStackConfig iMasterConfig; |
|
3615 |
friend class DMMCSocket; |
|
3616 |
friend class DMMCSession; |
|
3617 |
friend class TMMCardArray; |
|
3618 |
||
3619 |
private: |
|
3620 |
// |
|
3621 |
// Dummy functions to maintain binary compatibility |
|
3622 |
IMPORT_C virtual void Dummy1(); |
|
3623 |
||
3624 |
protected: |
|
3625 |
/** |
|
3626 |
Gets an interface from a derived class |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3627 |
N.B the derived class should call the base class's default implementation of this function |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
3628 |
if it does not support the specified interface |
0 | 3629 |
replaces reserved virtual Dummy4() |
3630 |
*/ |
|
3631 |
IMPORT_C virtual void GetInterface(TInterfaceId aInterfaceId, MInterface*& aInterfacePtr); |
|
3632 |
||
3633 |
private: |
|
3634 |
TBusWidthAndClock iBusWidthAndClock; |
|
3635 |
TInt iSelectedCardIndex; |
|
3636 |
// |
|
3637 |
// Reserved members to maintain binary compatibility |
|
3638 |
protected: |
|
3639 |
TBool iMultiplexedBus; // ETrue if cards are individually selectable. EFalse if stacked on a common bus. |
|
3640 |
private: |
|
3641 |
TMMCCommandTypeEnum iYieldCommandType; |
|
3642 |
TInt iReserved; |
|
3643 |
||
3644 |
protected: |
|
3645 |
// Pointer to protected utility class which allows class to grow while maintining BC |
|
3646 |
// replaces fourth element of iReserved[] |
|
3647 |
class DBody; |
|
3648 |
friend class DBody; |
|
3649 |
DBody* iBody; |
|
3650 |
}; |
|
3651 |
||
3652 |
||
3653 |
||
3654 |
||
3655 |
class TMMCMachineInfo |
|
3656 |
/** |
|
3657 |
Platform-specific configuration information for the |
|
3658 |
MultiMediaCard stack. |
|
3659 |
||
3660 |
An object of this type is passed to the Variant implementation |
|
3661 |
of DMMCStack::MachineInfo(), which should fill the public data |
|
3662 |
members with appropriate information and values. |
|
3663 |
||
3664 |
@publishedPartner |
|
3665 |
@released |
|
3666 |
*/ |
|
3667 |
{ |
|
3668 |
||
3669 |
public: |
|
3670 |
enum THardwareConfig |
|
3671 |
{ |
|
3672 |
/** |
|
3673 |
Set this bit in iFlags if hardware supports SPI mode (not currently supported - set this bit to zero) |
|
3674 |
*/ |
|
3675 |
ESupportsSPIMode = 0x01, |
|
3676 |
||
3677 |
/** |
|
3678 |
Set this bit in iFlags if the PSL is enabled for double-buffered data transfers |
|
3679 |
*/ |
|
3680 |
ESupportsDoubleBuffering = 0x02, |
|
3681 |
||
3682 |
/** |
|
3683 |
Set this bit in iFlags if the PSL supports response type R7 |
|
3684 |
*/ |
|
3685 |
ESupportsR7 = 0x04, |
|
3686 |
||
3687 |
/** |
|
3688 |
Set this bit in iFlags if the hardware DMA controller utilises 8-Bit Addressing |
|
3689 |
*/ |
|
3690 |
EDma8BitAddressing = 0x08, |
|
3691 |
||
3692 |
/** |
|
3693 |
Set this bit in iFlags if the hardware DMA controller utilises 16-Bit Addressing |
|
3694 |
*/ |
|
3695 |
EDma16BitAddressing = 0x10, |
|
3696 |
||
3697 |
/** |
|
3698 |
Set this bit in iFlags if the hardware DMA controller utilises 32-Bit Addressing |
|
3699 |
*/ |
|
3700 |
EDma32BitAddressing = 0x20, |
|
3701 |
||
3702 |
/** |
|
3703 |
Set this bit in iFlags if the hardware DMA controller utilises 64-Bit Addressing |
|
3704 |
*/ |
|
3705 |
EDma64BitAddressing = 0x40, |
|
3706 |
||
3707 |
/** |
|
3708 |
Set this in iFlags if the hardware supports DMA and can cope with being given a physical address. |
|
3709 |
This also sets the ESupportsDoubleBuffering flag, physical addressing is dependent on |
|
3710 |
doublebuffering functionality. |
|
3711 |
@see ESupportsDoubleBuffering |
|
3712 |
@see KMMCCmdFlagPhysAddr flag |
|
3713 |
*/ |
|
3714 |
ESupportsDMA = 0x082, |
|
3715 |
||
3716 |
/** |
|
3717 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 256K |
|
3718 |
- Transfers greater than 256K will be split into multiple transactions. |
|
3719 |
*/ |
|
3720 |
EMaxTransferLength_256K = 0x100, |
|
3721 |
||
3722 |
/** |
|
3723 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 512K |
|
3724 |
- Transfers greater than 512K will be split into multiple transactions. |
|
3725 |
*/ |
|
3726 |
EMaxTransferLength_512K = 0x200, |
|
3727 |
||
3728 |
/** |
|
3729 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 1M |
|
3730 |
- Transfers greater than 1M will be split into multiple transactions. |
|
3731 |
*/ |
|
3732 |
EMaxTransferLength_1M = 0x300, |
|
3733 |
||
3734 |
/** |
|
3735 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 2M |
|
3736 |
- Transfers greater than 2M will be split into multiple transactions. |
|
3737 |
*/ |
|
3738 |
EMaxTransferLength_2M = 0x400, |
|
3739 |
||
3740 |
/** |
|
3741 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 4M |
|
3742 |
- Transfers greater than 4M will be split into multiple transactions. |
|
3743 |
*/ |
|
3744 |
EMaxTransferLength_4M = 0x500, |
|
3745 |
||
3746 |
/** |
|
3747 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 8M |
|
3748 |
- Transfers greater than 8M will be split into multiple transactions. |
|
3749 |
*/ |
|
3750 |
EMaxTransferLength_8M = 0x600, |
|
3751 |
||
3752 |
/** |
|
3753 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 16M |
|
3754 |
- Transfers greater than 16M will be split into multiple transactions. |
|
3755 |
*/ |
|
3756 |
EMaxTransferLength_16M = 0x700, |
|
3757 |
||
3758 |
/** |
|
3759 |
The card in slot 1 is internal, i.e. not removable |
|
3760 |
*/ |
|
3761 |
ESlot1Internal = 0x0800, |
|
3762 |
||
3763 |
/** |
|
3764 |
The card in slot 2 is internal, i.e. not removable |
|
3765 |
*/ |
|
3766 |
ESlot2Internal = 0x1000, |
|
3767 |
}; |
|
3768 |
||
3769 |
public: |
|
3770 |
/** |
|
3771 |
The total number of MultiMediaCard slots for this stack. |
|
3772 |
||
3773 |
Be aware that this refers to the stack, and NOT to the platform; |
|
3774 |
a platform can have multiple stacks. |
|
3775 |
*/ |
|
3776 |
TInt iTotalSockets; |
|
3777 |
||
3778 |
/** |
|
3779 |
Not currently used. |
|
3780 |
||
3781 |
Set this value to zero. |
|
3782 |
*/ |
|
3783 |
TInt iTotalMediaChanges; |
|
3784 |
||
3785 |
/** |
|
3786 |
Not currently used. |
|
3787 |
||
3788 |
Set this value to zero. |
|
3789 |
*/ |
|
3790 |
TInt iTotalPrimarySupplies; |
|
3791 |
||
3792 |
union |
|
3793 |
{ |
|
3794 |
/** |
|
3795 |
Indicates whether the SPI protocol is being used or not. |
|
3796 |
||
3797 |
SPI not currently supported; set this to EFalse. |
|
3798 |
*/ |
|
3799 |
TBool iSPIMode; // SPI mode not yet supported |
|
3800 |
/** |
|
3801 |
Hardware configuration flags |
|
3802 |
*/ |
|
3803 |
TUint32 iFlags; |
|
3804 |
}; |
|
3805 |
||
3806 |
/** |
|
3807 |
The number of the first peripheral bus slot claimed by the |
|
3808 |
MultiMediaCard controller. |
|
3809 |
||
3810 |
Symbian OS supports 4, so set this to a value in the range 0-3. |
|
3811 |
*/ |
|
3812 |
TInt iBaseBusNumber; |
|
3813 |
}; |
|
3814 |
||
3815 |
||
3816 |
||
3817 |
||
3818 |
typedef TPckg<TMMCMachineInfo> TMMCardMachineInfoPckg; |
|
3819 |
||
3820 |
/** |
|
3821 |
Platform-specific configuration information for the |
|
3822 |
MultiMediaCard stack. Contains information pertinent to |
|
3823 |
MMC specification version 4.0/4.1 |
|
3824 |
||
3825 |
An object of this type is passed to the Variant implementation |
|
3826 |
of DMMCStack::MachineInfo(), which should fill the public data |
|
3827 |
members with appropriate information and values. |
|
3828 |
||
3829 |
@internalComponent |
|
3830 |
*/ |
|
3831 |
class TMMCMachineInfoV4 : public TMMCMachineInfo |
|
3832 |
{ |
|
3833 |
public: |
|
3834 |
inline TMMCMachineInfoV4() {memclr(this, sizeof(*this));} |
|
3835 |
||
3836 |
/** |
|
3837 |
The version of the structure returned by the PSL in a call to DMMStack::MachineInfo() |
|
3838 |
The fields defined in TMMCMachineInfoV4 are only valid if the version is EVersion4 or higher |
|
3839 |
*/ |
|
3840 |
enum TVersion {EVersion3, EVersion4}; |
|
3841 |
TVersion iVersion; |
|
3842 |
||
3843 |
/** |
|
3844 |
The maximum bus width supported. |
|
3845 |
*/ |
|
3846 |
TBusWidth iMaxBusWidth; |
|
3847 |
||
3848 |
/** |
|
3849 |
Maximum clock frequency supported, |
|
3850 |
N.B. if the controller's maximum clock rate is only slightly less than one of the |
|
3851 |
"high-speed" clock frequencies defined in MMC spec 4.0 (i.e 26 Mhz and 52 Mhz), then |
|
3852 |
it can still report that it is supported and then run at the slightly lower clock rate. |
|
3853 |
*/ |
|
3854 |
enum THighSpeedClocks {EClockSpeed26Mhz = 26, EClockSpeed52Mhz = 52}; |
|
3855 |
TUint iMaxClockSpeedInMhz; |
|
3856 |
||
3857 |
/** |
|
3858 |
The power class supported for 3.6V (high voltage). |
|
3859 |
This is a 4-bit value encoded in the same way as the POWER_CLASS field in the EXT_CSD |
|
3860 |
register. i.e. 0=100mA, 1=120mA, ... 10=450mA. |
|
3861 |
See MMC sepcification version 4.1, EXT_CSD register. |
|
3862 |
*/ |
|
3863 |
enum THiVoltagePowerClasses {EHi100mA, EHi120mA, EHi150mA, EHi180mA, EHi200mA, EHi220mA, EHi250mA, EHi300mA, EHi350mA, EHi400mA, EHi450mA }; |
|
3864 |
TUint iHighVoltagePowerClass; |
|
3865 |
||
3866 |
/** |
|
3867 |
The power class supported for 1.95V (low voltage). |
|
3868 |
This is a 4-bit value encoded in the same way as the POWER_CLASS field in the EXT_CSD |
|
3869 |
register. i.e. 0=65mA, 1=70mA, ... 10=250mA. |
|
3870 |
See MMC sepcification version 4.1, EXT_CSD register. |
|
3871 |
*/ |
|
3872 |
enum TLoVoltagePowerClasses {ELo065mA, ELo070mA, ELo080mA, ELo090mA, ELo100mA, ELo120mA, ELo140mA, ELo160mA, ELo180mA, ELo200mA, ELo250mA }; |
|
3873 |
TUint iLowVoltagePowerClass; |
|
3874 |
}; |
|
3875 |
||
3876 |
||
3877 |
class DMMCPsu : public DPBusPsuBase |
|
3878 |
/** |
|
3879 |
DPBusPsuBase derived abstract class to control the MMC socket's power supply. |
|
3880 |
||
3881 |
This class is intended for derivation at the variant layer, which handles the |
|
3882 |
variant specific functionality of the power supply. |
|
3883 |
||
3884 |
@publishedPartner |
|
3885 |
@released |
|
3886 |
*/ |
|
3887 |
{ |
|
3888 |
public: |
|
3889 |
IMPORT_C DMMCPsu(TInt aPsuNum, TInt aMediaChangedNum); |
|
3890 |
||
3891 |
// Re-declaring virtual and pure-virtual interface defined in DPBusPsuBase for clarity... |
|
3892 |
||
3893 |
IMPORT_C virtual TInt DoCreate(); |
|
3894 |
||
3895 |
/** |
|
3896 |
* Controls the power supply. |
|
3897 |
* Implemented by the variant, directly controls the power to the MMC stack. |
|
3898 |
* @param aState A TPBusPsuState enumeration specifying the required state |
|
3899 |
* (EPsuOnFull, EPsuOff, EPsuOnCurLimit) |
|
3900 |
*/ |
|
3901 |
virtual void DoSetState(TPBusPsuState aState)=0; |
|
3902 |
||
3903 |
/** |
|
3904 |
* Checks the PSU's voltage. |
|
3905 |
* Implemented by the variant, uses a mechanism such as a comparator to check |
|
3906 |
* the PSU's voltage level. Upon reciept of the voltage level (the process may |
|
3907 |
* be asynchronous), the variant calls ReceiveVoltageCheckResult() with KErrNone |
|
3908 |
* if the voltage is OK, KErrGeneral if there is a problem, or KErrNotReady if the |
|
3909 |
* hardware has not yet powered up. |
|
3910 |
*/ |
|
3911 |
virtual void DoCheckVoltage()=0; |
|
3912 |
||
3913 |
/** |
|
3914 |
* Fills in the supplied TPBusPsuInfo object with the characteristics of the platform. |
|
3915 |
* Provided at the variant layer. |
|
3916 |
* @param anInfo A reference to a TPBusPsuInfo to be filled in with the PSU characteristics. |
|
3917 |
*/ |
|
3918 |
virtual void PsuInfo(TPBusPsuInfo &anInfo)=0; |
|
3919 |
||
3920 |
inline void SetVoltage(TUint32 aVoltage); |
|
3921 |
||
3922 |
static void SleepCheck(TAny* aPtr); |
|
3923 |
||
3924 |
protected: |
|
3925 |
/** |
|
3926 |
* The current voltage setting, in OCR register format |
|
3927 |
*/ |
|
3928 |
TUint32 iVoltageSetting; |
|
3929 |
}; |
|
3930 |
||
3931 |
class DMMCMediaChange : public DMediaChangeBase |
|
3932 |
/** |
|
3933 |
DMediaChangeBase derived abstract class to handle the isertion and removal of removable media. |
|
3934 |
||
3935 |
This class is intended for derivation at the variant layer, which handles the variant specific |
|
3936 |
functionality such as interrupt detection, and calls functions of the DMediaChangeBase class |
|
3937 |
to pass notifications of media change to the socket layers. |
|
3938 |
||
3939 |
@publishedPartner |
|
3940 |
@released |
|
3941 |
*/ |
|
3942 |
{ |
|
3943 |
public: |
|
3944 |
IMPORT_C DMMCMediaChange(TInt aMediaChangeNum); |
|
3945 |
||
3946 |
// Re-declaring virtual and pure-virtual interface defined in DMediaChangeBase for clarity... |
|
3947 |
||
3948 |
IMPORT_C virtual TInt Create(); |
|
3949 |
||
3950 |
/** |
|
3951 |
* Forces a media change, executing the same actions as if a door open has occurred. |
|
3952 |
* @see DoDoorOpen |
|
3953 |
*/ |
|
3954 |
virtual void ForceMediaChange()=0; |
|
3955 |
||
3956 |
/** |
|
3957 |
* Called by DMediaChangeBase when the door is opened. |
|
3958 |
* Implemented at the variant layer, DoDoorOpen is invoked in response to the variant |
|
3959 |
* calling ::DoDoorOpenService upon detection of a door open event. |
|
3960 |
* DoDoorOpen may queue a debounce timer which masks further events until it expires. |
|
3961 |
* @see DoDoorClosed |
|
3962 |
*/ |
|
3963 |
virtual void DoDoorOpen()=0; |
|
3964 |
||
3965 |
/** |
|
3966 |
* Called by DMediaChangeBase when the door is closed. |
|
3967 |
* Implemented at the variant layer, DoDoorClosed is invoked in response to the variant |
|
3968 |
* calling ::DoorOpenService upon detection of a door closed event. |
|
3969 |
* Systems without a door should perform this sequence when the debounce timer has |
|
3970 |
* expired after a door open event has been detected. |
|
3971 |
* @see DoDoorOpen |
|
3972 |
*/ |
|
3973 |
virtual void DoDoorClosed()=0; |
|
3974 |
||
3975 |
/** |
|
3976 |
* Returns the current state of the door. |
|
3977 |
* Implemented at the variant layer to provide information as to the state of the door. |
|
3978 |
* @return TMediaState enumeration descibing the state of door (EDoorOpen, EDoorClosed). |
|
3979 |
*/ |
|
3980 |
virtual TMediaState MediaState() = 0; |
|
3981 |
}; |
|
3982 |
||
3983 |
||
3984 |
/*===========================================================================*/ |
|
3985 |
/* CLASS : DMMCEmbeddedMediaChange */ |
|
3986 |
/*===========================================================================*/ |
|
3987 |
NONSHARABLE_CLASS(DMMCEmbeddedMediaChange) : public DMMCMediaChange |
|
3988 |
/** |
|
3989 |
* This class looks after the processing to be carried out when the media door |
|
3990 |
* is opened or closed. It may be queried without the interrupt being enabled. |
|
3991 |
* |
|
3992 |
*/ |
|
3993 |
{ |
|
3994 |
public: |
|
3995 |
DMMCEmbeddedMediaChange(TInt aMediaChangeNum) : DMMCMediaChange(aMediaChangeNum){}; |
|
3996 |
||
3997 |
/// Directly calls the media change event |
|
3998 |
virtual void ForceMediaChange() {return;}; |
|
3999 |
||
4000 |
/// Handle media door open (called on media door open interrupt). |
|
4001 |
virtual void DoDoorOpen() {return;}; |
|
4002 |
||
4003 |
/// Handle media door closing (called on media door open interrupt). |
|
4004 |
virtual void DoDoorClosed() {return;}; |
|
4005 |
||
4006 |
/// Return status of media changed signal. |
|
4007 |
virtual TMediaState MediaState() {return EDoorClosed;}; |
|
4008 |
}; |
|
4009 |
||
4010 |
||
4011 |
||
4012 |
class TMapping |
|
4013 |
/** |
|
4014 |
MMC Mapping |
|
4015 |
*/ |
|
4016 |
{ |
|
4017 |
public: |
|
4018 |
TBuf8<KMMCCIDLength> iCID; |
|
4019 |
TMediaPassword iPWD; |
|
4020 |
enum TState {EStPending, EStValid, EStInvalid}; |
|
4021 |
TState iState; |
|
4022 |
}; |
|
4023 |
||
4024 |
NONSHARABLE_CLASS(TMMCPasswordStore) : public TPasswordStore |
|
4025 |
/** |
|
4026 |
MMC Password Store |
|
4027 |
*/ |
|
4028 |
{ |
|
4029 |
public: |
|
4030 |
TMMCPasswordStore(); |
|
4031 |
||
4032 |
// Pure virtual... |
|
4033 |
TInt Init(); |
|
4034 |
TInt ReadPasswordData(TDes8 &aBuf); |
|
4035 |
TInt WritePasswordData(TDesC8 &aBuf); |
|
4036 |
TInt PasswordStoreLengthInBytes(); |
|
4037 |
||
4038 |
public: |
|
4039 |
TMapping *FindMappingInStore(const TCID &aCID); |
|
4040 |
TInt InsertMapping(const TCID &aCID, const TMediaPassword &aPWD, TMapping::TState aState); |
|
4041 |
IMPORT_C TBool IsMappingIncorrect(const TCID& aCID, const TMediaPassword& aPWD); |
|
4042 |
||
4043 |
static TInt CompareCID(const TMapping& aLeft, const TMapping& aRight); |
|
4044 |
TIdentityRelation<TMapping> iIdentityRelation; |
|
4045 |
||
4046 |
private: |
|
4047 |
RArray<TMapping> *iStore; |
|
4048 |
||
4049 |
friend class DMMCSocket; |
|
4050 |
}; |
|
4051 |
||
4052 |
class DMMCSocket : public DPBusSocket |
|
4053 |
/** |
|
4054 |
This DPBusSocket derived object oversees the power supplies |
|
4055 |
and media change functionality of DMMCStack Objects. A socket |
|
4056 |
directly corresponds to a single stack, which may support multiple cards. |
|
4057 |
||
4058 |
@publishedPartner |
|
4059 |
@released |
|
4060 |
*/ |
|
4061 |
{ |
|
4062 |
public: |
|
4063 |
IMPORT_C DMMCSocket(TInt aSocketNumber, TMMCPasswordStore* aPasswordStore); |
|
4064 |
||
4065 |
// Functions inherited from DPBusSocket |
|
4066 |
virtual TInt Init(); |
|
4067 |
virtual void InitiatePowerUpSequence(); |
|
4068 |
virtual TBool CardIsPresent(); |
|
4069 |
virtual void Reset1(); |
|
4070 |
virtual void Reset2(); |
|
4071 |
||
4072 |
TInt TotalSupportedCards(); |
|
4073 |
||
4074 |
// MMC specific functions |
|
4075 |
inline DMMCStack* Stack(TInt aBus); |
|
4076 |
inline void ResetInactivity(TInt aBus); |
|
4077 |
inline const TMMCMachineInfo& MachineInfo() const; |
|
4078 |
||
4079 |
virtual void AdjustPartialRead(const TMMCard* aCard, TUint32 aStart, TUint32 aEnd, TUint32* aPhysStart, TUint32* aPhysEnd) const; |
|
4080 |
virtual void GetBufferInfo(TUint8** aMDBuf, TInt* aMDBufLen); |
|
4081 |
virtual TInt PrepareStore(TInt aBus, TInt aFunc, TLocalDrivePasswordData &aData); |
|
4082 |
||
4083 |
inline TBool SupportsDoubleBuffering(); |
|
4084 |
inline TUint32 MaxDataTransferLength(); |
|
4085 |
inline TUint32 DmaAlignment(); |
|
4086 |
||
4087 |
protected: |
|
4088 |
// MMC specific functions |
|
4089 |
virtual void GetMachineInfo(); |
|
4090 |
||
4091 |
private: |
|
4092 |
// Password Store Control Functions |
|
4093 |
TInt PasswordControlStart(const TCID &aCID, const TMediaPassword *aPWD); |
|
4094 |
void PasswordControlEnd(DMMCSession *aSessP, TInt aResult); |
|
4095 |
TBool RefreshStore(); |
|
4096 |
||
4097 |
protected: |
|
4098 |
TMMCMachineInfo iMachineInfo; |
|
4099 |
TMMCPasswordStore* iPasswordStore; |
|
4100 |
||
4101 |
public: |
|
4102 |
DMMCStack* iStack; |
|
4103 |
DMMCPsu* iVccCore; |
|
4104 |
||
4105 |
private: |
|
4106 |
TUint32 iReserved[4]; |
|
4107 |
||
4108 |
public: |
|
4109 |
enum TMMCPanic |
|
4110 |
{ |
|
4111 |
EMMCMachineStack =0, |
|
4112 |
EMMCMachineState =1, |
|
4113 |
EMMCSessRingNoSession =2, |
|
4114 |
EMMCStackSessionEngaged =3, |
|
4115 |
EMMCInitStackBlocked =4, |
|
4116 |
EMMCNoFreeRCA =5, |
|
4117 |
EMMCCommandStack =6, |
|
4118 |
EMMCRWSessionID =7, |
|
4119 |
EMMCEraseSessionID =8, |
|
4120 |
EMMCIOSessionID =9, |
|
4121 |
EMMCSessionNoPswdCard =10, |
|
4122 |
EMMCSessionPswdCmd =11, |
|
4123 |
EMMCSessionBadSessionID =12, |
|
4124 |
EMMCSetBusWidthNotImplemented =13, |
|
4125 |
EMMCInvalidNumberOfCardSlots =14, |
|
4126 |
EMMCBadBusWidth =15, |
|
4127 |
EMMCInvalidDBCommand =16, |
|
4128 |
EMMCInvalidDBBlockLength =17, |
|
4129 |
EMMCUnblockingInWrongContext =18, |
|
4130 |
EMMCInvalidCardNumber =19, |
|
4131 |
EMMCNotInDfcContext =20, |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
4132 |
EMMCAddressCardNotSupported =21, |
0 | 4133 |
}; |
4134 |
IMPORT_C static void Panic(TMMCPanic aPanic); |
|
4135 |
friend class DMMCStack; |
|
4136 |
friend class DMMCSession; |
|
4137 |
friend class DMMCMediaChange; |
|
4138 |
}; |
|
4139 |
||
4140 |
const TUint32 KMMCEraseClassCmdsSupported= KBit0; |
|
4141 |
const TUint32 KMMCEraseGroupCmdsSupported= KBit1; |
|
4142 |
NONSHARABLE_CLASS(TMMCEraseInfo) |
|
4143 |
{ |
|
4144 |
public: |
|
4145 |
inline TBool EraseClassCmdsSupported() const; |
|
4146 |
inline TBool EraseGroupCmdsSupported() const; |
|
4147 |
public: |
|
4148 |
TUint32 iEraseFlags; |
|
4149 |
TUint32 iPreferredEraseUnitSize; |
|
4150 |
TUint32 iMinEraseSectorSize; |
|
4151 |
}; |
|
4152 |
||
4153 |
#include <drivers/mmc.inl> |
|
4154 |
||
4155 |
#endif // __MMC_H__ |
|
4156 |