1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/usb/t_usb_device/include/activecontrol.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,114 @@
1.4 +// Copyright (c) 2008-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 +// e32test/usb/t_usb_device/include/activecontrol.h
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __ACTIVECONSOLE_H__
1.22 +#define __ACTIVECONSOLE_H__
1.23 +
1.24 +#include "activestallnotifier.h"
1.25 +#include "activedevicestatenotifier.h"
1.26 +
1.27 +static const TInt KSetupPacketSize = 8;
1.28 +static const TInt KMaxControlBufferSize = 256;
1.29 +static const TInt KMaxControlPacketSize = 64;
1.30 +
1.31 +static const TInt KUsb_Ep0RequestTypeOffset = 0;
1.32 +static const TInt KUsb_Ep0RequestOffset = 1;
1.33 +static const TInt KUsb_Ep0wValueOffset = 2;
1.34 +static const TInt KUsb_Ep0wIndexOffset = 4;
1.35 +static const TInt KUsb_Ep0wLengthOffset = 6;
1.36 +
1.37 +static const TUint32 KDeviceVersionMajor = 2; // The version for t_usb_device
1.38 +static const TUint32 KDeviceVersionMinor = 0;
1.39 +static const TUint32 KDeviceVersionMicro = 0;
1.40 +static const TUint8 KHostVersionMajor = 1; // the host version we're compatible with
1.41 +static const TUint8 KHostVersionMinor = 1;
1.42 +static const TUint8 KHostVersionMicro = 0;
1.43 +
1.44 +static const TUint32 KMSFinishedDelay = 5000000; // 5 second delay after mass storage finishing
1.45 +
1.46 +enum PendingRequest
1.47 + {
1.48 + EPendingNone,
1.49 + EPendingEp0Read,
1.50 + EPendingTimer,
1.51 + EPendingEject,
1.52 + EPendingCancel,
1.53 + };
1.54 +
1.55 +class CActiveRW;
1.56 +
1.57 +class CActiveControl : public CActive
1.58 + {
1.59 +public:
1.60 + static CActiveControl* NewLC(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile);
1.61 + static CActiveControl* NewL(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile);
1.62 + void ConstructL();
1.63 + ~CActiveControl();
1.64 + void RequestEp0ControlPacket();
1.65 + void SetMSFinished(TBool aState);
1.66 + void AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
1.67 + void AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
1.68 + void DeAllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
1.69 + void DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
1.70 +
1.71 +private:
1.72 + CActiveControl(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile);
1.73 + // Defined as pure virtual by CActive;
1.74 + // implementation provided by this class.
1.75 + virtual void DoCancel();
1.76 + // Defined as pure virtual by CActive;
1.77 + // implementation provided by this class,
1.78 + virtual void RunL();
1.79 + void CActiveControl::ReConnect();
1.80 + void SetupInterface(IFConfigPtr* aIfPtr, TInt aPortNumber);
1.81 + void QueryUsbClientL(LDDConfigPtr aLddPtr,RDEVCLIENT* aPort);
1.82 + void QueryEndpointState(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
1.83 + TInt ReEnumerate();
1.84 + TInt ProcessEp0ControlPacket();
1.85 + void PrintHostLog();
1.86 +
1.87 +private:
1.88 + CConsoleBase* iConsole; // a console to read from
1.89 + CActiveStallNotifier* iStallNotifier[KMaxInterfaces];
1.90 + CActiveDeviceStateNotifier* iDeviceStateNotifier[KMaxInterfaces];
1.91 + RDEVCLIENT iPort[KMaxInterfaces];
1.92 + RTimer iTimer;
1.93 + TUint iPending;
1.94 + TInt iNumInterfaceSettings[KMaxInterfaces];
1.95 + TInt iTotalChannels;
1.96 + TBool iSoftwareConnect;
1.97 + TBool iHighSpeed;
1.98 + RFs iFs;
1.99 + RFile iConfigFile;
1.100 + TDes * iConfigFileName;
1.101 + TDes * iScriptFileName;
1.102 + LDDConfigPtr iLddPtr;
1.103 + #ifdef USB_SC
1.104 + TEndpointBuffer iEp0Buf;
1.105 + TAny * iEp0Packet;
1.106 + TUint iEp0Size;
1.107 + TBool iEp0Zlp;
1.108 + #endif
1.109 + TBuf8<KSetupPacketSize> iEp0SetUpPacket;
1.110 + TBuf8<KMaxControlBufferSize> iEp0DataBuffer;
1.111 + TUint iEp0PacketSize;
1.112 + RThread iIdleCounterThread;
1.113 + RChunk iIdleCounterChunk;
1.114 + struct TTestIdleCounter* iIdleCounter;
1.115 + };
1.116 +
1.117 +#endif // __ACTIVECONTROL_H__