os/kernelhwsrv/kerneltest/e32test/usbho/t_otgdi/inc/otgroot.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/usbho/t_otgdi/inc/otgroot.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,162 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// @internalComponent
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef OTGROOT_H_
    1.22 +#define OTGROOT_H_
    1.23 +
    1.24 +
    1.25 +// The max OTG state/event/message text length
    1.26 +#define MAX_DSTRLEN		40
    1.27 +
    1.28 +
    1.29 +class COtgRoot 
    1.30 +	{
    1.31 +public:
    1.32 +	COtgRoot();
    1.33 +	
    1.34 +	static TBool& LddLoaded();
    1.35 +
    1.36 +	virtual void AssertionFailed(TInt aFailResult, const TDesC &aErrorDescription)=0;
    1.37 +	virtual void AssertionFailed2(TInt aFailResult, const TDesC &aErrorDescription, TInt errorCode)=0;
    1.38 +	virtual TBool IsActiveOutstanding() = 0;
    1.39 +	
    1.40 +	///////////////////////////////////////////////////////////////////////
    1.41 +	// UTILITY Helper methods
    1.42 +
    1.43 +	static void OtgEventString(const RUsbOtgDriver::TOtgEvent aEvent, 
    1.44 +	                            TBuf<MAX_DSTRLEN> &aDescription
    1.45 +	                          );
    1.46 +	static void OtgStateString(const RUsbOtgDriver::TOtgState aState, TBuf<MAX_DSTRLEN> &aDescription);	                          
    1.47 +	static void OtgMessageString(const RUsbOtgDriver::TOtgMessage aMessage, TBuf<MAX_DSTRLEN> &aDescription);	
    1.48 +	static void PeripheralStateString(TUint aPeripheralState, TBuf<MAX_DSTRLEN> &aDescription);
    1.49 +	static void AConnectionIdleString(RUsbOtgDriver::TOtgConnection aAConnectionIdle, TBuf<MAX_DSTRLEN> &aDescription);
    1.50 +	
    1.51 +	///////////////////////////////////////////////////////////////////////
    1.52 +    // RUsbOtgDriver API wrapper methods
    1.53 +    
    1.54 +    TInt otgLoadLdd(); // load and start stack
    1.55 +    void otgUnloadLdd();// unload only
    1.56 +    
    1.57 +    // open/close the user/kernel channel
    1.58 +    TInt otgOpen();
    1.59 +    void otgClose();
    1.60 +    
    1.61 +	// (Test) Activation of OPT (USB HOST/OTG Stack) tests
    1.62 +	TInt otgActivateOptTestMode();
    1.63 +
    1.64 +    // Start/stop the HOST+OTG stack
    1.65 +	TInt otgStartStacks();
    1.66 +	void otgStopStacks();
    1.67 +	
    1.68 +	// Activate T_OTGDI FDF Actor
    1.69 +	
    1.70 +    // Bus Control (Raise/Lower VBus)
    1.71 +	TInt otgBusRequest();
    1.72 +	TInt otgBusDrop();
    1.73 +	TInt otgBusRespondSRP();
    1.74 +	TInt otgBusClearError();
    1.75 +
    1.76 +	//	Functions to kick off and shut down the t_otgdi_fdfactor.exe
    1.77 +	//	Necessary for back-to-back tests for HNP / SRP
    1.78 +	TInt otgActivateFdfActor();
    1.79 +	void otgDeactivateFdfActor();
    1.80 +	
    1.81 +	
    1.82 +    /**
    1.83 +    QueueOtgEventRequest
    1.84 +    */
    1.85 +    void otgQueueOtgEventRequest(RUsbOtgDriver::TOtgEvent& aEvent, TRequestStatus& aStatus);
    1.86 +	void otgCancelOtgEventRequest();
    1.87 +    	
    1.88 +    /**
    1.89 +    QueueOtgEventRequest
    1.90 +    */
    1.91 +    void otgQueueOtgStateRequest(RUsbOtgDriver::TOtgState& aState, TRequestStatus& aStatus);
    1.92 +	void otgCancelOtgStateRequest();
    1.93 +
    1.94 +    /**
    1.95 +    QueueOtgMessageRequest
    1.96 +    */
    1.97 +    void otgQueueOtgMessageRequest(RUsbOtgDriver::TOtgMessage& aMessage, TRequestStatus& aStatus);
    1.98 +	void otgCancelOtgMessageRequest();
    1.99 +	
   1.100 +    /**
   1.101 +    QueuePeripheralStateRequest
   1.102 +    */
   1.103 +    void otgQueuePeripheralStateRequest(TUint& aPeripheralState, TRequestStatus& aStatus);
   1.104 +	void otgCancelPeripheralStateRequest();
   1.105 +	
   1.106 +    /**
   1.107 +    QueueAConnectionIdleRequest
   1.108 +    */
   1.109 +    void otgQueueAConnectionIdleRequest(RUsbOtgDriver::TOtgConnection& aAConnectionIdle, TRequestStatus& aStatus);
   1.110 +	void otgCancelAConnectionIdleRequest();
   1.111 +	
   1.112 +	// New ID_PIN API calls
   1.113 +	void otgQueueOtgIdPinNotification(RUsbOtgDriver::TOtgIdPin& aIdPin, TRequestStatus& aRequest);
   1.114 +	void otgCancelOtgIdPinNotification();
   1.115 +	
   1.116 +	// New VBus API calls
   1.117 +	void otgQueueOtgVbusNotification(RUsbOtgDriver::TOtgVbus& aVbus, TRequestStatus& aStatus);
   1.118 +	void otgCancelOtgVbusNotification();
   1.119 +	
   1.120 +	TBool otgIdPinPresent();
   1.121 +	TBool otgVbusPresent();
   1.122 +    	
   1.123 +	static TBool SetLoaded(TBool aState);	// internal flag
   1.124 +
   1.125 +	// await arrival of a specific message/event/state
   1.126 +	//TBool ExpectOTGEvent(const RUsbOtgDriver::TOtgEvent eventID, TInt timeoutMs=-1);
   1.127 +	//TBool ExpectOTGMessage(const RUsbOtgDriver::TOtgMessage messageID, TInt timeoutMs=-1);
   1.128 +	
   1.129 +	void SetMaxPowerToL(TUint16 val);
   1.130 +	void GetMaxPower(TUint16& val);
   1.131 +	
   1.132 +private:
   1.133 +	
   1.134 +//protected:
   1.135 +public:
   1.136 +    TBool StepUnloadLDD();
   1.137 +    TBool StepLoadLDD();
   1.138 +	void  StepSetOptActive();
   1.139 +    TBool StepUnloadClient();
   1.140 +    TBool StepLoadClient(TUint16 aPID, TBool aEnableHNP=ETrue, TBool aEnableSRP=ETrue);
   1.141 +    TBool StepDisconnect();
   1.142 +    TBool StepConnect();
   1.143 +    TBool StepChangeVidPid(TUint16 aVID, TUint16 aPID);
   1.144 +    
   1.145 +protected:
   1.146 +
   1.147 +	// API datas
   1.148 +	RUsbOtgDriver::TOtgEvent 	iOTGEvent;
   1.149 +	RUsbOtgDriver::TOtgState 	iOTGState;
   1.150 +	RUsbOtgDriver::TOtgMessage 	iOTGMessage;
   1.151 +	RUsbOtgDriver::TOtgIdPin	iOTGIdPin;
   1.152 +	RUsbOtgDriver::TOtgVbus   	iOTGVBus;
   1.153 +	TUint 						iPeripheralState;
   1.154 +	RUsbOtgDriver::TOtgConnection iAConnectionIdle;
   1.155 +	// api flags
   1.156 +	TBool iOptActive;
   1.157 +	static TBool 	iLoadedLdd;
   1.158 +	static TBool 	iFdfActorActive;
   1.159 +	
   1.160 +	//	FDF Actor handle
   1.161 +	static RProcess	iFdfActorProcess
   1.162 +	};
   1.163 +
   1.164 +
   1.165 +#endif /*OTGROOT_H_*/