sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test/usb/t_usb_device/include/activecontrol.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __ACTIVECONSOLE_H__ sl@0: #define __ACTIVECONSOLE_H__ sl@0: sl@0: #include "activestallnotifier.h" sl@0: #include "activedevicestatenotifier.h" sl@0: sl@0: static const TInt KSetupPacketSize = 8; sl@0: static const TInt KMaxControlBufferSize = 256; sl@0: static const TInt KMaxControlPacketSize = 64; sl@0: sl@0: static const TInt KUsb_Ep0RequestTypeOffset = 0; sl@0: static const TInt KUsb_Ep0RequestOffset = 1; sl@0: static const TInt KUsb_Ep0wValueOffset = 2; sl@0: static const TInt KUsb_Ep0wIndexOffset = 4; sl@0: static const TInt KUsb_Ep0wLengthOffset = 6; sl@0: sl@0: static const TUint32 KDeviceVersionMajor = 2; // The version for t_usb_device sl@0: static const TUint32 KDeviceVersionMinor = 0; sl@0: static const TUint32 KDeviceVersionMicro = 0; sl@0: static const TUint8 KHostVersionMajor = 1; // the host version we're compatible with sl@0: static const TUint8 KHostVersionMinor = 1; sl@0: static const TUint8 KHostVersionMicro = 0; sl@0: sl@0: static const TUint32 KMSFinishedDelay = 5000000; // 5 second delay after mass storage finishing sl@0: sl@0: enum PendingRequest sl@0: { sl@0: EPendingNone, sl@0: EPendingEp0Read, sl@0: EPendingTimer, sl@0: EPendingEject, sl@0: EPendingCancel, sl@0: }; sl@0: sl@0: class CActiveRW; sl@0: sl@0: class CActiveControl : public CActive sl@0: { sl@0: public: sl@0: static CActiveControl* NewLC(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile); sl@0: static CActiveControl* NewL(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile); sl@0: void ConstructL(); sl@0: ~CActiveControl(); sl@0: void RequestEp0ControlPacket(); sl@0: void SetMSFinished(TBool aState); sl@0: void AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); sl@0: void AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); sl@0: void DeAllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); sl@0: void DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); sl@0: sl@0: private: sl@0: CActiveControl(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile); sl@0: // Defined as pure virtual by CActive; sl@0: // implementation provided by this class. sl@0: virtual void DoCancel(); sl@0: // Defined as pure virtual by CActive; sl@0: // implementation provided by this class, sl@0: virtual void RunL(); sl@0: void CActiveControl::ReConnect(); sl@0: void SetupInterface(IFConfigPtr* aIfPtr, TInt aPortNumber); sl@0: void QueryUsbClientL(LDDConfigPtr aLddPtr,RDEVCLIENT* aPort); sl@0: void QueryEndpointState(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint); sl@0: TInt ReEnumerate(); sl@0: TInt ProcessEp0ControlPacket(); sl@0: void PrintHostLog(); sl@0: sl@0: private: sl@0: CConsoleBase* iConsole; // a console to read from sl@0: CActiveStallNotifier* iStallNotifier[KMaxInterfaces]; sl@0: CActiveDeviceStateNotifier* iDeviceStateNotifier[KMaxInterfaces]; sl@0: RDEVCLIENT iPort[KMaxInterfaces]; sl@0: RTimer iTimer; sl@0: TUint iPending; sl@0: TInt iNumInterfaceSettings[KMaxInterfaces]; sl@0: TInt iTotalChannels; sl@0: TBool iSoftwareConnect; sl@0: TBool iHighSpeed; sl@0: RFs iFs; sl@0: RFile iConfigFile; sl@0: TDes * iConfigFileName; sl@0: TDes * iScriptFileName; sl@0: LDDConfigPtr iLddPtr; sl@0: #ifdef USB_SC sl@0: TEndpointBuffer iEp0Buf; sl@0: TAny * iEp0Packet; sl@0: TUint iEp0Size; sl@0: TBool iEp0Zlp; sl@0: #endif sl@0: TBuf8 iEp0SetUpPacket; sl@0: TBuf8 iEp0DataBuffer; sl@0: TUint iEp0PacketSize; sl@0: RThread iIdleCounterThread; sl@0: RChunk iIdleCounterChunk; sl@0: struct TTestIdleCounter* iIdleCounter; sl@0: }; sl@0: sl@0: #endif // __ACTIVECONTROL_H__