os/kernelhwsrv/kerneltest/e32test/usbho/t_otgdi/inc/otgroot.h
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
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// @internalComponent
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef OTGROOT_H_
sl@0
    19
#define OTGROOT_H_
sl@0
    20
sl@0
    21
sl@0
    22
// The max OTG state/event/message text length
sl@0
    23
#define MAX_DSTRLEN		40
sl@0
    24
sl@0
    25
sl@0
    26
class COtgRoot 
sl@0
    27
	{
sl@0
    28
public:
sl@0
    29
	COtgRoot();
sl@0
    30
	
sl@0
    31
	static TBool& LddLoaded();
sl@0
    32
sl@0
    33
	virtual void AssertionFailed(TInt aFailResult, const TDesC &aErrorDescription)=0;
sl@0
    34
	virtual void AssertionFailed2(TInt aFailResult, const TDesC &aErrorDescription, TInt errorCode)=0;
sl@0
    35
	virtual TBool IsActiveOutstanding() = 0;
sl@0
    36
	
sl@0
    37
	///////////////////////////////////////////////////////////////////////
sl@0
    38
	// UTILITY Helper methods
sl@0
    39
sl@0
    40
	static void OtgEventString(const RUsbOtgDriver::TOtgEvent aEvent, 
sl@0
    41
	                            TBuf<MAX_DSTRLEN> &aDescription
sl@0
    42
	                          );
sl@0
    43
	static void OtgStateString(const RUsbOtgDriver::TOtgState aState, TBuf<MAX_DSTRLEN> &aDescription);	                          
sl@0
    44
	static void OtgMessageString(const RUsbOtgDriver::TOtgMessage aMessage, TBuf<MAX_DSTRLEN> &aDescription);	
sl@0
    45
	static void PeripheralStateString(TUint aPeripheralState, TBuf<MAX_DSTRLEN> &aDescription);
sl@0
    46
	static void AConnectionIdleString(RUsbOtgDriver::TOtgConnection aAConnectionIdle, TBuf<MAX_DSTRLEN> &aDescription);
sl@0
    47
	
sl@0
    48
	///////////////////////////////////////////////////////////////////////
sl@0
    49
    // RUsbOtgDriver API wrapper methods
sl@0
    50
    
sl@0
    51
    TInt otgLoadLdd(); // load and start stack
sl@0
    52
    void otgUnloadLdd();// unload only
sl@0
    53
    
sl@0
    54
    // open/close the user/kernel channel
sl@0
    55
    TInt otgOpen();
sl@0
    56
    void otgClose();
sl@0
    57
    
sl@0
    58
	// (Test) Activation of OPT (USB HOST/OTG Stack) tests
sl@0
    59
	TInt otgActivateOptTestMode();
sl@0
    60
sl@0
    61
    // Start/stop the HOST+OTG stack
sl@0
    62
	TInt otgStartStacks();
sl@0
    63
	void otgStopStacks();
sl@0
    64
	
sl@0
    65
	// Activate T_OTGDI FDF Actor
sl@0
    66
	
sl@0
    67
    // Bus Control (Raise/Lower VBus)
sl@0
    68
	TInt otgBusRequest();
sl@0
    69
	TInt otgBusDrop();
sl@0
    70
	TInt otgBusRespondSRP();
sl@0
    71
	TInt otgBusClearError();
sl@0
    72
sl@0
    73
	//	Functions to kick off and shut down the t_otgdi_fdfactor.exe
sl@0
    74
	//	Necessary for back-to-back tests for HNP / SRP
sl@0
    75
	TInt otgActivateFdfActor();
sl@0
    76
	void otgDeactivateFdfActor();
sl@0
    77
	
sl@0
    78
	
sl@0
    79
    /**
sl@0
    80
    QueueOtgEventRequest
sl@0
    81
    */
sl@0
    82
    void otgQueueOtgEventRequest(RUsbOtgDriver::TOtgEvent& aEvent, TRequestStatus& aStatus);
sl@0
    83
	void otgCancelOtgEventRequest();
sl@0
    84
    	
sl@0
    85
    /**
sl@0
    86
    QueueOtgEventRequest
sl@0
    87
    */
sl@0
    88
    void otgQueueOtgStateRequest(RUsbOtgDriver::TOtgState& aState, TRequestStatus& aStatus);
sl@0
    89
	void otgCancelOtgStateRequest();
sl@0
    90
sl@0
    91
    /**
sl@0
    92
    QueueOtgMessageRequest
sl@0
    93
    */
sl@0
    94
    void otgQueueOtgMessageRequest(RUsbOtgDriver::TOtgMessage& aMessage, TRequestStatus& aStatus);
sl@0
    95
	void otgCancelOtgMessageRequest();
sl@0
    96
	
sl@0
    97
    /**
sl@0
    98
    QueuePeripheralStateRequest
sl@0
    99
    */
sl@0
   100
    void otgQueuePeripheralStateRequest(TUint& aPeripheralState, TRequestStatus& aStatus);
sl@0
   101
	void otgCancelPeripheralStateRequest();
sl@0
   102
	
sl@0
   103
    /**
sl@0
   104
    QueueAConnectionIdleRequest
sl@0
   105
    */
sl@0
   106
    void otgQueueAConnectionIdleRequest(RUsbOtgDriver::TOtgConnection& aAConnectionIdle, TRequestStatus& aStatus);
sl@0
   107
	void otgCancelAConnectionIdleRequest();
sl@0
   108
	
sl@0
   109
	// New ID_PIN API calls
sl@0
   110
	void otgQueueOtgIdPinNotification(RUsbOtgDriver::TOtgIdPin& aIdPin, TRequestStatus& aRequest);
sl@0
   111
	void otgCancelOtgIdPinNotification();
sl@0
   112
	
sl@0
   113
	// New VBus API calls
sl@0
   114
	void otgQueueOtgVbusNotification(RUsbOtgDriver::TOtgVbus& aVbus, TRequestStatus& aStatus);
sl@0
   115
	void otgCancelOtgVbusNotification();
sl@0
   116
	
sl@0
   117
	TBool otgIdPinPresent();
sl@0
   118
	TBool otgVbusPresent();
sl@0
   119
    	
sl@0
   120
	static TBool SetLoaded(TBool aState);	// internal flag
sl@0
   121
sl@0
   122
	// await arrival of a specific message/event/state
sl@0
   123
	//TBool ExpectOTGEvent(const RUsbOtgDriver::TOtgEvent eventID, TInt timeoutMs=-1);
sl@0
   124
	//TBool ExpectOTGMessage(const RUsbOtgDriver::TOtgMessage messageID, TInt timeoutMs=-1);
sl@0
   125
	
sl@0
   126
	void SetMaxPowerToL(TUint16 val);
sl@0
   127
	void GetMaxPower(TUint16& val);
sl@0
   128
	
sl@0
   129
private:
sl@0
   130
	
sl@0
   131
//protected:
sl@0
   132
public:
sl@0
   133
    TBool StepUnloadLDD();
sl@0
   134
    TBool StepLoadLDD();
sl@0
   135
	void  StepSetOptActive();
sl@0
   136
    TBool StepUnloadClient();
sl@0
   137
    TBool StepLoadClient(TUint16 aPID, TBool aEnableHNP=ETrue, TBool aEnableSRP=ETrue);
sl@0
   138
    TBool StepDisconnect();
sl@0
   139
    TBool StepConnect();
sl@0
   140
    TBool StepChangeVidPid(TUint16 aVID, TUint16 aPID);
sl@0
   141
    
sl@0
   142
protected:
sl@0
   143
sl@0
   144
	// API datas
sl@0
   145
	RUsbOtgDriver::TOtgEvent 	iOTGEvent;
sl@0
   146
	RUsbOtgDriver::TOtgState 	iOTGState;
sl@0
   147
	RUsbOtgDriver::TOtgMessage 	iOTGMessage;
sl@0
   148
	RUsbOtgDriver::TOtgIdPin	iOTGIdPin;
sl@0
   149
	RUsbOtgDriver::TOtgVbus   	iOTGVBus;
sl@0
   150
	TUint 						iPeripheralState;
sl@0
   151
	RUsbOtgDriver::TOtgConnection iAConnectionIdle;
sl@0
   152
	// api flags
sl@0
   153
	TBool iOptActive;
sl@0
   154
	static TBool 	iLoadedLdd;
sl@0
   155
	static TBool 	iFdfActorActive;
sl@0
   156
	
sl@0
   157
	//	FDF Actor handle
sl@0
   158
	static RProcess	iFdfActorProcess
sl@0
   159
	};
sl@0
   160
sl@0
   161
sl@0
   162
#endif /*OTGROOT_H_*/