kerneltest/e32test/pccd/d_mmctest.h
changeset 279 957c583b417b
equal deleted inserted replaced
275:2b433474f2ba 279:957c583b417b
       
     1 // Copyright (c) 2010 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 // This header provides the interface to MMCIF.LDD, which provides a set of
       
    15 // direct interface functions with the kernel MultiMediaCard Controller
       
    16 // 
       
    17 //
       
    18 
       
    19 #if !defined(__D_MMCTEST_H__)
       
    20 #include <e32cmn.h>
       
    21 #ifndef __KERNEL_MODE__
       
    22 #include <e32std.h>
       
    23 #endif
       
    24 
       
    25 //
       
    26 enum TMmcMediaType {EMmcROM,EMmcFlash,EMmcIO,EMmcOther,EMmcNotSupported};
       
    27 //
       
    28 const TInt KMaxCardsPerStack=2;
       
    29 const TInt KSectorSizeInBytes=512;
       
    30 const TInt KSectorSizeShift=9;
       
    31 const TInt KDrvBufSizeInSectors=8;
       
    32 
       
    33 /**
       
    34 @internalComponent
       
    35 */
       
    36 class TMmcCardInfo
       
    37 	{
       
    38 public:
       
    39 	inline TMmcCardInfo()
       
    40 		  {memset(this,0x00,sizeof(TMmcCardInfo)); iMediaType=EMmcNotSupported;}
       
    41 public:
       
    42 	TBool iIsReady;
       
    43 	TBool iIsLocked;
       
    44 	TUint8 iCID[16];
       
    45 	TUint8 iCSD[16];
       
    46 	TUint16 iRCA;
       
    47 	TMmcMediaType iMediaType;
       
    48     TInt64 iCardSizeInBytes;
       
    49 	TUint iReadBlLen;
       
    50 	TUint iWriteBlLen;
       
    51 	TBool iReadBlPartial;
       
    52 	TBool iWriteBlPartial;
       
    53 	TBool iReadBlkMisalign;
       
    54 	TBool iWriteBlkMisalign;
       
    55     TInt iReadCurrentInMilliAmps;
       
    56     TInt iWriteCurrentInMilliAmps;
       
    57 	TUint iSpecVers;
       
    58 	TUint iTAAC;
       
    59 	TUint iNSAC;
       
    60 	TUint iTransferSpeed;
       
    61 	TUint iCommandRegister;
       
    62 	TBool iHighCapacity;
       
    63 	};
       
    64 
       
    65 /**
       
    66 @internalComponent
       
    67 */
       
    68 class TCapsMmcIfV01
       
    69 	{
       
    70 public:
       
    71 	TVersion version;
       
    72 	};
       
    73 
       
    74 /**
       
    75 @internalComponent
       
    76 */
       
    77 class RMmcCntrlIf : public RBusLogicalChannel
       
    78 	{
       
    79 public:
       
    80 	enum {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=1};
       
    81 	enum TRequest
       
    82 		{
       
    83 		EReqReadSect,
       
    84 		EReqWriteSect,
       
    85 		EReqPwrUp,
       
    86 		EReqReadExtCSD,
       
    87 		EReqMMCInfoPrint
       
    88 		};
       
    89 	enum TControl
       
    90         {
       
    91 		ESvReset,
       
    92 		ESvPwrDown,
       
    93 		ESvRegisterEvent,
       
    94 		EExecSelectCard,
       
    95 		EExecStackInfo,
       
    96         EExecCardInfo
       
    97 		};
       
    98 public:
       
    99 	inline void Cancel();
       
   100 	inline TInt Open(TInt aStack,const TVersion& aVer)
       
   101 		{return(DoCreate(_L("MmcTest"),aVer,(TInt)aStack,NULL,NULL));}
       
   102 	inline TVersion VersionRequired() const
       
   103 		{return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));}
       
   104 	inline void Reset()
       
   105 		{DoControl(ESvReset);}
       
   106 	inline void PwrDownStack()
       
   107 		{DoControl(ESvPwrDown);}
       
   108 	inline TInt StackInfo(TUint& aCardsPresentMask)
       
   109 		{return(DoControl(EExecStackInfo,&aCardsPresentMask));}
       
   110 	inline TInt SelectCard(TInt aCard)
       
   111 		{return(DoControl(EExecSelectCard,(TAny*)aCard));}
       
   112 	inline TInt CardInfo(TMmcCardInfo& anInfo)
       
   113 		{return(DoControl(EExecCardInfo,&anInfo));}
       
   114 
       
   115 //	inline TInt RegisterEvent(TUint anEventMask,TRequestStatus *aReqStat)
       
   116 //		{return(DoControl(ESvRegisterEvent,(TAny*)anEventMask,(TAny*)aReqStat));}
       
   117 
       
   118 	inline void PwrUpAndInitStack(TRequestStatus& aStatus)
       
   119 		{DoRequest(EReqPwrUp,aStatus);}
       
   120 	inline void ReadSector(TRequestStatus &aStatus,TInt aSectNum,TDes8 &aDes)
       
   121 		{DoRequest(EReqReadSect,aStatus,(TAny*)aSectNum,(TAny*)&aDes);}
       
   122 	inline void WriteSector(TRequestStatus &aStatus,TInt aSectNum,const TDesC8 &aDes)
       
   123 		{DoRequest(EReqWriteSect,aStatus,(TAny*)aSectNum,(TAny*)&aDes);}
       
   124 	inline void ReadExtCSD(TRequestStatus& aStatus, TDes8& aExtCSD)
       
   125 		{DoRequest(EReqReadExtCSD, aStatus, (TAny*) &aExtCSD, NULL);}
       
   126 	inline void PrintCardRegisters(TRequestStatus& aStatus)
       
   127         {DoRequest(EReqMMCInfoPrint,aStatus);}
       
   128 	
       
   129 	};
       
   130 //
       
   131 #endif