|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "T_MmcSDSocketDriverData.h" |
|
19 #include "MmcTestUtils.h" |
|
20 |
|
21 |
|
22 //MMCSD Commands index |
|
23 /*@{*/ |
|
24 |
|
25 _LIT(KCmdAdjustPartialRead, "AdjustPartialRead"); |
|
26 _LIT(KCmdCardIsPresent, "CardIsPresent"); |
|
27 _LIT(KCmdGetBufferInfo, "GetBufferInfo"); |
|
28 _LIT(KCmdInit, "Init"); |
|
29 _LIT(KCmdInitiatePowerUpSequence, "InitiatePowerUpSequence"); |
|
30 _LIT(KCmdMachineInfo, "MachineInfo"); |
|
31 _LIT(KCmdPrepareStore, "PrepareStore"); |
|
32 _LIT(KCmdReset1, "Reset1"); |
|
33 _LIT(KCmdReset2, "Reset2"); |
|
34 _LIT(KCmdResetInactivity, "ResetInactivity"); |
|
35 _LIT(KCmdStack, "Stack"); |
|
36 _LIT(KCmdiState_Get, "iState_Get"); |
|
37 _LIT(KCmdiType_Get, "iType_Get"); |
|
38 _LIT(KCmdiDoorOpened_Get, "iDoorOpened_Get"); |
|
39 _LIT(KCmdiStandby_Get, "iStandby_Get"); |
|
40 _LIT(KCmdPowerUp, "PowerUp"); |
|
41 |
|
42 // ini file tags |
|
43 _LIT(KCardPresent, "cardpresent"); |
|
44 _LIT(KExpectedBufLen, "expectedbuflen"); |
|
45 _LIT(KOldPassword, "oldpassword"); |
|
46 _LIT(KNewPassword, "newpassword"); |
|
47 _LIT(KPrepStoreFunc, "prepstorefn"); |
|
48 _LIT(KBusNumber, "busnum"); |
|
49 _LIT(KPrdStart, "prdstart"); |
|
50 _LIT(KPrdEnd, "prdend"); |
|
51 _LIT(KPrdExpectedStart, "expectedprdstart"); |
|
52 _LIT(KPrdExpectedEnd, "expectedprdend"); |
|
53 _LIT(KExpectedTotalSockets, "expectedtotalsockets"); |
|
54 _LIT(KExpectedTotalMediaChanges, "expectedtotalmediachanges"); |
|
55 _LIT(KExpectedTotalPrimarySupplies, "expectedtotalprimarysupplies"); |
|
56 _LIT(KExpectedSPIMode, "expectedspimode"); |
|
57 _LIT(KExpectedBaseBusNumber, "expectedbasebusnumber"); |
|
58 _LIT(KHasFlagSupportsSPIMode, "hasflagsupportsspimode"); |
|
59 _LIT(KHasFlagSupportsDoubleBuffering, "hasflagsupportsdoublebuffering"); |
|
60 _LIT(KHasFlagSupportsR7, "hasflagsupportsr7"); |
|
61 _LIT(KHasFlagDma8BitAddressing, "hasflagdma8bitaddressing"); |
|
62 _LIT(KHasFlagDma16BitAddressing, "hasflagdma16bitaddressing"); |
|
63 _LIT(KHasFlagDma32BitAddressing, "hasflagdma32bitaddressing"); |
|
64 _LIT(KHasFlagDma64BitAddressing, "hasflagdma64bitaddressing"); |
|
65 _LIT(KHasFlagSupportsDMA, "hasflagsupportsdma"); |
|
66 _LIT(KHasFlagMaxTransferLength_256K, "hasflagmaxtransferlength256k"); |
|
67 _LIT(KHasFlagMaxTransferLength_512K, "hasflagmaxtransferlength512k"); |
|
68 _LIT(KHasFlagMaxTransferLength_1M, "hasflagmaxtransferlength1m"); |
|
69 _LIT(KHasFlagMaxTransferLength_2M, "hasflagmaxtransferlength2m"); |
|
70 _LIT(KHasFlagMaxTransferLength_4M, "hasflagmaxtransferlength4m"); |
|
71 _LIT(KHasFlagMaxTransferLength_8M, "hasflagmaxtransferlength8m"); |
|
72 _LIT(KHasFlagMaxTransferLength_16M, "hasflagmaxtransferlength16m"); |
|
73 _LIT(KIsNull, "isnull"); |
|
74 _LIT(KState, "state"); |
|
75 _LIT(KType, "type"); |
|
76 _LIT(KDoorOpened, "dooropened"); |
|
77 _LIT(KStandby, "standby"); |
|
78 |
|
79 // DLocalDrive::TRequestId enum strings |
|
80 _LIT(KCaps, "ECaps"); |
|
81 _LIT(KRead, "ERead"); |
|
82 _LIT(KWrite, "EWrite"); |
|
83 _LIT(KFormat, "EFormat"); |
|
84 _LIT(KEnlarge, "EEnlarge"); |
|
85 _LIT(KReduce, "EReduce"); |
|
86 _LIT(KForceMediaChange, "EForceMediaChange"); |
|
87 _LIT(KPasswordLock, "EPasswordLock"); |
|
88 _LIT(KPasswordUnlock, "EPasswordUnlock"); |
|
89 _LIT(KPasswordClear, "EPasswordClear"); |
|
90 _LIT(KReadPasswordStore, "EReadPasswordStore"); |
|
91 _LIT(KWritePasswordStore, "EWritePasswordStore"); |
|
92 _LIT(KPasswordStoreLengthInBytes, "EPasswordStoreLengthInBytes"); |
|
93 _LIT(KControlIO, "EControlIO"); |
|
94 _LIT(KPasswordErase, "EPasswordErase"); |
|
95 _LIT(KDeleteNotify, "EDeleteNotify"); |
|
96 _LIT(KGetLastErrorInfo, "EGetLastErrorInfo"); |
|
97 _LIT(KInvalidRequestId, "EInvalidRequestId"); |
|
98 |
|
99 /** Enum as a descriptor Enum integar value |
|
100 * In this case these enums represent DLocalDrive::TRequestId |
|
101 * |
|
102 * |
|
103 */ |
|
104 const CDataWrapperBase::TEnumEntryTable CT_MMCSDSocketDriverData::iEnumTRequestIdTable [] = |
|
105 { |
|
106 // Enum as a descriptor Enum |
|
107 KCaps, 0, |
|
108 KRead, 1, |
|
109 KWrite, 2, |
|
110 KFormat, 3, |
|
111 KEnlarge, 4, |
|
112 KReduce, 5, |
|
113 KForceMediaChange, 6, |
|
114 KPasswordLock, 7, |
|
115 KPasswordUnlock, 8, |
|
116 KPasswordClear, 9, |
|
117 KReadPasswordStore, 10, |
|
118 KWritePasswordStore, 11, |
|
119 KPasswordStoreLengthInBytes, 12, |
|
120 KControlIO, 13, |
|
121 KPasswordErase, 14, |
|
122 KDeleteNotify, 15, |
|
123 KGetLastErrorInfo, 16, |
|
124 KInvalidRequestId, -1 |
|
125 }; |
|
126 |
|
127 // TPBusState enum strings |
|
128 _LIT(KPBusCardAbsent, "EPBusCardAbsent"); |
|
129 _LIT(KPBusOff, "EPBusOff"); |
|
130 _LIT(KPBusPoweringUp, "EPBusPoweringUp"); |
|
131 _LIT(KPBusOn, "EPBusOn"); |
|
132 _LIT(KPBusPsuFault, "EPBusPsuFault"); |
|
133 _LIT(KPBusPowerUpPending, "EPBusPowerUpPending"); |
|
134 _LIT(KInvalidState, "EInvalidState"); |
|
135 |
|
136 /** Enum as a descriptor Enum integar value |
|
137 * In this case these enums represent TPBusState |
|
138 * |
|
139 * |
|
140 */ |
|
141 const CDataWrapperBase::TEnumEntryTable CT_MMCSDSocketDriverData::iEnumTPBusStateTable [] = |
|
142 { |
|
143 // Enum as a descriptor Enum |
|
144 KPBusCardAbsent, EBusCardAbsent, |
|
145 KPBusOff, EBusOff, |
|
146 KPBusPoweringUp, EBusPoweringUp, |
|
147 KPBusOn, EBusOn, |
|
148 KPBusPsuFault, EBusPsuFault, |
|
149 KPBusPowerUpPending, EBusPowerUpPending, |
|
150 KInvalidState, -1 |
|
151 }; |
|
152 |
|
153 // TPBusType enum strings |
|
154 _LIT(KPBusTypeNone, "EPBusTypeNone"); |
|
155 _LIT(KPBusTypePcCard, "EPBusTypePcCard"); |
|
156 _LIT(KPBusTypeMultiMedia, "EPBusTypeMultiMedia"); |
|
157 _LIT(KPBusTypeUSB, "EPBusTypeUSB"); |
|
158 _LIT(KInvalidType, "EInvalidType"); |
|
159 |
|
160 /** Enum as a descriptor Enum integar value |
|
161 * In this case these enums represent TPBusType |
|
162 * |
|
163 * |
|
164 */ |
|
165 const CDataWrapperBase::TEnumEntryTable CT_MMCSDSocketDriverData::iEnumTPBusTypeTable [] = |
|
166 { |
|
167 // Enum as a descriptor Enum |
|
168 KPBusTypeNone, EBusTypeNone, |
|
169 KPBusTypePcCard, EBusTypePcCard, |
|
170 KPBusTypeMultiMedia, EBusTypeMultiMedia, |
|
171 KPBusTypeUSB, EBusTypeUSB, |
|
172 KInvalidType, -1 |
|
173 }; |
|
174 |
|
175 /*@}*/ |
|
176 |
|
177 |
|
178 /** |
|
179 * Create a new Socket Driver Data wrapper |
|
180 * |
|
181 * @return A Socket Driver Data wrapper |
|
182 * |
|
183 * @leave System wide error |
|
184 */ |
|
185 CT_MMCSDSocketDriverData* CT_MMCSDSocketDriverData::NewL() |
|
186 { |
|
187 CT_MMCSDSocketDriverData* ret=new (ELeave) CT_MMCSDSocketDriverData(); |
|
188 CleanupStack::PushL(ret); |
|
189 ret->ConstructL(); |
|
190 CleanupStack::Pop(ret); |
|
191 return ret; |
|
192 } |
|
193 |
|
194 /** |
|
195 * Construction |
|
196 * |
|
197 * @return N/A |
|
198 */ |
|
199 CT_MMCSDSocketDriverData::CT_MMCSDSocketDriverData() |
|
200 : CT_MmcSDDriverData() |
|
201 { |
|
202 } |
|
203 |
|
204 /** |
|
205 * Second phase construction |
|
206 * |
|
207 * @return void |
|
208 * |
|
209 * @leave System wide error |
|
210 */ |
|
211 void CT_MMCSDSocketDriverData::ConstructL() |
|
212 { |
|
213 CT_MmcSDDriverData::ConstructL(); |
|
214 } |
|
215 |
|
216 /** |
|
217 * Public destructor |
|
218 * |
|
219 * @return N/A |
|
220 */ |
|
221 CT_MMCSDSocketDriverData::~CT_MMCSDSocketDriverData() |
|
222 { |
|
223 } |
|
224 |
|
225 /** |
|
226 * Return a pointer to the object that the data wraps |
|
227 * |
|
228 * @return pointer to the object that the data wraps |
|
229 */ |
|
230 TAny* CT_MMCSDSocketDriverData::GetObject() |
|
231 { |
|
232 // Can't use DMMCSocket type on user side, so get pointer from Controller |
|
233 TAny* socketPtr = NULL; |
|
234 iMmcSDController->Socket(&socketPtr); |
|
235 return socketPtr; |
|
236 } |
|
237 |
|
238 /** |
|
239 * Process a command read from the script file |
|
240 * |
|
241 * @param aCommand The command to process |
|
242 * @param aSection The section in the ini containing data for the command |
|
243 * @param aAsyncErrorIndex Command index for async calls to return errors to |
|
244 * |
|
245 * @return ETrue if the command is processed |
|
246 * |
|
247 * @leave System wide error |
|
248 */ |
|
249 TBool CT_MMCSDSocketDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) |
|
250 { |
|
251 TBool ret=ETrue; |
|
252 |
|
253 if( aCommand == KCmdAdjustPartialRead ) |
|
254 { |
|
255 DoCmdAdjustPartialRead(aSection); |
|
256 } |
|
257 else if( aCommand==KCmdCardIsPresent ) |
|
258 { |
|
259 DoCmdCardIsPresent(aSection); |
|
260 } |
|
261 else if( aCommand == KCmdGetBufferInfo ) |
|
262 { |
|
263 DoCmdGetBufferInfo(aSection); |
|
264 } |
|
265 else if( aCommand == KCmdInit ) |
|
266 { |
|
267 DoCmdInit(); |
|
268 } |
|
269 else if( aCommand == KCmdInitiatePowerUpSequence ) |
|
270 { |
|
271 DoCmdInitiatePowerUpSequence(); |
|
272 } |
|
273 else if( aCommand==KCmdMachineInfo ) |
|
274 { |
|
275 DoCmdMachineInfo(aSection); |
|
276 } |
|
277 else if( aCommand == KCmdPrepareStore ) |
|
278 { |
|
279 DoCmdPrepareStore(aSection); |
|
280 } |
|
281 else if( aCommand == KCmdReset1 ) |
|
282 { |
|
283 DoCmdReset1(); |
|
284 } |
|
285 else if( aCommand == KCmdReset2 ) |
|
286 { |
|
287 DoCmdReset2(); |
|
288 } |
|
289 else if( aCommand == KCmdResetInactivity ) |
|
290 { |
|
291 DoCmdResetInactivity(aSection); |
|
292 } |
|
293 else if( aCommand == KCmdStack ) |
|
294 { |
|
295 DoCmdStack(aSection); |
|
296 } |
|
297 else if (aCommand == KCmdiState_Get) |
|
298 { |
|
299 DoCmdiState_Get(aSection); |
|
300 } |
|
301 else if (aCommand == KCmdiType_Get) |
|
302 { |
|
303 DoCmdiType_Get(aSection); |
|
304 } |
|
305 else if (aCommand == KCmdiDoorOpened_Get) |
|
306 { |
|
307 DoCmdiDoorOpened_Get(aSection); |
|
308 } |
|
309 else if (aCommand == KCmdiStandby_Get) |
|
310 { |
|
311 DoCmdiStandby_Get(aSection); |
|
312 } |
|
313 else if (aCommand == KCmdPowerUp) |
|
314 { |
|
315 DoCmdPowerUpL(aSection, aAsyncErrorIndex); |
|
316 } |
|
317 else |
|
318 { |
|
319 ret=CT_MmcSDDriverData::DoCommandL(aCommand, aSection, aAsyncErrorIndex); |
|
320 } |
|
321 return ret; |
|
322 } |
|
323 |
|
324 |
|
325 /** |
|
326 * Process command to call DMMCSocket::AdjustPartialRead |
|
327 * |
|
328 * @param aSection The section in the ini containing data for the command |
|
329 * |
|
330 * @return void |
|
331 */ |
|
332 void CT_MMCSDSocketDriverData::DoCmdAdjustPartialRead(const TDesC& aSection) |
|
333 { |
|
334 TPartialReadData prd; |
|
335 |
|
336 if( !GetUintFromConfig(aSection, KPrdStart(), prd.iStart) ) |
|
337 { |
|
338 ERR_PRINTF1(_L("Physical Start value not given in ini file")); |
|
339 SetBlockResult(EFail); |
|
340 } |
|
341 else if( !GetUintFromConfig(aSection, KPrdEnd(), prd.iEnd) ) |
|
342 { |
|
343 ERR_PRINTF1(_L("Physical End value not given in ini file")); |
|
344 SetBlockResult(EFail); |
|
345 } |
|
346 else |
|
347 { |
|
348 INFO_PRINTF3(_L("Calling MMCSocket::AdjustPartialRead(start=%u, end=%u)"), prd.iStart, prd.iEnd); |
|
349 TInt err = iMmcSDController->SocketAdjustPartialRead(prd); |
|
350 |
|
351 if( err != KErrNone ) |
|
352 { |
|
353 ERR_PRINTF2(_L("MMCSocket::AdjustPartialRead() Error %d"), err); |
|
354 SetError(err); |
|
355 } |
|
356 else |
|
357 { |
|
358 INFO_PRINTF3(_L("MMCSocket::AdjustPartialRead() = %u, %u"), prd.iPhysStart, prd.iPhysEnd); |
|
359 |
|
360 TUint expectedStart; |
|
361 if( GetUintFromConfig(aSection, KPrdExpectedStart(), expectedStart) ) |
|
362 { |
|
363 if( prd.iPhysStart != expectedStart ) |
|
364 { |
|
365 ERR_PRINTF3(_L("phys start(%u) != expectedStart(%u)"), prd.iPhysStart, expectedStart); |
|
366 SetBlockResult(EFail); |
|
367 } |
|
368 } |
|
369 else |
|
370 { |
|
371 ERR_PRINTF1(_L("Expected Start value not given in ini file")); |
|
372 SetBlockResult(EFail); |
|
373 } |
|
374 |
|
375 TUint expectedEnd; |
|
376 if( GetUintFromConfig(aSection, KPrdExpectedEnd(), expectedEnd) ) |
|
377 { |
|
378 if( prd.iPhysEnd != expectedEnd ) |
|
379 { |
|
380 ERR_PRINTF3(_L("phys end(%u) != expected end(%u)"), prd.iPhysEnd, expectedEnd); |
|
381 SetBlockResult(EFail); |
|
382 } |
|
383 } |
|
384 else |
|
385 { |
|
386 ERR_PRINTF1(_L("Expected End value not given in ini file")); |
|
387 SetBlockResult(EFail); |
|
388 } |
|
389 } |
|
390 } |
|
391 } |
|
392 |
|
393 /** |
|
394 * Process command to call DMMCSocket::CardIsPresent |
|
395 * |
|
396 * @param aSection The section in the ini containing data for the command |
|
397 * |
|
398 * @return void |
|
399 */ |
|
400 void CT_MMCSDSocketDriverData::DoCmdCardIsPresent(const TDesC& aSection) |
|
401 { |
|
402 TBool cardPresent = EFalse; |
|
403 INFO_PRINTF1(_L("Calling MMCSocket::CardIsPresent()")); |
|
404 TInt err = iMmcSDController->SocketCardIsPresent(cardPresent); |
|
405 |
|
406 if ( err!=KErrNone ) |
|
407 { |
|
408 ERR_PRINTF2(_L("MMCSocket::CardIsPresent() Error %d"), err); |
|
409 SetError(err); |
|
410 } |
|
411 else |
|
412 { |
|
413 INFO_PRINTF2(_L("MMCSocket::CardIsPresent() = %d"), cardPresent); |
|
414 TBool expectedCardPresent; |
|
415 if( GetBoolFromConfig(aSection, KCardPresent(), expectedCardPresent) ) |
|
416 { |
|
417 if( cardPresent != expectedCardPresent ) |
|
418 { |
|
419 ERR_PRINTF3(_L("cardPresent(%d) != expectedCardPresent(%d)"), cardPresent, expectedCardPresent); |
|
420 SetBlockResult(EFail); |
|
421 } |
|
422 } |
|
423 else |
|
424 { |
|
425 ERR_PRINTF1(_L("Expected CardPresent value not given in ini file")); |
|
426 SetBlockResult(EFail); |
|
427 } |
|
428 } |
|
429 } |
|
430 |
|
431 /** |
|
432 * Process command to call DMMCSocket::GetBufferInfo |
|
433 * |
|
434 * @param aSection The section in the ini containing data for the command |
|
435 * |
|
436 * @return void |
|
437 */ |
|
438 void CT_MMCSDSocketDriverData::DoCmdGetBufferInfo(const TDesC& aSection) |
|
439 { |
|
440 TBufferInfo bufferInfo; |
|
441 INFO_PRINTF1(_L("Calling MMCSocket::GetBufferInfo()")); |
|
442 TInt err = iMmcSDController->SocketGetBufferInfo(bufferInfo); |
|
443 if( err != KErrNone ) |
|
444 { |
|
445 ERR_PRINTF2(_L("MMCSocket::GetBufferInfo() Error %d"), err); |
|
446 SetError(err); |
|
447 } |
|
448 else |
|
449 { |
|
450 INFO_PRINTF3(_L("GetBufferInfo() iBuf(%x) iBufLen(%d)"), |
|
451 bufferInfo.iBuf, bufferInfo.iBufLen); |
|
452 |
|
453 // check the optional expected length |
|
454 TInt expectedBufLen; |
|
455 if( GetIntFromConfig(aSection, KExpectedBufLen(), expectedBufLen) ) |
|
456 { |
|
457 if( bufferInfo.iBufLen != expectedBufLen ) |
|
458 { |
|
459 ERR_PRINTF3(_L("bufferInfo.iBufLen (%d) != expectedBufLen(%d)"), bufferInfo.iBufLen , expectedBufLen); |
|
460 SetBlockResult(EFail); |
|
461 } |
|
462 } |
|
463 } |
|
464 } |
|
465 |
|
466 /** |
|
467 * Process command to call DMMCSocket::Init |
|
468 * |
|
469 * @return void |
|
470 */ |
|
471 void CT_MMCSDSocketDriverData::DoCmdInit() |
|
472 { |
|
473 INFO_PRINTF1(_L("Calling MMCSocket::Init()")); |
|
474 TInt err = iMmcSDController->SocketInit(); |
|
475 |
|
476 if(err != KErrNone) |
|
477 { |
|
478 ERR_PRINTF2(_L("MMCSocket::Init() Error %d"), err); |
|
479 SetError(err); |
|
480 } |
|
481 } |
|
482 |
|
483 /** |
|
484 * Process command to call DMMCSocket::InitiatePowerUpSequence |
|
485 * |
|
486 * @return void |
|
487 */ |
|
488 void CT_MMCSDSocketDriverData::DoCmdInitiatePowerUpSequence() |
|
489 { |
|
490 INFO_PRINTF1(_L("Calling MMCSocket::InitiatePowerUpSequence()")); |
|
491 TInt err = iMmcSDController->SocketInitiatePowerUpSequence(); |
|
492 if( err != KErrNone ) |
|
493 { |
|
494 ERR_PRINTF2(_L("MMCSocket::InitiatePowerUpSequence() Error %d"), err); |
|
495 SetError(err); |
|
496 } |
|
497 } |
|
498 |
|
499 /** |
|
500 * Process command to call DMMCSocket::MachineInfo |
|
501 * |
|
502 * @param aSection The section in the ini containing data for the command |
|
503 * |
|
504 * @return void |
|
505 */ |
|
506 void CT_MMCSDSocketDriverData::DoCmdMachineInfo(const TDesC& aSection) |
|
507 { |
|
508 TMachineInfo machineInfo; |
|
509 INFO_PRINTF1(_L("Calling MMCSocket::MachineInfo()")); |
|
510 TInt err = iMmcSDController->SocketMachineInfo(machineInfo); |
|
511 if( err != KErrNone ) |
|
512 { |
|
513 ERR_PRINTF2(_L("MMCSocket::MachineInfo() Error %d"), err); |
|
514 SetError(err); |
|
515 } |
|
516 else |
|
517 { |
|
518 INFO_PRINTF2(_L("MMCSocket::MachineInfo(): iTotalSockets=%d"), machineInfo.iTotalSockets); |
|
519 INFO_PRINTF2(_L("MMCSocket::MachineInfo(): iTotalMediaChanges=%d"), machineInfo.iTotalMediaChanges); |
|
520 INFO_PRINTF2(_L("MMCSocket::MachineInfo(): iTotalPrimarySupplies=%d"), machineInfo.iTotalPrimarySupplies); |
|
521 INFO_PRINTF2(_L("MMCSocket::MachineInfo(): iSPIMode=%d"), machineInfo.iSPIMode); |
|
522 INFO_PRINTF2(_L("MMCSocket::MachineInfo(): iBaseBusNumber=%d"), machineInfo.iBaseBusNumber); |
|
523 |
|
524 if( machineInfo.iSupportsSPIMode ) |
|
525 { |
|
526 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsSPIMode")); |
|
527 } |
|
528 if( machineInfo.iSupportsDoubleBuffering ) |
|
529 { |
|
530 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsDoubleBuffering")); |
|
531 } |
|
532 if( machineInfo.iSupportsR7 ) |
|
533 { |
|
534 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsR7")); |
|
535 } |
|
536 if( machineInfo.iDma8BitAddressing ) |
|
537 { |
|
538 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma8BitAddressing")); |
|
539 } |
|
540 if( machineInfo.iDma16BitAddressing ) |
|
541 { |
|
542 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma16BitAddressing")); |
|
543 } |
|
544 if( machineInfo.iDma32BitAddressing ) |
|
545 { |
|
546 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma32BitAddressing")); |
|
547 } |
|
548 if( machineInfo.iDma64BitAddressing ) |
|
549 { |
|
550 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma64BitAddressing")); |
|
551 } |
|
552 if( machineInfo.iSupportsDMA ) |
|
553 { |
|
554 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsDMA")); |
|
555 } |
|
556 if( machineInfo.iMaxTransferLength_256K ) |
|
557 { |
|
558 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_256K")); |
|
559 } |
|
560 if( machineInfo.iMaxTransferLength_512K ) |
|
561 { |
|
562 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_512K")); |
|
563 } |
|
564 if( machineInfo.iMaxTransferLength_1M ) |
|
565 { |
|
566 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_1M")); |
|
567 } |
|
568 if( machineInfo.iMaxTransferLength_2M ) |
|
569 { |
|
570 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_2M")); |
|
571 } |
|
572 if( machineInfo.iMaxTransferLength_4M ) |
|
573 { |
|
574 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_4M")); |
|
575 } |
|
576 if( machineInfo.iMaxTransferLength_8M ) |
|
577 { |
|
578 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_8M")); |
|
579 } |
|
580 if( machineInfo.iMaxTransferLength_16M ) |
|
581 { |
|
582 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_16M")); |
|
583 } |
|
584 |
|
585 TInt expectedInt; |
|
586 TBool expectedBool; |
|
587 |
|
588 if( GetIntFromConfig(aSection, KExpectedTotalSockets(), expectedInt) ) |
|
589 { |
|
590 if( machineInfo.iTotalSockets != expectedInt ) |
|
591 { |
|
592 ERR_PRINTF3(_L("totalSockets(%d) != expectedTotalSockets(%d)"), machineInfo.iTotalSockets, expectedInt); |
|
593 SetBlockResult(EFail); |
|
594 } |
|
595 } |
|
596 else |
|
597 { |
|
598 ERR_PRINTF1(_L("Expected Total Sockets not given in ini file")); |
|
599 SetBlockResult(EFail); |
|
600 } |
|
601 |
|
602 if( GetIntFromConfig(aSection, KExpectedTotalMediaChanges(), expectedInt) ) |
|
603 { |
|
604 if( machineInfo.iTotalMediaChanges != expectedInt ) |
|
605 { |
|
606 ERR_PRINTF3(_L("totalMediaChanges(%d) != expectedTotalMediaChanges(%d)"), machineInfo.iTotalMediaChanges, expectedInt); |
|
607 SetBlockResult(EFail); |
|
608 } |
|
609 } |
|
610 else |
|
611 { |
|
612 ERR_PRINTF1(_L("Expected Media Changes not given in ini file")); |
|
613 SetBlockResult(EFail); |
|
614 } |
|
615 |
|
616 if( GetIntFromConfig(aSection, KExpectedTotalPrimarySupplies(), expectedInt) ) |
|
617 { |
|
618 if( machineInfo.iTotalPrimarySupplies != expectedInt ) |
|
619 { |
|
620 ERR_PRINTF3(_L("totalPrimarySupplies(%d) != expectedTotalPrimarySupplies(%d)"), machineInfo.iTotalPrimarySupplies, expectedInt); |
|
621 SetBlockResult(EFail); |
|
622 } |
|
623 } |
|
624 else |
|
625 { |
|
626 ERR_PRINTF1(_L("Expected Primary Supplies not given in ini file")); |
|
627 SetBlockResult(EFail); |
|
628 } |
|
629 |
|
630 if( GetBoolFromConfig(aSection, KExpectedSPIMode(), expectedBool) ) |
|
631 { |
|
632 if( machineInfo.iSPIMode != expectedBool ) |
|
633 { |
|
634 ERR_PRINTF3(_L("SPIMode(%d) != expectedSPIMode(%d)"), machineInfo.iSPIMode, expectedBool); |
|
635 SetBlockResult(EFail); |
|
636 } |
|
637 } |
|
638 else |
|
639 { |
|
640 ERR_PRINTF1(_L("Expected SPI Mode not given in ini file")); |
|
641 SetBlockResult(EFail); |
|
642 } |
|
643 |
|
644 if( GetIntFromConfig(aSection, KExpectedBaseBusNumber(), expectedInt) ) |
|
645 { |
|
646 if( machineInfo.iBaseBusNumber != expectedInt ) |
|
647 { |
|
648 ERR_PRINTF3(_L("baseBusNumber(%d) != expectedBaseBusNumber(%d)"), machineInfo.iBaseBusNumber, expectedInt); |
|
649 SetBlockResult(EFail); |
|
650 } |
|
651 } |
|
652 else |
|
653 { |
|
654 ERR_PRINTF1(_L("Expected Base Bus Number not given in ini file")); |
|
655 SetBlockResult(EFail); |
|
656 } |
|
657 |
|
658 if( GetBoolFromConfig(aSection, KHasFlagSupportsSPIMode(), expectedBool) ) |
|
659 { |
|
660 if( machineInfo.iSupportsSPIMode != expectedBool ) |
|
661 { |
|
662 ERR_PRINTF3(_L("supportsSPIMode(%d) != expectedSupportsSPIMode(%d)"), machineInfo.iSupportsSPIMode, expectedBool); |
|
663 SetBlockResult(EFail); |
|
664 } |
|
665 } |
|
666 else |
|
667 { |
|
668 ERR_PRINTF1(_L("Has Flag Supports SPI Mode not given in ini file")); |
|
669 SetBlockResult(EFail); |
|
670 } |
|
671 |
|
672 if( GetBoolFromConfig(aSection, KHasFlagSupportsDoubleBuffering(), expectedBool) ) |
|
673 { |
|
674 if( machineInfo.iSupportsDoubleBuffering != expectedBool ) |
|
675 { |
|
676 ERR_PRINTF3(_L("supportsDoubleBuffering(%d) != expectedSupportsDoubleBuffering(%d)"), machineInfo.iSupportsDoubleBuffering, expectedBool); |
|
677 SetBlockResult(EFail); |
|
678 } |
|
679 } |
|
680 else |
|
681 { |
|
682 ERR_PRINTF1(_L("Has Flag Supports Double Buffering not given in ini file")); |
|
683 SetBlockResult(EFail); |
|
684 } |
|
685 |
|
686 if( GetBoolFromConfig(aSection, KHasFlagSupportsR7(), expectedBool) ) |
|
687 { |
|
688 if( machineInfo.iSupportsR7 != expectedBool ) |
|
689 { |
|
690 ERR_PRINTF3(_L("supportsR7(%d) != expectedSupportsR7(%d)"), machineInfo.iSupportsR7, expectedBool); |
|
691 SetBlockResult(EFail); |
|
692 } |
|
693 } |
|
694 else |
|
695 { |
|
696 ERR_PRINTF1(_L("Has Flag Supports R7 not given in ini file")); |
|
697 SetBlockResult(EFail); |
|
698 } |
|
699 |
|
700 if( GetBoolFromConfig(aSection, KHasFlagDma8BitAddressing(), expectedBool) ) |
|
701 { |
|
702 if( machineInfo.iDma8BitAddressing != expectedBool ) |
|
703 { |
|
704 ERR_PRINTF3(_L("Dma8BitAddressing(%d) != expectedDma8BitAddressing(%d)"), machineInfo.iDma8BitAddressing, expectedBool); |
|
705 SetBlockResult(EFail); |
|
706 } |
|
707 } |
|
708 else |
|
709 { |
|
710 ERR_PRINTF1(_L("Has Flag Dma 8Bit Addressing not given in ini file")); |
|
711 SetBlockResult(EFail); |
|
712 } |
|
713 |
|
714 if( GetBoolFromConfig(aSection, KHasFlagDma16BitAddressing(), expectedBool) ) |
|
715 { |
|
716 if( machineInfo.iDma16BitAddressing != expectedBool ) |
|
717 { |
|
718 ERR_PRINTF3(_L("Dma16BitAddressing(%d) != expectedDma16BitAddressing(%d)"), machineInfo.iDma16BitAddressing, expectedBool); |
|
719 SetBlockResult(EFail); |
|
720 } |
|
721 } |
|
722 else |
|
723 { |
|
724 ERR_PRINTF1(_L("Has Flag Dma 16Bit Addressing not given in ini file")); |
|
725 SetBlockResult(EFail); |
|
726 } |
|
727 |
|
728 if( GetBoolFromConfig(aSection, KHasFlagDma32BitAddressing(), expectedBool) ) |
|
729 { |
|
730 if( machineInfo.iDma32BitAddressing != expectedBool ) |
|
731 { |
|
732 ERR_PRINTF3(_L("Dma32BitAddressing(%d) != expectedDma32BitAddressing(%d)"), machineInfo.iDma32BitAddressing, expectedBool); |
|
733 SetBlockResult(EFail); |
|
734 } |
|
735 } |
|
736 else |
|
737 { |
|
738 ERR_PRINTF1(_L("Has Flag Dma 32Bit Addressing not given in ini file")); |
|
739 SetBlockResult(EFail); |
|
740 } |
|
741 |
|
742 if( GetBoolFromConfig(aSection, KHasFlagDma64BitAddressing(), expectedBool) ) |
|
743 { |
|
744 if( machineInfo.iDma64BitAddressing != expectedBool ) |
|
745 { |
|
746 ERR_PRINTF3(_L("Dma64BitAddressing(%d) != expectedDma64BitAddressing(%d)"), machineInfo.iDma64BitAddressing, expectedBool); |
|
747 SetBlockResult(EFail); |
|
748 } |
|
749 } |
|
750 else |
|
751 { |
|
752 ERR_PRINTF1(_L("Has Flag Dma 64Bit Addressing not given in ini file")); |
|
753 SetBlockResult(EFail); |
|
754 } |
|
755 |
|
756 if( GetBoolFromConfig(aSection, KHasFlagSupportsDMA(), expectedBool) ) |
|
757 { |
|
758 if( machineInfo.iSupportsDMA != expectedBool ) |
|
759 { |
|
760 ERR_PRINTF3(_L("SupportsDMA(%d) != expectedSupportsDMA(%d)"), machineInfo.iSupportsDMA, expectedBool); |
|
761 SetBlockResult(EFail); |
|
762 } |
|
763 } |
|
764 else |
|
765 { |
|
766 ERR_PRINTF1(_L("Has Flag Supports DMA not given in ini file")); |
|
767 SetBlockResult(EFail); |
|
768 } |
|
769 |
|
770 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_256K(), expectedBool) ) |
|
771 { |
|
772 if( machineInfo.iMaxTransferLength_256K != expectedBool ) |
|
773 { |
|
774 ERR_PRINTF3(_L("maxTransferLength_256K(%d) != expectedMaxTransferLength_256K(%d)"), machineInfo.iMaxTransferLength_256K, expectedBool); |
|
775 SetBlockResult(EFail); |
|
776 } |
|
777 } |
|
778 else |
|
779 { |
|
780 ERR_PRINTF1(_L("Has Flag Max Transfer Length 256K not given in ini file")); |
|
781 SetBlockResult(EFail); |
|
782 } |
|
783 |
|
784 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_512K(), expectedBool) ) |
|
785 { |
|
786 if( machineInfo.iMaxTransferLength_512K != expectedBool ) |
|
787 { |
|
788 ERR_PRINTF3(_L("maxTransferLength_512K(%d) != expectedMaxTransferLength_512K(%d)"), machineInfo.iMaxTransferLength_512K, expectedBool); |
|
789 SetBlockResult(EFail); |
|
790 } |
|
791 } |
|
792 else |
|
793 { |
|
794 ERR_PRINTF1(_L("Has Flag Max Transfer Length 512K not given in ini file")); |
|
795 SetBlockResult(EFail); |
|
796 } |
|
797 |
|
798 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_1M(), expectedBool) ) |
|
799 { |
|
800 if( machineInfo.iMaxTransferLength_1M != expectedBool ) |
|
801 { |
|
802 ERR_PRINTF3(_L("maxTransferLength_1M(%d) != expectedMaxTransferLength_1M(%d)"), machineInfo.iMaxTransferLength_1M, expectedBool); |
|
803 SetBlockResult(EFail); |
|
804 } |
|
805 } |
|
806 else |
|
807 { |
|
808 ERR_PRINTF1(_L("Has Flag Max Transfer Length 1M not given in ini file")); |
|
809 SetBlockResult(EFail); |
|
810 } |
|
811 |
|
812 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_2M(), expectedBool) ) |
|
813 { |
|
814 if( machineInfo.iMaxTransferLength_2M != expectedBool ) |
|
815 { |
|
816 ERR_PRINTF3(_L("maxTransferLength_2M(%d) != expectedMaxTransferLength_2M(%d)"), machineInfo.iMaxTransferLength_2M, expectedBool); |
|
817 SetBlockResult(EFail); |
|
818 } |
|
819 } |
|
820 else |
|
821 { |
|
822 ERR_PRINTF1(_L("Has Flag Max Transfer Length 2M not given in ini file")); |
|
823 SetBlockResult(EFail); |
|
824 } |
|
825 |
|
826 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_4M(), expectedBool) ) |
|
827 { |
|
828 if( machineInfo.iMaxTransferLength_4M != expectedBool ) |
|
829 { |
|
830 ERR_PRINTF3(_L("maxTransferLength_4M(%d) != expectedMaxTransferLength_4M(%d)"), machineInfo.iMaxTransferLength_4M, expectedBool); |
|
831 SetBlockResult(EFail); |
|
832 } |
|
833 } |
|
834 else |
|
835 { |
|
836 ERR_PRINTF1(_L("Has Flag Max Transfer Length 4M not given in ini file")); |
|
837 SetBlockResult(EFail); |
|
838 } |
|
839 |
|
840 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_8M(), expectedBool) ) |
|
841 { |
|
842 if( machineInfo.iMaxTransferLength_8M != expectedBool ) |
|
843 { |
|
844 ERR_PRINTF3(_L("maxTransferLength_8M(%d) != expectedMaxTransferLength_8M(%d)"), machineInfo.iMaxTransferLength_8M, expectedBool); |
|
845 SetBlockResult(EFail); |
|
846 } |
|
847 } |
|
848 else |
|
849 { |
|
850 ERR_PRINTF1(_L("Has Flag Max Transfer Length 8M not given in ini file")); |
|
851 SetBlockResult(EFail); |
|
852 } |
|
853 |
|
854 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_16M(), expectedBool) ) |
|
855 { |
|
856 if( machineInfo.iMaxTransferLength_16M != expectedBool ) |
|
857 { |
|
858 ERR_PRINTF3(_L("maxTransferLength_16M(%d) != expectedMaxTransferLength_16M(%d)"), machineInfo.iMaxTransferLength_16M, expectedBool); |
|
859 SetBlockResult(EFail); |
|
860 } |
|
861 } |
|
862 else |
|
863 { |
|
864 ERR_PRINTF1(_L("Has Flag Max Transfer Length 16M not given in ini file")); |
|
865 SetBlockResult(EFail); |
|
866 } |
|
867 } |
|
868 } |
|
869 |
|
870 /** |
|
871 * Process command to call DMMCSocket::PrepareStore |
|
872 * |
|
873 * @param aSection The section in the ini containing data for the command |
|
874 * |
|
875 * @return void |
|
876 */ |
|
877 void CT_MMCSDSocketDriverData::DoCmdPrepareStore(const TDesC& aSection) |
|
878 { |
|
879 TPasswordPrepareStoreData pwdData; |
|
880 TPtrC oldPassword; |
|
881 TPtrC newPassword; |
|
882 |
|
883 if( !GetIntFromConfig(aSection, KBusNumber(), pwdData.iBus) ) |
|
884 { |
|
885 ERR_PRINTF1(_L("Bus Number not given in ini file")); |
|
886 SetBlockResult(EFail); |
|
887 } |
|
888 else if( !GetStringFromConfig(aSection, KOldPassword(), oldPassword) ) |
|
889 { |
|
890 ERR_PRINTF1(_L("Old password value not given in ini file")); |
|
891 SetBlockResult(EFail); |
|
892 } |
|
893 else if( !GetStringFromConfig(aSection, KNewPassword(), newPassword) ) |
|
894 { |
|
895 ERR_PRINTF1(_L("New password value not given in ini file")); |
|
896 SetBlockResult(EFail); |
|
897 } |
|
898 else if( !GetEnumFromConfig(aSection, KPrepStoreFunc(), iEnumTRequestIdTable, pwdData.iFunc) ) |
|
899 { |
|
900 ERR_PRINTF1(_L("Function ID not given in ini file")); |
|
901 SetBlockResult(EFail); |
|
902 } |
|
903 else |
|
904 { |
|
905 pwdData.iOldPassword.Copy(oldPassword); |
|
906 pwdData.iNewPassword.Copy(newPassword); |
|
907 |
|
908 INFO_PRINTF5(_L("Calling MMCSocket::PrepareStore(bus=%d, func=%d, oldPassword=%S, newPassword=%S)"), pwdData.iBus, pwdData.iFunc, &oldPassword, &newPassword); |
|
909 TInt err = iMmcSDController->SocketPrepareStore(pwdData); |
|
910 if( err != KErrNone ) |
|
911 { |
|
912 ERR_PRINTF2(_L("MMCSocket::PrepareStore() Error %d"), err); |
|
913 SetError(err); |
|
914 } |
|
915 } |
|
916 } |
|
917 |
|
918 /** |
|
919 * Process command to call DMMCSocket::Reset1 |
|
920 * |
|
921 * @return void |
|
922 */ |
|
923 void CT_MMCSDSocketDriverData::DoCmdReset1() |
|
924 { |
|
925 INFO_PRINTF1(_L("Calling MMCSocket::Reset1()")); |
|
926 TInt err = iMmcSDController->SocketReset1(); |
|
927 if( err != KErrNone ) |
|
928 { |
|
929 ERR_PRINTF2(_L("MMCSocket::Reset1() Error %d"), err); |
|
930 SetError(err); |
|
931 } |
|
932 } |
|
933 |
|
934 /** |
|
935 * Process command to call DMMCSocket::Reset2 |
|
936 * |
|
937 * @return void |
|
938 */ |
|
939 void CT_MMCSDSocketDriverData::DoCmdReset2() |
|
940 { |
|
941 INFO_PRINTF1(_L("Calling MMCSocket::Reset2()")); |
|
942 TInt err = iMmcSDController->SocketReset2(); |
|
943 if( err != KErrNone ) |
|
944 { |
|
945 ERR_PRINTF2(_L("MMCSocket::Reset2() Error %d"), err); |
|
946 SetError(err); |
|
947 } |
|
948 } |
|
949 |
|
950 /** |
|
951 * Process command to call DMMCSocket::ResetInactivity |
|
952 * |
|
953 * @param aSection The section in the ini containing data for the command |
|
954 * |
|
955 * @return void |
|
956 */ |
|
957 void CT_MMCSDSocketDriverData::DoCmdResetInactivity(const TDesC& aSection) |
|
958 { |
|
959 TInt busNumber; |
|
960 if( GetIntFromConfig(aSection, KBusNumber(), busNumber) ) |
|
961 { |
|
962 INFO_PRINTF2(_L("Calling MMCSocket::ResetInactivity(bus=%d)"), busNumber); |
|
963 TInt err = iMmcSDController->SocketResetInactivity(busNumber); |
|
964 if( err != KErrNone ) |
|
965 { |
|
966 ERR_PRINTF2(_L("MMCSocket::ResetInactivity() Error %d"), err); |
|
967 SetError(err); |
|
968 } |
|
969 } |
|
970 else |
|
971 { |
|
972 ERR_PRINTF1(_L("Bus Number not given in ini file")); |
|
973 SetBlockResult(EFail); |
|
974 } |
|
975 } |
|
976 |
|
977 /** |
|
978 * Process command to call DMMCSocket::Stack |
|
979 * |
|
980 * @param aSection The section in the ini containing data for the command |
|
981 * |
|
982 * @return void |
|
983 */ |
|
984 void CT_MMCSDSocketDriverData::DoCmdStack(const TDesC& aSection) |
|
985 { |
|
986 TStackPtr stackPtr; |
|
987 if( GetIntFromConfig(aSection, KBusNumber(), stackPtr.iBus) ) |
|
988 { |
|
989 INFO_PRINTF2(_L("Calling MMCSocket::Stack(%d)"), stackPtr.iBus); |
|
990 TInt err = iMmcSDController->SocketStack(stackPtr); |
|
991 |
|
992 if( err!=KErrNone ) |
|
993 { |
|
994 ERR_PRINTF2(_L("MMCSocket::Stack() Error %d"), err); |
|
995 SetError(err); |
|
996 } |
|
997 else |
|
998 { |
|
999 INFO_PRINTF2(_L("MMCSocket::Stack(): ptr=%x"), stackPtr.iStackPtr); |
|
1000 TBool expectedIsNull; |
|
1001 if( GetBoolFromConfig(aSection, KIsNull(), expectedIsNull) ) |
|
1002 { |
|
1003 if( expectedIsNull ) |
|
1004 { |
|
1005 if( stackPtr.iStackPtr != NULL ) |
|
1006 { |
|
1007 ERR_PRINTF1(_L("Stack ptr is not NULL")); |
|
1008 SetBlockResult(EFail); |
|
1009 } |
|
1010 } |
|
1011 else |
|
1012 { |
|
1013 if( stackPtr.iStackPtr == NULL ) |
|
1014 { |
|
1015 ERR_PRINTF1(_L("Stack ptr is NULL")); |
|
1016 SetBlockResult(EFail); |
|
1017 } |
|
1018 else |
|
1019 { |
|
1020 TAny* expectedStackPtr = NULL; |
|
1021 err = iMmcSDController->Stack(&expectedStackPtr); |
|
1022 if( err!=KErrNone ) |
|
1023 { |
|
1024 ERR_PRINTF2(_L("MMCStack Error %d"), err); |
|
1025 SetBlockResult(EFail); |
|
1026 } |
|
1027 else if( stackPtr.iStackPtr != expectedStackPtr ) |
|
1028 { |
|
1029 ERR_PRINTF3(_L("stackPtr(%x) != expectedStackPtr(%x)"), stackPtr.iStackPtr, expectedStackPtr); |
|
1030 SetBlockResult(EFail); |
|
1031 } |
|
1032 } |
|
1033 } |
|
1034 } |
|
1035 else |
|
1036 { |
|
1037 ERR_PRINTF1(_L("Expected Is Null not given in ini file")); |
|
1038 SetBlockResult(EFail); |
|
1039 } |
|
1040 } |
|
1041 } |
|
1042 else |
|
1043 { |
|
1044 ERR_PRINTF1(_L("Bus Number not given in ini file")); |
|
1045 SetBlockResult(EFail); |
|
1046 } |
|
1047 } |
|
1048 |
|
1049 /** |
|
1050 * Process command that will result in getting DMMCSocket::iState kernel side |
|
1051 * |
|
1052 * @param aSection The section in the ini containing data for the command |
|
1053 * |
|
1054 * @return void |
|
1055 * |
|
1056 * @leave System wide error |
|
1057 */ |
|
1058 void CT_MMCSDSocketDriverData::DoCmdiState_Get(const TDesC& aSection) |
|
1059 { |
|
1060 TBusState state; |
|
1061 TInt err = iMmcSDController->SocketiState_Get(state); |
|
1062 |
|
1063 if( err!=KErrNone ) |
|
1064 { |
|
1065 ERR_PRINTF2(_L("MMCSocket::iState() Error %d"), err); |
|
1066 SetError(err); |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 switch(state) |
|
1071 { |
|
1072 case EBusCardAbsent: |
|
1073 { |
|
1074 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusCardAbsent(%d)"), state); |
|
1075 break; |
|
1076 } |
|
1077 case EBusOff: |
|
1078 { |
|
1079 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusOff(%d)"), state); |
|
1080 break; |
|
1081 } |
|
1082 case EBusPoweringUp: |
|
1083 { |
|
1084 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusPoweringUp(%d)"), state); |
|
1085 break; |
|
1086 } |
|
1087 case EBusOn: |
|
1088 { |
|
1089 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusOn(%d)"), state); |
|
1090 break; |
|
1091 } |
|
1092 case EBusPsuFault: |
|
1093 { |
|
1094 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusPsuFault(%d)"), state); |
|
1095 break; |
|
1096 } |
|
1097 case EBusPowerUpPending: |
|
1098 { |
|
1099 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusPowerUpPending(%d)"), state); |
|
1100 break; |
|
1101 } |
|
1102 default: |
|
1103 { |
|
1104 INFO_PRINTF2(_L("MMCSocket::iState() Unknown state=%d"), state); |
|
1105 break; |
|
1106 } |
|
1107 } |
|
1108 |
|
1109 TInt expectedState; |
|
1110 if( GetEnumFromConfig(aSection, KState(), iEnumTPBusStateTable, expectedState) ) |
|
1111 { |
|
1112 if( state != expectedState ) |
|
1113 { |
|
1114 ERR_PRINTF3(_L("State (%d) != Expected state (%d)"), state, expectedState); |
|
1115 SetBlockResult(EFail); |
|
1116 } |
|
1117 } |
|
1118 else |
|
1119 { |
|
1120 ERR_PRINTF1(_L("Expected state not given in ini file")); |
|
1121 SetBlockResult(EFail); |
|
1122 } |
|
1123 } |
|
1124 } |
|
1125 |
|
1126 /** |
|
1127 * Process command that will result in getting DMMCSocket::iStandby kernel side |
|
1128 * |
|
1129 * @param aSection The section in the ini containing data for the command |
|
1130 * |
|
1131 * @return void |
|
1132 * |
|
1133 * @leave System wide error |
|
1134 */ |
|
1135 void CT_MMCSDSocketDriverData::DoCmdiStandby_Get(const TDesC& aSection) |
|
1136 { |
|
1137 TBool standby; |
|
1138 TInt err = iMmcSDController->SocketiStandby_Get(standby); |
|
1139 |
|
1140 if( err!=KErrNone ) |
|
1141 { |
|
1142 ERR_PRINTF2(_L("MMCSocket::iStandby() Error %d"), err); |
|
1143 SetError(err); |
|
1144 } |
|
1145 else |
|
1146 { |
|
1147 INFO_PRINTF2(_L("MMCSocket::iStandby()=%d"), standby); |
|
1148 TBool expectedStandby; |
|
1149 if( GetBoolFromConfig(aSection, KStandby(), expectedStandby) ) |
|
1150 { |
|
1151 if( standby != expectedStandby ) |
|
1152 { |
|
1153 ERR_PRINTF3(_L("Standby (%d) != Expected standby (%d)"), standby, expectedStandby); |
|
1154 SetBlockResult(EFail); |
|
1155 } |
|
1156 } |
|
1157 else |
|
1158 { |
|
1159 ERR_PRINTF1(_L("Expected standby not given in ini file")); |
|
1160 SetBlockResult(EFail); |
|
1161 } |
|
1162 } |
|
1163 } |
|
1164 |
|
1165 /** |
|
1166 * Process command that will result in getting DMMCSocket::iDoorOpened kernel side |
|
1167 * |
|
1168 * @param aSection The section in the ini containing data for the command |
|
1169 * |
|
1170 * @return void |
|
1171 * |
|
1172 * @leave System wide error |
|
1173 */ |
|
1174 void CT_MMCSDSocketDriverData::DoCmdiDoorOpened_Get(const TDesC& aSection) |
|
1175 { |
|
1176 TBool doorOpened; |
|
1177 TInt err = iMmcSDController->SocketiDoorOpened_Get(doorOpened); |
|
1178 |
|
1179 if( err!=KErrNone ) |
|
1180 { |
|
1181 ERR_PRINTF2(_L("MMCSocket::iDoorOpened() Error %d"), err); |
|
1182 SetError(err); |
|
1183 } |
|
1184 else |
|
1185 { |
|
1186 INFO_PRINTF2(_L("MMCSocket::iDoorOpened()=%d"), doorOpened); |
|
1187 TBool expectedDoorOpened; |
|
1188 if( GetBoolFromConfig(aSection, KDoorOpened(), expectedDoorOpened) ) |
|
1189 { |
|
1190 if( doorOpened != expectedDoorOpened ) |
|
1191 { |
|
1192 ERR_PRINTF3(_L("DoorOpened (%d) != Expected doorOpened (%d)"), doorOpened, expectedDoorOpened); |
|
1193 SetBlockResult(EFail); |
|
1194 } |
|
1195 } |
|
1196 else |
|
1197 { |
|
1198 ERR_PRINTF1(_L("Expected doorOpened not given in ini file")); |
|
1199 SetBlockResult(EFail); |
|
1200 } |
|
1201 } |
|
1202 } |
|
1203 |
|
1204 /** |
|
1205 * Process command that will result in getting DMMCSocket::iType kernel side |
|
1206 * |
|
1207 * @param aSection The section in the ini containing data for the command |
|
1208 * |
|
1209 * @return void |
|
1210 * |
|
1211 * @leave System wide error |
|
1212 */ |
|
1213 void CT_MMCSDSocketDriverData::DoCmdiType_Get(const TDesC& aSection) |
|
1214 { |
|
1215 TCardBusType type; |
|
1216 TInt err = iMmcSDController->SocketiType_Get(type); |
|
1217 |
|
1218 if( err!=KErrNone ) |
|
1219 { |
|
1220 ERR_PRINTF2(_L("MMCSocket::iType() Error %d"), err); |
|
1221 SetError(err); |
|
1222 } |
|
1223 else |
|
1224 { |
|
1225 switch(type) |
|
1226 { |
|
1227 case EBusTypeNone: |
|
1228 { |
|
1229 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypeNone(%d)"), type); |
|
1230 break; |
|
1231 } |
|
1232 case EBusTypePcCard: |
|
1233 { |
|
1234 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypePcCard(%d)"), type); |
|
1235 break; |
|
1236 } |
|
1237 case EBusTypeMultiMedia: |
|
1238 { |
|
1239 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypeMultiMedia(%d)"), type); |
|
1240 break; |
|
1241 } |
|
1242 case EBusTypeUSB: |
|
1243 { |
|
1244 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypeUSB(%d)"), type); |
|
1245 break; |
|
1246 } |
|
1247 default: |
|
1248 { |
|
1249 INFO_PRINTF2(_L("MMCSocket::iType() Unknown type=%d"), type); |
|
1250 break; |
|
1251 } |
|
1252 } |
|
1253 |
|
1254 TInt expectedType; |
|
1255 if( GetEnumFromConfig(aSection, KType(), iEnumTPBusTypeTable, expectedType) ) |
|
1256 { |
|
1257 if( type != expectedType ) |
|
1258 { |
|
1259 ERR_PRINTF3(_L("Type (%d) != Expected type (%d)"), type, expectedType); |
|
1260 SetBlockResult(EFail); |
|
1261 } |
|
1262 } |
|
1263 else |
|
1264 { |
|
1265 ERR_PRINTF1(_L("Expected type not given in ini file")); |
|
1266 SetBlockResult(EFail); |
|
1267 } |
|
1268 } |
|
1269 } |
|
1270 |
|
1271 /** |
|
1272 * Process command that will result in call to DMMCSocket::PowerUp kernel side |
|
1273 * |
|
1274 * @param aSection The section in the ini containing data for the command |
|
1275 * |
|
1276 * @return void |
|
1277 * |
|
1278 * @leave System wide error |
|
1279 */ |
|
1280 void CT_MMCSDSocketDriverData::DoCmdPowerUpL(const TDesC& aSection, TInt aAsyncErrorIndex) |
|
1281 { |
|
1282 INFO_PRINTF1(_L("DoCmdSocketPowerUpL called()")); |
|
1283 CActiveCallbackWrap* activeCallbackWrap = CreateActiveCallbackL(RMMCSDTestControllerInterface::ESocketPowerUp, GetExpectedAsyncError(aSection)); |
|
1284 iMmcSDController->SocketPowerUp(activeCallbackWrap->ActiveCallback().iStatus); |
|
1285 activeCallbackWrap->ActiveCallback().Activate(aAsyncErrorIndex); |
|
1286 IncOutstanding(); |
|
1287 } |