OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [kernel/] [v2_0/] [include/] [instrmnt.h] - Blame information for rev 631

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#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
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
//==========================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):    nickg
47
// Contributors: nickg, andrew.lunn@ascom.ch
48
// Date:         2000-05-04
49
// Purpose:      Define kernel instrumentation
50
// Description:  A set of definitions and macros used to implement an
51
//               instrumentation interface for the kernel.
52
//               NOTE: Don't use CYG_UNUSED_PARAM (or similar) here to
53
//               silence warnings about unused variables when using the
54
//               empty macro definitions. Otherwise this can cause problems
55
//               with volatile arguments and cause other side-effects.
56
//               Instead it is up to the caller to ensure that unused
57
//               arguments don't cause warnings
58
// Usage:        #include <cyg/kernel/instrmnt.hxx>
59
//
60
//####DESCRIPTIONEND####
61
//
62
//==========================================================================
63
 
64
#include <cyg/kernel/ktypes.h>
65
#include <cyg/infra/cyg_ass.h>            // assertion macros
66
 
67
// -------------------------------------------------------------------------
68
// Underlying instrumentation function
69
 
70
externC void cyg_instrument( cyg_uint32 type, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2 );
71
 
72
// -------------------------------------------------------------------------
73
// The following functions are used to enable and disable specific
74
// instrumentation classes and events. The class must be one of the
75
// class defines below. The event may be one of the event defines below
76
// or zero, in which case all of the events in the class are enabled or
77
// disabled.
78
 
79
#ifdef CYGDBG_KERNEL_INSTRUMENT_FLAGS
80
 
81
externC void cyg_instrument_enable( cyg_uint32 cl, cyg_uint32 event );
82
 
83
externC void cyg_instrument_disable( cyg_uint32 cl, cyg_uint32 event );
84
 
85
externC cyg_bool cyg_instrument_state( cyg_uint32 cl, cyg_uint32 event );
86
 
87
#endif
88
 
89
#ifdef CYGDBG_KERNEL_INSTRUMENT_MSGS
90
externC char * cyg_instrument_msg(CYG_WORD16 type);
91
#endif 
92
 
93
// -------------------------------------------------------------------------
94
// Instrumentation macros
95
 
96
#ifdef CYGPKG_KERNEL_INSTRUMENT
97
 
98
#define CYG_INSTRUMENT(_type_,_arg1_,_arg2_) cyg_instrument(_type_, (CYG_ADDRWORD)(_arg1_), (CYG_ADDRWORD)(_arg2_))
99
 
100
#else   // ifdef CYGPKG_KERNEL_INSTRUMENT
101
 
102
#define CYG_INSTRUMENT(_type_,_arg1_,_arg2_)
103
 
104
#endif  // ifdef CYGPKG_KERNEL_INSTRUMENT
105
 
106
// -------------------------------------------------------------------------
107
// Type codes.
108
// Each code is 16 bit with an event class in the top 8 bits
109
// and an event code in the lower 8 bits.
110
 
111
// Event classes
112
#define CYG_INSTRUMENT_CLASS_SCHED              0x0100
113
#define CYG_INSTRUMENT_CLASS_THREAD             0x0200
114
#define CYG_INSTRUMENT_CLASS_INTR               0x0300
115
#define CYG_INSTRUMENT_CLASS_MUTEX              0x0400
116
#define CYG_INSTRUMENT_CLASS_CONDVAR            0x0500
117
#define CYG_INSTRUMENT_CLASS_BINSEM             0x0600
118
#define CYG_INSTRUMENT_CLASS_CNTSEM             0x0700
119
#define CYG_INSTRUMENT_CLASS_CLOCK              0x0800
120
#define CYG_INSTRUMENT_CLASS_ALARM              0x0900
121
#define CYG_INSTRUMENT_CLASS_MBOXT              0x0a00
122
#define CYG_INSTRUMENT_CLASS_SMP                0x0b00
123
#define CYG_INSTRUMENT_CLASS_MLQ                0x0c00
124
 
125
#define CYG_INSTRUMENT_CLASS_USER               0x0f00
126
 
127
#define CYG_INSTRUMENT_CLASS_MAX                CYG_INSTRUMENT_CLASS_USER
128
 
129
// Scheduler events
130
#define CYG_INSTRUMENT_EVENT_SCHED_LOCK         1
131
#define CYG_INSTRUMENT_EVENT_SCHED_UNLOCK       2
132
#define CYG_INSTRUMENT_EVENT_SCHED_RESCHEDULE   3
133
#define CYG_INSTRUMENT_EVENT_SCHED_TIMESLICE    4
134
 
135
// Thread events
136
#define CYG_INSTRUMENT_EVENT_THREAD_SWITCH      1
137
#define CYG_INSTRUMENT_EVENT_THREAD_SLEEP       2
138
#define CYG_INSTRUMENT_EVENT_THREAD_WAKE        3
139
#define CYG_INSTRUMENT_EVENT_THREAD_SUSPEND     4
140
#define CYG_INSTRUMENT_EVENT_THREAD_RESUME      5
141
#define CYG_INSTRUMENT_EVENT_THREAD_PRIORITY    6
142
#define CYG_INSTRUMENT_EVENT_THREAD_DELAY       7
143
#define CYG_INSTRUMENT_EVENT_THREAD_ALARM       8
144
#define CYG_INSTRUMENT_EVENT_THREAD_ENTER       9
145
#define CYG_INSTRUMENT_EVENT_THREAD_CHECK_STACK 10
146
#define CYG_INSTRUMENT_EVENT_THREAD_ATTACH_STACK 11
147
#define CYG_INSTRUMENT_EVENT_THREAD_CREATE      12
148
 
149
// Interrupt events
150
#define CYG_INSTRUMENT_EVENT_INTR_RAISE         1
151
#define CYG_INSTRUMENT_EVENT_INTR_END           2
152
#define CYG_INSTRUMENT_EVENT_INTR_RESTORE       3
153
#define CYG_INSTRUMENT_EVENT_INTR_POST_DSR      4
154
#define CYG_INSTRUMENT_EVENT_INTR_CALL_DSR      5
155
#define CYG_INSTRUMENT_EVENT_INTR_ATTACH        6
156
#define CYG_INSTRUMENT_EVENT_INTR_DETACH        7
157
#define CYG_INSTRUMENT_EVENT_INTR_SET_VSR       8
158
#define CYG_INSTRUMENT_EVENT_INTR_DISABLE       9
159
#define CYG_INSTRUMENT_EVENT_INTR_ENABLE        10
160
#define CYG_INSTRUMENT_EVENT_INTR_MASK          11
161
#define CYG_INSTRUMENT_EVENT_INTR_UNMASK        12
162
#define CYG_INSTRUMENT_EVENT_INTR_CONFIGURE     13
163
#define CYG_INSTRUMENT_EVENT_INTR_ACK           14
164
#define CYG_INSTRUMENT_EVENT_INTR_CHAIN_ISR     15
165
#define CYG_INSTRUMENT_EVENT_INTR_SET_CPU       16
166
#define CYG_INSTRUMENT_EVENT_INTR_GET_CPU       17
167
 
168
// Mutex events
169
#define CYG_INSTRUMENT_EVENT_MUTEX_LOCK         1
170
#define CYG_INSTRUMENT_EVENT_MUTEX_WAIT         2
171
#define CYG_INSTRUMENT_EVENT_MUTEX_LOCKED       3
172
#define CYG_INSTRUMENT_EVENT_MUTEX_TRY          4
173
#define CYG_INSTRUMENT_EVENT_MUTEX_UNLOCK       5
174
#define CYG_INSTRUMENT_EVENT_MUTEX_WAKE         6
175
#define CYG_INSTRUMENT_EVENT_MUTEX_RELEASE      7
176
#define CYG_INSTRUMENT_EVENT_MUTEX_RELEASED     8
177
 
178
// Condition variable events
179
#define CYG_INSTRUMENT_EVENT_CONDVAR_WAIT       1
180
#define CYG_INSTRUMENT_EVENT_CONDVAR_WOKE       2
181
#define CYG_INSTRUMENT_EVENT_CONDVAR_SIGNAL     3
182
#define CYG_INSTRUMENT_EVENT_CONDVAR_WAKE       4
183
#define CYG_INSTRUMENT_EVENT_CONDVAR_BROADCAST  5
184
#define CYG_INSTRUMENT_EVENT_CONDVAR_TIMED_WAIT 6
185
 
186
// Binary semaphore events
187
#define CYG_INSTRUMENT_EVENT_BINSEM_CLAIM       1
188
#define CYG_INSTRUMENT_EVENT_BINSEM_WAIT        2
189
#define CYG_INSTRUMENT_EVENT_BINSEM_WOKE        3
190
#define CYG_INSTRUMENT_EVENT_BINSEM_TRY         4
191
#define CYG_INSTRUMENT_EVENT_BINSEM_POST        5
192
#define CYG_INSTRUMENT_EVENT_BINSEM_WAKE        6
193
 
194
// Counting semaphore events
195
#define CYG_INSTRUMENT_EVENT_CNTSEM_CLAIM       1
196
#define CYG_INSTRUMENT_EVENT_CNTSEM_WAIT        2
197
#define CYG_INSTRUMENT_EVENT_CNTSEM_WOKE        3
198
#define CYG_INSTRUMENT_EVENT_CNTSEM_TRY         4
199
#define CYG_INSTRUMENT_EVENT_CNTSEM_POST        5
200
#define CYG_INSTRUMENT_EVENT_CNTSEM_WAKE        6
201
#define CYG_INSTRUMENT_EVENT_CNTSEM_TIMEOUT     7
202
 
203
// Clock events
204
#define CYG_INSTRUMENT_EVENT_CLOCK_TICK_START   1
205
#define CYG_INSTRUMENT_EVENT_CLOCK_TICK_END     2
206
#define CYG_INSTRUMENT_EVENT_CLOCK_ISR          3
207
 
208
// Alarm events
209
#define CYG_INSTRUMENT_EVENT_ALARM_ADD          1
210
#define CYG_INSTRUMENT_EVENT_ALARM_REM          2
211
#define CYG_INSTRUMENT_EVENT_ALARM_CALL         3
212
#define CYG_INSTRUMENT_EVENT_ALARM_INIT         4
213
#define CYG_INSTRUMENT_EVENT_ALARM_TRIGGER      5
214
#define CYG_INSTRUMENT_EVENT_ALARM_INTERVAL     6
215
 
216
// Mboxt events
217
#define CYG_INSTRUMENT_EVENT_MBOXT_WAIT         1
218
#define CYG_INSTRUMENT_EVENT_MBOXT_GET          2
219
#define CYG_INSTRUMENT_EVENT_MBOXT_GOT          3
220
#define CYG_INSTRUMENT_EVENT_MBOXT_TIMEOUT      4
221
#define CYG_INSTRUMENT_EVENT_MBOXT_WAKE         5
222
#define CYG_INSTRUMENT_EVENT_MBOXT_TRY          6
223
#define CYG_INSTRUMENT_EVENT_MBOXT_PUT          7
224
 
225
// SMP events
226
#define CYG_INSTRUMENT_EVENT_SMP_LOCK_INC       1
227
#define CYG_INSTRUMENT_EVENT_SMP_LOCK_ZERO      2
228
#define CYG_INSTRUMENT_EVENT_SMP_LOCK_SET       3
229
#define CYG_INSTRUMENT_EVENT_SMP_CPU_START      4
230
#define CYG_INSTRUMENT_EVENT_SMP_LOCK_WAIT      5
231
#define CYG_INSTRUMENT_EVENT_SMP_LOCK_GOT       6
232
#define CYG_INSTRUMENT_EVENT_SMP_RESCHED_SEND   8
233
#define CYG_INSTRUMENT_EVENT_SMP_RESCHED_RECV   9
234
 
235
// MLQ scheduler events
236
 
237
#define CYG_INSTRUMENT_EVENT_MLQ_SCHEDULE       1
238
#define CYG_INSTRUMENT_EVENT_MLQ_RESCHEDULE     2
239
#define CYG_INSTRUMENT_EVENT_MLQ_ADD            3
240
#define CYG_INSTRUMENT_EVENT_MLQ_REM            4
241
#define CYG_INSTRUMENT_EVENT_MLQ_TIMESLICE      5
242
#define CYG_INSTRUMENT_EVENT_MLQ_YIELD          6
243
#define CYG_INSTRUMENT_EVENT_MLQ_ENQUEUE        7
244
#define CYG_INSTRUMENT_EVENT_MLQ_DEQUEUE        8
245
#define CYG_INSTRUMENT_EVENT_MLQ_REMOVE         9
246
 
247
 
248
// User events
249
 
250
#define CYG_INSTRUMENT_EVENT_USER_1             1
251
#define CYG_INSTRUMENT_EVENT_USER_2             2
252
#define CYG_INSTRUMENT_EVENT_USER_3             3
253
#define CYG_INSTRUMENT_EVENT_USER_4             4
254
#define CYG_INSTRUMENT_EVENT_USER_5             5
255
#define CYG_INSTRUMENT_EVENT_USER_6             6
256
#define CYG_INSTRUMENT_EVENT_USER_7             7
257
#define CYG_INSTRUMENT_EVENT_USER_8             8
258
#define CYG_INSTRUMENT_EVENT_USER_9             9
259
#define CYG_INSTRUMENT_EVENT_USER_10            10
260
#define CYG_INSTRUMENT_EVENT_USER_11            11
261
#define CYG_INSTRUMENT_EVENT_USER_12            12
262
#define CYG_INSTRUMENT_EVENT_USER_13            13
263
#define CYG_INSTRUMENT_EVENT_USER_14            14
264
#define CYG_INSTRUMENT_EVENT_USER_15            15
265
#define CYG_INSTRUMENT_EVENT_USER_16            16
266
#define CYG_INSTRUMENT_EVENT_USER_17            17
267
#define CYG_INSTRUMENT_EVENT_USER_18            18
268
#define CYG_INSTRUMENT_EVENT_USER_19            19
269
 
270
// -------------------------------------------------------------------------
271
// Handy-dandy macro to make event codes.
272
// Note that this relies on the definitions above
273
// having a well defined form.
274
 
275
#define CYGINST_EVENT(_class_,_event_) \
276
((CYG_INSTRUMENT_CLASS_##_class_)|(CYG_INSTRUMENT_EVENT_##_class_##_##_event_))
277
 
278
// -------------------------------------------------------------------------
279
// Scheduler instrumentation macros
280
 
281
#ifdef CYGDBG_KERNEL_INSTRUMENT_SCHED
282
 
283
#define CYG_INSTRUMENT_SCHED(_event_,_arg1_,_arg2_) \
284
    CYG_INSTRUMENT(CYGINST_EVENT(SCHED,_event_),_arg1_,_arg2_)
285
 
286
#else
287
 
288
#define CYG_INSTRUMENT_SCHED(_event_,_arg1_,_arg2_)
289
 
290
#endif
291
 
292
// -------------------------------------------------------------------------
293
// Thread instrumentation macros
294
 
295
#ifdef CYGDBG_KERNEL_INSTRUMENT_THREAD
296
 
297
#define CYG_INSTRUMENT_THREAD(_event_,_arg1_,_arg2_) \
298
    CYG_INSTRUMENT(CYGINST_EVENT(THREAD,_event_),_arg1_,_arg2_)
299
 
300
#else
301
 
302
#define CYG_INSTRUMENT_THREAD(_event_,_arg1_,_arg2_)
303
 
304
#endif
305
 
306
// -------------------------------------------------------------------------
307
// Interrupt instrumentation macros
308
 
309
#ifdef CYGDBG_KERNEL_INSTRUMENT_INTR
310
 
311
#define CYG_INSTRUMENT_INTR(_event_,_arg1_,_arg2_) \
312
    CYG_INSTRUMENT(CYGINST_EVENT(INTR,_event_),_arg1_,_arg2_)
313
 
314
#else
315
 
316
#define CYG_INSTRUMENT_INTR(_event_,_arg1_,_arg2_)
317
 
318
#endif
319
 
320
// -------------------------------------------------------------------------
321
// Mutex instrumentation macros
322
 
323
#ifdef CYGDBG_KERNEL_INSTRUMENT_MUTEX
324
 
325
#define CYG_INSTRUMENT_MUTEX(_event_,_arg1_,_arg2_) \
326
    CYG_INSTRUMENT(CYGINST_EVENT(MUTEX,_event_),_arg1_,_arg2_)
327
 
328
#else
329
 
330
#define CYG_INSTRUMENT_MUTEX(_event_,_arg1_,_arg2_)
331
 
332
#endif
333
 
334
// -------------------------------------------------------------------------
335
// Condition variable instrumentation macros
336
 
337
#ifdef CYGDBG_KERNEL_INSTRUMENT_CONDVAR
338
 
339
#define CYG_INSTRUMENT_CONDVAR(_event_,_arg1_,_arg2_) \
340
    CYG_INSTRUMENT(CYGINST_EVENT(CONDVAR,_event_),_arg1_,_arg2_)
341
 
342
#else
343
 
344
#define CYG_INSTRUMENT_CONDVAR(_event_,_arg1_,_arg2_)
345
 
346
#endif
347
 
348
// -------------------------------------------------------------------------
349
// Binary semaphore instrumentation macros
350
 
351
#ifdef CYGDBG_KERNEL_INSTRUMENT_BINSEM
352
 
353
#define CYG_INSTRUMENT_BINSEM(_event_,_arg1_,_arg2_) \
354
    CYG_INSTRUMENT(CYGINST_EVENT(BINSEM,_event_),_arg1_,_arg2_)
355
 
356
#else
357
 
358
#define CYG_INSTRUMENT_BINSEM(_event_,_arg1_,_arg2_)
359
 
360
#endif
361
 
362
// -------------------------------------------------------------------------
363
// Counting semaphore instrumentation macros
364
 
365
#ifdef CYGDBG_KERNEL_INSTRUMENT_CNTSEM
366
 
367
#define CYG_INSTRUMENT_CNTSEM(_event_,_arg1_,_arg2_) \
368
    CYG_INSTRUMENT(CYGINST_EVENT(CNTSEM,_event_),_arg1_,_arg2_)
369
 
370
#else
371
 
372
#define CYG_INSTRUMENT_CNTSEM(_event_,_arg1_,_arg2_)
373
 
374
#endif
375
 
376
// -------------------------------------------------------------------------
377
// Clock instrumentation macros
378
 
379
#ifdef CYGDBG_KERNEL_INSTRUMENT_CLOCK
380
 
381
#define CYG_INSTRUMENT_CLOCK(_event_,_arg1_,_arg2_) \
382
    CYG_INSTRUMENT(CYGINST_EVENT(CLOCK,_event_),_arg1_,_arg2_)
383
 
384
#else
385
 
386
#define CYG_INSTRUMENT_CLOCK(_event_,_arg1_,_arg2_)
387
 
388
#endif
389
 
390
// -------------------------------------------------------------------------
391
// Alarm instrumentation macros
392
 
393
#ifdef CYGDBG_KERNEL_INSTRUMENT_ALARM
394
 
395
#define CYG_INSTRUMENT_ALARM(_event_,_arg1_,_arg2_) \
396
    CYG_INSTRUMENT(CYGINST_EVENT(ALARM,_event_),_arg1_,_arg2_)
397
 
398
#else
399
 
400
#define CYG_INSTRUMENT_ALARM(_event_,_arg1_,_arg2_)
401
 
402
#endif
403
 
404
// -------------------------------------------------------------------------
405
// Mboxt instrumentation macros
406
 
407
#ifdef CYGDBG_KERNEL_INSTRUMENT_MBOXT
408
 
409
#define CYG_INSTRUMENT_MBOXT(_event_,_arg1_,_arg2_) \
410
    CYG_INSTRUMENT(CYGINST_EVENT(MBOXT,_event_),_arg1_,_arg2_)
411
 
412
#else
413
 
414
#define CYG_INSTRUMENT_MBOXT(_event_,_arg1_,_arg2_)
415
 
416
#endif
417
 
418
// -------------------------------------------------------------------------
419
// SMP instrumentation
420
 
421
#ifdef CYGDBG_KERNEL_INSTRUMENT_SMP
422
 
423
#define CYG_INSTRUMENT_SMP(_event_,_arg1_,_arg2_) \
424
    CYG_INSTRUMENT(CYGINST_EVENT(SMP,_event_),_arg1_,_arg2_)
425
 
426
#else
427
 
428
#define CYG_INSTRUMENT_SMP(_event_,_arg1_,_arg2_)
429
 
430
#endif
431
 
432
 
433
// -------------------------------------------------------------------------
434
// MLQ instrumentation
435
 
436
#ifdef CYGDBG_KERNEL_INSTRUMENT_MLQ
437
 
438
#define CYG_INSTRUMENT_MLQ(_event_,_arg1_,_arg2_) \
439
    CYG_INSTRUMENT(CYGINST_EVENT(MLQ,_event_),_arg1_,_arg2_)
440
 
441
#else
442
 
443
#define CYG_INSTRUMENT_MLQ(_event_,_arg1_,_arg2_)
444
 
445
#endif
446
 
447
// -------------------------------------------------------------------------
448
// User instrumentation
449
 
450
#ifdef CYGDBG_KERNEL_INSTRUMENT_USER
451
 
452
#define CYG_INSTRUMENT_USER(_event_,_arg1_,_arg2_) \
453
    CYG_INSTRUMENT((CYG_INSTRUMENT_CLASS_USER|(_event_)),_arg1_,_arg2_)
454
 
455
#else
456
 
457
#define CYG_INSTRUMENT_USER(_event_,_arg1_,_arg2_)
458
 
459
#endif
460
 
461
 
462
// -------------------------------------------------------------------------
463
#endif // ifndef CYGONCE_KERNEL_INSTRMNT_HXX
464
// EOF instrmnt.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.