sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "T_MmcSDDriverData.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
//MMCSD Commands index
|
sl@0
|
21 |
/*@{*/
|
sl@0
|
22 |
_LIT(KCmdConstructor, "NewL");
|
sl@0
|
23 |
_LIT(KCmdReadSector, "ReadSector");
|
sl@0
|
24 |
_LIT(KCmdWriteSector, "WriteSector");
|
sl@0
|
25 |
_LIT(KCmdReadCSD, "ReadCSD");
|
sl@0
|
26 |
_LIT(KCmdReadExtCSD, "ReadExtCSD");
|
sl@0
|
27 |
_LIT(KCmdCardInfo, "CardInfo");
|
sl@0
|
28 |
_LIT(KCmdCardIsPresent, "CardIsPresent");
|
sl@0
|
29 |
_LIT(KCmdCardIsReady, "CardIsReady");
|
sl@0
|
30 |
_LIT(KCmdCardIsLocked, "CardIsLocked");
|
sl@0
|
31 |
_LIT(KCmdDestructor, "~");
|
sl@0
|
32 |
|
sl@0
|
33 |
_LIT(KExpectedAsyncError, "expectedasyncerror");
|
sl@0
|
34 |
_LIT(KSectorNumber, "sectornumber");
|
sl@0
|
35 |
_LIT(KSectorText, "sectortext");
|
sl@0
|
36 |
_LIT(KRepeats, "repeats");
|
sl@0
|
37 |
_LIT(KHighCapacity, "highcapacity");
|
sl@0
|
38 |
_LIT(KMaxReadBlockLen, "maxreadblocklen");
|
sl@0
|
39 |
_LIT(KReadCurrentInMilliAmps, "readcurrentinmilliamps");
|
sl@0
|
40 |
_LIT(KTransferSpeed, "transferspeed");
|
sl@0
|
41 |
_LIT(KSessionWrapperName, "sessionwrappername");
|
sl@0
|
42 |
_LIT(KExpectedIsPresent, "expectedispresent");
|
sl@0
|
43 |
_LIT(KExpectedIsReady, "expectedisready");
|
sl@0
|
44 |
_LIT(KExpectedIsLocked, "expectedislocked");
|
sl@0
|
45 |
/*@}*/
|
sl@0
|
46 |
|
sl@0
|
47 |
|
sl@0
|
48 |
|
sl@0
|
49 |
/**
|
sl@0
|
50 |
* Construction
|
sl@0
|
51 |
*
|
sl@0
|
52 |
* @return N/A
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
CT_MmcSDDriverData::CT_MmcSDDriverData()
|
sl@0
|
55 |
: CDataWrapperBase()
|
sl@0
|
56 |
, iMmcSDController(NULL)
|
sl@0
|
57 |
, iStackNum(0)
|
sl@0
|
58 |
, iAsyncErrorIndex(0)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
/**
|
sl@0
|
63 |
* Second phase construction
|
sl@0
|
64 |
*
|
sl@0
|
65 |
* @return void
|
sl@0
|
66 |
*
|
sl@0
|
67 |
* @leave System wide error
|
sl@0
|
68 |
*/
|
sl@0
|
69 |
void CT_MmcSDDriverData::ConstructL()
|
sl@0
|
70 |
{
|
sl@0
|
71 |
User::LeaveIfError(iFs.Connect());
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
/**
|
sl@0
|
75 |
* Public destructor
|
sl@0
|
76 |
*
|
sl@0
|
77 |
* @return N/A
|
sl@0
|
78 |
*/
|
sl@0
|
79 |
CT_MmcSDDriverData::~CT_MmcSDDriverData()
|
sl@0
|
80 |
{
|
sl@0
|
81 |
iFs.Close();
|
sl@0
|
82 |
|
sl@0
|
83 |
iActiveCallbacks.ResetAndDestroy();
|
sl@0
|
84 |
}
|
sl@0
|
85 |
|
sl@0
|
86 |
/**
|
sl@0
|
87 |
* Return a pointer to the object that the data wraps
|
sl@0
|
88 |
*
|
sl@0
|
89 |
* @return pointer to the object that the data wraps
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
TAny* CT_MmcSDDriverData::GetObject()
|
sl@0
|
92 |
{
|
sl@0
|
93 |
return iMmcSDController;
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
* Process a command read from the script file
|
sl@0
|
98 |
*
|
sl@0
|
99 |
* @param aCommand The command to process
|
sl@0
|
100 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
101 |
* @param aAsyncErrorIndex Command index for async calls to return errors to
|
sl@0
|
102 |
*
|
sl@0
|
103 |
* @return ETrue if the command is processed
|
sl@0
|
104 |
*
|
sl@0
|
105 |
* @leave System wide error
|
sl@0
|
106 |
*/
|
sl@0
|
107 |
TBool CT_MmcSDDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
sl@0
|
108 |
{
|
sl@0
|
109 |
TBool ret=ETrue;
|
sl@0
|
110 |
|
sl@0
|
111 |
if ( aCommand==KCmdConstructor )
|
sl@0
|
112 |
{
|
sl@0
|
113 |
DoCmdConstructorL(aSection);
|
sl@0
|
114 |
}
|
sl@0
|
115 |
else if ( aCommand==KCmdDestructor )
|
sl@0
|
116 |
{
|
sl@0
|
117 |
DoCmdDestructor();
|
sl@0
|
118 |
}
|
sl@0
|
119 |
else if(aCommand == KCmdReadSector)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
DoCmdReadSectorL(aSection, aAsyncErrorIndex);
|
sl@0
|
122 |
}
|
sl@0
|
123 |
else if(aCommand == KCmdWriteSector)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
DoCmdWriteSectorL(aSection, aAsyncErrorIndex);
|
sl@0
|
126 |
}
|
sl@0
|
127 |
else if(aCommand == KCmdReadCSD)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
DoCmdReadCSD();
|
sl@0
|
130 |
}
|
sl@0
|
131 |
else if(aCommand == KCmdReadExtCSD)
|
sl@0
|
132 |
{
|
sl@0
|
133 |
DoCmdReadExtCSD();
|
sl@0
|
134 |
}
|
sl@0
|
135 |
else if(aCommand == KCmdCardInfo)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
DoCmdCardInfo(aSection);
|
sl@0
|
138 |
}
|
sl@0
|
139 |
else if(aCommand == KCmdCardIsPresent)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
DoCmdCardIsPresent(aSection);
|
sl@0
|
142 |
}
|
sl@0
|
143 |
else if(aCommand == KCmdCardIsReady)
|
sl@0
|
144 |
{
|
sl@0
|
145 |
DoCmdCardIsReady(aSection);
|
sl@0
|
146 |
}
|
sl@0
|
147 |
else if(aCommand == KCmdCardIsLocked)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
DoCmdCardIsLocked(aSection);
|
sl@0
|
150 |
}
|
sl@0
|
151 |
else
|
sl@0
|
152 |
{
|
sl@0
|
153 |
ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
|
sl@0
|
154 |
}
|
sl@0
|
155 |
return ret;
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|
sl@0
|
158 |
/**
|
sl@0
|
159 |
* Creates the RBusLogicalChannel derived interface
|
sl@0
|
160 |
*
|
sl@0
|
161 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
162 |
*
|
sl@0
|
163 |
* @return void
|
sl@0
|
164 |
*
|
sl@0
|
165 |
* @leave System wide error
|
sl@0
|
166 |
*/
|
sl@0
|
167 |
void CT_MmcSDDriverData::DoCmdConstructorL(const TDesC& aSection)
|
sl@0
|
168 |
{
|
sl@0
|
169 |
TPtrC wrapperName;
|
sl@0
|
170 |
if( GetStringFromConfig(aSection, KSessionWrapperName(), wrapperName) )
|
sl@0
|
171 |
{
|
sl@0
|
172 |
iMmcSDController = static_cast<RMMCSDTestControllerInterface*>(GetDataObjectL(wrapperName));
|
sl@0
|
173 |
INFO_PRINTF2(_L("iMmcSDController = %x"), iMmcSDController);
|
sl@0
|
174 |
|
sl@0
|
175 |
if( iMmcSDController == NULL )
|
sl@0
|
176 |
{
|
sl@0
|
177 |
ERR_PRINTF1(_L("iMmcSDController is NULL-Constructor"));
|
sl@0
|
178 |
SetBlockResult(EFail);
|
sl@0
|
179 |
}
|
sl@0
|
180 |
}
|
sl@0
|
181 |
else
|
sl@0
|
182 |
{
|
sl@0
|
183 |
ERR_PRINTF1(_L("Error in Session Wrapper Name from INI file-Constructor"));
|
sl@0
|
184 |
SetBlockResult(EFail);
|
sl@0
|
185 |
}
|
sl@0
|
186 |
}
|
sl@0
|
187 |
|
sl@0
|
188 |
/**
|
sl@0
|
189 |
* Destructor
|
sl@0
|
190 |
*
|
sl@0
|
191 |
* @return void
|
sl@0
|
192 |
*/
|
sl@0
|
193 |
void CT_MmcSDDriverData::DoCmdDestructor()
|
sl@0
|
194 |
{
|
sl@0
|
195 |
INFO_PRINTF1(_L("CT_MmcSDDriverData::DoCmdDestructor()"));
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
/**
|
sl@0
|
199 |
* Creates an active callback wrapper and adds to the list
|
sl@0
|
200 |
*
|
sl@0
|
201 |
* @param aFunctionId The active callback function ID
|
sl@0
|
202 |
* @param aExpectedAsyncError The active callback expected asynchronous error
|
sl@0
|
203 |
*
|
sl@0
|
204 |
* @return The active callback wrapper created
|
sl@0
|
205 |
*/
|
sl@0
|
206 |
CActiveCallbackWrap* CT_MmcSDDriverData::CreateActiveCallbackL(TInt aFunctionId, TInt aExpectedAsyncError)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
CActiveCallbackWrap* activeCallbackWrap = CActiveCallbackWrap::NewL(*this, aFunctionId, aExpectedAsyncError);
|
sl@0
|
209 |
iActiveCallbacks.Append(activeCallbackWrap);
|
sl@0
|
210 |
return activeCallbackWrap;
|
sl@0
|
211 |
}
|
sl@0
|
212 |
|
sl@0
|
213 |
/**
|
sl@0
|
214 |
* Deletes an active callback from the list
|
sl@0
|
215 |
*
|
sl@0
|
216 |
* @param activeCallback The active callback to delete
|
sl@0
|
217 |
*
|
sl@0
|
218 |
* @return void
|
sl@0
|
219 |
*/
|
sl@0
|
220 |
void CT_MmcSDDriverData::DeleteActiveCallback(CActiveCallback* activeCallback)
|
sl@0
|
221 |
{
|
sl@0
|
222 |
if(activeCallback)
|
sl@0
|
223 |
{
|
sl@0
|
224 |
// loop through all wraps until we find the appropriate item
|
sl@0
|
225 |
|
sl@0
|
226 |
CActiveCallbackWrap* activeCallbackWrap = NULL;
|
sl@0
|
227 |
|
sl@0
|
228 |
for(int i=0;i<iActiveCallbacks.Count();i++)
|
sl@0
|
229 |
{
|
sl@0
|
230 |
if( &(iActiveCallbacks[i]->ActiveCallback()) == activeCallback)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
activeCallbackWrap = iActiveCallbacks[i];
|
sl@0
|
233 |
iActiveCallbacks.Remove(i);
|
sl@0
|
234 |
break;
|
sl@0
|
235 |
}
|
sl@0
|
236 |
}
|
sl@0
|
237 |
|
sl@0
|
238 |
delete activeCallbackWrap;
|
sl@0
|
239 |
}
|
sl@0
|
240 |
}
|
sl@0
|
241 |
|
sl@0
|
242 |
/**
|
sl@0
|
243 |
* Reads a sector from the card
|
sl@0
|
244 |
*
|
sl@0
|
245 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
246 |
* @param aAsyncErrorIndex The asynchronous error index
|
sl@0
|
247 |
*
|
sl@0
|
248 |
* @return void
|
sl@0
|
249 |
*
|
sl@0
|
250 |
* @leave System wide error
|
sl@0
|
251 |
*/
|
sl@0
|
252 |
void CT_MmcSDDriverData::DoCmdReadSectorL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
253 |
{
|
sl@0
|
254 |
|
sl@0
|
255 |
INFO_PRINTF1(_L("DoCmdReadSectorL called()"));
|
sl@0
|
256 |
|
sl@0
|
257 |
TInt sectorNumber;
|
sl@0
|
258 |
|
sl@0
|
259 |
if(!GetIntFromConfig(aSection, KSectorNumber(), sectorNumber))
|
sl@0
|
260 |
{
|
sl@0
|
261 |
ERR_PRINTF1(_L("DoCmdReadSectorL FAILED TO READ sectorNumber"));
|
sl@0
|
262 |
SetBlockResult(EFail);
|
sl@0
|
263 |
}
|
sl@0
|
264 |
else
|
sl@0
|
265 |
{
|
sl@0
|
266 |
INFO_PRINTF2(_L("DoCmdReadSectorL sectorNumber(%d)"), sectorNumber);
|
sl@0
|
267 |
HBufC8* readData = HBufC8::NewLC(KSectorSizeInBytes);
|
sl@0
|
268 |
CActiveCallbackWrap* activeCallbackWrap = CreateActiveCallbackL(RMMCSDTestControllerInterface::EReadSector, GetExpectedAsyncError(aSection));
|
sl@0
|
269 |
activeCallbackWrap->SetDesData(readData);
|
sl@0
|
270 |
|
sl@0
|
271 |
TPtrC expectedSectorText;
|
sl@0
|
272 |
if(GetStringFromConfig(aSection, KSectorText(), expectedSectorText))
|
sl@0
|
273 |
{
|
sl@0
|
274 |
TInt noOfRepeats = 1;
|
sl@0
|
275 |
GetIntFromConfig(aSection, KRepeats(), noOfRepeats);
|
sl@0
|
276 |
|
sl@0
|
277 |
HBufC8* expectedData = HBufC8::NewLC(KSectorSizeInBytes);
|
sl@0
|
278 |
activeCallbackWrap->SetExpectedDesData(expectedData);
|
sl@0
|
279 |
|
sl@0
|
280 |
activeCallbackWrap->ExpectedDataPtr().Zero();
|
sl@0
|
281 |
for(TInt i=0;i<noOfRepeats;i++)
|
sl@0
|
282 |
{
|
sl@0
|
283 |
activeCallbackWrap->ExpectedDataPtr().Append(expectedSectorText);
|
sl@0
|
284 |
}
|
sl@0
|
285 |
|
sl@0
|
286 |
TBuf16<KSectorSizeInBytes> printBuf;
|
sl@0
|
287 |
printBuf.Copy(activeCallbackWrap->ExpectedDataPtr());
|
sl@0
|
288 |
INFO_PRINTF3(_L("DoCmdReadSectorL expectedSectorText (length=%d):\n%S"), printBuf.Length(), &printBuf);
|
sl@0
|
289 |
|
sl@0
|
290 |
CleanupStack::Pop(expectedData);
|
sl@0
|
291 |
}
|
sl@0
|
292 |
|
sl@0
|
293 |
iMmcSDController->ReadSector(activeCallbackWrap->ActiveCallback().iStatus, sectorNumber, activeCallbackWrap->DataPtr());
|
sl@0
|
294 |
activeCallbackWrap->ActiveCallback().Activate(aAsyncErrorIndex);
|
sl@0
|
295 |
IncOutstanding();
|
sl@0
|
296 |
CleanupStack::Pop(readData);
|
sl@0
|
297 |
}
|
sl@0
|
298 |
}
|
sl@0
|
299 |
|
sl@0
|
300 |
/**
|
sl@0
|
301 |
* Writes a sector to the card
|
sl@0
|
302 |
*
|
sl@0
|
303 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
304 |
* @param aAsyncErrorIndex The asynchronous error index
|
sl@0
|
305 |
*
|
sl@0
|
306 |
* @return void
|
sl@0
|
307 |
*
|
sl@0
|
308 |
* @leave System wide error
|
sl@0
|
309 |
*/
|
sl@0
|
310 |
void CT_MmcSDDriverData::DoCmdWriteSectorL(const TDesC& aSection, TInt aAsyncErrorIndex)
|
sl@0
|
311 |
{
|
sl@0
|
312 |
INFO_PRINTF1(_L("DoCmdWriteSectorL called()"));
|
sl@0
|
313 |
TInt sectorNumber;
|
sl@0
|
314 |
TPtrC sectorText;
|
sl@0
|
315 |
|
sl@0
|
316 |
if(!GetIntFromConfig(aSection, KSectorNumber(), sectorNumber))
|
sl@0
|
317 |
{
|
sl@0
|
318 |
ERR_PRINTF1(_L("DoCmdWriteSectorL FAILED TO READ sectorNumber"));
|
sl@0
|
319 |
SetBlockResult(EFail);
|
sl@0
|
320 |
}
|
sl@0
|
321 |
else if(!GetStringFromConfig(aSection, KSectorText(), sectorText))
|
sl@0
|
322 |
{
|
sl@0
|
323 |
ERR_PRINTF1(_L("DoCmdWriteSectorL FAILED TO READ sectorText"));
|
sl@0
|
324 |
SetBlockResult(EFail);
|
sl@0
|
325 |
}
|
sl@0
|
326 |
else
|
sl@0
|
327 |
{
|
sl@0
|
328 |
TInt noOfRepeats = 1;
|
sl@0
|
329 |
GetIntFromConfig(aSection, KRepeats(), noOfRepeats);
|
sl@0
|
330 |
|
sl@0
|
331 |
HBufC8* writeData = HBufC8::NewLC(KSectorSizeInBytes);
|
sl@0
|
332 |
|
sl@0
|
333 |
CActiveCallbackWrap* activeCallbackWrap = CreateActiveCallbackL(RMMCSDTestControllerInterface::EWriteSector, GetExpectedAsyncError(aSection));
|
sl@0
|
334 |
activeCallbackWrap->SetDesData(writeData);
|
sl@0
|
335 |
|
sl@0
|
336 |
activeCallbackWrap->DataPtr().Zero();
|
sl@0
|
337 |
for(TInt i=0;i<noOfRepeats;i++)
|
sl@0
|
338 |
{
|
sl@0
|
339 |
activeCallbackWrap->DataPtr().Append(sectorText);
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
TBuf16<KSectorSizeInBytes> printBuf;
|
sl@0
|
343 |
printBuf.Copy(activeCallbackWrap->DataPtr());
|
sl@0
|
344 |
INFO_PRINTF4(_L("DoCmdWriteSectorL sectorNumber(%d) sectorText (length=%d):\n%S"), sectorNumber, printBuf.Length(), &printBuf);
|
sl@0
|
345 |
|
sl@0
|
346 |
iMmcSDController->WriteSector(activeCallbackWrap->ActiveCallback().iStatus, sectorNumber, activeCallbackWrap->DataPtr());
|
sl@0
|
347 |
activeCallbackWrap->ActiveCallback().Activate(aAsyncErrorIndex);
|
sl@0
|
348 |
IncOutstanding();
|
sl@0
|
349 |
CleanupStack::Pop(writeData);
|
sl@0
|
350 |
}
|
sl@0
|
351 |
}
|
sl@0
|
352 |
|
sl@0
|
353 |
/**
|
sl@0
|
354 |
* Prints a CSD
|
sl@0
|
355 |
*
|
sl@0
|
356 |
* @param aCSDInfo The CSD to print
|
sl@0
|
357 |
*
|
sl@0
|
358 |
* @return void
|
sl@0
|
359 |
*/
|
sl@0
|
360 |
void CT_MmcSDDriverData::PrintCSD(const TCSDInfo& aCSDInfo)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
INFO_PRINTF2(_L("CSDInfo->CSDStructure() = %u"), aCSDInfo.iCSDStructure);
|
sl@0
|
363 |
INFO_PRINTF2(_L("CSDInfo->SpecVers() = %u"), aCSDInfo.iSpecVers);
|
sl@0
|
364 |
INFO_PRINTF2(_L("CSDInfo->Reserved120() = %u"), aCSDInfo.iReserved120);
|
sl@0
|
365 |
INFO_PRINTF2(_L("CSDInfo->TAAC() = %u"), aCSDInfo.iTAAC);
|
sl@0
|
366 |
INFO_PRINTF2(_L("CSDInfo->NSAC() = %u"), aCSDInfo.iNSAC);
|
sl@0
|
367 |
INFO_PRINTF2(_L("CSDInfo->TranSpeed() = %u"), aCSDInfo.iTranSpeed);
|
sl@0
|
368 |
INFO_PRINTF2(_L("CSDInfo->CCC() = %u"), aCSDInfo.iCCC);
|
sl@0
|
369 |
INFO_PRINTF2(_L("CSDInfo->ReadBlLen() = %u"), aCSDInfo.iReadBlLen);
|
sl@0
|
370 |
INFO_PRINTF2(_L("CSDInfo->Reserved74() = %u"), aCSDInfo.iReserved74);
|
sl@0
|
371 |
INFO_PRINTF2(_L("CSDInfo->CSize() = %u"), aCSDInfo.iCSize);
|
sl@0
|
372 |
INFO_PRINTF2(_L("CSDInfo->VDDRCurrMin() = %u"), aCSDInfo.iVDDRCurrMin);
|
sl@0
|
373 |
INFO_PRINTF2(_L("CSDInfo->VDDRCurrMax() = %u"), aCSDInfo.iVDDRCurrMax);
|
sl@0
|
374 |
INFO_PRINTF2(_L("CSDInfo->VDDWCurrMin() = %u"), aCSDInfo.iVDDWCurrMin);
|
sl@0
|
375 |
INFO_PRINTF2(_L("CSDInfo->VDDWCurrMax() = %u"), aCSDInfo.iVDDWCurrMax);
|
sl@0
|
376 |
INFO_PRINTF2(_L("CSDInfo->CSizeMult() = %u"), aCSDInfo.iCSizeMult);
|
sl@0
|
377 |
INFO_PRINTF2(_L("CSDInfo->EraseGrpSize() = %u"), aCSDInfo.iEraseGrpSize);
|
sl@0
|
378 |
INFO_PRINTF2(_L("CSDInfo->EraseGrpMult() = %u"), aCSDInfo.iEraseGrpMult);
|
sl@0
|
379 |
INFO_PRINTF2(_L("CSDInfo->WPGrpSize() = %u"), aCSDInfo.iWPGrpSize);
|
sl@0
|
380 |
INFO_PRINTF2(_L("CSDInfo->DefaultECC() = %u"), aCSDInfo.iDefaultECC);
|
sl@0
|
381 |
INFO_PRINTF2(_L("CSDInfo->R2WFactor() = %u"), aCSDInfo.iR2WFactor);
|
sl@0
|
382 |
INFO_PRINTF2(_L("CSDInfo->WriteBlLen() = %u"), aCSDInfo.iWriteBlLen);
|
sl@0
|
383 |
INFO_PRINTF2(_L("CSDInfo->Reserved16() = %u"), aCSDInfo.iReserved16);
|
sl@0
|
384 |
INFO_PRINTF2(_L("CSDInfo->FileFormat() = %u"), aCSDInfo.iFileFormat);
|
sl@0
|
385 |
INFO_PRINTF2(_L("CSDInfo->ECC() = %u"), aCSDInfo.iECC);
|
sl@0
|
386 |
INFO_PRINTF2(_L("CSDInfo->CRC() = %u"), aCSDInfo.iCRC);
|
sl@0
|
387 |
INFO_PRINTF2(_L("CSDInfo->DeviceSize() = %u"), aCSDInfo.iDeviceSize);
|
sl@0
|
388 |
INFO_PRINTF2(_L("CSDInfo->ReadBlockLength() = %u"), aCSDInfo.iReadBlockLength);
|
sl@0
|
389 |
INFO_PRINTF2(_L("CSDInfo->WriteBlockLength() = %u"), aCSDInfo.iWriteBlockLength);
|
sl@0
|
390 |
INFO_PRINTF2(_L("CSDInfo->EraseSectorSize() = %u"), aCSDInfo.iEraseSectorSize);
|
sl@0
|
391 |
INFO_PRINTF2(_L("CSDInfo->EraseGroupSize() = %u"), aCSDInfo.iEraseGroupSize);
|
sl@0
|
392 |
INFO_PRINTF2(_L("CSDInfo->MinReadCurrentInMilliamps() = %u"), aCSDInfo.iMinReadCurrentInMilliamps);
|
sl@0
|
393 |
INFO_PRINTF2(_L("CSDInfo->MinWriteCurrentInMilliamps() = %u"), aCSDInfo.iMinWriteCurrentInMilliamps);
|
sl@0
|
394 |
INFO_PRINTF2(_L("CSDInfo->MaxReadCurrentInMilliamps() = %u"), aCSDInfo.iMaxReadCurrentInMilliamps);
|
sl@0
|
395 |
INFO_PRINTF2(_L("CSDInfo->MaxWriteCurrentInMilliamps() = %u"), aCSDInfo.iMaxWriteCurrentInMilliamps);
|
sl@0
|
396 |
INFO_PRINTF2(_L("CSDInfo->MaxTranSpeedInKilohertz() = %u"), aCSDInfo.iMaxTranSpeedInKilohertz);
|
sl@0
|
397 |
INFO_PRINTF2(_L("CSDInfo->ReadBlPartial() = %d"), aCSDInfo.iReadBlPartial);
|
sl@0
|
398 |
INFO_PRINTF2(_L("CSDInfo->WriteBlkMisalign() = %d"), aCSDInfo.iWriteBlkMisalign);
|
sl@0
|
399 |
INFO_PRINTF2(_L("CSDInfo->ReadBlkMisalign() = %d"), aCSDInfo.iReadBlkMisalign);
|
sl@0
|
400 |
INFO_PRINTF2(_L("CSDInfo->DSRImp() = %d"), aCSDInfo.iDSRImp);
|
sl@0
|
401 |
INFO_PRINTF2(_L("CSDInfo->WPGrpEnable() = %d"), aCSDInfo.iWPGrpEnable);
|
sl@0
|
402 |
INFO_PRINTF2(_L("CSDInfo->WriteBlPartial() = %d"), aCSDInfo.iWriteBlPartial);
|
sl@0
|
403 |
INFO_PRINTF2(_L("CSDInfo->FileFormatGrp() = %d"), aCSDInfo.iFileFormatGrp);
|
sl@0
|
404 |
INFO_PRINTF2(_L("CSDInfo->Copy() = %d"), aCSDInfo.iCopy);
|
sl@0
|
405 |
INFO_PRINTF2(_L("CSDInfo->PermWriteProtect() = %d"), aCSDInfo.iPermWriteProtect);
|
sl@0
|
406 |
INFO_PRINTF2(_L("CSDInfo->TmpWriteProtect() = %d"), aCSDInfo.iTmpWriteProtect);
|
sl@0
|
407 |
INFO_PRINTF2(_L("CSDInfo->MediaType() = %d"), aCSDInfo.iMediaType);
|
sl@0
|
408 |
}
|
sl@0
|
409 |
|
sl@0
|
410 |
/**
|
sl@0
|
411 |
* Prints an Extended CSD
|
sl@0
|
412 |
*
|
sl@0
|
413 |
* @param aExtendedCSDInfo The Extended CSD to print
|
sl@0
|
414 |
*
|
sl@0
|
415 |
* @return void
|
sl@0
|
416 |
*/
|
sl@0
|
417 |
void CT_MmcSDDriverData::PrintExtendedCSD(const TExtendedCSDInfo& aExtendedCSDInfo)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
INFO_PRINTF2(_L("ExtendedCSDInfo->SupportedCmdSet() = %u"), aExtendedCSDInfo.iSupportedCmdSet);
|
sl@0
|
420 |
INFO_PRINTF2(_L("ExtendedCSDInfo->SectorCount() = %u"), aExtendedCSDInfo.iSectorCount);
|
sl@0
|
421 |
INFO_PRINTF2(_L("ExtendedCSDInfo->MinPerfWrite8Bit52Mhz() = %u"), aExtendedCSDInfo.iMinPerfWrite8Bit52Mhz);
|
sl@0
|
422 |
INFO_PRINTF2(_L("ExtendedCSDInfo->MinPerfRead8Bit52Mhz() = %u"), aExtendedCSDInfo.iMinPerfRead8Bit52Mhz);
|
sl@0
|
423 |
INFO_PRINTF2(_L("ExtendedCSDInfo->MinPerfWrite8Bit26Mhz_4Bit52Mhz() = %u"), aExtendedCSDInfo.iMinPerfWrite8Bit26Mhz_4Bit52Mhz);
|
sl@0
|
424 |
INFO_PRINTF2(_L("ExtendedCSDInfo->MinPerfRead8Bit26Mhz_4Bit52Mhz() = %u"), aExtendedCSDInfo.iMinPerfRead8Bit26Mhz_4Bit52Mhz);
|
sl@0
|
425 |
INFO_PRINTF2(_L("ExtendedCSDInfo->MinPerfWrite4Bit26Mhz() = %u"), aExtendedCSDInfo.iMinPerfWrite4Bit26Mhz);
|
sl@0
|
426 |
INFO_PRINTF2(_L("ExtendedCSDInfo->MinPerfRead4Bit26Mhz() = %u"), aExtendedCSDInfo.iMinPerfRead4Bit26Mhz);
|
sl@0
|
427 |
INFO_PRINTF2(_L("ExtendedCSDInfo->PowerClass26Mhz360V() = %u"), aExtendedCSDInfo.iPowerClass26Mhz360V);
|
sl@0
|
428 |
INFO_PRINTF2(_L("ExtendedCSDInfo->PowerClass52Mhz360V() = %u"), aExtendedCSDInfo.iPowerClass52Mhz360V);
|
sl@0
|
429 |
INFO_PRINTF2(_L("ExtendedCSDInfo->PowerClass26Mhz195V() = %u"), aExtendedCSDInfo.iPowerClass26Mhz195V);
|
sl@0
|
430 |
INFO_PRINTF2(_L("ExtendedCSDInfo->PowerClass52Mhz195V() = %u"), aExtendedCSDInfo.iPowerClass52Mhz195V);
|
sl@0
|
431 |
INFO_PRINTF2(_L("ExtendedCSDInfo->CardType() = %u"), aExtendedCSDInfo.iCardType);
|
sl@0
|
432 |
INFO_PRINTF2(_L("ExtendedCSDInfo->CSDStructureVer() = %u"), aExtendedCSDInfo.iCSDStructureVer);
|
sl@0
|
433 |
INFO_PRINTF2(_L("ExtendedCSDInfo->ExtendedCSDRev() = %u"), aExtendedCSDInfo.iExtendedCSDRev);
|
sl@0
|
434 |
INFO_PRINTF2(_L("ExtendedCSDInfo->CmdSet() = %u"), aExtendedCSDInfo.iCmdSet);
|
sl@0
|
435 |
INFO_PRINTF2(_L("ExtendedCSDInfo->CmdSetRev() = %u"), aExtendedCSDInfo.iCmdSetRev);
|
sl@0
|
436 |
INFO_PRINTF2(_L("ExtendedCSDInfo->PowerClass() = %u"), aExtendedCSDInfo.iPowerClass);
|
sl@0
|
437 |
INFO_PRINTF2(_L("ExtendedCSDInfo->HighSpeedTiming() = %u"), aExtendedCSDInfo.iHighSpeedTiming);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
/**
|
sl@0
|
441 |
* Reads the CSD
|
sl@0
|
442 |
* This function is not contained within a TMMCard wrapper as this is not a class under test
|
sl@0
|
443 |
*
|
sl@0
|
444 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
445 |
*
|
sl@0
|
446 |
* @return void
|
sl@0
|
447 |
*/
|
sl@0
|
448 |
void CT_MmcSDDriverData::DoCmdReadCSD()
|
sl@0
|
449 |
{
|
sl@0
|
450 |
INFO_PRINTF1(_L("DoCmdReadCSD called()"));
|
sl@0
|
451 |
TCSDInfo csdInfo;
|
sl@0
|
452 |
TInt err = iMmcSDController->ReadCSD(csdInfo);
|
sl@0
|
453 |
PrintCSD(csdInfo);
|
sl@0
|
454 |
|
sl@0
|
455 |
if( err != KErrNone )
|
sl@0
|
456 |
{
|
sl@0
|
457 |
ERR_PRINTF2(_L("DoCmdReadCSD() ReadCSD() Error %d"), err);
|
sl@0
|
458 |
SetError(err);
|
sl@0
|
459 |
}
|
sl@0
|
460 |
}
|
sl@0
|
461 |
|
sl@0
|
462 |
/**
|
sl@0
|
463 |
* Reads the Extended CSD
|
sl@0
|
464 |
* This function is not contained within a TMMCard wrapper as this is not a class under test
|
sl@0
|
465 |
*
|
sl@0
|
466 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
467 |
*
|
sl@0
|
468 |
* @return void
|
sl@0
|
469 |
*/
|
sl@0
|
470 |
void CT_MmcSDDriverData::DoCmdReadExtCSD()
|
sl@0
|
471 |
{
|
sl@0
|
472 |
INFO_PRINTF1(_L("DoCmdReadExtCSD called()"));
|
sl@0
|
473 |
TExtendedCSDInfo extendedCSDInfo;
|
sl@0
|
474 |
TInt err = iMmcSDController->ReadExtCSD(extendedCSDInfo);
|
sl@0
|
475 |
if( err != KErrNone )
|
sl@0
|
476 |
{
|
sl@0
|
477 |
ERR_PRINTF2(_L("DoCmdReadExtCSD() Error %d"), err);
|
sl@0
|
478 |
SetError(err);
|
sl@0
|
479 |
}
|
sl@0
|
480 |
else
|
sl@0
|
481 |
{
|
sl@0
|
482 |
PrintExtendedCSD(extendedCSDInfo);
|
sl@0
|
483 |
}
|
sl@0
|
484 |
}
|
sl@0
|
485 |
|
sl@0
|
486 |
/**
|
sl@0
|
487 |
* Process command that will obtain card info from kernel side
|
sl@0
|
488 |
* This function is not contained within a TMMCard wrapper as this is not a class under test
|
sl@0
|
489 |
*
|
sl@0
|
490 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
491 |
*
|
sl@0
|
492 |
* @return void
|
sl@0
|
493 |
*/
|
sl@0
|
494 |
void CT_MmcSDDriverData::DoCmdCardInfo(const TDesC& aSection)
|
sl@0
|
495 |
{
|
sl@0
|
496 |
TMMCCardInfo ci;
|
sl@0
|
497 |
INFO_PRINTF1(_L("DoCmdCardInfo()"));
|
sl@0
|
498 |
TInt err = iMmcSDController->CardInfo(ci);
|
sl@0
|
499 |
if (err != KErrNone)
|
sl@0
|
500 |
{
|
sl@0
|
501 |
ERR_PRINTF2(_L("DoCmdCardInfo Error %d"), err);
|
sl@0
|
502 |
SetError(err);
|
sl@0
|
503 |
}
|
sl@0
|
504 |
else
|
sl@0
|
505 |
{
|
sl@0
|
506 |
INFO_PRINTF5(_L("iIsReady(%d) iIsLocked(%d) iRCA(%d) iMediaType(%d)"),
|
sl@0
|
507 |
ci.iIsReady, ci.iIsLocked, ci.iRCA, ci.iMediaType );
|
sl@0
|
508 |
|
sl@0
|
509 |
INFO_PRINTF6(_L("iCardSizeInBytes low(%x) high(%x) iMaxReadBlLen(%d) iReadBlLen(%d) iReadBlPartial(%d)"),
|
sl@0
|
510 |
I64LOW(ci.iCardSizeInBytes), I64HIGH(ci.iCardSizeInBytes), ci.iMaxReadBlLen, ci.iReadBlLen, ci.iReadBlPartial );
|
sl@0
|
511 |
|
sl@0
|
512 |
INFO_PRINTF6(_L("iWriteBlPartial(%d) iReadBlkMisalign(%d) iWriteBlkMisalign(%d) iReadCurrentInMilliAmps(%d) iWriteCurrentInMilliAmps(%d)"),
|
sl@0
|
513 |
ci.iWriteBlPartial, ci.iReadBlkMisalign, ci.iWriteBlkMisalign, ci.iReadCurrentInMilliAmps, ci.iWriteCurrentInMilliAmps );
|
sl@0
|
514 |
|
sl@0
|
515 |
INFO_PRINTF6(_L("iSpecVers(%d) iTAAC(%d) iNSAC(%d) iTransferSpeed(%d) iCommandRegister(%d)"),
|
sl@0
|
516 |
ci.iSpecVers, ci.iTAAC, ci.iNSAC, ci.iTransferSpeed, ci.iCommandRegister );
|
sl@0
|
517 |
|
sl@0
|
518 |
INFO_PRINTF3(_L("iHighCapacity(%d) iFlags(%d) "), ci.iHighCapacity, ci.iFlags);
|
sl@0
|
519 |
|
sl@0
|
520 |
// check against expected values
|
sl@0
|
521 |
|
sl@0
|
522 |
TInt maxreadBlockLen;
|
sl@0
|
523 |
if(GetIntFromConfig(aSection, KMaxReadBlockLen(), maxreadBlockLen))
|
sl@0
|
524 |
{
|
sl@0
|
525 |
if(maxreadBlockLen != ci.iMaxReadBlLen)
|
sl@0
|
526 |
{
|
sl@0
|
527 |
ERR_PRINTF3(_L("max block lengths do not match actual(%d), expected(%d)"), ci.iMaxReadBlLen, maxreadBlockLen);
|
sl@0
|
528 |
SetBlockResult(EFail);
|
sl@0
|
529 |
}
|
sl@0
|
530 |
}
|
sl@0
|
531 |
|
sl@0
|
532 |
TInt readCurrentInMilliAmps;
|
sl@0
|
533 |
if(GetIntFromConfig(aSection, KReadCurrentInMilliAmps(), readCurrentInMilliAmps))
|
sl@0
|
534 |
{
|
sl@0
|
535 |
if(readCurrentInMilliAmps!= ci.iReadCurrentInMilliAmps)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
ERR_PRINTF3(_L("ReadCurrentInMilliAmps do not match actual(%d), expected(%d)"),ci.iReadCurrentInMilliAmps, readCurrentInMilliAmps);
|
sl@0
|
538 |
SetBlockResult(EFail);
|
sl@0
|
539 |
}
|
sl@0
|
540 |
}
|
sl@0
|
541 |
|
sl@0
|
542 |
TUint transferSpeed;
|
sl@0
|
543 |
if(GetUintFromConfig(aSection, KTransferSpeed(), transferSpeed))
|
sl@0
|
544 |
{
|
sl@0
|
545 |
if(transferSpeed != ci.iTransferSpeed)
|
sl@0
|
546 |
{
|
sl@0
|
547 |
ERR_PRINTF3(_L("transferSpeed do not match actual(%d), expected(%d)"), ci.iTransferSpeed, transferSpeed);
|
sl@0
|
548 |
SetBlockResult(EFail);
|
sl@0
|
549 |
}
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
TBool highCapacity;
|
sl@0
|
553 |
if(GetBoolFromConfig(aSection, KHighCapacity(), highCapacity))
|
sl@0
|
554 |
{
|
sl@0
|
555 |
if(highCapacity != ci.iHighCapacity)
|
sl@0
|
556 |
{
|
sl@0
|
557 |
ERR_PRINTF3(_L("highCapacity do not match actual(%d), expected(%d)"), ci.iHighCapacity, highCapacity);
|
sl@0
|
558 |
SetBlockResult(EFail);
|
sl@0
|
559 |
}
|
sl@0
|
560 |
}
|
sl@0
|
561 |
}
|
sl@0
|
562 |
}
|
sl@0
|
563 |
|
sl@0
|
564 |
/**
|
sl@0
|
565 |
* Process command that will obtain card is present status from kernel side
|
sl@0
|
566 |
* This function is not contained within a TMMCard wrapper as this is not a class under test
|
sl@0
|
567 |
*
|
sl@0
|
568 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
569 |
*
|
sl@0
|
570 |
* @return void
|
sl@0
|
571 |
*/
|
sl@0
|
572 |
void CT_MmcSDDriverData::DoCmdCardIsPresent(const TDesC& aSection)
|
sl@0
|
573 |
{
|
sl@0
|
574 |
TBool isPresent;
|
sl@0
|
575 |
INFO_PRINTF1(_L("DoCmdCardIsPresent()"));
|
sl@0
|
576 |
TInt err = iMmcSDController->CardIsPresent(isPresent);
|
sl@0
|
577 |
if (err != KErrNone)
|
sl@0
|
578 |
{
|
sl@0
|
579 |
ERR_PRINTF2(_L("DoCmdCardIsPresent Error %d"), err);
|
sl@0
|
580 |
SetError(err);
|
sl@0
|
581 |
}
|
sl@0
|
582 |
else
|
sl@0
|
583 |
{
|
sl@0
|
584 |
INFO_PRINTF2(_L("DoCmdCardIsPresent(): isPresent = %d"), isPresent);
|
sl@0
|
585 |
|
sl@0
|
586 |
// check against expected value
|
sl@0
|
587 |
TBool expectedIsPresent;
|
sl@0
|
588 |
if(GetBoolFromConfig(aSection, KExpectedIsPresent(), expectedIsPresent))
|
sl@0
|
589 |
{
|
sl@0
|
590 |
if(expectedIsPresent != isPresent)
|
sl@0
|
591 |
{
|
sl@0
|
592 |
ERR_PRINTF3(_L("isPresent does not match actual(%d), expected(%d)"), isPresent, expectedIsPresent);
|
sl@0
|
593 |
SetBlockResult(EFail);
|
sl@0
|
594 |
}
|
sl@0
|
595 |
}
|
sl@0
|
596 |
else
|
sl@0
|
597 |
{
|
sl@0
|
598 |
ERR_PRINTF1(_L("DoCmdCardIsPresent(): No expected value given in INI file"));
|
sl@0
|
599 |
SetBlockResult(EFail);
|
sl@0
|
600 |
}
|
sl@0
|
601 |
}
|
sl@0
|
602 |
}
|
sl@0
|
603 |
|
sl@0
|
604 |
/**
|
sl@0
|
605 |
* Process command that will obtain card is ready status from kernel side
|
sl@0
|
606 |
* This function is not contained within a TMMCard wrapper as this is not a class under test
|
sl@0
|
607 |
*
|
sl@0
|
608 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
609 |
*
|
sl@0
|
610 |
* @return void
|
sl@0
|
611 |
*/
|
sl@0
|
612 |
void CT_MmcSDDriverData::DoCmdCardIsReady(const TDesC& aSection)
|
sl@0
|
613 |
{
|
sl@0
|
614 |
TBool isReady;
|
sl@0
|
615 |
INFO_PRINTF1(_L("DoCmdCardIsReady()"));
|
sl@0
|
616 |
TInt err = iMmcSDController->CardIsReady(isReady);
|
sl@0
|
617 |
if (err != KErrNone)
|
sl@0
|
618 |
{
|
sl@0
|
619 |
ERR_PRINTF2(_L("DoCmdCardIsReady Error %d"), err);
|
sl@0
|
620 |
SetError(err);
|
sl@0
|
621 |
}
|
sl@0
|
622 |
else
|
sl@0
|
623 |
{
|
sl@0
|
624 |
INFO_PRINTF2(_L("DoCmdCardIsReady(): isReady = %d"), isReady);
|
sl@0
|
625 |
|
sl@0
|
626 |
// check against expected value
|
sl@0
|
627 |
TBool expectedIsReady;
|
sl@0
|
628 |
if(GetBoolFromConfig(aSection, KExpectedIsReady(), expectedIsReady))
|
sl@0
|
629 |
{
|
sl@0
|
630 |
if(expectedIsReady != isReady)
|
sl@0
|
631 |
{
|
sl@0
|
632 |
ERR_PRINTF3(_L("isReady does not match actual(%d), expected(%d)"), isReady, expectedIsReady);
|
sl@0
|
633 |
SetBlockResult(EFail);
|
sl@0
|
634 |
}
|
sl@0
|
635 |
}
|
sl@0
|
636 |
else
|
sl@0
|
637 |
{
|
sl@0
|
638 |
ERR_PRINTF1(_L("DoCmdCardIsReady(): No expected value given in INI file"));
|
sl@0
|
639 |
SetBlockResult(EFail);
|
sl@0
|
640 |
}
|
sl@0
|
641 |
}
|
sl@0
|
642 |
}
|
sl@0
|
643 |
|
sl@0
|
644 |
/**
|
sl@0
|
645 |
* Process command that will obtain card is locked status from kernel side
|
sl@0
|
646 |
* This function is not contained within a TMMCard wrapper as this is not a class under test
|
sl@0
|
647 |
*
|
sl@0
|
648 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
649 |
*
|
sl@0
|
650 |
* @return void
|
sl@0
|
651 |
*/
|
sl@0
|
652 |
void CT_MmcSDDriverData::DoCmdCardIsLocked(const TDesC& aSection)
|
sl@0
|
653 |
{
|
sl@0
|
654 |
TBool isLocked;
|
sl@0
|
655 |
INFO_PRINTF1(_L("DoCmdCardIsLocked()"));
|
sl@0
|
656 |
TInt err = iMmcSDController->CardIsLocked(isLocked);
|
sl@0
|
657 |
if (err != KErrNone)
|
sl@0
|
658 |
{
|
sl@0
|
659 |
ERR_PRINTF2(_L("DoCmdCardIsLocked Error %d"), err);
|
sl@0
|
660 |
SetError(err);
|
sl@0
|
661 |
}
|
sl@0
|
662 |
else
|
sl@0
|
663 |
{
|
sl@0
|
664 |
INFO_PRINTF2(_L("DoCmdCardIsLocked(): isLocked = %d"), isLocked);
|
sl@0
|
665 |
|
sl@0
|
666 |
// check against expected value
|
sl@0
|
667 |
TBool expectedIsLocked;
|
sl@0
|
668 |
if(GetBoolFromConfig(aSection, KExpectedIsLocked(), expectedIsLocked))
|
sl@0
|
669 |
{
|
sl@0
|
670 |
if(expectedIsLocked != isLocked)
|
sl@0
|
671 |
{
|
sl@0
|
672 |
ERR_PRINTF3(_L("isLocked does not match actual(%d), expected(%d)"), isLocked, expectedIsLocked);
|
sl@0
|
673 |
SetBlockResult(EFail);
|
sl@0
|
674 |
}
|
sl@0
|
675 |
}
|
sl@0
|
676 |
else
|
sl@0
|
677 |
{
|
sl@0
|
678 |
ERR_PRINTF1(_L("DoCmdCardIsLocked(): No expected value given in INI file"));
|
sl@0
|
679 |
SetBlockResult(EFail);
|
sl@0
|
680 |
}
|
sl@0
|
681 |
}
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
/**
|
sl@0
|
685 |
* Called on completion of an asynchronous command
|
sl@0
|
686 |
*
|
sl@0
|
687 |
* @param aActive Active Object that RunL has been called on
|
sl@0
|
688 |
* @param aIndex Index of the active object
|
sl@0
|
689 |
*
|
sl@0
|
690 |
* @return void
|
sl@0
|
691 |
*/
|
sl@0
|
692 |
void CT_MmcSDDriverData::RunL(CActive* aActive, TInt aIndex)
|
sl@0
|
693 |
{
|
sl@0
|
694 |
TInt err = aActive->iStatus.Int();
|
sl@0
|
695 |
INFO_PRINTF2(_L("CT_MmcSDDriverData::RunL() called. err (%d)"), err);
|
sl@0
|
696 |
|
sl@0
|
697 |
// retrieve the active callback wrap that wraps this item
|
sl@0
|
698 |
CActiveCallbackWrap* activeCallbackWrap=NULL;
|
sl@0
|
699 |
|
sl@0
|
700 |
for(int i=0;i<iActiveCallbacks.Count();i++)
|
sl@0
|
701 |
{
|
sl@0
|
702 |
if( &(iActiveCallbacks[i]->ActiveCallback()) == aActive)
|
sl@0
|
703 |
{
|
sl@0
|
704 |
activeCallbackWrap = iActiveCallbacks[i];
|
sl@0
|
705 |
break;
|
sl@0
|
706 |
}
|
sl@0
|
707 |
}
|
sl@0
|
708 |
|
sl@0
|
709 |
if(activeCallbackWrap)
|
sl@0
|
710 |
{
|
sl@0
|
711 |
switch(activeCallbackWrap->FunctionId())
|
sl@0
|
712 |
{
|
sl@0
|
713 |
case RMMCSDTestControllerInterface::EReadSector:
|
sl@0
|
714 |
{
|
sl@0
|
715 |
INFO_PRINTF1(_L("CT_MmcSDDriverData::RunL() Post processing CActiveCallbackWrap RMMCSDTestControllerInterface::EReadSector:"));
|
sl@0
|
716 |
if (err == KErrNone)
|
sl@0
|
717 |
{
|
sl@0
|
718 |
HBufC8* readData = (HBufC8*) activeCallbackWrap->Data();
|
sl@0
|
719 |
// dump the read buffer here
|
sl@0
|
720 |
TBuf16<KSectorSizeInBytes> printBuf;
|
sl@0
|
721 |
printBuf.Copy(activeCallbackWrap->DataPtr());
|
sl@0
|
722 |
INFO_PRINTF3(_L("ReadSector data (length=%d):\n%S"), printBuf.Length(), &printBuf);
|
sl@0
|
723 |
|
sl@0
|
724 |
HBufC8* expectedData = (HBufC8*) activeCallbackWrap->ExpectedData();
|
sl@0
|
725 |
if (expectedData)
|
sl@0
|
726 |
{
|
sl@0
|
727 |
if (*readData != *expectedData)
|
sl@0
|
728 |
{
|
sl@0
|
729 |
TPtr8 expectedDataPtr(expectedData->Des());
|
sl@0
|
730 |
TBuf16<KSectorSizeInBytes> printExpectedBuf;
|
sl@0
|
731 |
printExpectedBuf.Copy(expectedDataPtr);
|
sl@0
|
732 |
ERR_PRINTF3(_L("ReadSector data not as expected (length=%d):\n%S"), printExpectedBuf.Length(), &printExpectedBuf);
|
sl@0
|
733 |
SetBlockResult(EFail);
|
sl@0
|
734 |
}
|
sl@0
|
735 |
}
|
sl@0
|
736 |
}
|
sl@0
|
737 |
}
|
sl@0
|
738 |
break;
|
sl@0
|
739 |
|
sl@0
|
740 |
case RMMCSDTestControllerInterface::EWriteSector:
|
sl@0
|
741 |
INFO_PRINTF1(_L("CT_MmcSDDriverData::RunL() Post processing CActiveCallbackWrap RMMCSDTestControllerInterface::EWriteSector:"));
|
sl@0
|
742 |
break;
|
sl@0
|
743 |
|
sl@0
|
744 |
case RMMCSDTestControllerInterface::ESocketPowerUp:
|
sl@0
|
745 |
INFO_PRINTF1(_L("CT_MmcSDDriverData::RunL() Post processing CActiveCallbackWrap RMMCSDTestControllerInterface::ESocketPowerUp:"));
|
sl@0
|
746 |
break;
|
sl@0
|
747 |
|
sl@0
|
748 |
default:
|
sl@0
|
749 |
break;
|
sl@0
|
750 |
}
|
sl@0
|
751 |
|
sl@0
|
752 |
if (err != activeCallbackWrap->ExpectedAsyncError())
|
sl@0
|
753 |
{
|
sl@0
|
754 |
ERR_PRINTF3(_L("Error (%d) != Expected error (%d)"), err, activeCallbackWrap->ExpectedAsyncError());
|
sl@0
|
755 |
SetAsyncError(aIndex, err);
|
sl@0
|
756 |
}
|
sl@0
|
757 |
|
sl@0
|
758 |
DecOutstanding();
|
sl@0
|
759 |
DeleteActiveCallback((CActiveCallback*)aActive);
|
sl@0
|
760 |
}
|
sl@0
|
761 |
else
|
sl@0
|
762 |
{
|
sl@0
|
763 |
ERR_PRINTF1(_L("An unchecked active object completed"));
|
sl@0
|
764 |
SetBlockResult(EFail);
|
sl@0
|
765 |
}
|
sl@0
|
766 |
}
|
sl@0
|
767 |
|
sl@0
|
768 |
/**
|
sl@0
|
769 |
* Request to cancel the asynchronous command
|
sl@0
|
770 |
*
|
sl@0
|
771 |
* @param aActive Active Object that DoCancel has been called on
|
sl@0
|
772 |
*
|
sl@0
|
773 |
* @return void
|
sl@0
|
774 |
*/
|
sl@0
|
775 |
void CT_MmcSDDriverData::DoCancel(CActive* aActive)
|
sl@0
|
776 |
{
|
sl@0
|
777 |
TInt err = aActive->iStatus.Int();
|
sl@0
|
778 |
INFO_PRINTF2(_L("CT_MmcSDDriverData::DoCancelL() called. err (%d)"), err);
|
sl@0
|
779 |
|
sl@0
|
780 |
// retrieve the active callback wrap that wraps this item
|
sl@0
|
781 |
CActiveCallbackWrap* activeCallbackWrap=NULL;
|
sl@0
|
782 |
|
sl@0
|
783 |
for(int i=0;i<iActiveCallbacks.Count();i++)
|
sl@0
|
784 |
{
|
sl@0
|
785 |
if( &(iActiveCallbacks[i]->ActiveCallback()) == aActive)
|
sl@0
|
786 |
{
|
sl@0
|
787 |
activeCallbackWrap = iActiveCallbacks[i];
|
sl@0
|
788 |
break;
|
sl@0
|
789 |
}
|
sl@0
|
790 |
}
|
sl@0
|
791 |
|
sl@0
|
792 |
if(activeCallbackWrap)
|
sl@0
|
793 |
{
|
sl@0
|
794 |
switch(activeCallbackWrap->FunctionId())
|
sl@0
|
795 |
{
|
sl@0
|
796 |
case RMMCSDTestControllerInterface::EReadSector:
|
sl@0
|
797 |
INFO_PRINTF1(_L("CT_MmcSDDriverData::DoCancelL() Post processing CActiveCallbackWrap RMMCSDTestControllerInterface::EReadSector:"));
|
sl@0
|
798 |
break;
|
sl@0
|
799 |
|
sl@0
|
800 |
case RMMCSDTestControllerInterface::EWriteSector:
|
sl@0
|
801 |
INFO_PRINTF1(_L("CT_MmcSDDriverData::DoCancelL() Post processing CActiveCallbackWrap RMMCSDTestControllerInterface::EWriteSector:"));
|
sl@0
|
802 |
break;
|
sl@0
|
803 |
|
sl@0
|
804 |
case RMMCSDTestControllerInterface::ESocketPowerUp:
|
sl@0
|
805 |
INFO_PRINTF1(_L("CT_MmcSDDriverData::DoCancelL() Post processing CActiveCallbackWrap RMMCSDTestControllerInterface::ESocketPowerUp:"));
|
sl@0
|
806 |
break;
|
sl@0
|
807 |
|
sl@0
|
808 |
default:
|
sl@0
|
809 |
break;
|
sl@0
|
810 |
}
|
sl@0
|
811 |
|
sl@0
|
812 |
if (err != activeCallbackWrap->ExpectedAsyncError())
|
sl@0
|
813 |
{
|
sl@0
|
814 |
ERR_PRINTF3(_L("Error (%d) != Expected error (%d)"), err, activeCallbackWrap->ExpectedAsyncError());
|
sl@0
|
815 |
SetBlockResult(EFail);
|
sl@0
|
816 |
}
|
sl@0
|
817 |
|
sl@0
|
818 |
DecOutstanding();
|
sl@0
|
819 |
DeleteActiveCallback((CActiveCallback*)aActive);
|
sl@0
|
820 |
}
|
sl@0
|
821 |
else
|
sl@0
|
822 |
{
|
sl@0
|
823 |
ERR_PRINTF1(_L("An unchecked active object completed"));
|
sl@0
|
824 |
SetBlockResult(EFail);
|
sl@0
|
825 |
}
|
sl@0
|
826 |
}
|
sl@0
|
827 |
|
sl@0
|
828 |
/**
|
sl@0
|
829 |
* Gets the expected async error code
|
sl@0
|
830 |
*
|
sl@0
|
831 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
832 |
*
|
sl@0
|
833 |
* @return The expected async error code
|
sl@0
|
834 |
*/
|
sl@0
|
835 |
TInt CT_MmcSDDriverData::GetExpectedAsyncError(const TDesC& aSection)
|
sl@0
|
836 |
{
|
sl@0
|
837 |
TInt expectedAsyncError = KErrNone;
|
sl@0
|
838 |
GetIntFromConfig(aSection, KExpectedAsyncError(), expectedAsyncError);
|
sl@0
|
839 |
return expectedAsyncError;
|
sl@0
|
840 |
}
|
sl@0
|
841 |
|