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