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,
|
|
1543 |
EHighSpeedCard52Mhz = 0x02
|
|
1544 |
};
|
|
1545 |
|
|
1546 |
/**
|
|
1547 |
This enum defines the boot config encoding used by the BOOT_CONFIG field
|
|
1548 |
*/
|
|
1549 |
enum TExtCSDBootConfig
|
|
1550 |
{
|
|
1551 |
ESelectUserArea = 0x00,
|
|
1552 |
ESelectBootPartition1 = 0x01,
|
|
1553 |
ESelectBootPartition2 = 0x02,
|
|
1554 |
EEnableBootPartition1forBoot = 0x08,
|
|
1555 |
EEnableBootPartition2forBoot = 0x10,
|
|
1556 |
EEnableUserAreaforBoot = 0x38,
|
|
1557 |
EEnableBootAck = 0x40
|
|
1558 |
};
|
|
1559 |
|
|
1560 |
/**
|
|
1561 |
This enum defines the Boot Bus Width encoding used by the BOOT_BUS_WIDTH field
|
|
1562 |
*/
|
|
1563 |
enum TExtCSDBootBusWidth
|
|
1564 |
{
|
|
1565 |
EBootBusWidth1Bit = 0x00,
|
|
1566 |
EBootBusWidth4Bit = 0x01,
|
|
1567 |
EBootBusWidth8Bit = 0x02,
|
|
1568 |
EResetBusWidthafterBoot = 0x08
|
|
1569 |
};
|
|
1570 |
|
|
1571 |
/**
|
|
1572 |
This enum defines the Erase Group Definition encoding
|
|
1573 |
used by the ERASE_GROUP_DEF field
|
|
1574 |
*/
|
|
1575 |
enum TExtCSDEraseGroupDef
|
|
1576 |
{
|
|
1577 |
|
|
1578 |
EEraseGrpDefEnableOldSizes = 0x00,
|
|
1579 |
EEraseGrpDefEnableHighCapSizes = 0x01
|
|
1580 |
};
|
|
1581 |
|
|
1582 |
public:
|
|
1583 |
/** Default constructor */
|
|
1584 |
inline TExtendedCSD();
|
|
1585 |
/**
|
|
1586 |
Constructor
|
|
1587 |
@param aPtr a byte buffer containing the contents of the register
|
|
1588 |
*/
|
|
1589 |
inline TExtendedCSD(const TUint8* aPtr);
|
|
1590 |
/**
|
|
1591 |
Copy constructor
|
|
1592 |
@param aCSD a reference to another instance of the same class
|
|
1593 |
*/
|
|
1594 |
inline TExtendedCSD& operator=(const TExtendedCSD& aCSD);
|
|
1595 |
/**
|
|
1596 |
Copy constructor
|
|
1597 |
@param aPtr a byte buffer containing the contents of the register
|
|
1598 |
*/
|
|
1599 |
inline TExtendedCSD& operator=(const TUint8* aPtr);
|
|
1600 |
|
|
1601 |
/** Returns the byte at a particular offset into the register
|
|
1602 |
@param anIndex the offset into the register
|
|
1603 |
*/
|
|
1604 |
inline TUint8 At(TUint anIndex) const;
|
|
1605 |
|
|
1606 |
/** returns a pointer to the raw data */
|
|
1607 |
inline TUint8* Ptr();
|
|
1608 |
|
|
1609 |
/**
|
|
1610 |
Constructs and then returns a TMMCArgument which can be used to
|
|
1611 |
write to the register using the SWITCH command (CMD6)
|
|
1612 |
@param aAccess specifies how the register or command set is to be modified.
|
|
1613 |
@param aIndex the offset into the register
|
|
1614 |
@param aValue the value to write to the field in the register
|
|
1615 |
@param aCmdSet The command set to write. Valid if aAccess = ECmdSet
|
|
1616 |
*/
|
|
1617 |
inline static TMMCArgument GetWriteArg(TExtCSDAccessBits aAccess, TExtCSDModesFieldIndex aIndex, TUint aValue, TUint aCmdSet);
|
|
1618 |
|
|
1619 |
/** returns the contents of the CMD_SET field */
|
|
1620 |
inline TUint SupportedCmdSet() const;
|
|
1621 |
|
|
1622 |
/** returns the contents of the SEC_COUNT field */
|
|
1623 |
inline TUint SectorCount() const;
|
|
1624 |
|
|
1625 |
/** returns the contents of the MIN_PERF_W_8_52 field */
|
|
1626 |
inline TUint MinPerfWrite8Bit52Mhz() const;
|
|
1627 |
|
|
1628 |
/** returns the contents of the MIN_PERF_R_8_52 field */
|
|
1629 |
inline TUint MinPerfRead8Bit52Mhz() const;
|
|
1630 |
|
|
1631 |
/** returns the contents of the MIN_PERF_W_8_26_4_52 field */
|
|
1632 |
inline TUint MinPerfWrite8Bit26Mhz_4Bit52Mhz() const;
|
|
1633 |
|
|
1634 |
/** returns the contents of the MIN_PERF_R_8_26_4_52 field */
|
|
1635 |
inline TUint MinPerfRead8Bit26Mhz_4Bit52Mhz() const;
|
|
1636 |
|
|
1637 |
/** returns the contents of the MIN_PERF_W_4_26 field */
|
|
1638 |
inline TUint MinPerfWrite4Bit26Mhz() const;
|
|
1639 |
|
|
1640 |
/** returns the contents of the MIN_PERF_R_4_26 field */
|
|
1641 |
inline TUint MinPerfRead4Bit26Mhz() const;
|
|
1642 |
|
|
1643 |
/** returns the contents of the PWR_CL_26_360 field */
|
|
1644 |
inline TUint PowerClass26Mhz360V() const;
|
|
1645 |
|
|
1646 |
/** returns the contents of the PWR_CL_52_360 field */
|
|
1647 |
inline TUint PowerClass52Mhz360V() const;
|
|
1648 |
|
|
1649 |
/** returns the contents of the PWR_CL_26_195 field */
|
|
1650 |
inline TUint PowerClass26Mhz195V() const;
|
|
1651 |
|
|
1652 |
/** returns the contents of the PWR_CL_52_195 field */
|
|
1653 |
inline TUint PowerClass52Mhz195V() const;
|
|
1654 |
|
|
1655 |
/** returns the contents of the CARD_TYPE field */
|
|
1656 |
inline TUint CardType() const;
|
|
1657 |
|
|
1658 |
/** returns the contents of the CSD_STRUCTURE field */
|
|
1659 |
inline TUint CSDStructureVer() const;
|
|
1660 |
|
|
1661 |
/** returns the contents of the EXT_CSD_REV field */
|
|
1662 |
inline TUint ExtendedCSDRev() const;
|
|
1663 |
|
|
1664 |
/** returns the contents of the CMD_SET field */
|
|
1665 |
inline TUint CmdSet() const;
|
|
1666 |
|
|
1667 |
/** returns the contents of the CMD_SET_REV field */
|
|
1668 |
inline TUint CmdSetRev() const;
|
|
1669 |
|
|
1670 |
/** returns the contents of the POWER_CLASS field */
|
|
1671 |
inline TUint PowerClass() const;
|
|
1672 |
|
|
1673 |
/** returns the contents of the HS_TIMING field */
|
|
1674 |
inline TUint HighSpeedTiming() const;
|
|
1675 |
|
|
1676 |
/** returns the contents of the BUS_WIDTH field */
|
|
1677 |
inline TUint BusWidthMode() const;
|
|
1678 |
|
|
1679 |
/** returns the contents of the BOOT_CONFIG field */
|
|
1680 |
inline TUint BootConfig() const;
|
|
1681 |
|
|
1682 |
/** returns the contents of the BOOT_BUS_WIDTH field */
|
|
1683 |
inline TUint BootBusWidth() const;
|
|
1684 |
|
|
1685 |
/** returns the contents of the ERASE_GROUP_DEF field */
|
|
1686 |
inline TUint EraseGroupDef() const;
|
|
1687 |
|
|
1688 |
/** returns the contents of the ACC_SIZE field */
|
|
1689 |
inline TUint AccessSize() const;
|
|
1690 |
|
|
1691 |
/** returns the contents of the HC_ERASE_GRP_SIZE field */
|
|
1692 |
inline TUint HighCapacityEraseGroupSize() const;
|
|
1693 |
|
|
1694 |
/** returns the contents of the BOOT_INFO field */
|
|
1695 |
inline TUint BootInfo() const;
|
|
1696 |
|
|
1697 |
/** returns the contents of the BOOT_SIZE_MUTLI field */
|
|
1698 |
inline TUint BootSizeMultiple() const;
|
|
1699 |
|
|
1700 |
/** returns the contents of the ERASE_TIMEOUT_MULT field */
|
|
1701 |
inline TUint EraseTimeoutMultiple() const;
|
|
1702 |
|
|
1703 |
/** returns the contents of the REL_WR_SEC_C field */
|
|
1704 |
inline TUint ReliableWriteSector() const;
|
|
1705 |
|
|
1706 |
/** returns the contents of the HC_WP_GRP_SIZE field */
|
|
1707 |
inline TUint HighCapacityWriteProtectGroupSize() const;
|
|
1708 |
|
|
1709 |
/** returns the contents of the S_C_VCC field */
|
|
1710 |
inline TUint SleepCurrentVcc() const;
|
|
1711 |
|
|
1712 |
/** returns the contents of the S_C_VCCQ field */
|
|
1713 |
inline TUint SleepCurrentVccQ() const;
|
|
1714 |
|
|
1715 |
/** returns the contents of the S_A_TIMEOUT field */
|
|
1716 |
inline TUint SleepAwakeTimeout() const;
|
|
1717 |
|
|
1718 |
private:
|
|
1719 |
/**
|
|
1720 |
@internalComponent little endian 512 byte field representing extended CSD
|
|
1721 |
*/
|
|
1722 |
TUint8 iData[KMMCExtendedCSDLength];
|
|
1723 |
};
|
|
1724 |
|
|
1725 |
|
|
1726 |
// 32 bit MMC card status field (response R1)
|
|
1727 |
|
|
1728 |
const TUint32 KMMCStatAppCmd= KBit5;
|
|
1729 |
const TUint32 KMMCStatSwitchError= KBit7;
|
|
1730 |
const TUint32 KMMCStatReadyForData= KBit8;
|
|
1731 |
const TUint32 KMMCStatCurrentStateMask= (KBit13-KBit9);
|
|
1732 |
const TUint32 KMMCStatEraseReset= KBit13;
|
|
1733 |
const TUint32 KMMCStatCardECCDisabled= KBit14;
|
|
1734 |
const TUint32 KMMCStatWPEraseSkip= KBit15;
|
|
1735 |
const TUint32 KMMCStatErrCSDOverwrite= KBit16;
|
|
1736 |
const TUint32 KMMCStatErrOverrun= KBit17;
|
|
1737 |
const TUint32 KMMCStatErrUnderrun= KBit18;
|
|
1738 |
const TUint32 KMMCStatErrUnknown= KBit19;
|
|
1739 |
const TUint32 KMMCStatErrCCError= KBit20;
|
|
1740 |
const TUint32 KMMCStatErrCardECCFailed= KBit21;
|
|
1741 |
const TUint32 KMMCStatErrIllegalCommand=KBit22;
|
|
1742 |
const TUint32 KMMCStatErrComCRCError= KBit23;
|
|
1743 |
const TUint32 KMMCStatErrLockUnlock= KBit24;
|
|
1744 |
const TUint32 KMMCStatCardIsLocked= KBit25;
|
|
1745 |
const TUint32 KMMCStatErrWPViolation= KBit26;
|
|
1746 |
const TUint32 KMMCStatErrEraseParam= KBit27;
|
|
1747 |
const TUint32 KMMCStatErrEraseSeqError= KBit28;
|
|
1748 |
const TUint32 KMMCStatErrBlockLenError= KBit29;
|
|
1749 |
const TUint32 KMMCStatErrAddressError= KBit30;
|
|
1750 |
const TUint32 KMMCStatErrOutOfRange= KBit31;
|
|
1751 |
|
|
1752 |
const TUint32 KMMCStatErrorMask= KMMCStatErrOutOfRange |
|
|
1753 |
KMMCStatErrAddressError |
|
|
1754 |
KMMCStatErrBlockLenError|
|
|
1755 |
KMMCStatErrEraseSeqError|
|
|
1756 |
KMMCStatErrEraseParam |
|
|
1757 |
KMMCStatErrWPViolation |
|
|
1758 |
KMMCStatErrLockUnlock |
|
|
1759 |
KMMCStatErrCardECCFailed|
|
|
1760 |
KMMCStatErrCCError |
|
|
1761 |
KMMCStatErrUnknown |
|
|
1762 |
KMMCStatErrUnderrun |
|
|
1763 |
KMMCStatErrOverrun |
|
|
1764 |
KMMCStatErrCSDOverwrite;
|
|
1765 |
|
|
1766 |
|
|
1767 |
const TUint32 KMMCStatClearByReadMask= KMMCStatErrOutOfRange |
|
|
1768 |
KMMCStatErrAddressError |
|
|
1769 |
KMMCStatErrBlockLenError|
|
|
1770 |
KMMCStatErrEraseSeqError|
|
|
1771 |
KMMCStatErrEraseParam |
|
|
1772 |
KMMCStatErrWPViolation |
|
|
1773 |
KMMCStatErrLockUnlock |
|
|
1774 |
KMMCStatErrCardECCFailed|
|
|
1775 |
KMMCStatErrCCError |
|
|
1776 |
KMMCStatErrUnknown |
|
|
1777 |
KMMCStatErrUnderrun |
|
|
1778 |
KMMCStatErrOverrun |
|
|
1779 |
KMMCStatErrCSDOverwrite |
|
|
1780 |
KMMCStatWPEraseSkip |
|
|
1781 |
KMMCStatEraseReset |
|
|
1782 |
KMMCStatAppCmd;
|
|
1783 |
|
|
1784 |
enum TMMCardStateEnum
|
|
1785 |
{
|
|
1786 |
ECardStateIdle = 0,
|
|
1787 |
ECardStateReady = (1 << 9),
|
|
1788 |
ECardStateIdent = (2 << 9),
|
|
1789 |
ECardStateStby = (3 << 9),
|
|
1790 |
ECardStateTran = (4 << 9),
|
|
1791 |
ECardStateData = (5 << 9),
|
|
1792 |
ECardStateRcv = (6 << 9),
|
|
1793 |
ECardStatePrg = (7 << 9),
|
|
1794 |
ECardStateDis = (8 << 9),
|
|
1795 |
ECardStateBtst = (9 << 9),
|
|
1796 |
ECardStateSlp = (10 << 9)
|
|
1797 |
};
|
|
1798 |
|
|
1799 |
class TMMCStatus
|
|
1800 |
/**
|
|
1801 |
MMC Status class.
|
|
1802 |
This class can be used to get the MMC card state machine and response status.
|
|
1803 |
For the details of MMC card state machine and command response refer to MMC card specification.
|
|
1804 |
|
|
1805 |
@see DMMCStack
|
|
1806 |
@publishedPartner
|
|
1807 |
@released
|
|
1808 |
*/
|
|
1809 |
{
|
|
1810 |
public:
|
|
1811 |
/**
|
|
1812 |
* Default constructor.
|
|
1813 |
*/
|
|
1814 |
inline TMMCStatus() {}
|
|
1815 |
inline TMMCStatus(const TUint8*);
|
|
1816 |
inline TMMCStatus(const TUint32&);
|
|
1817 |
inline operator TUint32() const;
|
|
1818 |
inline TUint32 Error() const;
|
|
1819 |
inline TMMCardStateEnum State() const;
|
|
1820 |
inline void UpdateState(TMMCardStateEnum aState);
|
|
1821 |
private:
|
|
1822 |
TUint32 iData; // 32 bit bitfield representing status register
|
|
1823 |
};
|
|
1824 |
|
|
1825 |
|
|
1826 |
|
|
1827 |
const TUint32 KMMCOCRBusy = KBit31; // OCR Busy Bit (Response R3)
|
|
1828 |
const TUint32 KMMCOCRAccessModeHCS = KBit30; // OCR Access Mode + SD HCS Bit (Response R3)
|
|
1829 |
const TUint32 KMMCOCRLowVoltage = KBit7; // 1.65 - 1.95 volt support
|
|
1830 |
const TUint32 KMMCOCRAccessModeMask = KBit30 | KBit29; // OCR Access Mode : [00 : Byte], [10 : Block]
|
|
1831 |
|
|
1832 |
|
|
1833 |
|
|
1834 |
/**
|
|
1835 |
Defines the bit value that can be used in TPBusPsuInfo::iVoltageSupported
|
|
1836 |
to indicate that the MultiMediaCard PSU supports voltage adjustment.
|
|
1837 |
|
|
1838 |
@publishedPartner
|
|
1839 |
@released
|
|
1840 |
*/
|
|
1841 |
#define KMMCAdjustableOpVoltage KMMCOCRBusy // Use same bit to flag ASSP PSU supports voltage adjustment.
|
|
1842 |
|
|
1843 |
|
|
1844 |
class TMMCArgument
|
|
1845 |
/**
|
|
1846 |
MMC Argument class
|
|
1847 |
|
|
1848 |
@publishedPartner
|
|
1849 |
@released
|
|
1850 |
*/
|
|
1851 |
{
|
|
1852 |
public:
|
|
1853 |
inline TMMCArgument();
|
|
1854 |
inline TMMCArgument(const TUint32&);
|
|
1855 |
inline TMMCArgument(TRCA);
|
|
1856 |
inline TMMCArgument(TDSR);
|
|
1857 |
inline operator TUint32() const;
|
|
1858 |
inline void SetRCA(TRCA);
|
|
1859 |
private:
|
|
1860 |
TUint32 iData; // 32 bit bitfield representing the argument
|
|
1861 |
};
|
|
1862 |
|
|
1863 |
|
|
1864 |
class TRCA
|
|
1865 |
/**
|
|
1866 |
MMC RCA (Relative Card Address) class
|
|
1867 |
*/
|
|
1868 |
{
|
|
1869 |
public:
|
|
1870 |
inline TRCA() {}
|
|
1871 |
inline TRCA(TUint16);
|
|
1872 |
inline TRCA(TInt);
|
|
1873 |
inline TRCA(TMMCArgument);
|
|
1874 |
inline operator TUint16() const;
|
|
1875 |
private:
|
|
1876 |
TUint16 iData; // 16 bit bitfield representing MultiMedia Card's RCA
|
|
1877 |
};
|
|
1878 |
|
|
1879 |
|
|
1880 |
class TDSR
|
|
1881 |
/**
|
|
1882 |
MMC DSR (Driver Stage Register) class
|
|
1883 |
*/
|
|
1884 |
{
|
|
1885 |
public:
|
|
1886 |
inline TDSR();
|
|
1887 |
inline TDSR(TUint16);
|
|
1888 |
inline operator TUint16() const;
|
|
1889 |
private:
|
|
1890 |
TUint16 iData; // 16 bit bitfield representing MultiMedia Card's DSR
|
|
1891 |
};
|
|
1892 |
|
|
1893 |
|
|
1894 |
// Card specific information and context
|
|
1895 |
|
|
1896 |
/**
|
|
1897 |
@publishedPartner
|
|
1898 |
@released
|
|
1899 |
*/
|
|
1900 |
const TUint32 KMMCardHasPassword= KBit0;
|
|
1901 |
|
|
1902 |
/**
|
|
1903 |
@publishedPartner
|
|
1904 |
@released
|
|
1905 |
*/
|
|
1906 |
const TUint32 KMMCardIsWriteProtected= KBit1;
|
|
1907 |
|
|
1908 |
/**
|
|
1909 |
@publishedPartner
|
|
1910 |
@released
|
|
1911 |
*/
|
|
1912 |
const TUint32 KMMCardIsLockable= KBit2;
|
|
1913 |
const TUint32 KMMCardIsHighCapacity= KBit3;
|
|
1914 |
const TUint32 KMMCardIsHighSpeed= KBit4;
|
|
1915 |
|
|
1916 |
const TUint32 KMMCardMMCFlagMask= 0x0000ffff;
|
|
1917 |
|
|
1918 |
const TUint32 KMMCardFirstCustomFlag= KBit16;
|
|
1919 |
const TUint32 KMMCardCustomFlagMask= 0xffff0000;
|
|
1920 |
|
|
1921 |
const TUint32 KMMCardHighCapBlockSize= 512;
|
|
1922 |
const TUint32 KMMCardHighCapBlockSizeLog2= 9;
|
|
1923 |
|
|
1924 |
NONSHARABLE_CLASS(TMMCard)
|
|
1925 |
/**
|
|
1926 |
MMC card class
|
|
1927 |
*/
|
|
1928 |
{
|
|
1929 |
public:
|
|
1930 |
inline TBool IsHighCapacity() const;
|
|
1931 |
|
|
1932 |
/** @publishedPartner
|
|
1933 |
@released */
|
|
1934 |
TMMCard();
|
|
1935 |
|
|
1936 |
/** @publishedPartner
|
|
1937 |
@released */
|
|
1938 |
inline TBool IsPresent() const;
|
|
1939 |
|
|
1940 |
/** @publishedPartner
|
|
1941 |
@released */
|
|
1942 |
IMPORT_C TBool IsReady() const;
|
|
1943 |
|
|
1944 |
/** @publishedPartner
|
|
1945 |
@released */
|
|
1946 |
IMPORT_C TBool IsLocked() const;
|
|
1947 |
|
|
1948 |
/** @publishedPartner
|
|
1949 |
@released */
|
|
1950 |
inline TMMCMediaTypeEnum MediaType() const;
|
|
1951 |
|
|
1952 |
/** @publishedPartner
|
|
1953 |
@released */
|
|
1954 |
inline TUint DeviceSize() const;
|
|
1955 |
|
|
1956 |
/** @publishedPartner
|
|
1957 |
@released */
|
|
1958 |
inline const TCID& CID() const;
|
|
1959 |
|
|
1960 |
/** @publishedPartner
|
|
1961 |
@released */
|
|
1962 |
inline const TCSD& CSD() const;
|
|
1963 |
|
|
1964 |
/** @publishedPartner
|
|
1965 |
@released */
|
|
1966 |
inline const TExtendedCSD& ExtendedCSD() const;
|
|
1967 |
|
|
1968 |
/** @publishedPartner
|
|
1969 |
@released */
|
|
1970 |
inline TRCA RCA() const;
|
|
1971 |
|
|
1972 |
/** @publishedPartner
|
|
1973 |
@released */
|
|
1974 |
inline TBool HasPassword() const;
|
|
1975 |
|
|
1976 |
/** @publishedPartner
|
|
1977 |
@released */
|
|
1978 |
inline TBool IsWriteProtected() const; // Always EFalse in MMC build
|
|
1979 |
|
|
1980 |
/** @publishedPartner
|
|
1981 |
@released */
|
|
1982 |
inline TInt BusWidth() const;
|
|
1983 |
|
|
1984 |
/** @publishedPartner
|
|
1985 |
@released */
|
|
1986 |
inline void SetBusWidth(TInt aBusWidth);
|
|
1987 |
|
|
1988 |
/** @internalTechnology */
|
|
1989 |
inline void SetHighSpeedClock(TUint32 aHighSpeedClock);
|
|
1990 |
|
|
1991 |
/** @internalTechnology */
|
|
1992 |
inline TUint32 HighSpeedClock() const;
|
|
1993 |
|
|
1994 |
/** @publishedPartner
|
|
1995 |
@released */
|
|
1996 |
virtual TUint32 PreferredWriteGroupLength() const;
|
|
1997 |
|
|
1998 |
/** @publishedPartner
|
|
1999 |
@released */
|
|
2000 |
virtual TInt GetFormatInfo(TLDFormatInfo& aFormatInfo) const;
|
|
2001 |
|
|
2002 |
/** @publishedPartner
|
|
2003 |
@released */
|
|
2004 |
virtual TUint32 MinEraseSectorSize() const;
|
|
2005 |
|
|
2006 |
/** @publishedPartner
|
|
2007 |
@released */
|
|
2008 |
virtual TUint32 EraseSectorSize() const;
|
|
2009 |
|
|
2010 |
virtual TUint MaxTranSpeedInKilohertz() const;
|
|
2011 |
|
|
2012 |
virtual TInt GetEraseInfo(TMMCEraseInfo& anEraseInfo) const;
|
|
2013 |
|
|
2014 |
/** @publishedPartner
|
|
2015 |
@released
|
|
2016 |
|
|
2017 |
Returns the maximum block length supported by the card encoded as a logarithm.
|
|
2018 |
This may be less than the READ_BL_LEN field in the CSD
|
|
2019 |
register depending on the type of card and it's capacity.
|
|
2020 |
*/
|
|
2021 |
virtual TInt MaxReadBlLen() const;
|
|
2022 |
|
|
2023 |
/** @publishedPartner
|
|
2024 |
@released
|
|
2025 |
|
|
2026 |
Returns the maximum write block length supported by the card encoded as a logarithm.
|
|
2027 |
This may be less than the WRITE_BL_LEN field in the CSD
|
|
2028 |
register depending on the type of card and it's capacity.
|
|
2029 |
*/
|
|
2030 |
virtual TInt MaxWriteBlLen() const;
|
|
2031 |
|
|
2032 |
/** @publishedPartner
|
|
2033 |
@released */
|
|
2034 |
virtual TInt64 DeviceSize64() const;
|
|
2035 |
|
|
2036 |
private:
|
|
2037 |
inline TInt Number() const;
|
|
2038 |
public:
|
|
2039 |
TInt iIndex;
|
|
2040 |
TMMCStatus iStatus; // last card's status
|
|
2041 |
TUint32 iSetBlockLen; // current block length set for the card
|
|
2042 |
TMMCCommandEnum iLastCommand; // Last Command code issued for the card
|
|
2043 |
TCID iCID;
|
|
2044 |
TCSD iCSD;
|
|
2045 |
TRCA iRCA;
|
|
2046 |
DMMCSession* iUsingSessionP; // session which has this card attached
|
|
2047 |
TUint32 iFlags;
|
|
2048 |
TExtendedCSD iExtendedCSD;
|
|
2049 |
private:
|
|
2050 |
TUint32 iHighSpeedClock;
|
|
2051 |
TInt iSpare[4];
|
|
2052 |
TInt iBusWidth;
|
|
2053 |
friend class DMMCStack;
|
|
2054 |
friend class TMMCardArray;
|
|
2055 |
};
|
|
2056 |
|
|
2057 |
class TMMCardArray
|
|
2058 |
/**
|
|
2059 |
MMC card array class
|
|
2060 |
*/
|
|
2061 |
{
|
|
2062 |
public:
|
|
2063 |
inline TMMCardArray(DMMCStack* anOwningStack);
|
|
2064 |
|
|
2065 |
/** @publishedPartner
|
|
2066 |
@released */
|
|
2067 |
IMPORT_C virtual TInt AllocCards();
|
|
2068 |
|
|
2069 |
void InitNewCardScan();
|
|
2070 |
|
|
2071 |
/** @publishedPartner
|
|
2072 |
@released */
|
|
2073 |
IMPORT_C void AddNewCard(const TUint8* aCID,TRCA* aNewRCA);
|
|
2074 |
|
|
2075 |
inline TUint NewCardCount();
|
|
2076 |
inline TInt CardsPresent();
|
|
2077 |
inline TMMCard* NewCardP(TUint aNewCardNumber);
|
|
2078 |
inline TMMCard* CardP(TUint aCardNumber);
|
|
2079 |
inline TMMCard& Card(TUint aCardNumber);
|
|
2080 |
inline TMMCard& NewCard(TUint aCardNumber);
|
|
2081 |
TInt MergeCards(TBool aFirstPass);
|
|
2082 |
void UpdateAcquisitions(TUint* aMaxClock);
|
|
2083 |
|
|
2084 |
/** @internalTechnology */
|
|
2085 |
TInt CardIndex(const TMMCard* aCard);
|
|
2086 |
|
|
2087 |
/** @publishedPartner
|
|
2088 |
@released */
|
|
2089 |
IMPORT_C virtual void DeclareCardAsGone(TUint aCardNumber);
|
|
2090 |
|
|
2091 |
protected: // initialized by AllocCards()
|
|
2092 |
void MoveCardAndLockRCA(TMMCard& aSrc,TMMCard& aDest,TInt aDestIndex);
|
|
2093 |
DMMCStack* iOwningStack;
|
|
2094 |
TInt iCardsPresent;
|
|
2095 |
TUint iNewCardsCount;
|
|
2096 |
TMMCard* iCards[KMaxMMCardsPerStack];
|
|
2097 |
TMMCard* iNewCards[KMaxMMCardsPerStack];
|
|
2098 |
};
|
|
2099 |
|
|
2100 |
// MMC Command descriptor
|
|
2101 |
|
|
2102 |
const TUint32 KMMCCmdFlagBytesValid= KBit0; // iBytesDone has a valid data
|
|
2103 |
const TUint32 KMMCCmdFlagTransStopped= KBit1; // CMD12 has been successfully issued
|
|
2104 |
const TUint32 KMMCCmdFlagStatusReceived=KBit2; // Raised by ASSP layer, cleared by ExecCommandSM()
|
|
2105 |
const TUint32 KMMCCmdFlagExecTopBusy= KBit3; // ExecCommandSM() flag
|
|
2106 |
const TUint32 KMMCCmdFlagExecSelBusy= KBit4; // ExecCommandSM() flag
|
|
2107 |
const TUint32 KMMCCmdFlagBlockAddress= KBit5; // Block addressing mode
|
|
2108 |
const TUint32 KMMCCmdFlagDMARamValid= KBit6; // Memory is DMA'able flag
|
|
2109 |
const TUint32 KMMCCmdFlagDoubleBuffer= KBit7; // The current DT command is double-buffered
|
|
2110 |
const TUint32 KMMCCmdFlagPhysAddr= KBit8; // Address is a physical address
|
|
2111 |
const TUint32 KMMCCmdFlagReliableWrite= KBit9; // Current command is Reliable Write
|
|
2112 |
|
|
2113 |
const TUint32 KMMCCmdFlagASSPFlags= KMMCCmdFlagBytesValid |
|
|
2114 |
KMMCCmdFlagTransStopped |
|
|
2115 |
KMMCCmdFlagStatusReceived;
|
|
2116 |
|
|
2117 |
|
|
2118 |
|
|
2119 |
|
|
2120 |
/**
|
|
2121 |
The MultiMediaCard command specification.
|
|
2122 |
|
|
2123 |
@publishedPartner
|
|
2124 |
@released
|
|
2125 |
*/
|
|
2126 |
class TMMCCommandSpec
|
|
2127 |
{
|
|
2128 |
public:
|
|
2129 |
/**
|
|
2130 |
The command class as defined by the MultiMediaCard System Specification.
|
|
2131 |
*/
|
|
2132 |
TUint32 iCommandClass;
|
|
2133 |
|
|
2134 |
/**
|
|
2135 |
The command type as defined by the MultiMediaCard System Specification.
|
|
2136 |
*/
|
|
2137 |
TMMCCommandTypeEnum iCommandType;
|
|
2138 |
|
|
2139 |
/**
|
|
2140 |
The data transfer direction.
|
|
2141 |
*/
|
|
2142 |
TMMCCmdDirEnum iDirection;
|
|
2143 |
|
|
2144 |
/**
|
|
2145 |
ETrue indicates more than one data block is to be tranferred.
|
|
2146 |
*/
|
|
2147 |
TBool iMultipleBlocks;
|
|
2148 |
|
|
2149 |
/**
|
|
2150 |
ETrue indicates use standard stop transmission mode.
|
|
2151 |
*/
|
|
2152 |
TBool iUseStopTransmission; // CMD12 has to be used in the end
|
|
2153 |
|
|
2154 |
/**
|
|
2155 |
The expected response type.
|
|
2156 |
|
|
2157 |
Note:
|
|
2158 |
|
|
2159 |
- if this is EResponseTypeNone, then no response is expected.
|
|
2160 |
- if this is ERespTypeR2, then a long (128-bit) response is expected.
|
|
2161 |
- for all other types, a standard (32-bit) response is expected.
|
|
2162 |
*/
|
|
2163 |
TMMCResponseTypeEnum iResponseType;
|
|
2164 |
|
|
2165 |
/**
|
|
2166 |
Expected response length (currently 4 or 16 bytes).
|
|
2167 |
*/
|
|
2168 |
TUint iResponseLength;
|
|
2169 |
};
|
|
2170 |
|
|
2171 |
class TMMCIdxCommandSpec
|
|
2172 |
/**
|
|
2173 |
MMC Index command spec class
|
|
2174 |
*/
|
|
2175 |
{
|
|
2176 |
public:
|
|
2177 |
TInt iIdx;
|
|
2178 |
TMMCCommandSpec iSpec;
|
|
2179 |
};
|
|
2180 |
|
|
2181 |
|
|
2182 |
|
|
2183 |
|
|
2184 |
/**
|
|
2185 |
MMC command description.
|
|
2186 |
|
|
2187 |
When issuing an individual command over the bus, the MultiMediaCard
|
|
2188 |
controller uses an object of this type to specify the parameters
|
|
2189 |
for the command, and to receive back any response.
|
|
2190 |
|
|
2191 |
Commands are issued by passing an object of this type to
|
|
2192 |
the DMMCStack::IssueMMCCommandSM() function, which is implemented by
|
|
2193 |
the platform specific layer.
|
|
2194 |
|
|
2195 |
@publishedPartner
|
|
2196 |
@released
|
|
2197 |
*/
|
|
2198 |
class TMMCCommandDesc
|
|
2199 |
{
|
|
2200 |
public:
|
|
2201 |
IMPORT_C TInt Direction() const; // returns -1/0/+1 for read/none/write
|
|
2202 |
|
|
2203 |
inline TBool IsBlockCmd() const;
|
|
2204 |
inline TUint32 NumBlocks() const;
|
|
2205 |
inline TInt64 Arg64() const;
|
|
2206 |
inline TBool IsDoubleBuffered() const;
|
|
2207 |
inline TUint32 BufferLength() const;
|
|
2208 |
inline TUint32 BlockLength() const;
|
|
2209 |
inline TBool IsPhysicalAddress() const;
|
|
2210 |
TBool AdjustForBlockOrByteAccess(const DMMCSession& aSession);
|
|
2211 |
|
|
2212 |
void Dump(TUint8* aResponseP, TMMCErr aErr);
|
|
2213 |
|
|
2214 |
public:
|
|
2215 |
/**
|
|
2216 |
@internalComponent
|
|
2217 |
*/
|
|
2218 |
TUint32 iFlags;
|
|
2219 |
|
|
2220 |
/**
|
|
2221 |
The command code.
|
|
2222 |
|
|
2223 |
This can be written directly to the MMC controller hardware.
|
|
2224 |
*/
|
|
2225 |
TMMCCommandEnum iCommand;
|
|
2226 |
|
|
2227 |
/**
|
|
2228 |
The argument to be supplied with the command.
|
|
2229 |
|
|
2230 |
This can be written directly to the MMC controller hardware.
|
|
2231 |
*/
|
|
2232 |
TMMCArgument iArgument;
|
|
2233 |
|
|
2234 |
/**
|
|
2235 |
The total length of the data to be tranferred.
|
|
2236 |
*/
|
|
2237 |
TUint32 iTotalLength;
|
|
2238 |
|
|
2239 |
/**
|
|
2240 |
A pointer to the location from where the data is to be read, or written.
|
|
2241 |
*/
|
|
2242 |
TUint8* iDataMemoryP;
|
|
2243 |
|
|
2244 |
/**
|
|
2245 |
The block length to be used in a data transaction.
|
|
2246 |
*/
|
|
2247 |
TUint32 iBlockLength;
|
|
2248 |
|
|
2249 |
/**
|
|
2250 |
The MultiMediaCard command specification.
|
|
2251 |
*/
|
|
2252 |
TMMCCommandSpec iSpec;
|
|
2253 |
|
|
2254 |
/**
|
|
2255 |
The number of bytes transferred since the last time the card was selected.
|
|
2256 |
*/
|
|
2257 |
TUint32 iBytesDone;
|
|
2258 |
|
|
2259 |
/**
|
|
2260 |
@internalComponent
|
|
2261 |
*/
|
|
2262 |
TUint iPollAttempts; // Retry counters
|
|
2263 |
|
|
2264 |
/**
|
|
2265 |
@internalComponent
|
|
2266 |
*/
|
|
2267 |
TUint iTimeOutRetries;
|
|
2268 |
|
|
2269 |
/**
|
|
2270 |
@internalComponent
|
|
2271 |
*/
|
|
2272 |
TUint iCRCRetries;
|
|
2273 |
|
|
2274 |
/**
|
|
2275 |
@internalComponent
|
|
2276 |
*/
|
|
2277 |
TUint16 iUnlockRetries;
|
|
2278 |
|
|
2279 |
/**
|
|
2280 |
@internalComponent
|
|
2281 |
*/
|
|
2282 |
TUint16 iOpCondBusyTimeout; // Units of 10mS
|
|
2283 |
|
|
2284 |
/**
|
|
2285 |
@internalComponent
|
|
2286 |
*/
|
|
2287 |
TUint iCustomRetries;
|
|
2288 |
|
|
2289 |
/**
|
|
2290 |
@internalComponent
|
|
2291 |
*/
|
|
2292 |
TUint32 iExecNotHandle; // error codes to not handle in ExecCommandSM()
|
|
2293 |
|
|
2294 |
/**
|
|
2295 |
The area into which the command response is put.
|
|
2296 |
|
|
2297 |
This is in big-endian format.
|
|
2298 |
*/
|
|
2299 |
TUint8 iResponse[KMMCMaxResponseLength];
|
|
2300 |
};
|
|
2301 |
|
|
2302 |
|
|
2303 |
|
|
2304 |
|
|
2305 |
/**
|
|
2306 |
MMC bus configuration.
|
|
2307 |
|
|
2308 |
An object of this type is passed to the Variant implementation
|
|
2309 |
of DMMCStack::SetBusConfigDefaults(), which should fill the public data
|
|
2310 |
members with appropriate information and values.
|
|
2311 |
|
|
2312 |
@publishedPartner
|
|
2313 |
@released
|
|
2314 |
*/
|
|
2315 |
class TMMCBusConfig
|
|
2316 |
{
|
|
2317 |
public:
|
|
2318 |
/**
|
|
2319 |
The hardware interface clock, in KHz.
|
|
2320 |
*/
|
|
2321 |
TUint iBusClock;
|
|
2322 |
|
|
2323 |
|
|
2324 |
/**
|
|
2325 |
The bus clock when clocking in data, in KHz.
|
|
2326 |
*/
|
|
2327 |
TUint iClockIn;
|
|
2328 |
|
|
2329 |
|
|
2330 |
/**
|
|
2331 |
The bus clock when clocking out data, in KHz.
|
|
2332 |
*/
|
|
2333 |
TUint iClockOut;
|
|
2334 |
|
|
2335 |
|
|
2336 |
/**
|
|
2337 |
The response timeout value, in uS.
|
|
2338 |
*/
|
|
2339 |
TUint iResponseTimeOut;
|
|
2340 |
|
|
2341 |
|
|
2342 |
/**
|
|
2343 |
The data timeout value, in uS.
|
|
2344 |
*/
|
|
2345 |
TUint iDataTimeOut;
|
|
2346 |
|
|
2347 |
|
|
2348 |
/**
|
|
2349 |
The busy timeout value, in uS.
|
|
2350 |
*/
|
|
2351 |
TUint iBusyTimeOut;
|
|
2352 |
};
|
|
2353 |
|
|
2354 |
|
|
2355 |
class TMMCStackConfig
|
|
2356 |
/**
|
|
2357 |
@publishedPartner
|
|
2358 |
@released
|
|
2359 |
|
|
2360 |
Holds the stack configuration settings on behalf of a session.
|
|
2361 |
|
|
2362 |
Each DMMCSession object contains the public member DMMCSession::iConfig - an instance of the TMMCStackConfig class.
|
|
2363 |
By changing these settings, the client can override the master (i.e. default) stack configuration settings.
|
|
2364 |
|
|
2365 |
However, these changes only remain in effect for the period that the session remains the current session.
|
|
2366 |
In this way, the client is able to change the settings employed by the Controller (e.g. bus clock, enable retries,
|
|
2367 |
change time-out values, restore defaults etc) while it performs that client's request.
|
|
2368 |
|
|
2369 |
The client would generally set-up the stack configuration it requires prior to submitting the session.
|
|
2370 |
*/
|
|
2371 |
{
|
|
2372 |
public:
|
|
2373 |
inline TMMCStackConfig();
|
|
2374 |
inline void SetMode(TUint32 aMask);
|
|
2375 |
inline void RemoveMode(TUint32 aMask);
|
|
2376 |
inline void UseDefault(TUint32 aMask);
|
|
2377 |
inline void SetPollAttempts(TUint aData);
|
|
2378 |
inline void SetTimeOutRetries(TUint aData);
|
|
2379 |
inline void SetCRCRetries(TUint aData);
|
|
2380 |
inline void SetBusClockInKhz(TUint aParam); // In kilohertz
|
|
2381 |
inline void SetTicksClockIn(TUint aParam); // Number of clock ticks in ClockIn phase
|
|
2382 |
inline void SetTicksClockOut(TUint aParam); // Number of clock ticks in ClockOut phase
|
|
2383 |
inline void SetResponseTimeOutInTicks(TUint aParam); // Timeout in bus clock ticks
|
|
2384 |
inline void SetDataTimeOutInMcs(TUint aParam); // in microseconds
|
|
2385 |
inline void SetBusyTimeOutInMcs(TUint aParam); // in microseconds
|
|
2386 |
inline void SetOpCondBusyTimeout(TUint16 aData); // Units of 10mS
|
|
2387 |
inline TInt OpCondBusyTimeout();
|
|
2388 |
TUint iPollAttempts;
|
|
2389 |
private:
|
|
2390 |
TUint32 iModes;
|
|
2391 |
TUint32 iUpdateMask;
|
|
2392 |
TUint32 iClientMask;
|
|
2393 |
TUint iTimeOutRetries;
|
|
2394 |
TUint iCRCRetries;
|
|
2395 |
TUint16 iUnlockRetries;
|
|
2396 |
TUint16 iOpCondBusyTimeout; // Units of 10mS
|
|
2397 |
TMMCBusConfig iBusConfig;
|
|
2398 |
friend class DMMCStack;
|
|
2399 |
};
|
|
2400 |
|
|
2401 |
|
|
2402 |
class TMMCRCAPool
|
|
2403 |
/**
|
|
2404 |
MMC RCA Pool
|
|
2405 |
*/
|
|
2406 |
{
|
|
2407 |
public:
|
|
2408 |
inline TMMCRCAPool();
|
|
2409 |
TRCA GetFreeRCA();
|
|
2410 |
inline void LockRCA(TRCA);
|
|
2411 |
inline void UnlockRCA(TRCA);
|
|
2412 |
inline void ReleaseUnlocked();
|
|
2413 |
private:
|
|
2414 |
TUint32 iPool;
|
|
2415 |
TUint32 iLocked;
|
|
2416 |
};
|
|
2417 |
|
|
2418 |
|
|
2419 |
class TMMCSessRing
|
|
2420 |
/**
|
|
2421 |
MMC session ring
|
|
2422 |
*/
|
|
2423 |
{
|
|
2424 |
public:
|
|
2425 |
TMMCSessRing();
|
|
2426 |
inline TBool IsEmpty() const;
|
|
2427 |
void Erase();
|
|
2428 |
inline void SetMarker(); // Sets Marker into Point position
|
|
2429 |
inline void AdvanceMarker(); // Moves Marker one position forward
|
|
2430 |
inline void Point(); // Sets Point into Marker position
|
|
2431 |
TBool Point(DMMCSession* aSessP); // Finds aSessP and sets Point to it
|
|
2432 |
void Add(DMMCSession* aSessP); // Inserts aSessP before the Marker; Point moves to Marker
|
|
2433 |
void Add(TMMCSessRing& aRing);
|
|
2434 |
DMMCSession* Remove(); // Removes at Point; Point moves forward
|
|
2435 |
void Remove(DMMCSession* aSessP); // Points aSessP first, then remove()
|
|
2436 |
inline TUint Size() const;
|
|
2437 |
inline operator DMMCSession*() const;
|
|
2438 |
DMMCSession* operator++(TInt); // returns Point and moves it forward; stops at Marker
|
|
2439 |
private:
|
|
2440 |
DMMCSession* iPMark;
|
|
2441 |
DMMCSession* iPoint;
|
|
2442 |
DMMCSession* iPrevP;
|
|
2443 |
TUint iSize;
|
|
2444 |
};
|
|
2445 |
|
|
2446 |
|
|
2447 |
//
|
|
2448 |
// DMMCStack State Machine Functions are supported by TMMCStateMachine class
|
|
2449 |
//
|
|
2450 |
// The structure of state machine functions is assumed to be as follows
|
|
2451 |
//
|
|
2452 |
// TMMCErr DMMCStack::FunctionNameSMST( TAny* aPtr )
|
|
2453 |
// { return( STATIC_CAST(DMMCStack*,aPtr)->FunctionNameSM() ); }
|
|
2454 |
//
|
|
2455 |
// TMMCErr DMMCStack::FunctionNameSM()
|
|
2456 |
// {
|
|
2457 |
// enum states {EStBegin=0, ..., EStEnd };
|
|
2458 |
// DMMCSession& s = Session();
|
|
2459 |
// TMMCStateMachine& m = Machine();
|
|
2460 |
// const TMMCErr err = m.SetExitCode( 0 );
|
|
2461 |
//
|
|
2462 |
// for(;;)
|
|
2463 |
// {
|
|
2464 |
// switch(m.State())
|
|
2465 |
// {
|
|
2466 |
// case EStBegin:
|
|
2467 |
// {
|
|
2468 |
// ....
|
|
2469 |
// }
|
|
2470 |
// case EStNext:
|
|
2471 |
// {
|
|
2472 |
// .....
|
|
2473 |
// }
|
|
2474 |
// case EStEnd: break;
|
|
2475 |
// default: Panic(...);
|
|
2476 |
// }
|
|
2477 |
// break;
|
|
2478 |
// }
|
|
2479 |
// return(m.Pop());
|
|
2480 |
// }
|
|
2481 |
//
|
|
2482 |
// State Machine remembers the next state number and function name and goes there as soon
|
|
2483 |
// as the control is returned to the session. To release the control and wait for the next
|
|
2484 |
// re-entrance (which will happen immediately if the session is not blocked or, as soon as
|
|
2485 |
// an asynchronous event removes the blocking condition), a state machine function has to
|
|
2486 |
// return( 0 ); Returning non-zero exit code will result in the session being completed with
|
|
2487 |
// that error code unless a caller state machine function has explicitly intercepted such
|
|
2488 |
// an error with m.SetTraps( TMMCErr aMask ).
|
|
2489 |
//
|
|
2490 |
// To make a state machine function code more readable, the following macros are provided:
|
|
2491 |
//
|
|
2492 |
// SMF_NEXTS(nexts) - set the next state to "nexts"
|
|
2493 |
// SMF_CALL(func) - invoke SM function "func", then go to the next state
|
|
2494 |
// SMF_CALLWAIT(func) - the same as above, but sleep at the entry point
|
|
2495 |
// SMF_CALLMYS(nexts,retst) - invoke current SM function at "nexts" entry point
|
|
2496 |
// SMF_CALLMEWR(retst) - invoke me right here with return state retst
|
|
2497 |
// SMF_INVOKES(func,nexts) - invoke SM function "func", then go to the state "nexts"
|
|
2498 |
// SMF_INVOKEWAITS(func,nexts) - the same as above, but sleep at the entry point
|
|
2499 |
// SMF_WAIT - sleep at the next state
|
|
2500 |
// SMF_WAITS(nexts) - set next state to "nexts", then sleep
|
|
2501 |
// SMF_RETURN(value) - return an error to the caller SM function
|
|
2502 |
// SMF_EXIT - return to the caller SM function
|
|
2503 |
// SMF_EXITWAIT - the same as above, but sleep at the exit point
|
|
2504 |
// SMF_JUMP(func) - transfer the control to SM function "func"
|
|
2505 |
// SMF_JUMPWAIT(func) - the same as above, but sleep at the entry point
|
|
2506 |
// SMF_GOTONEXTS - goto the next state
|
|
2507 |
// SMF_GOTOS(nexts) - set the next state to "nexts", then go to it
|
|
2508 |
// SMF_STATE(sname) - declare the state name "sname"
|
|
2509 |
// SMF_BPOINT(sname) - declare the state "sname" and sleep here if blocked statically
|
|
2510 |
//
|
|
2511 |
|
|
2512 |
/**
|
|
2513 |
@publishedPartner
|
|
2514 |
@released
|
|
2515 |
|
|
2516 |
Declares the start of a state machine case switch statement.
|
|
2517 |
|
|
2518 |
The macro assumes that the first state defined by the state machine
|
|
2519 |
function is EStBegin.
|
|
2520 |
|
|
2521 |
NOTES:
|
|
2522 |
|
|
2523 |
- the code generates an opening curly brace that must be matched by
|
|
2524 |
a closing curly brace. Typically, this is provided by the SMF_STATE or
|
|
2525 |
the SMF_END macros.
|
|
2526 |
|
|
2527 |
@see SMF_STATE
|
|
2528 |
@see SMF_END
|
|
2529 |
*/
|
|
2530 |
#define SMF_BEGIN TMMCStateMachine& m=Machine();const TMMCErr err=m.SetExitCode(0);\
|
|
2531 |
for(;;){switch(m.State()){case EStBegin:{if(err) (void)0;
|
|
2532 |
|
|
2533 |
/**
|
|
2534 |
@publishedPartner
|
|
2535 |
@released
|
|
2536 |
|
|
2537 |
Declares the end of a state machine case switch statement.
|
|
2538 |
|
|
2539 |
The macro assumes that the last state defined by the state machine
|
|
2540 |
function is EStEnd.
|
|
2541 |
|
|
2542 |
NOTES:
|
|
2543 |
|
|
2544 |
- the code generated assumes that there are earlier calls to SMF_BEGIN,
|
|
2545 |
and zero or more calls to SMF_STATE.
|
|
2546 |
|
|
2547 |
@see SMF_BEGIN
|
|
2548 |
@see SMF_STATE
|
|
2549 |
*/
|
|
2550 |
#define SMF_END }case EStEnd:break;default:DMMCSocket::Panic(DMMCSocket::EMMCMachineState);}break;}\
|
|
2551 |
return(m.Pop());
|
|
2552 |
|
|
2553 |
|
|
2554 |
/**
|
|
2555 |
@publishedPartner
|
|
2556 |
@released
|
|
2557 |
|
|
2558 |
Sets the next state when the current state machine
|
|
2559 |
function is re-entered.
|
|
2560 |
|
|
2561 |
@param nexts The next state to be entered in the current state machine.
|
|
2562 |
*/
|
|
2563 |
#define SMF_NEXTS(nexts) m.SetState(nexts);
|
|
2564 |
|
|
2565 |
|
|
2566 |
/**
|
|
2567 |
@publishedPartner
|
|
2568 |
@released
|
|
2569 |
|
|
2570 |
Pushes a state machine entry onto the stack, specifying the child state machine
|
|
2571 |
function to be invoked.
|
|
2572 |
|
|
2573 |
The child function will be entered at state 0 (EStBegin), when the state machine
|
|
2574 |
is next dispatched.
|
|
2575 |
|
|
2576 |
Control returns from this state machine function after completion of
|
|
2577 |
all functions coded by this macro.
|
|
2578 |
|
|
2579 |
@param func The child state machine function to be invoked.
|
|
2580 |
*/
|
|
2581 |
#define SMF_CALL(func) return(m.Push(func));
|
|
2582 |
|
|
2583 |
|
|
2584 |
/**
|
|
2585 |
@publishedPartner
|
|
2586 |
@released
|
|
2587 |
|
|
2588 |
Pushes a state machine entry onto the stack, specifying the child state machine
|
|
2589 |
function to be invoked.
|
|
2590 |
|
|
2591 |
The state machine is blocked before entry to the child function, but when
|
|
2592 |
it becomes unblocked, the child function will be entered at state 0 (EStBegin)
|
|
2593 |
when the state machine is next dispatched.
|
|
2594 |
|
|
2595 |
Control returns from this state machine function after completion of
|
|
2596 |
all functions coded by this macro.
|
|
2597 |
|
|
2598 |
@param func The child state machine function to be invoked.
|
|
2599 |
*/
|
|
2600 |
#define SMF_CALLWAIT(func) return(m.Push(func,ETrue));
|
|
2601 |
|
|
2602 |
|
|
2603 |
/**
|
|
2604 |
@publishedPartner
|
|
2605 |
@released
|
|
2606 |
|
|
2607 |
Sets the next state for the current state machine function - control will
|
|
2608 |
flow to this state on completion of all functions coded by this macro.
|
|
2609 |
|
|
2610 |
The macro also pushes a state machine entry onto the stack, specifying
|
|
2611 |
the CURRENT state machine function as the child state machine function to be
|
|
2612 |
invoked, and sets the state in which this child state machine function will
|
|
2613 |
be entered, when it gains control.
|
|
2614 |
|
|
2615 |
NOTES:
|
|
2616 |
|
|
2617 |
- the child function is the same as the parent function.
|
|
2618 |
- the state machine is blocked on return from the current state machine function.
|
|
2619 |
|
|
2620 |
@param nexts The state in which the child state machine function will
|
|
2621 |
gain control.
|
|
2622 |
@param retst The next state for the current state machine function.
|
|
2623 |
*/
|
|
2624 |
#define SMF_CALLMYS(nexts,retst) {m.SetState(retst);m.PushMe();m.SetState(nexts);continue;}
|
|
2625 |
|
|
2626 |
|
|
2627 |
/**
|
|
2628 |
@publishedPartner
|
|
2629 |
@released
|
|
2630 |
|
|
2631 |
Sets the next state for the current state machine function - control flows to
|
|
2632 |
the next instruction on completion of all functions coded by this macro.
|
|
2633 |
|
|
2634 |
The macro also pushes a state machine entry onto the stack, specifying
|
|
2635 |
the CURRENT state machine function as the child state machine function to be
|
|
2636 |
invoked. The child function will be entered at state 0 (EStBegin), when the state machine
|
|
2637 |
is next dispatched.
|
|
2638 |
|
|
2639 |
NOTES:
|
|
2640 |
|
|
2641 |
- the child function is the same as the parent function.
|
|
2642 |
- the state machine is blocked on return from the current state machine function.
|
|
2643 |
|
|
2644 |
@param retst The next state for the current state machine function.
|
|
2645 |
*/
|
|
2646 |
#define SMF_CALLMEWR(retst) {m.SetState(retst);m.PushMe();}
|
|
2647 |
|
|
2648 |
|
|
2649 |
/**
|
|
2650 |
@publishedPartner
|
|
2651 |
@released
|
|
2652 |
|
|
2653 |
Sets the next state for the current state machine function.
|
|
2654 |
|
|
2655 |
The macro also pushes a state machine entry onto the stack, specifying
|
|
2656 |
the child state machine function to be
|
|
2657 |
invoked. The child function will be entered at state 0 (EStBegin), when the state machine
|
|
2658 |
is next dispatched.
|
|
2659 |
|
|
2660 |
Control returns from the current state machine function after completion of
|
|
2661 |
all functions coded by this macro.
|
|
2662 |
|
|
2663 |
@param func The child state machine function to be invoked.
|
|
2664 |
@param nexts The next state for the current state machine function.
|
|
2665 |
*/
|
|
2666 |
#define SMF_INVOKES(func,nexts) {m.SetState(nexts);return(m.Push(func));}
|
|
2667 |
|
|
2668 |
|
|
2669 |
/**
|
|
2670 |
@publishedPartner
|
|
2671 |
@released
|
|
2672 |
|
|
2673 |
Sets the next state for the current state machine function.
|
|
2674 |
|
|
2675 |
The macro also pushes a state machine entry onto the stack, specifying
|
|
2676 |
the child state machine function to be
|
|
2677 |
invoked. The child function will be entered at state 0 (EStBegin), when the state machine
|
|
2678 |
is next dispatched.
|
|
2679 |
|
|
2680 |
Control returns from the current state machine function after completion of
|
|
2681 |
all functions coded by this macro.
|
|
2682 |
|
|
2683 |
NOTES:
|
|
2684 |
|
|
2685 |
- the state machine is blocked on return from the current state machine function.
|
|
2686 |
|
|
2687 |
@param func The child state machine function to be invoked.
|
|
2688 |
@param nexts The next state for the current state machine function.
|
|
2689 |
*/
|
|
2690 |
#define SMF_INVOKEWAITS(func,nexts) {m.SetState(nexts);return(m.Push(func,ETrue));}
|
|
2691 |
|
|
2692 |
|
|
2693 |
/**
|
|
2694 |
@publishedPartner
|
|
2695 |
@released
|
|
2696 |
|
|
2697 |
Returns from the current state machine function, and the state machine then blocks (waits).
|
|
2698 |
*/
|
|
2699 |
#define SMF_WAIT return(0);
|
|
2700 |
|
|
2701 |
|
|
2702 |
/**
|
|
2703 |
@publishedPartner
|
|
2704 |
@released
|
|
2705 |
|
|
2706 |
Sets the next state for the current state machine function; control then returns
|
|
2707 |
from the current state machine function, and the state machine blocks (waits).
|
|
2708 |
|
|
2709 |
@param nexts The next state for the current state machine function.
|
|
2710 |
*/
|
|
2711 |
#define SMF_WAITS(nexts) return(m.SetState(nexts));
|
|
2712 |
|
|
2713 |
|
|
2714 |
/**
|
|
2715 |
@publishedPartner
|
|
2716 |
@released
|
|
2717 |
|
|
2718 |
Returns the specified error value to the calling (parent) state machine function.
|
|
2719 |
|
|
2720 |
@param value The error value to be returned.
|
|
2721 |
*/
|
|
2722 |
#define SMF_RETURN(value) {m.Pop();return(value);}
|
|
2723 |
|
|
2724 |
|
|
2725 |
/**
|
|
2726 |
@publishedPartner
|
|
2727 |
@released
|
|
2728 |
|
|
2729 |
Returns to the calling state machine function.
|
|
2730 |
*/
|
|
2731 |
#define SMF_EXIT break;
|
|
2732 |
|
|
2733 |
|
|
2734 |
/**
|
|
2735 |
@publishedPartner
|
|
2736 |
@released
|
|
2737 |
|
|
2738 |
Returns to the calling state machine function, and the state machine blocks (waits).
|
|
2739 |
*/
|
|
2740 |
#define SMF_EXITWAIT return(m.Pop(ETrue));
|
|
2741 |
|
|
2742 |
|
|
2743 |
/**
|
|
2744 |
@publishedPartner
|
|
2745 |
@released
|
|
2746 |
|
|
2747 |
Transfers control to the specified state machine function.
|
|
2748 |
|
|
2749 |
NOTES:
|
|
2750 |
|
|
2751 |
- this function is executed at the same stack entry level as the current state machine function.
|
|
2752 |
|
|
2753 |
@param func The state machine function to which control is to be transferred.
|
|
2754 |
*/
|
|
2755 |
#define SMF_JUMP(func) return(m.Jump(func));
|
|
2756 |
|
|
2757 |
|
|
2758 |
/**
|
|
2759 |
@publishedPartner
|
|
2760 |
@released
|
|
2761 |
|
|
2762 |
Transfers control to the specified state machine function, and waits
|
|
2763 |
at its entry point.
|
|
2764 |
|
|
2765 |
@param func The state machine function to which control is to be transferred.
|
|
2766 |
*/
|
|
2767 |
#define SMF_JUMPWAIT(func) return(m.Jump(func,ETrue));
|
|
2768 |
|
|
2769 |
|
|
2770 |
/**
|
|
2771 |
@publishedPartner
|
|
2772 |
@released
|
|
2773 |
|
|
2774 |
Goes to the next state.
|
|
2775 |
*/
|
|
2776 |
#define SMF_GOTONEXTS continue;
|
|
2777 |
|
|
2778 |
|
|
2779 |
/**
|
|
2780 |
@publishedPartner
|
|
2781 |
@released
|
|
2782 |
|
|
2783 |
Sets the next state and then goes to that state.
|
|
2784 |
|
|
2785 |
@param nexts The next state.
|
|
2786 |
*/
|
|
2787 |
#define SMF_GOTOS(nexts) {m.SetState(nexts);continue;}
|
|
2788 |
|
|
2789 |
|
|
2790 |
/**
|
|
2791 |
@publishedPartner
|
|
2792 |
@released
|
|
2793 |
|
|
2794 |
Declares the name of a state.
|
|
2795 |
|
|
2796 |
This is used to generate a case statement based on the state name.
|
|
2797 |
|
|
2798 |
@param sname The state name.
|
|
2799 |
*/
|
|
2800 |
#define SMF_STATE(sname) }case sname:{
|
|
2801 |
|
|
2802 |
|
|
2803 |
/**
|
|
2804 |
@publishedPartner
|
|
2805 |
@released
|
|
2806 |
|
|
2807 |
Declares the name of a state, and sleeps here
|
|
2808 |
if blocked statically.
|
|
2809 |
|
|
2810 |
@param sname The state name.
|
|
2811 |
*/
|
|
2812 |
#define SMF_BPOINT(sname) }case sname: if(StaticBlocks()) return(m.SetState(sname));{
|
|
2813 |
|
|
2814 |
|
|
2815 |
|
|
2816 |
|
|
2817 |
class TMMCStateMachine
|
|
2818 |
/**
|
|
2819 |
The MultiMediaCard state machine.
|
|
2820 |
|
|
2821 |
@publishedPartner
|
|
2822 |
@released
|
|
2823 |
*/
|
|
2824 |
{
|
|
2825 |
public:
|
|
2826 |
inline void Setup(TMMCErr (*anEntry)(TAny*), TAny* aContextP);
|
|
2827 |
IMPORT_C void Reset();
|
|
2828 |
IMPORT_C TMMCErr Dispatch();
|
|
2829 |
inline TMMCErr ExitCode();
|
|
2830 |
inline TMMCErr SetExitCode(TMMCErr aCode);
|
|
2831 |
inline TUint State();
|
|
2832 |
inline TMMCErr SetState(TUint aState);
|
|
2833 |
inline void SuppressSuspension();
|
|
2834 |
inline void SetTraps(TMMCErr aMask);
|
|
2835 |
inline void ResetTraps();
|
|
2836 |
inline void Abort();
|
|
2837 |
inline TMMCErr Pop(TBool aSuspend=EFalse);
|
|
2838 |
inline TMMCErr PushMe();
|
|
2839 |
IMPORT_C TMMCErr Push(TMMCErr (*anEntry)(TAny*), TBool aSuspend=EFalse);
|
|
2840 |
IMPORT_C TMMCErr Jump(TMMCErr (*anEntry)(TAny*), TBool aSuspend=EFalse);
|
|
2841 |
private:
|
|
2842 |
class TMMCMachineStackEntry
|
|
2843 |
{
|
|
2844 |
public:
|
|
2845 |
TMMCErr (*iFunction)(TAny*);
|
|
2846 |
TUint iState;
|
|
2847 |
TMMCErr iTrapMask;
|
|
2848 |
};
|
|
2849 |
TBool iAbort;
|
|
2850 |
TBool iSuspend;
|
|
2851 |
TAny* iContextP;
|
|
2852 |
TMMCErr iExitCode;
|
|
2853 |
TInt iSP;
|
|
2854 |
TMMCMachineStackEntry iStack[KMaxMMCMachineStackDepth];
|
|
2855 |
};
|
|
2856 |
|
|
2857 |
class TMMCCallBack
|
|
2858 |
/**
|
|
2859 |
This class is used to notify the request completion as a callback function for the clients of DMMCSession.
|
|
2860 |
The callback function will be called on session completion.
|
|
2861 |
Callback function is used to indicate Asynchronous Completion.
|
|
2862 |
|
|
2863 |
@see DMMCSession
|
|
2864 |
@publishedPartner
|
|
2865 |
@released
|
|
2866 |
*/
|
|
2867 |
{
|
|
2868 |
public:
|
|
2869 |
inline TMMCCallBack();
|
|
2870 |
inline TMMCCallBack(void (*aFunction)(TAny* aPtr));
|
|
2871 |
inline TMMCCallBack(void (*aFunction)(TAny* aPtr), TAny* aPtr);
|
|
2872 |
inline void CallBack() const;
|
|
2873 |
public:
|
|
2874 |
/**
|
|
2875 |
A pointer to the callback function.
|
|
2876 |
*/
|
|
2877 |
void (*iFunction)(TAny* aPtr);
|
|
2878 |
|
|
2879 |
/**
|
|
2880 |
A pointer that is passed to the callback function when
|
|
2881 |
the callback function is called.
|
|
2882 |
*/
|
|
2883 |
TAny* iPtr;
|
|
2884 |
};
|
|
2885 |
|
|
2886 |
// DMMCStack serves an incoming queue of session requests.
|
|
2887 |
// Each queue element is represented by an instance of the following class
|
|
2888 |
|
|
2889 |
typedef TMMCErr (*TMMCSMSTFunc)(TAny*);
|
|
2890 |
|
|
2891 |
class DMMCSession : public DBase
|
|
2892 |
/**
|
|
2893 |
Provides the main interface between the client and the MMC Socket, allowing commands and responses
|
|
2894 |
to be processed asynchronously on the stack.
|
|
2895 |
|
|
2896 |
Each client creates it own instance of this class. It is then able to make MultiMediaCard requests
|
|
2897 |
on the selected stack by configuring the DMMCSession object with relevant information for the request
|
|
2898 |
and then submitting (or engaging) this session object.
|
|
2899 |
|
|
2900 |
The session is used to pass commands either to the entire stack (a broadcast command), or to individual
|
|
2901 |
cards in the stack. The class contains functions for initiating macro functions as laid down by the
|
|
2902 |
MultiMediaCard Association (MMCA) as well as lower level functions allowing a client to control the
|
|
2903 |
stack in a more explicit manner.
|
|
2904 |
|
|
2905 |
All requests on the MultiMediaCard stack which involve bus activity are inherently asynchronous. When
|
|
2906 |
creating a DMMCSession object, a client supplies a call-back function as part of the constructor.
|
|
2907 |
Once a client has engaged a session on the stack, it is informed of the completion of the request by
|
|
2908 |
the Controller calling this call-back function.
|
|
2909 |
|
|
2910 |
@publishedPartner
|
|
2911 |
@released
|
|
2912 |
*/
|
|
2913 |
{
|
|
2914 |
public:
|
|
2915 |
IMPORT_C virtual ~DMMCSession();
|
|
2916 |
IMPORT_C DMMCSession(const TMMCCallBack& aCallBack);
|
|
2917 |
|
|
2918 |
// Object initialisation
|
|
2919 |
inline void SetStack(DMMCStack* aStackP);
|
|
2920 |
IMPORT_C void SetCard(TMMCard* aCardP);
|
|
2921 |
|
|
2922 |
// Control macros setup
|
|
2923 |
inline void SetupCIMUpdateAcq();
|
|
2924 |
inline void SetupCIMInitStack();
|
|
2925 |
inline void SetupCIMCheckStack();
|
|
2926 |
inline void SetupCIMSetupCard();
|
|
2927 |
inline void SetupCIMLockStack();
|
|
2928 |
inline void SetupCIMInitStackAfterUnlock();
|
|
2929 |
inline void SetupCIMAutoUnlock();
|
|
2930 |
|
|
2931 |
// Data transfer macros setup
|
|
2932 |
IMPORT_C void SetupCIMReadBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP);
|
|
2933 |
IMPORT_C void SetupCIMWriteBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP);
|
|
2934 |
IMPORT_C void SetupCIMReadMBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen);
|
|
2935 |
IMPORT_C void SetupCIMWriteMBlock(TMMCArgument aDevAddr, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen);
|
|
2936 |
IMPORT_C void SetupCIMEraseSector(TMMCArgument aDevAddr, TUint32 aLength);
|
|
2937 |
IMPORT_C void SetupCIMEraseGroup(TMMCArgument aDevAddr, TUint32 aLength);
|
|
2938 |
IMPORT_C void SetupCIMReadIO(TUint8 aRegAddr, TUint32 aLength, TUint8* aMemoryP);
|
|
2939 |
IMPORT_C void SetupCIMWriteIO(TUint8 aRegAddr, TUint32 aLength, TUint8* aMemoryP);
|
|
2940 |
IMPORT_C void SetupCIMLockUnlock(TUint32 aLength, TUint8* aMemoryP);
|
|
2941 |
|
|
2942 |
// Data transfer macros setup (block mode)
|
|
2943 |
inline void SetupCIMReadBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1);
|
|
2944 |
inline void SetupCIMWriteBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks = 1);
|
|
2945 |
inline void SetupCIMEraseMSector(TMMCArgument aBlockAddr, TUint32 aBlocks = 1);
|
|
2946 |
inline void SetupCIMEraseMGroup(TMMCArgument aBlockAddr, TUint32 aBlocks = 1);
|
|
2947 |
|
|
2948 |
// Raw commands (must be used in the locked bus state only)
|
|
2949 |
// Known commands with or without (with a default) argument
|
|
2950 |
IMPORT_C void SetupCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument=0);
|
|
2951 |
|
|
2952 |
// Generic unknown command with unknown response type
|
|
2953 |
IMPORT_C void SetupRSCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument,
|
|
2954 |
TUint32 aResponseLength, TMMCCommandTypeEnum aCommandType=ECmdTypeUK,
|
|
2955 |
TMMCResponseTypeEnum aResponseType=ERespTypeUnknown,
|
|
2956 |
TUint32 aCommandClass=KMMCCmdClassNone);
|
|
2957 |
|
|
2958 |
// Generic data transfer command
|
|
2959 |
IMPORT_C void SetupDTCommand(TMMCCommandEnum aCommand, TMMCArgument anArgument,
|
|
2960 |
TUint32 aTotalLength, TUint8* aMemoryAddress, TUint32 aBlockLength=0,
|
|
2961 |
TBool aStopTransmission=EFalse, TMMCCmdDirEnum aDir=EDirNone,
|
|
2962 |
TUint32 aCommandClass=KMMCCmdClassNone);
|
|
2963 |
// Actions
|
|
2964 |
IMPORT_C TInt Engage(); // Enque session for execution
|
|
2965 |
inline void UnlockStack(); // Unlock the bus
|
|
2966 |
inline void Stop(); // Signal session to complete (stop and complete)
|
|
2967 |
inline void Abort(); // Abort only (no completion)
|
|
2968 |
|
|
2969 |
// Info retrieval
|
|
2970 |
IMPORT_C TInt EpocErrorCode() const; // Derived from MMCExitCode and LastStatus
|
|
2971 |
inline TMMCSessionTypeEnum SessionID() const;
|
|
2972 |
inline DMMCStack* StackP() const; // DMMCStack serving this session
|
|
2973 |
inline TMMCard* CardP() const; // The current card pointer
|
|
2974 |
inline TBool IsEngaged() const; // Session is being served by DMMCStack
|
|
2975 |
inline TMMCErr MMCExitCode() const; // MMC specific error code returned by DMMCStack
|
|
2976 |
inline TMMCStatus LastStatus() const; // Last R1 response received from the card
|
|
2977 |
inline TUint32 BytesTransferred() const;// The actual amount of data transferred in this session
|
|
2978 |
inline TUint8* ResponseP(); // Current command response (&iCommand[iCmdSP].iResponse)
|
|
2979 |
inline TUint32 EffectiveModes() const; // Modes which DMMCStack will consider as effective
|
|
2980 |
//
|
|
2981 |
inline void ResetCommandStack();
|
|
2982 |
private:
|
|
2983 |
void SetupCIMControl(TInt aSessNum);
|
|
2984 |
protected:
|
|
2985 |
IMPORT_C virtual TMMCSMSTFunc GetMacro(TInt aSessNum) const;
|
|
2986 |
inline void Block(TUint32 aFlag);
|
|
2987 |
inline void UnBlock(TUint32 aFlag, TMMCErr anExitCode);
|
|
2988 |
private:
|
|
2989 |
#ifdef __EPOC32__
|
|
2990 |
static void PollTimerCallBack(TAny* aSessP);
|
|
2991 |
static void RetryTimerCallBack(TAny* aSessP);
|
|
2992 |
static void ProgramTimerCallBack(TAny* aSessP);
|
|
2993 |
#endif
|
|
2994 |
inline void SwapMe();
|
|
2995 |
void SynchBlock(TUint32 aFlag);
|
|
2996 |
void SynchUnBlock(TUint32 aFlag);
|
|
2997 |
public:
|
|
2998 |
static const TMMCCommandSpec& FindCommandSpec(const TMMCIdxCommandSpec aSpecs[], TInt aIdx);
|
|
2999 |
IMPORT_C void FillCommandDesc();
|
|
3000 |
IMPORT_C void FillCommandDesc(TMMCCommandEnum aCommand);
|
|
3001 |
IMPORT_C void FillCommandDesc(TMMCCommandEnum aCommand, TMMCArgument anArgument);
|
|
3002 |
IMPORT_C void FillCommandArgs(TMMCArgument anArgument, TUint32 aLength, TUint8* aMemoryP, TUint32 aBlkLen);
|
|
3003 |
inline TMMCCommandDesc& Command(); // The current command descriptor
|
|
3004 |
|
|
3005 |
inline void PushCommandStack();
|
|
3006 |
inline void PopCommandStack();
|
|
3007 |
|
|
3008 |
// Methods for double-buffered data transfer:
|
|
3009 |
inline TBool RequestMoreData();
|
|
3010 |
inline void EnableDoubleBuffering(TUint32 aNumBlocks); /**< @internalTechnology */
|
|
3011 |
inline void SetDataTransferCallback(TMMCCallBack& aCallback); /**< @internalTechnology */
|
|
3012 |
inline void MoreDataAvailable(TUint32 aNumBlocks, TUint8* aMemoryP, TInt aError); /**< @internalTechnology */
|
|
3013 |
public:
|
|
3014 |
/**
|
|
3015 |
The last R1 response.
|
|
3016 |
*/
|
|
3017 |
TMMCStatus iLastStatus;
|
|
3018 |
|
|
3019 |
/**
|
|
3020 |
A pointer to the card object.
|
|
3021 |
*/
|
|
3022 |
TMMCard* iCardP; // Pointer to Card Info object
|
|
3023 |
IMPORT_C TRCA CardRCA(); // Checks that card is still ready - otherwise returns 0
|
|
3024 |
TMMCSessionTypeEnum iSessionID;
|
|
3025 |
private:
|
|
3026 |
DMMCSession* iLinkP; //
|
|
3027 |
protected:
|
|
3028 |
TMMCCallBack iCallBack; // Where to report the completion
|
|
3029 |
private:
|
|
3030 |
DMMCStack* iStackP; // Pointer to Stack Controller
|
|
3031 |
TCID iCID; // Card ID to ensure we are still talking to the same card
|
|
3032 |
TUint32 iBytesTransferred; // The actual amount of data transferred in this session
|
|
3033 |
TMMCErr iMMCExitCode; // State Machine exit code (MMC specific)
|
|
3034 |
public:
|
|
3035 |
/**
|
|
3036 |
Session state flags (synchronous).
|
|
3037 |
*/
|
|
3038 |
TUint32 iState;
|
|
3039 |
private:
|
|
3040 |
TUint iInitContext; // Stack Initialiser pass number
|
|
3041 |
TUint iGlobalRetries; // Global retry counter
|
|
3042 |
|
|
3043 |
// Asynchronous flags analysed by scheduler
|
|
3044 |
TBool volatile iDoAbort; // Marks the session for abort
|
|
3045 |
TBool volatile iDoStop; // Stop the session as soon as it's safe
|
|
3046 |
TBool volatile iDoComplete; // Completion callback is now to be invoked
|
|
3047 |
TBool iBrokenLock; // Stack lock is broken by force major
|
|
3048 |
//
|
|
3049 |
TUint32 iBlockOn; // blocking reasons
|
|
3050 |
TInt iCmdSP; // Current Command stack index
|
|
3051 |
|
|
3052 |
TMMCCommandDesc iCommand[KMaxMMCCommandStackDepth]; // Command stack
|
|
3053 |
|
|
3054 |
TMMCCallBack iDataTransferCallback; // A callback function, used to request more data when performing double-buffering
|
|
3055 |
|
|
3056 |
TUint32 iSpare[22]; // Spare data (stolen from iCommand)
|
|
3057 |
|
|
3058 |
TMMCStateMachine iMachine; // State Machine context
|
|
3059 |
#ifdef __EPOC32__
|
|
3060 |
NTimer iPollTimer;
|
|
3061 |
NTimer iRetryTimer;
|
|
3062 |
NTimer iProgramTimer;
|
|
3063 |
#endif
|
|
3064 |
public:
|
|
3065 |
TMMCStackConfig iConfig; // Client configuration parameters
|
|
3066 |
friend class DMMCStack;
|
|
3067 |
friend class TMMCSessRing;
|
|
3068 |
friend class TMMCardArray;
|
|
3069 |
};
|
|
3070 |
|
|
3071 |
|
|
3072 |
class DMMCStack : public DBase
|
|
3073 |
/**
|
|
3074 |
This object controls access to the MultiMediaCard stack.
|
|
3075 |
The DMMCSocket owns an instance of this class for the MultiMediaCard stack that it manages.
|
|
3076 |
|
|
3077 |
@publishedPartner
|
|
3078 |
@released
|
|
3079 |
*/
|
|
3080 |
{
|
|
3081 |
public:
|
|
3082 |
/** extension interfaces Ids */
|
|
3083 |
enum TInterfaceId
|
|
3084 |
{
|
|
3085 |
KInterfaceMachineInfo,
|
|
3086 |
KInterfaceSwitchToLowVoltageSM,
|
|
3087 |
KInterfaceSetBusWidth,
|
|
3088 |
KInterfaceDemandPagingInfo,
|
|
3089 |
KInterfaceCancelSession,
|
|
3090 |
KInterfaceDoWakeUpSM
|
|
3091 |
};
|
|
3092 |
|
|
3093 |
/** generic interface */
|
|
3094 |
class MInterface
|
|
3095 |
{
|
|
3096 |
public:
|
|
3097 |
virtual TInt Function() = 0;
|
|
3098 |
};
|
|
3099 |
|
|
3100 |
/**
|
|
3101 |
Demand paging support
|
|
3102 |
@see KInterfaceDemandPagingInfo
|
|
3103 |
*/
|
|
3104 |
class TDemandPagingInfo
|
|
3105 |
{
|
|
3106 |
public:
|
|
3107 |
const TInt* iPagingDriveList;
|
|
3108 |
TInt iDriveCount;
|
|
3109 |
TUint iPagingType;
|
|
3110 |
TInt iReadShift;
|
|
3111 |
TUint iNumPages;
|
|
3112 |
TBool iWriteProtected;
|
|
3113 |
TInt iSlotNumber;
|
|
3114 |
TUint iSpare[2];
|
|
3115 |
} ;
|
|
3116 |
/**
|
|
3117 |
* An optional interface implemented by the PSL for returning demand-paging information.
|
|
3118 |
* @see KInterfaceDemandPagingInfo
|
|
3119 |
*/
|
|
3120 |
class MDemandPagingInfo
|
|
3121 |
{
|
|
3122 |
public:
|
|
3123 |
virtual TInt DemandPagingInfo(TDemandPagingInfo& aInfo) = 0;
|
|
3124 |
};
|
|
3125 |
|
|
3126 |
/**
|
|
3127 |
* An optional interface State machine implemented by the PSL for handling asynchronous VccCore powerup
|
|
3128 |
* @see KInterfaceDoWakeUpSM
|
|
3129 |
*/
|
|
3130 |
class MDoWakeUp
|
|
3131 |
{
|
|
3132 |
public:
|
|
3133 |
virtual TMMCErr DoWakeUpSM()=0;
|
|
3134 |
};
|
|
3135 |
|
|
3136 |
|
|
3137 |
public:
|
|
3138 |
IMPORT_C DMMCStack(TInt aBus, DMMCSocket* aSocket);
|
|
3139 |
IMPORT_C virtual TInt Init();
|
|
3140 |
//
|
|
3141 |
// Actions
|
|
3142 |
inline void ReportPowerUp();
|
|
3143 |
inline void ReportPowerDown();
|
|
3144 |
inline void Reset(); // Discard all requests and clear up
|
|
3145 |
inline void CompleteAll(TMMCErr aCode); // Complete all operations with an error
|
|
3146 |
inline void CancelSession(DMMCSession* aSession);
|
|
3147 |
|
|
3148 |
IMPORT_C void PowerUpStack();
|
|
3149 |
IMPORT_C void PowerDownStack();
|
|
3150 |
void QSleepStack();
|
|
3151 |
IMPORT_C TInt Stop(TMMCard* aCardP);
|
|
3152 |
//
|
|
3153 |
// Inquiries
|
|
3154 |
inline TUint MaxCardsInStack() const;
|
|
3155 |
inline TMMCard* CardP(TUint aCardNumber);
|
|
3156 |
inline DMMCSocket* MMCSocket() const;
|
|
3157 |
inline TMMCPasswordStore* PasswordStore() const;
|
|
3158 |
inline TBool InitStackInProgress() const;
|
|
3159 |
inline TBool HasSessionsQueued() const;
|
|
3160 |
inline TBool HasCardsPresent();
|
|
3161 |
inline void BufferInfo(TUint8*& aBuf, TInt& aBufLen, TInt& aMinorBufLen);
|
|
3162 |
inline TInt DemandPagingInfo(TDemandPagingInfo& aInfo);
|
|
3163 |
inline TBool StackRunning() const;
|
|
3164 |
|
|
3165 |
|
|
3166 |
#ifdef __EPOC32__
|
|
3167 |
|
|
3168 |
/**
|
|
3169 |
Defines the period for the poll timer.
|
|
3170 |
|
|
3171 |
The poll timer is used by the generic layer for platforms
|
|
3172 |
that do not provide an interrupt to indicate
|
|
3173 |
when programming mode is finished.
|
|
3174 |
|
|
3175 |
@return The poll timer period, in milliseconds.
|
|
3176 |
*/
|
|
3177 |
virtual TInt ProgramPeriodInMilliSeconds() const =0;
|
|
3178 |
#endif
|
|
3179 |
|
|
3180 |
/**
|
|
3181 |
* Calculates the minimum range that must be read off a card, an optimisation that takes advantage
|
|
3182 |
* of the partial read feature found on some cards. It takes the logical range that the media driver
|
|
3183 |
* wants to read from the card, and increases it to take into account factors such as FIFO width and
|
|
3184 |
* minimum DMA transfer size.
|
|
3185 |
* @param aCard A pointer to the MMC Card
|
|
3186 |
* @param aStart The required start position
|
|
3187 |
* @param aEnd The required end position
|
|
3188 |
* @param aPhysStart The adjusted start position
|
|
3189 |
* @param aPhysEnd The adjusted end position
|
|
3190 |
*/
|
|
3191 |
virtual void AdjustPartialRead(const TMMCard* aCard, TUint32 aStart, TUint32 aEnd, TUint32* aPhysStart, TUint32* aPhysEnd) const =0;
|
|
3192 |
|
|
3193 |
/**
|
|
3194 |
* Returns the details of the buffer allocated by the socket for data transfer operations. The buffer
|
|
3195 |
* is allocated and configured at the variant layer to allow , for example, contiguous pages to be
|
|
3196 |
* allocated for DMA transfers.
|
|
3197 |
* @param aMDBuf A pointer to the allocated buffer
|
|
3198 |
* @param aMDBufLen The length of the allocated buffer
|
|
3199 |
*/
|
|
3200 |
virtual void GetBufferInfo(TUint8** aMDBuf, TInt* aMDBufLen) =0;
|
|
3201 |
|
|
3202 |
/**
|
|
3203 |
* Gets the platform specific configuration information.
|
|
3204 |
* @see TMMCMachineInfo
|
|
3205 |
*/
|
|
3206 |
virtual void MachineInfo(TMMCMachineInfo& aMachineInfo) =0;
|
|
3207 |
|
|
3208 |
/**
|
|
3209 |
* Creates the session object
|
|
3210 |
*/
|
|
3211 |
IMPORT_C virtual DMMCSession* AllocSession(const TMMCCallBack& aCallBack) const;
|
|
3212 |
|
|
3213 |
protected:
|
|
3214 |
// Platform layer service
|
|
3215 |
inline TMMCBusConfig& BusConfig();
|
|
3216 |
inline TMMCBusConfig& MasterBusConfig();
|
|
3217 |
inline DMMCSession& Session(); // Current session
|
|
3218 |
inline TMMCCommandDesc& Command(); // Current command descriptor of current session
|
|
3219 |
inline TMMCStateMachine& Machine(); // State machine of current session
|
|
3220 |
inline void BlockCurrentSession(TUint32 aFlag);
|
|
3221 |
inline void UnBlockCurrentSession(TUint32 aFlag, TMMCErr anExitCode);
|
|
3222 |
inline void ReportInconsistentBusState();
|
|
3223 |
inline void ReportASSPEngaged();
|
|
3224 |
inline void ReportASSPDisengaged();
|
|
3225 |
inline TRCA CurrentSessCardRCA(); // Checks that card is still ready - otherwise returns 0
|
|
3226 |
inline void CurrentSessPushCmdStack();
|
|
3227 |
inline void CurrentSessPopCmdStack();
|
|
3228 |
inline void CurrentSessFillCmdDesc(TMMCCommandEnum aCommand);
|
|
3229 |
inline void CurrentSessFillCmdDesc(TMMCCommandEnum aCommand,TMMCArgument anArgument);
|
|
3230 |
inline void CurrentSessFillCmdArgs(TMMCArgument anArgument,TUint32 aLength,TUint8* aMemoryP,TUint32 aBlkLen);
|
|
3231 |
inline TRCA SelectedCard() const;
|
|
3232 |
inline void YieldStack(TMMCCommandTypeEnum aCommand);
|
|
3233 |
|
|
3234 |
void DoSetClock(TUint32 aClock);
|
|
3235 |
void DoSetBusWidth(TUint32 aBusWidth);
|
|
3236 |
TBusWidth BusWidthEncoding(TInt aBusWidth) const;
|
|
3237 |
TUint MaxTranSpeedInKilohertz(const TMMCard& aCard) const;
|
|
3238 |
|
|
3239 |
// Stack service provided by platform/variant layer.
|
|
3240 |
|
|
3241 |
/**
|
|
3242 |
* Returns the default master settings for the platform.
|
|
3243 |
* @param aConfig A TMMCBusConfig reference to be filled in with the default settings.
|
|
3244 |
* @param aClock The requested clock frequency (may be ignored if the hardware cannot support it).
|
|
3245 |
*/
|
|
3246 |
virtual void SetBusConfigDefaults(TMMCBusConfig& aConfig, TUint aClock)=0;
|
|
3247 |
|
|
3248 |
/**
|
|
3249 |
* Switches from identification mode of operation to data transfer mode operation.
|
|
3250 |
*
|
|
3251 |
* Note that at this point the clock information in iBusConfig will not have been updated
|
|
3252 |
* to the new data transfer rate. This function should generally just switch from open drain
|
|
3253 |
* to push-pull bus mode - with the clock rate being changed at the start of IssueMMCCommandSM,
|
|
3254 |
* where iBusConfig will be valid.
|
|
3255 |
*/
|
|
3256 |
virtual void InitClockOff()=0;
|
|
3257 |
|
|
3258 |
/**
|
|
3259 |
* Stop all activities on the host stack.
|
|
3260 |
*
|
|
3261 |
* This will generally perform the same operations as for ASSPDisengage() but this will additionally
|
|
3262 |
* turn off the clock to the hardware interface and release any requested power requirements made on
|
|
3263 |
* the power model. (That is release any power requirements made as part of the InitClockOnSM() function).
|
|
3264 |
*
|
|
3265 |
* Called from the platform independent layer when it is required to immediately cancel any PSL asynchronous
|
|
3266 |
* activity because the current session has been aborted.
|
|
3267 |
*
|
|
3268 |
* This function should normally include a call to ReportAsspDisengaged() at the end, to report to the PIL
|
|
3269 |
* that the PSL level resources have been disengaged.
|
|
3270 |
*/
|
|
3271 |
virtual void ASSPReset()=0;
|
|
3272 |
|
|
3273 |
/**
|
|
3274 |
* Called each time a session which has engaged PSL resources has completed or has been aborted.
|
|
3275 |
*
|
|
3276 |
* This should disable any activities which were required to perform the session just completed/aborted.
|
|
3277 |
* It shouldn't however turn off the clock to the hardware interface (which will be turned off instead
|
|
3278 |
* by the inactivity timer). This typically disables DMA and interface interrupts and forces the hardware
|
|
3279 |
* interface into idle.
|
|
3280 |
*
|
|
3281 |
* This function should normally include a call to ReportAsspDisengaged() at the end, to report to the PIL
|
|
3282 |
* that the PSL level resources have been disengaged.
|
|
3283 |
*/
|
|
3284 |
virtual void ASSPDisengage()=0;
|
|
3285 |
|
|
3286 |
/**
|
|
3287 |
* Called as part of the bus power down sequence. It stops all activities on the host stack, turns off the clock
|
|
3288 |
* to the hardware interface and releases any requested power requirements made on the power model
|
|
3289 |
* (i.e. very often a straight call of ASSPReset()).
|
|
3290 |
*
|
|
3291 |
* This shouldn't turn off the MMC PSU as this will be performed immediately afterwards by the PSU class.
|
|
3292 |
*/
|
|
3293 |
virtual void DoPowerDown()=0;
|
|
3294 |
|
|
3295 |
IMPORT_C virtual TBool CardDetect(TUint aCardNumber);
|
|
3296 |
IMPORT_C virtual TBool WriteProtected(TUint aCardNumber);
|
|
3297 |
//
|
|
3298 |
// State Machine functions implemented in platform layer.
|
|
3299 |
|
|
3300 |
/**
|
|
3301 |
* Called as a child function at the start of the CIM_UPDATE_ACQ macro state machine.
|
|
3302 |
*
|
|
3303 |
* It should perform the necessary PSL level actions associated with powering up the bus. This includes
|
|
3304 |
* turning on the MMC PSU. However, the hardware interface clock should not be turned on as part of this function.
|
|
3305 |
*
|
|
3306 |
* If the Controller has to request power resources from the power model (e.g a fast system clock required all the
|
|
3307 |
* time the bus is powered) then this state machine function can be used to asynchronously wait for this resource
|
|
3308 |
* to become available.
|
|
3309 |
*
|
|
3310 |
* Upon completion, DMMCStack::ReportPowerUp() should be called.
|
|
3311 |
*
|
|
3312 |
* @return KMMCErrNone if completed successfully or standard TMMCErr code otherwise
|
|
3313 |
*/
|
|
3314 |
virtual TMMCErr DoPowerUpSM()=0;
|
|
3315 |
|
|
3316 |
/**
|
|
3317 |
* Turns on the clock to the hardware interface.
|
|
3318 |
*
|
|
3319 |
* This state machine function is called as a child function as part of the CIM_UPDATE_ACQ macro state machine.
|
|
3320 |
*
|
|
3321 |
* It is implemented as a state machine function since it may be necessary to include a short delay after the
|
|
3322 |
* clock has been turned on to allow it to stabilise, or in some cases it may be necessary to wait for a power
|
|
3323 |
* resource to become available.
|
|
3324 |
*
|
|
3325 |
* This function should normally include a call to ReportAsspEngaged() at the start, to report to the PIL that the PSL
|
|
3326 |
* level resources have been engaged.
|
|
3327 |
*
|
|
3328 |
* @return KMMCErrNone if completed successfully or standard TMMCErr code otherwise
|
|
3329 |
*/
|
|
3330 |
virtual TMMCErr InitClockOnSM()=0;
|
|
3331 |
|
|
3332 |
/**
|
|
3333 |
* Executes a single command over the bus.
|
|
3334 |
*
|
|
3335 |
* The input parameters are passed via the current command descriptor on the session's command stack
|
|
3336 |
* (TMMCCommandDesc class), which specifies the type of command, response type, arguments etc..
|
|
3337 |
*
|
|
3338 |
* @return KMMCErrNone if completed successfully or standard TMMCErr code otherwise
|
|
3339 |
*/
|
|
3340 |
IMPORT_C virtual TMMCErr IssueMMCCommandSM()=0;
|
|
3341 |
|
|
3342 |
TBool StaticBlocks();
|
|
3343 |
|
|
3344 |
/**
|
|
3345 |
* Indicates that the PSL should change the bus width.
|
|
3346 |
* Must be implemented by the Platform Specific Layer if MMCV4 4/8-bit bus mode is required
|
|
3347 |
*/
|
|
3348 |
IMPORT_C virtual void SetBusWidth(TUint32 aBusWidth);
|
|
3349 |
|
|
3350 |
/**
|
|
3351 |
* Retrieves a TMMCMachineInfoV4 from the PSL
|
|
3352 |
* Must be implemented by the Platform Specific Layer if MMCV4 support is required
|
|
3353 |
*/
|
|
3354 |
public:
|
|
3355 |
IMPORT_C virtual void MachineInfo(TDes8& aMachineInfo);
|
|
3356 |
|
|
3357 |
protected:
|
|
3358 |
/**
|
|
3359 |
* Switches the MMC bus to low voltage mode
|
|
3360 |
*/
|
|
3361 |
TMMCErr SwitchToLowVoltageSM();
|
|
3362 |
|
|
3363 |
|
|
3364 |
private:
|
|
3365 |
//
|
|
3366 |
// Session service
|
|
3367 |
void Add(DMMCSession* aSessP);
|
|
3368 |
void Abort(DMMCSession* aSessP);
|
|
3369 |
void Stop(DMMCSession* aSessP);
|
|
3370 |
void UnlockStack(DMMCSession* aSessP);
|
|
3371 |
void MarkComplete(DMMCSession* aSessP, TMMCErr anExitCode);
|
|
3372 |
//
|
|
3373 |
// Stack control and operations support
|
|
3374 |
// Scheduler and its supplementary functions
|
|
3375 |
enum TMMCStackSchedStateEnum
|
|
3376 |
{
|
|
3377 |
ESchedContinue=0,
|
|
3378 |
ESchedLoop=1,
|
|
3379 |
ESchedExit,
|
|
3380 |
ESchedChooseJob
|
|
3381 |
};
|
|
3382 |
void Scheduler(volatile TBool& aFlag);
|
|
3383 |
void DoSchedule();
|
|
3384 |
TMMCStackSchedStateEnum SchedGetOnDFC();
|
|
3385 |
void SchedSetContext(DMMCSession* aSessP);
|
|
3386 |
void SchedDoAbort(DMMCSession* aSessP);
|
|
3387 |
TMMCStackSchedStateEnum SchedResolveStatBlocks(DMMCSession* aSessP);
|
|
3388 |
TMMCStackSchedStateEnum SchedGroundDown(DMMCSession* aSessP, TMMCErr aReason);
|
|
3389 |
TMMCStackSchedStateEnum SchedEnqueStackSession(TMMCSessionTypeEnum aSessID);
|
|
3390 |
void SchedGrabEntries();
|
|
3391 |
void SchedDisengage();
|
|
3392 |
TBool SchedAllowDirectCommands(DMMCSession* aSessP);
|
|
3393 |
TBool SchedYielding(DMMCSession* aSessP);
|
|
3394 |
inline TMMCStackSchedStateEnum SchedAbortPass();
|
|
3395 |
inline TMMCStackSchedStateEnum SchedCompletionPass();
|
|
3396 |
inline TMMCStackSchedStateEnum SchedInitStack();
|
|
3397 |
inline TMMCStackSchedStateEnum SchedSleepStack();
|
|
3398 |
inline TBool SchedPreemptable();
|
|
3399 |
inline TMMCStackSchedStateEnum SchedSession();
|
|
3400 |
inline TMMCStackSchedStateEnum SchedChooseJob();
|
|
3401 |
//
|
|
3402 |
// Miscellaneous SM function service
|
|
3403 |
protected:
|
|
3404 |
void MergeConfig(DMMCSession* aSessP);
|
|
3405 |
private:
|
|
3406 |
inline void DeselectsToIssue(TUint aNumber);
|
|
3407 |
|
|
3408 |
// Static Completion routines.
|
|
3409 |
static void StackDFC(TAny* aStackP);
|
|
3410 |
static void StackSessionCBST(TAny* aStackP);
|
|
3411 |
TInt StackSessionCB();
|
|
3412 |
static void AutoUnlockCBST(TAny *aStackP);
|
|
3413 |
TInt AutoUnlockCB();
|
|
3414 |
|
|
3415 |
protected:
|
|
3416 |
IMPORT_C void Block(DMMCSession* aSessP, TUint32 aFlag);
|
|
3417 |
IMPORT_C void UnBlock(DMMCSession* aSessP, TUint32 aFlag, TMMCErr anExitCode);
|
|
3418 |
|
|
3419 |
protected:
|
|
3420 |
// State machines. The adapter functions just call the non-static versions.
|
|
3421 |
// Top-level state machines.
|
|
3422 |
static TMMCErr NakedSessionSMST(TAny* aStackP); // ECIMNakedSession
|
|
3423 |
inline TMMCErr NakedSessionSM();
|
|
3424 |
static TMMCErr CIMUpdateAcqSMST(TAny* aStackP); // ECIMUpdateAcq
|
|
3425 |
TMMCErr CIMUpdateAcqSM();
|
|
3426 |
static TMMCErr CIMInitStackSMST(TAny* aStackP); // ECIMInitStack
|
|
3427 |
inline TMMCErr CIMInitStackSM();
|
|
3428 |
static TMMCErr CIMCheckStackSMST(TAny* aStackP); // ECIMCheckStack
|
|
3429 |
inline TMMCErr CIMCheckStackSM();
|
|
3430 |
static TMMCErr CIMSetupCardSMST(TAny* aStackP); // ECIMSetupCard
|
|
3431 |
inline TMMCErr CIMSetupCardSM();
|
|
3432 |
IMPORT_C static TMMCErr CIMReadWriteBlocksSMST(TAny* aStackP); // ECIMReadBlock, ECIMWriteBlock, ECIMReadMBlock, ECIMWriteMBlock
|
|
3433 |
IMPORT_C virtual TMMCErr CIMReadWriteBlocksSM();
|
|
3434 |
static TMMCErr CIMEraseSMST(TAny* aStackP); // ECIMEraseSector, ECIMEraseGroup
|
|
3435 |
inline TMMCErr CIMEraseSM();
|
|
3436 |
static TMMCErr CIMReadWriteIOSMST(TAny* aStackP); // ECIMReadIO, ECIMWriteIO
|
|
3437 |
inline TMMCErr CIMReadWriteIOSM();
|
|
3438 |
static TMMCErr CIMLockUnlockSMST(TAny *aStackP); // ECIMLockUnlock
|
|
3439 |
inline TMMCErr CIMLockUnlockSM();
|
|
3440 |
static TMMCErr NoSessionSMST(TAny* aStackP); // ECIMLockStack
|
|
3441 |
inline TMMCErr NoSessionSM();
|
|
3442 |
static TMMCErr AcquireStackSMST(TAny* aStackP);
|
|
3443 |
IMPORT_C virtual TMMCErr AcquireStackSM();
|
|
3444 |
static TMMCErr CheckStackSMST(TAny* aStackP); // ECIMCheckStack
|
|
3445 |
inline TMMCErr CheckStackSM();
|
|
3446 |
static TMMCErr CheckLockStatusSMST(TAny* aStackP);
|
|
3447 |
inline TMMCErr CheckLockStatusSM();
|
|
3448 |
static TMMCErr ModifyCardCapabilitySMST(TAny* aStackP);
|
|
3449 |
IMPORT_C virtual TMMCErr ModifyCardCapabilitySM();
|
|
3450 |
static TMMCErr BaseModifyCardCapabilitySMST(TAny* aStackP);
|
|
3451 |
static TMMCErr DoPowerUpSMST(TAny* aStackP);
|
|
3452 |
static TMMCErr InitClockOnSMST(TAny* aStackP);
|
|
3453 |
IMPORT_C static TMMCErr IssueMMCCommandSMST(TAny* aStackP);
|
|
3454 |
|
|
3455 |
static TMMCErr CIMAutoUnlockSMST(TAny* aStackP);
|
|
3456 |
inline TMMCErr CIMAutoUnlockSM();
|
|
3457 |
|
|
3458 |
static TMMCErr InitStackAfterUnlockSMST(TAny* aStackP); // ECIMInitStackAfterUnlock
|
|
3459 |
IMPORT_C virtual TMMCErr InitStackAfterUnlockSM();
|
|
3460 |
|
|
3461 |
static TMMCErr InitCurrentCardAfterUnlockSMST(TAny* aStackP);
|
|
3462 |
|
|
3463 |
static TMMCErr AttachCardSMST(TAny* aStackP);
|
|
3464 |
inline TMMCErr AttachCardSM();
|
|
3465 |
static TMMCErr ExecCommandSMST(TAny* aStackP);
|
|
3466 |
inline TMMCErr ExecCommandSM();
|
|
3467 |
static TMMCErr IssueCommandCheckResponseSMST(TAny* aStackP);
|
|
3468 |
inline TMMCErr IssueCommandCheckResponseSM();
|
|
3469 |
static TMMCErr PollGapTimerSMST(TAny* aStackP);
|
|
3470 |
inline TMMCErr PollGapTimerSM();
|
|
3471 |
static TMMCErr RetryGapTimerSMST(TAny* aStackP);
|
|
3472 |
inline TMMCErr RetryGapTimerSM();
|
|
3473 |
static TMMCErr ProgramTimerSMST(TAny *aStackP);
|
|
3474 |
inline TMMCErr ProgramTimerSM();
|
|
3475 |
static TMMCErr GoIdleSMST(TAny* aStackP);
|
|
3476 |
inline TMMCErr GoIdleSM();
|
|
3477 |
|
|
3478 |
static TMMCErr SwitchToLowVoltageSMST(TAny* aStackP);
|
|
3479 |
|
|
3480 |
static TMMCErr DoWakeUpSMST(TAny* aStackP);
|
|
3481 |
|
|
3482 |
|
|
3483 |
private:
|
|
3484 |
static TMMCErr ConfigureHighSpeedSMST(TAny* aStackP);
|
|
3485 |
inline TMMCErr ConfigureHighSpeedSM();
|
|
3486 |
|
|
3487 |
static TMMCErr DetermineBusWidthAndClockSMST(TAny* aStackP);
|
|
3488 |
inline TMMCErr DetermineBusWidthAndClockSM();
|
|
3489 |
|
|
3490 |
static TMMCErr ExecSwitchCommandST(TAny* aStackP);
|
|
3491 |
inline TMMCErr ExecSwitchCommand();
|
|
3492 |
|
|
3493 |
static TMMCErr ExecSleepCommandSMST(TAny* aStackP);
|
|
3494 |
inline TMMCErr ExecSleepCommandSM();
|
|
3495 |
|
|
3496 |
static TMMCErr ExecAwakeCommandSMST(TAny* aStackP);
|
|
3497 |
inline TMMCErr ExecAwakeCommandSM();
|
|
3498 |
|
|
3499 |
static TMMCErr LowVoltagePowerupTimerSMST(TAny *aStackP);
|
|
3500 |
TMMCErr LowVoltagePowerupTimerSM();
|
|
3501 |
|
|
3502 |
static TMMCErr ExecBusTestSMST(TAny* aStackP);
|
|
3503 |
inline TMMCErr ExecBusTestSM();
|
|
3504 |
|
|
3505 |
enum TBusWidthAndClock
|
|
3506 |
{
|
|
3507 |
E1Bit20Mhz = 0x0000,
|
|
3508 |
|
|
3509 |
E4Bits26Mhz = 0x0001,
|
|
3510 |
E4Bits52Mhz = 0x0002,
|
|
3511 |
|
|
3512 |
E8Bits26Mhz = 0x0004,
|
|
3513 |
E8Bits52Mhz = 0x0008,
|
|
3514 |
};
|
|
3515 |
enum TBusWidthAndClockMasks
|
|
3516 |
{
|
|
3517 |
E4BitMask = E4Bits26Mhz | E4Bits52Mhz,
|
|
3518 |
E8BitMask = E8Bits26Mhz | E8Bits52Mhz,
|
|
3519 |
E26MhzMask = E4Bits26Mhz | E8Bits26Mhz,
|
|
3520 |
E52MhzMask = E4Bits52Mhz | E8Bits52Mhz
|
|
3521 |
};
|
|
3522 |
|
|
3523 |
void DetermineBusWidthAndClock(const TMMCard& aCard, TBool aLowVoltage, TUint& aPowerClass, TBusWidthAndClock& aBusWidthAndClock);
|
|
3524 |
TUint GetPowerClass(const TMMCard& aCard, TBusWidthAndClock aWidthAndClock, TBool aLowVoltage);
|
|
3525 |
|
|
3526 |
|
|
3527 |
// ----------- Data Members -------------
|
|
3528 |
private:
|
|
3529 |
//
|
|
3530 |
// Synchronous status, data structures and control info.
|
|
3531 |
TUint32 iStackState;
|
|
3532 |
TUint iInitContext; // Stack Initialiser pass number
|
|
3533 |
DMMCSession* iLockingSessionP;
|
|
3534 |
TMMCSessRing iWorkSet;
|
|
3535 |
TMMCSessRing iReadyQueue;
|
|
3536 |
TMMCSessRing iEntryQueue;
|
|
3537 |
TDfc iStackDFC;
|
|
3538 |
TRCA iSelectedCard;
|
|
3539 |
DMMCSocket* iSocket;
|
|
3540 |
DMMCSession* iStackSession;
|
|
3541 |
DMMCSession iAutoUnlockSession;
|
|
3542 |
TInt iAutoUnlockIndex; // index into iCards
|
|
3543 |
protected:
|
|
3544 |
TUint8* iPSLBuf;
|
|
3545 |
private:
|
|
3546 |
TInt iPSLBufLen;
|
|
3547 |
TInt iMinorBufLen;
|
|
3548 |
TUint8 iSpare[2];
|
|
3549 |
TBool volatile iSleep;
|
|
3550 |
DThread* iNotifierThread;
|
|
3551 |
TRequestStatus* iNotifierReqStat;
|
|
3552 |
enum TInitState {EISPending, EISDone};
|
|
3553 |
TInitState iInitState;
|
|
3554 |
//
|
|
3555 |
// Stack and Scheduler control
|
|
3556 |
// Asynchronous sheduler attention flags
|
|
3557 |
TBool volatile iAttention; // There are ready sessions
|
|
3558 |
TBool volatile iAbortReq; // There are sessions marked for abort
|
|
3559 |
TBool volatile iCompReq; // There are sessions to complete
|
|
3560 |
TBool volatile iInitialise; // Enforce InitStack (after enforced PowerDown)
|
|
3561 |
TBool volatile iUpdate; // Enque InitStack into iWorkSet
|
|
3562 |
// Other asynchronous flags
|
|
3563 |
TBool volatile iPoweredUp;
|
|
3564 |
TBool volatile iDFCRunning;
|
|
3565 |
TBool volatile iAbortAll;
|
|
3566 |
TMMCErr volatile iCompleteAllExitCode;
|
|
3567 |
//
|
|
3568 |
// Session context
|
|
3569 |
protected:
|
|
3570 |
DMMCSession* iSessionP;
|
|
3571 |
private:
|
|
3572 |
//
|
|
3573 |
// Bus control
|
|
3574 |
TDSR iCurrentDSR;
|
|
3575 |
//
|
|
3576 |
// Stack data structures and Session/StateMachine miscellaneous
|
|
3577 |
TUint iDeselectsToIssue;
|
|
3578 |
TInt iCxDeselectCount;
|
|
3579 |
TUint8 iCMD42CmdByte;
|
|
3580 |
TMediaPassword iMPTgt;
|
|
3581 |
public:
|
|
3582 |
IMPORT_C TUint32 EffectiveModes(const TMMCStackConfig& aClientConfig);
|
|
3583 |
TUint32 iCurrentOpRange;
|
|
3584 |
TInt iCxCardCount;
|
|
3585 |
TInt iCxPollRetryCount;
|
|
3586 |
TMMCStackConfig iConfig;
|
|
3587 |
TUint iMaxCardsInStack;
|
|
3588 |
TMMCRCAPool iRCAPool;
|
|
3589 |
TMMCardArray* iCardArray;
|
|
3590 |
TMMCStackConfig iMasterConfig;
|
|
3591 |
friend class DMMCSocket;
|
|
3592 |
friend class DMMCSession;
|
|
3593 |
friend class TMMCardArray;
|
|
3594 |
|
|
3595 |
private:
|
|
3596 |
//
|
|
3597 |
// Dummy functions to maintain binary compatibility
|
|
3598 |
IMPORT_C virtual void Dummy1();
|
|
3599 |
|
|
3600 |
protected:
|
|
3601 |
/**
|
|
3602 |
Gets an interface from a derived class
|
|
3603 |
replaces reserved virtual Dummy4()
|
|
3604 |
*/
|
|
3605 |
IMPORT_C virtual void GetInterface(TInterfaceId aInterfaceId, MInterface*& aInterfacePtr);
|
|
3606 |
|
|
3607 |
private:
|
|
3608 |
TBusWidthAndClock iBusWidthAndClock;
|
|
3609 |
TInt iSelectedCardIndex;
|
|
3610 |
//
|
|
3611 |
// Reserved members to maintain binary compatibility
|
|
3612 |
protected:
|
|
3613 |
TBool iMultiplexedBus; // ETrue if cards are individually selectable. EFalse if stacked on a common bus.
|
|
3614 |
private:
|
|
3615 |
TMMCCommandTypeEnum iYieldCommandType;
|
|
3616 |
TInt iReserved;
|
|
3617 |
|
|
3618 |
protected:
|
|
3619 |
// Pointer to protected utility class which allows class to grow while maintining BC
|
|
3620 |
// replaces fourth element of iReserved[]
|
|
3621 |
class DBody;
|
|
3622 |
friend class DBody;
|
|
3623 |
DBody* iBody;
|
|
3624 |
};
|
|
3625 |
|
|
3626 |
|
|
3627 |
|
|
3628 |
|
|
3629 |
class TMMCMachineInfo
|
|
3630 |
/**
|
|
3631 |
Platform-specific configuration information for the
|
|
3632 |
MultiMediaCard stack.
|
|
3633 |
|
|
3634 |
An object of this type is passed to the Variant implementation
|
|
3635 |
of DMMCStack::MachineInfo(), which should fill the public data
|
|
3636 |
members with appropriate information and values.
|
|
3637 |
|
|
3638 |
@publishedPartner
|
|
3639 |
@released
|
|
3640 |
*/
|
|
3641 |
{
|
|
3642 |
|
|
3643 |
public:
|
|
3644 |
enum THardwareConfig
|
|
3645 |
{
|
|
3646 |
/**
|
|
3647 |
Set this bit in iFlags if hardware supports SPI mode (not currently supported - set this bit to zero)
|
|
3648 |
*/
|
|
3649 |
ESupportsSPIMode = 0x01,
|
|
3650 |
|
|
3651 |
/**
|
|
3652 |
Set this bit in iFlags if the PSL is enabled for double-buffered data transfers
|
|
3653 |
*/
|
|
3654 |
ESupportsDoubleBuffering = 0x02,
|
|
3655 |
|
|
3656 |
/**
|
|
3657 |
Set this bit in iFlags if the PSL supports response type R7
|
|
3658 |
*/
|
|
3659 |
ESupportsR7 = 0x04,
|
|
3660 |
|
|
3661 |
/**
|
|
3662 |
Set this bit in iFlags if the hardware DMA controller utilises 8-Bit Addressing
|
|
3663 |
*/
|
|
3664 |
EDma8BitAddressing = 0x08,
|
|
3665 |
|
|
3666 |
/**
|
|
3667 |
Set this bit in iFlags if the hardware DMA controller utilises 16-Bit Addressing
|
|
3668 |
*/
|
|
3669 |
EDma16BitAddressing = 0x10,
|
|
3670 |
|
|
3671 |
/**
|
|
3672 |
Set this bit in iFlags if the hardware DMA controller utilises 32-Bit Addressing
|
|
3673 |
*/
|
|
3674 |
EDma32BitAddressing = 0x20,
|
|
3675 |
|
|
3676 |
/**
|
|
3677 |
Set this bit in iFlags if the hardware DMA controller utilises 64-Bit Addressing
|
|
3678 |
*/
|
|
3679 |
EDma64BitAddressing = 0x40,
|
|
3680 |
|
|
3681 |
/**
|
|
3682 |
Set this in iFlags if the hardware supports DMA and can cope with being given a physical address.
|
|
3683 |
This also sets the ESupportsDoubleBuffering flag, physical addressing is dependent on
|
|
3684 |
doublebuffering functionality.
|
|
3685 |
@see ESupportsDoubleBuffering
|
|
3686 |
@see KMMCCmdFlagPhysAddr flag
|
|
3687 |
*/
|
|
3688 |
ESupportsDMA = 0x082,
|
|
3689 |
|
|
3690 |
/**
|
|
3691 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 256K
|
|
3692 |
- Transfers greater than 256K will be split into multiple transactions.
|
|
3693 |
*/
|
|
3694 |
EMaxTransferLength_256K = 0x100,
|
|
3695 |
|
|
3696 |
/**
|
|
3697 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 512K
|
|
3698 |
- Transfers greater than 512K will be split into multiple transactions.
|
|
3699 |
*/
|
|
3700 |
EMaxTransferLength_512K = 0x200,
|
|
3701 |
|
|
3702 |
/**
|
|
3703 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 1M
|
|
3704 |
- Transfers greater than 1M will be split into multiple transactions.
|
|
3705 |
*/
|
|
3706 |
EMaxTransferLength_1M = 0x300,
|
|
3707 |
|
|
3708 |
/**
|
|
3709 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 2M
|
|
3710 |
- Transfers greater than 2M will be split into multiple transactions.
|
|
3711 |
*/
|
|
3712 |
EMaxTransferLength_2M = 0x400,
|
|
3713 |
|
|
3714 |
/**
|
|
3715 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 4M
|
|
3716 |
- Transfers greater than 4M will be split into multiple transactions.
|
|
3717 |
*/
|
|
3718 |
EMaxTransferLength_4M = 0x500,
|
|
3719 |
|
|
3720 |
/**
|
|
3721 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 8M
|
|
3722 |
- Transfers greater than 8M will be split into multiple transactions.
|
|
3723 |
*/
|
|
3724 |
EMaxTransferLength_8M = 0x600,
|
|
3725 |
|
|
3726 |
/**
|
|
3727 |
Set this in iFlags if the hardware is unable to perform data transfers of more than 16M
|
|
3728 |
- Transfers greater than 16M will be split into multiple transactions.
|
|
3729 |
*/
|
|
3730 |
EMaxTransferLength_16M = 0x700,
|
|
3731 |
|
|
3732 |
/**
|
|
3733 |
The card in slot 1 is internal, i.e. not removable
|
|
3734 |
*/
|
|
3735 |
ESlot1Internal = 0x0800,
|
|
3736 |
|
|
3737 |
/**
|
|
3738 |
The card in slot 2 is internal, i.e. not removable
|
|
3739 |
*/
|
|
3740 |
ESlot2Internal = 0x1000,
|
|
3741 |
};
|
|
3742 |
|
|
3743 |
public:
|
|
3744 |
/**
|
|
3745 |
The total number of MultiMediaCard slots for this stack.
|
|
3746 |
|
|
3747 |
Be aware that this refers to the stack, and NOT to the platform;
|
|
3748 |
a platform can have multiple stacks.
|
|
3749 |
*/
|
|
3750 |
TInt iTotalSockets;
|
|
3751 |
|
|
3752 |
/**
|
|
3753 |
Not currently used.
|
|
3754 |
|
|
3755 |
Set this value to zero.
|
|
3756 |
*/
|
|
3757 |
TInt iTotalMediaChanges;
|
|
3758 |
|
|
3759 |
/**
|
|
3760 |
Not currently used.
|
|
3761 |
|
|
3762 |
Set this value to zero.
|
|
3763 |
*/
|
|
3764 |
TInt iTotalPrimarySupplies;
|
|
3765 |
|
|
3766 |
union
|
|
3767 |
{
|
|
3768 |
/**
|
|
3769 |
Indicates whether the SPI protocol is being used or not.
|
|
3770 |
|
|
3771 |
SPI not currently supported; set this to EFalse.
|
|
3772 |
*/
|
|
3773 |
TBool iSPIMode; // SPI mode not yet supported
|
|
3774 |
/**
|
|
3775 |
Hardware configuration flags
|
|
3776 |
*/
|
|
3777 |
TUint32 iFlags;
|
|
3778 |
};
|
|
3779 |
|
|
3780 |
/**
|
|
3781 |
The number of the first peripheral bus slot claimed by the
|
|
3782 |
MultiMediaCard controller.
|
|
3783 |
|
|
3784 |
Symbian OS supports 4, so set this to a value in the range 0-3.
|
|
3785 |
*/
|
|
3786 |
TInt iBaseBusNumber;
|
|
3787 |
};
|
|
3788 |
|
|
3789 |
|
|
3790 |
|
|
3791 |
|
|
3792 |
typedef TPckg<TMMCMachineInfo> TMMCardMachineInfoPckg;
|
|
3793 |
|
|
3794 |
/**
|
|
3795 |
Platform-specific configuration information for the
|
|
3796 |
MultiMediaCard stack. Contains information pertinent to
|
|
3797 |
MMC specification version 4.0/4.1
|
|
3798 |
|
|
3799 |
An object of this type is passed to the Variant implementation
|
|
3800 |
of DMMCStack::MachineInfo(), which should fill the public data
|
|
3801 |
members with appropriate information and values.
|
|
3802 |
|
|
3803 |
@internalComponent
|
|
3804 |
*/
|
|
3805 |
class TMMCMachineInfoV4 : public TMMCMachineInfo
|
|
3806 |
{
|
|
3807 |
public:
|
|
3808 |
inline TMMCMachineInfoV4() {memclr(this, sizeof(*this));}
|
|
3809 |
|
|
3810 |
/**
|
|
3811 |
The version of the structure returned by the PSL in a call to DMMStack::MachineInfo()
|
|
3812 |
The fields defined in TMMCMachineInfoV4 are only valid if the version is EVersion4 or higher
|
|
3813 |
*/
|
|
3814 |
enum TVersion {EVersion3, EVersion4};
|
|
3815 |
TVersion iVersion;
|
|
3816 |
|
|
3817 |
/**
|
|
3818 |
The maximum bus width supported.
|
|
3819 |
*/
|
|
3820 |
TBusWidth iMaxBusWidth;
|
|
3821 |
|
|
3822 |
/**
|
|
3823 |
Maximum clock frequency supported,
|
|
3824 |
N.B. if the controller's maximum clock rate is only slightly less than one of the
|
|
3825 |
"high-speed" clock frequencies defined in MMC spec 4.0 (i.e 26 Mhz and 52 Mhz), then
|
|
3826 |
it can still report that it is supported and then run at the slightly lower clock rate.
|
|
3827 |
*/
|
|
3828 |
enum THighSpeedClocks {EClockSpeed26Mhz = 26, EClockSpeed52Mhz = 52};
|
|
3829 |
TUint iMaxClockSpeedInMhz;
|
|
3830 |
|
|
3831 |
/**
|
|
3832 |
The power class supported for 3.6V (high voltage).
|
|
3833 |
This is a 4-bit value encoded in the same way as the POWER_CLASS field in the EXT_CSD
|
|
3834 |
register. i.e. 0=100mA, 1=120mA, ... 10=450mA.
|
|
3835 |
See MMC sepcification version 4.1, EXT_CSD register.
|
|
3836 |
*/
|
|
3837 |
enum THiVoltagePowerClasses {EHi100mA, EHi120mA, EHi150mA, EHi180mA, EHi200mA, EHi220mA, EHi250mA, EHi300mA, EHi350mA, EHi400mA, EHi450mA };
|
|
3838 |
TUint iHighVoltagePowerClass;
|
|
3839 |
|
|
3840 |
/**
|
|
3841 |
The power class supported for 1.95V (low voltage).
|
|
3842 |
This is a 4-bit value encoded in the same way as the POWER_CLASS field in the EXT_CSD
|
|
3843 |
register. i.e. 0=65mA, 1=70mA, ... 10=250mA.
|
|
3844 |
See MMC sepcification version 4.1, EXT_CSD register.
|
|
3845 |
*/
|
|
3846 |
enum TLoVoltagePowerClasses {ELo065mA, ELo070mA, ELo080mA, ELo090mA, ELo100mA, ELo120mA, ELo140mA, ELo160mA, ELo180mA, ELo200mA, ELo250mA };
|
|
3847 |
TUint iLowVoltagePowerClass;
|
|
3848 |
};
|
|
3849 |
|
|
3850 |
|
|
3851 |
class DMMCPsu : public DPBusPsuBase
|
|
3852 |
/**
|
|
3853 |
DPBusPsuBase derived abstract class to control the MMC socket's power supply.
|
|
3854 |
|
|
3855 |
This class is intended for derivation at the variant layer, which handles the
|
|
3856 |
variant specific functionality of the power supply.
|
|
3857 |
|
|
3858 |
@publishedPartner
|
|
3859 |
@released
|
|
3860 |
*/
|
|
3861 |
{
|
|
3862 |
public:
|
|
3863 |
IMPORT_C DMMCPsu(TInt aPsuNum, TInt aMediaChangedNum);
|
|
3864 |
|
|
3865 |
// Re-declaring virtual and pure-virtual interface defined in DPBusPsuBase for clarity...
|
|
3866 |
|
|
3867 |
IMPORT_C virtual TInt DoCreate();
|
|
3868 |
|
|
3869 |
/**
|
|
3870 |
* Controls the power supply.
|
|
3871 |
* Implemented by the variant, directly controls the power to the MMC stack.
|
|
3872 |
* @param aState A TPBusPsuState enumeration specifying the required state
|
|
3873 |
* (EPsuOnFull, EPsuOff, EPsuOnCurLimit)
|
|
3874 |
*/
|
|
3875 |
virtual void DoSetState(TPBusPsuState aState)=0;
|
|
3876 |
|
|
3877 |
/**
|
|
3878 |
* Checks the PSU's voltage.
|
|
3879 |
* Implemented by the variant, uses a mechanism such as a comparator to check
|
|
3880 |
* the PSU's voltage level. Upon reciept of the voltage level (the process may
|
|
3881 |
* be asynchronous), the variant calls ReceiveVoltageCheckResult() with KErrNone
|
|
3882 |
* if the voltage is OK, KErrGeneral if there is a problem, or KErrNotReady if the
|
|
3883 |
* hardware has not yet powered up.
|
|
3884 |
*/
|
|
3885 |
virtual void DoCheckVoltage()=0;
|
|
3886 |
|
|
3887 |
/**
|
|
3888 |
* Fills in the supplied TPBusPsuInfo object with the characteristics of the platform.
|
|
3889 |
* Provided at the variant layer.
|
|
3890 |
* @param anInfo A reference to a TPBusPsuInfo to be filled in with the PSU characteristics.
|
|
3891 |
*/
|
|
3892 |
virtual void PsuInfo(TPBusPsuInfo &anInfo)=0;
|
|
3893 |
|
|
3894 |
inline void SetVoltage(TUint32 aVoltage);
|
|
3895 |
|
|
3896 |
static void SleepCheck(TAny* aPtr);
|
|
3897 |
|
|
3898 |
protected:
|
|
3899 |
/**
|
|
3900 |
* The current voltage setting, in OCR register format
|
|
3901 |
*/
|
|
3902 |
TUint32 iVoltageSetting;
|
|
3903 |
};
|
|
3904 |
|
|
3905 |
class DMMCMediaChange : public DMediaChangeBase
|
|
3906 |
/**
|
|
3907 |
DMediaChangeBase derived abstract class to handle the isertion and removal of removable media.
|
|
3908 |
|
|
3909 |
This class is intended for derivation at the variant layer, which handles the variant specific
|
|
3910 |
functionality such as interrupt detection, and calls functions of the DMediaChangeBase class
|
|
3911 |
to pass notifications of media change to the socket layers.
|
|
3912 |
|
|
3913 |
@publishedPartner
|
|
3914 |
@released
|
|
3915 |
*/
|
|
3916 |
{
|
|
3917 |
public:
|
|
3918 |
IMPORT_C DMMCMediaChange(TInt aMediaChangeNum);
|
|
3919 |
|
|
3920 |
// Re-declaring virtual and pure-virtual interface defined in DMediaChangeBase for clarity...
|
|
3921 |
|
|
3922 |
IMPORT_C virtual TInt Create();
|
|
3923 |
|
|
3924 |
/**
|
|
3925 |
* Forces a media change, executing the same actions as if a door open has occurred.
|
|
3926 |
* @see DoDoorOpen
|
|
3927 |
*/
|
|
3928 |
virtual void ForceMediaChange()=0;
|
|
3929 |
|
|
3930 |
/**
|
|
3931 |
* Called by DMediaChangeBase when the door is opened.
|
|
3932 |
* Implemented at the variant layer, DoDoorOpen is invoked in response to the variant
|
|
3933 |
* calling ::DoDoorOpenService upon detection of a door open event.
|
|
3934 |
* DoDoorOpen may queue a debounce timer which masks further events until it expires.
|
|
3935 |
* @see DoDoorClosed
|
|
3936 |
*/
|
|
3937 |
virtual void DoDoorOpen()=0;
|
|
3938 |
|
|
3939 |
/**
|
|
3940 |
* Called by DMediaChangeBase when the door is closed.
|
|
3941 |
* Implemented at the variant layer, DoDoorClosed is invoked in response to the variant
|
|
3942 |
* calling ::DoorOpenService upon detection of a door closed event.
|
|
3943 |
* Systems without a door should perform this sequence when the debounce timer has
|
|
3944 |
* expired after a door open event has been detected.
|
|
3945 |
* @see DoDoorOpen
|
|
3946 |
*/
|
|
3947 |
virtual void DoDoorClosed()=0;
|
|
3948 |
|
|
3949 |
/**
|
|
3950 |
* Returns the current state of the door.
|
|
3951 |
* Implemented at the variant layer to provide information as to the state of the door.
|
|
3952 |
* @return TMediaState enumeration descibing the state of door (EDoorOpen, EDoorClosed).
|
|
3953 |
*/
|
|
3954 |
virtual TMediaState MediaState() = 0;
|
|
3955 |
};
|
|
3956 |
|
|
3957 |
|
|
3958 |
/*===========================================================================*/
|
|
3959 |
/* CLASS : DMMCEmbeddedMediaChange */
|
|
3960 |
/*===========================================================================*/
|
|
3961 |
NONSHARABLE_CLASS(DMMCEmbeddedMediaChange) : public DMMCMediaChange
|
|
3962 |
/**
|
|
3963 |
* This class looks after the processing to be carried out when the media door
|
|
3964 |
* is opened or closed. It may be queried without the interrupt being enabled.
|
|
3965 |
*
|
|
3966 |
*/
|
|
3967 |
{
|
|
3968 |
public:
|
|
3969 |
DMMCEmbeddedMediaChange(TInt aMediaChangeNum) : DMMCMediaChange(aMediaChangeNum){};
|
|
3970 |
|
|
3971 |
/// Directly calls the media change event
|
|
3972 |
virtual void ForceMediaChange() {return;};
|
|
3973 |
|
|
3974 |
/// Handle media door open (called on media door open interrupt).
|
|
3975 |
virtual void DoDoorOpen() {return;};
|
|
3976 |
|
|
3977 |
/// Handle media door closing (called on media door open interrupt).
|
|
3978 |
virtual void DoDoorClosed() {return;};
|
|
3979 |
|
|
3980 |
/// Return status of media changed signal.
|
|
3981 |
virtual TMediaState MediaState() {return EDoorClosed;};
|
|
3982 |
};
|
|
3983 |
|
|
3984 |
|
|
3985 |
|
|
3986 |
class TMapping
|
|
3987 |
/**
|
|
3988 |
MMC Mapping
|
|
3989 |
*/
|
|
3990 |
{
|
|
3991 |
public:
|
|
3992 |
TBuf8<KMMCCIDLength> iCID;
|
|
3993 |
TMediaPassword iPWD;
|
|
3994 |
enum TState {EStPending, EStValid, EStInvalid};
|
|
3995 |
TState iState;
|
|
3996 |
};
|
|
3997 |
|
|
3998 |
NONSHARABLE_CLASS(TMMCPasswordStore) : public TPasswordStore
|
|
3999 |
/**
|
|
4000 |
MMC Password Store
|
|
4001 |
*/
|
|
4002 |
{
|
|
4003 |
public:
|
|
4004 |
TMMCPasswordStore();
|
|
4005 |
|
|
4006 |
// Pure virtual...
|
|
4007 |
TInt Init();
|
|
4008 |
TInt ReadPasswordData(TDes8 &aBuf);
|
|
4009 |
TInt WritePasswordData(TDesC8 &aBuf);
|
|
4010 |
TInt PasswordStoreLengthInBytes();
|
|
4011 |
|
|
4012 |
public:
|
|
4013 |
TMapping *FindMappingInStore(const TCID &aCID);
|
|
4014 |
TInt InsertMapping(const TCID &aCID, const TMediaPassword &aPWD, TMapping::TState aState);
|
|
4015 |
IMPORT_C TBool IsMappingIncorrect(const TCID& aCID, const TMediaPassword& aPWD);
|
|
4016 |
|
|
4017 |
static TInt CompareCID(const TMapping& aLeft, const TMapping& aRight);
|
|
4018 |
TIdentityRelation<TMapping> iIdentityRelation;
|
|
4019 |
|
|
4020 |
private:
|
|
4021 |
RArray<TMapping> *iStore;
|
|
4022 |
|
|
4023 |
friend class DMMCSocket;
|
|
4024 |
};
|
|
4025 |
|
|
4026 |
class DMMCSocket : public DPBusSocket
|
|
4027 |
/**
|
|
4028 |
This DPBusSocket derived object oversees the power supplies
|
|
4029 |
and media change functionality of DMMCStack Objects. A socket
|
|
4030 |
directly corresponds to a single stack, which may support multiple cards.
|
|
4031 |
|
|
4032 |
@publishedPartner
|
|
4033 |
@released
|
|
4034 |
*/
|
|
4035 |
{
|
|
4036 |
public:
|
|
4037 |
IMPORT_C DMMCSocket(TInt aSocketNumber, TMMCPasswordStore* aPasswordStore);
|
|
4038 |
|
|
4039 |
// Functions inherited from DPBusSocket
|
|
4040 |
virtual TInt Init();
|
|
4041 |
virtual void InitiatePowerUpSequence();
|
|
4042 |
virtual TBool CardIsPresent();
|
|
4043 |
virtual void Reset1();
|
|
4044 |
virtual void Reset2();
|
|
4045 |
|
|
4046 |
TInt TotalSupportedCards();
|
|
4047 |
|
|
4048 |
// MMC specific functions
|
|
4049 |
inline DMMCStack* Stack(TInt aBus);
|
|
4050 |
inline void ResetInactivity(TInt aBus);
|
|
4051 |
inline const TMMCMachineInfo& MachineInfo() const;
|
|
4052 |
|
|
4053 |
virtual void AdjustPartialRead(const TMMCard* aCard, TUint32 aStart, TUint32 aEnd, TUint32* aPhysStart, TUint32* aPhysEnd) const;
|
|
4054 |
virtual void GetBufferInfo(TUint8** aMDBuf, TInt* aMDBufLen);
|
|
4055 |
virtual TInt PrepareStore(TInt aBus, TInt aFunc, TLocalDrivePasswordData &aData);
|
|
4056 |
|
|
4057 |
inline TBool SupportsDoubleBuffering();
|
|
4058 |
inline TUint32 MaxDataTransferLength();
|
|
4059 |
inline TUint32 DmaAlignment();
|
|
4060 |
|
|
4061 |
protected:
|
|
4062 |
// MMC specific functions
|
|
4063 |
virtual void GetMachineInfo();
|
|
4064 |
|
|
4065 |
private:
|
|
4066 |
// Password Store Control Functions
|
|
4067 |
TInt PasswordControlStart(const TCID &aCID, const TMediaPassword *aPWD);
|
|
4068 |
void PasswordControlEnd(DMMCSession *aSessP, TInt aResult);
|
|
4069 |
TBool RefreshStore();
|
|
4070 |
|
|
4071 |
protected:
|
|
4072 |
TMMCMachineInfo iMachineInfo;
|
|
4073 |
TMMCPasswordStore* iPasswordStore;
|
|
4074 |
|
|
4075 |
public:
|
|
4076 |
DMMCStack* iStack;
|
|
4077 |
DMMCPsu* iVccCore;
|
|
4078 |
|
|
4079 |
private:
|
|
4080 |
TUint32 iReserved[4];
|
|
4081 |
|
|
4082 |
public:
|
|
4083 |
enum TMMCPanic
|
|
4084 |
{
|
|
4085 |
EMMCMachineStack =0,
|
|
4086 |
EMMCMachineState =1,
|
|
4087 |
EMMCSessRingNoSession =2,
|
|
4088 |
EMMCStackSessionEngaged =3,
|
|
4089 |
EMMCInitStackBlocked =4,
|
|
4090 |
EMMCNoFreeRCA =5,
|
|
4091 |
EMMCCommandStack =6,
|
|
4092 |
EMMCRWSessionID =7,
|
|
4093 |
EMMCEraseSessionID =8,
|
|
4094 |
EMMCIOSessionID =9,
|
|
4095 |
EMMCSessionNoPswdCard =10,
|
|
4096 |
EMMCSessionPswdCmd =11,
|
|
4097 |
EMMCSessionBadSessionID =12,
|
|
4098 |
EMMCSetBusWidthNotImplemented =13,
|
|
4099 |
EMMCInvalidNumberOfCardSlots =14,
|
|
4100 |
EMMCBadBusWidth =15,
|
|
4101 |
EMMCInvalidDBCommand =16,
|
|
4102 |
EMMCInvalidDBBlockLength =17,
|
|
4103 |
EMMCUnblockingInWrongContext =18,
|
|
4104 |
EMMCInvalidCardNumber =19,
|
|
4105 |
EMMCNotInDfcContext =20,
|
|
4106 |
};
|
|
4107 |
IMPORT_C static void Panic(TMMCPanic aPanic);
|
|
4108 |
friend class DMMCStack;
|
|
4109 |
friend class DMMCSession;
|
|
4110 |
friend class DMMCMediaChange;
|
|
4111 |
};
|
|
4112 |
|
|
4113 |
const TUint32 KMMCEraseClassCmdsSupported= KBit0;
|
|
4114 |
const TUint32 KMMCEraseGroupCmdsSupported= KBit1;
|
|
4115 |
NONSHARABLE_CLASS(TMMCEraseInfo)
|
|
4116 |
{
|
|
4117 |
public:
|
|
4118 |
inline TBool EraseClassCmdsSupported() const;
|
|
4119 |
inline TBool EraseGroupCmdsSupported() const;
|
|
4120 |
public:
|
|
4121 |
TUint32 iEraseFlags;
|
|
4122 |
TUint32 iPreferredEraseUnitSize;
|
|
4123 |
TUint32 iMinEraseSectorSize;
|
|
4124 |
};
|
|
4125 |
|
|
4126 |
#include <drivers/mmc.inl>
|
|
4127 |
|
|
4128 |
#endif // __MMC_H__
|
|
4129 |
|