os/boardsupport/haitest/bspsvs/suite/bsp/mmc/src/T_MmcSDPsuBaseDriverData.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_MmcSDPsuBaseDriverData.h"
sl@0
    19
sl@0
    20
//MMCSD Commands index
sl@0
    21
/*@{*/
sl@0
    22
sl@0
    23
_LIT(KCmdIsLocked,							"IsLocked");
sl@0
    24
_LIT(KCmdIsOff,								"IsOff");
sl@0
    25
_LIT(KCmdMaxCurrentInMicroAmps,				"MaxCurrentInMicroAmps");
sl@0
    26
_LIT(KCmdResetInactivityTimer,				"ResetInactivityTimer");
sl@0
    27
_LIT(KCmdVoltageSupported,					"VoltageSupported");
sl@0
    28
_LIT(KCmdInactivityCount,					"InactivityCount");
sl@0
    29
_LIT(KCmdNotLockedCount,					"NotLockedCount");
sl@0
    30
_LIT(KCmdInactivityTimeout,					"InactivityTimeout");
sl@0
    31
_LIT(KCmdNotLockedTimeout,					"NotLockedTimeout");
sl@0
    32
_LIT(KCmdMemVoltageSupported,				"MemVoltageSupported");
sl@0
    33
_LIT(KCmdMemMaxCurrentInMicroAmps,			"MemMaxCurrentInMicroAmps");
sl@0
    34
_LIT(KCmdVoltCheckInterval,					"VoltCheckInterval");
sl@0
    35
sl@0
    36
sl@0
    37
_LIT(KExpectedLockState,					"expectedlockstate");
sl@0
    38
_LIT(KExpectedPsuState,						"expectedpsustate");
sl@0
    39
_LIT(KExpectedCurrent,						"expectedcurrent");
sl@0
    40
_LIT(KExpectedVoltage,						"expectedvoltage");
sl@0
    41
_LIT(KExpectedInactivityCount,				"expectedinactivityCount");
sl@0
    42
_LIT(KExpectedNotLockedCount,				"expectednotLockedCount");
sl@0
    43
_LIT(KExpectedInactivityTimeout,			"expectedinactivityTimeout");
sl@0
    44
_LIT(KExpectedNotLockedTimeout,				"expectednotlockedtimeOut");
sl@0
    45
_LIT(KExpectedMemVoltageSupported,			"expectedmemVoltageSupported");
sl@0
    46
_LIT(KExpectedMemMaxCurrentInMicroAmps,		"expectedmemMaxCurrentInMicroAmps");
sl@0
    47
_LIT(KExpectedVoltageinterval,				"expectedvoltageinterval");
sl@0
    48
sl@0
    49
/*@}*/
sl@0
    50
sl@0
    51
//////////////////////////////////////////////////////////////////////
sl@0
    52
// Construction/Destruction
sl@0
    53
//////////////////////////////////////////////////////////////////////
sl@0
    54
sl@0
    55
CT_MMCSDPsuBaseDriverData* CT_MMCSDPsuBaseDriverData::NewL()
sl@0
    56
	{
sl@0
    57
	CT_MMCSDPsuBaseDriverData*	ret=new (ELeave) CT_MMCSDPsuBaseDriverData();
sl@0
    58
	CleanupStack::PushL(ret);
sl@0
    59
	ret->ConstructL();
sl@0
    60
	CleanupStack::Pop(ret);
sl@0
    61
	return ret;
sl@0
    62
	}
sl@0
    63
sl@0
    64
sl@0
    65
CT_MMCSDPsuBaseDriverData::CT_MMCSDPsuBaseDriverData()
sl@0
    66
:	CT_MmcSDDriverData()
sl@0
    67
,	iAsyncErrorIndex(0)
sl@0
    68
	{
sl@0
    69
	}
sl@0
    70
sl@0
    71
void CT_MMCSDPsuBaseDriverData::ConstructL()
sl@0
    72
/**
sl@0
    73
 * Second phase construction
sl@0
    74
 *
sl@0
    75
 * @internalComponent
sl@0
    76
 *
sl@0
    77
 * @return	N/A
sl@0
    78
 *
sl@0
    79
 * @pre		None
sl@0
    80
 * @post	None
sl@0
    81
 *
sl@0
    82
 * @leave	system wide error
sl@0
    83
 */
sl@0
    84
	{
sl@0
    85
	CT_MmcSDDriverData::ConstructL();
sl@0
    86
	}
sl@0
    87
sl@0
    88
CT_MMCSDPsuBaseDriverData::~CT_MMCSDPsuBaseDriverData()
sl@0
    89
/**
sl@0
    90
 * Public destructor
sl@0
    91
 */
sl@0
    92
	{
sl@0
    93
	}
sl@0
    94
sl@0
    95
TBool CT_MMCSDPsuBaseDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
sl@0
    96
/**
sl@0
    97
 * Process a command read from the ini file
sl@0
    98
 *
sl@0
    99
 * @param aCommand			The command to process
sl@0
   100
 * @param aSection			The section in the ini containing data for the command
sl@0
   101
 * @param aAsyncErrorIndex	Command index for async calls to return errors to
sl@0
   102
 *
sl@0
   103
 * @return					ETrue if the command is processed
sl@0
   104
 *
sl@0
   105
 * @leave					System wide error
sl@0
   106
 */
sl@0
   107
 	{
sl@0
   108
	TBool	ret=ETrue;
sl@0
   109
sl@0
   110
	if ( aCommand==KCmdIsLocked )
sl@0
   111
		{
sl@0
   112
		DoCmdIsLocked(aSection);
sl@0
   113
		}
sl@0
   114
	else if ( aCommand==KCmdIsOff )
sl@0
   115
		{
sl@0
   116
		DoCmdIsOff(aSection);
sl@0
   117
		}
sl@0
   118
	else if ( aCommand==KCmdMaxCurrentInMicroAmps )
sl@0
   119
		{
sl@0
   120
		DoCmdMaxCurrentInMicroAmps(aSection);
sl@0
   121
		}
sl@0
   122
	else if ( aCommand==KCmdResetInactivityTimer )
sl@0
   123
		{
sl@0
   124
		DoCmdResetInactivityTimer();
sl@0
   125
		}
sl@0
   126
	else if ( aCommand==KCmdVoltageSupported)
sl@0
   127
		{
sl@0
   128
		DoCmdVoltageSupported(aSection);
sl@0
   129
		}
sl@0
   130
	else if ( aCommand==KCmdInactivityCount)
sl@0
   131
		{
sl@0
   132
		DoCmdInactivityCount(aSection);
sl@0
   133
		}
sl@0
   134
	else if ( aCommand==KCmdNotLockedCount)
sl@0
   135
		{
sl@0
   136
		DoCmdNotLockedCount(aSection);
sl@0
   137
		}
sl@0
   138
	else if ( aCommand==KCmdInactivityTimeout)
sl@0
   139
		{
sl@0
   140
		DoCmdInactivityTimeout(aSection);
sl@0
   141
		}
sl@0
   142
	else if ( aCommand==KCmdNotLockedTimeout)
sl@0
   143
		{
sl@0
   144
		DoCmdNotLockedTimeout(aSection);
sl@0
   145
		}
sl@0
   146
	else if ( aCommand==KCmdMemVoltageSupported)
sl@0
   147
		{
sl@0
   148
		DoCmdMemVoltageSupported(aSection);
sl@0
   149
		}
sl@0
   150
	else if ( aCommand==KCmdMemMaxCurrentInMicroAmps)
sl@0
   151
		{
sl@0
   152
		DoCmdMemMaxCurrentInMicroAmps(aSection);
sl@0
   153
		}
sl@0
   154
	else if ( aCommand==KCmdVoltCheckInterval)
sl@0
   155
		{
sl@0
   156
		DoCmdVoltCheckInterval(aSection);
sl@0
   157
		}
sl@0
   158
	else
sl@0
   159
		{
sl@0
   160
		ret=CT_MmcSDDriverData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
sl@0
   161
		}
sl@0
   162
	return ret;
sl@0
   163
	}
sl@0
   164
sl@0
   165
/**
sl@0
   166
 * Checks whether this PSU is powering a bus containing a locked device
sl@0
   167
 * i.e. one that is recognised and in use by a client
sl@0
   168
 *
sl@0
   169
 * @param aSection			The section in the ini containing data for the command
sl@0
   170
 *
sl@0
   171
 * @return					void
sl@0
   172
 *
sl@0
   173
 * @leave					System wide error
sl@0
   174
 */
sl@0
   175
void CT_MMCSDPsuBaseDriverData::DoCmdIsLocked(const TDesC& aSection)
sl@0
   176
	{
sl@0
   177
 	TInt err;
sl@0
   178
 	TBool lockstate;
sl@0
   179
 	err = iMmcSDController->IsLocked(lockstate);
sl@0
   180
	if ( err!=KErrNone )
sl@0
   181
		{
sl@0
   182
		ERR_PRINTF2(_L("Getting Lock Information Error %d"), err);
sl@0
   183
		SetError(err);
sl@0
   184
		}
sl@0
   185
	else
sl@0
   186
		{
sl@0
   187
		//IsLocked?
sl@0
   188
		INFO_PRINTF2(_L("PSUBASE: IsLocked    = %d \n"),lockstate);
sl@0
   189
		TBool	expectedlockstate;
sl@0
   190
		if(GetBoolFromConfig(aSection, KExpectedLockState(), expectedlockstate))
sl@0
   191
			{
sl@0
   192
			if(lockstate != expectedlockstate)
sl@0
   193
				{
sl@0
   194
				SetBlockResult(EFail);
sl@0
   195
				ERR_PRINTF3(_L("lockstate(%d) != expectedlockstate(%d)"), lockstate, expectedlockstate);
sl@0
   196
				}
sl@0
   197
			}
sl@0
   198
		else
sl@0
   199
			{
sl@0
   200
			SetBlockResult(EFail);
sl@0
   201
			WARN_PRINTF1(_L("expectedlockstate Value Missing From INI File"));
sl@0
   202
			}
sl@0
   203
		}
sl@0
   204
	}
sl@0
   205
sl@0
   206
/**
sl@0
   207
 * Checks whether the PSU is off
sl@0
   208
 *
sl@0
   209
 * @param aSection			The section in the ini containing data for the command
sl@0
   210
 *
sl@0
   211
 * @return					void
sl@0
   212
 *
sl@0
   213
 * @leave					System wide error
sl@0
   214
 */
sl@0
   215
void CT_MMCSDPsuBaseDriverData::DoCmdIsOff(const TDesC& aSection)
sl@0
   216
	{
sl@0
   217
 	TInt err;
sl@0
   218
 	TBool psustate;
sl@0
   219
 	err = iMmcSDController->IsOff(psustate);
sl@0
   220
	if ( err!=KErrNone )
sl@0
   221
		{
sl@0
   222
		ERR_PRINTF2(_L("Getting PSU State Information Error %d"), err);
sl@0
   223
		SetError(err);
sl@0
   224
		}
sl@0
   225
	else
sl@0
   226
		{
sl@0
   227
		//IsLocked?
sl@0
   228
		INFO_PRINTF2(_L("PSUBASE: IsOff    = %d \n"),psustate);
sl@0
   229
		TBool	expectedpsustate;
sl@0
   230
		if(GetBoolFromConfig(aSection, KExpectedPsuState(), expectedpsustate))
sl@0
   231
			{
sl@0
   232
			if(psustate != expectedpsustate)
sl@0
   233
				{
sl@0
   234
				SetBlockResult(EFail);
sl@0
   235
				ERR_PRINTF3(_L("psustate(%d) != expectedpsustate(%d)"), psustate, expectedpsustate);
sl@0
   236
				}
sl@0
   237
			}
sl@0
   238
		else
sl@0
   239
			{
sl@0
   240
			SetBlockResult(EFail);
sl@0
   241
			WARN_PRINTF1(_L("expectedpsustate Value Missing From INI File"));
sl@0
   242
			}
sl@0
   243
		}
sl@0
   244
	}
sl@0
   245
sl@0
   246
/**
sl@0
   247
 * Gets the maximum current (in microAmps) that the PSU is able to supply
sl@0
   248
 *
sl@0
   249
 * @param aSection			The section in the ini containing data for the command
sl@0
   250
 *
sl@0
   251
 * @return					void
sl@0
   252
 *
sl@0
   253
 * @leave					System wide error
sl@0
   254
 */
sl@0
   255
void CT_MMCSDPsuBaseDriverData::DoCmdMaxCurrentInMicroAmps(const TDesC& aSection)
sl@0
   256
	{
sl@0
   257
 	TInt err;
sl@0
   258
 	TInt current;
sl@0
   259
 	err = iMmcSDController->MaxCurrentInMicroAmps(current);
sl@0
   260
	if ( err!=KErrNone )
sl@0
   261
		{
sl@0
   262
		ERR_PRINTF2(_L("Getting MaxCurrentInMicroAmps Error %d"), err);
sl@0
   263
		SetError(err);
sl@0
   264
		}
sl@0
   265
	else
sl@0
   266
		{
sl@0
   267
		//MaxCurrentInMicroAmps
sl@0
   268
		INFO_PRINTF2(_L("PSUBASE: MaxCurrentInMicroAmps   = %d \n"),current);
sl@0
   269
		TInt	expectedcurrent;
sl@0
   270
		if(GetIntFromConfig(aSection, KExpectedCurrent(), expectedcurrent))
sl@0
   271
			{
sl@0
   272
			if(current != expectedcurrent)
sl@0
   273
				{
sl@0
   274
				SetBlockResult(EFail);
sl@0
   275
				ERR_PRINTF3(_L("current(%d) != expectedcurrent(%d)"), current, expectedcurrent);
sl@0
   276
				}
sl@0
   277
			}
sl@0
   278
		else
sl@0
   279
			{
sl@0
   280
			SetBlockResult(EFail);
sl@0
   281
			WARN_PRINTF1(_L("expectedcurrent Value Missing From INI File"));
sl@0
   282
			}
sl@0
   283
		}
sl@0
   284
	}
sl@0
   285
sl@0
   286
/**
sl@0
   287
 * Resets inactivity and not-locked counts
sl@0
   288
 *
sl@0
   289
 * @return					void
sl@0
   290
 *
sl@0
   291
 * @leave					System wide error
sl@0
   292
 */
sl@0
   293
void CT_MMCSDPsuBaseDriverData::DoCmdResetInactivityTimer()
sl@0
   294
	{
sl@0
   295
 	TInt err;
sl@0
   296
 	err = iMmcSDController->ResetInactivityTimer();
sl@0
   297
	if ( err!=KErrNone )
sl@0
   298
		{
sl@0
   299
		ERR_PRINTF2(_L("ResetInactivityTimer Error %d"), err);
sl@0
   300
		SetError(err);
sl@0
   301
		}
sl@0
   302
	}
sl@0
   303
sl@0
   304
/**
sl@0
   305
 * Gets the voltage level, or range of supported voltage levels
sl@0
   306
 *
sl@0
   307
 * @param aSection			The section in the ini containing data for the command
sl@0
   308
 *
sl@0
   309
 * @return					void
sl@0
   310
 *
sl@0
   311
 * @leave					System wide error
sl@0
   312
 */
sl@0
   313
void CT_MMCSDPsuBaseDriverData::DoCmdVoltageSupported(const TDesC& aSection)
sl@0
   314
	{
sl@0
   315
 	TInt err;
sl@0
   316
 	TUint volt;
sl@0
   317
 	err = iMmcSDController->VoltageSupported(volt);
sl@0
   318
	if ( err!=KErrNone )
sl@0
   319
		{
sl@0
   320
		ERR_PRINTF2(_L("VoltageSupported Error %d"), err);
sl@0
   321
		SetError(err);
sl@0
   322
		}
sl@0
   323
	else
sl@0
   324
		{
sl@0
   325
		//VoltageSupported
sl@0
   326
		INFO_PRINTF2(_L("PSUBASE: VoltageSupported  = %x \n"),volt);
sl@0
   327
		TUint	expectedvolt;
sl@0
   328
		if(GetUintFromConfig(aSection, KExpectedVoltage(), expectedvolt))
sl@0
   329
			{
sl@0
   330
			if(volt != expectedvolt)
sl@0
   331
				{
sl@0
   332
				SetBlockResult(EFail);
sl@0
   333
				ERR_PRINTF3(_L("volt(%x) != expectedvolt(%x)"), volt, expectedvolt);
sl@0
   334
				}
sl@0
   335
			}
sl@0
   336
		else
sl@0
   337
			{
sl@0
   338
			SetBlockResult(EFail);
sl@0
   339
			WARN_PRINTF1(_L("expectedvolt Value Missing From INI File"));
sl@0
   340
			}
sl@0
   341
		}
sl@0
   342
	}
sl@0
   343
sl@0
   344
/**
sl@0
   345
 * Bus inactivity counter
sl@0
   346
 *
sl@0
   347
 * @param aSection			The section in the ini containing data for the command
sl@0
   348
 *
sl@0
   349
 * @return					void
sl@0
   350
 *
sl@0
   351
 * @leave					System wide error
sl@0
   352
 */
sl@0
   353
void CT_MMCSDPsuBaseDriverData::DoCmdInactivityCount(const TDesC& aSection)
sl@0
   354
	{
sl@0
   355
 	TInt err;
sl@0
   356
 	TInt inactivityCount;
sl@0
   357
 	err = iMmcSDController->InactivityCount(inactivityCount);
sl@0
   358
	if ( err!=KErrNone )
sl@0
   359
		{
sl@0
   360
		ERR_PRINTF2(_L("InactivityCount Error %d"), err);
sl@0
   361
		SetError(err);
sl@0
   362
		}
sl@0
   363
	else
sl@0
   364
		{
sl@0
   365
		//InactivityCount
sl@0
   366
		INFO_PRINTF2(_L("PSUBASE: InactivityCount  = %d \n"),inactivityCount);
sl@0
   367
		TInt	expectedinactivityCount;
sl@0
   368
		if(GetIntFromConfig(aSection, KExpectedInactivityCount(), expectedinactivityCount))
sl@0
   369
			{
sl@0
   370
			if(inactivityCount != expectedinactivityCount)
sl@0
   371
				{
sl@0
   372
				SetBlockResult(EFail);
sl@0
   373
				ERR_PRINTF3(_L("inactivityCount(%d) != expectedinactivityCount(%d)"), inactivityCount, expectedinactivityCount);
sl@0
   374
				}
sl@0
   375
			}
sl@0
   376
		else
sl@0
   377
			{
sl@0
   378
			SetBlockResult(EFail);
sl@0
   379
			WARN_PRINTF1(_L("expectedinactivityCount Value Missing From INI File"));
sl@0
   380
			}
sl@0
   381
		}
sl@0
   382
	}
sl@0
   383
sl@0
   384
/**
sl@0
   385
 * Bus not locked counter
sl@0
   386
 *
sl@0
   387
 * @param aSection			The section in the ini containing data for the command
sl@0
   388
 *
sl@0
   389
 * @return					void
sl@0
   390
 *
sl@0
   391
 * @leave					System wide error
sl@0
   392
 */
sl@0
   393
void CT_MMCSDPsuBaseDriverData::DoCmdNotLockedCount(const TDesC& aSection)
sl@0
   394
	{
sl@0
   395
 	TInt err;
sl@0
   396
 	TInt notLockedCount;
sl@0
   397
 	err = iMmcSDController->NotLockedCount(notLockedCount);
sl@0
   398
	if ( err!=KErrNone )
sl@0
   399
		{
sl@0
   400
		ERR_PRINTF2(_L("NotLockedCount Error %d"), err);
sl@0
   401
		SetError(err);
sl@0
   402
		}
sl@0
   403
	else
sl@0
   404
		{
sl@0
   405
		//NotLockedCount
sl@0
   406
		INFO_PRINTF2(_L("PSUBASE: NotLockedCount  = %d \n"),notLockedCount);
sl@0
   407
		TInt	expectednotLockedCount;
sl@0
   408
		if(GetIntFromConfig(aSection, KExpectedNotLockedCount(), expectednotLockedCount))
sl@0
   409
			{
sl@0
   410
			if(notLockedCount != expectednotLockedCount)
sl@0
   411
				{
sl@0
   412
				SetBlockResult(EFail);
sl@0
   413
				ERR_PRINTF3(_L("notLockedCount(%d) != expectednotLockedCount(%d)"), notLockedCount, expectednotLockedCount);
sl@0
   414
				}
sl@0
   415
			}
sl@0
   416
		else
sl@0
   417
			{
sl@0
   418
			SetBlockResult(EFail);
sl@0
   419
			WARN_PRINTF1(_L("expectednotLockedCount Value Missing From INI File"));
sl@0
   420
			}
sl@0
   421
		}
sl@0
   422
	}
sl@0
   423
sl@0
   424
/**
sl@0
   425
 * Bus inactivity timeout period, in seconds, when clients are registered
sl@0
   426
 *
sl@0
   427
 * @param aSection			The section in the ini containing data for the command
sl@0
   428
 *
sl@0
   429
 * @return					void
sl@0
   430
 *
sl@0
   431
 * @leave					System wide error
sl@0
   432
 */
sl@0
   433
void CT_MMCSDPsuBaseDriverData::DoCmdInactivityTimeout(const TDesC& aSection)
sl@0
   434
	{
sl@0
   435
 	TInt err;
sl@0
   436
 	TInt inactivityTimeout;
sl@0
   437
 	err = iMmcSDController->InactivityTimeout(inactivityTimeout);
sl@0
   438
	if ( err!=KErrNone )
sl@0
   439
		{
sl@0
   440
		ERR_PRINTF2(_L("InactivityTimeout Error %d"), err);
sl@0
   441
		SetError(err);
sl@0
   442
		}
sl@0
   443
	else
sl@0
   444
		{
sl@0
   445
		//InactivityTimeout
sl@0
   446
		INFO_PRINTF2(_L("PSUBASE: InactivityTimeout  = %d \n"),inactivityTimeout);
sl@0
   447
		TInt	expectedinactivityTimeout;
sl@0
   448
		if(GetIntFromConfig(aSection, KExpectedInactivityTimeout(), expectedinactivityTimeout))
sl@0
   449
			{
sl@0
   450
			if(inactivityTimeout != expectedinactivityTimeout)
sl@0
   451
				{
sl@0
   452
				SetBlockResult(EFail);
sl@0
   453
				ERR_PRINTF3(_L("inactivityTimeout(%d) != expectedinactivityTimeout(%d)"), inactivityTimeout, expectedinactivityTimeout);
sl@0
   454
				}
sl@0
   455
			}
sl@0
   456
		else
sl@0
   457
			{
sl@0
   458
			SetBlockResult(EFail);
sl@0
   459
			WARN_PRINTF1(_L("expectedinactivityTimeout Value Missing From INI File"));
sl@0
   460
			}
sl@0
   461
		}
sl@0
   462
	}
sl@0
   463
sl@0
   464
/**
sl@0
   465
 * Bus not locked timeout period, in seconds, when no clients are registered
sl@0
   466
 *
sl@0
   467
 * @param aSection			The section in the ini containing data for the command
sl@0
   468
 *
sl@0
   469
 * @return					void
sl@0
   470
 *
sl@0
   471
 * @leave					System wide error
sl@0
   472
 */
sl@0
   473
void CT_MMCSDPsuBaseDriverData::DoCmdNotLockedTimeout(const TDesC& aSection)
sl@0
   474
	{
sl@0
   475
 	TInt err;
sl@0
   476
 	TInt notLockedTimeout;
sl@0
   477
 	err = iMmcSDController->NotLockedTimeout(notLockedTimeout);
sl@0
   478
	if ( err!=KErrNone )
sl@0
   479
		{
sl@0
   480
		ERR_PRINTF2(_L("NotLockedTimeout Error %d"), err);
sl@0
   481
		SetError(err);
sl@0
   482
		}
sl@0
   483
	else
sl@0
   484
		{
sl@0
   485
		//NotLockedTimeout
sl@0
   486
		INFO_PRINTF2(_L("PSUBASE: NotLockedTimeout  = %d \n"),notLockedTimeout);
sl@0
   487
		TInt	expectednotLockedTimeout;
sl@0
   488
		if(GetIntFromConfig(aSection, KExpectedNotLockedTimeout(), expectednotLockedTimeout))
sl@0
   489
			{
sl@0
   490
			if(notLockedTimeout != expectednotLockedTimeout)
sl@0
   491
				{
sl@0
   492
				SetBlockResult(EFail);
sl@0
   493
				ERR_PRINTF3(_L("notLockedTimeout(%d) != expectednotLockedTimeout(%d)"), notLockedTimeout, expectednotLockedTimeout);
sl@0
   494
				}
sl@0
   495
			}
sl@0
   496
		else
sl@0
   497
			{
sl@0
   498
			SetBlockResult(EFail);
sl@0
   499
			WARN_PRINTF1(_L("expectednotLockedTimeout Value Missing From INI File"));
sl@0
   500
			}
sl@0
   501
		}
sl@0
   502
	}
sl@0
   503
sl@0
   504
/**
sl@0
   505
 * Indicates the voltage level, or range of voltages supported
sl@0
   506
 *
sl@0
   507
 * @param aSection			The section in the ini containing data for the command
sl@0
   508
 *
sl@0
   509
 * @return					void
sl@0
   510
 *
sl@0
   511
 * @leave					System wide error
sl@0
   512
 */
sl@0
   513
void CT_MMCSDPsuBaseDriverData::DoCmdMemVoltageSupported(const TDesC& aSection)
sl@0
   514
	{
sl@0
   515
 	TInt err;
sl@0
   516
 	TUint memVoltageSupported;
sl@0
   517
 	err = iMmcSDController->MemVoltageSupported(memVoltageSupported);
sl@0
   518
	if ( err!=KErrNone )
sl@0
   519
		{
sl@0
   520
		ERR_PRINTF2(_L("MemVoltageSupported Error %u"), err);
sl@0
   521
		SetError(err);
sl@0
   522
		}
sl@0
   523
	else
sl@0
   524
		{
sl@0
   525
		//MemVoltageSupported
sl@0
   526
		INFO_PRINTF2(_L("PSUBASE: MemVoltageSupported  = %x \n"),memVoltageSupported);
sl@0
   527
		TUint	expectedmemVoltageSupported;
sl@0
   528
		if(GetUintFromConfig(aSection, KExpectedMemVoltageSupported(), expectedmemVoltageSupported))
sl@0
   529
			{
sl@0
   530
			if(memVoltageSupported != expectedmemVoltageSupported)
sl@0
   531
				{
sl@0
   532
				SetBlockResult(EFail);
sl@0
   533
				ERR_PRINTF3(_L("memVoltageSupported(%x) != expectedmemVoltageSupported(%x)"), memVoltageSupported, expectedmemVoltageSupported);
sl@0
   534
				}
sl@0
   535
			}
sl@0
   536
		else
sl@0
   537
			{
sl@0
   538
			SetBlockResult(EFail);
sl@0
   539
			WARN_PRINTF1(_L("expectedmemVoltageSupported Value Missing From INI File"));
sl@0
   540
			}
sl@0
   541
		}
sl@0
   542
	}
sl@0
   543
sl@0
   544
/**
sl@0
   545
 * The maximum current (in microAmps) that the PSU is able to supply
sl@0
   546
 *
sl@0
   547
 * @param aSection			The section in the ini containing data for the command
sl@0
   548
 *
sl@0
   549
 * @return					void
sl@0
   550
 *
sl@0
   551
 * @leave					System wide error
sl@0
   552
 */
sl@0
   553
void CT_MMCSDPsuBaseDriverData::DoCmdMemMaxCurrentInMicroAmps(const TDesC& aSection)
sl@0
   554
	{
sl@0
   555
 	TInt err;
sl@0
   556
 	TInt memMaxCurrentInMicroAmps;
sl@0
   557
 	err = iMmcSDController->MemMaxCurrentInMicroAmps(memMaxCurrentInMicroAmps);
sl@0
   558
	if ( err!=KErrNone )
sl@0
   559
		{
sl@0
   560
		ERR_PRINTF2(_L("MemMaxCurrentInMicroAmps Error %d"), err);
sl@0
   561
		SetError(err);
sl@0
   562
		}
sl@0
   563
	else
sl@0
   564
		{
sl@0
   565
		//MemMaxCurrentInMicroAmps
sl@0
   566
		INFO_PRINTF2(_L("PSUBASE: MemMaxCurrentInMicroAmps  = %d \n"),memMaxCurrentInMicroAmps);
sl@0
   567
		TInt	expectedmemMaxCurrentInMicroAmps;
sl@0
   568
		if(GetIntFromConfig(aSection, KExpectedMemMaxCurrentInMicroAmps(), expectedmemMaxCurrentInMicroAmps))
sl@0
   569
			{
sl@0
   570
			if(memMaxCurrentInMicroAmps != expectedmemMaxCurrentInMicroAmps)
sl@0
   571
				{
sl@0
   572
				SetBlockResult(EFail);
sl@0
   573
				ERR_PRINTF3(_L("memMaxCurrentInMicroAmps(%d) != expectedmemMaxCurrentInMicroAmps(%d)"), memMaxCurrentInMicroAmps, expectedmemMaxCurrentInMicroAmps);
sl@0
   574
				}
sl@0
   575
			}
sl@0
   576
		else
sl@0
   577
			{
sl@0
   578
			SetBlockResult(EFail);
sl@0
   579
			WARN_PRINTF1(_L("expectedmemMaxCurrentInMicroAmps Value Missing From INI File"));
sl@0
   580
			}
sl@0
   581
		}
sl@0
   582
	}
sl@0
   583
sl@0
   584
/**
sl@0
   585
 * Indicates whether the platform hardware has support for checking whether the voltage level of the
sl@0
   586
 * PSU is within its expected voltage limit while turned on
sl@0
   587
 *
sl@0
   588
 * @param aSection			The section in the ini containing data for the command
sl@0
   589
 *
sl@0
   590
 * @return					void
sl@0
   591
 *
sl@0
   592
 * @leave					System wide error
sl@0
   593
 */
sl@0
   594
void CT_MMCSDPsuBaseDriverData::DoCmdVoltCheckInterval(const TDesC& aSection)
sl@0
   595
	{
sl@0
   596
 	TInt err;
sl@0
   597
 	TUint voltCheckInterval;
sl@0
   598
 	err = iMmcSDController->VoltCheckInterval(voltCheckInterval);
sl@0
   599
	if ( err!=KErrNone )
sl@0
   600
		{
sl@0
   601
		ERR_PRINTF2(_L("VoltCheckInterval Error %d"), err);
sl@0
   602
		SetError(err);
sl@0
   603
		}
sl@0
   604
	else
sl@0
   605
		{
sl@0
   606
		//VoltCheckInterval
sl@0
   607
		INFO_PRINTF2(_L("PSUBASE: VoltCheckInterval  = %u \n"),voltCheckInterval);
sl@0
   608
		TUint	expectedvoltCheckInterval;
sl@0
   609
		if(GetUintFromConfig(aSection, KExpectedVoltageinterval(), expectedvoltCheckInterval))
sl@0
   610
			{
sl@0
   611
			if(voltCheckInterval != expectedvoltCheckInterval)
sl@0
   612
				{
sl@0
   613
				SetBlockResult(EFail);
sl@0
   614
				ERR_PRINTF3(_L("voltCheckInterval(%u) != expectedvoltCheckInterval(%u)"), voltCheckInterval, expectedvoltCheckInterval);
sl@0
   615
				}
sl@0
   616
			}
sl@0
   617
		else
sl@0
   618
			{
sl@0
   619
			SetBlockResult(EFail);
sl@0
   620
			WARN_PRINTF1(_L("expectedvoltCheckInterval Value Missing From INI File"));
sl@0
   621
			}
sl@0
   622
		}
sl@0
   623
	}