|
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 // 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_MMCIF_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 }; |
|
88 enum TControl |
|
89 { |
|
90 ESvReset, |
|
91 ESvPwrDown, |
|
92 ESvRegisterEvent, |
|
93 EExecSelectCard, |
|
94 EExecStackInfo, |
|
95 EExecCardInfo |
|
96 }; |
|
97 public: |
|
98 inline void Cancel(); |
|
99 inline TInt Open(TInt aStack,const TVersion& aVer) |
|
100 {return(DoCreate(_L("MmcIf"),aVer,(TInt)aStack,NULL,NULL));} |
|
101 inline TVersion VersionRequired() const |
|
102 {return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));} |
|
103 inline void Reset() |
|
104 {DoControl(ESvReset);} |
|
105 inline void PwrDownStack() |
|
106 {DoControl(ESvPwrDown);} |
|
107 inline TInt StackInfo(TUint& aCardsPresentMask) |
|
108 {return(DoControl(EExecStackInfo,&aCardsPresentMask));} |
|
109 inline TInt SelectCard(TInt aCard) |
|
110 {return(DoControl(EExecSelectCard,(TAny*)aCard));} |
|
111 inline TInt CardInfo(TMmcCardInfo& anInfo) |
|
112 {return(DoControl(EExecCardInfo,&anInfo));} |
|
113 |
|
114 // inline TInt RegisterEvent(TUint anEventMask,TRequestStatus *aReqStat) |
|
115 // {return(DoControl(ESvRegisterEvent,(TAny*)anEventMask,(TAny*)aReqStat));} |
|
116 |
|
117 inline void PwrUpAndInitStack(TRequestStatus& aStatus) |
|
118 {DoRequest(EReqPwrUp,aStatus);} |
|
119 inline void ReadSector(TRequestStatus &aStatus,TInt aSectNum,TDes8 &aDes) |
|
120 {DoRequest(EReqReadSect,aStatus,(TAny*)aSectNum,(TAny*)&aDes);} |
|
121 inline void WriteSector(TRequestStatus &aStatus,TInt aSectNum,const TDesC8 &aDes) |
|
122 {DoRequest(EReqWriteSect,aStatus,(TAny*)aSectNum,(TAny*)&aDes);} |
|
123 |
|
124 |
|
125 inline void ReadExtCSD(TRequestStatus& aStatus, TDes8& aExtCSD) |
|
126 {DoRequest(EReqReadExtCSD, aStatus, (TAny*) &aExtCSD, NULL);} |
|
127 |
|
128 }; |
|
129 // |
|
130 #endif |