|
1 // Copyright (c) 2007-2010 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 |
|
15 /** |
|
16 @internalComponent |
|
17 */ |
|
18 |
|
19 #ifndef __TRACECOREREGISTERWRITER_H__ |
|
20 #define __TRACECOREREGISTERWRITER_H__ |
|
21 |
|
22 |
|
23 // Include files |
|
24 #include "TraceCoreWriter.h" |
|
25 |
|
26 |
|
27 class TTraceCoreRegisterWriterProperties |
|
28 { |
|
29 public: |
|
30 TUint32 iDataRegister0; |
|
31 TUint32 iDataRegister1; |
|
32 TUint32 iControlRegister; |
|
33 TUint8 iDataStart; |
|
34 TUint8 iControlEnd0; |
|
35 TUint8 iControlEnd1; |
|
36 }; |
|
37 |
|
38 |
|
39 /** |
|
40 * Base class for optimized writers that use a register address to write data |
|
41 */ |
|
42 class DTraceCoreRegisterWriter : public DTraceCoreWriter |
|
43 { |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Constructor |
|
48 */ |
|
49 /*IMPORT_C*/ DTraceCoreRegisterWriter(); |
|
50 |
|
51 /** |
|
52 * Destructor |
|
53 */ |
|
54 /*IMPORT_C*/ ~DTraceCoreRegisterWriter(); |
|
55 |
|
56 /** |
|
57 * Registers this writer to TraceCore. The first writer to register becomes the active writer. |
|
58 */ |
|
59 /*IMPORT_C*/ TInt Register(); |
|
60 |
|
61 /** |
|
62 * Initializes the properties of this writer |
|
63 */ |
|
64 virtual void InitProperties( TTraceCoreRegisterWriterProperties& aProperties ) = 0; |
|
65 |
|
66 /** |
|
67 * Outputs a TraceCore frame. This calls WriteStart, writes the component and group ID's, |
|
68 * calls WriteBTraceFrame and calls WriteEnd |
|
69 * |
|
70 * @param aComponentId the component ID |
|
71 * @param aTraceId the trace ID |
|
72 * @param aHeader BTrace header |
|
73 * @param aHeader2 Extra header data |
|
74 * @param aContext The thread context in which this function was called |
|
75 * @param a1 The first trace parameter |
|
76 * @param a2 The second trace parameter |
|
77 * @param a3 The third trace parameter |
|
78 * @param aExtra Extra trace data |
|
79 * @param aPc The program counter value |
|
80 * @param aRecordSize The record size |
|
81 */ |
|
82 virtual void WriteTraceCoreFrame( const TUint32 aComponentId, const TUint32 aTraceId, |
|
83 TUint32 aHeader, TUint32 aHeader2, const TUint32 aContext, const TUint32 a1, |
|
84 const TUint32 a2, const TUint32 a3, const TUint32 aExtra, const TUint32 aPc, TUint32 aRecordSize ) = 0; |
|
85 |
|
86 |
|
87 /** |
|
88 * Writes 8-bit data to given entry (Time stamped channel -> ends the trace for used channel) |
|
89 * |
|
90 * @param aEntryId the entry ID returned by WriteStart |
|
91 * @param aData the trace data |
|
92 */ |
|
93 virtual void WriteDataTs( TUint32 aEntryId, TUint8 aData ) = 0; |
|
94 |
|
95 /** |
|
96 * Writes 16-bit data to given entry (Time stamped channel -> ends the trace for used channel) |
|
97 * |
|
98 * @param aEntryId the entry ID returned by WriteStart |
|
99 * @param aData the trace data |
|
100 */ |
|
101 virtual void WriteDataTs( TUint32 aEntryId, TUint16 aData ) = 0; |
|
102 |
|
103 /** |
|
104 * Writes 32-bit data to given entry (Time stamped channel -> ends the trace for used channel) |
|
105 * |
|
106 * @param aEntryId the entry ID returned by WriteStart |
|
107 * @param aData the trace data |
|
108 */ |
|
109 virtual void WriteDataTs( TUint32 aEntryId, TUint32 aData ) = 0; |
|
110 |
|
111 /** |
|
112 * Outputs a TraceCore frame |
|
113 * |
|
114 * @param aComponentId the component ID |
|
115 * @param aTraceId the trace ID |
|
116 * @param aHeader BTrace header |
|
117 * @param aHeader2 Extra header data |
|
118 * @param aContext The thread context in which this function was called |
|
119 * @param a1 The first trace parameter |
|
120 * @param a2 The second trace parameter |
|
121 * @param a3 The third trace parameter |
|
122 * @param aExtra Extra trace data |
|
123 * @param aPc The program counter value |
|
124 * @param aRecordSize The record size |
|
125 */ |
|
126 // void OptimizedWriteTraceCoreFrame( const TUint32 aComponentId, const TUint32 aTraceId, |
|
127 // TUint32 aHeader, TUint32 aHeader2, const TUint32 aContext, const TUint32 a1, |
|
128 // const TUint32 a2, const TUint32 a3, const TUint32 aExtra, const TUint32 aPc, TUint32 aRecordSize ); |
|
129 #ifndef __WINS__ |
|
130 /** |
|
131 * InterruptsDisabled |
|
132 * |
|
133 */ |
|
134 /*IMPORT_C*/ TUint32 InterruptsDisabled(); |
|
135 #endif |
|
136 |
|
137 protected: |
|
138 |
|
139 /** |
|
140 * Outputs a BTrace frame |
|
141 * |
|
142 * @param aHeader BTrace header |
|
143 * @param aHeader2 Extra header data |
|
144 * @param aContext The thread context in which this function was called |
|
145 * @param a1 The first trace parameter |
|
146 * @param a2 The second trace parameter |
|
147 * @param a3 The third trace parameter |
|
148 * @param aExtra Extra trace data |
|
149 * @param aPc The program counter value |
|
150 * @param aRecordSize The record size |
|
151 */ |
|
152 virtual void WriteBTraceFrame( TUint32 aWriteParameter, TUint32 aHeader, TUint32 aHeader2, |
|
153 const TUint32 aContext, const TUint32 a1, const TUint32 a2, const TUint32 a3, |
|
154 const TUint32 aExtra, const TUint32 aPc, TUint32 aRecordSize ) = 0; |
|
155 |
|
156 /** |
|
157 * Writes the remaining bytes if data is not 32-bit aligned |
|
158 */ |
|
159 virtual void WriteRemainingBytes( TUint32 aWriteParameter, const TUint32 aSize, const TUint32 a3 ) = 0; |
|
160 |
|
161 /** |
|
162 * Write helper functions |
|
163 */ |
|
164 // inline void LocalWriteData8( TUint32 aWriteParameter, TUint8 aValue, TInt32 aSizeLeftBeforeWrite ); |
|
165 // inline void LocalWriteData16( TUint32 aWriteParameter, TUint16 aValue, TInt32 aSizeLeftBeforeWrite ); |
|
166 // inline void LocalWriteData32( TUint32 aWriteParameter, TUint32 aValue, TInt32 aSizeLeftBeforeWrite ); |
|
167 |
|
168 /** |
|
169 * Writer properties |
|
170 */ |
|
171 TTraceCoreRegisterWriterProperties iProperties; |
|
172 }; |
|
173 |
|
174 #endif |
|
175 |
|
176 // End of file |