os/kernelhwsrv/kerneltest/e32test/device/t_slowir.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1997-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 // e32test\device\t_slowir.h
    15 // 
    16 //
    17 
    18 //#include <es_sock.h>
    19 #include <e32test.h>
    20 #include <e32cons.h>
    21 #include <d32comm.h>
    22 
    23 #ifndef __T_SLOWIR__
    24 #define __T_SLOWIR__ 
    25 
    26 //	Our own comms object with synchronous writes
    27 class RCommDev : public RBusDevComm
    28 	{
    29 public:
    30 	TInt WriteS(const TDesC8& aDes);
    31 	TInt WriteS(const TDesC8& aDes,TInt aLength);
    32 	TInt WriteSE(const TDes8& Entered, TInt aLength);
    33 	};
    34 
    35 enum TXferType
    36 	{
    37     EWriteXfer,
    38     EReadXfer,
    39 	EDiagXfer,
    40 	EDiscardXfer
    41     };
    42 
    43 class CActiveRW;
    44 class CActiveConsole : public CActive
    45 //-----------------------------------
    46 	{
    47 public:
    48 	  // Construction
    49 	CActiveConsole(CConsoleBase* aConsole);
    50 	static CActiveConsole* NewLC(CConsoleBase* aConsole);
    51 	void ConstructL();
    52 
    53 	  // Destruction
    54 	~CActiveConsole();
    55 
    56 	  // Issue request
    57 	void RequestCharacter();
    58 	
    59 	  // Cancel request.
    60 	  // Defined as pure virtual by CActive;
    61 	  // implementation provided by this class.
    62 	void DoCancel();
    63 
    64 	  // Service completed request.
    65 	  // Defined as pure virtual by CActive;
    66 	  // implementation provided by this class,
    67 	void RunL();
    68 
    69 	void ProcessKeyPressL(TChar aChar);
    70 
    71 //	void GetFirRegs();
    72 //	void GetDmaReaderRegs();
    73 //	void GetDmaWriterRegs();
    74 //	void GetReadBufInfo();
    75 //	void GetWriteBufInfo();
    76 //	void GetChunkInfo();
    77 //	void GetMiscInfo();
    78 	void Options1();
    79 	void Options2();
    80 
    81 public:
    82 	 // Data members defined by this class
    83 	CConsoleBase*   iConsole;	// A console for reading from
    84 	CActiveRW*      iRW;
    85 
    86 	RCommDev* iPort;
    87 	TBool iInit1;
    88 	TBool iInit2;
    89 	};
    90 
    91 
    92 class CActiveRW : public CActive
    93 //-----------------------------------------------------------
    94 	{
    95 public:
    96 	// Construction
    97 	CActiveRW(CConsoleBase* aConsole,RCommDev* aPort);
    98 	static CActiveRW* NewL(CConsoleBase* aConsole,RCommDev* aPort);
    99 	void ConstructL();
   100 
   101 	~CActiveRW();
   102 
   103 	void Start(TBool StartWriting);
   104 	void Stop();
   105 private:
   106 	void RunL ();
   107 	void DoCancel ();
   108 	TBool CompareBuffers(TInt aLen);
   109 	TInt ErrorStats();
   110 
   111 private:
   112 	CConsoleBase* iConsole;
   113 	RCommDev* iPort;
   114 	TInt iLength;
   115 	TInt iNextXfer;
   116 	TInt iUnrecovered;
   117 	TInt iRxCount;
   118 	TInt iRxErrCount;
   119 	};
   120 
   121 #endif  // __T_SLOWIR__