author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 25 May 2010 14:09:55 +0300 | |
branch | RCL_3 |
changeset 117 | 5b5d147c7838 |
parent 87 | 2f92ad2dc5db |
child 200 | 73ea206103e6 |
permissions | -rw-r--r-- |
0 | 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 |
// SD-specific extensions of generic MMC classes adhering to SD Physical layer simplified spec v2.0 |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
/** |
|
19 |
@file |
|
20 |
@internalComponent |
|
21 |
*/ |
|
22 |
||
23 |
#ifndef __SDCARD_H__ |
|
24 |
#define __SDCARD_H__ |
|
25 |
||
26 |
#include <drivers/mmc.h> |
|
27 |
||
28 |
class DSDStack; |
|
29 |
||
30 |
enum TSDSessionTypeEnum |
|
31 |
{ |
|
32 |
// empty. |
|
33 |
}; |
|
34 |
||
35 |
const TUint KSDMinCustomSession = KMMCMinCustomSession + 1024; |
|
36 |
||
37 |
const TUint32 KSDBusWidth1 = 0x00; |
|
38 |
const TUint32 KSDBusWidth4 = 0x02; |
|
39 |
const TUint32 KSDStatusBlockLength = 0x40; |
|
40 |
||
41 |
const TUint32 KSDSCRLength = 0x08; |
|
42 |
const TUint32 KSDSwitchFuncLength = 0x40; |
|
43 |
const TUint32 KSDCheckFunctionHighSpeed = 0x00FFFF01; |
|
44 |
const TUint32 KSDSwitchFunctionHighSpeed = 0x80FFFF01; |
|
45 |
||
46 |
const TUint32 KSDCardIsSDCard = KBit16; // KMMCardFirstCustomFlag |
|
87
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
62
diff
changeset
|
47 |
const TUint32 KSDCardIsCorrupt = KBit17; |
0 | 48 |
const TUint32 KSDCardFirstCustomFlag = KBit24; |
49 |
||
50 |
const TUint KSDDTClk25MHz = 25000; //25000KHz |
|
51 |
const TUint KSDDTClk50MHz = 50000; //50000KHz |
|
52 |
||
53 |
class TSDCSD : public TCSD |
|
54 |
{ |
|
55 |
public: |
|
56 |
inline TSDCSD(const TCSD& aCSD); |
|
57 |
||
58 |
inline TBool SDEraseBlkEn() const; |
|
59 |
inline TBool SDSectorSize() const; |
|
60 |
inline TBool SDWPGrpSize() const; |
|
61 |
}; |
|
62 |
||
63 |
class TSDCard : public TMMCard |
|
64 |
{ |
|
65 |
public: |
|
66 |
TSDCard(); |
|
67 |
inline TBool IsSDCard() const; |
|
68 |
inline TUint32 ProtectedAreaSize() const; |
|
69 |
inline void SetProtectedAreaSize(TUint32 aPAS); |
|
70 |
inline TUint8 GetAUSize() const; |
|
71 |
inline void SetAUSize(TUint8 aAU); |
|
72 |
inline TInt DeviceSize() const; |
|
73 |
virtual TUint32 PreferredWriteGroupLength() const; |
|
74 |
virtual TInt GetFormatInfo(TLDFormatInfo& aFormatInfo) const; |
|
75 |
virtual TUint32 MinEraseSectorSize() const; |
|
76 |
virtual TUint32 EraseSectorSize() const; |
|
77 |
virtual TInt GetEraseInfo(TMMCEraseInfo& anEraseInfo) const; |
|
78 |
virtual TInt MaxReadBlLen() const; |
|
79 |
virtual TInt MaxWriteBlLen() const; |
|
80 |
virtual TInt64 DeviceSize64() const; |
|
81 |
enum {KPARootDirEndUnknown = 0}; |
|
82 |
inline TUint32 PARootDirEnd() const; |
|
83 |
inline void SetPARootDirEnd(TUint32 aPARootDirEnd); |
|
84 |
virtual TUint MaxTranSpeedInKilohertz() const; |
|
85 |
private: |
|
86 |
TUint32 iProtectedAreaSize; |
|
87 |
TUint32 iPARootDirEnd; |
|
88 |
TUint8 iAUSize; |
|
89 |
TUint8 iPad[3]; |
|
90 |
TUint32 iSpare[4]; |
|
91 |
}; |
|
92 |
||
93 |
class TSDCardArray : public TMMCardArray |
|
94 |
{ |
|
95 |
public: |
|
96 |
inline TSDCardArray(DSDStack* aOwningStack); |
|
97 |
IMPORT_C virtual TInt AllocCards(); |
|
98 |
||
99 |
inline TSDCard& Card(TUint aCardNumber) const; |
|
100 |
inline TSDCard& NewCard(TUint aCardNumber) const; |
|
101 |
void AddCardSDMode(TUint aCardNumber,const TUint8* aCID,TRCA* aNewRCA); |
|
102 |
TInt StoreRCAIfUnique(TUint aCardNumber,TRCA& anRCA); |
|
103 |
IMPORT_C virtual void DeclareCardAsGone(TUint aCardNumber); |
|
104 |
}; |
|
105 |
||
106 |
enum TSDAppCmd |
|
107 |
{ |
|
108 |
ESDACmdSetBusWidth = 6, |
|
109 |
ESDACmdSDStatus = 13, |
|
110 |
ESDACmdSendNumWrBlocks = 22, |
|
111 |
ESDACmdSetWrBlkEraseCount = 23, |
|
112 |
ESDACmdSDAppOpCond = 41, |
|
113 |
ESDACmdSetClrCardDetect = 42, |
|
114 |
ESDACmdSendSCR = 51 |
|
115 |
}; |
|
116 |
||
117 |
enum TSDSpecificCmd |
|
118 |
{ |
|
119 |
ESDCmdSendRelativeAddress = 3, |
|
120 |
ESDCmdSwitchFunction = 6, |
|
121 |
ESDCmdSendIfCond = 8 |
|
122 |
}; |
|
123 |
||
124 |
class DSDSession : public DMMCSession |
|
125 |
{ |
|
126 |
public: |
|
127 |
inline DSDSession(const TMMCCallBack& aCallBack); |
|
128 |
||
129 |
static void FillAppCommandDesc(TMMCCommandDesc& aDesc, TSDAppCmd aCmd); |
|
130 |
static void FillAppCommandDesc(TMMCCommandDesc& aDesc, TSDAppCmd aCmd, TMMCArgument aArg); |
|
131 |
||
132 |
static void FillSdSpecificCommandDesc(TMMCCommandDesc& aDesc, TSDSpecificCmd aCmd); |
|
133 |
static void FillSdSpecificCommandDesc(TMMCCommandDesc& aDesc, TSDSpecificCmd aCmd, TMMCArgument aArg); |
|
134 |
||
135 |
protected: |
|
136 |
// not implemented. No SD specific macros |
|
137 |
// virtual TMMCSMSTFunc GetMacro(TInt aSessNum) const; |
|
138 |
||
139 |
private: |
|
140 |
static void FillAppCommandDesc(TMMCCommandDesc& aDesc); |
|
141 |
static void FillSdSpecificCommandDesc(TMMCCommandDesc& aDesc); |
|
142 |
}; |
|
143 |
||
144 |
const TInt KSDMaxMBWRetries = 1; |
|
145 |
const TUint32 KSDACMD22BlockLen = 4; |
|
146 |
class DSDStack : public DMMCStack |
|
147 |
{ |
|
148 |
public: |
|
149 |
inline DSDStack(TInt aBus, DMMCSocket* aSocket); |
|
150 |
||
151 |
IMPORT_C virtual TInt Init(); |
|
152 |
IMPORT_C virtual TMMCErr AcquireStackSM(); |
|
153 |
IMPORT_C virtual TMMCErr CIMReadWriteBlocksSM(); |
|
154 |
IMPORT_C virtual DMMCSession* AllocSession(const TMMCCallBack& aCallBack) const; |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
|
0 | 156 |
virtual void AddressCard(TInt aCardNumber) = 0; |
157 |
||
158 |
inline TSDCardArray& CardArray() const; |
|
159 |
||
160 |
protected: |
|
161 |
IMPORT_C virtual TMMCErr InitStackAfterUnlockSM(); |
|
162 |
||
163 |
static TMMCErr InitialiseMemoryCardSMST(TAny* aStackP); |
|
164 |
TMMCErr InitialiseMemoryCardSM(); |
|
165 |
||
166 |
static TMMCErr ConfigureMemoryCardSMST(TAny* aStackP); |
|
167 |
TMMCErr ConfigureMemoryCardSM(); |
|
168 |
||
169 |
static TMMCErr CIMReadWriteMemoryBlocksSMST(TAny* aStackP); |
|
170 |
||
171 |
static TMMCErr BaseModifyCardCapabilitySMST(TAny* aStackP); |
|
172 |
IMPORT_C virtual TMMCErr ModifyCardCapabilitySM(); |
|
173 |
||
174 |
static TMMCErr SwitchToHighSpeedModeSMST(TAny* aStackP); |
|
175 |
TMMCErr SwitchToHighSpeedModeSM(); |
|
176 |
||
177 |
private: |
|
178 |
TInt iSpare; |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
protected: |
0 | 180 |
enum TSDCardType {ESDCardTypeUnknown, ESDCardTypeIsMMC, ESDCardTypeIsSD}; |
181 |
TSDCardType iCxCardType; // Used when detecting whether an SD Memory card is present. |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
private: |
0 | 183 |
TUint8 iACMD22[KSDACMD22BlockLen]; |
184 |
||
185 |
private: |
|
186 |
// |
|
187 |
// Dummy functions to maintain binary compatibility |
|
188 |
IMPORT_C virtual void Dummy1(); |
|
189 |
IMPORT_C virtual void Dummy2(); |
|
190 |
IMPORT_C virtual void Dummy3(); |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
191 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
192 |
public: |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
193 |
IMPORT_C virtual DSDStack::TSDCardType CardType(TInt aSocket, TInt aCardNumber); |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
195 |
private: |
0 | 196 |
// |
197 |
// Reserved members to maintain binary compatibility |
|
198 |
TInt iReserved[68]; |
|
199 |
}; |
|
200 |
||
201 |
#include <drivers/sdcard.inl> |
|
202 |
||
203 |
#endif // #ifndef __SDCARD_H__ |