os/boardsupport/haitest/bspsvs/suite/bsp/mmc/ldd/inc/d_mmcsdif.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/bsp/mmc/ldd/inc/d_mmcsdif.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,409 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#if !defined(__D_MMCSDIF_H__)
    1.23 +#include <e32cmn.h>
    1.24 +#ifndef __KERNEL_MODE__
    1.25 +#include <e32std.h>
    1.26 +#endif
    1.27 +#include "MmcTestUtils.h"
    1.28 +
    1.29 +
    1.30 +#ifdef __DEBUG
    1.31 +	#define _MMCSDLDDLOGGING   // Enable LDD logging
    1.32 +#endif
    1.33 +
    1.34 +#if defined( _MMCSDLDDLOGGING )
    1.35 +	 #define MMCSDLOG(A) Kern::Printf(A)
    1.36 +	 #define MMCSDLOG2(A, B) Kern::Printf(A, B)
    1.37 +	 #define MMCSDLOG3(A, B, C) Kern::Printf(A, B, C)
    1.38 +	 #define MMCSDLOG4(A, B, C, D) Kern::Printf(A, B, C, D)
    1.39 +	 #define MMCSDLOG5(A, B, C, D, E) Kern::Printf(A, B, C, D, E)
    1.40 +	 #define MMCSDLOG6(A, B, C, D, E, F) Kern::Printf(A, B, C, D, E, F)
    1.41 +#else
    1.42 +	 #define MMCSDLOG(A)
    1.43 +	 #define MMCSDLOG2(A, B)
    1.44 +	 #define MMCSDLOG3(A, B, C)
    1.45 +	 #define MMCSDLOG4(A, B, C, D)
    1.46 +	 #define MMCSDLOG5(A, B, C, D, E)
    1.47 +	 #define MMCSDLOG6(A, B, C, D, E, F)
    1.48 +#endif
    1.49 +
    1.50 +
    1.51 +_LIT(KLddName, "MMCSDTestCtrlInf");
    1.52 +
    1.53 +//Card Constants
    1.54 +const TInt KMaxCardsPerStack=2;
    1.55 +const TInt KSectorSizeInBytes=512;
    1.56 +const TInt KMaxBlocklengthInBytes=1024;
    1.57 +const TInt KSectorSizeShift=9;
    1.58 +const TInt KDrvBufSizeInSectors=8;
    1.59 +
    1.60 +const TInt KStackNo=0;
    1.61 +
    1.62 +//Used to check erase command is supported by the card.
    1.63 +const TUint32 KMMCEraseClassCmdSupported=KBit0;
    1.64 +
    1.65 +//Used to check group erase command is supported by the card.
    1.66 +const TUint32 KMMCEraseGroupCmdSupported=KBit1;
    1.67 +
    1.68 +
    1.69 +/**
    1.70 + * Card power supply information
    1.71 + *
    1.72 + */
    1.73 +class TPBusPsuInf
    1.74 +	{
    1.75 +public:
    1.76 +
    1.77 +	/**	Indicates the voltage level, or range of voltages supported.
    1.78 +		Reperesented in OCR (Operation Condition Register) */
    1.79 +	TUint iVoltageSupported;
    1.80 +
    1.81 +   	/**	Maximum Current Supplied by the PSU */
    1.82 +	TInt iMaxCurrentInMicroAmps;
    1.83 +
    1.84 +	/**	PSU Voltage level within expected limit while turning ON */
    1.85 +	TUint iVoltCheckInterval;
    1.86 +
    1.87 +	/**	VCC voltage when ON */
    1.88 +	TUint iVoltCheckMethod;
    1.89 +
    1.90 +    /**	Bus not locked timeout period,in seconds,when no clients are registered */
    1.91 +    TInt iNotLockedTimeOut;
    1.92 +
    1.93 +	/**	Bus inactivity timeout period, in seconds, when clients are registered */
    1.94 +	TInt iInactivityTimeOut;
    1.95 +
    1.96 +	};
    1.97 +	
    1.98 +/**
    1.99 + * MMC card Version
   1.100 + *
   1.101 + */
   1.102 +class TCapsMmcIfV01
   1.103 +	{
   1.104 +public:
   1.105 +	TVersion version;
   1.106 +	};
   1.107 +
   1.108 +
   1.109 +/**
   1.110 + * Class for MMCSD controller interface to test MMC/SD Cards
   1.111 + *
   1.112 + */
   1.113 +class RMMCSDTestControllerInterface : public RBusLogicalChannel
   1.114 +	{
   1.115 +public:
   1.116 +	enum {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=1};
   1.117 +	enum TRequest
   1.118 +		{
   1.119 +		/** Read a sector */
   1.120 +		EReadSector,
   1.121 +		/** Write a sector */
   1.122 +		EWriteSector
   1.123 +		};
   1.124 +	enum TControl
   1.125 +		{
   1.126 +		/** Return whether SD card is in use */
   1.127 +		ESDCard,
   1.128 +		/** Read CSD register */
   1.129 +		EReadCSD,
   1.130 +		/** Read extended CSD register */
   1.131 +		EReadExtCSD,
   1.132 +		/** Get card info */
   1.133 +		ECardInfo,
   1.134 +		/** Return card object */
   1.135 +		ECard,
   1.136 +		/** Return card is present status */
   1.137 +		ECardIsPresent,
   1.138 +		/** Return card is ready status */
   1.139 +		ECardIsReady,
   1.140 +		/** Return card is locked status */
   1.141 +		ECardIsLocked
   1.142 +		};
   1.143 +	enum TPsuControl
   1.144 +        {
   1.145 +		/** Return psu object */
   1.146 +		EPsu,
   1.147 +    	/** Gets the PSU Information */
   1.148 +		EPsuInfo,
   1.149 +		/** Set Power Supply State */
   1.150 +		EPsuState,
   1.151 +		/**Set Psu Voltage in OCR format */
   1.152 +		EPsuVoltage,
   1.153 +		/** Read Power supply unit number */
   1.154 +		EPsuNum,
   1.155 +		/** Read the Media Change ID */
   1.156 +		EMediaChangeNum,
   1.157 +		/** PSU current limit safe level or Not */
   1.158 +		EPsuCurLimit,
   1.159 +		/** Gets the PBUS state */
   1.160 +		EPbusState,
   1.161 +		/**	Gets the Power Supply Status */
   1.162 +		EVccState,
   1.163 +		/** Checks whether this PSU is powering a bus containing a locked device*/
   1.164 +		EIsLocked,
   1.165 +		/** Checks whether the PSU is off*/
   1.166 +		EIsOff,
   1.167 +		/** Gets the maximum current (in microAmps) that the PSU is able to supply*/
   1.168 +		EMaxCurrentInMicroAmps,
   1.169 +		/** Resets inactivity and not-locked counts*/
   1.170 +		EResetInactivityTimer,
   1.171 +		/** Gets the voltage level, or range of supported voltage levels*/
   1.172 +		EVoltageSupported,
   1.173 +		/** Bus inactivity counter*/
   1.174 +		EMemInactivityCount,
   1.175 +		/** Bus not locked counter*/
   1.176 +		EMemNotLockedCount,
   1.177 +		/** Bus inactivity timeout period, in seconds, when clients are registered*/
   1.178 +		EMemInactivityTimeout,
   1.179 +		/** Bus not locked timeout period, in seconds, when no clients are registered*/
   1.180 +		EMemNotLockedTimeout,
   1.181 +		/** Indicates the voltage level, or range of voltages supported*/
   1.182 +		EMemVoltageSupported,
   1.183 +		/** The maximum current (in microAmps) that the PSU is able to supply*/
   1.184 +		EMemMaxCurrentInMicroAmps,
   1.185 +		/**Indicates whether the platform hardware has support for checking whether the voltage level*/
   1.186 +		EMemVoltCheckInterval
   1.187 +		};
   1.188 +	enum TMediaChangeControl
   1.189 +		{
   1.190 +		/** Return media change object */
   1.191 +		EMediaChange,
   1.192 +		/** Gets the MMC stack media state */
   1.193 +		EMediaStateInfo,
   1.194 +		/** Force Media Change */
   1.195 +		EForceMediaChange,
   1.196 +		/** Media Change Replay Count */
   1.197 +		EMediaChangeCounter
   1.198 +		};
   1.199 +	enum TSocketControl
   1.200 +        {
   1.201 +		/** Return socket object */
   1.202 +		ESocket
   1.203 +		/** DMMCSocket::AdjustPartialRead */
   1.204 +		,ESocketAdjustPartialRead
   1.205 +    	/** DMMCSocket::CardIsPresent */
   1.206 +		,ESocketCardIsPresent
   1.207 +		/** DMMCSocket::GetBufferInfo */
   1.208 +		,ESocketGetBufferInfo
   1.209 +		/** DMMCSocket::Init */
   1.210 +		,ESocketInit
   1.211 +		/** DMMCSocket::InitiatePowerUpSequence */
   1.212 +		,ESocketInitiatePowerUpSequence
   1.213 +		/** DMMCSocket::MachineInfo */
   1.214 +		,ESocketMachineInfo
   1.215 +		/** DMMCSocket::PrepareStore */
   1.216 +		,ESocketPrepareStore
   1.217 +		/** DMMCSocket::Reset1 */
   1.218 +		,ESocketReset1
   1.219 +		/** DMMCSocket::Reset2 */
   1.220 +		,ESocketReset2
   1.221 +		/** DMMCSocket::ResetInactivity */
   1.222 +		,ESocketResetInactivity
   1.223 +		/** DMMCSocket::Stack */
   1.224 +		,ESocketStack
   1.225 +		/** DMMCSocket::iState */
   1.226 +		,ESocketiState_Get
   1.227 +		/** DMMCSocket::iDoorOpened */
   1.228 +		,ESocketiDoorOpened_Get
   1.229 +		/** DMMCSocket::iStandby */
   1.230 +		,ESocketiStandby_Get
   1.231 +		/** DMMCSocket::iType */
   1.232 +		,ESocketiType_Get
   1.233 +		/** DMMCSocket::PowerUp */
   1.234 +		,ESocketPowerUp
   1.235 +       };
   1.236 +	enum TStackControl
   1.237 +        {
   1.238 +		/** Return stack object */
   1.239 +		EStack
   1.240 +		/** DMMCStack::AdjustPartialRead */
   1.241 +		,EStackAdjustPartialRead
   1.242 +		/** DMMCStack::AllocSession */
   1.243 +		,EStackAllocSession
   1.244 +		/** DMMCStack::BufferInfo */
   1.245 +		,EStackBufferInfo
   1.246 +		/** DMMCStack::CardP */
   1.247 +		,EStackCardP
   1.248 +		/** DMMCStack::DemandPagingInfo */
   1.249 +		,EStackDemandPagingInfo
   1.250 +		/** DMMCStack::EffectiveModes */
   1.251 +		,EStackEffectiveModes
   1.252 +		/** DMMCStack::GetBufferInfo */
   1.253 +		,EStackGetBufferInfo
   1.254 +		/** DMMCStack::HasCardsPresent */
   1.255 +		,EStackHasCardsPresent
   1.256 +		/** DMMCStack::HasSessionsQueued */
   1.257 +		,EStackHasSessionsQueued
   1.258 +		/** DMMCStack::Init */
   1.259 +		, EStackInit
   1.260 +		/** DMMCStack::InitStackInProgress */
   1.261 +		, EStackInitStackInProgress
   1.262 +		/** DMMCStack::MMCSocket */
   1.263 +		, EStackMMCSocket
   1.264 +		/** DMMCStack::MachineInfo */
   1.265 +		, EStackMachineInfo
   1.266 +		/** DMMCStack::MaxCardsInStack */
   1.267 +		, EStackMaxCardsInStack
   1.268 +		/** DMMCStack::PasswordStore read*/
   1.269 +		, EStackReadPasswordStore
   1.270 +		/** DMMCStack::PasswordStore write*/
   1.271 +		, EStackWritePasswordStore
   1.272 +		/** DMMCStack::ProgramPeriodInMs */
   1.273 +		, EStackProgramPeriodInMs
   1.274 +		/** DMMCStack::StackStop */
   1.275 +		, EStackStop
   1.276 +		/** DMMCStack::ReportPowerDown */
   1.277 +		, EStackReportPowerDown
   1.278 +		/** DMMCStack::ReportPowerUp */
   1.279 +		, EStackReportPowerUp
   1.280 +		/** see TEffectiveModesFunctionId enum */
   1.281 +		, EStackConfigureEffectiveModes
   1.282 +        };
   1.283 +
   1.284 +	enum TEffectiveModesFunctionId {
   1.285 +		/** TMMCStackConfig::RemoveMode(TUint32 aMask) */
   1.286 +		EStackEffectiveModesRemoveMode = 1
   1.287 +		/** TMMCStackConfig::SetBusClockInKhz(TUint aParam) */
   1.288 +		, EStackEffectiveModesSetBusClockInKhz
   1.289 +		/** TMMCStackConfig:: SetBusClockInKhz(TUint aParam); */
   1.290 +		, EStackEffectiveModesSetBusyTimeOutInMcs
   1.291 +		/** TMMCStackConfig::SetCRCRetries(TUint aData)*/
   1.292 +		, EStackEffectiveModesSetCRCRetries
   1.293 +		/** TMMCStackConfig::SetDataTimeOutInMcs(TUint aParam) */
   1.294 +		, EStackEffectiveModesSetDataTimeOutInMcs
   1.295 +		/** TMMCStackConfig::TUint32 aMask*/
   1.296 +		, EStackEffectiveModesSetMode
   1.297 +		/** TMMCStackConfig::SetOpCondBusyTimeout(TUint16 aData); */
   1.298 +		, EStackEffectiveModesSetOpCondBusyTimeout
   1.299 +		/** TMMCStackConfig::SetPollAttempts(TUint aData); */
   1.300 +		, EStackEffectiveModesSetPollAttempts
   1.301 +		/** TMMCStackConfig::SetResponseTimeOutInTicks(TUint aParam); */
   1.302 +		, EStackEffectiveModesSetResponseTimeOutInTicks
   1.303 +		/** TMMCStackConfig:: SetTicksClockIn(TUint aParam); */
   1.304 +		, EStackEffectiveModesSetTicksClockIn
   1.305 +		/** TMMCStackConfig::SetTicksClockOut(TUint aParam); */
   1.306 +		, EStackEffectiveModesSetTicksClockOut
   1.307 +		/** TMMCStackConfig::SetTimeOutRetries(TUint aData); */
   1.308 +		, EStackEffectiveModesSetTimeOutRetries
   1.309 +
   1.310 +        };
   1.311 +public:
   1.312 +	inline void Cancel();
   1.313 +	inline TInt Open(TInt aStack,const TVersion& aVer);
   1.314 +	inline TVersion VersionRequired() const;
   1.315 +	inline void Reset();
   1.316 +	// requests
   1.317 +	inline TInt ReadBlock();
   1.318 +
   1.319 +	//DMMCPsu
   1.320 +	inline TInt Psu(TAny* aPsu);
   1.321 +	inline TInt PsuInfo(TPBusPsuInf& anInfo);
   1.322 +	inline TInt SetPsuState(TInt& aState);
   1.323 +	inline TInt SetPsuVoltage(TUint& aVol);
   1.324 +	inline TInt PsuNumber(TInt& aPsuNum);
   1.325 +	inline TInt MediaChangeID(TInt& aMCId);
   1.326 +	inline TInt PsuCurLimit(TBool& aSafe);
   1.327 +	inline TInt PbusState(TInt& aState);
   1.328 +	inline TInt VccState(TInt& aVccState);
   1.329 +	inline TInt IsLocked(TBool& aState);
   1.330 +	inline TInt IsOff(TBool& aState);
   1.331 +	inline TInt MaxCurrentInMicroAmps(TInt& aMaxCurrent);
   1.332 +	inline TInt ResetInactivityTimer();
   1.333 +	inline TInt VoltageSupported(TUint& aVoltage);
   1.334 +	inline TInt InactivityCount(TInt& aInactivityCount);
   1.335 +	inline TInt NotLockedCount(TInt& aNotLockedCount);
   1.336 +	inline TInt InactivityTimeout(TInt& aInactivityTimeout);
   1.337 +	inline TInt NotLockedTimeout(TInt& aNotLockedTimeout);
   1.338 +	inline TInt MemVoltageSupported(TUint& aVoltage);
   1.339 +	inline TInt MemMaxCurrentInMicroAmps(TInt& aMaxCurrent);
   1.340 +	inline TInt VoltCheckInterval(TUint& aVoltCheckInterval);
   1.341 +
   1.342 +	//DMMCMediaChange
   1.343 +	inline TInt MediaChange(TAny* aMediaChange);
   1.344 +	inline TInt MediaStateInfo(TInt& aMediaState);
   1.345 +	inline TInt ForceMediaChange();
   1.346 +	inline TInt MediaChangeCounter(TInt& aCounter);
   1.347 +	
   1.348 +	// DMMCSocket
   1.349 +	inline TInt Socket(TAny* aSocket);
   1.350 +	inline TInt SocketAdjustPartialRead(TPartialReadData& aPartialReadData);
   1.351 +	inline TInt SocketCardIsPresent(TBool& aCardPresent);
   1.352 +	inline TInt SocketGetBufferInfo(TBufferInfo& aBufferInfo);
   1.353 +	inline TInt SocketInit();
   1.354 +	inline TInt SocketInitiatePowerUpSequence();
   1.355 +	inline TInt SocketMachineInfo(TMachineInfo& aMachineInfo);
   1.356 +	inline TInt SocketPrepareStore(TPasswordPrepareStoreData& aData);
   1.357 +	inline TInt SocketReset1();
   1.358 +	inline TInt SocketReset2();
   1.359 +	inline TInt SocketResetInactivity(TInt aBusNumber);
   1.360 +	inline TInt SocketStack(TStackPtr& aStackPtr);
   1.361 +	inline TInt SocketiState_Get(TBusState& aState);
   1.362 +	inline TInt SocketiDoorOpened_Get(TBool& aDoorOpened);
   1.363 +	inline TInt SocketiStandby_Get(TBool& aStandby);
   1.364 +	inline TInt SocketiType_Get(TCardBusType& aType);
   1.365 +	inline void SocketPowerUp(TRequestStatus& aStatus);
   1.366 +
   1.367 +	// DMMCStack
   1.368 +	inline TInt Stack(TAny* aStack);
   1.369 +	inline TInt StackAdjustPartialRead(TPartialReadData& aPartialReadData);
   1.370 +	inline TInt StackAllocSession();
   1.371 +	inline TInt StackGetBufferInfo(TBufferInfo& aBufferInfo);
   1.372 +	inline TInt StackBufferInfo(TBufferInfo& aBufferInfo);
   1.373 +	inline TInt StackCardP(TCardPtr& aCardPtr);
   1.374 +	inline TInt StackStop();
   1.375 +	inline TInt StackMaxCardsInStack(TUint& aNumCardsInStack);
   1.376 +	inline TInt StackMMCSocket(TAny* aAny);
   1.377 +
   1.378 +	inline TInt StackPasswordStore(TAny** aPwdStorePtr);
   1.379 +	inline TInt StackReadPasswordStore(TStackPasswordStoreData& aPwdStoreData);
   1.380 +	inline TInt StackWritePasswordStore(TStackPasswordStoreData& aPwdStoreData);
   1.381 +	inline TInt StackProgramPeriodInMilliSeconds(TInt& aPeriodMs);
   1.382 +	inline TInt StackInitStackInProgress(TBool& aInProgress);
   1.383 +	inline TInt StackHasSessionsQueued(TBool& aSessionsQueued);
   1.384 +	inline TInt StackHasCardsPresent(TBool& aCardsPresent);
   1.385 +	inline TInt StackMachineInfo(TMachineInfo& aMachineInfo);
   1.386 +	inline TInt StackDemandPagingInfo(TTCDemandPagingInfo& aInfo);
   1.387 +	inline TInt StackEffectiveModes(TUint32& aRetVal);
   1.388 +	inline TInt StackInit();
   1.389 +	inline TInt StackReportPowerUp();
   1.390 +	inline TInt StackReportPowerDown();
   1.391 +	inline TInt StackAlterEffectiveModes( TEffectiveModesFunctionId FunctionId, TAny* aData);
   1.392 +
   1.393 +	// general
   1.394 +	inline void ReadSector(TRequestStatus &aStatus,TInt aSectNum,TDes8 &aDes);
   1.395 +	inline void WriteSector(TRequestStatus &aStatus,TInt aSectNum,const TDesC8 &aDes);
   1.396 +	inline TInt CardInfo(TMMCCardInfo& aCardInfo);
   1.397 +	inline TInt ReadCSD(TCSDInfo& aCSDInfo);
   1.398 +	inline TInt ReadExtCSD(TExtendedCSDInfo& aExtCSDInfo);
   1.399 +	inline TInt Card(TAny* aCard);
   1.400 +	inline TInt CardIsPresent(TBool& aIsPresent);
   1.401 +	inline TInt CardIsReady(TBool& aIsReady);
   1.402 +	inline TInt CardIsLocked(TBool& aIsLocked);
   1.403 +	inline void PwrDownStack();
   1.404 +
   1.405 +private:
   1.406 +	inline TInt TestDoControl(TTCFunctionId aFunctionId, TAny *a1 = NULL, TAny *a2 = NULL);
   1.407 +	inline void TestDoRequest(TTCFunctionId aFunctionId, TRequestStatus &aStatus, TAny *a1 = NULL, TAny *a2 = NULL);
   1.408 +	};
   1.409 +
   1.410 +#include "d_mmcsdif.inl"
   1.411 +
   1.412 +#endif