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_MmcSDPsuDriverData.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
//MMCSD Commands index
|
sl@0
|
21 |
/*@{*/
|
sl@0
|
22 |
|
sl@0
|
23 |
_LIT(KEnumNull, " ");
|
sl@0
|
24 |
|
sl@0
|
25 |
_LIT(KCmdPsuInfo, "PsuInfo");
|
sl@0
|
26 |
_LIT(KCmdPbusState, "PbusState");
|
sl@0
|
27 |
_LIT(KCmdSetPsuState, "SetState");
|
sl@0
|
28 |
_LIT(KCmdVccState, "VccState");
|
sl@0
|
29 |
_LIT(KCmdPsuVoltage, "SetVoltage");
|
sl@0
|
30 |
_LIT(KCmdPsuNumber, "PsuNumber");
|
sl@0
|
31 |
_LIT(KCmdMediaChangeNumber, "MediaChangeNumber");
|
sl@0
|
32 |
_LIT(KCmdPsuCurLimit, "PsuCurLimit");
|
sl@0
|
33 |
|
sl@0
|
34 |
_LIT(KVoltage, "expectedvoltage");
|
sl@0
|
35 |
_LIT(KCurrent, "expectedcurrent");
|
sl@0
|
36 |
_LIT(KVoltageinterval, "expectedvoltageinterval");
|
sl@0
|
37 |
_LIT(KVoltagecheck, "expectedvoltagecheck");
|
sl@0
|
38 |
_LIT(KInactivityTimeOut, "expectedpsuinactivitytimeOut");
|
sl@0
|
39 |
_LIT(KNotlockedtimeOut, "expectednotlockedtimeOut");
|
sl@0
|
40 |
_LIT(KPbusState, "expectedpbusstate");
|
sl@0
|
41 |
_LIT(KVccState, "expectedvccstate");
|
sl@0
|
42 |
_LIT(KExpectedpsuNumber, "expectedpsuNumber");
|
sl@0
|
43 |
_LIT(KExpectedmediaChangeNumber, "expectedmediaChangeNumber");
|
sl@0
|
44 |
_LIT(KExpectedpsuCurLimit, "expectedpsuCurLimit");
|
sl@0
|
45 |
|
sl@0
|
46 |
_LIT(KPsuState, "psustate");
|
sl@0
|
47 |
_LIT(KPsuVoltage, "psuVoltage");
|
sl@0
|
48 |
/*@}*/
|
sl@0
|
49 |
|
sl@0
|
50 |
_LIT(KPsuChkComparator, "EDPsuChkComparator");
|
sl@0
|
51 |
_LIT(KPsuChkADCType, "EDPsuChkADCType");
|
sl@0
|
52 |
_LIT(KPsuChkADCType2, "EDPsuChkADCType2");
|
sl@0
|
53 |
|
sl@0
|
54 |
_LIT(KBusCardAbsent, "EBusCardAbsent");
|
sl@0
|
55 |
_LIT(KBusOff, "EBusOff");
|
sl@0
|
56 |
_LIT(KBusPoweringUp, "EBusPoweringUp");
|
sl@0
|
57 |
_LIT(KBusOn, "EBusOn");
|
sl@0
|
58 |
_LIT(KEBusPsuFault, "EBusPsuFault");
|
sl@0
|
59 |
_LIT(KBusPowerUpPending, "EBusPowerUpPending");
|
sl@0
|
60 |
|
sl@0
|
61 |
_LIT(KPsuOff, "EDPsuOff");
|
sl@0
|
62 |
_LIT(KPsuOnCurLimit, "EDPsuOnCurLimit");
|
sl@0
|
63 |
_LIT(KPsuOnFull, "EDPsuOnFull");
|
sl@0
|
64 |
|
sl@0
|
65 |
const CDataWrapperBase::TEnumEntryTable CT_MMCSDPsuDriverData::iEnumTableVoltageCheckMethod[] =
|
sl@0
|
66 |
{
|
sl@0
|
67 |
// Enum as a descriptor Enum
|
sl@0
|
68 |
KPsuChkComparator, EDPsuChkComparator,
|
sl@0
|
69 |
KPsuChkADCType, EDPsuChkADCType,
|
sl@0
|
70 |
KPsuChkADCType2, EDPsuChkADCType2,
|
sl@0
|
71 |
KEnumNull, -1
|
sl@0
|
72 |
};
|
sl@0
|
73 |
|
sl@0
|
74 |
const CDataWrapperBase::TEnumEntryTable CT_MMCSDPsuDriverData::iEnumTablePbusState[] =
|
sl@0
|
75 |
{
|
sl@0
|
76 |
// Enum as a descriptor Enum
|
sl@0
|
77 |
KBusCardAbsent, EBusCardAbsent,
|
sl@0
|
78 |
KBusOff, EBusOff,
|
sl@0
|
79 |
KBusPoweringUp, EBusPoweringUp,
|
sl@0
|
80 |
KBusOn, EBusOn,
|
sl@0
|
81 |
KEBusPsuFault, EBusPsuFault,
|
sl@0
|
82 |
KBusPowerUpPending, EBusPowerUpPending,
|
sl@0
|
83 |
KEnumNull, -1
|
sl@0
|
84 |
};
|
sl@0
|
85 |
|
sl@0
|
86 |
const CDataWrapperBase::TEnumEntryTable CT_MMCSDPsuDriverData::iEnumTableVccState[] =
|
sl@0
|
87 |
{
|
sl@0
|
88 |
// Enum as a descriptor Enum
|
sl@0
|
89 |
KPsuOff, EDPsuOff,
|
sl@0
|
90 |
KPsuOnCurLimit, EDPsuOnCurLimit,
|
sl@0
|
91 |
KPsuOnFull, EDPsuOnFull,
|
sl@0
|
92 |
KEnumNull, -1
|
sl@0
|
93 |
};
|
sl@0
|
94 |
|
sl@0
|
95 |
//////////////////////////////////////////////////////////////////////
|
sl@0
|
96 |
// Construction/Destruction
|
sl@0
|
97 |
//////////////////////////////////////////////////////////////////////
|
sl@0
|
98 |
|
sl@0
|
99 |
CT_MMCSDPsuDriverData* CT_MMCSDPsuDriverData::NewL()
|
sl@0
|
100 |
{
|
sl@0
|
101 |
CT_MMCSDPsuDriverData* ret=new (ELeave) CT_MMCSDPsuDriverData();
|
sl@0
|
102 |
CleanupStack::PushL(ret);
|
sl@0
|
103 |
ret->ConstructL();
|
sl@0
|
104 |
CleanupStack::Pop(ret);
|
sl@0
|
105 |
return ret;
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
|
sl@0
|
109 |
CT_MMCSDPsuDriverData::CT_MMCSDPsuDriverData()
|
sl@0
|
110 |
: CT_MmcSDDriverData()
|
sl@0
|
111 |
, iAsyncErrorIndex(0)
|
sl@0
|
112 |
{
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
void CT_MMCSDPsuDriverData::ConstructL()
|
sl@0
|
116 |
/**
|
sl@0
|
117 |
* Second phase construction
|
sl@0
|
118 |
*
|
sl@0
|
119 |
* @internalComponent
|
sl@0
|
120 |
*
|
sl@0
|
121 |
* @return N/A
|
sl@0
|
122 |
*
|
sl@0
|
123 |
* @pre None
|
sl@0
|
124 |
* @post None
|
sl@0
|
125 |
*
|
sl@0
|
126 |
* @leave system wide error
|
sl@0
|
127 |
*/
|
sl@0
|
128 |
{
|
sl@0
|
129 |
CT_MmcSDDriverData::ConstructL();
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
CT_MMCSDPsuDriverData::~CT_MMCSDPsuDriverData()
|
sl@0
|
133 |
/**
|
sl@0
|
134 |
* Public destructor
|
sl@0
|
135 |
*/
|
sl@0
|
136 |
{
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
TBool CT_MMCSDPsuDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
sl@0
|
140 |
/**
|
sl@0
|
141 |
* Process a command read from the ini file
|
sl@0
|
142 |
*
|
sl@0
|
143 |
* @param aCommand The command to process
|
sl@0
|
144 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
145 |
* @param aAsyncErrorIndex Command index for async calls to return errors to
|
sl@0
|
146 |
*
|
sl@0
|
147 |
* @return ETrue if the command is processed
|
sl@0
|
148 |
*
|
sl@0
|
149 |
* @leave System wide error
|
sl@0
|
150 |
*/
|
sl@0
|
151 |
{
|
sl@0
|
152 |
TBool ret=ETrue;
|
sl@0
|
153 |
|
sl@0
|
154 |
if ( aCommand==KCmdPsuInfo )
|
sl@0
|
155 |
{
|
sl@0
|
156 |
DoCmdPsuInfo(aSection);
|
sl@0
|
157 |
}
|
sl@0
|
158 |
else if ( aCommand==KCmdPsuVoltage )
|
sl@0
|
159 |
{
|
sl@0
|
160 |
DoCmdSetPsuVoltage(aSection);
|
sl@0
|
161 |
}
|
sl@0
|
162 |
else if ( aCommand==KCmdPsuNumber )
|
sl@0
|
163 |
{
|
sl@0
|
164 |
DoCmdPsuNumber(aSection);
|
sl@0
|
165 |
}
|
sl@0
|
166 |
else if ( aCommand==KCmdMediaChangeNumber )
|
sl@0
|
167 |
{
|
sl@0
|
168 |
DoCmdMediaChangeID(aSection);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
else if ( aCommand==KCmdPsuCurLimit )
|
sl@0
|
171 |
{
|
sl@0
|
172 |
DoCmdPsuCurLimit(aSection);
|
sl@0
|
173 |
}
|
sl@0
|
174 |
else if ( aCommand==KCmdPbusState)
|
sl@0
|
175 |
{
|
sl@0
|
176 |
DoCmdPbusState(aSection);
|
sl@0
|
177 |
}
|
sl@0
|
178 |
else if ( aCommand==KCmdSetPsuState)
|
sl@0
|
179 |
{
|
sl@0
|
180 |
DoCmdSetPsuState(aSection);
|
sl@0
|
181 |
}
|
sl@0
|
182 |
else if ( aCommand==KCmdVccState)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
DoCmdVccState(aSection);
|
sl@0
|
185 |
}
|
sl@0
|
186 |
else
|
sl@0
|
187 |
{
|
sl@0
|
188 |
ret=CT_MmcSDDriverData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
|
sl@0
|
189 |
}
|
sl@0
|
190 |
return ret;
|
sl@0
|
191 |
}
|
sl@0
|
192 |
|
sl@0
|
193 |
/**
|
sl@0
|
194 |
* Psu information
|
sl@0
|
195 |
*
|
sl@0
|
196 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
197 |
*
|
sl@0
|
198 |
* @return void
|
sl@0
|
199 |
*
|
sl@0
|
200 |
* @leave System wide error
|
sl@0
|
201 |
*/
|
sl@0
|
202 |
void CT_MMCSDPsuDriverData::DoCmdPsuInfo(const TDesC& aSection)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
TInt err;
|
sl@0
|
205 |
TPBusPsuInf psuInfo;
|
sl@0
|
206 |
err = iMmcSDController->PsuInfo(psuInfo);
|
sl@0
|
207 |
if ( err!=KErrNone )
|
sl@0
|
208 |
{
|
sl@0
|
209 |
ERR_PRINTF2(_L("Getting PsuInfo Error %d"), err);
|
sl@0
|
210 |
SetError(err);
|
sl@0
|
211 |
}
|
sl@0
|
212 |
else
|
sl@0
|
213 |
{
|
sl@0
|
214 |
//Inactivity Timeout
|
sl@0
|
215 |
INFO_PRINTF2(_L("PSU: Bus Inactivity timeout Period = %d \n"),psuInfo.iInactivityTimeOut);
|
sl@0
|
216 |
TInt expectedInactivityTimeOut;
|
sl@0
|
217 |
if(GetIntFromConfig(aSection, KInactivityTimeOut(), expectedInactivityTimeOut))
|
sl@0
|
218 |
{
|
sl@0
|
219 |
if(psuInfo.iInactivityTimeOut != expectedInactivityTimeOut)
|
sl@0
|
220 |
{
|
sl@0
|
221 |
SetBlockResult(EFail);
|
sl@0
|
222 |
ERR_PRINTF3(_L("psuInfo.iInactivityTimeOut(%d) != expectedInactivityTimeOut(%d)"), psuInfo.iInactivityTimeOut, expectedInactivityTimeOut);
|
sl@0
|
223 |
}
|
sl@0
|
224 |
if(psuInfo.iInactivityTimeOut<=0 || psuInfo.iInactivityTimeOut>10)
|
sl@0
|
225 |
{
|
sl@0
|
226 |
ERR_PRINTF1(_L("MMC/SD: Error : Inactivity timeout is not programmed correctly. \n"));
|
sl@0
|
227 |
ERR_PRINTF1(_L("MMC/SD: Inactivity time out depends on platform. Possible value can be (1/3/5/10) seconds \n"));
|
sl@0
|
228 |
SetBlockResult(EFail);
|
sl@0
|
229 |
}
|
sl@0
|
230 |
}
|
sl@0
|
231 |
else
|
sl@0
|
232 |
{
|
sl@0
|
233 |
SetBlockResult(EFail);
|
sl@0
|
234 |
WARN_PRINTF1(_L("Inactivity timeout Value Missing From INI File"));
|
sl@0
|
235 |
}
|
sl@0
|
236 |
//NotLocked Timeout
|
sl@0
|
237 |
INFO_PRINTF2(_L("PSU: Bus Not Locked Timeout Period = %d \n"),psuInfo.iNotLockedTimeOut);
|
sl@0
|
238 |
TInt expectedNotlockedtimeOut;
|
sl@0
|
239 |
if(GetIntFromConfig(aSection, KNotlockedtimeOut(), expectedNotlockedtimeOut))
|
sl@0
|
240 |
{
|
sl@0
|
241 |
if(psuInfo.iNotLockedTimeOut != expectedNotlockedtimeOut)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
SetBlockResult(EFail);
|
sl@0
|
244 |
ERR_PRINTF3(_L("psuInfo.iNotLockedTimeOut(%d) != expectedNotlockedtimeOut(%d)"), psuInfo.iNotLockedTimeOut, expectedNotlockedtimeOut);
|
sl@0
|
245 |
}
|
sl@0
|
246 |
}
|
sl@0
|
247 |
else
|
sl@0
|
248 |
{
|
sl@0
|
249 |
SetBlockResult(EFail);
|
sl@0
|
250 |
WARN_PRINTF1(_L("NotlockedtimeOut Value Missing From INI File"));
|
sl@0
|
251 |
}
|
sl@0
|
252 |
//MaxCurrentInMicroAmps
|
sl@0
|
253 |
INFO_PRINTF2(_L("PSU: MaxCurrentInMicroAmps = %d \n"),psuInfo.iMaxCurrentInMicroAmps);
|
sl@0
|
254 |
TInt expectedMaxCurrentInMicroAmps;
|
sl@0
|
255 |
if(GetIntFromConfig(aSection, KCurrent(), expectedMaxCurrentInMicroAmps))
|
sl@0
|
256 |
{
|
sl@0
|
257 |
if(psuInfo.iMaxCurrentInMicroAmps != expectedMaxCurrentInMicroAmps)
|
sl@0
|
258 |
{
|
sl@0
|
259 |
SetBlockResult(EFail);
|
sl@0
|
260 |
ERR_PRINTF3(_L("psuInfo.iMaxCurrentInMicroAmps(%d) != expectedMaxCurrentInMicroAmps(%d)"), psuInfo.iMaxCurrentInMicroAmps, expectedMaxCurrentInMicroAmps);
|
sl@0
|
261 |
}
|
sl@0
|
262 |
}
|
sl@0
|
263 |
else
|
sl@0
|
264 |
{
|
sl@0
|
265 |
SetBlockResult(EFail);
|
sl@0
|
266 |
WARN_PRINTF1(_L("MaxCurrentInMicroAmps Value Missing From INI File"));
|
sl@0
|
267 |
}
|
sl@0
|
268 |
//Volatge Supported
|
sl@0
|
269 |
INFO_PRINTF2(_L("PSU: Volatge Supported(OCR Register Format) = 0x%08x(OCR Format) \n"),psuInfo.iVoltageSupported);
|
sl@0
|
270 |
TUint expectedVoltageSupported;
|
sl@0
|
271 |
if(GetUintFromConfig(aSection, KVoltage(), expectedVoltageSupported))
|
sl@0
|
272 |
{
|
sl@0
|
273 |
if(psuInfo.iVoltageSupported != expectedVoltageSupported)
|
sl@0
|
274 |
{
|
sl@0
|
275 |
SetBlockResult(EFail);
|
sl@0
|
276 |
ERR_PRINTF3(_L("psuInfo.iVoltageSupported(0x%08x) != expectedVoltageSupported(0x%08x)"), psuInfo.iVoltageSupported, expectedVoltageSupported);
|
sl@0
|
277 |
}
|
sl@0
|
278 |
//Bit MASK (Refer OCR register format)
|
sl@0
|
279 |
if(psuInfo.iVoltageSupported ==0)
|
sl@0
|
280 |
{
|
sl@0
|
281 |
ERR_PRINTF1(_L("MMC/SD: iVoltageSupported should not be zero \n"));
|
sl@0
|
282 |
ERR_PRINTF1(_L("MMC/SD: iVoltageSupported depends on platform. Possible values(3.0/3.3) volts in OCR register format\n"));
|
sl@0
|
283 |
SetBlockResult(EFail);
|
sl@0
|
284 |
}
|
sl@0
|
285 |
}
|
sl@0
|
286 |
else
|
sl@0
|
287 |
{
|
sl@0
|
288 |
SetBlockResult(EFail);
|
sl@0
|
289 |
WARN_PRINTF1(_L("VoltageSupported Value Missing From INI File"));
|
sl@0
|
290 |
}
|
sl@0
|
291 |
//Voltage Interval
|
sl@0
|
292 |
INFO_PRINTF2(_L("PSU: Voltage Interval = %x \n"),psuInfo.iVoltCheckInterval);
|
sl@0
|
293 |
TUint expectedVoltCheckInterval;
|
sl@0
|
294 |
if(GetUintFromConfig(aSection, KVoltageinterval(), expectedVoltCheckInterval))
|
sl@0
|
295 |
{
|
sl@0
|
296 |
if(psuInfo.iVoltCheckInterval != expectedVoltCheckInterval)
|
sl@0
|
297 |
{
|
sl@0
|
298 |
SetBlockResult(EFail);
|
sl@0
|
299 |
ERR_PRINTF3(_L("psuInfo.iVoltCheckInterval(%d) != expectedVoltCheckInterval(%d)"), psuInfo.iVoltCheckInterval, expectedVoltCheckInterval);
|
sl@0
|
300 |
}
|
sl@0
|
301 |
}
|
sl@0
|
302 |
else
|
sl@0
|
303 |
{
|
sl@0
|
304 |
SetBlockResult(EFail);
|
sl@0
|
305 |
WARN_PRINTF1(_L("VoltCheckInterval Value Missing From INI File"));
|
sl@0
|
306 |
}
|
sl@0
|
307 |
//VoltCheckMethod
|
sl@0
|
308 |
switch(psuInfo.iVoltCheckMethod)
|
sl@0
|
309 |
{
|
sl@0
|
310 |
case EDPsuChkComparator:
|
sl@0
|
311 |
{
|
sl@0
|
312 |
INFO_PRINTF1(_L("PSU VoltCheck Method is Comparator"));
|
sl@0
|
313 |
break;
|
sl@0
|
314 |
}
|
sl@0
|
315 |
case EDPsuChkADCType:
|
sl@0
|
316 |
{
|
sl@0
|
317 |
INFO_PRINTF1(_L("PSU VoltCheck Method is ADCType"));
|
sl@0
|
318 |
break;
|
sl@0
|
319 |
}
|
sl@0
|
320 |
case EDPsuChkADCType2:
|
sl@0
|
321 |
{
|
sl@0
|
322 |
INFO_PRINTF1(_L("PSU VoltCheck Method is ADCType2"));
|
sl@0
|
323 |
break;
|
sl@0
|
324 |
}
|
sl@0
|
325 |
default:
|
sl@0
|
326 |
ERR_PRINTF2(_L("PSU VoltCheck Method is Not Supported=%d"),psuInfo.iVoltCheckMethod);
|
sl@0
|
327 |
}
|
sl@0
|
328 |
TInt expectedVoltCheckMethod;
|
sl@0
|
329 |
if ( GetEnumFromConfig(aSection, KVoltagecheck(), iEnumTableVoltageCheckMethod, expectedVoltCheckMethod) )
|
sl@0
|
330 |
{
|
sl@0
|
331 |
if(psuInfo.iVoltCheckMethod != (TUint)expectedVoltCheckMethod)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
SetBlockResult(EFail);
|
sl@0
|
334 |
ERR_PRINTF3(_L("psuInfo.iVoltCheckMethod(%d) != expectedVoltCheckMethod(%d)"), psuInfo.iVoltCheckMethod, expectedVoltCheckMethod);
|
sl@0
|
335 |
}
|
sl@0
|
336 |
}
|
sl@0
|
337 |
else
|
sl@0
|
338 |
{
|
sl@0
|
339 |
SetBlockResult(EFail);
|
sl@0
|
340 |
WARN_PRINTF1(_L("expectedVoltCheckMethod Value Missing From INI File"));
|
sl@0
|
341 |
}
|
sl@0
|
342 |
|
sl@0
|
343 |
}
|
sl@0
|
344 |
}
|
sl@0
|
345 |
|
sl@0
|
346 |
/**
|
sl@0
|
347 |
* TPBusState Information
|
sl@0
|
348 |
*
|
sl@0
|
349 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
350 |
*
|
sl@0
|
351 |
* @return void
|
sl@0
|
352 |
*
|
sl@0
|
353 |
* @leave System wide error
|
sl@0
|
354 |
*/
|
sl@0
|
355 |
void CT_MMCSDPsuDriverData::DoCmdPbusState(const TDesC& aSection)
|
sl@0
|
356 |
{
|
sl@0
|
357 |
TInt err;
|
sl@0
|
358 |
TInt pbusState;
|
sl@0
|
359 |
err= iMmcSDController->PbusState(pbusState);
|
sl@0
|
360 |
if(err != KErrNone)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
ERR_PRINTF2(_L("MMC/SD : Error in getting PbusState information, error code = %d \n"),err);
|
sl@0
|
363 |
SetError(err);
|
sl@0
|
364 |
}
|
sl@0
|
365 |
else
|
sl@0
|
366 |
{
|
sl@0
|
367 |
switch(pbusState)
|
sl@0
|
368 |
{
|
sl@0
|
369 |
case EBusCardAbsent:
|
sl@0
|
370 |
{
|
sl@0
|
371 |
WARN_PRINTF1(_L("Card is absent in the slot"));
|
sl@0
|
372 |
break;
|
sl@0
|
373 |
}
|
sl@0
|
374 |
case EBusOff:
|
sl@0
|
375 |
{
|
sl@0
|
376 |
INFO_PRINTF1(_L("Bus State is OFF"));
|
sl@0
|
377 |
break;
|
sl@0
|
378 |
}
|
sl@0
|
379 |
case EBusPoweringUp:
|
sl@0
|
380 |
{
|
sl@0
|
381 |
INFO_PRINTF1(_L("Bus State is Powerwing Up"));
|
sl@0
|
382 |
break;
|
sl@0
|
383 |
}
|
sl@0
|
384 |
case EBusOn:
|
sl@0
|
385 |
{
|
sl@0
|
386 |
INFO_PRINTF1(_L("Bus State is Power ON"));
|
sl@0
|
387 |
break;
|
sl@0
|
388 |
}
|
sl@0
|
389 |
case EBusPsuFault:
|
sl@0
|
390 |
{
|
sl@0
|
391 |
WARN_PRINTF1(_L("Bus State is BusPsuFault"));
|
sl@0
|
392 |
break;
|
sl@0
|
393 |
}
|
sl@0
|
394 |
case EBusPowerUpPending:
|
sl@0
|
395 |
{
|
sl@0
|
396 |
INFO_PRINTF1(_L("Bus State is BusPowerUpPending"));
|
sl@0
|
397 |
break;
|
sl@0
|
398 |
}
|
sl@0
|
399 |
default:
|
sl@0
|
400 |
ERR_PRINTF2(_L("Bus State Not Supported = %d"),pbusState);
|
sl@0
|
401 |
}
|
sl@0
|
402 |
TInt expectedPbusState;
|
sl@0
|
403 |
if ( GetEnumFromConfig(aSection, KPbusState(), iEnumTablePbusState, expectedPbusState) )
|
sl@0
|
404 |
{
|
sl@0
|
405 |
if(pbusState != expectedPbusState)
|
sl@0
|
406 |
{
|
sl@0
|
407 |
ERR_PRINTF3(_L("pbusState(%d) != expectedPbusState(%d)"), pbusState, expectedPbusState);
|
sl@0
|
408 |
SetBlockResult(EFail);
|
sl@0
|
409 |
}
|
sl@0
|
410 |
}
|
sl@0
|
411 |
else
|
sl@0
|
412 |
{
|
sl@0
|
413 |
SetBlockResult(EFail);
|
sl@0
|
414 |
WARN_PRINTF1(_L("expectedPbusState Value Missing From INI File"));
|
sl@0
|
415 |
}
|
sl@0
|
416 |
}
|
sl@0
|
417 |
|
sl@0
|
418 |
}
|
sl@0
|
419 |
|
sl@0
|
420 |
/**
|
sl@0
|
421 |
* Set Power Supply State
|
sl@0
|
422 |
*
|
sl@0
|
423 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
424 |
*
|
sl@0
|
425 |
* @return void
|
sl@0
|
426 |
*
|
sl@0
|
427 |
* @leave System wide error
|
sl@0
|
428 |
*/
|
sl@0
|
429 |
void CT_MMCSDPsuDriverData::DoCmdSetPsuState(const TDesC& aSection)
|
sl@0
|
430 |
{
|
sl@0
|
431 |
TInt err;
|
sl@0
|
432 |
TInt psuState;
|
sl@0
|
433 |
GetIntFromConfig(aSection, KPsuState(), psuState);
|
sl@0
|
434 |
err=iMmcSDController->SetPsuState(psuState);
|
sl@0
|
435 |
if(err != KErrNone)
|
sl@0
|
436 |
{
|
sl@0
|
437 |
ERR_PRINTF2(_L("MMCSD : Error in Setting PowerSupply State, error code = %d \n"),err);
|
sl@0
|
438 |
SetError(err);
|
sl@0
|
439 |
}
|
sl@0
|
440 |
}
|
sl@0
|
441 |
|
sl@0
|
442 |
/**
|
sl@0
|
443 |
* PSU VCC State Information
|
sl@0
|
444 |
*
|
sl@0
|
445 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
446 |
*
|
sl@0
|
447 |
* @return void
|
sl@0
|
448 |
*
|
sl@0
|
449 |
* @leave System wide error
|
sl@0
|
450 |
*/
|
sl@0
|
451 |
void CT_MMCSDPsuDriverData::DoCmdVccState(const TDesC& aSection)
|
sl@0
|
452 |
{
|
sl@0
|
453 |
TInt err;
|
sl@0
|
454 |
TInt vccState;
|
sl@0
|
455 |
err= iMmcSDController->VccState(vccState);
|
sl@0
|
456 |
if(err != KErrNone)
|
sl@0
|
457 |
{
|
sl@0
|
458 |
ERR_PRINTF2(_L("MMC/SD : Error in getting VccState information, error code = %d \n"),err);
|
sl@0
|
459 |
SetBlockResult(EFail);
|
sl@0
|
460 |
}
|
sl@0
|
461 |
else
|
sl@0
|
462 |
{
|
sl@0
|
463 |
switch(vccState)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
case EDPsuOff:
|
sl@0
|
466 |
{
|
sl@0
|
467 |
INFO_PRINTF1(_L("PSU VCC State is PsuOff "));
|
sl@0
|
468 |
break;
|
sl@0
|
469 |
}
|
sl@0
|
470 |
case EDPsuOnCurLimit:
|
sl@0
|
471 |
{
|
sl@0
|
472 |
INFO_PRINTF1(_L("PSU VCC State is PsuOnCurLimit "));
|
sl@0
|
473 |
break;
|
sl@0
|
474 |
}
|
sl@0
|
475 |
case EDPsuOnFull:
|
sl@0
|
476 |
{
|
sl@0
|
477 |
INFO_PRINTF1(_L("PSU VCC State is PsuOnFull "));
|
sl@0
|
478 |
break;
|
sl@0
|
479 |
}
|
sl@0
|
480 |
default:
|
sl@0
|
481 |
ERR_PRINTF2(_L("PSU VCC State Not Supported = %d"),vccState);
|
sl@0
|
482 |
}
|
sl@0
|
483 |
TInt expectedvccState;
|
sl@0
|
484 |
if ( GetEnumFromConfig(aSection, KVccState(), iEnumTableVccState, expectedvccState) )
|
sl@0
|
485 |
{
|
sl@0
|
486 |
if(vccState != expectedvccState)
|
sl@0
|
487 |
{
|
sl@0
|
488 |
ERR_PRINTF3(_L("vccState(%d) != expectedvccState(%d)"), vccState, expectedvccState);
|
sl@0
|
489 |
SetBlockResult(EFail);
|
sl@0
|
490 |
}
|
sl@0
|
491 |
}
|
sl@0
|
492 |
else
|
sl@0
|
493 |
{
|
sl@0
|
494 |
SetBlockResult(EFail);
|
sl@0
|
495 |
WARN_PRINTF1(_L("expectedvccState Value Missing From INI File"));
|
sl@0
|
496 |
}
|
sl@0
|
497 |
}
|
sl@0
|
498 |
}
|
sl@0
|
499 |
/**
|
sl@0
|
500 |
*Set Psu Voltage in OCR Format
|
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 |
* @leave System wide error
|
sl@0
|
507 |
*/
|
sl@0
|
508 |
void CT_MMCSDPsuDriverData::DoCmdSetPsuVoltage(const TDesC& aSection)
|
sl@0
|
509 |
{
|
sl@0
|
510 |
TInt err;
|
sl@0
|
511 |
TUint psuVoltage; //OCR Register Format
|
sl@0
|
512 |
GetUintFromConfig(aSection, KPsuVoltage(), psuVoltage);
|
sl@0
|
513 |
err=iMmcSDController->SetPsuVoltage(psuVoltage);
|
sl@0
|
514 |
if(err != KErrNone)
|
sl@0
|
515 |
{
|
sl@0
|
516 |
ERR_PRINTF2(_L("MMCSD : Error in Setting Psu Voltage, error code = %d \n"),err);
|
sl@0
|
517 |
SetError(err);
|
sl@0
|
518 |
}
|
sl@0
|
519 |
}
|
sl@0
|
520 |
|
sl@0
|
521 |
/**
|
sl@0
|
522 |
*Reads the MMCSD power supply unit number
|
sl@0
|
523 |
*
|
sl@0
|
524 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
525 |
*
|
sl@0
|
526 |
* @return void
|
sl@0
|
527 |
*
|
sl@0
|
528 |
* @leave System wide error
|
sl@0
|
529 |
*/
|
sl@0
|
530 |
void CT_MMCSDPsuDriverData::DoCmdPsuNumber(const TDesC& aSection)
|
sl@0
|
531 |
{
|
sl@0
|
532 |
TInt err;
|
sl@0
|
533 |
TInt psuNumber;
|
sl@0
|
534 |
err=iMmcSDController->PsuNumber(psuNumber);
|
sl@0
|
535 |
if(err != KErrNone)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
ERR_PRINTF2(_L("MMCSD : Error in reading PSU Number from the platform, error code = %d \n"),err);
|
sl@0
|
538 |
SetError(err);
|
sl@0
|
539 |
}
|
sl@0
|
540 |
else
|
sl@0
|
541 |
{
|
sl@0
|
542 |
INFO_PRINTF2(_L("MMCSD Psu Number on platform = %d \n"),psuNumber);
|
sl@0
|
543 |
TInt expectedpsuNumber;
|
sl@0
|
544 |
if(GetIntFromConfig(aSection, KExpectedpsuNumber(), expectedpsuNumber))
|
sl@0
|
545 |
{
|
sl@0
|
546 |
if(psuNumber != expectedpsuNumber)
|
sl@0
|
547 |
{
|
sl@0
|
548 |
ERR_PRINTF3(_L("psuNumber(%d) != expectedpsuNumber(%d)"), psuNumber, expectedpsuNumber);
|
sl@0
|
549 |
SetBlockResult(EFail);
|
sl@0
|
550 |
}
|
sl@0
|
551 |
}
|
sl@0
|
552 |
else
|
sl@0
|
553 |
{
|
sl@0
|
554 |
SetBlockResult(EFail);
|
sl@0
|
555 |
WARN_PRINTF1(_L("expectedpsuNumber Value Missing From INI File"));
|
sl@0
|
556 |
}
|
sl@0
|
557 |
}
|
sl@0
|
558 |
}
|
sl@0
|
559 |
|
sl@0
|
560 |
/**
|
sl@0
|
561 |
*Reads the MMCSD Media Change ID
|
sl@0
|
562 |
*
|
sl@0
|
563 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
564 |
*
|
sl@0
|
565 |
* @return void
|
sl@0
|
566 |
*
|
sl@0
|
567 |
* @leave System wide error
|
sl@0
|
568 |
*/
|
sl@0
|
569 |
void CT_MMCSDPsuDriverData::DoCmdMediaChangeID(const TDesC& aSection)
|
sl@0
|
570 |
{
|
sl@0
|
571 |
TInt err;
|
sl@0
|
572 |
TInt mediaChangeNumber;
|
sl@0
|
573 |
err=iMmcSDController->MediaChangeID(mediaChangeNumber);
|
sl@0
|
574 |
if(err != KErrNone)
|
sl@0
|
575 |
{
|
sl@0
|
576 |
ERR_PRINTF2(_L("MMCSD : Error in reading MeadiaChangeID from the platform, error code = %d \n"),err);
|
sl@0
|
577 |
SetError(err);
|
sl@0
|
578 |
}
|
sl@0
|
579 |
else
|
sl@0
|
580 |
{
|
sl@0
|
581 |
INFO_PRINTF2(_L("MMCSD MeadiaChangeID on platform = %d \n"),mediaChangeNumber);
|
sl@0
|
582 |
TInt expectedmediaChangeNumber;
|
sl@0
|
583 |
if(GetIntFromConfig(aSection, KExpectedmediaChangeNumber(), expectedmediaChangeNumber))
|
sl@0
|
584 |
{
|
sl@0
|
585 |
if(mediaChangeNumber != expectedmediaChangeNumber)
|
sl@0
|
586 |
{
|
sl@0
|
587 |
ERR_PRINTF3(_L("mediaChangeNumber(%d) != expectedmediaChangeNumber(%d)"), mediaChangeNumber, expectedmediaChangeNumber);
|
sl@0
|
588 |
SetBlockResult(EFail);
|
sl@0
|
589 |
};
|
sl@0
|
590 |
}
|
sl@0
|
591 |
else
|
sl@0
|
592 |
{
|
sl@0
|
593 |
SetBlockResult(EFail);
|
sl@0
|
594 |
WARN_PRINTF1(_L("expectedmediaChangeNumber Value Missing From INI File"));
|
sl@0
|
595 |
}
|
sl@0
|
596 |
}
|
sl@0
|
597 |
|
sl@0
|
598 |
}
|
sl@0
|
599 |
|
sl@0
|
600 |
/**
|
sl@0
|
601 |
*Reads PSU current is limited to a safe level or Not
|
sl@0
|
602 |
*
|
sl@0
|
603 |
* @param aSection The section in the ini containing data for the command
|
sl@0
|
604 |
*
|
sl@0
|
605 |
* @return void
|
sl@0
|
606 |
*
|
sl@0
|
607 |
* @leave System wide error
|
sl@0
|
608 |
*/
|
sl@0
|
609 |
void CT_MMCSDPsuDriverData::DoCmdPsuCurLimit(const TDesC& aSection)
|
sl@0
|
610 |
{
|
sl@0
|
611 |
TInt err;
|
sl@0
|
612 |
TBool psuCurLimit;
|
sl@0
|
613 |
err=iMmcSDController->PsuCurLimit(psuCurLimit);
|
sl@0
|
614 |
if(err != KErrNone)
|
sl@0
|
615 |
{
|
sl@0
|
616 |
ERR_PRINTF2(_L("MMCSD : Error in reading PsuCurLimit from the platform, error code = %d \n"),err);
|
sl@0
|
617 |
SetError(err);
|
sl@0
|
618 |
}
|
sl@0
|
619 |
else
|
sl@0
|
620 |
{
|
sl@0
|
621 |
INFO_PRINTF2(_L("MMCSD PsuCurLimit on platform = %d \n"),psuCurLimit);
|
sl@0
|
622 |
TInt expectedpsuCurLimit;
|
sl@0
|
623 |
if(GetIntFromConfig(aSection, KExpectedpsuCurLimit(), expectedpsuCurLimit))
|
sl@0
|
624 |
{
|
sl@0
|
625 |
if(psuCurLimit != expectedpsuCurLimit)
|
sl@0
|
626 |
{
|
sl@0
|
627 |
ERR_PRINTF3(_L("psuCurLimit(%d) != expectedpsuCurLimit(%d)"), psuCurLimit, expectedpsuCurLimit);
|
sl@0
|
628 |
SetBlockResult(EFail);
|
sl@0
|
629 |
}
|
sl@0
|
630 |
}
|
sl@0
|
631 |
else
|
sl@0
|
632 |
{
|
sl@0
|
633 |
SetBlockResult(EFail);
|
sl@0
|
634 |
WARN_PRINTF1(_L("expectedpsuCurLimit Value Missing From INI File"));
|
sl@0
|
635 |
}
|
sl@0
|
636 |
}
|
sl@0
|
637 |
}
|