|
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 Class for XTI data transmission. |
|
22 |
|
23 *///========================================================================= |
|
24 |
|
25 |
|
26 #ifndef __XtiTx_H__ |
|
27 #define __XtiTx_H__ |
|
28 |
|
29 |
|
30 //- Include Files ---------------------------------------------------------- |
|
31 |
|
32 #include <e32def.h> |
|
33 |
|
34 //- Namespace --------------------------------------------------------------- |
|
35 |
|
36 |
|
37 //- Using ------------------------------------------------------------------- |
|
38 |
|
39 |
|
40 //- Data Types -------------------------------------------------------------- |
|
41 |
|
42 |
|
43 //- Constants --------------------------------------------------------------- |
|
44 |
|
45 const TUint8 KOsmoMsgSymbianTrace = 0xD2; // MCU Symbian Trace message ID |
|
46 const TUint8 KOsmoMsgAsciiPrintf = 0xC0; // MCU Ascii Printf message ID |
|
47 const TUint8 KOsmoMsgPhoneFormatted = 0xC1; // Phone Formatted message ID |
|
48 const TUint KXtiChannelSize = 0x1000; |
|
49 const TUint8 KOsmoSymbianSystemChannel0 = 224; |
|
50 const TUint8 KOsmoSymbianSystemChannel1 = 225; |
|
51 const TUint8 KOsmosReceptionAckChannel = 251; |
|
52 const TUint8 KOsmoTraceControlChannel = 253; |
|
53 const TUint8 KOsmoTraceBoxConfigChannel = 226; |
|
54 |
|
55 |
|
56 //- Macros ------------------------------------------------------------------ |
|
57 |
|
58 |
|
59 //- External Data ----------------------------------------------------------- |
|
60 |
|
61 |
|
62 //- Variables --------------------------------------------------------------- |
|
63 |
|
64 |
|
65 //- Forward Declarations ---------------------------------------------------- |
|
66 |
|
67 |
|
68 //- Class Definitions ------------------------------------------------------- |
|
69 |
|
70 /** |
|
71 |
|
72 Interface class |
|
73 |
|
74 */ |
|
75 class XtiTx |
|
76 { |
|
77 public: |
|
78 static XtiTx* Instance(); |
|
79 |
|
80 /** |
|
81 * Start writing data to Symbian XTI channel. This method must be called before WriteData8, WriteData16 or WriteData32 can be used. |
|
82 * @param aChannel XTI channel number. Must be KOsmoSymbianSystemChannel0 or KOsmoSymbianSystemChannel1 |
|
83 * @param aMessageId XTI message ID. Defines what type of messages are sent. Must be KOsmoMsgSymbianTrace or KOsmoMsgAsciiPrintf. |
|
84 * @return Standard Symbian error code |
|
85 */ |
|
86 IMPORT_C static TInt StartWrite( TUint8 aChannel, TUint8 aMessageId ); |
|
87 |
|
88 /** |
|
89 * Write 8 bits data to KOsmoSymbianSystemChannel0 or KOsmoSymbianSystemChannel1 |
|
90 * XTI channel in KOsmoMsgSymbianTrace or KOsmoMsgAsciiPrintf message format. |
|
91 * Before using this method XTI channel and message type must be defined with |
|
92 * method XtiTx::StartWrite(). |
|
93 * @param aChannel XTI channel number |
|
94 * @param aData Data to be written |
|
95 */ |
|
96 IMPORT_C static void WriteData8( TUint8 aChannel, TUint8 aData ); |
|
97 |
|
98 /** |
|
99 * Write 16 bits data to KOsmoSymbianSystemChannel0 or KOsmoSymbianSystemChannel1 |
|
100 * XTI channel in KOsmoMsgSymbianTrace or KOsmoMsgAsciiPrintf message format. |
|
101 * Before using this method XTI channel and message type must be defined with |
|
102 * method XtiTx::StartWrite(). |
|
103 * @param aChannel XTI channel number |
|
104 * @param aData Data to be written |
|
105 */ |
|
106 IMPORT_C static void WriteData16( TUint8 aChannel, TUint16 aData ); |
|
107 |
|
108 /** |
|
109 * Write 32 bits data to KOsmoSymbianSystemChannel0 or KOsmoSymbianSystemChannel1 |
|
110 * XTI channel in KOsmoMsgSymbianTrace or KOsmoMsgAsciiPrintf message format. |
|
111 * Before using this method XTI channel and message type must be defined with |
|
112 * method XtiTx::StartWrite(). |
|
113 * @param aChannel XTI channel number |
|
114 * @param aData Data to be written |
|
115 */ |
|
116 IMPORT_C static void WriteData32( TUint8 aChannel, TUint32 aData ); |
|
117 |
|
118 /** |
|
119 * Stop writing data to Symbian XTI channel which has been started by method StartWrite(). |
|
120 * @param aChannel XTI channel number |
|
121 * @return Standard Symbian error code |
|
122 */ |
|
123 IMPORT_C static TInt StopWrite( TUint8 aChannel ); |
|
124 |
|
125 /** |
|
126 * Sends set bit rate command to Musti |
|
127 * @param aBitRate Uart bit rate |
|
128 */ |
|
129 IMPORT_C static void SetBitRate( TUint aBitRate ); |
|
130 |
|
131 /** |
|
132 * Sends acknowledgement for data length message to Musti |
|
133 */ |
|
134 IMPORT_C static void SendDataLenAckMsg(); |
|
135 |
|
136 /** |
|
137 * Sends acknowledgement for data message to Musti |
|
138 */ |
|
139 IMPORT_C static void SendDataRxAckMsg(); |
|
140 |
|
141 /** |
|
142 * Returns the flag that tells if traces are enabled |
|
143 * @return EFalse if traces not enabled in RDC, otherwise true |
|
144 */ |
|
145 IMPORT_C static TBool IsTraceEnabled(); |
|
146 |
|
147 private: |
|
148 XtiTx(); |
|
149 ~XtiTx(); |
|
150 static TBool CheckMessageIdForStartWrite( TUint8 aMessageId ); |
|
151 TBool CheckRDC(); |
|
152 |
|
153 private: |
|
154 static XtiTx* iXtiTxPtr; |
|
155 TBool iSymbianChannel0Open; |
|
156 TBool iSymbianChannel1Open; |
|
157 TBool iTraceEnabled; |
|
158 }; |
|
159 |
|
160 |
|
161 //- Global Function Prototypes ---------------------------------------------- |
|
162 |
|
163 |
|
164 //- Inline Functions -------------------------------------------------------- |
|
165 |
|
166 |
|
167 //- Namespace --------------------------------------------------------------- |
|
168 |
|
169 #endif // __XtiTx_H__ |
|
170 |
|
171 // End of File |