os/kernelhwsrv/kerneltest/e32test/usb/t_usb_device/include/activecontrol.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-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
// e32test/usb/t_usb_device/include/activecontrol.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __ACTIVECONSOLE_H__
sl@0
    19
#define __ACTIVECONSOLE_H__
sl@0
    20
sl@0
    21
#include "activestallnotifier.h"
sl@0
    22
#include "activedevicestatenotifier.h"
sl@0
    23
sl@0
    24
static const TInt KSetupPacketSize = 8;
sl@0
    25
static const TInt KMaxControlBufferSize = 256;
sl@0
    26
static const TInt KMaxControlPacketSize = 64;
sl@0
    27
sl@0
    28
static const TInt KUsb_Ep0RequestTypeOffset = 0;
sl@0
    29
static const TInt KUsb_Ep0RequestOffset = 1;
sl@0
    30
static const TInt KUsb_Ep0wValueOffset = 2;
sl@0
    31
static const TInt KUsb_Ep0wIndexOffset = 4;
sl@0
    32
static const TInt KUsb_Ep0wLengthOffset = 6;
sl@0
    33
sl@0
    34
static const TUint32 KDeviceVersionMajor = 2;				// The version for t_usb_device
sl@0
    35
static const TUint32 KDeviceVersionMinor = 0;
sl@0
    36
static const TUint32 KDeviceVersionMicro = 0;
sl@0
    37
static const TUint8 KHostVersionMajor = 1;					// the host version we're compatible with
sl@0
    38
static const TUint8 KHostVersionMinor = 1;
sl@0
    39
static const TUint8 KHostVersionMicro = 0;
sl@0
    40
sl@0
    41
static const TUint32 KMSFinishedDelay = 5000000;			// 5 second delay after mass storage finishing
sl@0
    42
sl@0
    43
enum PendingRequest
sl@0
    44
	{
sl@0
    45
	EPendingNone,
sl@0
    46
	EPendingEp0Read,
sl@0
    47
	EPendingTimer,
sl@0
    48
	EPendingEject,
sl@0
    49
	EPendingCancel,
sl@0
    50
	};
sl@0
    51
sl@0
    52
class CActiveRW;
sl@0
    53
sl@0
    54
class CActiveControl : public CActive
sl@0
    55
	{
sl@0
    56
public:
sl@0
    57
	static CActiveControl* NewLC(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile);
sl@0
    58
	static CActiveControl* NewL(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile);
sl@0
    59
	void ConstructL();
sl@0
    60
	~CActiveControl();
sl@0
    61
	void RequestEp0ControlPacket();
sl@0
    62
	void SetMSFinished(TBool aState);
sl@0
    63
	void AllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
sl@0
    64
	void AllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
sl@0
    65
	void DeAllocateEndpointDMA(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
sl@0
    66
	void DeAllocateDoubleBuffering(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
sl@0
    67
sl@0
    68
private:
sl@0
    69
	CActiveControl(CConsoleBase* aConsole, TDes * aConfigFile, TDes * aScriptFile);
sl@0
    70
	// Defined as pure virtual by CActive;
sl@0
    71
	// implementation provided by this class.
sl@0
    72
	virtual void DoCancel();
sl@0
    73
	// Defined as pure virtual by CActive;
sl@0
    74
	// implementation provided by this class,
sl@0
    75
	virtual void RunL();
sl@0
    76
	void CActiveControl::ReConnect();
sl@0
    77
	void SetupInterface(IFConfigPtr* aIfPtr, TInt aPortNumber);
sl@0
    78
	void QueryUsbClientL(LDDConfigPtr aLddPtr,RDEVCLIENT* aPort);
sl@0
    79
	void QueryEndpointState(RDEVCLIENT* aPort,TENDPOINTNUMBER aEndpoint);
sl@0
    80
	TInt ReEnumerate();
sl@0
    81
	TInt ProcessEp0ControlPacket();
sl@0
    82
	void PrintHostLog();
sl@0
    83
sl@0
    84
private:
sl@0
    85
	CConsoleBase* iConsole;											// a console to read from
sl@0
    86
	CActiveStallNotifier* iStallNotifier[KMaxInterfaces];
sl@0
    87
	CActiveDeviceStateNotifier* iDeviceStateNotifier[KMaxInterfaces];
sl@0
    88
	RDEVCLIENT iPort[KMaxInterfaces];
sl@0
    89
	RTimer iTimer;
sl@0
    90
	TUint iPending;
sl@0
    91
	TInt iNumInterfaceSettings[KMaxInterfaces];
sl@0
    92
	TInt iTotalChannels;
sl@0
    93
	TBool iSoftwareConnect;
sl@0
    94
	TBool iHighSpeed;
sl@0
    95
	RFs iFs;
sl@0
    96
	RFile iConfigFile;
sl@0
    97
	TDes * iConfigFileName;
sl@0
    98
	TDes * iScriptFileName;
sl@0
    99
	LDDConfigPtr iLddPtr;
sl@0
   100
	#ifdef USB_SC
sl@0
   101
	TEndpointBuffer iEp0Buf;
sl@0
   102
	TAny * iEp0Packet;
sl@0
   103
	TUint iEp0Size;
sl@0
   104
	TBool iEp0Zlp;	
sl@0
   105
	#endif
sl@0
   106
	TBuf8<KSetupPacketSize> iEp0SetUpPacket;
sl@0
   107
	TBuf8<KMaxControlBufferSize> iEp0DataBuffer;
sl@0
   108
	TUint iEp0PacketSize;
sl@0
   109
	RThread iIdleCounterThread;
sl@0
   110
	RChunk iIdleCounterChunk;
sl@0
   111
	struct TTestIdleCounter* iIdleCounter;
sl@0
   112
	};
sl@0
   113
sl@0
   114
#endif	// __ACTIVECONTROL_H__