os/boardsupport/haitest/bspsvs/suite/bsp/mmc/src/T_MmcSDStackDriverData.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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_MmcSDStackDriverData.h"
    19 #include "MmcTestUtils.h"
    20 
    21 //MMCSD Commands index
    22 /*@{*/
    23 
    24 _LIT(KCmdStackAdjustPartialRead, 						"AdjustPartialRead");
    25 _LIT(KCmdStackAllocSession, 							"AllocSession");
    26 _LIT(KCmdStackBufferInfo, 								"BufferInfo");
    27 _LIT(KCmdStackDemandPagingInfo, 						"DemandPagingInfo");
    28 _LIT(KCmdStackEffectiveModes, 							"EffectiveModes");
    29 _LIT(KCmdStackAlterEffectiveModes, 						"AlterEffectiveModes");
    30 _LIT(KCmdStackGetBufferInfo, 							"GetBufferInfo");
    31 _LIT(KCmdStackHasCardsPresent, 							"HasCardsPresent");
    32 _LIT(KCmdStackHasSessionsQueued, 						"HasSessionsQueued");
    33 _LIT(KCmdStackInit, 									"Init");
    34 _LIT(KCmdStackInitStackInProgress, 						"InitStackInProgress");
    35 _LIT(KCmdStackMMCSocket, 								"MMCSocket");
    36 _LIT(KCmdStackMachineInfo, 								"MachineInfo");
    37 _LIT(KCmdStackMaxCardsInStack, 							"MaxCardsInStack");
    38 _LIT(KCmdStackReadPasswordStore, 						"ReadPasswordStore");
    39 _LIT(KCmdStackWritePasswordStore, 						"WritePasswordStore");
    40 _LIT(KCmdStackProgramPeriodInMs, 						"ProgramPeriodMs");
    41 _LIT(KCmdStackStop, 									"Stop");
    42 _LIT(KCmdStackReportPowerUp, 							"ReportPowerUp");
    43 _LIT(KCmdStackReportPowerDown, 							"ReportPowerDown");
    44 _LIT(KCmdStackCardP, 									"CardP");
    45 
    46 // ini file tags
    47 _LIT(KPrdStart, 										"prdstart");
    48 _LIT(KPrdEnd, 											"prdend");
    49 _LIT(KPrdExpectedStart, 								"expectedprdstart");
    50 _LIT(KPrdExpectedEnd, 									"expectedprdend");
    51 _LIT(KExpectedBufLen, 									"expectedBuflen");
    52 _LIT(KExpectedMinorBufLen, 								"expectedMinorBuflen");
    53 _LIT(KExpectedMaxCardsInStack, 							"maxcards");
    54 _LIT(KProgramPeriodMs, 									"programperiodms");
    55 _LIT(KInProgress, 										"inprogress");
    56 _LIT(KSessionsQueued, 									"sessionsqueued");
    57 _LIT(KCardsPresent, 									"cardspresent");
    58 _LIT(KExpectedTotalSockets, 							"expectedtotalsockets");
    59 _LIT(KExpectedTotalMediaChanges, 						"expectedtotalmediachanges");
    60 _LIT(KExpectedTotalPrimarySupplies, 					"expectedtotalprimarysupplies");
    61 _LIT(KExpectedSPIMode, 									"expectedspimode");
    62 _LIT(KExpectedBaseBusNumber, 							"expectedbasebusnumber");
    63 _LIT(KHasFlagSupportsSPIMode, 							"hasflagsupportsspimode");
    64 _LIT(KHasFlagSupportsDoubleBuffering, 					"hasflagsupportsdoublebuffering");
    65 _LIT(KHasFlagSupportsR7, 								"hasflagsupportsr7");
    66 _LIT(KHasFlagDma8BitAddressing, 						"hasflagdma8bitaddressing");
    67 _LIT(KHasFlagDma16BitAddressing, 						"hasflagdma16bitaddressing");
    68 _LIT(KHasFlagDma32BitAddressing, 						"hasflagdma32bitaddressing");
    69 _LIT(KHasFlagDma64BitAddressing, 						"hasflagdma64bitaddressing");
    70 _LIT(KHasFlagSupportsDMA, 								"hasflagsupportsdma");
    71 _LIT(KHasFlagMaxTransferLength_256K, 					"hasflagmaxtransferlength256k");
    72 _LIT(KHasFlagMaxTransferLength_512K, 					"hasflagmaxtransferlength512k");
    73 _LIT(KHasFlagMaxTransferLength_1M, 						"hasflagmaxtransferlength1m");
    74 _LIT(KHasFlagMaxTransferLength_2M, 						"hasflagmaxtransferlength2m");
    75 _LIT(KHasFlagMaxTransferLength_4M, 						"hasflagmaxtransferlength4m");
    76 _LIT(KHasFlagMaxTransferLength_8M, 						"hasflagmaxtransferlength8m");
    77 _LIT(KHasFlagMaxTransferLength_16M, 					"hasflagmaxtransferlength16m");
    78 _LIT(KPassword, 										"password");
    79 _LIT(KIsNull, 											"isnull");
    80 _LIT(KEffectiveModes, 									"effectivemodes");
    81 _LIT(KEffectiveModesFunctionId, 						"emfunctionid");
    82 _LIT(KEffectiveModesData, 								"emdata");
    83 _LIT(KDriveCount, 										"drivecount");
    84 _LIT(KNumPages, 										"numpages");
    85 _LIT(KPagingType, 										"pagingtype");
    86 _LIT(KWriteProtected, 									"writeprotected");
    87 _LIT(KCardNumber, 										"cardnumber");
    88 _LIT(KSocketWrapperName,								"socketwrappername");
    89 
    90 
    91 // TEffectiveModesFunctionId enum strings
    92 _LIT(KEffectiveModesRemoveMode, 						"EEffectiveModesRemoveMode");
    93 _LIT(KEffectiveModesSetBusClockInKhz, 					"EEffectiveModesSetBusClockInKhz");
    94 _LIT(KEffectiveModesSetBusyTimeOutInMcs, 				"EEffectiveModesSetBusyTimeOutInMcs");
    95 _LIT(KEffectiveModesSetCRCRetries, 						"EEffectiveModesSetCRCRetries");
    96 _LIT(KEffectiveModesSetDataTimeOutInMcs, 				"EEffectiveModesSetDataTimeOutInMcs");
    97 _LIT(KEffectiveModesSetMode, 							"EEffectiveModesSetMode");
    98 _LIT(KEffectiveModesSetOpCondBusyTimeout, 				"EEffectiveModesSetOpCondBusyTimeout");
    99 _LIT(KEffectiveModesSetPollAttempts, 					"EEffectiveModesSetPollAttempts");
   100 _LIT(KEffectiveModesSetResponseTimeOutInTicks,			"EEffectiveModesSetResponseTimeOutInTicks");
   101 _LIT(KEffectiveModesSetTicksClockIn, 					"EEffectiveModesSetTicksClockIn");
   102 _LIT(KEffectiveModesSetTicksClockOut, 					"EEffectiveModesSetTicksClockOut");
   103 _LIT(KEffectiveModesSetTimeOutRetries, 					"EEffectiveModesSetTimeOutRetries");
   104 _LIT(KInvalidEffectiveModesFunctionId,					"EInvalidEffectiveModesFunctionId");	
   105 
   106 /**	Enum as a descriptor  				Enum integar value													
   107  *	In this case these enums represent TEffectiveModesFunctionId
   108  *                                                                             
   109  * 																											      							
   110  */																														
   111 const CDataWrapperBase::TEnumEntryTable	CT_MMCSDStackDriverData::iEnumEffectiveModesFunctionIdTable [] =
   112 	{
   113 //	Enum as a descriptor								Enum
   114 	KEffectiveModesRemoveMode,							RMMCSDTestControllerInterface::EStackEffectiveModesRemoveMode,
   115 	KEffectiveModesSetBusClockInKhz,					RMMCSDTestControllerInterface::EStackEffectiveModesSetBusClockInKhz,
   116 	KEffectiveModesSetBusyTimeOutInMcs,					RMMCSDTestControllerInterface::EStackEffectiveModesSetBusyTimeOutInMcs,
   117 	KEffectiveModesSetCRCRetries,						RMMCSDTestControllerInterface::EStackEffectiveModesSetCRCRetries,
   118 	KEffectiveModesSetDataTimeOutInMcs,					RMMCSDTestControllerInterface::EStackEffectiveModesSetDataTimeOutInMcs,
   119 	KEffectiveModesSetMode,								RMMCSDTestControllerInterface::EStackEffectiveModesSetMode,
   120 	KEffectiveModesSetOpCondBusyTimeout,				RMMCSDTestControllerInterface::EStackEffectiveModesSetOpCondBusyTimeout,
   121 	KEffectiveModesSetPollAttempts,						RMMCSDTestControllerInterface::EStackEffectiveModesSetPollAttempts,
   122 	KEffectiveModesSetResponseTimeOutInTicks,			RMMCSDTestControllerInterface::EStackEffectiveModesSetResponseTimeOutInTicks,
   123 	KEffectiveModesSetTicksClockIn,						RMMCSDTestControllerInterface::EStackEffectiveModesSetTicksClockIn,
   124 	KEffectiveModesSetTicksClockOut,					RMMCSDTestControllerInterface::EStackEffectiveModesSetTicksClockOut,
   125 	KEffectiveModesSetTimeOutRetries,					RMMCSDTestControllerInterface::EStackEffectiveModesSetTimeOutRetries,
   126 	KInvalidEffectiveModesFunctionId,					-1
   127 	};
   128 
   129 /*@}*/
   130 
   131 //////////////////////////////////////////////////////////////////////
   132 // Construction/Destruction
   133 //////////////////////////////////////////////////////////////////////
   134 
   135 /**
   136  * static Construction
   137  *
   138  *
   139  * @return					A pointer to T_MMCSDStackDriverData
   140  *
   141  * @leave					System wide error
   142  */
   143 CT_MMCSDStackDriverData* CT_MMCSDStackDriverData::NewL()
   144 	{
   145 	CT_MMCSDStackDriverData* ret = new (ELeave) CT_MMCSDStackDriverData();
   146 	CleanupStack::PushL(ret);
   147 	ret->ConstructL();
   148 	CleanupStack::Pop(ret);
   149 	return ret;
   150 	}
   151 
   152 
   153 /**
   154  * Constructor
   155  *
   156  * @return					N/A
   157  *
   158  * @leave					N/A
   159  */
   160 CT_MMCSDStackDriverData::CT_MMCSDStackDriverData()
   161 : CT_MmcSDDriverData()
   162 	{
   163 	}
   164 
   165 /**
   166  * 2nd Phase constructor
   167  *
   168  *
   169  * @return					void
   170  *
   171  * @leave					System wide error
   172  */
   173 void CT_MMCSDStackDriverData::ConstructL()
   174 	{
   175 	CT_MmcSDDriverData::ConstructL();
   176 	}
   177 
   178 /**
   179  * Destructor
   180  *
   181  * @return					N/A
   182  *
   183  * @leave					N/A
   184  */
   185 CT_MMCSDStackDriverData::~CT_MMCSDStackDriverData()
   186 	{
   187 	}
   188 
   189 /**
   190  * Process a command read from the script file
   191  *
   192  * @param aCommand			The command to process
   193  * @param aSection			The section in the ini containing data for the command
   194  * @param aAsyncErrorIndex	Command index for async calls to return errors to
   195  *
   196  * @return					ETrue if the command is processed
   197  *
   198  * @leave					System wide error
   199  */
   200 TBool CT_MMCSDStackDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
   201 	{
   202 	TBool ret = ETrue;
   203 
   204 	if (aCommand == KCmdStackAdjustPartialRead)
   205 		{
   206 		DoCmdAdjustPartialRead(aSection);
   207 		}
   208 	else if (aCommand == KCmdStackAllocSession)
   209 		{
   210 		DoCmdAllocSession();
   211 		}
   212 	else if (aCommand == KCmdStackBufferInfo)
   213 		{
   214 		DoCmdBufferInfo(aSection);
   215 		}
   216 	else if (aCommand == KCmdStackDemandPagingInfo)
   217 		{
   218 		DoCmdDemandPagingInfo(aSection);
   219 		}
   220 	else if (aCommand == KCmdStackEffectiveModes)
   221 		{
   222 		DoCmdEffectiveModes(aSection);
   223 		}
   224 	else if (aCommand == KCmdStackGetBufferInfo)
   225 		{
   226 		DoCmdGetBufferInfo(aSection);
   227 		}
   228 	else if (aCommand == KCmdStackHasCardsPresent)
   229 		{
   230 		DoCmdHasCardsPresent(aSection);
   231 		}
   232 	else if (aCommand == KCmdStackHasSessionsQueued)
   233 		{
   234 		DoCmdHasSessionsQueued(aSection);
   235 		}
   236 	else if (aCommand == KCmdStackInit)
   237 		{
   238 		DoCmdInit();
   239 		}
   240 	else if (aCommand == KCmdStackInitStackInProgress)
   241 		{
   242 		DoCmdInitStackInProgress(aSection);
   243 		}
   244 	else if (aCommand == KCmdStackMMCSocket)
   245 		{
   246 		DoCmdMMCSocketL(aSection);
   247 		}
   248 	else if (aCommand == KCmdStackMachineInfo)
   249 		{
   250 		DoCmdMachineInfo(aSection);
   251 		}
   252 	else if (aCommand == KCmdStackMaxCardsInStack)
   253 		{
   254 		DoCmdMaxCardsInStack(aSection);
   255 		}
   256 	else if (aCommand == KCmdStackReadPasswordStore)
   257 		{
   258 		DoCmdPasswordStore(aSection);
   259 		}
   260 	else if (aCommand == KCmdStackWritePasswordStore)
   261 		{
   262 		DoCmdWritePasswordStore(aSection);
   263 		}
   264 	else if (aCommand == KCmdStackProgramPeriodInMs)
   265 		{
   266 		DoCmdProgramPeriodInMilliSeconds(aSection);
   267 		}
   268 	else if (aCommand == KCmdStackStop)
   269 		{
   270 		DoCmdStop(aSection);
   271 		}
   272 	else if (aCommand == KCmdStackReportPowerUp)
   273 		{
   274 		DoCmdReportPowerUp(aSection);
   275 		}
   276 	else if (aCommand == KCmdStackReportPowerDown)
   277 		{
   278 		DoCmdReportPowerDown(aSection);
   279 		}
   280 	else if (aCommand == KCmdStackCardP)
   281 		{
   282 		DoCmdCardP(aSection);
   283 		}
   284 	else if (aCommand == KCmdStackAlterEffectiveModes)
   285 		{
   286 		DoCmdAlterEffectiveModes(aSection);
   287 		}
   288 	else
   289 		{
   290 		ret = CT_MmcSDDriverData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
   291 		}
   292 	return ret;
   293 	}
   294 
   295 
   296 /**
   297  * Process command that will result in call to DMMCStack::AdjustPartial kernel side
   298  *
   299  * @param aSection			The section in the ini containing data for the command
   300  *
   301  * @return					void
   302  *
   303  * @leave					System wide error
   304  */
   305 void  CT_MMCSDStackDriverData::DoCmdAdjustPartialRead(const TDesC& aSection)
   306 	{
   307 	TPartialReadData prd;
   308 	prd.iStart = 0;
   309 	prd.iEnd = 0;
   310 
   311 	if(! GetUintFromConfig(aSection, KPrdStart(), prd.iStart) )
   312 		{
   313 		ERR_PRINTF1(_L("Failed to get prdstart from ini file"));
   314 		SetBlockResult(EFail);
   315 		}
   316 
   317 	if(!GetUintFromConfig(aSection, KPrdEnd(), prd.iEnd))
   318 		{
   319 		ERR_PRINTF1(_L("Failed to get prdend from ini file"));
   320 		SetBlockResult(EFail);		
   321 		}
   322 
   323 	INFO_PRINTF3(_L("Calling MMCStack::AdjustPartialRead(start=%d, end=%d)"), prd.iStart, prd.iEnd);
   324 	TInt err = iMmcSDController->StackAdjustPartialRead(prd);
   325 
   326 	if (err != KErrNone)
   327 		{
   328 		ERR_PRINTF2(_L("MMCStack::AdjustPartialRead() Error %d"), err);
   329 		SetError(err);
   330 		}
   331 	else
   332 		{
   333 		INFO_PRINTF3(_L("MMCStack::AdjustPartialRead() = %d, %d"), prd.iPhysStart, prd.iPhysEnd);
   334 
   335 		TUint expectedStart;
   336 		if( !GetUintFromConfig(aSection, KPrdExpectedStart(), expectedStart) )
   337 			{
   338 			ERR_PRINTF1(_L("Failed to get KPrdExpectedStart from ini file"));
   339 			SetBlockResult(EFail);
   340 			}
   341 								
   342 		else if(prd.iPhysStart != expectedStart )
   343 			{
   344 			ERR_PRINTF3(_L("phys start(%d) != expectedStart(%d)"), prd.iPhysStart, expectedStart);
   345 			SetBlockResult(EFail);
   346 			}
   347 
   348 		TUint expectedEnd;
   349 		if( !GetUintFromConfig(aSection, KPrdExpectedEnd(), expectedEnd) )
   350 			{
   351 			ERR_PRINTF1(_L("Failed to get KPrdExpectedEnd from ini file"));
   352 			SetBlockResult(EFail);			
   353 			}
   354 		else if(prd.iPhysEnd != expectedEnd )
   355 			{
   356 			ERR_PRINTF3(_L("MMCStack::AdjustPartialRead phys end(%d) != expected end(%d)"), prd.iPhysEnd, expectedEnd);
   357 			SetBlockResult(EFail);
   358 			}
   359 		}
   360 	}
   361 
   362 /**
   363  * Process command that will result in call to DMMCStack::AllocSession kernel side
   364  *
   365  * @param aSection			The section in the ini containing data for the command
   366  *
   367  * @return					void
   368  *
   369  * @leave					System wide error
   370  */
   371 void  CT_MMCSDStackDriverData::DoCmdAllocSession()
   372 	{
   373 	INFO_PRINTF1(_L("Calling MMCStack::AllocSession()"));
   374 	iMmcSDController->StackAllocSession();
   375 	}
   376 
   377 /**
   378  * Process command that will result in call to DMMCStack::BufferInfo kernel side
   379  *
   380  * @param aSection			The section in the ini containing data for the command
   381  *
   382  * @return					void
   383  *
   384  * @leave					System wide error
   385  */
   386 void CT_MMCSDStackDriverData::DoCmdBufferInfo(const TDesC& aSection)
   387 	{
   388 	TBufferInfo bufferInfo;
   389 	INFO_PRINTF1(_L("Calling MMCStack::BufferInfo()"));
   390 	TInt err = iMmcSDController->StackBufferInfo(bufferInfo);
   391 	if (err != KErrNone)
   392 		{
   393 		ERR_PRINTF2(_L("MMCStack::BufferInfo() Error %d"), err);
   394 		SetError(err);
   395 		}
   396 	else
   397 		{
   398 		INFO_PRINTF4(_L("BufferInfo() iBuf(%x) iBufLen(%d) iMinorBufLen(%d)"),
   399 				bufferInfo.iBuf, bufferInfo.iBufLen, bufferInfo.iMinorBufLen);
   400 
   401 		// check the expected length
   402 		TInt expectedBufLen;
   403 		if( ! GetIntFromConfig(aSection, KExpectedBufLen(), expectedBufLen ))
   404 			{
   405 			ERR_PRINTF1(_L("Failed to get KExpectedBufLen from ini file"));
   406 			SetBlockResult(EFail);
   407 			}
   408 		
   409 		else if(bufferInfo.iBufLen != expectedBufLen )
   410 			{
   411 			ERR_PRINTF3(_L("bufferInfo.iBufLen (%d) != expectedBufLen(%d)"),
   412 					bufferInfo.iBufLen , expectedBufLen);
   413 			SetBlockResult(EFail);
   414 			}
   415 
   416 		// check the expected minor length
   417 		TInt expectedMinorBufLen;
   418 		if( !GetIntFromConfig(aSection, KExpectedMinorBufLen(), expectedMinorBufLen ))
   419 			{
   420 			ERR_PRINTF1(_L("Failed to get KExpectedMinorBufLen from ini file"));
   421 			SetBlockResult(EFail);
   422 			}
   423 		else if(bufferInfo.iMinorBufLen != expectedMinorBufLen )
   424 			{
   425 			ERR_PRINTF3(_L("bufferInfo.iMinorBufLen (%d) != expectedMinorBufLen(%d)"),
   426 					bufferInfo.iMinorBufLen , expectedMinorBufLen);
   427 			SetBlockResult(EFail);
   428 			}
   429 		}
   430 	}
   431 
   432 /**
   433  * Process command that will result in call to DMMCStack::GetBufferInfo kernel side
   434  *
   435  * @param aSection			The section in the ini containing data for the command
   436  *
   437  * @return					void
   438  *
   439  * @leave					System wide error
   440  */
   441 void CT_MMCSDStackDriverData::DoCmdGetBufferInfo(const TDesC& aSection)
   442 	{
   443 	TBufferInfo bufferInfo;
   444 	INFO_PRINTF1(_L("Calling MMCStack::GetBufferInfo()"));
   445 	TInt err = iMmcSDController->StackGetBufferInfo(bufferInfo);
   446 	if (err != KErrNone)
   447 		{
   448 		ERR_PRINTF2(_L("MMCStack::GetBufferInfo() Error %d"), err);
   449 		SetError(err);
   450 		}
   451 	else
   452 		{
   453 		INFO_PRINTF3(_L("GetBufferInfo() iBuf(%x) iBufLen(%d)"),
   454 				bufferInfo.iBuf, bufferInfo.iBufLen);
   455 
   456 		// check the expected length
   457 		TInt expectedBufLen;
   458 		if( !GetIntFromConfig(aSection, KExpectedBufLen(), expectedBufLen ))
   459 			{
   460 			ERR_PRINTF1(_L("Failed to get KExpectedBufLen from ini file"));
   461 			SetBlockResult(EFail);
   462 			}
   463 		else if(bufferInfo.iBufLen != expectedBufLen )
   464 			{
   465 			ERR_PRINTF3(_L("bufferInfo.iBufLen (%d) != expectedBufLen(%d)"),
   466 					bufferInfo.iBufLen , expectedBufLen);
   467 			SetBlockResult(EFail);
   468 			}
   469 		}
   470 	}
   471 
   472 /**
   473  * Process command that will result in call to DMMCStack::DemandPagingInfo kernel side
   474  *
   475  * @param aSection			The section in the ini containing data for the command
   476  *
   477  * @return					void
   478  *
   479  * @leave					System wide error
   480  */
   481 void CT_MMCSDStackDriverData::DoCmdDemandPagingInfo(const TDesC& aSection)
   482 	{
   483 	TTCDemandPagingInfo info;
   484 	INFO_PRINTF1(_L("Calling MMCStack::DemandPagingInfo()"));
   485 	TInt err = iMmcSDController->StackDemandPagingInfo(info);
   486 	
   487 	if(err != KErrNone)
   488 		{
   489 		ERR_PRINTF2(_L("MMCStack::DemandPagingInfo() Error %d"), err);
   490 		SetError(err);
   491 		}
   492 	else
   493 		{
   494 		INFO_PRINTF4(_L("info.iPagingDriveList(%x) info.iDriveCount(%d) info.iPagingType(%d)"),
   495 				info.iPagingDriveList, info.iDriveCount, info.iPagingType);
   496 		INFO_PRINTF4(_L("info.iReadShift(%d) info.iNumPages(%d) info.iWriteProtected(%d)"),
   497 				info.iReadShift, info.iNumPages, info.iWriteProtected);
   498 		
   499 		// read expected values here		
   500 		TInt driveCount;
   501 		if(!GetIntFromConfig(aSection, KDriveCount(), driveCount))
   502 			{
   503 			ERR_PRINTF1(_L("Failed to read KDriveCount from ini file"));
   504 			SetBlockResult(EFail);
   505 			}
   506 		else
   507 			{
   508 			if(driveCount != info.iDriveCount)
   509 				{
   510 				ERR_PRINTF3(_L("drive counts do not match actual(%d), expected(%d)"), info.iDriveCount, driveCount);
   511 				SetBlockResult(EFail);				
   512 				}	
   513 			}
   514 
   515 		TUint pagingType;
   516 		if(!GetUintFromConfig(aSection, KPagingType(), pagingType))
   517 			{
   518 			ERR_PRINTF1(_L("Failed to read pagingType from ini file"));
   519 			SetBlockResult(EFail);
   520 			}
   521 		else
   522 			{
   523 			if(pagingType != info.iPagingType)
   524 				{
   525 				ERR_PRINTF3(_L("pagingType do not match actual(%d), expected(%d)"), info.iPagingType, pagingType);
   526 				SetBlockResult(EFail);				
   527 				}	
   528 			}
   529 		
   530 		
   531 		TUint numPages;
   532 		if(!GetUintFromConfig(aSection, KNumPages(), numPages))
   533 			{
   534 			ERR_PRINTF1(_L("Failed to read num pages from ini file"));
   535 			SetBlockResult(EFail);
   536 			}
   537 		else
   538 			{
   539 			if(numPages != info.iNumPages)
   540 				{
   541 				ERR_PRINTF3(_L("numPages do not match actual(%d), expected(%d)"), info.iNumPages, numPages);
   542 				SetBlockResult(EFail);				
   543 				}	
   544 			}
   545 
   546 		TBool writeProtected;
   547 		if(!GetBoolFromConfig(aSection, KWriteProtected(), writeProtected))
   548 			{
   549 			ERR_PRINTF1(_L("Failed to read writeProtected from ini file"));
   550 			SetBlockResult(EFail);
   551 			}
   552 		else
   553 			{
   554 			if(writeProtected != info.iWriteProtected)
   555 				{
   556 				ERR_PRINTF3(_L("writeProtected do not match actual(%d), expected(%d)"), info.iWriteProtected, writeProtected);
   557 				SetBlockResult(EFail);				
   558 				}	
   559 			}
   560 		
   561 		}
   562 	}
   563 
   564 /**
   565  * Process command that will result in call to DMMCStack::EffectiveModes kernel side
   566  *
   567  * @param aSection			The section in the ini containing data for the command
   568  *
   569  * @return					void
   570  *
   571  * @leave					System wide error
   572  */
   573 void CT_MMCSDStackDriverData::DoCmdEffectiveModes(const TDesC& aSection)
   574 	{
   575 	INFO_PRINTF1(_L("Calling MMCStack::EffectiveModes()"));
   576 
   577 	TUint32 actualModes;
   578 	TInt err = iMmcSDController->StackEffectiveModes(actualModes);
   579 	if (err != KErrNone)
   580 		{
   581 		ERR_PRINTF2(_L("DMMCStack::EffectiveModes() Error (%d)"), err);
   582 		SetError(err);
   583 		}
   584 	else
   585 		{
   586 		INFO_PRINTF3(_L("DMMCStack::EffectiveModes() modes(0x%x / %d)"), actualModes, actualModes);
   587 
   588 		TInt expectedModes;
   589 		if(GetHexFromConfig(aSection, KEffectiveModes(), expectedModes))
   590 			{
   591 
   592 			if(((TUint32)expectedModes) != actualModes)
   593 				{
   594 				ERR_PRINTF5(_L("actual (%d)(%x) and expected(%d)(%x) effectiveModes do not match"), actualModes, actualModes, expectedModes, expectedModes);
   595 				SetBlockResult(EFail);
   596 				}
   597 			}
   598 		else
   599 			{
   600 			ERR_PRINTF1(_L("DMMCStack::EffectiveModes() Could not read expectedModes from ini file"));
   601 			SetError(err);
   602 			}
   603 		}
   604 	}
   605 
   606 /**
   607  * Process command that will result in an update of Effective Modes variable on kernel side
   608  * for a call to DMMCStack::EffectiveModes
   609  *
   610  * @param aSection			The section in the ini containing data for the command
   611  *
   612  * @return					void
   613  *
   614  * @leave					System wide error
   615  */
   616 void CT_MMCSDStackDriverData::DoCmdAlterEffectiveModes(const TDesC& aSection)
   617 	{	
   618 	TInt	funcId;
   619 	TUint	data;
   620 	
   621 	// read funtion ID from section
   622 	if (!GetEnumFromConfig(aSection, KEffectiveModesFunctionId(), iEnumEffectiveModesFunctionIdTable, funcId))
   623 		{
   624 		ERR_PRINTF1(_L("Failed to read Function ID DoCmdEffectiveModes"));
   625 		SetBlockResult(EFail);
   626 		}
   627 	// read data param from section - all params are 32 bit or less	
   628 	else if (!GetUintFromConfig(aSection, KEffectiveModesData(), data))
   629 		{
   630 		ERR_PRINTF2(_L("Failed to read DATA DoCmdEffectiveModes funcId(%d)"), funcId);
   631 		SetBlockResult(EFail);
   632 		}
   633 	else
   634 		{
   635 		INFO_PRINTF3( _L("Calling DoCmdEffectiveModes funcid(%d) data(%u)"), funcId, data);
   636 		TInt err = iMmcSDController->StackAlterEffectiveModes((RMMCSDTestControllerInterface::TEffectiveModesFunctionId) funcId, (TAny*)data);
   637 		if (err != KErrNone)
   638 			{
   639 			ERR_PRINTF3(_L("DoCmdEffectiveModes funcid(%d) Error(%d"), funcId, err);
   640 			SetError(err);
   641 			}
   642 		}
   643 	}
   644 
   645 /**
   646  * Process command that will result in call to DMMCStack::HasCardsPresent kernel side
   647  *
   648  * @param aSection			The section in the ini containing data for the command
   649  *
   650  * @return					void
   651  *
   652  * @leave					System wide error
   653  */
   654 void CT_MMCSDStackDriverData::DoCmdHasCardsPresent(const TDesC& aSection)
   655 	{
   656 	INFO_PRINTF1( _L("CT_MMCSDStackDriverData:::DoCmdHasCardsPresent called"));
   657 
   658 	TBool actualCardspresent;
   659 	TInt err = iMmcSDController->StackHasCardsPresent(actualCardspresent);
   660 	if (err != KErrNone)
   661 		{
   662 		ERR_PRINTF2(_L("DMMCStack::DoCmdHasCardsPresent() Error (%d)"), err);
   663 		SetError(err);
   664 		}
   665 	else
   666 		{
   667 		INFO_PRINTF2(_L("DMMCStack::DoCmdHasCardsPresent() actual cards present (%d)"), actualCardspresent);
   668 
   669 		TBool expectedCardsPresent;
   670 		if(!GetBoolFromConfig(aSection, KCardsPresent(), expectedCardsPresent))
   671 			{
   672 			ERR_PRINTF1(_L("Failed to get KCardsPresent from ini file"));
   673 			SetBlockResult(EFail);
   674 			}
   675 		else if(actualCardspresent != expectedCardsPresent)
   676 			{
   677 			ERR_PRINTF3(_L("actual (%d) and expected(%d) cards present do not match"), actualCardspresent, expectedCardsPresent);
   678 			SetBlockResult(EFail);
   679 			}
   680 		}
   681 	}
   682 
   683 /**
   684  * Process command that will result in call to DMMCStack::HasSessionsQueued kernel side
   685  *
   686  * @param aSection			The section in the ini containing data for the command
   687  *
   688  * @return					void
   689  *
   690  * @leave					System wide error
   691  */
   692 void CT_MMCSDStackDriverData::DoCmdHasSessionsQueued(const TDesC& aSection)
   693 	{
   694 	INFO_PRINTF1( _L(" CT_MMCSDStackDriverData::DoCmdHasSessionsQueued called"));
   695 
   696 	TBool actualSessionsQueued;
   697 	TInt err = iMmcSDController->StackHasSessionsQueued(actualSessionsQueued);
   698 
   699 	if (err != KErrNone)
   700 		{
   701 		ERR_PRINTF2(_L("DMMCStack::DoCmdHasSessionsQueued() Error (%d)"), err);
   702 		SetError(err);
   703 		}
   704 	else
   705 		{
   706 		INFO_PRINTF2(_L("DMMCStack::DoCmdHasSessionsQueued() actual sessions queued (%d)"), actualSessionsQueued);
   707 
   708 		TBool expectedInProgress;
   709 		if(!GetBoolFromConfig(aSection, KSessionsQueued(), expectedInProgress))
   710 			{
   711 			ERR_PRINTF1(_L("Failed to get KSessionsQueued from ini file"));
   712 			SetBlockResult(EFail);
   713 			}
   714 		else if(actualSessionsQueued != expectedInProgress)
   715 			{
   716 			ERR_PRINTF3(_L("actual (%d) and expected(%d) sessions queued do not match"), actualSessionsQueued, expectedInProgress);
   717 			SetBlockResult(EFail);
   718 			}
   719 		}
   720 	}
   721 /**
   722  * Process command that will result in call to DMMCStack::InitStackInProgress kernel side
   723  *
   724  * @param aSection			The section in the ini containing data for the command
   725  *
   726  * @return					void
   727  *
   728  * @leave					System wide error
   729  */
   730 void CT_MMCSDStackDriverData::DoCmdInitStackInProgress(const TDesC& aSection)
   731 	{
   732 	INFO_PRINTF1( _L(" CT_MMCSDStackDriverData::DoCmdInitStackInProgress called"));
   733 
   734 	TBool actualInProgress;
   735 	TInt err = iMmcSDController->StackInitStackInProgress(actualInProgress);
   736 
   737 	if (err != KErrNone)
   738 		{
   739 		ERR_PRINTF2(_L("DMMCStack::InitStackInProgress() Error (%d)"), err);
   740 		SetError(err);
   741 		}
   742 	else
   743 		{
   744 		INFO_PRINTF2(_L("DMMCStack::InitStackInProgress() actualInProgress(%d)"), actualInProgress);
   745 
   746 		TBool expectedInProgress;
   747 		if(!GetBoolFromConfig(aSection, KInProgress(), expectedInProgress))
   748 			{
   749 			ERR_PRINTF1(_L("Failed to get KInProgress from ini file"));
   750 			SetBlockResult(EFail);
   751 			}
   752 		else if(actualInProgress != expectedInProgress)
   753 			{
   754 			ERR_PRINTF3(_L("actual (%d) and expected(%d) in progress do not match"), actualInProgress, expectedInProgress);
   755 			SetBlockResult(EFail);
   756 			}
   757 		}
   758 	}
   759 
   760 /**
   761  * Process command that will result in call to DMMCStack::MMCSocket kernel side
   762  *
   763  * @param aSection			The section in the ini containing data for the command
   764  *
   765  * @return					void
   766  *
   767  * @leave					System wide error
   768  */
   769 void CT_MMCSDStackDriverData::DoCmdMMCSocketL(const TDesC& aSection)
   770 	{
   771 	INFO_PRINTF1( _L(" CT_MMCSDStackDriverData::DoCmdMMCSocket called"));
   772 	// can't use DMMCSocket type on user side
   773 	TAny* socketPtr= NULL;
   774 
   775 	TInt err = iMmcSDController->StackMMCSocket(&socketPtr);
   776 
   777 	if (err!=KErrNone)
   778 		{
   779 		ERR_PRINTF2(_L("MMCStack::Socket() Error %d"), err);
   780 		SetError(err);
   781 		}
   782 	else
   783 		{
   784 		INFO_PRINTF2(_L("MMCStack::Socket(): ptr=%x"), socketPtr);
   785 		TBool expectedIsNull = EFalse;
   786 		if(!GetBoolFromConfig(aSection, KIsNull(), expectedIsNull))
   787 			{
   788 			ERR_PRINTF1(_L("Failed to get isnull from ini file"));
   789 			SetBlockResult(EFail);
   790 			}
   791 
   792 		if (expectedIsNull)
   793 			{
   794 			if (socketPtr != NULL)
   795 				{
   796 				ERR_PRINTF1(_L("Socket ptr is not NULL"));
   797 				SetBlockResult(EFail);
   798 				}
   799 			}
   800 		else
   801 			{
   802 			if (!socketPtr)
   803 				{
   804 				ERR_PRINTF1(_L("Socket ptr is NULL"));
   805 				SetBlockResult(EFail);
   806 				}
   807 			else
   808 				{
   809 				TPtrC	socketWrapperName;
   810 				if( GetStringFromConfig(aSection, KSocketWrapperName(), socketWrapperName) )
   811 					{
   812 					TAny* expectedSocketPtr = GetDataObjectL(socketWrapperName);
   813 					INFO_PRINTF2(_L("expectedSocketPtr = %x"), expectedSocketPtr);
   814 
   815 					if( expectedSocketPtr == NULL )
   816 						{
   817 						ERR_PRINTF1(_L("MMCStack::Socket(): expectedSocketPtr is NULL"));
   818 						SetBlockResult(EFail);
   819 						}
   820 					else if( socketPtr != expectedSocketPtr )
   821 						{
   822 						ERR_PRINTF3(_L("socketPtr(%x) != expectedSocketPtr(%x)"), socketPtr, expectedSocketPtr);
   823 						SetBlockResult(EFail);
   824 						}
   825 					}
   826 				else
   827 					{
   828 					ERR_PRINTF1(_L("MMCStack::Socket(): Error in Socket Wrapper Name from INI file"));
   829 					SetBlockResult(EFail);
   830 					}
   831 				}
   832 			}
   833 		}
   834 	}
   835 
   836 /**
   837  * Process command that will result in call to DMMCStack::MachineInfo kernel side
   838  *
   839  * @param aSection			The section in the ini containing data for the command
   840  *
   841  * @return					void
   842  *
   843  * @leave					System wide error
   844  */
   845 void CT_MMCSDStackDriverData::DoCmdMachineInfo(const TDesC& aSection)
   846 	{
   847 	INFO_PRINTF1( _L(" CT_MMCSDStackDriverData::DoCmdMachineInfo called XXX"));
   848 
   849 	TMachineInfo machineInfo;
   850 	TInt err = iMmcSDController->StackMachineInfo(machineInfo);
   851 
   852 	if (err !=KErrNone)
   853 		{
   854 		ERR_PRINTF2(_L("DMMCStack::MachineInfo() Error (%d)"), err);
   855 		SetError(err);
   856 		}
   857 	else
   858 		{
   859 		INFO_PRINTF2(_L("DMMCStack::MachineInfo(): iTotalSockets=%d"), machineInfo.iTotalSockets);
   860 		INFO_PRINTF2(_L("DMMCStack::MachineInfo(): iTotalMediaChanges=%d"), machineInfo.iTotalMediaChanges);
   861 		INFO_PRINTF2(_L("DMMCStack::MachineInfo(): iTotalPrimarySupplies=%d"), machineInfo.iTotalPrimarySupplies);
   862 		INFO_PRINTF2(_L("DMMCStack::MachineInfo(): iSPIMode=%d"), machineInfo.iSPIMode);
   863 		INFO_PRINTF2(_L("DMMCStack::MachineInfo(): iBaseBusNumber=%d"), machineInfo.iBaseBusNumber);
   864 
   865 		if (machineInfo.iSupportsSPIMode)
   866 			{
   867 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag ESupportsSPIMode"));
   868 			}
   869 		if (machineInfo.iSupportsDoubleBuffering)
   870 			{
   871 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag ESupportsDoubleBuffering"));
   872 			}
   873 		if (machineInfo.iSupportsR7)
   874 			{
   875 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag ESupportsR7"));
   876 			}
   877   		if( machineInfo.iDma8BitAddressing )
   878   			{
   879   			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EDma8BitAddressing"));
   880   			}
   881   		if( machineInfo.iDma16BitAddressing )
   882   			{
   883   			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EDma16BitAddressing"));
   884   			}
   885   		if( machineInfo.iDma32BitAddressing )
   886   			{
   887   			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EDma32BitAddressing"));
   888   			}
   889   		if( machineInfo.iDma64BitAddressing )
   890   			{
   891   			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EDma64BitAddressing"));
   892   			}
   893   		if( machineInfo.iSupportsDMA )
   894   			{
   895   			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag ESupportsDMA"));
   896   			}
   897 		if (machineInfo.iMaxTransferLength_256K)
   898 			{
   899 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EMaxTransferLength_256K"));
   900 			}
   901 		if (machineInfo.iMaxTransferLength_512K)
   902 			{
   903 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EMaxTransferLength_512K"));
   904 			}
   905 		if (machineInfo.iMaxTransferLength_1M)
   906 			{
   907 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EMaxTransferLength_1M"));
   908 			}
   909 		if (machineInfo.iMaxTransferLength_2M)
   910 			{
   911 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EMaxTransferLength_2M"));
   912 			}
   913 		if (machineInfo.iMaxTransferLength_4M)
   914 			{
   915 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EMaxTransferLength_4M"));
   916 			}
   917 		if (machineInfo.iMaxTransferLength_8M)
   918 			{
   919 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EMaxTransferLength_8M"));
   920 			}
   921 		if (machineInfo.iMaxTransferLength_16M)
   922 			{
   923 			INFO_PRINTF1(_L("DMMCStack::MachineInfo(): Has flag EMaxTransferLength_16M"));
   924 			}
   925 
   926 		TInt expectedInt;
   927 		TBool expectedBool;
   928 
   929 		if( !GetIntFromConfig(aSection, KExpectedTotalSockets(), expectedInt))
   930 			{
   931 			ERR_PRINTF1(_L("Failed to get KExpectedTotalSockets from ini file"));
   932 			SetBlockResult(EFail);
   933 			}
   934 		else if(machineInfo.iTotalSockets != expectedInt )
   935 			{
   936 			ERR_PRINTF3(_L("totalSockets(%d) != expectedTotalSockets(%d)"), machineInfo.iTotalSockets, expectedInt);
   937 			SetBlockResult(EFail);
   938 			}
   939 
   940 		if( !GetIntFromConfig(aSection, KExpectedTotalMediaChanges(), expectedInt))
   941 			{
   942 			ERR_PRINTF1(_L("Failed to get expected total media changes from ini file"));
   943 			SetBlockResult(EFail);
   944 			}
   945 		else if(machineInfo.iTotalMediaChanges != expectedInt )
   946 			{
   947 			ERR_PRINTF3(_L("totalMediaChanges(%d) != expectedTotalMediaChanges(%d)"), machineInfo.iTotalMediaChanges, expectedInt);
   948 			SetBlockResult(EFail);
   949 			}
   950 
   951 		if( !GetIntFromConfig(aSection, KExpectedTotalPrimarySupplies(), expectedInt))
   952 			{
   953 			ERR_PRINTF1(_L("Failed to get KExpectedTotalPrimarySupplies from ini file"));
   954 			SetBlockResult(EFail);
   955 			}
   956 		else if(machineInfo.iTotalPrimarySupplies != expectedInt )
   957 			{
   958 			ERR_PRINTF3(_L("totalPrimarySupplies(%d) != expectedTotalPrimarySupplies(%d)"), machineInfo.iTotalPrimarySupplies, expectedInt);
   959 			SetBlockResult(EFail);
   960 			}
   961 
   962 		if( !GetBoolFromConfig(aSection, KExpectedSPIMode(), expectedBool))
   963 			{
   964 			ERR_PRINTF1(_L("Failed to get KExpectedSPIMode from ini file"));
   965 			SetBlockResult(EFail);
   966 			}		
   967 		else if(machineInfo.iSPIMode != expectedBool )
   968 			{
   969 			ERR_PRINTF3(_L("SPIMode(%d) != expectedSPIMode(%d)"), machineInfo.iSPIMode, expectedBool);
   970 			SetBlockResult(EFail);
   971 			}
   972 
   973 		if( !GetIntFromConfig(aSection, KExpectedBaseBusNumber(), expectedInt))
   974 			{
   975 			ERR_PRINTF1(_L("Failed to get KExpectedBaseBusNumber from ini file"));
   976 			SetBlockResult(EFail);
   977 			}
   978 		else if(machineInfo.iBaseBusNumber != expectedInt )
   979 			{
   980 			ERR_PRINTF3(_L("baseBusNumber(%d) != expectedBaseBusNumber(%d)"), machineInfo.iBaseBusNumber, expectedInt);
   981 			SetBlockResult(EFail);
   982 			}
   983 
   984 		if( !GetBoolFromConfig(aSection, KHasFlagSupportsSPIMode(), expectedBool))
   985 			{
   986 			ERR_PRINTF1(_L("Failed to get KHasFlagSupportsSPIMode from ini file"));
   987 			SetBlockResult(EFail);
   988 			}
   989 		else if(machineInfo.iSupportsSPIMode != expectedBool )
   990 			{
   991 			ERR_PRINTF3(_L("supportsSPIMode(%d) != expectedSupportsSPIMode(%d)"), machineInfo.iSupportsSPIMode, expectedBool);
   992 			SetBlockResult(EFail);
   993 			}
   994 
   995 		if(!GetBoolFromConfig(aSection, KHasFlagSupportsDoubleBuffering(), expectedBool))
   996 			{
   997 			ERR_PRINTF1(_L("Failed to get KHasFlagSupportsDoubleBuffering from ini file"));
   998 			SetBlockResult(EFail);
   999 			}
  1000 		else if(machineInfo.iSupportsDoubleBuffering != expectedBool )
  1001 			{
  1002 			ERR_PRINTF3(_L("supportsDoubleBuffering(%d) != expectedSupportsDoubleBuffering(%d)"), machineInfo.iSupportsDoubleBuffering, expectedBool);
  1003 			SetBlockResult(EFail);
  1004 			}
  1005 
  1006 		if( !GetBoolFromConfig(aSection, KHasFlagSupportsR7(), expectedBool))
  1007 			{
  1008 			ERR_PRINTF1(_L("Failed to get KHasFlagSupportsR7 from ini file"));
  1009 			SetBlockResult(EFail);
  1010 
  1011 			}
  1012 		else if(machineInfo.iSupportsR7 != expectedBool )
  1013 			{
  1014 			ERR_PRINTF3(_L("supportsR7(%d) != expectedSupportsR7(%d)"), machineInfo.iSupportsR7, expectedBool);
  1015 			SetBlockResult(EFail);
  1016 			}
  1017 
  1018 		if( !GetBoolFromConfig(aSection, KHasFlagDma8BitAddressing(), expectedBool))
  1019 			{
  1020 			ERR_PRINTF1(_L("Failed to get KHasFlagDma8BitAddressing from ini file"));
  1021 			SetBlockResult(EFail);
  1022 			}
  1023 		else if(machineInfo.iDma8BitAddressing != expectedBool )
  1024 			{
  1025 			ERR_PRINTF3(_L("Dma8BitAddressing(%d) != expectedDma8BitAddressing(%d)"), machineInfo.iDma8BitAddressing, expectedBool);
  1026 			SetBlockResult(EFail);
  1027 			}
  1028 
  1029 		if( !GetBoolFromConfig(aSection, KHasFlagDma16BitAddressing(), expectedBool))
  1030 			{
  1031 			ERR_PRINTF1(_L("Failed to get KHasFlagDma16BitAddressing from ini file"));
  1032 			SetBlockResult(EFail);
  1033 			}
  1034 		else if(machineInfo.iDma16BitAddressing != expectedBool )
  1035 			{
  1036 			ERR_PRINTF3(_L("Dma16BitAddressing(%d) != expectedDma16BitAddressing(%d)"), machineInfo.iDma16BitAddressing, expectedBool);
  1037 			SetBlockResult(EFail);
  1038 			}		
  1039 
  1040 		if( !GetBoolFromConfig(aSection, KHasFlagDma32BitAddressing(), expectedBool))
  1041 			{
  1042 			ERR_PRINTF1(_L("Failed to get KHasFlagDma32BitAddressing from ini file"));
  1043 			SetBlockResult(EFail);
  1044 			}
  1045 		else if(machineInfo.iDma32BitAddressing != expectedBool )
  1046 			{
  1047 			ERR_PRINTF3(_L("Dma32BitAddressing(%d) != expectedDma32BitAddressing(%d)"), machineInfo.iDma32BitAddressing, expectedBool);
  1048 			SetBlockResult(EFail);
  1049 			}	
  1050 		
  1051 		if( !GetBoolFromConfig(aSection, KHasFlagDma64BitAddressing(), expectedBool))
  1052 			{
  1053 			ERR_PRINTF1(_L("Failed to get KHasFlagDma64BitAddressing from ini file"));
  1054 			SetBlockResult(EFail);
  1055 			}
  1056 		else if(machineInfo.iDma64BitAddressing != expectedBool )
  1057 			{
  1058 			ERR_PRINTF3(_L("Dma64BitAddressing(%d) != expectedDma64BitAddressing(%d)"), machineInfo.iDma64BitAddressing, expectedBool);
  1059 			SetBlockResult(EFail);
  1060 			}	
  1061 		
  1062 		if( !GetBoolFromConfig(aSection, KHasFlagSupportsDMA(), expectedBool))
  1063 			{
  1064 			ERR_PRINTF1(_L("Failed to get KHasFlagSupportsDMA from ini file"));
  1065 			SetBlockResult(EFail);
  1066 			}
  1067 		else if(machineInfo.iSupportsDMA != expectedBool )
  1068 			{
  1069 			ERR_PRINTF3(_L("SupportsDMA(%d) != expectedSupportsDMA(%d)"), machineInfo.iSupportsDMA, expectedBool);
  1070 			SetBlockResult(EFail);
  1071 			}			
  1072 	
  1073 		if( !GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_256K(), expectedBool))
  1074 			{
  1075 			ERR_PRINTF1(_L("Failed to get KHasFlagMaxTransferLength_256K( from ini file"));
  1076 			SetBlockResult(EFail);
  1077 			}
  1078 		else if(machineInfo.iMaxTransferLength_256K != expectedBool )
  1079 			{
  1080 			ERR_PRINTF3(_L("maxTransferLength_256K(%d) != expectedMaxTransferLength_256K(%d)"), machineInfo.iMaxTransferLength_256K, expectedBool);
  1081 			SetBlockResult(EFail);
  1082 			}
  1083 
  1084 		if( !GetBoolFromConfig(aSection,  KHasFlagMaxTransferLength_512K(), expectedBool))
  1085 			{
  1086 			ERR_PRINTF1(_L("Failed to get  KHasFlagMaxTransferLength_512K from ini file"));
  1087 			SetBlockResult(EFail);
  1088 
  1089 			}
  1090 		else if(machineInfo.iMaxTransferLength_512K != expectedBool )
  1091 			{
  1092 			ERR_PRINTF3(_L("maxTransferLength_512K(%d) != expectedMaxTransferLength_512K(%d)"), machineInfo.iMaxTransferLength_512K, expectedBool);
  1093 			SetBlockResult(EFail);
  1094 			}
  1095 
  1096 		if( !GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_1M(), expectedBool))
  1097 			{
  1098 			ERR_PRINTF1(_L("Failed to get KHasFlagMaxTransferLength_1M from ini file"));
  1099 			SetBlockResult(EFail);
  1100 
  1101 			}
  1102 		else if(machineInfo.iMaxTransferLength_1M != expectedBool )
  1103 			{
  1104 			ERR_PRINTF3(_L("maxTransferLength_1M(%d) != expectedMaxTransferLength_1M(%d)"), machineInfo.iMaxTransferLength_1M, expectedBool);
  1105 			SetBlockResult(EFail);
  1106 			}
  1107 
  1108 		if( !GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_2M(), expectedBool))
  1109 			{
  1110 			ERR_PRINTF1(_L("Failed to get KHasFlagMaxTransferLength_2M from ini file"));
  1111 			SetBlockResult(EFail);
  1112 
  1113 			}
  1114 		else if(machineInfo.iMaxTransferLength_2M != expectedBool )
  1115 			{
  1116 			ERR_PRINTF3(_L("maxTransferLength_2M(%d) != expectedMaxTransferLength_2M(%d)"), machineInfo.iMaxTransferLength_2M, expectedBool);
  1117 			SetBlockResult(EFail);
  1118 			}
  1119 
  1120 		if( !GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_4M(), expectedBool))
  1121 			{
  1122 			ERR_PRINTF1(_L("Failed to get KHasFlagMaxTransferLength_4M from ini file"));
  1123 			SetBlockResult(EFail);			
  1124 			}
  1125 		else if(machineInfo.iMaxTransferLength_4M != expectedBool )
  1126 			{
  1127 			ERR_PRINTF3(_L("maxTransferLength_4M(%d) != expectedMaxTransferLength_4M(%d)"), machineInfo.iMaxTransferLength_4M, expectedBool);
  1128 			SetBlockResult(EFail);
  1129 			}
  1130 
  1131 		if( !GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_8M(), expectedBool))
  1132 			{
  1133 			ERR_PRINTF1(_L("Failed to get KHasFlagMaxTransferLength_8M from ini file"));
  1134 			SetBlockResult(EFail);						
  1135 			}
  1136 		else if(machineInfo.iMaxTransferLength_8M != expectedBool )
  1137 			{
  1138 			ERR_PRINTF3(_L("maxTransferLength_8M(%d) != expectedMaxTransferLength_8M(%d)"), machineInfo.iMaxTransferLength_8M, expectedBool);
  1139 			SetBlockResult(EFail);
  1140 			}
  1141 
  1142 		if( !GetBoolFromConfig(aSection, KHasFlagMaxTransferLength_16M(), expectedBool))
  1143 			{
  1144 			ERR_PRINTF1(_L("Failed to get KHasFlagMaxTransferLength_16M from ini file"));
  1145 			SetBlockResult(EFail);			
  1146 
  1147 			}
  1148 		else if(machineInfo.iMaxTransferLength_16M != expectedBool )
  1149 			{
  1150 			ERR_PRINTF3(_L("maxTransferLength_16M(%d) != expectedMaxTransferLength_16M(%d)"), machineInfo.iMaxTransferLength_16M, expectedBool);
  1151 			SetBlockResult(EFail);
  1152 			}
  1153 		}
  1154 	}
  1155 
  1156 /**
  1157  * Process command that will result in call to DMMCStack::MaxCardsInStack kernel side
  1158  *
  1159  * @param aSection			The section in the ini containing data for the command
  1160  *
  1161  * @return					void
  1162  *
  1163  * @leave					System wide error
  1164  */
  1165 
  1166 void CT_MMCSDStackDriverData::DoCmdMaxCardsInStack(const TDesC& aSection)
  1167 	{
  1168 	INFO_PRINTF1( _L(" CT_MMCSDStackDriverData::DoCmdMaxCardsInStack called"));
  1169 
  1170 	TUint actualMaxCardsInStack;
  1171 	iMmcSDController->StackMaxCardsInStack(actualMaxCardsInStack);
  1172 
  1173 	TUint expectedMaxCardsInStack;
  1174 	if(!GetUintFromConfig(aSection, KExpectedMaxCardsInStack(), expectedMaxCardsInStack))
  1175 		{
  1176 		ERR_PRINTF1(_L("Failed to get  KExpectedMaxCardsInStack from ini file"));
  1177 		SetBlockResult(EFail);			
  1178 
  1179 		}
  1180 	else if(actualMaxCardsInStack != expectedMaxCardsInStack)
  1181 		{
  1182 		ERR_PRINTF3(_L("MaxCardsInStack actualMaxCardsInStack (%d) != expectedMaxCardsInStack(%d)")
  1183 				,actualMaxCardsInStack, expectedMaxCardsInStack);
  1184 		SetBlockResult(EFail);
  1185 		}
  1186 	}
  1187 
  1188 /**
  1189  * Process command that will result in call to DMMCStack::PasswordStore kernel side
  1190  * and retrieve the password in the store
  1191  *
  1192  * @param aSection			The section in the ini containing data for the command
  1193  *
  1194  * @return					void
  1195  *
  1196  * @leave					System wide error
  1197  */
  1198 void CT_MMCSDStackDriverData::DoCmdPasswordStore(const TDesC& aSection)
  1199 	{
  1200 	INFO_PRINTF1( _L(" CT_MMCSDStackDriverData::DoCmdPasswordStore called"));
  1201 
  1202 	TStackPasswordStoreData pwdStoreData;
  1203 	TInt err = iMmcSDController->StackReadPasswordStore(pwdStoreData);
  1204 
  1205 	if (err != KErrNone)
  1206 		{
  1207 		ERR_PRINTF2(_L("MMCStack::DoCmdPasswordStore() Error %d"), err);
  1208 		SetError(err);
  1209 		}
  1210 	else
  1211 		{
  1212 		if (!pwdStoreData.iPwdStorePtr)
  1213 			{
  1214 			ERR_PRINTF1(_L("MMCStack::DoCmdPasswordStore() retrieved a NULL pointer"));
  1215 			SetError(err);
  1216 			}
  1217 		else
  1218 			{
  1219 			INFO_PRINTF2( _L("Password Store ptr (%x)"), pwdStoreData.iPwdStorePtr);
  1220 
  1221 			TBuf<KMmcPwdLen> pwd;
  1222 			pwd.Copy(pwdStoreData.iPassword);
  1223 			INFO_PRINTF2( _L("PwdStore Password (%S)"), &pwd);
  1224 
  1225 			TPtrC tmp;
  1226 			if (GetStringFromConfig(aSection, KPassword(), tmp))
  1227 				{
  1228 				INFO_PRINTF2( _L("Expected password (%S)"), &tmp);
  1229 				if(tmp != pwd)
  1230 					{
  1231 					ERR_PRINTF1( _L("PASSWORD does not match"));
  1232 					SetBlockResult(EFail);
  1233 					}
  1234 				}
  1235 			else
  1236 				{
  1237 				ERR_PRINTF1( _L("failed to read password"));
  1238 				SetBlockResult(EFail);	
  1239 				}
  1240 			}
  1241 		}
  1242 	}
  1243 
  1244 /**
  1245  * Process command that will result in call to DMMCStack::PasswordStore kernel side
  1246  * and update the password in the store
  1247  *
  1248  * @param aSection			The section in the ini containing data for the command
  1249  *
  1250  * @return					void
  1251  *
  1252  * @leave					System wide error
  1253  */
  1254 void CT_MMCSDStackDriverData::DoCmdWritePasswordStore(const TDesC& aSection)
  1255 	{
  1256 
  1257 	INFO_PRINTF1( _L(" CT_MMCSDStackDriverData::DoCmdWritePasswordStore called"));
  1258 
  1259 	// read the password to set from ini file			
  1260 	TPtrC tmp;
  1261 	if (GetStringFromConfig(aSection, KPassword(), tmp))
  1262 		{
  1263 		INFO_PRINTF2( _L("Attempting to write password (%S) to password store"), &tmp);
  1264 
  1265 		TStackPasswordStoreData pwdStoreData;
  1266 		pwdStoreData.iPassword.Copy(tmp);
  1267 		TInt err = iMmcSDController->StackWritePasswordStore(pwdStoreData);
  1268 		if (err == KErrNone)
  1269 			{
  1270 			INFO_PRINTF1(_L("Wrote password ok"));
  1271 			}
  1272 		else
  1273 			{
  1274 			ERR_PRINTF2( _L("StackWritePasswordStore failed err(%d)"), err);
  1275 			SetError(err);
  1276 			}
  1277 		}
  1278 	else
  1279 		{
  1280 		ERR_PRINTF1( _L("Failed to read PASSWORD to write from ini file"));
  1281 		SetBlockResult(EFail);
  1282 		}
  1283 	}
  1284 
  1285 /**
  1286  * Process command that will result in call to DMMCStack::ProgramPeriodMs kernel side
  1287  *
  1288  * @param aSection			The section in the ini containing data for the command
  1289  *
  1290  * @return					void
  1291  *
  1292  * @leave					System wide error
  1293  */
  1294 void CT_MMCSDStackDriverData::DoCmdProgramPeriodInMilliSeconds(const TDesC& aSection)
  1295 	{
  1296 	TInt actualPeriod;
  1297 	INFO_PRINTF1(_L("Calling MMCStack::ProgramPeriodInMilliSeconds()"));
  1298 	TInt err = iMmcSDController->StackProgramPeriodInMilliSeconds(actualPeriod);
  1299 
  1300 	if (err != KErrNone)
  1301 		{
  1302 		ERR_PRINTF2(_L("DMMCStack::ProgramPeriodInMilliSeconds() Error %d"), err);
  1303 		SetError(err);
  1304 		}
  1305 	else
  1306 		{
  1307 		INFO_PRINTF2(_L("DMMCStack::ProgramPeriodInMilliSeconds() actualPeriod(%d)"), actualPeriod);
  1308 
  1309 		TInt expectedPeriod;
  1310 		if (GetIntFromConfig(aSection, KProgramPeriodMs(), expectedPeriod)
  1311 				&& actualPeriod != expectedPeriod)
  1312 			{
  1313 			ERR_PRINTF3(_L("actual (%d) and expected(%d) periods do not match"), actualPeriod, expectedPeriod);
  1314 			SetBlockResult(EFail);
  1315 			}
  1316 		}
  1317 	}
  1318 
  1319 /**
  1320  * Process command that will result in call to DMMCStack::Stop kernel side
  1321  *
  1322  * @param aSection			The section in the ini containing data for the command
  1323  *
  1324  * @return					void
  1325  *
  1326  * @leave					System wide error
  1327  */
  1328 void CT_MMCSDStackDriverData::DoCmdStop(const TDesC& /*aSection*/)
  1329 	{
  1330 	INFO_PRINTF1(_L("Calling MMCStack::Stop()"));
  1331 	TInt err = iMmcSDController->StackStop();
  1332 	if (err != KErrNone)
  1333 		{
  1334 		ERR_PRINTF2(_L("MMCStack::Stop() Error %d"), err);
  1335 		SetError(err);
  1336 		}
  1337 	}
  1338 
  1339 /**
  1340  * Process command that will result in call to DMMCStack::Init kernel side
  1341  *
  1342  * @return					void
  1343  *
  1344  * @leave					System wide error
  1345  */
  1346 void CT_MMCSDStackDriverData::DoCmdInit()
  1347 	{
  1348 	INFO_PRINTF1(_L("Calling MMCStack::Init()"));
  1349 	TInt err = iMmcSDController->StackInit();
  1350 	
  1351 	if(err != KErrNone)
  1352 		{
  1353 		ERR_PRINTF2(_L("MMCStack::Init() Error %d"), err);
  1354 		SetError(err);
  1355 		}
  1356 	}
  1357 
  1358 /**
  1359  * Process command that will result in call to DMMCStack::ReportPowerUp kernel side
  1360  *
  1361  * @param aSection			The section in the ini containing data for the command
  1362  *
  1363  * @return					void
  1364  *
  1365  * @leave					System wide error
  1366  */
  1367 void CT_MMCSDStackDriverData::DoCmdReportPowerUp(const TDesC& /*aSection*/)
  1368 	{
  1369 	INFO_PRINTF1(_L("Calling MMCStack::ReportPowerUp()"));
  1370 	TInt err = iMmcSDController->StackReportPowerUp();
  1371 	if (err != KErrNone)
  1372 		{
  1373 		ERR_PRINTF2(_L("MMCStack::ReportPowerUp() Error %d"), err);
  1374 		SetError(err);
  1375 		}
  1376 	}
  1377 
  1378 /**
  1379  * Process command that will result in call to DMMCStack::ReportPowerDown kernel side
  1380  *
  1381  * @param aSection			The section in the ini containing data for the command
  1382  *
  1383  * @return					void
  1384  *
  1385  * @leave					System wide error
  1386  */
  1387 void CT_MMCSDStackDriverData::DoCmdReportPowerDown(const TDesC& /*aSection*/)
  1388 	{
  1389 	INFO_PRINTF1(_L("Calling MMCStack::ReportPowerDown()"));
  1390 	TInt err = iMmcSDController->StackReportPowerDown();
  1391 	if (err != KErrNone)
  1392 		{
  1393 		ERR_PRINTF2(_L("MMCStack::ReportPowerDown() Error %d"), err);
  1394 		SetError(err);
  1395 		}
  1396 	}
  1397 
  1398 /**
  1399  * Process command that will result in call to DMMCStack::CardP kernel side
  1400  *
  1401  * @param aSection			The section in the ini containing data for the command
  1402  *
  1403  * @return					void
  1404  *
  1405  * @leave					System wide error
  1406  */
  1407 void CT_MMCSDStackDriverData::DoCmdCardP(const TDesC& aSection)
  1408 	{
  1409 	TCardPtr cardPtr;
  1410 	if( GetIntFromConfig(aSection, KCardNumber(), cardPtr.iCardNumber) )
  1411 		{
  1412 		INFO_PRINTF2(_L("Calling MMCStack::CardP(%d)"), cardPtr.iCardNumber);
  1413 		TInt err = iMmcSDController->StackCardP(cardPtr);
  1414 	
  1415 		if( err!=KErrNone )
  1416 			{
  1417 			ERR_PRINTF2(_L("MMCStack::CardP() Error %d"), err);
  1418 			SetError(err);
  1419 			}
  1420 		else
  1421 			{
  1422 			INFO_PRINTF2(_L("MMCStack::CardP(): ptr=%x"), cardPtr.iCardPtr);
  1423 			TBool	expectedIsNull;
  1424 			if( GetBoolFromConfig(aSection, KIsNull(), expectedIsNull) )
  1425 				{
  1426 				if( expectedIsNull )
  1427 					{
  1428 					if( cardPtr.iCardPtr != NULL )
  1429 						{
  1430 						ERR_PRINTF1(_L("Card ptr is not NULL"));
  1431 						SetBlockResult(EFail);
  1432 						}
  1433 					}
  1434 				else
  1435 					{
  1436 					if( cardPtr.iCardPtr == NULL )
  1437 						{
  1438 						ERR_PRINTF1(_L("Card ptr is NULL"));
  1439 						SetBlockResult(EFail);
  1440 						}
  1441 					}				
  1442 				}
  1443 			else
  1444 				{
  1445 				ERR_PRINTF1(_L("Expected Is Null not given in ini file"));
  1446 				SetBlockResult(EFail);			
  1447 				}
  1448 			}		
  1449 		}
  1450 	else
  1451 		{
  1452 		ERR_PRINTF1(_L("Card Number not given in ini file"));
  1453 		SetBlockResult(EFail);			
  1454 		}		
  1455 	}