emulator/emulatorbsp/test/exdriver/exdriver_pio/inc/d_expio_emul.h
changeset 0 cec860690d41
equal deleted inserted replaced
-1:000000000000 0:cec860690d41
       
     1 // Copyright (c) 2007-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 "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 // This is a header file to define wins specific classes and info
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __D_EXPIO_EMUL_H__
       
    19 #define __D_EXPIO_EMUL_H__
       
    20 
       
    21 // pdd include file
       
    22 #include "d_expio_pdd.h"
       
    23 
       
    24 // include files
       
    25 #include <d32comm.h> // comm header file
       
    26 
       
    27 // DFC related constants
       
    28 //
       
    29 _LIT(KExEmulUartDfcName,"ExEmulUartDfc"); 		// Name of the DFC thread
       
    30 const TInt KExEmulUartDfcPriority=26; 		// DFC thread priority		
       
    31 
       
    32 // UART FIFO sizes
       
    33 const TInt KTxFifoSize=64; // 64bytes fifo
       
    34 const TInt KRxFifoSize=64; // 64bytes fifo
       
    35 
       
    36 // Timer constants
       
    37 const TInt KRxPollTimeout=1; // 1ms
       
    38 const TInt KTimerStarted=1;
       
    39 const TInt KTimerExpired=0;
       
    40 const TInt KTimerCancelled=-1;
       
    41 
       
    42 
       
    43 /**
       
    44  * Physical device class specific for Emulator UART Physical Device Driver (PDD)
       
    45  */
       
    46 class DExEmulPhysicalDevice: public DExDriverPhysicalDevice
       
    47 {
       
    48 public:
       
    49     DExEmulPhysicalDevice();   
       
    50     ~DExEmulPhysicalDevice();  // Destructor
       
    51     TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, 
       
    52     										const TVersion& aVer);
       
    53 };
       
    54 
       
    55 /**
       
    56  Hardware peripheral class
       
    57  
       
    58  Target specific class, H4 uart controller. This class 
       
    59  is accessed from physical channel class. It's object 
       
    60  is created in physical channel DoCreate()and deleted 
       
    61  in it's destructor
       
    62  */ 
       
    63 class DExUartPhysicalChannelEmul:public DExDriverPhysicalChannel
       
    64 	{
       
    65 public:
       
    66 	// Public functions access to all
       
    67 	DExUartPhysicalChannelEmul();					// Constructor	
       
    68 	~DExUartPhysicalChannelEmul();					// Destructor	
       
    69 	TInt DoCreate(TInt aUnit, const TDesC8* aInfo, 
       
    70 								const TVersion& aVer); // 2nd Stage constructor
       
    71 	void Caps(TDes8& aCaps);						// Get channel Capabilities
       
    72 	TInt Configure(const TCommConfigV01& aConfig);  // Configure the uart	
       
    73 	TInt TransmitData(const TDesC8& aData);			// Transmit data to uart	
       
    74 	TInt ReceiveData(TDes8& aData,TInt aLen);					// Receive data from uart	
       
    75 	TDynamicDfcQue* DfcQ();							// DFC queue creation
       
    76 private:
       
    77 	static void RxPollTimerCallback(TAny* aPtr);	
       
    78 private:	
       
    79 	TBool iConfigured;				// Channel configuration status;
       
    80 	TBps iBaudRate;		
       
    81 	NTimer iRxPollTimer;			// Timer to poll for Rx data
       
    82 	TInt iTimerStatus;				// Rx data timer status
       
    83 	// Windows handle for com port
       
    84 	HANDLE hCommPort;
       
    85 	DWORD iBytesRead;
       
    86 	DWORD iBytesWritten;
       
    87 	};
       
    88 		
       
    89 #endif // __D_EXPIO_EMUL_H__
       
    90 
       
    91 //
       
    92 // End of d_expio_emul.h