|
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 // |
|
15 // WARNING: This file contains some APIs which are internal and are subject |
|
16 // to change without noticed. Such APIs should therefore not be used |
|
17 // outside the Kernel and Hardware Services package. |
|
18 // |
|
19 |
|
20 /** |
|
21 |
|
22 A static function that takes the 4 bytes that are stored in a memory location |
|
23 in ascending address order, and returns them as a 32-bit unsigned integer |
|
24 in big-endian format. |
|
25 |
|
26 @param aPtr A pointer to the memory location containing the 4 bytes to be stored. |
|
27 |
|
28 @return A 32 bit unsigned integer containing the 4 bytes in big-endian format. |
|
29 */ |
|
30 inline TUint32 TMMC::BigEndian32(const TUint8* aPtr) |
|
31 {return( (aPtr[0]<<24) | (aPtr[1]<<16) | (aPtr[2]<<8) | (aPtr[3]) );} |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 /** |
|
37 A static function that takes the specified 32-bit unsigned integer, assumed to |
|
38 be in big-endian format, and stores this into the specified memory location. |
|
39 |
|
40 @param aPtr A pointer to a 4 byte memory location which is to contain |
|
41 the unsigned integer. |
|
42 @param aVal A 32 bit unsigned integer in big-endian format. |
|
43 */ |
|
44 inline void TMMC::BigEndian4Bytes(TUint8* aPtr, TUint32 aVal) |
|
45 { |
|
46 aPtr[0] = (TUint8)(aVal >> 24); |
|
47 aPtr[1] = (TUint8)(aVal >> 16); |
|
48 aPtr[2] = (TUint8)(aVal >> 8); |
|
49 aPtr[3] = (TUint8)aVal; |
|
50 } |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 // -------- class TCID -------- |
|
56 |
|
57 inline TCID::TCID(const TUint8* aPtr) |
|
58 {memcpy(&iData[0], aPtr, KMMCCIDLength);} |
|
59 |
|
60 inline TCID& TCID::operator=(const TCID& aCID) |
|
61 {memcpy(&iData[0], &aCID.iData[0], KMMCCIDLength); return(*this);} |
|
62 |
|
63 inline TCID& TCID::operator=(const TUint8* aPtr) |
|
64 {memcpy(&iData[0], aPtr, KMMCCIDLength); return(*this);} |
|
65 |
|
66 inline TBool TCID::operator==(const TCID& aCID) const |
|
67 {return(memcompare(&iData[0],KMMCCIDLength,&aCID.iData[0],KMMCCIDLength)==0);} |
|
68 |
|
69 inline TBool TCID::operator==(const TUint8* aPtr) const |
|
70 {return(memcompare(&iData[0],KMMCCIDLength,aPtr,KMMCCIDLength)==0);} |
|
71 |
|
72 inline void TCID::Copy(TUint8* aPtr) const |
|
73 {memcpy(aPtr, &iData[0], KMMCCIDLength);} |
|
74 |
|
75 inline TUint8 TCID::At(TUint anIndex) const |
|
76 {return(iData[KMMCCIDLength-1-anIndex]);} |
|
77 |
|
78 // -------- class TCSD -------- |
|
79 |
|
80 inline TCSD::TCSD(const TUint8* aPtr) |
|
81 {memcpy(&iData[0], aPtr, KMMCCSDLength);} |
|
82 |
|
83 inline TCSD& TCSD::operator=(const TCSD& aCSD) |
|
84 {memcpy(&iData[0], &aCSD.iData[0], KMMCCSDLength); return(*this);} |
|
85 |
|
86 inline TCSD& TCSD::operator=(const TUint8* aPtr) |
|
87 {memcpy(&iData[0], aPtr, KMMCCSDLength); return(*this);} |
|
88 |
|
89 inline void TCSD::Copy(TUint8* aPtr) const |
|
90 {memcpy(aPtr, &iData[0], KMMCCSDLength);} |
|
91 |
|
92 inline TUint8 TCSD::At(TUint anIndex) const // anIndex byte in little-endian format |
|
93 {return(iData[KMMCCSDLength-1-anIndex]);} |
|
94 |
|
95 // Raw field accessors. Encoded values such as memory capacity are calulated in |
|
96 // non-inline functions defined in ps_mmc.cpp. |
|
97 |
|
98 inline TUint TCSD::CSDStructure() const {return( CSDField(127,126) );} |
|
99 inline TUint TCSD::SpecVers() const {return( CSDField(125,122) );} |
|
100 inline TUint TCSD::Reserved120() const {return( CSDField(121,120) );} |
|
101 inline TUint TCSD::TAAC() const {return( CSDField(119,112) );} |
|
102 inline TUint TCSD::NSAC() const {return( CSDField(111,104) );} |
|
103 inline TUint TCSD::TranSpeed() const {return( CSDField(103,96) );} |
|
104 inline TUint TCSD::CCC() const {return( CSDField(95,84) );} |
|
105 inline TUint TCSD::ReadBlLen() const {return( CSDField(83,80) );} |
|
106 inline TBool TCSD::ReadBlPartial() const {return( CSDField(79,79) );} |
|
107 inline TBool TCSD::WriteBlkMisalign() const {return( CSDField(78,78) );} |
|
108 inline TBool TCSD::ReadBlkMisalign() const {return( CSDField(77,77) );} |
|
109 inline TBool TCSD::DSRImp() const {return( CSDField(76,76) );} |
|
110 inline TUint TCSD::Reserved74() const {return( CSDField(75,74) );} |
|
111 inline TUint TCSD::CSize() const {return( CSDField(73,62) );} |
|
112 inline TUint TCSD::VDDRCurrMin() const {return( CSDField(61,59) );} |
|
113 inline TUint TCSD::VDDRCurrMax() const {return( CSDField(58,56) );} |
|
114 inline TUint TCSD::VDDWCurrMin() const {return( CSDField(55,53) );} |
|
115 inline TUint TCSD::VDDWCurrMax() const {return( CSDField(52,50) );} |
|
116 inline TUint TCSD::CSizeMult() const {return( CSDField(49,47) );} |
|
117 |
|
118 inline TUint TCSD::EraseGrpSize() const {return( CSDField(46,42) );} |
|
119 inline TUint TCSD::EraseGrpMult() const {return( CSDField(41,37) );} |
|
120 inline TUint TCSD::WPGrpSize() const {return( CSDField(36,32) );} |
|
121 |
|
122 inline TBool TCSD::WPGrpEnable() const {return( CSDField(31,31) );} |
|
123 inline TUint TCSD::DefaultECC() const {return( CSDField(30,29) );} |
|
124 inline TUint TCSD::R2WFactor() const {return( CSDField(28,26) );} |
|
125 inline TUint TCSD::WriteBlLen() const {return( CSDField(25,22) );} |
|
126 inline TBool TCSD::WriteBlPartial() const {return( CSDField(21,21) );} |
|
127 inline TUint TCSD::Reserved16() const {return( CSDField(20,16) );} |
|
128 inline TBool TCSD::FileFormatGrp() const {return( CSDField(15,15) );} |
|
129 inline TBool TCSD::Copy() const {return( CSDField(14,14) );} |
|
130 inline TBool TCSD::PermWriteProtect() const {return( CSDField(13,13) );} |
|
131 inline TBool TCSD::TmpWriteProtect() const {return( CSDField(12,12) );} |
|
132 inline TUint TCSD::FileFormat() const {return( CSDField(11,10) );} |
|
133 inline TUint TCSD::ECC() const {return( CSDField(9,8) );} |
|
134 inline TUint TCSD::CRC() const {return( CSDField(7,1) );} |
|
135 |
|
136 // -------- class TExtendedCSD -------- |
|
137 |
|
138 inline TExtendedCSD::TExtendedCSD() // Default constructor |
|
139 {} |
|
140 |
|
141 inline TExtendedCSD::TExtendedCSD(const TUint8* aPtr) |
|
142 {memcpy(&iData[0], aPtr, KMMCExtendedCSDLength);} |
|
143 |
|
144 inline TExtendedCSD& TExtendedCSD::operator=(const TExtendedCSD& aCSD) |
|
145 {memcpy(&iData[0], &aCSD.iData[0], KMMCExtendedCSDLength); return(*this);} |
|
146 |
|
147 inline TExtendedCSD& TExtendedCSD::operator=(const TUint8* aPtr) |
|
148 {memcpy(&iData[0], aPtr, KMMCExtendedCSDLength); return(*this);} |
|
149 |
|
150 inline TMMCArgument TExtendedCSD::GetWriteArg(TExtCSDAccessBits aAccess, TExtCSDModesFieldIndex aIndex, TUint aValue, TUint aCmdSet) |
|
151 {return TMMCArgument((aAccess << 24) | (aIndex << 16) | (aValue << 8) | (aCmdSet));} |
|
152 |
|
153 inline TUint8* TExtendedCSD::Ptr() {return &iData[0];} |
|
154 |
|
155 // Raw field accessors. |
|
156 // "Properties Segment" of Extended CSD - i.e. read-only fields |
|
157 inline TUint TExtendedCSD::SupportedCmdSet() const {return iData[504];} |
|
158 inline TUint TExtendedCSD::SectorCount() const {return(iData[212] | ((TUint)iData[213] << 8) | ((TUint)iData[214] << 16) | ((TUint)iData[215] << 24));} |
|
159 inline TUint TExtendedCSD::MinPerfWrite8Bit52Mhz() const {return iData[210];} |
|
160 inline TUint TExtendedCSD::MinPerfRead8Bit52Mhz() const {return iData[209];} |
|
161 inline TUint TExtendedCSD::MinPerfWrite8Bit26Mhz_4Bit52Mhz() const {return iData[208];} |
|
162 inline TUint TExtendedCSD::MinPerfRead8Bit26Mhz_4Bit52Mhz() const {return iData[207];} |
|
163 inline TUint TExtendedCSD::MinPerfWrite4Bit26Mhz() const {return iData[206];} |
|
164 inline TUint TExtendedCSD::MinPerfRead4Bit26Mhz() const {return iData[205];} |
|
165 inline TUint TExtendedCSD::PowerClass26Mhz360V() const {return iData[203];} |
|
166 inline TUint TExtendedCSD::PowerClass52Mhz360V() const {return iData[202];} |
|
167 inline TUint TExtendedCSD::PowerClass26Mhz195V() const {return iData[201];} |
|
168 inline TUint TExtendedCSD::PowerClass52Mhz195V() const {return iData[200];} |
|
169 inline TUint TExtendedCSD::CardType() const {return iData[196];} |
|
170 inline TUint TExtendedCSD::CSDStructureVer() const {return iData[194];} |
|
171 inline TUint TExtendedCSD::ExtendedCSDRev() const {return iData[EExtendedCSDRevIndex];} |
|
172 inline TUint TExtendedCSD::AccessSize() const {return iData[EAccessSizeIndex];} |
|
173 inline TUint TExtendedCSD::HighCapacityEraseGroupSize() const {return iData[EHighCapacityEraseGroupSizeIndex];} |
|
174 inline TUint TExtendedCSD::BootInfo() const {return iData[228];} |
|
175 inline TUint TExtendedCSD::BootSizeMultiple() const {return iData[226];} |
|
176 inline TUint TExtendedCSD::EraseTimeoutMultiple() const {return iData[223];} |
|
177 inline TUint TExtendedCSD::ReliableWriteSector() const {return iData[222];} |
|
178 inline TUint TExtendedCSD::HighCapacityWriteProtectGroupSize() const {return iData[221];} |
|
179 inline TUint TExtendedCSD::SleepCurrentVcc() const {return iData[220];} |
|
180 inline TUint TExtendedCSD::SleepCurrentVccQ() const {return iData[219];} |
|
181 inline TUint TExtendedCSD::SleepAwakeTimeout() const {return iData[217];} |
|
182 |
|
183 // "Modes Segment" of Extended CSD - i.e. modifiable fields |
|
184 inline TUint TExtendedCSD::CmdSet() const {return iData[ECmdSetIndex];} |
|
185 inline TUint TExtendedCSD::CmdSetRev() const {return iData[ECmdSetRevIndex];} |
|
186 inline TUint TExtendedCSD::PowerClass() const {return iData[EPowerClassIndex];} |
|
187 inline TUint TExtendedCSD::HighSpeedTiming() const {return iData[EHighSpeedInterfaceTimingIndex];} |
|
188 inline TUint TExtendedCSD::BusWidthMode() const {return iData[EBusWidthModeIndex];} |
|
189 inline TUint TExtendedCSD::BootConfig() const {return iData[EBootConfigIndex];} |
|
190 inline TUint TExtendedCSD::BootBusWidth() const {return iData[EBootBusWidthIndex];} |
|
191 inline TUint TExtendedCSD::EraseGroupDef() const {return iData[EEraseGroupDefIndex];} |
|
192 |
|
193 // -------- class TMMCStatus -------- |
|
194 /** |
|
195 * Constructor for TMMCStatus. |
|
196 * @param aPtr A pointer to the memory location containing the 4 bytes to be stored. |
|
197 The 4 bytes corresponds to MMC card response. Refer to the MMC card specification for the possible values of response. |
|
198 */ |
|
199 inline TMMCStatus::TMMCStatus(const TUint8* aPtr) : iData(TMMC::BigEndian32(aPtr)) {} |
|
200 |
|
201 /** |
|
202 * constructs the TMMCStatus object with value corresponding to MMC status register. |
|
203 * @param aData Value corresponding to MMC status register. |
|
204 */ |
|
205 inline TMMCStatus::TMMCStatus(const TUint32& aData) : iData(aData) {} |
|
206 |
|
207 /** |
|
208 * Gets the bitfield(32 bits) representing the MMC status register. |
|
209 * @return Value corresponding to MMC status register. |
|
210 */ |
|
211 inline TMMCStatus::operator TUint32() const {return(iData);} |
|
212 |
|
213 /** |
|
214 * Gets the error status. |
|
215 * For the possible values, refer to the MMC card R1 Response. |
|
216 * @see DMMCStack |
|
217 * @return MMC card error status. |
|
218 */ |
|
219 inline TUint32 TMMCStatus::Error() const { return(iData & KMMCStatErrorMask); } |
|
220 |
|
221 /** |
|
222 * Gets the MMC card's current state machine. |
|
223 * For the possible values of the state machine, refer to the MMC card specification. |
|
224 * @return The current state of the state machine. |
|
225 */ |
|
226 inline TMMCardStateEnum TMMCStatus::State() const |
|
227 { return((TMMCardStateEnum)(iData & KMMCStatCurrentStateMask)); } |
|
228 |
|
229 /** |
|
230 * Replace the MMC card's current state with supplied value |
|
231 * @param aState The new MMC card State |
|
232 */ |
|
233 inline void TMMCStatus::UpdateState(TMMCardStateEnum aState) |
|
234 { |
|
235 iData &= ~KMMCStatCurrentStateMask; |
|
236 iData |= aState; |
|
237 } |
|
238 |
|
239 |
|
240 // -------- class TMMCArgument -------- |
|
241 |
|
242 inline TMMCArgument::TMMCArgument() |
|
243 /** |
|
244 * Default constructor |
|
245 * Initialises the argument to zero. |
|
246 */ |
|
247 {} |
|
248 |
|
249 inline TMMCArgument::TMMCArgument(const TUint32& aData) |
|
250 : iData(aData) |
|
251 /** |
|
252 * Constructs a TMMCArgument with a 32-bit parameter. |
|
253 * @param aData The 32-bit parameter. |
|
254 */ |
|
255 {} |
|
256 |
|
257 inline TMMCArgument::TMMCArgument(TRCA anRCA) : iData(TUint(anRCA)<<16) |
|
258 /** |
|
259 * Constructs a TMMCArgument with a Relative Card Address (RCA). |
|
260 * @param anRCA The RCA. |
|
261 */ |
|
262 {} |
|
263 inline TMMCArgument::TMMCArgument(TDSR aDSR) : iData(TUint(aDSR)<<16) |
|
264 /** |
|
265 * Constructs a TMMCArgument with a Driver Stage Register (DSR). |
|
266 * @param aDSR The DSR. |
|
267 */ |
|
268 {} |
|
269 |
|
270 inline TMMCArgument::operator TUint32() const |
|
271 /** |
|
272 * Converts the TMMCArgument to it's raw 32-bit representation. |
|
273 * @return Raw 32-bit argument data |
|
274 */ |
|
275 {return(iData);} |
|
276 |
|
277 inline void TMMCArgument::SetRCA(TRCA anRCA) |
|
278 /** |
|
279 * Sets the Relative Card Address |
|
280 * @param anRCA The RCA. |
|
281 */ |
|
282 {iData=(iData&0xFFFF)|(TUint(anRCA)<<16);} |
|
283 |
|
284 // -------- class TRCA -------- |
|
285 |
|
286 inline TRCA::TRCA(TUint16 aData) : iData(aData) |
|
287 /** |
|
288 * Constructs a TRCA with a 16-bit RCA. |
|
289 * @param aData The 16-bit RCA. |
|
290 */ |
|
291 {} |
|
292 |
|
293 inline TRCA::TRCA(TInt aData) : iData(static_cast<TUint16>(aData)) |
|
294 /** |
|
295 * Constructs a TRCA with a parameter of type TInt. |
|
296 * @param aData The TInt parameter. |
|
297 */ |
|
298 {} |
|
299 |
|
300 inline TRCA::TRCA(TMMCArgument aData) |
|
301 /** |
|
302 * Constructs a TRCA with a TMMCArgument containing a RCA. |
|
303 * @param aData The argument containing the RCA. |
|
304 */ |
|
305 {iData=(TUint16)((TUint32(aData)>>16)&0xFFFF);} |
|
306 |
|
307 inline TRCA::operator TUint16() const |
|
308 /** |
|
309 * Converts the TRCA to it's raw 16-bit representation. |
|
310 * @return Raw 16-bit RCA |
|
311 */ |
|
312 {return(iData);} |
|
313 |
|
314 // -------- class TDSR -------- |
|
315 |
|
316 inline TDSR::TDSR() |
|
317 /** |
|
318 * Default constructor. |
|
319 * Initialises the DRS to zero |
|
320 */ |
|
321 {} |
|
322 |
|
323 inline TDSR::TDSR(TUint16 aData) : iData(aData) |
|
324 /** |
|
325 * Constructs a TDSR with a 16-bit DSR. |
|
326 * @param aData The 16-bit DSR. |
|
327 */ |
|
328 {} |
|
329 |
|
330 inline TDSR::operator TUint16() const |
|
331 /** |
|
332 * Converts the TDSR to it's raw 16-bit representation. |
|
333 * @return Raw 16-bit DSR |
|
334 */ |
|
335 {return(iData);} |
|
336 |
|
337 |
|
338 // -------- class TMMCard -------- |
|
339 inline TBool TMMCard::IsHighCapacity() const { return (iFlags & KMMCardIsHighCapacity) != 0; } |
|
340 |
|
341 inline TBool TMMCard::IsPresent() const |
|
342 // |
|
343 // If the card is present, its index shows the card number + 1 |
|
344 // |
|
345 {return( iIndex != 0 );} |
|
346 |
|
347 inline TInt TMMCard::Number() const {return( iIndex - 1 );} |
|
348 inline TMMCMediaTypeEnum TMMCard::MediaType() const {return(iCSD.MediaType());} |
|
349 inline const TCID& TMMCard::CID() const {return(iCID);} |
|
350 inline const TCSD& TMMCard::CSD() const {return(iCSD);} |
|
351 inline const TExtendedCSD& TMMCard::ExtendedCSD() const {return(iExtendedCSD);} |
|
352 inline TRCA TMMCard::RCA() const {return(iRCA);} |
|
353 inline TBool TMMCard::HasPassword() const {return(iFlags&KMMCardHasPassword);} |
|
354 inline TBool TMMCard::IsWriteProtected() const {return(iFlags&KMMCardIsWriteProtected);} |
|
355 |
|
356 inline TUint TMMCard::DeviceSize() const |
|
357 { |
|
358 TInt64 capacity = DeviceSize64(); |
|
359 return(capacity > KMaxTInt ? KMaxTInt : I64LOW(capacity)); |
|
360 } |
|
361 |
|
362 /** |
|
363 Gets the bus width setting for this card. |
|
364 Note returned value may differ from current host controller bus width setting. |
|
365 returns 1, 4 or 8 |
|
366 */ |
|
367 inline TInt TMMCard::BusWidth() const |
|
368 {return iBusWidth;} |
|
369 |
|
370 /** |
|
371 Sets the bus width setting for this card. |
|
372 Note this buswidth will not be applied to the host controller and is only used for recording. |
|
373 |
|
374 @param aBusWidth the bus width to set - valid values are 1, 4 or 8 |
|
375 */ |
|
376 inline void TMMCard::SetBusWidth(TInt aBusWidth) |
|
377 {iBusWidth=aBusWidth;} |
|
378 |
|
379 inline void TMMCard::SetHighSpeedClock(TUint32 aHighSpeedClock) |
|
380 {iHighSpeedClock = aHighSpeedClock;} |
|
381 inline TUint32 TMMCard::HighSpeedClock() const |
|
382 {return iHighSpeedClock;} |
|
383 |
|
384 // -------- class TMMCardArray -------- |
|
385 |
|
386 inline TMMCardArray::TMMCardArray(DMMCStack* anOwningStack) |
|
387 {iOwningStack=anOwningStack;} |
|
388 inline TUint TMMCardArray::NewCardCount() |
|
389 {return(iNewCardsCount);} |
|
390 inline TInt TMMCardArray::CardsPresent() |
|
391 {return(iCardsPresent);} |
|
392 inline TMMCard* TMMCardArray::NewCardP(TUint aNewCardNumber) |
|
393 {return(iNewCards[aNewCardNumber]);} |
|
394 inline TMMCard* TMMCardArray::CardP(TUint aCardNumber) |
|
395 {return(iCards[aCardNumber]);} |
|
396 inline TMMCard& TMMCardArray::NewCard(TUint aCardNumber) |
|
397 {return *iNewCards[aCardNumber];} |
|
398 inline TMMCard& TMMCardArray::Card(TUint aCardNumber) |
|
399 {return *iCards[aCardNumber];} |
|
400 |
|
401 // -------- class TMMCCommandDesc -------- |
|
402 |
|
403 inline TBool TMMCCommandDesc::IsBlockCmd() const |
|
404 { return ((iFlags & KMMCCmdFlagBlockAddress) != 0); } |
|
405 |
|
406 inline TUint32 TMMCCommandDesc::NumBlocks() const |
|
407 { return iTotalLength / BlockLength(); } |
|
408 |
|
409 inline TInt64 TMMCCommandDesc::Arg64() const |
|
410 { return IsBlockCmd()? ((TInt64)(TUint32)iArgument) << KMMCardHighCapBlockSizeLog2 : (TInt64)(TUint32)iArgument; } |
|
411 |
|
412 inline TBool TMMCCommandDesc::IsDoubleBuffered() const |
|
413 { return ((iFlags & KMMCCmdFlagDoubleBuffer) != 0); } |
|
414 |
|
415 inline TBool TMMCCommandDesc::IsPhysicalAddress() const |
|
416 { return ((iFlags & KMMCCmdFlagPhysAddr) != 0); } |
|
417 |
|
418 /** |
|
419 Returns the buffer length in bytes. If the current request is double-buffered, |
|
420 this returns the amount of data available in the currently active buffer. |
|
421 If the command is not double-buffered, the total amount of data to be transferred is returned. |
|
422 |
|
423 @return Buffer length in bytes |
|
424 */ |
|
425 inline TUint32 TMMCCommandDesc::BufferLength() const |
|
426 { return (IsDoubleBuffered() ? (iBlockLength >> 16) << KMMCardHighCapBlockSizeLog2 : iTotalLength); } |
|
427 |
|
428 inline TUint32 TMMCCommandDesc::BlockLength() const |
|
429 { return (IsDoubleBuffered() ? (iBlockLength & 0x0000FFFF) : iBlockLength); } |
|
430 |
|
431 // -------- class TMMCStackConfig -------- |
|
432 |
|
433 inline TMMCStackConfig::TMMCStackConfig() : iUpdateMask(0), iClientMask(0) |
|
434 /** |
|
435 * Constructor for a TMMCStackConfig object. |
|
436 */ |
|
437 {} |
|
438 |
|
439 inline void TMMCStackConfig::SetMode(TUint32 aMask) |
|
440 /** |
|
441 * Enable a single mode or a set of modes. |
|
442 * Enabled modes should be considered by the Controller as effective. However, client mode |
|
443 * settings may be overridden by master settings. |
|
444 * @param aMask The mode(s) to be set. |
|
445 */ |
|
446 {iModes |= aMask; iUpdateMask |= aMask;} |
|
447 |
|
448 inline void TMMCStackConfig::RemoveMode(TUint32 aMask) |
|
449 /** |
|
450 * Disable a single mode or a set of modes. |
|
451 * Disabled modes should be considered by the Controller as not in effect. However, client mode |
|
452 * settings may be overridden by master settings. |
|
453 * @param aMask The mode(s) to be removed. |
|
454 */ |
|
455 {iModes &= ~aMask; iUpdateMask |= aMask;} |
|
456 |
|
457 inline void TMMCStackConfig::UseDefault(TUint32 aMask) |
|
458 /** |
|
459 * Restore a single mode or a set of modes to the default setting setting for the platform. |
|
460 * @param aMask The mode(s) to be restored. |
|
461 */ |
|
462 {iUpdateMask &= ~aMask; iClientMask &= ~aMask;} |
|
463 |
|
464 inline void TMMCStackConfig::SetPollAttempts(TUint aData) |
|
465 /** |
|
466 * Set the number of attempts the Controller is allowed to make to recover on busy timeout during writes to the card. |
|
467 * The default setting for this is KMMCMaxPollAttempts (i.e. 5). |
|
468 * @param aData The number of attempts to make to recover on busy timeout during write |
|
469 */ |
|
470 {iPollAttempts=aData; iClientMask |= KMMCModeClientPollAttempts; } |
|
471 |
|
472 inline void TMMCStackConfig::SetOpCondBusyTimeout(TUint16 aData) |
|
473 /** |
|
474 * Set the number of attempts the Controller is allowed to make to recover on busy timeout |
|
475 * while waiting for a card which is slow to power up during stack initialisation. The default setting |
|
476 * for this is KMMCMaxOpCondBusyTimeout (i.e. 100). |
|
477 * @param aData The number of attempts to make to recover on busy timeout during power up |
|
478 */ |
|
479 {iOpCondBusyTimeout=aData; iClientMask |= KMMCModeClientiOpCondBusyTimeout; } |
|
480 |
|
481 inline TInt TMMCStackConfig::OpCondBusyTimeout() |
|
482 /** |
|
483 * Return the number of attempts the Controller is allowed to make to recover on busy timeout |
|
484 * while waiting for a card which is slow to power up during stack initialisation. |
|
485 * @return The number of attempts to make to recover on busy timeout |
|
486 */ |
|
487 {return((TInt)iOpCondBusyTimeout);} |
|
488 |
|
489 inline void TMMCStackConfig::SetTimeOutRetries(TUint aData) |
|
490 /** |
|
491 * Set the number of auto reties the Controller is allowed to make on command response time-out or data |
|
492 * block receive timeout situations. The default setting for this is KMMCMaxTimeOutRetries (i.e. 1). |
|
493 * @param aData The number of auto reties to make on command response time-out or data block receive timeout condition. |
|
494 */ |
|
495 {iTimeOutRetries=aData; iClientMask |= KMMCModeClientTimeOutRetries; } |
|
496 |
|
497 inline void TMMCStackConfig::SetCRCRetries(TUint aData) |
|
498 /** |
|
499 * Set the number of auto reties the Controller is allowed to make on CRC error situations. |
|
500 * The default setting for this is KMMCMaxCRCRetries (i.e. 1). |
|
501 * @param aData The number of auto reties to make on a CRC error condition. |
|
502 */ |
|
503 {iCRCRetries=aData; iClientMask |= KMMCModeClientCRCRetries; } |
|
504 |
|
505 inline void TMMCStackConfig::SetBusClockInKhz(TUint aData) |
|
506 /** |
|
507 * Set the bus clock speed in kilohertz. |
|
508 * The default master setting for this depends on the platform (set in DMMCStack::SetBusConfigDefaults). |
|
509 * @param aData The bus clock speed in kilohertz |
|
510 */ |
|
511 {iBusConfig.iBusClock=aData; iClientMask |= KMMCModeClientBusClock; } |
|
512 |
|
513 inline void TMMCStackConfig::SetTicksClockIn(TUint aData) |
|
514 /** |
|
515 * Set the number of clock ticks in the ClockIn phase to be used. |
|
516 * The default master setting for this depends on the platform (set in DMMCStack::SetBusConfigDefaults). |
|
517 * @param aData The number of clock ticks in the ClockIn phase |
|
518 */ |
|
519 {iBusConfig.iClockIn=aData; iClientMask |= KMMCModeClientClockIn; } |
|
520 |
|
521 inline void TMMCStackConfig::SetTicksClockOut(TUint aData) |
|
522 /** |
|
523 * Set the number of clock ticks in the ClockOut phase to be used. |
|
524 * The default master setting for this depends on the platform (set in DMMCStack::SetBusConfigDefaults). |
|
525 * @param aData The number of clock ticks in the ClockOut phase |
|
526 */ |
|
527 {iBusConfig.iClockOut=aData; iClientMask |= KMMCModeClientClockOut; } |
|
528 |
|
529 inline void TMMCStackConfig::SetResponseTimeOutInTicks(TUint aData) |
|
530 /** |
|
531 * Set the response timeout value to be used (in bus clock ticks). |
|
532 * If a command response is not received within this period then the Controller will either retry or return an error. |
|
533 * The default master setting for this depends on the platform (set in DMMCStack::SetBusConfigDefaults). |
|
534 * @param aData The response timeout in bus clock ticks |
|
535 */ |
|
536 {iBusConfig.iResponseTimeOut=aData; iClientMask |= KMMCModeClientResponseTimeOut; } |
|
537 |
|
538 inline void TMMCStackConfig::SetDataTimeOutInMcs(TUint aData) |
|
539 /** |
|
540 * Set the data timeout value to be used (in microseconds). |
|
541 * If an expected data block is not received from the card within this period then the Controller will |
|
542 * either retry or return an error. |
|
543 * The default master setting for this depends on the platform (set in DMMCStack::SetBusConfigDefaults). |
|
544 * @param aData The data timeout in microseconds |
|
545 */ |
|
546 {iBusConfig.iDataTimeOut=aData; iClientMask |= KMMCModeClientDataTimeOut; } |
|
547 |
|
548 inline void TMMCStackConfig::SetBusyTimeOutInMcs(TUint aData) |
|
549 /** |
|
550 * Set the busy timeout value to be used (in microseconds). |
|
551 * If a data block is not requested by the card within this period then the Controller will either retry |
|
552 * or return an error. |
|
553 * The default master setting for this depends on the platform (set in DMMCStack::SetBusConfigDefaults). |
|
554 * @param aData The busy timeout in microseconds |
|
555 */ |
|
556 {iBusConfig.iBusyTimeOut=aData; iClientMask |= KMMCModeClientBusyTimeOut; } |
|
557 |
|
558 |
|
559 // -------- class TMMCRCAPool -------- |
|
560 |
|
561 inline TMMCRCAPool::TMMCRCAPool() : iLocked(0) {} |
|
562 inline void TMMCRCAPool::LockRCA(TRCA anRCA) {iLocked |= (1 << (((TUint(anRCA) / 257) - 1) & 31));} |
|
563 inline void TMMCRCAPool::UnlockRCA(TRCA anRCA) {iLocked &= ~(1 << (((TUint(anRCA) / 257) - 1) & 31));} |
|
564 inline void TMMCRCAPool::ReleaseUnlocked() {iPool = 0;} |
|
565 |
|
566 |
|
567 // -------- class TMMCSessRing -------- |
|
568 |
|
569 inline TBool TMMCSessRing::IsEmpty() const {return(iSize==0);} |
|
570 inline void TMMCSessRing::SetMarker() {iPMark=iPrevP;} |
|
571 inline void TMMCSessRing::AdvanceMarker() {if(iPMark != NULL) iPMark=iPMark->iLinkP;} |
|
572 inline void TMMCSessRing::Point() {iPoint=((iPrevP=iPMark)==NULL)? NULL : iPMark->iLinkP;} |
|
573 inline TUint TMMCSessRing::Size() const {return(iSize);} |
|
574 inline TMMCSessRing::operator DMMCSession*() const {return(iPoint);} |
|
575 |
|
576 |
|
577 // -------- class TMMCStateMachine -------- |
|
578 |
|
579 |
|
580 /** |
|
581 Gets the current MultiMediCard error code. |
|
582 |
|
583 @return The current MultiMediCard error code. |
|
584 */ |
|
585 inline TMMCErr TMMCStateMachine::ExitCode() { return(iExitCode); } |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 /** |
|
591 Gets the current MultiMediCard error code, and sets a new error code. |
|
592 |
|
593 @param aCode The new error code value to be set. |
|
594 |
|
595 @return The current MultiMediCard error code. |
|
596 */ |
|
597 inline TMMCErr TMMCStateMachine::SetExitCode(TMMCErr aCode) { return __e32_atomic_swp_ord32(&iExitCode, aCode); } |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 /** |
|
603 Gets the current state of the state machine. |
|
604 |
|
605 Note that this is the state of the current state entry within |
|
606 the state machine stack. |
|
607 |
|
608 @return The current state of the state machine. |
|
609 */ |
|
610 inline TUint TMMCStateMachine::State() { return(iStack[iSP].iState); } |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 /** |
|
616 Sets the state of the state machine. |
|
617 |
|
618 Note that this sets the state of the current state entry within |
|
619 the state machine stack. |
|
620 |
|
621 @param aState The state to be set. |
|
622 |
|
623 @return KMMCErrNone |
|
624 */ |
|
625 inline TMMCErr TMMCStateMachine::SetState(TUint aState) { iStack[iSP].iState=aState; return(0); } |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 /** |
|
631 Prevents the state machine from blocking. |
|
632 */ |
|
633 inline void TMMCStateMachine::SuppressSuspension() { iSuspend = EFalse; } |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 /** |
|
639 Sets the trap mask for the current state machine entry. |
|
640 |
|
641 This defines the set of errors that the state machine function |
|
642 wants to trap. |
|
643 |
|
644 @param aMask The set of error values. This is a set of TMMCErr bits. |
|
645 |
|
646 @see TMMCErr |
|
647 */ |
|
648 inline void TMMCStateMachine::SetTraps(TMMCErr aMask) { iStack[iSP].iTrapMask=aMask; } |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 /** |
|
654 Clears the trap mask. |
|
655 |
|
656 @see TMMCStateMachine::SetTraps() |
|
657 */ |
|
658 inline void TMMCStateMachine::ResetTraps() { iStack[iSP].iTrapMask=0; } |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 /** |
|
664 Aborts the session. |
|
665 */ |
|
666 inline void TMMCStateMachine::Abort() { iAbort=ETrue; } |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 /** |
|
672 Initialises the state machine. |
|
673 |
|
674 The function sets up the state machine function for the first state entry on |
|
675 the state machine stack. |
|
676 |
|
677 It also sets up the context. In practice, the context is a pointer to |
|
678 the DMMCStack stack object, i.e. the object representing the MultiMediaCard |
|
679 stack. The pointer is passed to the state machine functions when they |
|
680 are dispatched. |
|
681 |
|
682 @param anEntry The state machine function for the first state machine entry. |
|
683 @param aContextP A pointer to the context. |
|
684 */ |
|
685 inline void TMMCStateMachine::Setup(TMMCErr (*anEntry)(TAny*), TAny* aContextP) |
|
686 {iContextP = aContextP; iStack[0].iFunction = anEntry; Reset();} |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 /** |
|
692 Pops the current state entry off the state machine stack. |
|
693 |
|
694 @param aSuspend Indicates whether the state machine is to block; |
|
695 specify ETrue to block, EFalse not to block. |
|
696 |
|
697 @return KMMCErrNone. |
|
698 */ |
|
699 inline TMMCErr TMMCStateMachine::Pop(TBool aSuspend) |
|
700 {iSP--; if(!aSuspend) iSuspend = EFalse; return( 0 );} |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 /** |
|
706 Pushes the next state entry onto the stack, specifying the current state |
|
707 function as the child function that is to be run, and requests the state |
|
708 machine to block. |
|
709 |
|
710 @return A MultiMediaCard error code returned from a call to TMMCStateMachine::Push(). |
|
711 */ |
|
712 inline TMMCErr TMMCStateMachine::PushMe() {return(Push(iStack[iSP].iFunction,ETrue));} |
|
713 |
|
714 |
|
715 // -------- class DMMCSession -------- |
|
716 |
|
717 inline void DMMCSession::SetStack(DMMCStack* aStackP) |
|
718 /** |
|
719 * Assign a stack to the session. |
|
720 * |
|
721 * If an attempt is made to engage the session before a stack has been assigned to it |
|
722 * then the request will fail straight away. It is possible to change the stack controller |
|
723 * assigned to the session as long as this is not attempted while the session is engaged. |
|
724 * |
|
725 * @param aStackP A pointer to the stack to be assigned to the session |
|
726 */ |
|
727 {iStackP = aStackP;} |
|
728 |
|
729 inline void DMMCSession::SetupCIMUpdateAcq() |
|
730 /** |
|
731 * Set up the session to perform the CIM_UPDATE_ACQ macro as outlined by the MMCA. |
|
732 * |
|
733 * Having set-up the session for this operation, the client must then engage the session |
|
734 * before the operation can commence. The CIM_UPDATE_ACQ macro starts an identification |
|
735 * cycle of a card stack. New cards are initialised but old cards keep their configuration. |
|
736 * The process ends with all compatible cards being moved to their stand-by state. |
|
737 */ |
|
738 {iSessionID = ECIMUpdateAcq;} |
|
739 |
|
740 inline void DMMCSession::SetupCIMInitStack() |
|
741 /** |
|
742 * Set up the session to perform the CIM_INIT_STACK macro as outlined by the MMCA. |
|
743 * |
|
744 * Having set-up the session for this operation, the client must then engage the session |
|
745 * before the operation can commence. The CIM_UPDATE_ACQ macro sends all cards to the idle |
|
746 * state and then executes the update acquisition sequence. |
|
747 */ |
|
748 {iSessionID = ECIMInitStack;} |
|
749 |
|
750 inline void DMMCSession::SetupCIMCheckStack() |
|
751 /** |
|
752 * Set up the session to perform the CIM_CHECK_STACK macro as outlined by the MMCA. |
|
753 * |
|
754 * Having set-up the session for this operation, the client must then engage the session |
|
755 * before the operation can commence. The CIM_CHECK_STACK macro attempts to read the CSD |
|
756 * of each active card in the stack, updating the data held by the stack controller for each card. |
|
757 */ |
|
758 {iSessionID = ECIMCheckStack;} |
|
759 |
|
760 inline void DMMCSession::SetupCIMSetupCard() |
|
761 /** |
|
762 * Set up the session to perform the CIM_SETUP_CARD macro as outlined by the MMCA. |
|
763 * |
|
764 * Having set-up the session for this operation, the client must then engage the session |
|
765 * before the operation can commence. The CIM_SETUP_CARD macro selects a particular card |
|
766 * for data transfer and reads back its CSD. |
|
767 */ |
|
768 {iSessionID = ECIMSetupCard;} |
|
769 |
|
770 inline void DMMCSession::SetupCIMLockStack() |
|
771 /** |
|
772 * Set up the session to lock the stack for this session only (so that only this session |
|
773 * can be engaged upon it). This prevents any other sessions from being engaged upon it. |
|
774 * |
|
775 * Having set-up the session for this operation, the client must then engage this session before |
|
776 * the stack becomes locked. In fact, no card bus activity results when this session is engaged. |
|
777 * However, because it may take some time for the Controller to be able to lock the stack for this |
|
778 * session, the mechanism for locking the stack still involves submitting a session. |
|
779 * When issuing a series of application specific commands, the client will want to lock the stack, |
|
780 * preventing any other client from generating bus activity during this period. This is accomplished |
|
781 * by issuing this function and then engaging that session. If successful, the stack will be locked |
|
782 * until the DMMCSession::UnlockStack() function is issued. |
|
783 */ |
|
784 {iSessionID = ECIMLockStack;} |
|
785 |
|
786 inline void DMMCSession::UnlockStack() |
|
787 /** |
|
788 * Unlock this session as the locking session for the stack, the stack having previously been locked |
|
789 * to this session using the DMMCSession. |
|
790 */ |
|
791 {if(iStackP != NULL) iStackP->UnlockStack(this);} |
|
792 |
|
793 inline void DMMCSession::SetupCIMInitStackAfterUnlock() |
|
794 /** |
|
795 * Set up the session to perform the second stage of initialisation after unlocking of the card |
|
796 * |
|
797 * This is provided to allow types of cards (particularly SD cards) to access the SD_STATUS and |
|
798 * associated registers during initialisation, which are only available once the card is unlocked. |
|
799 */ |
|
800 { |
|
801 iCardP = NULL; |
|
802 iSessionID = ECIMInitStackAfterUnlock; |
|
803 } |
|
804 |
|
805 inline void DMMCSession::SetupCIMAutoUnlock() |
|
806 /** |
|
807 * Set up the session to perform auto-unlocking of the card |
|
808 */ |
|
809 {iSessionID = ECIMAutoUnlock;} |
|
810 |
|
811 inline void DMMCSession::Stop() |
|
812 /** |
|
813 * Signal the session to complete immediately with KErrAbort |
|
814 * (i.e. the session end call-back function will be called). |
|
815 */ |
|
816 {if(iStackP != NULL) iStackP->Stop(this);} |
|
817 |
|
818 inline void DMMCSession::Abort() |
|
819 /** |
|
820 * Signal the session to abort immediately with no completion |
|
821 * (i.e. the session end call-back function will not be called). |
|
822 */ |
|
823 {if(iStackP != NULL) iStackP->Abort(this);} |
|
824 |
|
825 inline TMMCSessionTypeEnum DMMCSession::SessionID() const |
|
826 /** |
|
827 * Returns the current session type for this session. |
|
828 * |
|
829 * @return A TMMCSessionTypeEnum describing the sesion type |
|
830 */ |
|
831 {return(iSessionID);} |
|
832 |
|
833 inline DMMCStack* DMMCSession::StackP() const |
|
834 /** |
|
835 * Returns the DMMCStack object serving this session. |
|
836 * |
|
837 * @return A pointer to the DMMCStack object serving this session. |
|
838 */ |
|
839 {return(iStackP);} |
|
840 |
|
841 inline TMMCard* DMMCSession::CardP() const |
|
842 /** |
|
843 * Returns a pointer to the TMMCard object which this session is set to use. |
|
844 * |
|
845 * @return A pointer to the TMMCard object which this session is set to use. |
|
846 */ |
|
847 {return(iCardP);} |
|
848 |
|
849 inline TBool DMMCSession::IsEngaged() const |
|
850 /** |
|
851 * Return ETrue if this session is currently queued on the DMMCStack object serving this session. |
|
852 * |
|
853 * @return ETrue if this session is currently queued, otherwise EFalse |
|
854 */ |
|
855 {return((iState & KMMCSessStateEngaged) != 0);} |
|
856 |
|
857 inline TMMCErr DMMCSession::MMCExitCode() const |
|
858 /** |
|
859 * Returns the last MMC specific error code returned to this session. |
|
860 * |
|
861 * @return a TMMCErr describing the MMC specific error code |
|
862 */ |
|
863 {return(iMMCExitCode);} |
|
864 |
|
865 inline TMMCStatus DMMCSession::LastStatus() const |
|
866 /** |
|
867 * Returns the last status information from the card (i.e. the last R1 response received from the card). |
|
868 * |
|
869 * @return a TMMCStatus describing the status information |
|
870 */ |
|
871 {return(iLastStatus);} |
|
872 |
|
873 inline TUint32 DMMCSession::BytesTransferred() const |
|
874 /** |
|
875 * Returns the total number of bytes transferred in this session. |
|
876 * |
|
877 * @return the total number of bytes transferred in this session. |
|
878 */ |
|
879 {return(iBytesTransferred);} |
|
880 |
|
881 inline TUint8* DMMCSession::ResponseP() |
|
882 /** |
|
883 * Returns a pointer to a buffer containing the last command response received in this session. |
|
884 * |
|
885 * @return a buffer with format TUint8[KMMCMaxResponseLength] (where KMMCMaxResponseLength = 16). |
|
886 */ |
|
887 {return(&iCommand[iCmdSP].iResponse[0]);} |
|
888 |
|
889 inline TUint32 DMMCSession::EffectiveModes() const |
|
890 /** |
|
891 * Returns the modes which the DMMCStack object serving this session will consider as effective. |
|
892 * |
|
893 * @return the modes which the DMMCStack object serving this session will consider as effective |
|
894 */ |
|
895 {if(iStackP != NULL) return(iStackP->EffectiveModes(iConfig)); return(0);} |
|
896 |
|
897 inline void DMMCSession::Block(TUint32 aFlag) |
|
898 {iStackP->Block(this, aFlag);} |
|
899 |
|
900 inline void DMMCSession::UnBlock(TUint32 aFlag, TMMCErr anExitCode) |
|
901 {iStackP->UnBlock(this, aFlag, anExitCode);} |
|
902 |
|
903 inline void DMMCSession::SwapMe() |
|
904 {iState |= KMMCSessStateDoReSchedule;} |
|
905 |
|
906 inline void DMMCSession::ResetCommandStack() |
|
907 /** |
|
908 * Resets the command stack, setting the stack pointer to zero. |
|
909 */ |
|
910 {iCmdSP = 0;} |
|
911 |
|
912 /** |
|
913 Increments the command stack pointer. |
|
914 |
|
915 @panic PBUS-MMC 6 if the stack pointer lies outside the bounds of the stack. |
|
916 */ |
|
917 inline void DMMCSession::PushCommandStack() |
|
918 { |
|
919 __ASSERT_ALWAYS(TUint(++iCmdSP)<KMaxMMCCommandStackDepth, |
|
920 DMMCSocket::Panic(DMMCSocket::EMMCCommandStack)); |
|
921 } |
|
922 |
|
923 /** |
|
924 Decrements the command stack pointer. |
|
925 |
|
926 @panic PBUS-MMC 6 if the stack pointer lies outside the bounds of the stack. |
|
927 */ |
|
928 inline void DMMCSession::PopCommandStack() |
|
929 { |
|
930 __ASSERT_ALWAYS(--iCmdSP>=0, |
|
931 DMMCSocket::Panic(DMMCSocket::EMMCCommandStack)); |
|
932 } |
|
933 |
|
934 inline TMMCCommandDesc& DMMCSession::Command() |
|
935 /** |
|
936 * Returns the current command, as referred to by the stack pointer. |
|
937 * @return A TMMCCommandDesc reference, containing the current command. |
|
938 */ |
|
939 {return(iCommand[iCmdSP]);} |
|
940 |
|
941 |
|
942 // |
|
943 // Data transfer macros setup (block mode) |
|
944 // |
|
945 |
|
946 inline void DMMCSession::SetupCIMReadBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks) |
|
947 /** |
|
948 * Sets the session up to perform the CIM_READ_BLOCK macro as outlined by the MMCA. |
|
949 * Having set-up the session for this operation, the client must then engage the session before the operation can commence. |
|
950 * The CIM_READ_BLOCK macro reads a single block from the card. It starts by setting the block length (CMD16) to 512 Bytes. |
|
951 * It then reads 'aBlocks' blocks of data from the card at offset 'aBlockAddr' on the card into system memory starting at |
|
952 * address 'aMemoryP'. |
|
953 * |
|
954 * @param aBlockAddr Contains offset (in blocks) to the block to be read from the card |
|
955 * @param aMemoryP host destination address |
|
956 * @param aBlocks The number of blocks to read from the card |
|
957 */ |
|
958 { |
|
959 ResetCommandStack(); |
|
960 FillCommandArgs(aBlockAddr, aBlocks << KMMCardHighCapBlockSizeLog2, aMemoryP, KMMCardHighCapBlockSize); |
|
961 Command().iFlags |= KMMCCmdFlagBlockAddress; |
|
962 iSessionID = (aBlocks > 1)? ECIMReadMBlock : ECIMReadBlock; |
|
963 } |
|
964 |
|
965 inline void DMMCSession::SetupCIMWriteBlock(TMMCArgument aBlockAddr, TUint8* aMemoryP, TUint32 aBlocks) |
|
966 /** |
|
967 * Set up the session to perform the CIM_WRITE_BLOCK macro as outlined by the MMCA. |
|
968 * Having set-up the session for this operation, the client must then engage the session before the operation can commence. |
|
969 * The CIM_WRITE_BLOCK macro writes a single block to the card. It starts by setting the block length (CMD16) to 512 Bytes. |
|
970 * It then writes 'aBlocks' block of data to the card at offset 'aBlockAddr' on the card reading from system memory starting |
|
971 * at address 'aMemoryP'. |
|
972 * |
|
973 * @param aBlockAddr Contains offset to the block (in blocks) to be written on the card |
|
974 * @param aMemoryP Host source address |
|
975 * @param aBlocks The number of blocks to write to the card |
|
976 */ |
|
977 { |
|
978 ResetCommandStack(); |
|
979 FillCommandArgs(aBlockAddr, aBlocks << KMMCardHighCapBlockSizeLog2, aMemoryP, KMMCardHighCapBlockSize); |
|
980 Command().iFlags |= KMMCCmdFlagBlockAddress; |
|
981 iSessionID = (aBlocks > 1)? ECIMWriteMBlock : ECIMWriteBlock; |
|
982 } |
|
983 |
|
984 inline void DMMCSession::SetupCIMEraseMSector(TMMCArgument aBlockAddr, TUint32 aBlocks) |
|
985 /** |
|
986 * Set up the session to perform the CIM_ERASE_SECTOR macro broadly as outlined by the MMCA. |
|
987 * However, the macro only performs a sector erase of a contiguous area and doesn't support the un-tagging of particular sectors |
|
988 * within the initial tagged area. Having set-up the session for this operation, the client must then engage the session before |
|
989 * the operation can commence. |
|
990 * |
|
991 * The CIM_ERASE_SECTOR macro erases a range of sectors on the card starting at offset (in blocks) 'aBlockAddr' on the card and ending at offset |
|
992 * 'aBlockAddr'+'aBlocks' (in blocks). The entire area specified must lie within a single erase group. (The erase group size can be read from the CSD). |
|
993 * The tag sector start command (CMD32) is first issued setting the address of the first sector to be erased. |
|
994 * This is followed by the tag sector end command (CMD33) setting the address of the last sector to be erased. Now that the erase |
|
995 * sectors are tagged, the erase command (CMD38) is sent followed by a send status command (CMD13) to read any additional status |
|
996 * information from the card. |
|
997 * |
|
998 * @param aBlockAddr Contains offset (in blocks) to the first block to be erased |
|
999 * @param aBlocks Total number of blocks to erase |
|
1000 */ |
|
1001 { |
|
1002 ResetCommandStack(); |
|
1003 FillCommandArgs(aBlockAddr, aBlocks << KMMCardHighCapBlockSizeLog2, NULL, 0); |
|
1004 Command().iFlags |= KMMCCmdFlagBlockAddress; |
|
1005 iSessionID = ECIMEraseSector; |
|
1006 } |
|
1007 |
|
1008 inline void DMMCSession::SetupCIMEraseMGroup(TMMCArgument aBlockAddr, TUint32 aBlocks) |
|
1009 /** |
|
1010 * Set up the session to perform the CIM_ERASE_GROUP macro broadly as outlined by the MMCA. |
|
1011 * However, the macro only performs an erase group erase of a contiguous area and doesn't support the un-tagging of particular |
|
1012 * erase groups within the initial tagged area. Having set-up the session for this operation, the client must then engage the |
|
1013 * session before the operation can commence. |
|
1014 * |
|
1015 * The CIM_ERASE_GROUP macro erases a range of erase groups on the card starting at offset (in blocks) 'aDevAddr' on the card and ending at |
|
1016 * offset 'aBlockAddr'+'aBlocks' (in blocks). The tag ease group start command (CMD35) is first issued setting |
|
1017 * the address of the first erase group to be erased. This is followed by the tag erase group end command (CMD36) setting the |
|
1018 * address of the last erase group to be erased. Now that the erase groups are tagged, the erase command (CMD38) is sent followed |
|
1019 * by a send status command (CMD13) to read any additional status information from the card. |
|
1020 * |
|
1021 * @param aBlockAddr Contains offset (in blocks) to the first block to be erased |
|
1022 * @param aBlocks Total number of blocks to erase |
|
1023 */ |
|
1024 { |
|
1025 ResetCommandStack(); |
|
1026 FillCommandArgs(aBlockAddr, aBlocks << KMMCardHighCapBlockSizeLog2, NULL, 0); |
|
1027 Command().iFlags |= KMMCCmdFlagBlockAddress; |
|
1028 iSessionID = ECIMEraseGroup; |
|
1029 } |
|
1030 |
|
1031 inline void DMMCSession::EnableDoubleBuffering(TUint32 aNumBlocks) |
|
1032 /** |
|
1033 * When called before a data transfer operation is engaged, specifies that the data |
|
1034 * transfer operation is to be double-buffered. |
|
1035 * |
|
1036 * @param aNumBlocks The number of blocks to transfer per double-buffer transfer. |
|
1037 * |
|
1038 * @internalTechnology |
|
1039 */ |
|
1040 { |
|
1041 __KTRACE_OPT(KPBUS1, Kern::Printf("++ DMMCSession::EnableDoubleBuffering(%d Blocks)", aNumBlocks)) |
|
1042 |
|
1043 //__ASSERT_ALWAYS(iSessionID == ECIMWriteMBlock || iSessionID == ECIMReadMBlock, DMMCSocket::Panic(DMMCSocket::EMMCInvalidDBCommand)); |
|
1044 |
|
1045 Command().iBlockLength &= 0x0000FFFF; |
|
1046 Command().iBlockLength |= aNumBlocks << 16; |
|
1047 Command().iFlags |= KMMCCmdFlagDoubleBuffer; |
|
1048 } |
|
1049 |
|
1050 inline void DMMCSession::SetDataTransferCallback(TMMCCallBack& aCallback) |
|
1051 /** |
|
1052 * Registers the data transfer callback function to be called when more data is required by the PSL, |
|
1053 * typically while the hardware is busy performing a DMA transfer. |
|
1054 * |
|
1055 * @param aCallback The callback function. |
|
1056 * |
|
1057 * @internalTechnology |
|
1058 */ |
|
1059 { |
|
1060 __KTRACE_OPT(KPBUS1, Kern::Printf("++ DMMCSession::SetDataTransferCallback")); |
|
1061 |
|
1062 iDataTransferCallback = aCallback; |
|
1063 } |
|
1064 |
|
1065 inline void DMMCSession::MoreDataAvailable(TUint32 aNumBlocks, TUint8* aMemoryP, TInt aError) |
|
1066 /** |
|
1067 * Called by the MMC Media Driver after copying data from the client thread to indicate to the |
|
1068 * PSL that data is available in the next data buffer. Should be called at the end of the |
|
1069 * data transfer callback function, at which point the stack will be unblocked enabling the |
|
1070 * next data transfer to take place. |
|
1071 * |
|
1072 * @param aNumBlocks The number of blocks available in the buffer. |
|
1073 * @param aMemoryP A pointer to the host memory containing the next blocks of data. |
|
1074 * @param aError The result of the data callback. |
|
1075 * |
|
1076 * @internalTechnology |
|
1077 */ |
|
1078 { |
|
1079 __KTRACE_OPT(KPBUS1, Kern::Printf("++ DMMCSession::MoreDataAvailable(%d blocks, %08x, %d)", aNumBlocks, aMemoryP, aError)); |
|
1080 |
|
1081 Command().iDataMemoryP = aMemoryP; |
|
1082 EnableDoubleBuffering(aNumBlocks); |
|
1083 |
|
1084 iStackP->UnBlock(this, KMMCBlockOnMoreData, aError == KErrNone ? KMMCErrNone : KMMCErrGeneral); |
|
1085 } |
|
1086 |
|
1087 inline TBool DMMCSession::RequestMoreData() |
|
1088 /** |
|
1089 * Called by the PSL to request the next blocks of data to be transferred from the media driver |
|
1090 * to the PSL. This would typically be called while the hardware is busy transferring the current |
|
1091 * block of data, allowing the media driver to copy data from the client in parallel. |
|
1092 * |
|
1093 * This method will set the state machine to block on KMMCBlockOnMoreData, so the PSL must block |
|
1094 * the state machine using an SMF_WAITS (or equivalent). When the Media Driver has populated the |
|
1095 * next buffer, the current command descriptor will be updated and the state machine unblocked. |
|
1096 * |
|
1097 * @return ETrue if all conditions are met to perform double-buffering (ie - command is enabled |
|
1098 * for double-buffering and the last transfer has not already been satisfied). If |
|
1099 * successful, upon exit the state machine will be blocked with the KMMCBlockOnMOreData |
|
1100 * condition and the Media Driver's data transfer callback invoked. |
|
1101 * |
|
1102 * |
|
1103 */ |
|
1104 { |
|
1105 __KTRACE_OPT(KPBUS1, Kern::Printf("++ DMMCSession::RequestMoreData()")); |
|
1106 |
|
1107 if(Command().IsDoubleBuffered() && (Command().iBytesDone + Command().BufferLength() < Command().iTotalLength)) |
|
1108 { |
|
1109 iStackP->Block(this, KMMCBlockOnMoreData); |
|
1110 iDataTransferCallback.CallBack(); |
|
1111 return(ETrue); |
|
1112 } |
|
1113 |
|
1114 return(EFalse); |
|
1115 } |
|
1116 |
|
1117 |
|
1118 // -------- class DMMCSocket -------- |
|
1119 |
|
1120 inline TBool DMMCSocket::SupportsDoubleBuffering() |
|
1121 /** |
|
1122 * @return ETrue If the PSL supports double buffering, as specified by the |
|
1123 * PSL by setting the ESupportsDoubleBuffering flag in ::MachineInfo. |
|
1124 * |
|
1125 * @internalTechnology |
|
1126 */ |
|
1127 { |
|
1128 return ((iMachineInfo.iFlags & TMMCMachineInfo::ESupportsDoubleBuffering) ? (TBool)ETrue : (TBool)EFalse); |
|
1129 } |
|
1130 |
|
1131 inline TUint32 DMMCSocket::MaxDataTransferLength() |
|
1132 /** |
|
1133 * @return The maximum length that the PSL supports in a single data transfer. |
|
1134 * Returns Zero if the PSL has no limitation on the maximum length of data transfer. |
|
1135 * |
|
1136 * @internalTechnology |
|
1137 */ |
|
1138 { |
|
1139 return(0x20000 << ((iMachineInfo.iFlags & TMMCMachineInfo::EMaxTransferLength_16M) >> 8)); |
|
1140 } |
|
1141 |
|
1142 inline TUint32 DMMCSocket::DmaAlignment() |
|
1143 /** |
|
1144 * @return Byte alignment required by the DMA Controller. |
|
1145 * e.g. 16 Bit addressing scheme equates to 2 byte alignment. |
|
1146 * |
|
1147 * @internalTechnology |
|
1148 */ |
|
1149 { |
|
1150 const TUint32 DmaAddrMsk = TMMCMachineInfo::EDma8BitAddressing | |
|
1151 TMMCMachineInfo::EDma16BitAddressing | |
|
1152 TMMCMachineInfo::EDma32BitAddressing | |
|
1153 TMMCMachineInfo::EDma64BitAddressing; |
|
1154 return ((iMachineInfo.iFlags & DmaAddrMsk) >> 3); |
|
1155 } |
|
1156 |
|
1157 // -------- class DMMCStack -------- |
|
1158 |
|
1159 inline void DMMCStack::ReportPowerUp() |
|
1160 /** |
|
1161 * Called by the variant layer to indicate that a |
|
1162 * power up operation has successfully completed. |
|
1163 */ |
|
1164 {iPoweredUp = ETrue;} |
|
1165 |
|
1166 inline void DMMCStack::ReportPowerDown() |
|
1167 /** |
|
1168 * Indicates that that power down operation has successfully completed. |
|
1169 * Following power down, the stack enters a state pending the next power up operation. |
|
1170 */ |
|
1171 {iPoweredUp = EFalse; iStackState |= KMMCStackStateInitPending;} |
|
1172 |
|
1173 inline void DMMCStack::Reset() |
|
1174 /** |
|
1175 * Resets the stack by aborting all current requests. |
|
1176 */ |
|
1177 {iAbortAll = ETrue; Scheduler(iAbortReq);} |
|
1178 |
|
1179 inline void DMMCStack::CompleteAll(TMMCErr aCode) |
|
1180 /** |
|
1181 * Stops and dequeues all sessions queued on this stack (including those queued by other clients). |
|
1182 * Each of the sessions affected will complete immediately with error code 'aCode' (i.e. the session |
|
1183 * end call-back function will be called). |
|
1184 * @param aCode The MMC error code to be returned. |
|
1185 */ |
|
1186 {iCompleteAllExitCode = aCode; Scheduler(iCompReq);} |
|
1187 |
|
1188 inline TUint DMMCStack::MaxCardsInStack() const |
|
1189 /** |
|
1190 * Returns the maximum number of MultiMediaCards which could ever be present in this stack. |
|
1191 * i.e. the total number of physical card slots associated with this stack on this platform. |
|
1192 * (This is initialised from the DMMCSocket::TotalSupportedCards) |
|
1193 * @return The number of supported cards. |
|
1194 */ |
|
1195 {return( iMaxCardsInStack );} |
|
1196 |
|
1197 inline TMMCard* DMMCStack::CardP(TUint aCardNumber) |
|
1198 /** |
|
1199 * Returns a pointer to the specified card. |
|
1200 * @param aCardNumber The card number. |
|
1201 * @return A pointer to the specified card. |
|
1202 */ |
|
1203 {return( (aCardNumber<iMaxCardsInStack) ? (iCardArray->CardP(aCardNumber)) : NULL );} |
|
1204 |
|
1205 inline DMMCSocket* DMMCStack::MMCSocket() const |
|
1206 /** |
|
1207 * Returns a pointer to associated socket object. |
|
1208 * @return A pointer to the associated socket. |
|
1209 */ |
|
1210 {return( iSocket );} |
|
1211 |
|
1212 inline TMMCPasswordStore* DMMCStack::PasswordStore() const |
|
1213 /** |
|
1214 * Returns a pointer to the associated password store. |
|
1215 * @return A pointer to the associated password store. |
|
1216 */ |
|
1217 {return( iSocket->iPasswordStore );} |
|
1218 |
|
1219 inline TBool DMMCStack::InitStackInProgress() const |
|
1220 /** |
|
1221 * Reports the initialisation state of the stack (i.e is the CIM_INIT_STACK macro in progress). |
|
1222 * @return ETrue if the stack is being initialised, EFalse otherwise. |
|
1223 */ |
|
1224 {return( (iStackState & KMMCStackStateInitInProgress) != 0 );} |
|
1225 |
|
1226 inline TBool DMMCStack::HasSessionsQueued() const |
|
1227 /** |
|
1228 * Reports if any of the session queues have submitted session engaged. |
|
1229 * @return ETrue if there are any sessions engaged on this stack, EFalse otherwise. |
|
1230 */ |
|
1231 {return((iWorkSet.Size()!=0) || (iReadyQueue.Size()!=0) || (iEntryQueue.Size()!=0));} |
|
1232 |
|
1233 inline TBool DMMCStack::HasCardsPresent() |
|
1234 /** |
|
1235 * Reports if any cards are present on the stack |
|
1236 * @return ETrue if there are any sessions engaged on this stack, EFalse otherwise. |
|
1237 */ |
|
1238 { |
|
1239 for (TUint i=0 ; i<iMaxCardsInStack ; i++) |
|
1240 if (CardDetect(i)) return(ETrue); |
|
1241 return(EFalse); |
|
1242 } |
|
1243 |
|
1244 inline TBool DMMCStack::StackRunning() const |
|
1245 /** |
|
1246 * Reports whether the stack is currently running (i.e. running in another context from the caller) |
|
1247 * @return ETrue if the stack is currently running |
|
1248 */ |
|
1249 {return( (iStackState & KMMCStackStateRunning) != 0 );} |
|
1250 |
|
1251 inline void DMMCStack::BufferInfo(TUint8*& aBuf, TInt& aBufLen, TInt& aMinorBufLen) |
|
1252 /** |
|
1253 * Calls the variant-layer function GetBufferInfo() to retrieve the DMA-capable buffer start and length |
|
1254 * and then calculates the minor buffer length (which is situated at the start) - |
|
1255 * this is the maximum of a sector size (512 bytes) and the biggest block size of |
|
1256 * any card in the stack. |
|
1257 |
|
1258 * @param aBuf A pointer to the allocated buffer |
|
1259 * @param aBufLen The length of the allocated buffer |
|
1260 * @param aMinorBufLen The length of the minor buffer |
|
1261 */ |
|
1262 { |
|
1263 aBuf = iPSLBuf; |
|
1264 aBufLen = iPSLBufLen; |
|
1265 aMinorBufLen = iMinorBufLen; |
|
1266 } |
|
1267 |
|
1268 |
|
1269 inline TInt DMMCStack::DemandPagingInfo(TDemandPagingInfo& aInfo) |
|
1270 { |
|
1271 MDemandPagingInfo* demandPagingInterface = NULL; |
|
1272 GetInterface(KInterfaceDemandPagingInfo, (MInterface*&) demandPagingInterface); |
|
1273 if (demandPagingInterface) |
|
1274 return demandPagingInterface->DemandPagingInfo(aInfo); |
|
1275 else |
|
1276 return KErrNotSupported; |
|
1277 } |
|
1278 |
|
1279 |
|
1280 inline void DMMCStack::CancelSession(DMMCSession* aSession) |
|
1281 { |
|
1282 GetInterface(KInterfaceCancelSession, (MInterface*&) aSession); |
|
1283 } |
|
1284 |
|
1285 inline TRCA DMMCStack::SelectedCard() const |
|
1286 /** |
|
1287 * Returns the Relative Card Address (RCA) of the currently selected card |
|
1288 * @return A TRCA object containing the Relative Card Address. |
|
1289 */ |
|
1290 { |
|
1291 return iSelectedCard; |
|
1292 } |
|
1293 |
|
1294 inline TMMCStateMachine& DMMCStack::Machine() |
|
1295 /** |
|
1296 * Returns the current sessions MMC State Machine object. |
|
1297 * @return A TMMCStateMachine reference to the current sessions State Machine object. |
|
1298 */ |
|
1299 {return( iSessionP->iMachine );} |
|
1300 |
|
1301 inline TMMCBusConfig& DMMCStack::BusConfig() |
|
1302 /** |
|
1303 * Returns the current bus configuration. |
|
1304 * @return A TMMCBusConfig reference describing current sessions bus configuration. |
|
1305 */ |
|
1306 {return( iConfig.iBusConfig );} |
|
1307 |
|
1308 inline TMMCBusConfig& DMMCStack::MasterBusConfig() |
|
1309 /** |
|
1310 * Returns the master bus configuration. |
|
1311 * @return A TMMCBusConfig reference describing the master bus configuration. |
|
1312 */ |
|
1313 {return( iMasterConfig.iBusConfig );} |
|
1314 |
|
1315 inline TMMCCommandDesc& DMMCStack::Command() |
|
1316 /** |
|
1317 * Returns the current sessions command description. |
|
1318 * @return A TMMCCommandDesc reference describing current sessions command. |
|
1319 */ |
|
1320 {return( iSessionP->Command() );} |
|
1321 |
|
1322 inline DMMCSession& DMMCStack::Session() |
|
1323 /** |
|
1324 * Returns the current session object. |
|
1325 * @return A reference to the current DMMCSession object. |
|
1326 */ |
|
1327 {return(*iSessionP);} |
|
1328 |
|
1329 inline void DMMCStack::BlockCurrentSession(TUint32 aFlag) |
|
1330 /** |
|
1331 * Indicates that the current session is to be blocked (ie - waiting on an asynchronous response such as interrupt). |
|
1332 * The state machine will only unblock when an unblock request with the matching argument is called. |
|
1333 * In the PSL level of the Controller you should always use KMMCBlockOnASSPFunction as the argument. |
|
1334 * @param aFlag Bitmask describing the reason for blocking. |
|
1335 */ |
|
1336 {Block(iSessionP,aFlag);} |
|
1337 |
|
1338 inline void DMMCStack::UnBlockCurrentSession(TUint32 aFlag, TMMCErr anExitCode) |
|
1339 /** |
|
1340 * Indicates that the current session is to be unblocked (ie - an a asynchronous operation has completed). |
|
1341 * The state machine will only unblock when an unblock request with the matching argument is called. |
|
1342 * @param aFlag Bitmask describing the reason for unblocking. |
|
1343 * @param anExitCode KMMCErrNone if successful, otherwise a standard TMMCErr code. |
|
1344 */ |
|
1345 {UnBlock(iSessionP,aFlag,anExitCode);} |
|
1346 |
|
1347 inline void DMMCStack::ReportInconsistentBusState() |
|
1348 /** |
|
1349 * Indicates that something has gone wrong, so the stack needs re-initialising. |
|
1350 */ |
|
1351 {iStackState |= KMMCStackStateBusInconsistent;} |
|
1352 |
|
1353 inline void DMMCStack::ReportASSPEngaged() |
|
1354 /** |
|
1355 * Called by the PSL to indicate that a session has been engaged. |
|
1356 */ |
|
1357 {iSessionP->iState |= KMMCSessStateASSPEngaged;} |
|
1358 |
|
1359 inline void DMMCStack::ReportASSPDisengaged() |
|
1360 /** |
|
1361 * Called by the PSL to indicate that a session has completed or has been aborted. |
|
1362 */ |
|
1363 {iSessionP->iState &= ~KMMCSessStateASSPEngaged;} |
|
1364 |
|
1365 inline TRCA DMMCStack::CurrentSessCardRCA() |
|
1366 /** |
|
1367 * Returns the Relative Card Address (RCA) in use by the current session. |
|
1368 * @return A TRCA object containing the Relative Card Address. |
|
1369 */ |
|
1370 {return(iSessionP->CardRCA());} |
|
1371 |
|
1372 |
|
1373 inline TMMCErr DMMCStack::BaseModifyCardCapabilitySMST( TAny* aStackP ) |
|
1374 { return( static_cast<DMMCStack *>(aStackP)->DMMCStack::ModifyCardCapabilitySM() ); } |
|
1375 |
|
1376 inline TMMCErr DMMCStack::InitCurrentCardAfterUnlockSMST( TAny* aStackP ) |
|
1377 { return( static_cast<DMMCStack *>(aStackP)->DMMCStack::InitStackAfterUnlockSM() ); } |
|
1378 |
|
1379 /** |
|
1380 Increments the current session's command stack pointer. |
|
1381 |
|
1382 @see DMMCSession::PushCommandStack() |
|
1383 */ |
|
1384 inline void DMMCStack::CurrentSessPushCmdStack() |
|
1385 {iSessionP->PushCommandStack();} |
|
1386 |
|
1387 |
|
1388 |
|
1389 /** |
|
1390 Decrements the current session's command stack pointer. |
|
1391 |
|
1392 @see DMMCSession::PopCommandStack() |
|
1393 */ |
|
1394 inline void DMMCStack::CurrentSessPopCmdStack() |
|
1395 {iSessionP->PopCommandStack();} |
|
1396 |
|
1397 /** |
|
1398 Allows the stack to yield to another command temporarily, for one loop of the scheduler only. |
|
1399 |
|
1400 @param aCommandType The command type to yield to. |
|
1401 */ |
|
1402 inline void DMMCStack::YieldStack(TMMCCommandTypeEnum aCommandType) |
|
1403 { |
|
1404 BlockCurrentSession(KMMCBlockOnYielding); |
|
1405 iYieldCommandType = aCommandType; |
|
1406 iStackState |= KMMCStackStateYielding; |
|
1407 } |
|
1408 |
|
1409 |
|
1410 inline void DMMCStack::CurrentSessFillCmdDesc(TMMCCommandEnum aCommand) |
|
1411 /** |
|
1412 * Initialises the current sessions command according to whether it is a normal |
|
1413 * or an application command. |
|
1414 * @param aCommand Contains the command. |
|
1415 */ |
|
1416 {iSessionP->FillCommandDesc(aCommand);} |
|
1417 |
|
1418 inline void DMMCStack::CurrentSessFillCmdDesc(TMMCCommandEnum aCommand,TMMCArgument anArgument) |
|
1419 /** |
|
1420 * Initialises the current sessions command with an argument according to whether |
|
1421 * it is a normal or an application command. |
|
1422 * @param aCommand Contains the command. |
|
1423 * @param anArgument Specifies the argument. |
|
1424 */ |
|
1425 {iSessionP->FillCommandDesc(aCommand,anArgument);} |
|
1426 |
|
1427 inline void DMMCStack::CurrentSessFillCmdArgs(TMMCArgument anArgument,TUint32 aLength,TUint8* aMemoryP,TUint32 aBlkLen) |
|
1428 /** |
|
1429 * Initialises the current sessions command arguments with the specified parameters |
|
1430 * It is necessary to have set the command arguments with this command prior |
|
1431 * to engaging a read/write macro or command. |
|
1432 * @param anArgument Command specific argument. |
|
1433 * @param aLength aLength Total number of bytes to read/write. |
|
1434 * @param aMemoryP Host source/destination address |
|
1435 * @param aBlkLen Block length |
|
1436 */ |
|
1437 {iSessionP->FillCommandArgs(anArgument,aLength,aMemoryP,aBlkLen);} |
|
1438 |
|
1439 inline void DMMCStack::DeselectsToIssue(TUint aNumber) |
|
1440 /** |
|
1441 * Specifies how many deselects to issue during deselection. |
|
1442 * @param aNumber The number of deselects to issue. |
|
1443 */ |
|
1444 {iDeselectsToIssue = aNumber; iStackState |= KMMCStackStateDoDeselect;} |
|
1445 |
|
1446 // -------- class DMMCController -------- |
|
1447 |
|
1448 inline DMMCStack* DMMCSocket::Stack(TInt aBus) |
|
1449 /** |
|
1450 * Returns a pointer to the DMMCStack object corresponding to the specified MMC card. |
|
1451 * @param aBus The MMC card number. |
|
1452 * @return A pointer to the DMMCStack object corresponding to the specified card. |
|
1453 */ |
|
1454 {return( ((TInt)aBus < iMachineInfo.iTotalSockets) ? iStack : NULL );} |
|
1455 |
|
1456 inline void DMMCSocket::ResetInactivity(TInt /*aBus*/) |
|
1457 /** |
|
1458 * Resets the sockets PSU inactivity timer. |
|
1459 * Commonly used to prevent reset due to inactivity |
|
1460 * while waiting for a response from the card. |
|
1461 * @param aBus Unused |
|
1462 */ |
|
1463 { |
|
1464 iVcc->ResetInactivityTimer(); |
|
1465 if (iVccCore) |
|
1466 iVccCore->ResetInactivityTimer(); |
|
1467 } |
|
1468 |
|
1469 inline const TMMCMachineInfo& DMMCSocket::MachineInfo() const |
|
1470 /** |
|
1471 * Returns a reference to the MachineInfo retrieved from the PSL |
|
1472 * @return a reference to the MachineInfo |
|
1473 */ |
|
1474 {return iMachineInfo;} |
|
1475 |
|
1476 // -------- class TMMCPsu -------- |
|
1477 |
|
1478 inline void DMMCPsu::SetVoltage(TUint32 aVoltage) |
|
1479 /** |
|
1480 * Specifies the voltage setting to be used when the stack is next powered up. |
|
1481 * @param aVoltage The required voltage setting, in OCR register format. |
|
1482 */ |
|
1483 {iVoltageSetting=aVoltage;} |
|
1484 |
|
1485 // -------- Class TMMCCallBack -------- |
|
1486 /** |
|
1487 * Default constructor. Initializes the pointer to the callback function to NULL. |
|
1488 * @see iFunction |
|
1489 */ |
|
1490 inline TMMCCallBack::TMMCCallBack() |
|
1491 {iFunction=NULL;} |
|
1492 |
|
1493 /** |
|
1494 * Constructs the TMMCCallBack object with the specified callback function. |
|
1495 * @param aFunction Callback notification function. |
|
1496 */ |
|
1497 inline TMMCCallBack::TMMCCallBack(void (*aFunction)(TAny *aPtr)) |
|
1498 : iFunction(aFunction),iPtr(NULL) |
|
1499 {} |
|
1500 /** |
|
1501 * Constructs the TMMCCallBack object with the specified callback function and a pointer to any object. |
|
1502 * @param aFunction Callback notification function. |
|
1503 * @param aPtr Pointer to any data. |
|
1504 */ |
|
1505 inline TMMCCallBack::TMMCCallBack(void (*aFunction)(TAny *aPtr),TAny *aPtr) |
|
1506 : iFunction(aFunction),iPtr(aPtr) |
|
1507 {} |
|
1508 /** |
|
1509 * Calls the registered callback function. |
|
1510 */ |
|
1511 inline void TMMCCallBack::CallBack() const |
|
1512 { if(iFunction) (*iFunction)(iPtr); } |
|
1513 |
|
1514 // -------- class TMMCEraseInfo -------- |
|
1515 |
|
1516 inline TBool TMMCEraseInfo::EraseClassCmdsSupported() const |
|
1517 /** |
|
1518 * Returns ETrue if Erase Class commands are supported. |
|
1519 * @return ETrue if Erase Class commands are supported. |
|
1520 */ |
|
1521 {return(iEraseFlags&KMMCEraseClassCmdsSupported);} |
|
1522 |
|
1523 inline TBool TMMCEraseInfo::EraseGroupCmdsSupported() const |
|
1524 /** |
|
1525 * Returns ETrue if Erase Group commands are supported. |
|
1526 * @return ETrue if Erase Group commands are supported. |
|
1527 */ |
|
1528 {return(iEraseFlags&KMMCEraseGroupCmdsSupported);} |