|
1 // Created by TraceCompiler 1.2.5 |
|
2 // DO NOT EDIT, CHANGES WILL BE LOST |
|
3 |
|
4 #ifndef __TRACECOMPILERTESTERADVANCEDTRACES_H__ |
|
5 #define __TRACECOMPILERTESTERADVANCEDTRACES_H__ |
|
6 |
|
7 #define KOstTraceComponentID 0x20011111 |
|
8 |
|
9 #define HELLO_WORLD 0x400001 |
|
10 #define HELLO_MOON 0x70001 |
|
11 #define TEST_TRACE_2 0x70002 |
|
12 #define POINTER_PARAMETER_TRACE1 0x410001 |
|
13 #define POINTER_PARAMETER_TRACE2 0x410002 |
|
14 #define ASCII60 0x420001 |
|
15 #define ASCII300 0x420002 |
|
16 #define ASCII512 0x420003 |
|
17 #define ASCII600 0x420004 |
|
18 #define ASCII300_ASCII512 0x420005 |
|
19 #define ASCII600_ASCII300 0x420006 |
|
20 #define ASCII333_ASCII333 0x420007 |
|
21 #define ASCII1 0x430001 |
|
22 #define ASCII2 0x430002 |
|
23 #define ASCII3 0x430003 |
|
24 #define ASCII4 0x430004 |
|
25 #define ASCII5 0x430005 |
|
26 #define STATE_TRACE_0 0x50001 |
|
27 #define STATE_TRACE_1 0x50002 |
|
28 #define TRACE_DATA_TRACE 0x440001 |
|
29 #define POST1 0x450001 |
|
30 |
|
31 |
|
32 inline TBool OstTraceGen2( TUint32 aTraceID, const TAny* aParam1, const TAny* aParam2 ) |
|
33 { |
|
34 TBool retval = BTrace8( KBTraceCategoryOpenSystemTrace, EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); |
|
35 if ( retval ) |
|
36 { |
|
37 TUint8 data[ 8 ]; |
|
38 TUint8* ptr = data; |
|
39 *( ( const TAny** )ptr ) = aParam1; |
|
40 ptr += sizeof ( const TAny* ); |
|
41 *( ( const TAny** )ptr ) = aParam2; |
|
42 ptr += sizeof ( const TAny* ); |
|
43 ptr -= 8; |
|
44 retval = OstSendNBytes( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 ); |
|
45 } |
|
46 return retval; |
|
47 } |
|
48 |
|
49 |
|
50 inline TBool OstTraceGen1( TUint32 aTraceID, const TAny* aParam1 ) |
|
51 { |
|
52 TBool retval = BTrace8( KBTraceCategoryOpenSystemTrace, EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); |
|
53 if ( retval ) |
|
54 { |
|
55 TUint8 data[ 4 ]; |
|
56 TUint8* ptr = data; |
|
57 *( ( const TAny** )ptr ) = aParam1; |
|
58 ptr += sizeof ( const TAny* ); |
|
59 ptr -= 4; |
|
60 retval = BTraceContext12( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, *( ( TUint32* )ptr ) ); |
|
61 } |
|
62 return retval; |
|
63 } |
|
64 |
|
65 |
|
66 inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC8& aParam1 ) |
|
67 { |
|
68 TBool retval; |
|
69 // Data is written directly and length is determined from trace message length |
|
70 TInt size = aParam1.Size(); |
|
71 // BTrace assumes that parameter size is atleast 4 bytes |
|
72 TInt sizeAligned = ( size + 3 ) & ~3; |
|
73 size = sizeAligned; |
|
74 TUint8* ptr = ( TUint8* )aParam1.Ptr(); |
|
75 retval = OstSendNBytes( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); |
|
76 return retval; |
|
77 } |
|
78 |
|
79 |
|
80 inline TBool OstTraceGen2( TUint32 aTraceID, const TDesC8& aParam1, const TDesC8& aParam2 ) |
|
81 { |
|
82 TBool retval = BTrace8( KBTraceCategoryOpenSystemTrace, EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); |
|
83 if ( retval ) |
|
84 { |
|
85 TInt length = 0; |
|
86 // Check that parameter lenght is not too long |
|
87 TInt length1 = aParam1.Size(); |
|
88 if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) |
|
89 { |
|
90 length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); |
|
91 } |
|
92 TInt lengthAligned1 = ( length1 + 3 ) & ~3; |
|
93 if (lengthAligned1 > 0) |
|
94 { |
|
95 length = length + sizeof ( TUint32 ) + lengthAligned1; |
|
96 } |
|
97 // Check that parameter lenght is not too long |
|
98 TInt length2 = aParam2.Size(); |
|
99 if ((length + length2 + sizeof ( TUint32 )) > KOstMaxDataLength) |
|
100 { |
|
101 length2 = KOstMaxDataLength - (length + sizeof ( TUint32 )); |
|
102 } |
|
103 TInt lengthAligned2 = ( length2 + 3 ) & ~3; |
|
104 if (lengthAligned2 > 0) |
|
105 { |
|
106 length = length + sizeof ( TUint32 ) + lengthAligned2; |
|
107 } |
|
108 TUint8 data[ KOstMaxDataLength ]; |
|
109 TUint8* ptr = data; |
|
110 // Set length to zero and calculate it againg |
|
111 // when adding parameters |
|
112 length = 0; |
|
113 if (length1 > 0) |
|
114 { |
|
115 // Number of elements is written before data |
|
116 // In case of Unicode string, number of elements is half of length |
|
117 *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); |
|
118 ptr += sizeof ( TUint32 ); |
|
119 memcpy( ptr, aParam1.Ptr(), length1 ); |
|
120 ptr += length1; |
|
121 // Fillers are written to get 32-bit alignment |
|
122 while ( length1++ < lengthAligned1 ) |
|
123 { |
|
124 *ptr++ = 0; |
|
125 } |
|
126 length += sizeof ( TUint32 ) + lengthAligned1; |
|
127 } |
|
128 else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) |
|
129 { |
|
130 *( ( TUint32* )ptr ) = 0; |
|
131 ptr += sizeof ( TUint32 ); |
|
132 length += sizeof ( TUint32 ); |
|
133 } |
|
134 if (length2 > 0) |
|
135 { |
|
136 // Number of elements is written before data |
|
137 // In case of Unicode string, number of elements is half of length |
|
138 *( ( TUint32* )ptr ) = length2 / (aParam2.Size() / aParam2.Length()); |
|
139 ptr += sizeof ( TUint32 ); |
|
140 memcpy( ptr, aParam2.Ptr(), length2 ); |
|
141 ptr += length2; |
|
142 // Fillers are written to get 32-bit alignment |
|
143 while ( length2++ < lengthAligned2 ) |
|
144 { |
|
145 *ptr++ = 0; |
|
146 } |
|
147 length += sizeof ( TUint32 ) + lengthAligned2; |
|
148 } |
|
149 else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) |
|
150 { |
|
151 *( ( TUint32* )ptr ) = 0; |
|
152 ptr += sizeof ( TUint32 ); |
|
153 length += sizeof ( TUint32 ); |
|
154 } |
|
155 ptr -= length; |
|
156 retval = OstSendNBytes( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); |
|
157 } |
|
158 return retval; |
|
159 } |
|
160 |
|
161 |
|
162 inline TBool OstTraceGen3( TUint32 aTraceID, const TDesC8& aParam1, const TDesC8& aParam2, TUint aParam3 ) |
|
163 { |
|
164 TBool retval = BTrace8( KBTraceCategoryOpenSystemTrace, EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); |
|
165 if ( retval ) |
|
166 { |
|
167 TInt length = 0; |
|
168 // Check that parameter lenght is not too long |
|
169 TInt length1 = aParam1.Size(); |
|
170 if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) |
|
171 { |
|
172 length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); |
|
173 } |
|
174 TInt lengthAligned1 = ( length1 + 3 ) & ~3; |
|
175 if (lengthAligned1 > 0) |
|
176 { |
|
177 length = length + sizeof ( TUint32 ) + lengthAligned1; |
|
178 } |
|
179 // Check that parameter lenght is not too long |
|
180 TInt length2 = aParam2.Size(); |
|
181 if ((length + length2 + sizeof ( TUint32 )) > KOstMaxDataLength) |
|
182 { |
|
183 length2 = KOstMaxDataLength - (length + sizeof ( TUint32 )); |
|
184 } |
|
185 TInt lengthAligned2 = ( length2 + 3 ) & ~3; |
|
186 if (lengthAligned2 > 0) |
|
187 { |
|
188 length = length + sizeof ( TUint32 ) + lengthAligned2; |
|
189 } |
|
190 TUint8 data[ KOstMaxDataLength ]; |
|
191 TUint8* ptr = data; |
|
192 // Set length to zero and calculate it againg |
|
193 // when adding parameters |
|
194 length = 0; |
|
195 if (length1 > 0) |
|
196 { |
|
197 // Number of elements is written before data |
|
198 // In case of Unicode string, number of elements is half of length |
|
199 *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); |
|
200 ptr += sizeof ( TUint32 ); |
|
201 memcpy( ptr, aParam1.Ptr(), length1 ); |
|
202 ptr += length1; |
|
203 // Fillers are written to get 32-bit alignment |
|
204 while ( length1++ < lengthAligned1 ) |
|
205 { |
|
206 *ptr++ = 0; |
|
207 } |
|
208 length += sizeof ( TUint32 ) + lengthAligned1; |
|
209 } |
|
210 else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) |
|
211 { |
|
212 *( ( TUint32* )ptr ) = 0; |
|
213 ptr += sizeof ( TUint32 ); |
|
214 length += sizeof ( TUint32 ); |
|
215 } |
|
216 if (length2 > 0) |
|
217 { |
|
218 // Number of elements is written before data |
|
219 // In case of Unicode string, number of elements is half of length |
|
220 *( ( TUint32* )ptr ) = length2 / (aParam2.Size() / aParam2.Length()); |
|
221 ptr += sizeof ( TUint32 ); |
|
222 memcpy( ptr, aParam2.Ptr(), length2 ); |
|
223 ptr += length2; |
|
224 // Fillers are written to get 32-bit alignment |
|
225 while ( length2++ < lengthAligned2 ) |
|
226 { |
|
227 *ptr++ = 0; |
|
228 } |
|
229 length += sizeof ( TUint32 ) + lengthAligned2; |
|
230 } |
|
231 else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) |
|
232 { |
|
233 *( ( TUint32* )ptr ) = 0; |
|
234 ptr += sizeof ( TUint32 ); |
|
235 length += sizeof ( TUint32 ); |
|
236 } |
|
237 // Check that there are enough space to next parameter |
|
238 if ((length + sizeof ( TUint )) <= KOstMaxDataLength) |
|
239 { |
|
240 *( ( TUint* )ptr ) = aParam3; |
|
241 ptr += sizeof ( TUint ); |
|
242 length += sizeof ( TUint ); |
|
243 } |
|
244 ptr -= length; |
|
245 retval = OstSendNBytes( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); |
|
246 } |
|
247 return retval; |
|
248 } |
|
249 |
|
250 inline TBool OstTraceGen3( TUint32 aTraceID, const TDesC8& aParam1, const TDesC8& aParam2, TUint32 aParam3 ) |
|
251 { |
|
252 TBool retval = BTrace8( KBTraceCategoryOpenSystemTrace, EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); |
|
253 if ( retval ) |
|
254 { |
|
255 TInt length = 0; |
|
256 // Check that parameter lenght is not too long |
|
257 TInt length1 = aParam1.Size(); |
|
258 if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) |
|
259 { |
|
260 length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); |
|
261 } |
|
262 TInt lengthAligned1 = ( length1 + 3 ) & ~3; |
|
263 if (lengthAligned1 > 0) |
|
264 { |
|
265 length = length + sizeof ( TUint32 ) + lengthAligned1; |
|
266 } |
|
267 // Check that parameter lenght is not too long |
|
268 TInt length2 = aParam2.Size(); |
|
269 if ((length + length2 + sizeof ( TUint32 )) > KOstMaxDataLength) |
|
270 { |
|
271 length2 = KOstMaxDataLength - (length + sizeof ( TUint32 )); |
|
272 } |
|
273 TInt lengthAligned2 = ( length2 + 3 ) & ~3; |
|
274 if (lengthAligned2 > 0) |
|
275 { |
|
276 length = length + sizeof ( TUint32 ) + lengthAligned2; |
|
277 } |
|
278 TUint8 data[ KOstMaxDataLength ]; |
|
279 TUint8* ptr = data; |
|
280 // Set length to zero and calculate it againg |
|
281 // when adding parameters |
|
282 length = 0; |
|
283 if (length1 > 0) |
|
284 { |
|
285 // Number of elements is written before data |
|
286 // In case of Unicode string, number of elements is half of length |
|
287 *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); |
|
288 ptr += sizeof ( TUint32 ); |
|
289 memcpy( ptr, aParam1.Ptr(), length1 ); |
|
290 ptr += length1; |
|
291 // Fillers are written to get 32-bit alignment |
|
292 while ( length1++ < lengthAligned1 ) |
|
293 { |
|
294 *ptr++ = 0; |
|
295 } |
|
296 length += sizeof ( TUint32 ) + lengthAligned1; |
|
297 } |
|
298 else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) |
|
299 { |
|
300 *( ( TUint32* )ptr ) = 0; |
|
301 ptr += sizeof ( TUint32 ); |
|
302 length += sizeof ( TUint32 ); |
|
303 } |
|
304 if (length2 > 0) |
|
305 { |
|
306 // Number of elements is written before data |
|
307 // In case of Unicode string, number of elements is half of length |
|
308 *( ( TUint32* )ptr ) = length2 / (aParam2.Size() / aParam2.Length()); |
|
309 ptr += sizeof ( TUint32 ); |
|
310 memcpy( ptr, aParam2.Ptr(), length2 ); |
|
311 ptr += length2; |
|
312 // Fillers are written to get 32-bit alignment |
|
313 while ( length2++ < lengthAligned2 ) |
|
314 { |
|
315 *ptr++ = 0; |
|
316 } |
|
317 length += sizeof ( TUint32 ) + lengthAligned2; |
|
318 } |
|
319 else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) |
|
320 { |
|
321 *( ( TUint32* )ptr ) = 0; |
|
322 ptr += sizeof ( TUint32 ); |
|
323 length += sizeof ( TUint32 ); |
|
324 } |
|
325 // Check that there are enough space to next parameter |
|
326 if ((length + sizeof ( TUint )) <= KOstMaxDataLength) |
|
327 { |
|
328 *( ( TUint* )ptr ) = aParam3; |
|
329 ptr += sizeof ( TUint ); |
|
330 length += sizeof ( TUint ); |
|
331 } |
|
332 ptr -= length; |
|
333 retval = OstSendNBytes( KBTraceCategoryOpenSystemTrace, EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); |
|
334 } |
|
335 return retval; |
|
336 } |
|
337 |
|
338 |
|
339 #endif |
|
340 |
|
341 // End of file |
|
342 |