author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 11:08:29 +0300 | |
changeset 247 | d8d70de2bd36 |
parent 90 | 947f0dc9f7a8 |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
247
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
1 |
// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 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 |
// e32test/usb/t_usb_device/include/activecontrol.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#ifndef __ACTIVECONSOLE_H__ |
|
19 |
#define __ACTIVECONSOLE_H__ |
|
20 |
||
21 |
#include "activestallnotifier.h" |
|
22 |
#include "activedevicestatenotifier.h" |
|
247
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
23 |
#include "transfersrv.h" |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
24 |
#include "config.h" |
0 | 25 |
|
26 |
static const TInt KSetupPacketSize = 8; |
|
27 |
static const TInt KMaxControlBufferSize = 256; |
|
28 |
static const TInt KMaxControlPacketSize = 64; |
|
29 |
||
30 |
static const TInt KUsb_Ep0RequestTypeOffset = 0; |
|
31 |
static const TInt KUsb_Ep0RequestOffset = 1; |
|
32 |
static const TInt KUsb_Ep0wValueOffset = 2; |
|
33 |
static const TInt KUsb_Ep0wIndexOffset = 4; |
|
34 |
static const TInt KUsb_Ep0wLengthOffset = 6; |
|
35 |
||
36 |
static const TUint32 KDeviceVersionMajor = 2; // The version for t_usb_device |
|
37 |
static const TUint32 KDeviceVersionMinor = 0; |
|
38 |
static const TUint32 KDeviceVersionMicro = 0; |
|
39 |
static const TUint8 KHostVersionMajor = 1; // the host version we're compatible with |
|
40 |
static const TUint8 KHostVersionMinor = 1; |
|
41 |
static const TUint8 KHostVersionMicro = 0; |
|
42 |
||
43 |
static const TUint32 KMSFinishedDelay = 5000000; // 5 second delay after mass storage finishing |
|
44 |
||
45 |
enum PendingRequest |
|
46 |
{ |
|
47 |
EPendingNone, |
|
48 |
EPendingEp0Read, |
|
49 |
EPendingTimer, |
|
50 |
EPendingEject, |
|
51 |
EPendingCancel, |
|
52 |
}; |
|
53 |
||
54 |
class CActiveRW; |
|
55 |
||
247
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
56 |
class CTranHandleServer; |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
57 |
|
0 | 58 |
class CActiveControl : public CActive |
59 |
{ |
|
60 |
public: |
|
61 |
static CActiveControl* NewLC(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile); |
|
62 |
static CActiveControl* NewL(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile); |
|
63 |
void ConstructL(); |
|
64 |
~CActiveControl(); |
|
65 |
void RequestEp0ControlPacket(); |
|
66 |
void SetMSFinished(TBool aState); |
|
67 |
void AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); |
|
68 |
void AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); |
|
69 |
void DeAllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); |
|
70 |
void DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); |
|
247
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
71 |
#ifdef USB_SC |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
72 |
void ConstructLOnSharedLdd(const RMessagePtr2& aMsg); |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
73 |
#endif |
0 | 74 |
|
75 |
private: |
|
76 |
CActiveControl(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile); |
|
77 |
// Defined as pure virtual by CActive; |
|
78 |
// implementation provided by this class. |
|
79 |
virtual void DoCancel(); |
|
80 |
// Defined as pure virtual by CActive; |
|
81 |
// implementation provided by this class, |
|
82 |
virtual void RunL(); |
|
83 |
void CActiveControl::ReConnect(); |
|
84 |
void SetupInterface(IFConfigPtr* aIfPtr, TInt aPortNumber); |
|
85 |
void QueryUsbClientL(LDDConfigPtr aLddPtr,RDEVCLIENT* aPort); |
|
86 |
void QueryEndpointState(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); |
|
87 |
TInt ReEnumerate(); |
|
88 |
TInt ProcessEp0ControlPacket(); |
|
89 |
void PrintHostLog(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
void FillEndpointsResourceAllocation(IFConfigPtr aIfCfg); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
92 |
void PopulateInterfaceResourceAllocation(IFConfigPtr aFirstIfCfg, TInt aPortNumber); |
247
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
93 |
#ifdef USB_SC |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
94 |
void SetupTransferedInterface(IFConfigPtr* aIfPtr, TInt aPortNumber); |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
95 |
#endif |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
|
0 | 97 |
private: |
98 |
CConsoleBase* iConsole; // a console to read from |
|
99 |
CActiveStallNotifier* iStallNotifier[KMaxInterfaces]; |
|
100 |
CActiveDeviceStateNotifier* iDeviceStateNotifier[KMaxInterfaces]; |
|
101 |
RDEVCLIENT iPort[KMaxInterfaces]; |
|
102 |
RTimer iTimer; |
|
103 |
TUint iPending; |
|
104 |
TInt iNumInterfaceSettings[KMaxInterfaces]; |
|
105 |
TInt iTotalChannels; |
|
106 |
TBool iSoftwareConnect; |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
TBool iSupportResourceAllocationV2; |
0 | 108 |
TBool iHighSpeed; |
109 |
RFs iFs; |
|
110 |
RFile iConfigFile; |
|
111 |
TDes * iConfigFileName; |
|
112 |
TDes * iScriptFileName; |
|
113 |
LDDConfigPtr iLddPtr; |
|
114 |
#ifdef USB_SC |
|
115 |
TEndpointBuffer iEp0Buf; |
|
116 |
TAny * iEp0Packet; |
|
117 |
TUint iEp0Size; |
|
118 |
TBool iEp0Zlp; |
|
119 |
#endif |
|
120 |
TBuf8<KSetupPacketSize> iEp0SetUpPacket; |
|
121 |
TBuf8<KMaxControlBufferSize> iEp0DataBuffer; |
|
122 |
TUint iEp0PacketSize; |
|
123 |
RThread iIdleCounterThread; |
|
124 |
RChunk iIdleCounterChunk; |
|
125 |
struct TTestIdleCounter* iIdleCounter; |
|
247
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
126 |
#ifdef USB_SC |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
127 |
CTranHandleServer* iTranHandleServer; |
d8d70de2bd36
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
128 |
#endif |
0 | 129 |
}; |
130 |
||
131 |
#endif // __ACTIVECONTROL_H__ |