First public contribution.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__D_MMCSDIF_H__)
21 #ifndef __KERNEL_MODE__
24 #include "MmcTestUtils.h"
28 #define _MMCSDLDDLOGGING // Enable LDD logging
31 #if defined( _MMCSDLDDLOGGING )
32 #define MMCSDLOG(A) Kern::Printf(A)
33 #define MMCSDLOG2(A, B) Kern::Printf(A, B)
34 #define MMCSDLOG3(A, B, C) Kern::Printf(A, B, C)
35 #define MMCSDLOG4(A, B, C, D) Kern::Printf(A, B, C, D)
36 #define MMCSDLOG5(A, B, C, D, E) Kern::Printf(A, B, C, D, E)
37 #define MMCSDLOG6(A, B, C, D, E, F) Kern::Printf(A, B, C, D, E, F)
40 #define MMCSDLOG2(A, B)
41 #define MMCSDLOG3(A, B, C)
42 #define MMCSDLOG4(A, B, C, D)
43 #define MMCSDLOG5(A, B, C, D, E)
44 #define MMCSDLOG6(A, B, C, D, E, F)
48 _LIT(KLddName, "MMCSDTestCtrlInf");
51 const TInt KMaxCardsPerStack=2;
52 const TInt KSectorSizeInBytes=512;
53 const TInt KMaxBlocklengthInBytes=1024;
54 const TInt KSectorSizeShift=9;
55 const TInt KDrvBufSizeInSectors=8;
57 const TInt KStackNo=0;
59 //Used to check erase command is supported by the card.
60 const TUint32 KMMCEraseClassCmdSupported=KBit0;
62 //Used to check group erase command is supported by the card.
63 const TUint32 KMMCEraseGroupCmdSupported=KBit1;
67 * Card power supply information
74 /** Indicates the voltage level, or range of voltages supported.
75 Reperesented in OCR (Operation Condition Register) */
76 TUint iVoltageSupported;
78 /** Maximum Current Supplied by the PSU */
79 TInt iMaxCurrentInMicroAmps;
81 /** PSU Voltage level within expected limit while turning ON */
82 TUint iVoltCheckInterval;
84 /** VCC voltage when ON */
85 TUint iVoltCheckMethod;
87 /** Bus not locked timeout period,in seconds,when no clients are registered */
88 TInt iNotLockedTimeOut;
90 /** Bus inactivity timeout period, in seconds, when clients are registered */
91 TInt iInactivityTimeOut;
107 * Class for MMCSD controller interface to test MMC/SD Cards
110 class RMMCSDTestControllerInterface : public RBusLogicalChannel
113 enum {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=1};
118 /** Write a sector */
123 /** Return whether SD card is in use */
125 /** Read CSD register */
127 /** Read extended CSD register */
131 /** Return card object */
133 /** Return card is present status */
135 /** Return card is ready status */
137 /** Return card is locked status */
142 /** Return psu object */
144 /** Gets the PSU Information */
146 /** Set Power Supply State */
148 /**Set Psu Voltage in OCR format */
150 /** Read Power supply unit number */
152 /** Read the Media Change ID */
154 /** PSU current limit safe level or Not */
156 /** Gets the PBUS state */
158 /** Gets the Power Supply Status */
160 /** Checks whether this PSU is powering a bus containing a locked device*/
162 /** Checks whether the PSU is off*/
164 /** Gets the maximum current (in microAmps) that the PSU is able to supply*/
165 EMaxCurrentInMicroAmps,
166 /** Resets inactivity and not-locked counts*/
167 EResetInactivityTimer,
168 /** Gets the voltage level, or range of supported voltage levels*/
170 /** Bus inactivity counter*/
172 /** Bus not locked counter*/
174 /** Bus inactivity timeout period, in seconds, when clients are registered*/
175 EMemInactivityTimeout,
176 /** Bus not locked timeout period, in seconds, when no clients are registered*/
177 EMemNotLockedTimeout,
178 /** Indicates the voltage level, or range of voltages supported*/
179 EMemVoltageSupported,
180 /** The maximum current (in microAmps) that the PSU is able to supply*/
181 EMemMaxCurrentInMicroAmps,
182 /**Indicates whether the platform hardware has support for checking whether the voltage level*/
183 EMemVoltCheckInterval
185 enum TMediaChangeControl
187 /** Return media change object */
189 /** Gets the MMC stack media state */
191 /** Force Media Change */
193 /** Media Change Replay Count */
198 /** Return socket object */
200 /** DMMCSocket::AdjustPartialRead */
201 ,ESocketAdjustPartialRead
202 /** DMMCSocket::CardIsPresent */
203 ,ESocketCardIsPresent
204 /** DMMCSocket::GetBufferInfo */
205 ,ESocketGetBufferInfo
206 /** DMMCSocket::Init */
208 /** DMMCSocket::InitiatePowerUpSequence */
209 ,ESocketInitiatePowerUpSequence
210 /** DMMCSocket::MachineInfo */
212 /** DMMCSocket::PrepareStore */
214 /** DMMCSocket::Reset1 */
216 /** DMMCSocket::Reset2 */
218 /** DMMCSocket::ResetInactivity */
219 ,ESocketResetInactivity
220 /** DMMCSocket::Stack */
222 /** DMMCSocket::iState */
224 /** DMMCSocket::iDoorOpened */
225 ,ESocketiDoorOpened_Get
226 /** DMMCSocket::iStandby */
228 /** DMMCSocket::iType */
230 /** DMMCSocket::PowerUp */
235 /** Return stack object */
237 /** DMMCStack::AdjustPartialRead */
238 ,EStackAdjustPartialRead
239 /** DMMCStack::AllocSession */
241 /** DMMCStack::BufferInfo */
243 /** DMMCStack::CardP */
245 /** DMMCStack::DemandPagingInfo */
246 ,EStackDemandPagingInfo
247 /** DMMCStack::EffectiveModes */
248 ,EStackEffectiveModes
249 /** DMMCStack::GetBufferInfo */
251 /** DMMCStack::HasCardsPresent */
252 ,EStackHasCardsPresent
253 /** DMMCStack::HasSessionsQueued */
254 ,EStackHasSessionsQueued
255 /** DMMCStack::Init */
257 /** DMMCStack::InitStackInProgress */
258 , EStackInitStackInProgress
259 /** DMMCStack::MMCSocket */
261 /** DMMCStack::MachineInfo */
263 /** DMMCStack::MaxCardsInStack */
264 , EStackMaxCardsInStack
265 /** DMMCStack::PasswordStore read*/
266 , EStackReadPasswordStore
267 /** DMMCStack::PasswordStore write*/
268 , EStackWritePasswordStore
269 /** DMMCStack::ProgramPeriodInMs */
270 , EStackProgramPeriodInMs
271 /** DMMCStack::StackStop */
273 /** DMMCStack::ReportPowerDown */
274 , EStackReportPowerDown
275 /** DMMCStack::ReportPowerUp */
276 , EStackReportPowerUp
277 /** see TEffectiveModesFunctionId enum */
278 , EStackConfigureEffectiveModes
281 enum TEffectiveModesFunctionId {
282 /** TMMCStackConfig::RemoveMode(TUint32 aMask) */
283 EStackEffectiveModesRemoveMode = 1
284 /** TMMCStackConfig::SetBusClockInKhz(TUint aParam) */
285 , EStackEffectiveModesSetBusClockInKhz
286 /** TMMCStackConfig:: SetBusClockInKhz(TUint aParam); */
287 , EStackEffectiveModesSetBusyTimeOutInMcs
288 /** TMMCStackConfig::SetCRCRetries(TUint aData)*/
289 , EStackEffectiveModesSetCRCRetries
290 /** TMMCStackConfig::SetDataTimeOutInMcs(TUint aParam) */
291 , EStackEffectiveModesSetDataTimeOutInMcs
292 /** TMMCStackConfig::TUint32 aMask*/
293 , EStackEffectiveModesSetMode
294 /** TMMCStackConfig::SetOpCondBusyTimeout(TUint16 aData); */
295 , EStackEffectiveModesSetOpCondBusyTimeout
296 /** TMMCStackConfig::SetPollAttempts(TUint aData); */
297 , EStackEffectiveModesSetPollAttempts
298 /** TMMCStackConfig::SetResponseTimeOutInTicks(TUint aParam); */
299 , EStackEffectiveModesSetResponseTimeOutInTicks
300 /** TMMCStackConfig:: SetTicksClockIn(TUint aParam); */
301 , EStackEffectiveModesSetTicksClockIn
302 /** TMMCStackConfig::SetTicksClockOut(TUint aParam); */
303 , EStackEffectiveModesSetTicksClockOut
304 /** TMMCStackConfig::SetTimeOutRetries(TUint aData); */
305 , EStackEffectiveModesSetTimeOutRetries
309 inline void Cancel();
310 inline TInt Open(TInt aStack,const TVersion& aVer);
311 inline TVersion VersionRequired() const;
314 inline TInt ReadBlock();
317 inline TInt Psu(TAny* aPsu);
318 inline TInt PsuInfo(TPBusPsuInf& anInfo);
319 inline TInt SetPsuState(TInt& aState);
320 inline TInt SetPsuVoltage(TUint& aVol);
321 inline TInt PsuNumber(TInt& aPsuNum);
322 inline TInt MediaChangeID(TInt& aMCId);
323 inline TInt PsuCurLimit(TBool& aSafe);
324 inline TInt PbusState(TInt& aState);
325 inline TInt VccState(TInt& aVccState);
326 inline TInt IsLocked(TBool& aState);
327 inline TInt IsOff(TBool& aState);
328 inline TInt MaxCurrentInMicroAmps(TInt& aMaxCurrent);
329 inline TInt ResetInactivityTimer();
330 inline TInt VoltageSupported(TUint& aVoltage);
331 inline TInt InactivityCount(TInt& aInactivityCount);
332 inline TInt NotLockedCount(TInt& aNotLockedCount);
333 inline TInt InactivityTimeout(TInt& aInactivityTimeout);
334 inline TInt NotLockedTimeout(TInt& aNotLockedTimeout);
335 inline TInt MemVoltageSupported(TUint& aVoltage);
336 inline TInt MemMaxCurrentInMicroAmps(TInt& aMaxCurrent);
337 inline TInt VoltCheckInterval(TUint& aVoltCheckInterval);
340 inline TInt MediaChange(TAny* aMediaChange);
341 inline TInt MediaStateInfo(TInt& aMediaState);
342 inline TInt ForceMediaChange();
343 inline TInt MediaChangeCounter(TInt& aCounter);
346 inline TInt Socket(TAny* aSocket);
347 inline TInt SocketAdjustPartialRead(TPartialReadData& aPartialReadData);
348 inline TInt SocketCardIsPresent(TBool& aCardPresent);
349 inline TInt SocketGetBufferInfo(TBufferInfo& aBufferInfo);
350 inline TInt SocketInit();
351 inline TInt SocketInitiatePowerUpSequence();
352 inline TInt SocketMachineInfo(TMachineInfo& aMachineInfo);
353 inline TInt SocketPrepareStore(TPasswordPrepareStoreData& aData);
354 inline TInt SocketReset1();
355 inline TInt SocketReset2();
356 inline TInt SocketResetInactivity(TInt aBusNumber);
357 inline TInt SocketStack(TStackPtr& aStackPtr);
358 inline TInt SocketiState_Get(TBusState& aState);
359 inline TInt SocketiDoorOpened_Get(TBool& aDoorOpened);
360 inline TInt SocketiStandby_Get(TBool& aStandby);
361 inline TInt SocketiType_Get(TCardBusType& aType);
362 inline void SocketPowerUp(TRequestStatus& aStatus);
365 inline TInt Stack(TAny* aStack);
366 inline TInt StackAdjustPartialRead(TPartialReadData& aPartialReadData);
367 inline TInt StackAllocSession();
368 inline TInt StackGetBufferInfo(TBufferInfo& aBufferInfo);
369 inline TInt StackBufferInfo(TBufferInfo& aBufferInfo);
370 inline TInt StackCardP(TCardPtr& aCardPtr);
371 inline TInt StackStop();
372 inline TInt StackMaxCardsInStack(TUint& aNumCardsInStack);
373 inline TInt StackMMCSocket(TAny* aAny);
375 inline TInt StackPasswordStore(TAny** aPwdStorePtr);
376 inline TInt StackReadPasswordStore(TStackPasswordStoreData& aPwdStoreData);
377 inline TInt StackWritePasswordStore(TStackPasswordStoreData& aPwdStoreData);
378 inline TInt StackProgramPeriodInMilliSeconds(TInt& aPeriodMs);
379 inline TInt StackInitStackInProgress(TBool& aInProgress);
380 inline TInt StackHasSessionsQueued(TBool& aSessionsQueued);
381 inline TInt StackHasCardsPresent(TBool& aCardsPresent);
382 inline TInt StackMachineInfo(TMachineInfo& aMachineInfo);
383 inline TInt StackDemandPagingInfo(TTCDemandPagingInfo& aInfo);
384 inline TInt StackEffectiveModes(TUint32& aRetVal);
385 inline TInt StackInit();
386 inline TInt StackReportPowerUp();
387 inline TInt StackReportPowerDown();
388 inline TInt StackAlterEffectiveModes( TEffectiveModesFunctionId FunctionId, TAny* aData);
391 inline void ReadSector(TRequestStatus &aStatus,TInt aSectNum,TDes8 &aDes);
392 inline void WriteSector(TRequestStatus &aStatus,TInt aSectNum,const TDesC8 &aDes);
393 inline TInt CardInfo(TMMCCardInfo& aCardInfo);
394 inline TInt ReadCSD(TCSDInfo& aCSDInfo);
395 inline TInt ReadExtCSD(TExtendedCSDInfo& aExtCSDInfo);
396 inline TInt Card(TAny* aCard);
397 inline TInt CardIsPresent(TBool& aIsPresent);
398 inline TInt CardIsReady(TBool& aIsReady);
399 inline TInt CardIsLocked(TBool& aIsLocked);
400 inline void PwrDownStack();
403 inline TInt TestDoControl(TTCFunctionId aFunctionId, TAny *a1 = NULL, TAny *a2 = NULL);
404 inline void TestDoRequest(TTCFunctionId aFunctionId, TRequestStatus &aStatus, TAny *a1 = NULL, TAny *a2 = NULL);
407 #include "d_mmcsdif.inl"