First public contribution.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
18 #include "T_MmcSDSocketDriverData.h"
19 #include "MmcTestUtils.h"
22 //MMCSD Commands index
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");
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");
76 _LIT(KDoorOpened, "dooropened");
77 _LIT(KStandby, "standby");
79 // DLocalDrive::TRequestId enum strings
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");
99 /** Enum as a descriptor Enum integar value
100 * In this case these enums represent DLocalDrive::TRequestId
104 const CDataWrapperBase::TEnumEntryTable CT_MMCSDSocketDriverData::iEnumTRequestIdTable [] =
106 // Enum as a descriptor Enum
113 KForceMediaChange, 6,
117 KReadPasswordStore, 10,
118 KWritePasswordStore, 11,
119 KPasswordStoreLengthInBytes, 12,
123 KGetLastErrorInfo, 16,
124 KInvalidRequestId, -1
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");
136 /** Enum as a descriptor Enum integar value
137 * In this case these enums represent TPBusState
141 const CDataWrapperBase::TEnumEntryTable CT_MMCSDSocketDriverData::iEnumTPBusStateTable [] =
143 // Enum as a descriptor Enum
144 KPBusCardAbsent, EBusCardAbsent,
146 KPBusPoweringUp, EBusPoweringUp,
148 KPBusPsuFault, EBusPsuFault,
149 KPBusPowerUpPending, EBusPowerUpPending,
153 // TPBusType enum strings
154 _LIT(KPBusTypeNone, "EPBusTypeNone");
155 _LIT(KPBusTypePcCard, "EPBusTypePcCard");
156 _LIT(KPBusTypeMultiMedia, "EPBusTypeMultiMedia");
157 _LIT(KPBusTypeUSB, "EPBusTypeUSB");
158 _LIT(KInvalidType, "EInvalidType");
160 /** Enum as a descriptor Enum integar value
161 * In this case these enums represent TPBusType
165 const CDataWrapperBase::TEnumEntryTable CT_MMCSDSocketDriverData::iEnumTPBusTypeTable [] =
167 // Enum as a descriptor Enum
168 KPBusTypeNone, EBusTypeNone,
169 KPBusTypePcCard, EBusTypePcCard,
170 KPBusTypeMultiMedia, EBusTypeMultiMedia,
171 KPBusTypeUSB, EBusTypeUSB,
179 * Create a new Socket Driver Data wrapper
181 * @return A Socket Driver Data wrapper
183 * @leave System wide error
185 CT_MMCSDSocketDriverData* CT_MMCSDSocketDriverData::NewL()
187 CT_MMCSDSocketDriverData* ret=new (ELeave) CT_MMCSDSocketDriverData();
188 CleanupStack::PushL(ret);
190 CleanupStack::Pop(ret);
199 CT_MMCSDSocketDriverData::CT_MMCSDSocketDriverData()
200 : CT_MmcSDDriverData()
205 * Second phase construction
209 * @leave System wide error
211 void CT_MMCSDSocketDriverData::ConstructL()
213 CT_MmcSDDriverData::ConstructL();
221 CT_MMCSDSocketDriverData::~CT_MMCSDSocketDriverData()
226 * Return a pointer to the object that the data wraps
228 * @return pointer to the object that the data wraps
230 TAny* CT_MMCSDSocketDriverData::GetObject()
232 // Can't use DMMCSocket type on user side, so get pointer from Controller
233 TAny* socketPtr = NULL;
234 iMmcSDController->Socket(&socketPtr);
239 * Process a command read from the script file
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
245 * @return ETrue if the command is processed
247 * @leave System wide error
249 TBool CT_MMCSDSocketDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
253 if( aCommand == KCmdAdjustPartialRead )
255 DoCmdAdjustPartialRead(aSection);
257 else if( aCommand==KCmdCardIsPresent )
259 DoCmdCardIsPresent(aSection);
261 else if( aCommand == KCmdGetBufferInfo )
263 DoCmdGetBufferInfo(aSection);
265 else if( aCommand == KCmdInit )
269 else if( aCommand == KCmdInitiatePowerUpSequence )
271 DoCmdInitiatePowerUpSequence();
273 else if( aCommand==KCmdMachineInfo )
275 DoCmdMachineInfo(aSection);
277 else if( aCommand == KCmdPrepareStore )
279 DoCmdPrepareStore(aSection);
281 else if( aCommand == KCmdReset1 )
285 else if( aCommand == KCmdReset2 )
289 else if( aCommand == KCmdResetInactivity )
291 DoCmdResetInactivity(aSection);
293 else if( aCommand == KCmdStack )
295 DoCmdStack(aSection);
297 else if (aCommand == KCmdiState_Get)
299 DoCmdiState_Get(aSection);
301 else if (aCommand == KCmdiType_Get)
303 DoCmdiType_Get(aSection);
305 else if (aCommand == KCmdiDoorOpened_Get)
307 DoCmdiDoorOpened_Get(aSection);
309 else if (aCommand == KCmdiStandby_Get)
311 DoCmdiStandby_Get(aSection);
313 else if (aCommand == KCmdPowerUp)
315 DoCmdPowerUpL(aSection, aAsyncErrorIndex);
319 ret=CT_MmcSDDriverData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
326 * Process command to call DMMCSocket::AdjustPartialRead
328 * @param aSection The section in the ini containing data for the command
332 void CT_MMCSDSocketDriverData::DoCmdAdjustPartialRead(const TDesC& aSection)
334 TPartialReadData prd;
336 if( !GetUintFromConfig(aSection, KPrdStart(), prd.iStart) )
338 ERR_PRINTF1(_L("Physical Start value not given in ini file"));
339 SetBlockResult(EFail);
341 else if( !GetUintFromConfig(aSection, KPrdEnd(), prd.iEnd) )
343 ERR_PRINTF1(_L("Physical End value not given in ini file"));
344 SetBlockResult(EFail);
348 INFO_PRINTF3(_L("Calling MMCSocket::AdjustPartialRead(start=%u, end=%u)"), prd.iStart, prd.iEnd);
349 TInt err = iMmcSDController->SocketAdjustPartialRead(prd);
351 if( err != KErrNone )
353 ERR_PRINTF2(_L("MMCSocket::AdjustPartialRead() Error %d"), err);
358 INFO_PRINTF3(_L("MMCSocket::AdjustPartialRead() = %u, %u"), prd.iPhysStart, prd.iPhysEnd);
361 if( GetUintFromConfig(aSection, KPrdExpectedStart(), expectedStart) )
363 if( prd.iPhysStart != expectedStart )
365 ERR_PRINTF3(_L("phys start(%u) != expectedStart(%u)"), prd.iPhysStart, expectedStart);
366 SetBlockResult(EFail);
371 ERR_PRINTF1(_L("Expected Start value not given in ini file"));
372 SetBlockResult(EFail);
376 if( GetUintFromConfig(aSection, KPrdExpectedEnd(), expectedEnd) )
378 if( prd.iPhysEnd != expectedEnd )
380 ERR_PRINTF3(_L("phys end(%u) != expected end(%u)"), prd.iPhysEnd, expectedEnd);
381 SetBlockResult(EFail);
386 ERR_PRINTF1(_L("Expected End value not given in ini file"));
387 SetBlockResult(EFail);
394 * Process command to call DMMCSocket::CardIsPresent
396 * @param aSection The section in the ini containing data for the command
400 void CT_MMCSDSocketDriverData::DoCmdCardIsPresent(const TDesC& aSection)
402 TBool cardPresent = EFalse;
403 INFO_PRINTF1(_L("Calling MMCSocket::CardIsPresent()"));
404 TInt err = iMmcSDController->SocketCardIsPresent(cardPresent);
408 ERR_PRINTF2(_L("MMCSocket::CardIsPresent() Error %d"), err);
413 INFO_PRINTF2(_L("MMCSocket::CardIsPresent() = %d"), cardPresent);
414 TBool expectedCardPresent;
415 if( GetBoolFromConfig(aSection, KCardPresent(), expectedCardPresent) )
417 if( cardPresent != expectedCardPresent )
419 ERR_PRINTF3(_L("cardPresent(%d) != expectedCardPresent(%d)"), cardPresent, expectedCardPresent);
420 SetBlockResult(EFail);
425 ERR_PRINTF1(_L("Expected CardPresent value not given in ini file"));
426 SetBlockResult(EFail);
432 * Process command to call DMMCSocket::GetBufferInfo
434 * @param aSection The section in the ini containing data for the command
438 void CT_MMCSDSocketDriverData::DoCmdGetBufferInfo(const TDesC& aSection)
440 TBufferInfo bufferInfo;
441 INFO_PRINTF1(_L("Calling MMCSocket::GetBufferInfo()"));
442 TInt err = iMmcSDController->SocketGetBufferInfo(bufferInfo);
443 if( err != KErrNone )
445 ERR_PRINTF2(_L("MMCSocket::GetBufferInfo() Error %d"), err);
450 INFO_PRINTF3(_L("GetBufferInfo() iBuf(%x) iBufLen(%d)"),
451 bufferInfo.iBuf, bufferInfo.iBufLen);
453 // check the optional expected length
455 if( GetIntFromConfig(aSection, KExpectedBufLen(), expectedBufLen) )
457 if( bufferInfo.iBufLen != expectedBufLen )
459 ERR_PRINTF3(_L("bufferInfo.iBufLen (%d) != expectedBufLen(%d)"), bufferInfo.iBufLen , expectedBufLen);
460 SetBlockResult(EFail);
467 * Process command to call DMMCSocket::Init
471 void CT_MMCSDSocketDriverData::DoCmdInit()
473 INFO_PRINTF1(_L("Calling MMCSocket::Init()"));
474 TInt err = iMmcSDController->SocketInit();
478 ERR_PRINTF2(_L("MMCSocket::Init() Error %d"), err);
484 * Process command to call DMMCSocket::InitiatePowerUpSequence
488 void CT_MMCSDSocketDriverData::DoCmdInitiatePowerUpSequence()
490 INFO_PRINTF1(_L("Calling MMCSocket::InitiatePowerUpSequence()"));
491 TInt err = iMmcSDController->SocketInitiatePowerUpSequence();
492 if( err != KErrNone )
494 ERR_PRINTF2(_L("MMCSocket::InitiatePowerUpSequence() Error %d"), err);
500 * Process command to call DMMCSocket::MachineInfo
502 * @param aSection The section in the ini containing data for the command
506 void CT_MMCSDSocketDriverData::DoCmdMachineInfo(const TDesC& aSection)
508 TMachineInfo machineInfo;
509 INFO_PRINTF1(_L("Calling MMCSocket::MachineInfo()"));
510 TInt err = iMmcSDController->SocketMachineInfo(machineInfo);
511 if( err != KErrNone )
513 ERR_PRINTF2(_L("MMCSocket::MachineInfo() Error %d"), err);
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);
524 if( machineInfo.iSupportsSPIMode )
526 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsSPIMode"));
528 if( machineInfo.iSupportsDoubleBuffering )
530 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsDoubleBuffering"));
532 if( machineInfo.iSupportsR7 )
534 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsR7"));
536 if( machineInfo.iDma8BitAddressing )
538 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma8BitAddressing"));
540 if( machineInfo.iDma16BitAddressing )
542 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma16BitAddressing"));
544 if( machineInfo.iDma32BitAddressing )
546 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma32BitAddressing"));
548 if( machineInfo.iDma64BitAddressing )
550 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EDma64BitAddressing"));
552 if( machineInfo.iSupportsDMA )
554 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag ESupportsDMA"));
556 if( machineInfo.iMaxTransferLength_256K )
558 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_256K"));
560 if( machineInfo.iMaxTransferLength_512K )
562 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_512K"));
564 if( machineInfo.iMaxTransferLength_1M )
566 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_1M"));
568 if( machineInfo.iMaxTransferLength_2M )
570 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_2M"));
572 if( machineInfo.iMaxTransferLength_4M )
574 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_4M"));
576 if( machineInfo.iMaxTransferLength_8M )
578 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_8M"));
580 if( machineInfo.iMaxTransferLength_16M )
582 INFO_PRINTF1(_L("MMCSocket::MachineInfo(): Has flag EMaxTransferLength_16M"));
588 if( GetIntFromConfig(aSection, KExpectedTotalSockets(), expectedInt) )
590 if( machineInfo.iTotalSockets != expectedInt )
592 ERR_PRINTF3(_L("totalSockets(%d) != expectedTotalSockets(%d)"), machineInfo.iTotalSockets, expectedInt);
593 SetBlockResult(EFail);
598 ERR_PRINTF1(_L("Expected Total Sockets not given in ini file"));
599 SetBlockResult(EFail);
602 if( GetIntFromConfig(aSection, KExpectedTotalMediaChanges(), expectedInt) )
604 if( machineInfo.iTotalMediaChanges != expectedInt )
606 ERR_PRINTF3(_L("totalMediaChanges(%d) != expectedTotalMediaChanges(%d)"), machineInfo.iTotalMediaChanges, expectedInt);
607 SetBlockResult(EFail);
612 ERR_PRINTF1(_L("Expected Media Changes not given in ini file"));
613 SetBlockResult(EFail);
616 if( GetIntFromConfig(aSection, KExpectedTotalPrimarySupplies(), expectedInt) )
618 if( machineInfo.iTotalPrimarySupplies != expectedInt )
620 ERR_PRINTF3(_L("totalPrimarySupplies(%d) != expectedTotalPrimarySupplies(%d)"), machineInfo.iTotalPrimarySupplies, expectedInt);
621 SetBlockResult(EFail);
626 ERR_PRINTF1(_L("Expected Primary Supplies not given in ini file"));
627 SetBlockResult(EFail);
630 if( GetBoolFromConfig(aSection, KExpectedSPIMode(), expectedBool) )
632 if( machineInfo.iSPIMode != expectedBool )
634 ERR_PRINTF3(_L("SPIMode(%d) != expectedSPIMode(%d)"), machineInfo.iSPIMode, expectedBool);
635 SetBlockResult(EFail);
640 ERR_PRINTF1(_L("Expected SPI Mode not given in ini file"));
641 SetBlockResult(EFail);
644 if( GetIntFromConfig(aSection, KExpectedBaseBusNumber(), expectedInt) )
646 if( machineInfo.iBaseBusNumber != expectedInt )
648 ERR_PRINTF3(_L("baseBusNumber(%d) != expectedBaseBusNumber(%d)"), machineInfo.iBaseBusNumber, expectedInt);
649 SetBlockResult(EFail);
654 ERR_PRINTF1(_L("Expected Base Bus Number not given in ini file"));
655 SetBlockResult(EFail);
658 if( GetBoolFromConfig(aSection, KHasFlagSupportsSPIMode(), expectedBool) )
660 if( machineInfo.iSupportsSPIMode != expectedBool )
662 ERR_PRINTF3(_L("supportsSPIMode(%d) != expectedSupportsSPIMode(%d)"), machineInfo.iSupportsSPIMode, expectedBool);
663 SetBlockResult(EFail);
668 ERR_PRINTF1(_L("Has Flag Supports SPI Mode not given in ini file"));
669 SetBlockResult(EFail);
672 if( GetBoolFromConfig(aSection, KHasFlagSupportsDoubleBuffering(), expectedBool) )
674 if( machineInfo.iSupportsDoubleBuffering != expectedBool )
676 ERR_PRINTF3(_L("supportsDoubleBuffering(%d) != expectedSupportsDoubleBuffering(%d)"), machineInfo.iSupportsDoubleBuffering, expectedBool);
677 SetBlockResult(EFail);
682 ERR_PRINTF1(_L("Has Flag Supports Double Buffering not given in ini file"));
683 SetBlockResult(EFail);
686 if( GetBoolFromConfig(aSection, KHasFlagSupportsR7(), expectedBool) )
688 if( machineInfo.iSupportsR7 != expectedBool )
690 ERR_PRINTF3(_L("supportsR7(%d) != expectedSupportsR7(%d)"), machineInfo.iSupportsR7, expectedBool);
691 SetBlockResult(EFail);
696 ERR_PRINTF1(_L("Has Flag Supports R7 not given in ini file"));
697 SetBlockResult(EFail);
700 if( GetBoolFromConfig(aSection, KHasFlagDma8BitAddressing(), expectedBool) )
702 if( machineInfo.iDma8BitAddressing != expectedBool )
704 ERR_PRINTF3(_L("Dma8BitAddressing(%d) != expectedDma8BitAddressing(%d)"), machineInfo.iDma8BitAddressing, expectedBool);
705 SetBlockResult(EFail);
710 ERR_PRINTF1(_L("Has Flag Dma 8Bit Addressing not given in ini file"));
711 SetBlockResult(EFail);
714 if( GetBoolFromConfig(aSection, KHasFlagDma16BitAddressing(), expectedBool) )
716 if( machineInfo.iDma16BitAddressing != expectedBool )
718 ERR_PRINTF3(_L("Dma16BitAddressing(%d) != expectedDma16BitAddressing(%d)"), machineInfo.iDma16BitAddressing, expectedBool);
719 SetBlockResult(EFail);
724 ERR_PRINTF1(_L("Has Flag Dma 16Bit Addressing not given in ini file"));
725 SetBlockResult(EFail);
728 if( GetBoolFromConfig(aSection, KHasFlagDma32BitAddressing(), expectedBool) )
730 if( machineInfo.iDma32BitAddressing != expectedBool )
732 ERR_PRINTF3(_L("Dma32BitAddressing(%d) != expectedDma32BitAddressing(%d)"), machineInfo.iDma32BitAddressing, expectedBool);
733 SetBlockResult(EFail);
738 ERR_PRINTF1(_L("Has Flag Dma 32Bit Addressing not given in ini file"));
739 SetBlockResult(EFail);
742 if( GetBoolFromConfig(aSection, KHasFlagDma64BitAddressing(), expectedBool) )
744 if( machineInfo.iDma64BitAddressing != expectedBool )
746 ERR_PRINTF3(_L("Dma64BitAddressing(%d) != expectedDma64BitAddressing(%d)"), machineInfo.iDma64BitAddressing, expectedBool);
747 SetBlockResult(EFail);
752 ERR_PRINTF1(_L("Has Flag Dma 64Bit Addressing not given in ini file"));
753 SetBlockResult(EFail);
756 if( GetBoolFromConfig(aSection, KHasFlagSupportsDMA(), expectedBool) )
758 if( machineInfo.iSupportsDMA != expectedBool )
760 ERR_PRINTF3(_L("SupportsDMA(%d) != expectedSupportsDMA(%d)"), machineInfo.iSupportsDMA, expectedBool);
761 SetBlockResult(EFail);
766 ERR_PRINTF1(_L("Has Flag Supports DMA not given in ini file"));
767 SetBlockResult(EFail);
770 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_256K(), expectedBool) )
772 if( machineInfo.iMaxTransferLength_256K != expectedBool )
774 ERR_PRINTF3(_L("maxTransferLength_256K(%d) != expectedMaxTransferLength_256K(%d)"), machineInfo.iMaxTransferLength_256K, expectedBool);
775 SetBlockResult(EFail);
780 ERR_PRINTF1(_L("Has Flag Max Transfer Length 256K not given in ini file"));
781 SetBlockResult(EFail);
784 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_512K(), expectedBool) )
786 if( machineInfo.iMaxTransferLength_512K != expectedBool )
788 ERR_PRINTF3(_L("maxTransferLength_512K(%d) != expectedMaxTransferLength_512K(%d)"), machineInfo.iMaxTransferLength_512K, expectedBool);
789 SetBlockResult(EFail);
794 ERR_PRINTF1(_L("Has Flag Max Transfer Length 512K not given in ini file"));
795 SetBlockResult(EFail);
798 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_1M(), expectedBool) )
800 if( machineInfo.iMaxTransferLength_1M != expectedBool )
802 ERR_PRINTF3(_L("maxTransferLength_1M(%d) != expectedMaxTransferLength_1M(%d)"), machineInfo.iMaxTransferLength_1M, expectedBool);
803 SetBlockResult(EFail);
808 ERR_PRINTF1(_L("Has Flag Max Transfer Length 1M not given in ini file"));
809 SetBlockResult(EFail);
812 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_2M(), expectedBool) )
814 if( machineInfo.iMaxTransferLength_2M != expectedBool )
816 ERR_PRINTF3(_L("maxTransferLength_2M(%d) != expectedMaxTransferLength_2M(%d)"), machineInfo.iMaxTransferLength_2M, expectedBool);
817 SetBlockResult(EFail);
822 ERR_PRINTF1(_L("Has Flag Max Transfer Length 2M not given in ini file"));
823 SetBlockResult(EFail);
826 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_4M(), expectedBool) )
828 if( machineInfo.iMaxTransferLength_4M != expectedBool )
830 ERR_PRINTF3(_L("maxTransferLength_4M(%d) != expectedMaxTransferLength_4M(%d)"), machineInfo.iMaxTransferLength_4M, expectedBool);
831 SetBlockResult(EFail);
836 ERR_PRINTF1(_L("Has Flag Max Transfer Length 4M not given in ini file"));
837 SetBlockResult(EFail);
840 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_8M(), expectedBool) )
842 if( machineInfo.iMaxTransferLength_8M != expectedBool )
844 ERR_PRINTF3(_L("maxTransferLength_8M(%d) != expectedMaxTransferLength_8M(%d)"), machineInfo.iMaxTransferLength_8M, expectedBool);
845 SetBlockResult(EFail);
850 ERR_PRINTF1(_L("Has Flag Max Transfer Length 8M not given in ini file"));
851 SetBlockResult(EFail);
854 if( GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_16M(), expectedBool) )
856 if( machineInfo.iMaxTransferLength_16M != expectedBool )
858 ERR_PRINTF3(_L("maxTransferLength_16M(%d) != expectedMaxTransferLength_16M(%d)"), machineInfo.iMaxTransferLength_16M, expectedBool);
859 SetBlockResult(EFail);
864 ERR_PRINTF1(_L("Has Flag Max Transfer Length 16M not given in ini file"));
865 SetBlockResult(EFail);
871 * Process command to call DMMCSocket::PrepareStore
873 * @param aSection The section in the ini containing data for the command
877 void CT_MMCSDSocketDriverData::DoCmdPrepareStore(const TDesC& aSection)
879 TPasswordPrepareStoreData pwdData;
883 if( !GetIntFromConfig(aSection, KBusNumber(), pwdData.iBus) )
885 ERR_PRINTF1(_L("Bus Number not given in ini file"));
886 SetBlockResult(EFail);
888 else if( !GetStringFromConfig(aSection, KOldPassword(), oldPassword) )
890 ERR_PRINTF1(_L("Old password value not given in ini file"));
891 SetBlockResult(EFail);
893 else if( !GetStringFromConfig(aSection, KNewPassword(), newPassword) )
895 ERR_PRINTF1(_L("New password value not given in ini file"));
896 SetBlockResult(EFail);
898 else if( !GetEnumFromConfig(aSection, KPrepStoreFunc(), iEnumTRequestIdTable, pwdData.iFunc) )
900 ERR_PRINTF1(_L("Function ID not given in ini file"));
901 SetBlockResult(EFail);
905 pwdData.iOldPassword.Copy(oldPassword);
906 pwdData.iNewPassword.Copy(newPassword);
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 )
912 ERR_PRINTF2(_L("MMCSocket::PrepareStore() Error %d"), err);
919 * Process command to call DMMCSocket::Reset1
923 void CT_MMCSDSocketDriverData::DoCmdReset1()
925 INFO_PRINTF1(_L("Calling MMCSocket::Reset1()"));
926 TInt err = iMmcSDController->SocketReset1();
927 if( err != KErrNone )
929 ERR_PRINTF2(_L("MMCSocket::Reset1() Error %d"), err);
935 * Process command to call DMMCSocket::Reset2
939 void CT_MMCSDSocketDriverData::DoCmdReset2()
941 INFO_PRINTF1(_L("Calling MMCSocket::Reset2()"));
942 TInt err = iMmcSDController->SocketReset2();
943 if( err != KErrNone )
945 ERR_PRINTF2(_L("MMCSocket::Reset2() Error %d"), err);
951 * Process command to call DMMCSocket::ResetInactivity
953 * @param aSection The section in the ini containing data for the command
957 void CT_MMCSDSocketDriverData::DoCmdResetInactivity(const TDesC& aSection)
960 if( GetIntFromConfig(aSection, KBusNumber(), busNumber) )
962 INFO_PRINTF2(_L("Calling MMCSocket::ResetInactivity(bus=%d)"), busNumber);
963 TInt err = iMmcSDController->SocketResetInactivity(busNumber);
964 if( err != KErrNone )
966 ERR_PRINTF2(_L("MMCSocket::ResetInactivity() Error %d"), err);
972 ERR_PRINTF1(_L("Bus Number not given in ini file"));
973 SetBlockResult(EFail);
978 * Process command to call DMMCSocket::Stack
980 * @param aSection The section in the ini containing data for the command
984 void CT_MMCSDSocketDriverData::DoCmdStack(const TDesC& aSection)
987 if( GetIntFromConfig(aSection, KBusNumber(), stackPtr.iBus) )
989 INFO_PRINTF2(_L("Calling MMCSocket::Stack(%d)"), stackPtr.iBus);
990 TInt err = iMmcSDController->SocketStack(stackPtr);
994 ERR_PRINTF2(_L("MMCSocket::Stack() Error %d"), err);
999 INFO_PRINTF2(_L("MMCSocket::Stack(): ptr=%x"), stackPtr.iStackPtr);
1000 TBool expectedIsNull;
1001 if( GetBoolFromConfig(aSection, KIsNull(), expectedIsNull) )
1003 if( expectedIsNull )
1005 if( stackPtr.iStackPtr != NULL )
1007 ERR_PRINTF1(_L("Stack ptr is not NULL"));
1008 SetBlockResult(EFail);
1013 if( stackPtr.iStackPtr == NULL )
1015 ERR_PRINTF1(_L("Stack ptr is NULL"));
1016 SetBlockResult(EFail);
1020 TAny* expectedStackPtr = NULL;
1021 err = iMmcSDController->Stack(&expectedStackPtr);
1024 ERR_PRINTF2(_L("MMCStack Error %d"), err);
1025 SetBlockResult(EFail);
1027 else if( stackPtr.iStackPtr != expectedStackPtr )
1029 ERR_PRINTF3(_L("stackPtr(%x) != expectedStackPtr(%x)"), stackPtr.iStackPtr, expectedStackPtr);
1030 SetBlockResult(EFail);
1037 ERR_PRINTF1(_L("Expected Is Null not given in ini file"));
1038 SetBlockResult(EFail);
1044 ERR_PRINTF1(_L("Bus Number not given in ini file"));
1045 SetBlockResult(EFail);
1050 * Process command that will result in getting DMMCSocket::iState kernel side
1052 * @param aSection The section in the ini containing data for the command
1056 * @leave System wide error
1058 void CT_MMCSDSocketDriverData::DoCmdiState_Get(const TDesC& aSection)
1061 TInt err = iMmcSDController->SocketiState_Get(state);
1065 ERR_PRINTF2(_L("MMCSocket::iState() Error %d"), err);
1072 case EBusCardAbsent:
1074 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusCardAbsent(%d)"), state);
1079 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusOff(%d)"), state);
1082 case EBusPoweringUp:
1084 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusPoweringUp(%d)"), state);
1089 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusOn(%d)"), state);
1094 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusPsuFault(%d)"), state);
1097 case EBusPowerUpPending:
1099 INFO_PRINTF2(_L("MMCSocket::iState()=EPBusPowerUpPending(%d)"), state);
1104 INFO_PRINTF2(_L("MMCSocket::iState() Unknown state=%d"), state);
1110 if( GetEnumFromConfig(aSection, KState(), iEnumTPBusStateTable, expectedState) )
1112 if( state != expectedState )
1114 ERR_PRINTF3(_L("State (%d) != Expected state (%d)"), state, expectedState);
1115 SetBlockResult(EFail);
1120 ERR_PRINTF1(_L("Expected state not given in ini file"));
1121 SetBlockResult(EFail);
1127 * Process command that will result in getting DMMCSocket::iStandby kernel side
1129 * @param aSection The section in the ini containing data for the command
1133 * @leave System wide error
1135 void CT_MMCSDSocketDriverData::DoCmdiStandby_Get(const TDesC& aSection)
1138 TInt err = iMmcSDController->SocketiStandby_Get(standby);
1142 ERR_PRINTF2(_L("MMCSocket::iStandby() Error %d"), err);
1147 INFO_PRINTF2(_L("MMCSocket::iStandby()=%d"), standby);
1148 TBool expectedStandby;
1149 if( GetBoolFromConfig(aSection, KStandby(), expectedStandby) )
1151 if( standby != expectedStandby )
1153 ERR_PRINTF3(_L("Standby (%d) != Expected standby (%d)"), standby, expectedStandby);
1154 SetBlockResult(EFail);
1159 ERR_PRINTF1(_L("Expected standby not given in ini file"));
1160 SetBlockResult(EFail);
1166 * Process command that will result in getting DMMCSocket::iDoorOpened kernel side
1168 * @param aSection The section in the ini containing data for the command
1172 * @leave System wide error
1174 void CT_MMCSDSocketDriverData::DoCmdiDoorOpened_Get(const TDesC& aSection)
1177 TInt err = iMmcSDController->SocketiDoorOpened_Get(doorOpened);
1181 ERR_PRINTF2(_L("MMCSocket::iDoorOpened() Error %d"), err);
1186 INFO_PRINTF2(_L("MMCSocket::iDoorOpened()=%d"), doorOpened);
1187 TBool expectedDoorOpened;
1188 if( GetBoolFromConfig(aSection, KDoorOpened(), expectedDoorOpened) )
1190 if( doorOpened != expectedDoorOpened )
1192 ERR_PRINTF3(_L("DoorOpened (%d) != Expected doorOpened (%d)"), doorOpened, expectedDoorOpened);
1193 SetBlockResult(EFail);
1198 ERR_PRINTF1(_L("Expected doorOpened not given in ini file"));
1199 SetBlockResult(EFail);
1205 * Process command that will result in getting DMMCSocket::iType kernel side
1207 * @param aSection The section in the ini containing data for the command
1211 * @leave System wide error
1213 void CT_MMCSDSocketDriverData::DoCmdiType_Get(const TDesC& aSection)
1216 TInt err = iMmcSDController->SocketiType_Get(type);
1220 ERR_PRINTF2(_L("MMCSocket::iType() Error %d"), err);
1229 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypeNone(%d)"), type);
1232 case EBusTypePcCard:
1234 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypePcCard(%d)"), type);
1237 case EBusTypeMultiMedia:
1239 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypeMultiMedia(%d)"), type);
1244 INFO_PRINTF2(_L("MMCSocket::iType()=EPBusTypeUSB(%d)"), type);
1249 INFO_PRINTF2(_L("MMCSocket::iType() Unknown type=%d"), type);
1255 if( GetEnumFromConfig(aSection, KType(), iEnumTPBusTypeTable, expectedType) )
1257 if( type != expectedType )
1259 ERR_PRINTF3(_L("Type (%d) != Expected type (%d)"), type, expectedType);
1260 SetBlockResult(EFail);
1265 ERR_PRINTF1(_L("Expected type not given in ini file"));
1266 SetBlockResult(EFail);
1272 * Process command that will result in call to DMMCSocket::PowerUp kernel side
1274 * @param aSection The section in the ini containing data for the command
1278 * @leave System wide error
1280 void CT_MMCSDSocketDriverData::DoCmdPowerUpL(const TDesC& aSection, TInt aAsyncErrorIndex)
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);