|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** @file |
|
20 |
|
21 XTI interface class for RAPU PlatSim |
|
22 |
|
23 *///========================================================================= |
|
24 |
|
25 |
|
26 #ifndef __XTIRX_H__ |
|
27 #define __XTIRX_H__ |
|
28 |
|
29 |
|
30 //- Include Files ---------------------------------------------------------- |
|
31 |
|
32 #include <kernel.h> |
|
33 #include <d32comm.h> |
|
34 |
|
35 //- Namespace --------------------------------------------------------------- |
|
36 |
|
37 |
|
38 //- Using ------------------------------------------------------------------- |
|
39 |
|
40 |
|
41 //- Data Types -------------------------------------------------------------- |
|
42 |
|
43 |
|
44 //- Constants --------------------------------------------------------------- |
|
45 |
|
46 |
|
47 //- Macros ------------------------------------------------------------------ |
|
48 |
|
49 |
|
50 //- External Data ----------------------------------------------------------- |
|
51 |
|
52 |
|
53 //- Variables --------------------------------------------------------------- |
|
54 |
|
55 |
|
56 //- Forward Declarations ---------------------------------------------------- |
|
57 |
|
58 |
|
59 //- Class Definitions ------------------------------------------------------- |
|
60 |
|
61 /** |
|
62 |
|
63 Interface class |
|
64 |
|
65 */ |
|
66 class XtiRx : public DBase |
|
67 { |
|
68 enum TRxState |
|
69 { |
|
70 KRxStateIdle, |
|
71 KRxStateWaitDataLenMsg, |
|
72 KRxStateWaitDataMsg |
|
73 }; |
|
74 |
|
75 public: |
|
76 static XtiRx* Instance(); |
|
77 |
|
78 /** |
|
79 * This method is used to register a user to the driver. |
|
80 * @param aDfc Pointer to the DFC function which is called by the XTI driver when the data is available in the receive buffer. |
|
81 * @param aBuf Receive buffer |
|
82 * @return Standard Symbian error code |
|
83 */ |
|
84 IMPORT_C static TInt Register( TDfc* aDfc, TDes8& aBuf ); |
|
85 |
|
86 /** |
|
87 * User of the driver calls this function when the receive buffer has been read |
|
88 */ |
|
89 IMPORT_C static void SetReceiveBufferRead(); |
|
90 |
|
91 private: |
|
92 XtiRx(); |
|
93 ~XtiRx(); |
|
94 static void Isr(TAny* aPtr); |
|
95 TInt Configure() const; |
|
96 TInt ConfigureUart() const; |
|
97 static void ReceiveDataDfc( TAny* aPtr ); |
|
98 static void GPIOWakeupDfc( TAny* aPtr ); |
|
99 static void GPIODeepSleepWakeupDfc( TAny* aPtr ); |
|
100 TInt Start() const; |
|
101 TInt Init(); |
|
102 TInt ReadData(); |
|
103 void SetPowerRequirements(); |
|
104 void ClearPowerRequirements(); |
|
105 static void StandbyMode( TAny* aPtr ); |
|
106 static void ResetReceiveState( TAny* aPtr ); |
|
107 static void GPIOwakeIsr(TAny* aPtr); |
|
108 static void SetPowerDfc(TAny* aPtr); |
|
109 static void ClearPowerDfc(TAny* aPtr); |
|
110 |
|
111 private: |
|
112 TDfcQue* iDfcQueue; |
|
113 TDfc iReceiveDataDfc; |
|
114 TDfc iGPIOWakeupDfc; |
|
115 TDfc iSetPowerDfc; |
|
116 TDfc iClearPowerDfc; |
|
117 static XtiRx* iXtiRxPtr; |
|
118 TBool iClocksOn; |
|
119 TDfc* iTraceCoreDfcPtr; |
|
120 TDes8* iRxBufferPtr; |
|
121 TRxState iRxState; |
|
122 TBool iReceiveBufferFree; |
|
123 TUint32 iMessagelength; |
|
124 TTickLink iWakeupResponseTimer; |
|
125 TInt iWakeupResponseCounter; |
|
126 TTickLink iIdleTimer; |
|
127 TUint iClientId; |
|
128 }; |
|
129 |
|
130 |
|
131 //- Global Function Prototypes ---------------------------------------------- |
|
132 |
|
133 |
|
134 //- Inline Functions -------------------------------------------------------- |
|
135 |
|
136 |
|
137 //- Namespace --------------------------------------------------------------- |
|
138 |
|
139 #endif // __XTIRX_H__ |
|
140 |
|
141 // End of File |