0
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// @internalComponent
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef OTGROOT_H_
|
|
19 |
#define OTGROOT_H_
|
|
20 |
|
|
21 |
|
|
22 |
// The max OTG state/event/message text length
|
|
23 |
#define MAX_DSTRLEN 40
|
|
24 |
|
|
25 |
|
|
26 |
class COtgRoot
|
|
27 |
{
|
|
28 |
public:
|
|
29 |
COtgRoot();
|
|
30 |
|
|
31 |
static TBool& LddLoaded();
|
|
32 |
|
|
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;
|
|
36 |
|
|
37 |
///////////////////////////////////////////////////////////////////////
|
|
38 |
// UTILITY Helper methods
|
|
39 |
|
|
40 |
static void OtgEventString(const RUsbOtgDriver::TOtgEvent aEvent,
|
|
41 |
TBuf<MAX_DSTRLEN> &aDescription
|
|
42 |
);
|
|
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);
|
|
47 |
|
|
48 |
///////////////////////////////////////////////////////////////////////
|
|
49 |
// RUsbOtgDriver API wrapper methods
|
|
50 |
|
|
51 |
TInt otgLoadLdd(); // load and start stack
|
|
52 |
void otgUnloadLdd();// unload only
|
|
53 |
|
|
54 |
// open/close the user/kernel channel
|
|
55 |
TInt otgOpen();
|
|
56 |
void otgClose();
|
|
57 |
|
|
58 |
// (Test) Activation of OPT (USB HOST/OTG Stack) tests
|
|
59 |
TInt otgActivateOptTestMode();
|
|
60 |
|
|
61 |
// Start/stop the HOST+OTG stack
|
|
62 |
TInt otgStartStacks();
|
|
63 |
void otgStopStacks();
|
|
64 |
|
|
65 |
// Activate T_OTGDI FDF Actor
|
|
66 |
|
|
67 |
// Bus Control (Raise/Lower VBus)
|
|
68 |
TInt otgBusRequest();
|
|
69 |
TInt otgBusDrop();
|
|
70 |
TInt otgBusRespondSRP();
|
|
71 |
TInt otgBusClearError();
|
|
72 |
|
|
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();
|
|
77 |
|
|
78 |
|
|
79 |
/**
|
|
80 |
QueueOtgEventRequest
|
|
81 |
*/
|
|
82 |
void otgQueueOtgEventRequest(RUsbOtgDriver::TOtgEvent& aEvent, TRequestStatus& aStatus);
|
|
83 |
void otgCancelOtgEventRequest();
|
|
84 |
|
|
85 |
/**
|
|
86 |
QueueOtgEventRequest
|
|
87 |
*/
|
|
88 |
void otgQueueOtgStateRequest(RUsbOtgDriver::TOtgState& aState, TRequestStatus& aStatus);
|
|
89 |
void otgCancelOtgStateRequest();
|
|
90 |
|
|
91 |
/**
|
|
92 |
QueueOtgMessageRequest
|
|
93 |
*/
|
|
94 |
void otgQueueOtgMessageRequest(RUsbOtgDriver::TOtgMessage& aMessage, TRequestStatus& aStatus);
|
|
95 |
void otgCancelOtgMessageRequest();
|
|
96 |
|
|
97 |
/**
|
|
98 |
QueuePeripheralStateRequest
|
|
99 |
*/
|
|
100 |
void otgQueuePeripheralStateRequest(TUint& aPeripheralState, TRequestStatus& aStatus);
|
|
101 |
void otgCancelPeripheralStateRequest();
|
|
102 |
|
|
103 |
/**
|
|
104 |
QueueAConnectionIdleRequest
|
|
105 |
*/
|
|
106 |
void otgQueueAConnectionIdleRequest(RUsbOtgDriver::TOtgConnection& aAConnectionIdle, TRequestStatus& aStatus);
|
|
107 |
void otgCancelAConnectionIdleRequest();
|
|
108 |
|
|
109 |
// New ID_PIN API calls
|
|
110 |
void otgQueueOtgIdPinNotification(RUsbOtgDriver::TOtgIdPin& aIdPin, TRequestStatus& aRequest);
|
|
111 |
void otgCancelOtgIdPinNotification();
|
|
112 |
|
|
113 |
// New VBus API calls
|
|
114 |
void otgQueueOtgVbusNotification(RUsbOtgDriver::TOtgVbus& aVbus, TRequestStatus& aStatus);
|
|
115 |
void otgCancelOtgVbusNotification();
|
|
116 |
|
|
117 |
TBool otgIdPinPresent();
|
|
118 |
TBool otgVbusPresent();
|
|
119 |
|
|
120 |
static TBool SetLoaded(TBool aState); // internal flag
|
|
121 |
|
|
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);
|
|
125 |
|
|
126 |
void SetMaxPowerToL(TUint16 val);
|
|
127 |
void GetMaxPower(TUint16& val);
|
|
128 |
|
|
129 |
private:
|
|
130 |
|
|
131 |
//protected:
|
|
132 |
public:
|
|
133 |
TBool StepUnloadLDD();
|
|
134 |
TBool StepLoadLDD();
|
|
135 |
void StepSetOptActive();
|
|
136 |
TBool StepUnloadClient();
|
|
137 |
TBool StepLoadClient(TUint16 aPID, TBool aEnableHNP=ETrue, TBool aEnableSRP=ETrue);
|
|
138 |
TBool StepDisconnect();
|
|
139 |
TBool StepConnect();
|
|
140 |
TBool StepChangeVidPid(TUint16 aVID, TUint16 aPID);
|
|
141 |
|
|
142 |
protected:
|
|
143 |
|
|
144 |
// API datas
|
|
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;
|
|
152 |
// api flags
|
|
153 |
TBool iOptActive;
|
|
154 |
static TBool iLoadedLdd;
|
|
155 |
static TBool iFdfActorActive;
|
|
156 |
|
|
157 |
// FDF Actor handle
|
|
158 |
static RProcess iFdfActorProcess
|
|
159 |
};
|
|
160 |
|
|
161 |
|
|
162 |
#endif /*OTGROOT_H_*/
|