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