comparison src/gpf3/inc/vsi.h @ 2:c41a534f33c6

src/gpf3: preened GPF goo from TCS3.2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 23:52:50 +0000
parents
children
comparison
equal deleted inserted replaced
1:864b8cc0cf63 2:c41a534f33c6
1 /*
2 +------------------------------------------------------------------------------
3 | File: vsi.h
4 +------------------------------------------------------------------------------
5 | Copyright 2002 Texas Instruments Berlin, AG
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas
9 | Instruments Berlin, AG
10 | The receipt of or possession of this file does not convey
11 | any rights to reproduce or disclose its contents or to
12 | manufacture, use, or sell anything it may describe, in
13 | whole, or in part, without the specific written consent of
14 | Texas Instruments Berlin, AG.
15 +-----------------------------------------------------------------------------
16 | Purpose : Definitions for Virtual System Interface.
17 +-----------------------------------------------------------------------------
18 */
19
20 #ifndef VSI_H
21 #define VSI_H
22
23 /*==== INCLUDES =============================================================*/
24
25 #include <stddef.h>
26 #include "header.h"
27 #include "gdi.h"
28 #include "drvconf.h"
29 #include "prf_func.h"
30
31 /*==== CONSTANTS ===============================================================*/
32
33 #ifdef _TOOLS_
34 #ifdef FRAME_DLL
35 #define DLL_IMPORT_DATA extern
36 #else /* FRAME_DLL*/
37 #define DLL_IMPORT_DATA __declspec( dllimport )
38 #endif /* FRAME_DLL*/
39 #endif /* _TOOLS_ */
40
41 #ifdef MEMORY_SUPERVISION
42 #define FILE_LINE ,file,line
43 #define FILE_LINE_TYPE ,const char *file, int line
44 #define FILE_LINE_MACRO ,__FILE__,__LINE__
45 #define FILE_LINE_MACRO_PASSED ,rm_path(file),line
46 #else
47 #define FILE_LINE
48 #define FILE_LINE_TYPE
49 #define FILE_LINE_MACRO
50 #define FILE_LINE_MACRO_PASSED ,__FILE__,__LINE__
51 #endif
52
53 #define NO_TASK 0
54
55 /*
56 * defines if the frame is controlling a protocol stack or a tools application (TAP,PCO,...)
57 */
58 #define ENV_STACK 0
59 #define ENV_TOOLS 1
60
61 #define PASSIVE_BODY 0x00000001 /* main loop in the frame compared to ACTIVE_BODY with main loop in pei_run() */
62 #define COPY_BY_REF 0x00000002 /* only pointers to message are exchanged between the entities */
63 #define SYSTEM_PROCESS 0x00000004 /* currently used to have a non-blocking tracing behavior for TST and RCV */
64 #define TRC_NO_SUSPEND 0x00000008 /* discard traces, if no memory available or test interface queue full */
65 #define PARTITION_AUTO_FREE 0x00000010 /* automatically free memory after primitive processing */
66 #define PRIM_NO_SUSPEND 0x00000020 /* drop duplicated prim, if no memory available or test interface queue full */
67 #define INT_DATA_TASK 0x00000040 /* allocate task stack and queue memory from internal memory */
68 #define ADD_QUEUE_SIZES 0x00000080 /* add queue size for grouped entities (default is to take biggest value) */
69 #define USE_LEMU_QUEUE 0x00000100 /* use registered "os_sendtoqueue" function instead of standard function */
70
71 /*
72 * return values
73 */
74 #define VSI_OK 0
75 #define VSI_TIMEOUT 1
76 #define VSI_ERROR (-1)
77
78 /*
79 * message types
80 */
81 #define MSG_PRIMITIVE 1
82 #define MSG_SIGNAL 2
83 #define MSG_TIMEOUT 3
84
85 /*
86 * definitions for dynamic primitive allocation
87 */
88 #define DP_FRAME_GUESS 0xffffffff
89 #define DP_NO_FRAME_GUESS 0
90
91
92 #ifndef NTRACE
93 #ifndef NTRACE_FUNC
94 #define TRACE_FUNC
95 #endif
96 #define TRACE_EVE
97 #define TRACE_ERR
98 #define TRACE_PRIM
99 #ifndef NTRACE_GET_STATE
100 #define TRACE_GET_STATE
101 #endif
102 #ifndef NTRACE_SET_STATE
103 #define TRACE_SET_STATE
104 #endif
105 #define TRACE_IS /* entity internal signals */
106 #define TRACE_BIN
107 #define TRACE_PRF
108 #endif
109
110 /*
111 * trace bit masks
112 */
113 #define TC_FUNC 0x00000001
114 #define TC_EVENT 0x00000002
115 #define TC_PRIM 0x00000004
116 #define TC_STATE 0x00000008
117 #define TC_SYSTEM 0x00000010
118 #define TC_ISIG 0x00000020
119 #define TC_ERROR 0x00000040
120 #define TC_CCD 0x00000080
121 #define TC_TIMER 0x00000100
122 #define TC_DATA 0x00000200
123 #define TC_SDU 0x00000400
124 #define TC_PROFILER 0x00000800
125 #define TC_ALERT_HINT 0x00001000
126 #define TC_ALERT_WARNING 0x00002000
127 #define TC_ALERT_ERROR TC_ERROR
128 #define TC_ALERT_FATAL 0x00004000
129
130 #define TC_USER1 0x00010000
131 #define TC_USER2 0x00020000
132 #define TC_USER3 0x00040000
133 #define TC_USER4 0x00080000
134 #define TC_USER5 0x00100000
135 #define TC_USER6 0x00200000
136 #define TC_USER7 0x00400000
137 #define TC_USER8 0x00800000
138
139 /*
140 * TC_ENABLE is use for sending primitives from target to tools.
141 * In case these do not need to be dependent on trace filter
142 * settings, TC_ENABLE must be passed to vsi_o_primsend resp. the
143 * macros calling vsi_o_primsend.
144 */
145 #define TC_ENABLE 0xffffffff
146
147 /*
148 * trace opc's
149 */
150 #define TRACE_OPC 0x00000000
151
152 #define BIN_TRACE_OPC 0xC7654321
153
154 #define IP_TRACE_OPC 0xC0000800
155 #define HEX_TRACE_OPC 0xC0010800
156 #define SDU_TRACE_OPC 0xC0020800
157
158 #define TRACE_SAP 0x00000801
159
160 #define FUNC_TRACE_OPC 0xC0010801
161 #define EVENT_TRACE_OPC 0xC0020801
162 #define PRIM_TRACE_OPC 0xC0030801
163 #define STATE_TRACE_OPC 0xC0040801
164 #define SYSTEM_TRACE_OPC 0xC0050801
165 #define ISIG_TRACE_OPC 0xC0060801
166 #define ERROR_TRACE_OPC 0xC0070801
167 #define CCD_TRACE_OPC 0xC0080801
168 #define TIMER_TRACE_OPC 0xC0090801
169 #define PROFILER_TRACE_OPC 0xC00A0801
170
171 #define USER1_TRACE_OPC 0xC00F0801
172 #define USER2_TRACE_OPC 0xC0100801
173 #define USER3_TRACE_OPC 0xC0110801
174 #define USER4_TRACE_OPC 0xC0120801
175 #define USER5_TRACE_OPC 0xC0130801
176 #define USER6_TRACE_OPC 0xC0140801
177 #define USER7_TRACE_OPC 0xC0150801
178 #define USER8_TRACE_OPC 0xC0160801
179
180 /* system primitive mask */
181 #define SYS_MASK 0x8000
182
183 /* declare trace queue names */
184 #ifdef _TOOLS_
185 #ifdef FRAME_DLL
186 extern UBYTE SuppressOK;
187 extern char FRM_SYST_NAME[RESOURCE_NAMELEN];
188 extern char FRM_TST_NAME[RESOURCE_NAMELEN];
189 extern char FRM_RCV_NAME[RESOURCE_NAMELEN];
190 extern char FRM_PCO_NAME[RESOURCE_NAMELEN];
191 #else /* FRAME_DLL */
192 __declspec (dllimport) char FRM_SYST_NAME[RESOURCE_NAMELEN];
193 __declspec (dllimport) char FRM_TST_NAME[RESOURCE_NAMELEN];
194 __declspec (dllimport) char FRM_RCV_NAME[RESOURCE_NAMELEN];
195 __declspec (dllimport) char FRM_PCO_NAME[RESOURCE_NAMELEN];
196 #endif /* FRAME_DLL */
197 #else /* _TOOLS_ */
198 extern char FRM_SYST_NAME[];
199 extern char FRM_TST_NAME[];
200 extern char FRM_RCV_NAME[];
201 extern char FRM_PCO_NAME[];
202 #endif /* _TOOLS_ */
203
204 /*
205 * masks for different kind of info passed to the type parameter at memory allocation
206 */
207 #define VSI_MEM_POOL_MASK 0x000000ff
208 #define VSI_MEM_FLAG_MASK 0x0000ff00
209 #define VSI_MEM_DESC_MASK 0x00ff0000
210
211 /*
212 * types of partition pools to allocate from
213 */
214 #define PRIM_POOL_PARTITION PrimGroupHandle
215 #define DMEM_POOL_PARTITION DmemGroupHandle
216
217 /*
218 * flags to determine allocation behavior
219 */
220 #define VSI_MEM_NON_BLOCKING 0x00000100
221
222 /*
223 * descriptor types for allocation
224 */
225 #define VSI_DESC_TYPE0 0x00000000
226 #define VSI_DESC_TYPE1 0x00010000
227 #define VSI_DESC_TYPE2 0x00020000
228 #define VSI_DESC_TYPE3 0x00030000
229
230 /*
231 * definitions for dynamic timer configuration
232 */
233 #define TIMER_SET 1
234 #define TIMER_RESET 2
235 #define TIMER_SPEED_UP 3
236 #define TIMER_SLOW_DOWN 4
237 #define TIMER_SUPPRESS 5
238 #define TIMER_CLEAN 6
239
240 /*
241 * maximum length for a text trace
242 */
243 #define TTRACE_LEN 100
244
245 /*
246 * values do be passed to vsi_m_init() to define if the allocated
247 * partitions shall be initialized with a predefined value.
248 */
249 #define DISABLE_PARTITON_INIT 0
250 #define ENABLE_PARTITON_INIT 1
251
252 #define TIME_MODE_MASK 0xc0000000
253 #define TIME_IS_TDMA 0x80000000
254
255 #define CHECK_TRC_SUSPEND 1
256 #define CHECK_PRIM_SUSPEND 2
257
258 /*==== TYPES ================================================================*/
259
260 typedef ULONG T_TIME;
261 typedef int T_HANDLE;
262
263 #include "pei.h"
264 #include "alert.h"
265
266 union T_MSG
267 {
268 struct T_Prim
269 {
270 T_VOID_STRUCT *Prim;
271 ULONG PrimLen;
272 } Primitive;
273 struct Sig
274 {
275 ULONG SigOPC;
276 T_VOID_STRUCT *SigBuffer;
277 ULONG SigLen;
278 } Signal;
279 struct Tim
280 {
281 ULONG Index;
282 } Timer;
283 };
284
285 typedef struct
286 {
287 USHORT MsgType;
288 union T_MSG Msg;
289 } T_QMSG;
290
291 typedef struct
292 {
293 char const *Str;
294 USHORT Ind;
295 } T_STR_IND;
296
297 #include <stdarg.h>
298
299 typedef struct
300 {
301 void (*trace_error)(const char * const format, va_list varpars);
302 void (*trace_assert)(const char * const format, va_list varpars);
303 } T_EXT_TRACE_FUNC;
304
305 /*==== EXTERNALS ===============================================================*/
306
307 extern T_HANDLE PrimGroupHandle;
308 extern T_HANDLE DmemGroupHandle;
309 #ifdef FF_FAST_MEMORY
310 extern T_HANDLE FastGroupHandle;
311 #endif
312
313 /*==== PROTOTYPES ===============================================================*/
314 //TISH modified for MSIM
315 #ifndef FRAME_DLL
316
317 T_HANDLE vsi_p_create (T_HANDLE Caller,
318 SHORT (*pei_create)(T_PEI_INFO const ** info),
319 void (*TaskEntry)(T_HANDLE, ULONG),
320 T_HANDLE MemPoolHandle );
321 int vsi_p_exit (T_HANDLE Caller, T_HANDLE TaskHandle);
322 int vsi_p_delete (T_HANDLE Caller, T_HANDLE TaskHandle);
323 int vsi_p_start (T_HANDLE Caller, T_HANDLE TaskHandle);
324 int vsi_p_stop (T_HANDLE Caller, T_HANDLE TaskHandle);
325 int vsi_p_name (T_HANDLE Caller, T_HANDLE Handle, char *Name);
326 T_HANDLE vsi_p_handle (T_HANDLE Caller, char *Name);
327 void vsi_o_set_htrace (T_HANDLE comhandle);
328
329 T_VOID_STRUCT * vsi_m_new (ULONG Size, ULONG type FILE_LINE_TYPE);
330 T_VOID_STRUCT * vsi_m_new_size (ULONG size, ULONG type,
331 ULONG *partition_size FILE_LINE_TYPE);
332 int vsi_m_free (T_VOID_STRUCT **Addr FILE_LINE_TYPE);
333 int vsi_m_status (T_HANDLE caller, ULONG size, USHORT type, USHORT *free, USHORT *alloc);
334 int vsi_m_init (char enable_init, char pattern);
335 T_VOID_STRUCT * vsi_m_cnew (ULONG size, ULONG type FILE_LINE_TYPE);
336 int vsi_m_cfree (T_VOID_STRUCT **ptr FILE_LINE_TYPE);
337 int vsi_m_attach (T_VOID_STRUCT *ptr FILE_LINE_TYPE);
338 int vsi_m_register_pool(char * name, T_HANDLE *pool_gr_id);
339
340
341 char * vsi_c_init_com_matrix (int max_entities);
342 int vsi_c_get_com_matrix_entry (int entry, char *dst);
343 int vsi_c_get_entity_com_entry (int entry, T_HANDLE rcv, T_HANDLE *snd);
344 T_HANDLE vsi_c_open (T_HANDLE Caller, char *Name);
345 int vsi_c_close (T_HANDLE Caller, T_HANDLE ComHandle);
346 int vsi_c_clear (T_HANDLE Caller, T_HANDLE ComHandle);
347 T_VOID_STRUCT * vsi_c_pnew_generic(T_HANDLE Caller, ULONG Size, ULONG opc, ULONG flags FILE_LINE_TYPE);
348 T_VOID_STRUCT * vsi_c_pnew (ULONG Size, ULONG opc FILE_LINE_TYPE);
349 T_VOID_STRUCT * vsi_c_pnew_nb (ULONG Size, ULONG opc FILE_LINE_TYPE);
350 T_VOID_STRUCT * vsi_c_new_sdu (ULONG Size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset FILE_LINE_TYPE);
351 T_VOID_STRUCT * vsi_c_new_sdu_generic(ULONG Size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset, ULONG flags FILE_LINE_TYPE);
352 T_VOID_STRUCT * vsi_c_ppass (T_VOID_STRUCT *prim, ULONG opc FILE_LINE_TYPE);
353 void vsi_c_pstore (T_VOID_STRUCT *prim FILE_LINE_TYPE);
354 int vsi_c_pattach (T_VOID_STRUCT *prim FILE_LINE_TYPE);
355 int vsi_c_pfree (T_VOID_STRUCT **Msg FILE_LINE_TYPE);
356 int vsi_c_ssend (T_HANDLE ComHandle, ULONG opc,
357 T_VOID_STRUCT *ptr, ULONG MsgLen FILE_LINE_TYPE);
358 int vsi_c_psend (T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE);
359 int vsi_c_psend_caller(T_HANDLE caller, T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE);
360 T_VOID_STRUCT * vsi_c_reuse (T_PRIM_HEADER *ptr, ULONG Size,
361 ULONG opc, USHORT sdu_len, USHORT sdu_offset,
362 USHORT encode_offset FILE_LINE_TYPE);
363 T_VOID_STRUCT * vsi_c_new (T_HANDLE Caller, ULONG Size, ULONG opc FILE_LINE_TYPE);
364 int vsi_c_send (T_HANDLE Caller, T_HANDLE ComHandle,
365 T_QMSG *Msg FILE_LINE_TYPE);
366 int vsi_c_free (T_HANDLE Caller, T_VOID_STRUCT **Msg FILE_LINE_TYPE);
367 int vsi_c_pmax_size (void);
368 int vsi_c_sync (T_HANDLE Caller, T_TIME timeout);
369 int vsi_c_alloc_send (T_HANDLE com_handle, char* rcv, char* snd, void *prim, char* string);
370 T_VOID_STRUCT * vsi_drpo_new (ULONG size, ULONG opc, ULONG guess FILE_LINE_TYPE);
371 T_VOID_STRUCT * vsi_drpo_new_sdu (ULONG size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset, ULONG guess FILE_LINE_TYPE );
372 T_VOID_STRUCT * vsi_drp_new (ULONG size, ULONG guess FILE_LINE_TYPE);
373 T_VOID_STRUCT * vsi_dp_new (ULONG size, T_VOID_STRUCT *addr, ULONG guess FILE_LINE_TYPE);
374 int vsi_drp_bind (T_VOID_STRUCT *child, T_VOID_STRUCT *parent FILE_LINE_TYPE);
375 int vsi_free (T_VOID_STRUCT **Msg FILE_LINE_TYPE);
376 int vsi_dp_sum (T_VOID_STRUCT *addr, ULONG *size);
377 int vsi_dp_max_size (void);
378 int vsi_c_await (T_HANDLE Caller, T_HANDLE ComHandle, T_QMSG *Msg,
379 ULONG Timeout);
380 int vsi_c_primitive (T_HANDLE Caller, void *Prim);
381 int vsi_c_awake (T_HANDLE caller );
382 int vsi_c_status (T_HANDLE q_handle, unsigned int *used, unsigned int *free);
383
384 int vsi_t_start (T_HANDLE Caller, USHORT Index, T_TIME Value);
385 int vsi_t_pstart (T_HANDLE Caller, USHORT Index, T_TIME Value1, T_TIME Value2 );
386 int vsi_t_stop (T_HANDLE Caller, USHORT Index );
387 int vsi_t_status (T_HANDLE Caller, USHORT Index, T_TIME *Value );
388 int vsi_t_config (T_HANDLE Caller, USHORT Index, UBYTE Mode, ULONG Value );
389 int _vsi_t_config (T_HANDLE Caller, char *CfgString, const T_STR_IND *pTable );
390
391 T_HANDLE vsi_s_open (T_HANDLE Caller, char *Name, USHORT Count);
392 int vsi_s_close (T_HANDLE Caller, T_HANDLE SemHandle);
393 int vsi_s_get (T_HANDLE Caller, T_HANDLE SemHandle);
394 int vsi_s_release (T_HANDLE Caller, T_HANDLE SemHandle);
395 int vsi_s_status (T_HANDLE Caller, T_HANDLE SemHandle, USHORT *Count);
396
397 /* *** ATTENTION START: A modification of the prototypes below requires a modification of STR2IND *** */
398 int vsi_o_func_ttrace (const char * const format, ... );
399 int vsi_o_event_ttrace(const char * const format, ... );
400 int vsi_o_error_ttrace(const char * const format, ... );
401 int vsi_o_state_ttrace(const char * const format, ... );
402 int vsi_o_class_ttrace(ULONG TraceClass, const char * const format, ... );
403 int vsi_o_func_itrace (ULONG index, const char * const format, ... );
404 int vsi_o_event_itrace(ULONG index, const char * const format, ... );
405 int vsi_o_error_itrace(ULONG index, const char * const format, ... );
406 int vsi_o_state_itrace(ULONG index, const char * const format, ... );
407 int vsi_o_class_itrace(ULONG TraceClass, ULONG index, const char * const format, ... );
408 /* *** ATTENTION END: A modification of the prototypes above requires a modification of STR2IND *** */
409
410 int vsi_o_ttrace (T_HANDLE Caller, ULONG TraceClass, const char * const format, ... );
411 int vsi_o_itrace (T_HANDLE Caller, ULONG TraceClass, ULONG index, const char * const format, ... );
412 int vsi_o_ptrace (T_HANDLE Caller, ULONG opc, UBYTE dir );
413 int vsi_o_strace (T_HANDLE Caller, const char *const machine,
414 const char *const curstate,
415 const char *const newstate);
416 void vsi_ext_trace_register (T_EXT_TRACE_FUNC * func);
417 int vsi_o_memtrace (T_HANDLE Caller, void *ptr, unsigned int len);
418 int vsi_o_primsend (T_HANDLE Caller, unsigned int mask, T_HANDLE dst, char *ext_dst, unsigned int opc, void *ptr, unsigned int len FILE_LINE_TYPE);
419 int vsi_o_sdusend (T_HANDLE caller, T_HANDLE dst, char *ext_dst, int opc, char ent, char dir, char type, void *ptr, unsigned int len FILE_LINE_TYPE);
420 int vsi_o_assert (T_HANDLE Caller, USHORT cause, const char *file, int line, const char * const format, ...);
421 int vsi_settracemask (T_HANDLE Caller, T_HANDLE Handle, ULONG Mask );
422 int vsi_gettracemask (T_HANDLE Caller, T_HANDLE Handle, ULONG *Mask );
423 int vsi_trcsuspend (T_HANDLE Caller, T_HANDLE Handle, ULONG Suspend );
424 int vsi_trc_free (T_HANDLE Caller, T_VOID_STRUCT **Msg);
425 ULONG get_suspend_state (T_HANDLE caller, int type);
426
427
428 void vsi_ppm_new (T_HANDLE Caller, ULONG Size, T_PRIM_HEADER *prim, const char* file, int line );
429 void vsi_ppm_rec (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line );
430 void vsi_ppm_access (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line );
431 void vsi_ppm_store (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line );
432 void vsi_ppm_send (T_HANDLE Caller, T_HANDLE rcv, T_PRIM_HEADER *prim, const char* file, int line );
433 void vsi_ppm_reuse (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line );
434 void vsi_ppm_free (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line );
435 void vsi_ppm_setend (T_PRIM_HEADER *Prim, ULONG Size );
436
437 int vsi_gettaskname (T_HANDLE Caller, T_HANDLE Handle, char *Name);
438 T_HANDLE vsi_gettaskhandle (T_HANDLE Caller, char *Name);
439 int vsi_e_name (T_HANDLE Caller, T_HANDLE Handle, char *Name);
440 T_HANDLE vsi_e_handle (T_HANDLE Caller, char *Name);
441 int vsi_gettaskflags (T_HANDLE Caller, T_HANDLE Handle, U32 *Flags);
442 int vsi_t_time (T_HANDLE Caller, T_TIME *Value);
443 int vsi_t_sleep (T_HANDLE Caller, T_TIME Value);
444 int vsi_object_info (T_HANDLE caller, USHORT Id, USHORT Index, char *Buffer, USHORT Size);
445
446 void vsi_d_callback (T_DRV_SIGNAL *Signal );
447 int vsi_d_create (T_HANDLE Caller, T_TST_DRV_ENTRY *drv_info );
448 int vsi_d_init (T_HANDLE Caller );
449 int vsi_d_exit (T_HANDLE Caller, T_HANDLE DrvHandle );
450 int vsi_d_open (T_HANDLE Caller, char *Name );
451 int vsi_d_close (T_HANDLE Caller, T_HANDLE DrvHandle );
452 int vsi_d_read (T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG *Size );
453 int vsi_d_write (T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG Size );
454 int vsi_d_flush (T_HANDLE Caller, T_HANDLE DrvHandle );
455 int vsi_d_setsignal (T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType );
456 int vsi_d_resetsignal (T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType );
457 int vsi_d_setconfig (T_HANDLE Caller, T_HANDLE DrvHandle, char *Config );
458 int vsi_d_getconfig (T_HANDLE Caller, T_HANDLE DrvHandle, char *Config );
459
460 void vsi_pcheck_init (void);
461 void vsi_pcheck_register(ULONG (*func)(ULONG, void*), ULONG ret_ok);
462 //TISH modified for MSIM
463 #endif //#ifdef FRAME_DLL
464
465 /*==== MACROS ================================================================*/
466
467 #define ConfigTimer _vsi_t_config
468
469 #ifdef MEMORY_SUPERVISION
470 #define VSI_PPM_REC(B,F,L)
471 #define VSI_PPM_RCV(B) vsi_ppm_rec (VSI_CALLER ((T_PRIM_HEADER*)(B)),__FILE__, __LINE__);
472 #define VSI_PPM_NEW(B,S) vsi_ppm_new (VSI_CALLER S,((T_PRIM_HEADER*)(B)),__FILE__, __LINE__);
473 #define VSI_PPM_FREE(B) vsi_ppm_free (VSI_CALLER ((T_PRIM_HEADER*)(B)),__FILE__, __LINE__);
474 #define VSI_PPM_REUSE(B) vsi_ppm_reuse (VSI_CALLER (T_PRIM_HEADER*)B,__FILE__,__LINE__);
475 #define VSI_PPM_ACCESS(B) vsi_ppm_access (VSI_CALLER (T_PRIM_HEADER*)B,__FILE__,__LINE__);
476 #define VSI_PPM_SEND(B,D) vsi_ppm_send (VSI_CALLER D,(T_PRIM_HEADER*)B,__FILE__,__LINE__);
477 #else
478 #define VSI_PPM_REC(B,F,L)
479 #define VSI_PPM_RCV(B)
480 #define VSI_PPM_NEW(B)
481 #define VSI_PPM_FREE(B)
482 #define VSI_PPM_REUSE(B)
483 #define VSI_PPM_ACCESS(B)
484 #define VSI_PPM_SEND(B,D)
485 #endif /* MEMORY_SUPERVISION */
486
487 #define ALIGN(S) (((S)+3)&~0x03)
488 #define ALIGN_SIZE(S) (((S)+sizeof(int)-1)&~(sizeof(int)-1))
489 #define S_ALLOC_SIZE(S) (ALIGN((S)+sizeof(T_PRIM_HEADER)+sizeof(T_S_HEADER)))
490 #define S_HDR_OFFSET(S) (ALIGN(S)>>2)
491 #define D_ALLOC_SIZE(S) (ALIGN((S)+sizeof(T_PRIM_HEADER)+sizeof(T_DP_HEADER)))
492 #define D_HDR_OFFSET(S) (ALIGN((S)-sizeof(T_DP_HEADER))>>2)
493
494 #define P2D(P) ((T_PRIM_HEADER*)(P)+1)
495 #define D2P(D) ((T_PRIM_HEADER*)(D)-1)
496
497 #define P2D_AC(P,T) P2D(P)
498
499 #define P_OPC(P) (((T_PRIM_HEADER*)(P))->opc)
500 #define P_OPC2(P) (((T_PRIM_HEADER*)(P))->opc2)
501 #define P_LEN(P) (((T_PRIM_HEADER*)(P))->len)
502 #define P_TID(P) (((T_PRIM_HEADER*)(P))->tid)
503 #define P_SDU(P) (((T_PRIM_HEADER*)(P))->sdu)
504 #define P_CNT(P) (((T_PRIM_HEADER*)(P))->use_cnt)
505 #define P_IDX(P) (*(ULONG*)(P))
506 #define P_PPM_IDX(P) (*((ULONG*)(P)-PPM_OFFSET))
507 #define P_PNR(P) (*((ULONG*)(P)-PPM_OFFSET) & 0xffff)
508 #define P_PGR(P) ((*((ULONG*)(P)-PPM_OFFSET) >> 16) & 0xffff)
509 #define P_SHDR(P) ((T_S_HEADER*)((ULONG*)(P)+((T_PRIM_HEADER*)(P))->sh_offset))
510 #define P_RCV(P) (((T_S_HEADER*)P_SHDR(P))->rcv)
511 #define P_SND(P) (((T_S_HEADER*)P_SHDR(P))->snd)
512 #define P_TIME(P) (((T_S_HEADER*)P_SHDR(P))->time)
513 #define P_SHO(P) (((T_PRIM_HEADER*)(P))->sh_offset)
514 #define P_DPHO(P) (((T_PRIM_HEADER*)(P))->dph_offset)
515 #define P_MEMHANDLE(P) (*(U32*)P2D(P))
516 #define P_MEMHANDLE_SDU(P) (*(((U32*)P2D(P))+1))
517
518 #define D_OPC(D) P_OPC(D2P(D))
519 #define D_OPC2(D) P_OPC2(D2P(D))
520 #define D_LEN(D) P_LEN(D2P(D))
521 #define D_CNT(D) P_CNT(D2P(D))
522 #define D_TID(D) P_TID(D2P(D))
523 #define D_SDU(D) P_SDU(D2P(D))
524
525 #define D_SDU_LEN(D) (D_SDU(D)->l_buf)
526 #define D_SDU_OFF(D) (D_SDU(D)->o_buf)
527
528 #define BITS_PER_BYTE 8
529 #define BYTELEN(BITLEN) ((BITLEN)<=0?0:((((BITLEN)-1)/BITS_PER_BYTE)+1))
530 #define BYTELEN_POS(BITLEN) (((BITLEN)+7)/BITS_PER_BYTE)
531
532 #define SDU_TRAIL ((char*)(((T_sdu*)0)+1)-(char*)(((T_sdu*)0)->buf))
533 #define PSIZE(D) D_LEN(D)
534
535 #define SIZ(T) ((ULONG)(sizeof(T_PRIM_HEADER)+sizeof(T)))
536 #define SIZ_SDU(T,M) ((ULONG)(SIZ(T)+BYTELEN((M)+ENCODE_OFFSET)-SDU_TRAIL))
537 /* NOTE : received SDUs may have a different ENCODE_OFFSET */
538
539 #ifndef ADD_BSIZE
540 #define ADD_BSIZE 0
541 #endif
542
543 #define NO_SDU 0xffff
544
545 /*lint -e773 Info 773: Expression-like macro '...' not parenthesized
546 this message has to be disabled to avoid LINT complaining about missing parentesis in the macros
547 that create a pointer and initialize it. Here we cannot set paranthesis because in this case the
548 existing entity code will not compile without ';'. To disable this message is safe for these macros */
549
550 #define DRPO_ALLOC(T,G) (T_##T*)vsi_drpo_new(sizeof(T_##T),T,G FILE_LINE_MACRO)
551 #define DRPO_ALLOC_SDU(T,N,G) (T_##T*)vsi_drpo_new_sdu(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET,G FILE_LINE_MACRO)
552 #define DRP_ALLOC(S,G) (T_VOID_STRUCT*)vsi_drp_new(S,G FILE_LINE_MACRO)
553 #define DRP_BIND(C,P) vsi_drp_bind((T_VOID_STRUCT*)C,(T_VOID_STRUCT*)P FILE_LINE_MACRO)
554 #define DP_ALLOC(S,P,G) (T_VOID_STRUCT*)vsi_dp_new(S,(T_VOID_STRUCT*)P,G FILE_LINE_MACRO)
555 #define FREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\
556 vsi_free((T_VOID_STRUCT **)&z FILE_LINE_MACRO);}
557 #define MALLOC(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO)
558 #define M_ALLOC(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO)
559
560 #ifdef FF_FAST_MEMORY
561 #define FMALLOC(P,S) P = (void*)vsi_m_cnew(S,(FastGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO)
562 #define FM_ALLOC(S) (void*)vsi_m_cnew(S,(FastGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO)
563 #else
564 #define FMALLOC(P,S) MALLOC(P,S)
565 #define FM_ALLOC(S) M_ALLOC(S)
566 #endif
567
568 #define MALLOC_GENERIC(P,S,G,F) P = (void*)vsi_m_cnew(S,(G|(F)) FILE_LINE_MACRO)
569 #define M_ALLOC_GENERIC(S,G,F) (void*)vsi_m_cnew(S,(G|(F)) FILE_LINE_MACRO)
570
571 #define MALLOC_DESC1(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1) FILE_LINE_MACRO)
572 #define M_ALLOC_DESC1(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1) FILE_LINE_MACRO)
573
574 #define MALLOC_DESC2(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2) FILE_LINE_MACRO)
575 #define M_ALLOC_DESC2(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2) FILE_LINE_MACRO)
576
577 #define MALLOC_DESC3(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3) FILE_LINE_MACRO)
578 #define M_ALLOC_DESC3(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3) FILE_LINE_MACRO)
579
580 #define MALLOC_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
581 #define M_ALLOC_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
582
583 #define MALLOC_DESC1_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
584 #define M_ALLOC_DESC1_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
585
586 #define MALLOC_DESC2_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
587 #define M_ALLOC_DESC2_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
588
589 #define MALLOC_DESC3_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
590 #define M_ALLOC_DESC3_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO)
591
592 #define MATTACH(M) vsi_m_attach((T_VOID_STRUCT*)M FILE_LINE_MACRO)
593 #define M_ATTACH(M) vsi_m_attach((T_VOID_STRUCT*)M FILE_LINE_MACRO)
594
595 #define DMALLOC(P,S) P = (void*)vsi_m_new(S,DmemGroupHandle FILE_LINE_MACRO)
596 #define D_ALLOC(S) (void*)vsi_m_new(S,DmemGroupHandle FILE_LINE_MACRO)
597
598 #define DMALLOC_NB(P,S) P = (void*)vsi_m_new(S,DmemGroupHandle|VSI_MEM_NON_BLOCKING FILE_LINE_MACRO)
599 #define D_ALLOC_NB(S) (void*)vsi_m_new(S,DmemGroupHandle|VSI_MEM_NON_BLOCKING FILE_LINE_MACRO)
600
601 #define PALLOC_GENERIC(D,T,G,F) T_##T *D = (T_##T*)vsi_c_pnew_generic(0,sizeof(T_##T),T,(G|(F)) FILE_LINE_MACRO)
602 #define P_ALLOC_GENERIC(T,G,F) (T_##T*)vsi_c_pnew_generic(0,sizeof(T_##T),T,(G|(F)) FILE_LINE_MACRO )
603
604 #define PALLOC(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO)
605 #define P_ALLOC(T) (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO )
606
607 #define PALLOC_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO)
608 #define P_ALLOC_NB(T) (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO )
609
610 #define PALLOC_MSG(D,T,M) T_##T *D = (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
611 #define P_ALLOC_MSG(T,M) (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
612
613 #define PALLOC_SDU(D,T,N) T_##T *D = (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
614 #define P_ALLOC_SDU(T,N) (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
615
616 #ifdef FF_FAST_MEMORY
617 #define FPALLOC_SDU(D,T,N) T_##T *D = (T_##T*)vsi_c_new_sdu_generic(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET,FastGroupHandle FILE_LINE_MACRO)
618 #define FP_ALLOC_SDU(T,N) (T_##T*)vsi_c_new_sdu_generic(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET,FastGroupHandle FILE_LINE_MACRO)
619 #else
620 #define FPALLOC_SDU(D,T,N) PALLOC_SDU(D,T,N)
621 #define FP_ALLOC_SDU(T,N) P_ALLOC_SDU(T,N)
622 #endif
623
624 #define PALLOC_DESC(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\
625 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list)+sizeof(T_PRIM_HEADER))>>2));
626
627 #define PALLOC_DESC2(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\
628 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list2)+sizeof(T_PRIM_HEADER))>>2));
629
630 #define PALLOC_DESC3(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\
631 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list3)+sizeof(T_PRIM_HEADER))>>2));
632
633 #define PALLOC_DESC_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\
634 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list)+sizeof(T_PRIM_HEADER))>>2));
635
636 #define PALLOC_DESC2_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\
637 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list2)+sizeof(T_PRIM_HEADER))>>2));
638
639 #define PALLOC_DESC3_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\
640 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list3)+sizeof(T_PRIM_HEADER))>>2));
641
642 #define PATTACH(D) vsi_c_pattach((T_VOID_STRUCT*)D FILE_LINE_MACRO)
643 #define P_ATTACH(D) vsi_c_pattach((T_VOID_STRUCT*)D FILE_LINE_MACRO)
644
645 #define PREUSE(D0,D,T) T_##T *D = (T_##T*)vsi_c_reuse((T_PRIM_HEADER*)D0,SIZ(T_##T),T,0,NO_SDU,0 FILE_LINE_MACRO)
646 #define P_REUSE(D0,T) (T_##T*)vsi_c_reuse((T_PRIM_HEADER*)D0,SIZ(T_##T),T,0,NO_SDU,0 FILE_LINE_MACRO)
647
648 #define PREUSE_MSG(D,T,M) T_##T *D = (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
649 #define P_REUSE_MSG(T,M) (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
650
651 #define PREUSE_SDU(D,T,N) T_##T *D = (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
652 #define P_REUSE_SDU(T,N) (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO)
653
654 #define PSEND(E,D) vsi_c_psend ( E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO )
655 #define P_SEND(E,D) vsi_c_psend ( E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO )
656
657 #define PSEND_CALLER(C,E,D) vsi_c_psend_caller ( C, E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO )
658 #define P_SEND_CALLER(C,E,D) vsi_c_psend_caller ( C, E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO )
659
660 #define PSIGNAL(E,O,D) vsi_c_ssend ( E ,O,(T_VOID_STRUCT*)D,SIZ(T_##O) FILE_LINE_MACRO )
661 #define P_SIGNAL(E,O,D) vsi_c_ssend ( E ,O,(T_VOID_STRUCT*)D,SIZ(T_##O) FILE_LINE_MACRO )
662
663 #define PRIM_SEND_TO_PC(S,R,P) vsi_o_primsend(S,TC_ENABLE,0,R,0,P,0 FILE_LINE_MACRO)
664 #define DATA_SEND_TO_PC(S,F,R,O,P,L) vsi_o_primsend(S,F,0,R,O,P,L FILE_LINE_MACRO)
665
666 #define PFREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\
667 vsi_c_pfree((T_VOID_STRUCT **)&z FILE_LINE_MACRO);}
668 #define P_FREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\
669 vsi_c_pfree((T_VOID_STRUCT **)&z FILE_LINE_MACRO);}
670
671 #define PPASS(D0,D,T) T_##T *D = (T_##T*)vsi_c_ppass ( (T_VOID_STRUCT*)D0, T FILE_LINE_MACRO )
672 #define P_PASS(D0,D,T) T_##T *D = (T_##T*)vsi_c_ppass ( (T_VOID_STRUCT*)D0, T FILE_LINE_MACRO )
673
674 #define PACCESS(D) VSI_PPM_ACCESS(D2P(D))
675 #define P_ACCESS(D) VSI_PPM_ACCESS(D2P(D))
676
677 #define PSTORE(D) vsi_c_pstore ((T_VOID_STRUCT*)D FILE_LINE_MACRO)
678 #define P_STORE(D) vsi_c_pstore ((T_VOID_STRUCT*)D FILE_LINE_MACRO)
679
680 #define MFREE(P) vsi_m_cfree((T_VOID_STRUCT **)&P FILE_LINE_MACRO)
681 #define M_FREE(P) vsi_m_cfree((T_VOID_STRUCT **)&P FILE_LINE_MACRO)
682
683 #define D_FREE(P) vsi_m_free((T_VOID_STRUCT **)&P FILE_LINE_MACRO)
684
685 /*lint +e773 */
686
687 #ifdef TRACE_FUNC
688 #define TRACE_FUNCTION(a) vsi_o_func_ttrace(a)
689 #define TRACE_FUNCTION_P1(f,a1) vsi_o_func_ttrace(f,a1)
690 #define TRACE_FUNCTION_P2(f,a1,a2) vsi_o_func_ttrace(f,a1,a2)
691 #define TRACE_FUNCTION_P3(f,a1,a2,a3) vsi_o_func_ttrace(f,a1,a2,a3)
692 #define TRACE_FUNCTION_P4(f,a1,a2,a3,a4) vsi_o_func_ttrace(f,a1,a2,a3,a4)
693 #define TRACE_FUNCTION_P5(f,a1,a2,a3,a4,a5) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5)
694 #define TRACE_FUNCTION_P6(f,a1,a2,a3,a4,a5,a6) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6)
695 #define TRACE_FUNCTION_P7(f,a1,a2,a3,a4,a5,a6,a7) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6,a7)
696 #define TRACE_FUNCTION_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8)
697 #define TRACE_FUNCTION_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
698 #else
699 #define TRACE_FUNCTION(a) ((void)(0))
700 #define TRACE_FUNCTION_P1(f,a1) ((void)(0))
701 #define TRACE_FUNCTION_P2(f,a1,a2) ((void)(0))
702 #define TRACE_FUNCTION_P3(f,a1,a2,a3) ((void)(0))
703 #define TRACE_FUNCTION_P4(f,a1,a2,a3,a4) ((void)(0))
704 #define TRACE_FUNCTION_P5(f,a1,a2,a3,a4,a5) ((void)(0))
705 #define TRACE_FUNCTION_P6(f,a1,a2,a3,a4,a5,a6) ((void)(0))
706 #define TRACE_FUNCTION_P7(f,a1,a2,a3,a4,a5,a6,a7) ((void)(0))
707 #define TRACE_FUNCTION_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0))
708 #define TRACE_FUNCTION_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0))
709 #endif
710
711 #ifdef TRACE_EVE
712 #define TRACE_EVENT(a) vsi_o_event_ttrace(a)
713 #define TRACE_EVENT_P1(f,a1) vsi_o_event_ttrace(f,a1)
714 #define TRACE_EVENT_P2(f,a1,a2) vsi_o_event_ttrace(f,a1,a2)
715 #define TRACE_EVENT_P3(f,a1,a2,a3) vsi_o_event_ttrace(f,a1,a2,a3)
716 #define TRACE_EVENT_P4(f,a1,a2,a3,a4) vsi_o_event_ttrace(f,a1,a2,a3,a4)
717 #define TRACE_EVENT_P5(f,a1,a2,a3,a4,a5) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5)
718 #define TRACE_EVENT_P6(f,a1,a2,a3,a4,a5,a6) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6)
719 #define TRACE_EVENT_P7(f,a1,a2,a3,a4,a5,a6,a7) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7)
720 #define TRACE_EVENT_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8)
721 #define TRACE_EVENT_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
722 #define TRACE_USER_CLASS(c,a) vsi_o_class_ttrace(c,a)
723 #define TRACE_USER_CLASS_P1(c,f,a1) vsi_o_class_ttrace(c,f,a1)
724 #define TRACE_USER_CLASS_P2(c,f,a1,a2) vsi_o_class_ttrace(c,f,a1,a2)
725 #define TRACE_USER_CLASS_P3(c,f,a1,a2,a3) vsi_o_class_ttrace(c,f,a1,a2,a3)
726 #define TRACE_USER_CLASS_P4(c,f,a1,a2,a3,a4) vsi_o_class_ttrace(c,f,a1,a2,a3,a4)
727 #define TRACE_USER_CLASS_P5(c,f,a1,a2,a3,a4,a5) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5)
728 #define TRACE_USER_CLASS_P6(c,f,a1,a2,a3,a4,a5,a6) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6)
729 #define TRACE_USER_CLASS_P7(c,f,a1,a2,a3,a4,a5,a6,a7) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6,a7)
730 #define TRACE_USER_CLASS_P8(c,f,a1,a2,a3,a4,a5,a6,a7,a8) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6,a7,a8)
731 #define TRACE_USER_CLASS_P9(c,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
732 #else
733 #define TRACE_EVENT(a) ((void)(0))
734 #define TRACE_EVENT_P1(f,a1) ((void)(0))
735 #define TRACE_EVENT_P2(f,a1,a2) ((void)(0))
736 #define TRACE_EVENT_P3(f,a1,a2,a3) ((void)(0))
737 #define TRACE_EVENT_P4(f,a1,a2,a3,a4) ((void)(0))
738 #define TRACE_EVENT_P5(f,a1,a2,a3,a4,a5) ((void)(0))
739 #define TRACE_EVENT_P6(f,a1,a2,a3,a4,a5,a6) ((void)(0))
740 #define TRACE_EVENT_P7(f,a1,a2,a3,a4,a5,a6,a7) ((void)(0))
741 #define TRACE_EVENT_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0))
742 #define TRACE_EVENT_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0))
743 #define TRACE_USER_CLASS(c,a) ((void)(0))
744 #define TRACE_USER_CLASS_P1(c,f,a1) ((void)(0))
745 #define TRACE_USER_CLASS_P2(c,f,a1,a2) ((void)(0))
746 #define TRACE_USER_CLASS_P3(c,f,a1,a2,a3) ((void)(0))
747 #define TRACE_USER_CLASS_P4(c,f,a1,a2,a3,a4) ((void)(0))
748 #define TRACE_USER_CLASS_P5(c,f,a1,a2,a3,a4,a5) ((void)(0))
749 #define TRACE_USER_CLASS_P6(c,f,a1,a2,a3,a4,a5,a6) ((void)(0))
750 #define TRACE_USER_CLASS_P7(c,f,a1,a2,a3,a4,a5,a6,a7) ((void)(0))
751 #define TRACE_USER_CLASS_P8(c,f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0))
752 #define TRACE_USER_CLASS_P9(c,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0))
753 #endif
754
755 #ifdef TRACE_BIN
756 #define TRACE_MEMORY(s,p,l) vsi_o_memtrace(s,p,l)
757 #define TRACE_MEMORY_PRIM(s,r,o,p,l) vsi_o_primsend(s,TC_DATA,r,FRM_PCO_NAME,o,p,l FILE_LINE_MACRO)
758 #define TRACE_USER_CLASS_MEMORY_PRIM(s,m,r,o,p,l) vsi_o_primsend(s,m,r,FRM_PCO_NAME,o,p,l FILE_LINE_MACRO)
759 #define TRACE_BINDUMP(s,m,d,p,l) {vsi_o_ttrace(s,m,d);vsi_o_primsend(s,m,0,FRM_PCO_NAME,BIN_TRACE_OPC,p,l FILE_LINE_MACRO);}
760 #define TRACE_HEXDUMP(s,p,l) vsi_o_primsend(s,TC_DATA,0,FRM_PCO_NAME,HEX_TRACE_OPC,p,l FILE_LINE_MACRO);
761 #define TRACE_SDU(s,r,e,d,t,p,l) vsi_o_sdusend(s,r,FRM_PCO_NAME,SDU_TRACE_OPC,e,d,t,p,l FILE_LINE_MACRO)
762 #define TRACE_IP(s,r,u,p,l) vsi_o_primsend(s,TC_DATA,r,FRM_PCO_NAME,(IP_TRACE_OPC|u),p,l FILE_LINE_MACRO)
763 #define TRACE_PRIMDUMP(s,r,o,p,l) vsi_o_primsend(s,TC_DATA,r,FRM_PCO_NAME,o,p,l FILE_LINE_MACRO)
764 #else
765 #define TRACE_MEMORY(s,p,l) ((void)(0))
766 #define TRACE_MEMORY_PRIM(s,r,o,p,l) ((void)(0))
767 #define TRACE_USER_CLASS_MEMORY_PRIM(s,r,o,p,l) ((void)(0))
768 #define TRACE_BINDUMP(s,m,d,p,l) ((void)(0))
769 #define TRACE_HEXDUMP(s,p,l) ((void)(0))
770 #define TRACE_SDU(s,r,e,d,t,p,l) ((void)(0))
771 #define TRACE_IP(s,r,u,p,l) ((void)(0))
772 #define TRACE_PRIMDUMP(s,r,o,p,l) ((void)(0))
773 #endif
774
775 #ifdef TRACE_ERR
776 #define TRACE_ERROR(a) vsi_o_error_ttrace(a)
777 #else
778 #define TRACE_ERROR(a) ((void)(0))
779 #endif
780
781 #ifdef TRACE_IS /* entity internal signals */
782 #define TRACE_ISIG(a) vsi_o_class_ttrace( TC_ISIG,a)
783 #else
784 #define TRACE_ISIG(a) ((void)(0))
785 #endif
786
787 #ifdef TRACE_PRIM
788 #define PTRACE_IN(OPC) vsi_o_ptrace (VSI_CALLER OPC, 0)
789 #define PTRACE_OUT(OPC) vsi_o_ptrace (VSI_CALLER OPC, 1)
790 #else
791 #define PTRACE_IN(OPC) ((void)(0))
792 #define PTRACE_OUT(OPC) ((void)(0))
793 #endif
794
795 #ifdef TRACE_PRF
796 #define PRF_LOG_FUNC_ENTRY(F) prf_log_function_entry(F)
797 #define PRF_LOG_FUNC_EXIT(F) prf_log_function_exit(F)
798 #define PRF_LOG_POI(P) prf_log_point_of_interest(P)
799 #else
800 #define PRF_LOG_FUNC_ENTRY(F) ((void)(0))
801 #define PRF_LOG_FUNC_EXIT(F) ((void)(0))
802 #define PRF_LOG_POI(P) ((void)(0))
803 #endif
804
805 #undef TRACE_ASSERT
806 #if defined NDEBUG
807 #define TRACE_ASSERT(e) ((void)(0))
808 #else
809 #define _TRACE_ASSERT(e) ((void)((e)?0:vsi_o_assert(0,0x8000,__FILE__,__LINE__,#e)))
810 #define TRACE_ASSERT(e) ((void)((e)?0:vsi_o_assert(0,0x8000,__FILE__,__LINE__,"Assertion failed:" #e)))
811 #endif
812
813 #ifdef assert
814 #undef assert
815 #endif
816
817 #define assert TRACE_ASSERT
818
819 #ifdef TRACE_SET_STATE
820 #define SET_STATE(PROCESS,STATE)\
821 { vsi_o_state_ttrace ( #PROCESS ":%s -> " #STATE,\
822 PROCESS##_NAME [ ENTITY_DATA->state[PROCESS] ]);\
823 ENTITY_DATA->state[PROCESS] = STATE;}
824 #else /* TRACE_SET_STATE */
825 #define SET_STATE(PROCESS,STATE) (ENTITY_DATA->state[PROCESS] = STATE)
826 #endif /* TRACE_SET_STATE */
827
828 #ifdef TRACE_GET_STATE
829 #define GET_STATE(PROCESS)\
830 (vsi_o_state_ttrace (#PROCESS ":%s",\
831 PROCESS##_NAME [ ENTITY_DATA->state[PROCESS] ]),\
832 ENTITY_DATA->state[PROCESS] )
833 #else /* TRACE_GET_STATE */
834 #define GET_STATE(PROCESS) ENTITY_DATA->state[PROCESS]
835 #endif /* TRACE_GET_STATE */
836
837
838 #endif /* VSI_H */
839