First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 // The max OTG state/event/message text length
23 #define MAX_DSTRLEN 40
31 static TBool& LddLoaded();
33 virtual void AssertionFailed(TInt aFailResult, const TDesC &aErrorDescription)=0;
34 virtual void AssertionFailed2(TInt aFailResult, const TDesC &aErrorDescription, TInt errorCode)=0;
35 virtual TBool IsActiveOutstanding() = 0;
37 ///////////////////////////////////////////////////////////////////////
38 // UTILITY Helper methods
40 static void OtgEventString(const RUsbOtgDriver::TOtgEvent aEvent,
41 TBuf<MAX_DSTRLEN> &aDescription
43 static void OtgStateString(const RUsbOtgDriver::TOtgState aState, TBuf<MAX_DSTRLEN> &aDescription);
44 static void OtgMessageString(const RUsbOtgDriver::TOtgMessage aMessage, TBuf<MAX_DSTRLEN> &aDescription);
45 static void PeripheralStateString(TUint aPeripheralState, TBuf<MAX_DSTRLEN> &aDescription);
46 static void AConnectionIdleString(RUsbOtgDriver::TOtgConnection aAConnectionIdle, TBuf<MAX_DSTRLEN> &aDescription);
48 ///////////////////////////////////////////////////////////////////////
49 // RUsbOtgDriver API wrapper methods
51 TInt otgLoadLdd(); // load and start stack
52 void otgUnloadLdd();// unload only
54 // open/close the user/kernel channel
58 // (Test) Activation of OPT (USB HOST/OTG Stack) tests
59 TInt otgActivateOptTestMode();
61 // Start/stop the HOST+OTG stack
62 TInt otgStartStacks();
65 // Activate T_OTGDI FDF Actor
67 // Bus Control (Raise/Lower VBus)
70 TInt otgBusRespondSRP();
71 TInt otgBusClearError();
73 // Functions to kick off and shut down the t_otgdi_fdfactor.exe
74 // Necessary for back-to-back tests for HNP / SRP
75 TInt otgActivateFdfActor();
76 void otgDeactivateFdfActor();
82 void otgQueueOtgEventRequest(RUsbOtgDriver::TOtgEvent& aEvent, TRequestStatus& aStatus);
83 void otgCancelOtgEventRequest();
88 void otgQueueOtgStateRequest(RUsbOtgDriver::TOtgState& aState, TRequestStatus& aStatus);
89 void otgCancelOtgStateRequest();
92 QueueOtgMessageRequest
94 void otgQueueOtgMessageRequest(RUsbOtgDriver::TOtgMessage& aMessage, TRequestStatus& aStatus);
95 void otgCancelOtgMessageRequest();
98 QueuePeripheralStateRequest
100 void otgQueuePeripheralStateRequest(TUint& aPeripheralState, TRequestStatus& aStatus);
101 void otgCancelPeripheralStateRequest();
104 QueueAConnectionIdleRequest
106 void otgQueueAConnectionIdleRequest(RUsbOtgDriver::TOtgConnection& aAConnectionIdle, TRequestStatus& aStatus);
107 void otgCancelAConnectionIdleRequest();
109 // New ID_PIN API calls
110 void otgQueueOtgIdPinNotification(RUsbOtgDriver::TOtgIdPin& aIdPin, TRequestStatus& aRequest);
111 void otgCancelOtgIdPinNotification();
113 // New VBus API calls
114 void otgQueueOtgVbusNotification(RUsbOtgDriver::TOtgVbus& aVbus, TRequestStatus& aStatus);
115 void otgCancelOtgVbusNotification();
117 TBool otgIdPinPresent();
118 TBool otgVbusPresent();
120 static TBool SetLoaded(TBool aState); // internal flag
122 // await arrival of a specific message/event/state
123 //TBool ExpectOTGEvent(const RUsbOtgDriver::TOtgEvent eventID, TInt timeoutMs=-1);
124 //TBool ExpectOTGMessage(const RUsbOtgDriver::TOtgMessage messageID, TInt timeoutMs=-1);
126 void SetMaxPowerToL(TUint16 val);
127 void GetMaxPower(TUint16& val);
133 TBool StepUnloadLDD();
135 void StepSetOptActive();
136 TBool StepUnloadClient();
137 TBool StepLoadClient(TUint16 aPID, TBool aEnableHNP=ETrue, TBool aEnableSRP=ETrue);
138 TBool StepDisconnect();
140 TBool StepChangeVidPid(TUint16 aVID, TUint16 aPID);
145 RUsbOtgDriver::TOtgEvent iOTGEvent;
146 RUsbOtgDriver::TOtgState iOTGState;
147 RUsbOtgDriver::TOtgMessage iOTGMessage;
148 RUsbOtgDriver::TOtgIdPin iOTGIdPin;
149 RUsbOtgDriver::TOtgVbus iOTGVBus;
150 TUint iPeripheralState;
151 RUsbOtgDriver::TOtgConnection iAConnectionIdle;
154 static TBool iLoadedLdd;
155 static TBool iFdfActorActive;
158 static RProcess iFdfActorProcess
162 #endif /*OTGROOT_H_*/