Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
24 #include "d_mmcsdif.h"
27 * Do a kernel side control for DMMCPsu
29 * @param TInt aFunction - Request Function ID
30 * @param TAny* a1 - Given parameter
31 * @param TAny* a2 - Given parameter
33 * @return TInt the error code
37 TInt DLddMmcCntrlInterface::PsuDoControl(TInt aFunction, TAny* a1, TAny* a2)
39 MMCSDLOG("<--PsuDoControl-->");
44 MMCSDLOG("DLddMmcCntrlInterface::PsuDoControl - iPsu is NULL");
49 MMCSDLOG("DLddMmcCntrlInterface::PsuDoControl - iClient is NULL");
53 switch(TTCFunctionId(aFunction).FunctionId())
55 case RMMCSDTestControllerInterface::EPsu:
57 r = Kern::ThreadRawWrite(iClient, a1, &iPsu, sizeof(iPsu));
60 case RMMCSDTestControllerInterface::EPsuInfo:
63 MMCSDLOG("<--PsuInfo-->");
64 iPsu->PsuInfo(psuInfo);
65 r = Kern::ThreadRawWrite(iClient, a1, &psuInfo, sizeof(TPBusPsuInfo));
68 case RMMCSDTestControllerInterface::EPsuState:
73 aState = (TPBusPsuState&)a1;
74 r= iPsu->SetState(aState);
75 MMCSDLOG2("EPsuState :%d", aState);
83 case RMMCSDTestControllerInterface::EPsuVoltage:
88 aVoltOpRange = (TUint32)a1;
89 iPsu->SetVoltage(aVoltOpRange);
90 MMCSDLOG2("EPsuVoltage :0x%x", aVoltOpRange);
98 case RMMCSDTestControllerInterface::EPsuNum:
102 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iPsuNum, sizeof(TInt));
103 MMCSDLOG2("EPsuNum :%d", &iPsu->iPsuNum);
111 case RMMCSDTestControllerInterface::EMediaChangeNum:
115 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iMediaChangeNum, sizeof(TInt));
116 MMCSDLOG2("EMediaChangeNum :%d", &iPsu->iMediaChangeNum);
124 case RMMCSDTestControllerInterface::EPsuCurLimit:
128 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iCurrLimited, sizeof(TBool));
129 MMCSDLOG2("EPsuCurLimit :%d", &iPsu->iCurrLimited);
137 case RMMCSDTestControllerInterface::EPbusState:
141 r = Kern::ThreadRawWrite(iClient, a1, &iSocket->iState, sizeof(TInt));
142 MMCSDLOG2("EPbusState :%d", &iSocket->iState);
146 MMCSDLOG("RMMCSDTestControllerInterface::EPbusState - iSocket is NULL");
151 case RMMCSDTestControllerInterface::EVccState:
155 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iState,sizeof(TInt));
156 MMCSDLOG2("EVccState :%d", &iPsu->iState);
164 case RMMCSDTestControllerInterface::EIsLocked:
168 TBool lock =iPsu->IsLocked();
169 r = Kern::ThreadRawWrite(iClient, a1, &lock,sizeof(TBool));
170 MMCSDLOG2("EIsLocked :%d", lock);
178 case RMMCSDTestControllerInterface::EIsOff:
182 TBool isoff =iPsu->IsOff();
183 r = Kern::ThreadRawWrite(iClient, a1, &isoff,sizeof(TBool));
184 MMCSDLOG2("EIsOff :%d", isoff);
192 case RMMCSDTestControllerInterface::EMaxCurrentInMicroAmps:
196 TInt current =iPsu->MaxCurrentInMicroAmps();
197 r = Kern::ThreadRawWrite(iClient, a1, ¤t,sizeof(TInt));
198 MMCSDLOG2("EMaxCurrentInMicroAmps :%d", current);
206 case RMMCSDTestControllerInterface::EResetInactivityTimer:
210 iPsu->ResetInactivityTimer();
211 MMCSDLOG("EResetInactivityTimer");
219 case RMMCSDTestControllerInterface::EVoltageSupported:
223 TUint vol =iPsu->VoltageSupported();
224 r = Kern::ThreadRawWrite(iClient, a1, &vol,sizeof(TUint));
225 MMCSDLOG2("EVoltageSupported :0x%x", vol);
233 case RMMCSDTestControllerInterface::EMemInactivityCount:
237 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iInactivityCount,sizeof(&iPsu->iInactivityCount));
238 MMCSDLOG2("EMemInactivityCount :%d", &iPsu->iInactivityCount);
246 case RMMCSDTestControllerInterface::EMemNotLockedCount:
250 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iNotLockedCount,sizeof(&iPsu->iNotLockedCount));
251 MMCSDLOG2("EMemNotLockedCount :%d", &iPsu->iNotLockedCount);
259 case RMMCSDTestControllerInterface::EMemInactivityTimeout:
263 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iInactivityTimeout,sizeof(&iPsu->iInactivityTimeout));
264 MMCSDLOG2("EMemInactivityTimeout :%d", &iPsu->iInactivityTimeout);
272 case RMMCSDTestControllerInterface::EMemNotLockedTimeout:
276 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iNotLockedTimeout,sizeof(&iPsu->iNotLockedTimeout));
277 MMCSDLOG2("EMemNotLockedTimeout :%d", &iPsu->iNotLockedTimeout);
285 case RMMCSDTestControllerInterface::EMemVoltageSupported:
289 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iVoltageSupported,sizeof(&iPsu->iVoltageSupported));
290 MMCSDLOG2("EMemVoltageSupported :%d", &iPsu->iVoltageSupported);
298 case RMMCSDTestControllerInterface::EMemMaxCurrentInMicroAmps:
302 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iMaxCurrentInMicroAmps,sizeof(&iPsu->iMaxCurrentInMicroAmps));
303 MMCSDLOG2("EMemMaxCurrentInMicroAmps :%d", &iPsu->iMaxCurrentInMicroAmps);
311 case RMMCSDTestControllerInterface::EMemVoltCheckInterval:
315 r = Kern::ThreadRawWrite(iClient, a1, &iPsu->iVoltCheckInterval,sizeof(&iPsu->iVoltCheckInterval));
316 MMCSDLOG2("EMemVoltCheckInterval :%d", &iPsu->iVoltCheckInterval);