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