|
0
|
1 #ifndef CYGONCE_KERNEL_INSTRMNT_HXX |
|
|
2 #define CYGONCE_KERNEL_INSTRMNT_HXX |
|
|
3 |
|
|
4 //========================================================================== |
|
|
5 // |
|
|
6 // instrmnt.hxx |
|
|
7 // |
|
|
8 // Kernel Instrumentation mechanism |
|
|
9 // |
|
|
10 //========================================================================== |
|
|
11 //####COPYRIGHTBEGIN#### |
|
|
12 // |
|
|
13 // ------------------------------------------- |
|
|
14 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
15 // Version 1.0 (the "License"); you may not use this file except in |
|
|
16 // compliance with the License. You may obtain a copy of the License at |
|
|
17 // http://sourceware.cygnus.com/ecos |
|
|
18 // |
|
|
19 // Software distributed under the License is distributed on an "AS IS" |
|
|
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
21 // License for the specific language governing rights and limitations under |
|
|
22 // the License. |
|
|
23 // |
|
|
24 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
25 // September 30, 1998. |
|
|
26 // |
|
|
27 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
29 // ------------------------------------------- |
|
|
30 // |
|
|
31 //####COPYRIGHTEND#### |
|
|
32 //========================================================================== |
|
|
33 //#####DESCRIPTIONBEGIN#### |
|
|
34 // |
|
|
35 // Author(s): nickg |
|
|
36 // Contributors: nickg |
|
|
37 // Date: 1997-10-24 |
|
|
38 // Purpose: Define kernel instrumentation |
|
|
39 // Description: A set of definitions and macros used to implement an |
|
|
40 // instrumentation interface for the kernel. |
|
|
41 // Usage: #include <cyg/kernel/instrmnt.hxx> |
|
|
42 // |
|
|
43 //####DESCRIPTIONEND#### |
|
|
44 // |
|
|
45 //========================================================================== |
|
|
46 |
|
|
47 #include <cyg/kernel/ktypes.h> |
|
|
48 #include <cyg/infra/cyg_ass.h> // assertion macros |
|
|
49 |
|
|
50 // ------------------------------------------------------------------------- |
|
|
51 // Underlying instrumentation function |
|
|
52 |
|
|
53 externC void cyg_instrument( cyg_uint32 type, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2 ); |
|
|
54 |
|
|
55 // ------------------------------------------------------------------------- |
|
|
56 // The following functions are used to enable and disable specific |
|
|
57 // instrumentation classes and events. The class must be one of the |
|
|
58 // class defines below. The event may be one of the event defines below |
|
|
59 // or zero, in which case all of the events in the class are enabled or |
|
|
60 // disabled. |
|
|
61 |
|
|
62 #ifdef CYGDBG_KERNEL_INSTRUMENT_FLAGS |
|
|
63 |
|
|
64 externC void cyg_instrument_enable( cyg_uint32 cl, cyg_uint32 event ); |
|
|
65 |
|
|
66 externC void cyg_instrument_disable( cyg_uint32 cl, cyg_uint32 event ); |
|
|
67 |
|
|
68 #endif |
|
|
69 |
|
|
70 // ------------------------------------------------------------------------- |
|
|
71 // Instrumentation macros |
|
|
72 |
|
|
73 #ifdef CYGPKG_KERNEL_INSTRUMENT |
|
|
74 |
|
|
75 #define CYG_INSTRUMENT(_type_,_arg1_,_arg2_) cyg_instrument(_type_, CYG_ADDRWORD(_arg1_), CYG_ADDRWORD(_arg2_)) |
|
|
76 |
|
|
77 #else // ifdef CYGPKG_KERNEL_INSTRUMENT |
|
|
78 |
|
|
79 #define CYG_INSTRUMENT(_type_,_arg1_,_arg2_) |
|
|
80 |
|
|
81 #endif // ifdef CYGPKG_KERNEL_INSTRUMENT |
|
|
82 |
|
|
83 // ------------------------------------------------------------------------- |
|
|
84 // Type codes. |
|
|
85 // Each code is 16 bit with an event class in the top 8 bits |
|
|
86 // and an event code in the lower 8 bits. |
|
|
87 |
|
|
88 // Event classes |
|
|
89 #define CYG_INSTRUMENT_CLASS_SCHED 0x0100 |
|
|
90 #define CYG_INSTRUMENT_CLASS_THREAD 0x0200 |
|
|
91 #define CYG_INSTRUMENT_CLASS_INTR 0x0300 |
|
|
92 #define CYG_INSTRUMENT_CLASS_MUTEX 0x0400 |
|
|
93 #define CYG_INSTRUMENT_CLASS_CONDVAR 0x0500 |
|
|
94 #define CYG_INSTRUMENT_CLASS_BINSEM 0x0600 |
|
|
95 #define CYG_INSTRUMENT_CLASS_CNTSEM 0x0700 |
|
|
96 #define CYG_INSTRUMENT_CLASS_CLOCK 0x0800 |
|
|
97 #define CYG_INSTRUMENT_CLASS_ALARM 0x0900 |
|
|
98 #define CYG_INSTRUMENT_CLASS_MBOXT 0x0a00 |
|
|
99 |
|
|
100 #define CYG_INSTRUMENT_CLASS_USER 0x0f00 |
|
|
101 |
|
|
102 #define CYG_INSTRUMENT_CLASS_MAX CYG_INSTRUMENT_CLASS_USER |
|
|
103 |
|
|
104 // Scheduler events |
|
|
105 #define CYG_INSTRUMENT_EVENT_SCHED_LOCK 1 |
|
|
106 #define CYG_INSTRUMENT_EVENT_SCHED_UNLOCK 2 |
|
|
107 #define CYG_INSTRUMENT_EVENT_SCHED_RESCHEDULE 3 |
|
|
108 #define CYG_INSTRUMENT_EVENT_SCHED_TIMESLICE 4 |
|
|
109 |
|
|
110 // Thread events |
|
|
111 #define CYG_INSTRUMENT_EVENT_THREAD_SWITCH 1 |
|
|
112 #define CYG_INSTRUMENT_EVENT_THREAD_SLEEP 2 |
|
|
113 #define CYG_INSTRUMENT_EVENT_THREAD_WAKE 3 |
|
|
114 #define CYG_INSTRUMENT_EVENT_THREAD_SUSPEND 4 |
|
|
115 #define CYG_INSTRUMENT_EVENT_THREAD_RESUME 5 |
|
|
116 #define CYG_INSTRUMENT_EVENT_THREAD_PRIORITY 6 |
|
|
117 #define CYG_INSTRUMENT_EVENT_THREAD_DELAY 7 |
|
|
118 #define CYG_INSTRUMENT_EVENT_THREAD_ALARM 8 |
|
|
119 |
|
|
120 // Interrupt events |
|
|
121 #define CYG_INSTRUMENT_EVENT_INTR_RAISE 1 |
|
|
122 #define CYG_INSTRUMENT_EVENT_INTR_END 2 |
|
|
123 #define CYG_INSTRUMENT_EVENT_INTR_RESTORE 3 |
|
|
124 #define CYG_INSTRUMENT_EVENT_INTR_POST_DSR 4 |
|
|
125 #define CYG_INSTRUMENT_EVENT_INTR_CALL_DSR 5 |
|
|
126 #define CYG_INSTRUMENT_EVENT_INTR_ATTACH 6 |
|
|
127 #define CYG_INSTRUMENT_EVENT_INTR_DETACH 7 |
|
|
128 #define CYG_INSTRUMENT_EVENT_INTR_SET_VSR 8 |
|
|
129 #define CYG_INSTRUMENT_EVENT_INTR_DISABLE 9 |
|
|
130 #define CYG_INSTRUMENT_EVENT_INTR_ENABLE 10 |
|
|
131 #define CYG_INSTRUMENT_EVENT_INTR_MASK 11 |
|
|
132 #define CYG_INSTRUMENT_EVENT_INTR_UNMASK 12 |
|
|
133 #define CYG_INSTRUMENT_EVENT_INTR_CONFIGURE 13 |
|
|
134 #define CYG_INSTRUMENT_EVENT_INTR_ACK 14 |
|
|
135 #define CYG_INSTRUMENT_EVENT_INTR_CHAIN_ISR 15 |
|
|
136 |
|
|
137 // Mutex events |
|
|
138 #define CYG_INSTRUMENT_EVENT_MUTEX_LOCK 1 |
|
|
139 #define CYG_INSTRUMENT_EVENT_MUTEX_WAIT 2 |
|
|
140 #define CYG_INSTRUMENT_EVENT_MUTEX_LOCKED 3 |
|
|
141 #define CYG_INSTRUMENT_EVENT_MUTEX_TRY 4 |
|
|
142 #define CYG_INSTRUMENT_EVENT_MUTEX_UNLOCK 5 |
|
|
143 #define CYG_INSTRUMENT_EVENT_MUTEX_WAKE 6 |
|
|
144 |
|
|
145 // Condition variable events |
|
|
146 #define CYG_INSTRUMENT_EVENT_CONDVAR_WAIT 1 |
|
|
147 #define CYG_INSTRUMENT_EVENT_CONDVAR_WOKE 2 |
|
|
148 #define CYG_INSTRUMENT_EVENT_CONDVAR_SIGNAL 3 |
|
|
149 #define CYG_INSTRUMENT_EVENT_CONDVAR_WAKE 4 |
|
|
150 #define CYG_INSTRUMENT_EVENT_CONDVAR_BROADCAST 5 |
|
|
151 #define CYG_INSTRUMENT_EVENT_CONDVAR_TIMED_WAIT 6 |
|
|
152 |
|
|
153 // Binary semaphore events |
|
|
154 #define CYG_INSTRUMENT_EVENT_BINSEM_CLAIM 1 |
|
|
155 #define CYG_INSTRUMENT_EVENT_BINSEM_WAIT 2 |
|
|
156 #define CYG_INSTRUMENT_EVENT_BINSEM_WOKE 3 |
|
|
157 #define CYG_INSTRUMENT_EVENT_BINSEM_TRY 4 |
|
|
158 #define CYG_INSTRUMENT_EVENT_BINSEM_POST 5 |
|
|
159 #define CYG_INSTRUMENT_EVENT_BINSEM_WAKE 6 |
|
|
160 |
|
|
161 // Counting semaphore events |
|
|
162 #define CYG_INSTRUMENT_EVENT_CNTSEM_CLAIM 1 |
|
|
163 #define CYG_INSTRUMENT_EVENT_CNTSEM_WAIT 2 |
|
|
164 #define CYG_INSTRUMENT_EVENT_CNTSEM_WOKE 3 |
|
|
165 #define CYG_INSTRUMENT_EVENT_CNTSEM_TRY 4 |
|
|
166 #define CYG_INSTRUMENT_EVENT_CNTSEM_POST 5 |
|
|
167 #define CYG_INSTRUMENT_EVENT_CNTSEM_WAKE 6 |
|
|
168 #define CYG_INSTRUMENT_EVENT_CNTSEM_TIMEOUT 7 |
|
|
169 |
|
|
170 // Clock events |
|
|
171 #define CYG_INSTRUMENT_EVENT_CLOCK_TICK_START 1 |
|
|
172 #define CYG_INSTRUMENT_EVENT_CLOCK_TICK_END 2 |
|
|
173 #define CYG_INSTRUMENT_EVENT_CLOCK_ISR 3 |
|
|
174 |
|
|
175 // Alarm events |
|
|
176 #define CYG_INSTRUMENT_EVENT_ALARM_ADD 1 |
|
|
177 #define CYG_INSTRUMENT_EVENT_ALARM_REM 2 |
|
|
178 #define CYG_INSTRUMENT_EVENT_ALARM_CALL 3 |
|
|
179 #define CYG_INSTRUMENT_EVENT_ALARM_INIT 4 |
|
|
180 #define CYG_INSTRUMENT_EVENT_ALARM_TRIGGER 5 |
|
|
181 #define CYG_INSTRUMENT_EVENT_ALARM_INTERVAL 6 |
|
|
182 |
|
|
183 // Mboxt events |
|
|
184 #define CYG_INSTRUMENT_EVENT_MBOXT_WAIT 1 |
|
|
185 #define CYG_INSTRUMENT_EVENT_MBOXT_GET 2 |
|
|
186 #define CYG_INSTRUMENT_EVENT_MBOXT_GOT 3 |
|
|
187 #define CYG_INSTRUMENT_EVENT_MBOXT_TIMEOUT 4 |
|
|
188 #define CYG_INSTRUMENT_EVENT_MBOXT_WAKE 5 |
|
|
189 #define CYG_INSTRUMENT_EVENT_MBOXT_TRY 6 |
|
|
190 #define CYG_INSTRUMENT_EVENT_MBOXT_PUT 7 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 // User events |
|
|
195 |
|
|
196 #define CYG_INSTRUMENT_EVENT_USER_1 1 |
|
|
197 #define CYG_INSTRUMENT_EVENT_USER_2 2 |
|
|
198 #define CYG_INSTRUMENT_EVENT_USER_3 3 |
|
|
199 #define CYG_INSTRUMENT_EVENT_USER_4 4 |
|
|
200 #define CYG_INSTRUMENT_EVENT_USER_5 5 |
|
|
201 #define CYG_INSTRUMENT_EVENT_USER_6 6 |
|
|
202 #define CYG_INSTRUMENT_EVENT_USER_7 7 |
|
|
203 #define CYG_INSTRUMENT_EVENT_USER_8 8 |
|
|
204 #define CYG_INSTRUMENT_EVENT_USER_9 9 |
|
|
205 #define CYG_INSTRUMENT_EVENT_USER_10 10 |
|
|
206 #define CYG_INSTRUMENT_EVENT_USER_11 11 |
|
|
207 #define CYG_INSTRUMENT_EVENT_USER_12 12 |
|
|
208 #define CYG_INSTRUMENT_EVENT_USER_13 13 |
|
|
209 #define CYG_INSTRUMENT_EVENT_USER_14 14 |
|
|
210 #define CYG_INSTRUMENT_EVENT_USER_15 15 |
|
|
211 #define CYG_INSTRUMENT_EVENT_USER_16 16 |
|
|
212 #define CYG_INSTRUMENT_EVENT_USER_17 17 |
|
|
213 #define CYG_INSTRUMENT_EVENT_USER_18 18 |
|
|
214 #define CYG_INSTRUMENT_EVENT_USER_19 19 |
|
|
215 |
|
|
216 // ------------------------------------------------------------------------- |
|
|
217 // Handy-dandy macro to make event codes. |
|
|
218 // Note that this relies on the definitions above |
|
|
219 // having a well defined form. |
|
|
220 |
|
|
221 #define CYGINST_EVENT(_class_,_event_) \ |
|
|
222 ((CYG_INSTRUMENT_CLASS_##_class_)|(CYG_INSTRUMENT_EVENT_##_class_##_##_event_)) |
|
|
223 |
|
|
224 // ------------------------------------------------------------------------- |
|
|
225 // Scheduler instrumentation macros |
|
|
226 |
|
|
227 #ifdef CYGDBG_KERNEL_INSTRUMENT_SCHED |
|
|
228 |
|
|
229 #define CYG_INSTRUMENT_SCHED(_event_,_arg1_,_arg2_) \ |
|
|
230 CYG_INSTRUMENT(CYGINST_EVENT(SCHED,_event_),_arg1_,_arg2_) |
|
|
231 |
|
|
232 #else |
|
|
233 |
|
|
234 #define CYG_INSTRUMENT_SCHED(_event_,_arg1_,_arg2_) |
|
|
235 |
|
|
236 #endif |
|
|
237 |
|
|
238 // ------------------------------------------------------------------------- |
|
|
239 // Thread instrumentation macros |
|
|
240 |
|
|
241 #ifdef CYGDBG_KERNEL_INSTRUMENT_THREAD |
|
|
242 |
|
|
243 #define CYG_INSTRUMENT_THREAD(_event_,_arg1_,_arg2_) \ |
|
|
244 CYG_INSTRUMENT(CYGINST_EVENT(THREAD,_event_),_arg1_,_arg2_) |
|
|
245 |
|
|
246 #else |
|
|
247 |
|
|
248 #define CYG_INSTRUMENT_THREAD(_event_,_arg1_,_arg2_) |
|
|
249 |
|
|
250 #endif |
|
|
251 |
|
|
252 // ------------------------------------------------------------------------- |
|
|
253 // Interrupt instrumentation macros |
|
|
254 |
|
|
255 #ifdef CYGDBG_KERNEL_INSTRUMENT_INTR |
|
|
256 |
|
|
257 #define CYG_INSTRUMENT_INTR(_event_,_arg1_,_arg2_) \ |
|
|
258 CYG_INSTRUMENT(CYGINST_EVENT(INTR,_event_),_arg1_,_arg2_) |
|
|
259 |
|
|
260 #else |
|
|
261 |
|
|
262 #define CYG_INSTRUMENT_INTR(_event_,_arg1_,_arg2_) |
|
|
263 |
|
|
264 #endif |
|
|
265 |
|
|
266 // ------------------------------------------------------------------------- |
|
|
267 // Mutex instrumentation macros |
|
|
268 |
|
|
269 #ifdef CYGDBG_KERNEL_INSTRUMENT_MUTEX |
|
|
270 |
|
|
271 #define CYG_INSTRUMENT_MUTEX(_event_,_arg1_,_arg2_) \ |
|
|
272 CYG_INSTRUMENT(CYGINST_EVENT(MUTEX,_event_),_arg1_,_arg2_) |
|
|
273 |
|
|
274 #else |
|
|
275 |
|
|
276 #define CYG_INSTRUMENT_MUTEX(_event_,_arg1_,_arg2_) |
|
|
277 |
|
|
278 #endif |
|
|
279 |
|
|
280 // ------------------------------------------------------------------------- |
|
|
281 // Condition variable instrumentation macros |
|
|
282 |
|
|
283 #ifdef CYGDBG_KERNEL_INSTRUMENT_CONDVAR |
|
|
284 |
|
|
285 #define CYG_INSTRUMENT_CONDVAR(_event_,_arg1_,_arg2_) \ |
|
|
286 CYG_INSTRUMENT(CYGINST_EVENT(CONDVAR,_event_),_arg1_,_arg2_) |
|
|
287 |
|
|
288 #else |
|
|
289 |
|
|
290 #define CYG_INSTRUMENT_CONDVAR(_event_,_arg1_,_arg2_) |
|
|
291 |
|
|
292 #endif |
|
|
293 |
|
|
294 // ------------------------------------------------------------------------- |
|
|
295 // Binary semaphore instrumentation macros |
|
|
296 |
|
|
297 #ifdef CYGDBG_KERNEL_INSTRUMENT_BINSEM |
|
|
298 |
|
|
299 #define CYG_INSTRUMENT_BINSEM(_event_,_arg1_,_arg2_) \ |
|
|
300 CYG_INSTRUMENT(CYGINST_EVENT(BINSEM,_event_),_arg1_,_arg2_) |
|
|
301 |
|
|
302 #else |
|
|
303 |
|
|
304 #define CYG_INSTRUMENT_BINSEM(_event_,_arg1_,_arg2_) |
|
|
305 |
|
|
306 #endif |
|
|
307 |
|
|
308 // ------------------------------------------------------------------------- |
|
|
309 // Counting semaphore instrumentation macros |
|
|
310 |
|
|
311 #ifdef CYGDBG_KERNEL_INSTRUMENT_CNTSEM |
|
|
312 |
|
|
313 #define CYG_INSTRUMENT_CNTSEM(_event_,_arg1_,_arg2_) \ |
|
|
314 CYG_INSTRUMENT(CYGINST_EVENT(CNTSEM,_event_),_arg1_,_arg2_) |
|
|
315 |
|
|
316 #else |
|
|
317 |
|
|
318 #define CYG_INSTRUMENT_CNTSEM(_event_,_arg1_,_arg2_) |
|
|
319 |
|
|
320 #endif |
|
|
321 |
|
|
322 // ------------------------------------------------------------------------- |
|
|
323 // Clock instrumentation macros |
|
|
324 |
|
|
325 #ifdef CYGDBG_KERNEL_INSTRUMENT_CLOCK |
|
|
326 |
|
|
327 #define CYG_INSTRUMENT_CLOCK(_event_,_arg1_,_arg2_) \ |
|
|
328 CYG_INSTRUMENT(CYGINST_EVENT(CLOCK,_event_),_arg1_,_arg2_) |
|
|
329 |
|
|
330 #else |
|
|
331 |
|
|
332 #define CYG_INSTRUMENT_CLOCK(_event_,_arg1_,_arg2_) |
|
|
333 |
|
|
334 #endif |
|
|
335 |
|
|
336 // ------------------------------------------------------------------------- |
|
|
337 // Alarm instrumentation macros |
|
|
338 |
|
|
339 #ifdef CYGDBG_KERNEL_INSTRUMENT_ALARM |
|
|
340 |
|
|
341 #define CYG_INSTRUMENT_ALARM(_event_,_arg1_,_arg2_) \ |
|
|
342 CYG_INSTRUMENT(CYGINST_EVENT(ALARM,_event_),_arg1_,_arg2_) |
|
|
343 |
|
|
344 #else |
|
|
345 |
|
|
346 #define CYG_INSTRUMENT_ALARM(_event_,_arg1_,_arg2_) |
|
|
347 |
|
|
348 #endif |
|
|
349 |
|
|
350 // ------------------------------------------------------------------------- |
|
|
351 // Mboxt instrumentation macros |
|
|
352 |
|
|
353 #ifdef CYGDBG_KERNEL_INSTRUMENT_MBOXT |
|
|
354 |
|
|
355 #define CYG_INSTRUMENT_MBOXT(_event_,_arg1_,_arg2_) \ |
|
|
356 CYG_INSTRUMENT(CYGINST_EVENT(MBOXT,_event_),_arg1_,_arg2_) |
|
|
357 |
|
|
358 #else |
|
|
359 |
|
|
360 #define CYG_INSTRUMENT_MBOXT(_event_,_arg1_,_arg2_) |
|
|
361 |
|
|
362 #endif |
|
|
363 |
|
|
364 // ------------------------------------------------------------------------- |
|
|
365 // User instrumentation |
|
|
366 |
|
|
367 #ifdef CYGDBG_KERNEL_INSTRUMENT_USER |
|
|
368 |
|
|
369 #define CYG_INSTRUMENT_USER(_event_,_arg1_,_arg2_) \ |
|
|
370 CYG_INSTRUMENT(CYGINST_EVENT(USER,_event_),_arg1_,_arg2_) |
|
|
371 |
|
|
372 #else |
|
|
373 |
|
|
374 #define CYG_INSTRUMENT_USER(_event_,_arg1_,_arg2_) |
|
|
375 |
|
|
376 #endif |
|
|
377 |
|
|
378 |
|
|
379 // ------------------------------------------------------------------------- |
|
|
380 #endif // ifndef CYGONCE_KERNEL_INSTRMNT_HXX |
|
|
381 // EOF instrmnt.hxx |