FreeCalypso > hg > tcs211-l1-reconst
comparison gpf/INC/vsi.h @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
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 | |
315 T_HANDLE vsi_p_create (T_HANDLE Caller, | |
316 SHORT (*pei_create)(T_PEI_INFO const ** info), | |
317 void (*TaskEntry)(T_HANDLE, ULONG), | |
318 T_HANDLE MemPoolHandle ); | |
319 int vsi_p_exit (T_HANDLE Caller, T_HANDLE TaskHandle); | |
320 int vsi_p_delete (T_HANDLE Caller, T_HANDLE TaskHandle); | |
321 int vsi_p_start (T_HANDLE Caller, T_HANDLE TaskHandle); | |
322 int vsi_p_stop (T_HANDLE Caller, T_HANDLE TaskHandle); | |
323 int vsi_p_name (T_HANDLE Caller, T_HANDLE Handle, char *Name); | |
324 T_HANDLE vsi_p_handle (T_HANDLE Caller, char *Name); | |
325 void vsi_o_set_htrace (T_HANDLE comhandle); | |
326 | |
327 T_VOID_STRUCT * vsi_m_new (ULONG Size, ULONG type FILE_LINE_TYPE); | |
328 T_VOID_STRUCT * vsi_m_new_size (ULONG size, ULONG type, | |
329 ULONG *partition_size FILE_LINE_TYPE); | |
330 int vsi_m_free (T_VOID_STRUCT **Addr FILE_LINE_TYPE); | |
331 int vsi_m_status (T_HANDLE caller, ULONG size, USHORT type, USHORT *free, USHORT *alloc); | |
332 int vsi_m_init (char enable_init, char pattern); | |
333 T_VOID_STRUCT * vsi_m_cnew (ULONG size, ULONG type FILE_LINE_TYPE); | |
334 int vsi_m_cfree (T_VOID_STRUCT **ptr FILE_LINE_TYPE); | |
335 int vsi_m_attach (T_VOID_STRUCT *ptr FILE_LINE_TYPE); | |
336 int vsi_m_register_pool(char * name, T_HANDLE *pool_gr_id); | |
337 | |
338 | |
339 char * vsi_c_init_com_matrix (int max_entities); | |
340 int vsi_c_get_com_matrix_entry (int entry, char *dst); | |
341 int vsi_c_get_entity_com_entry (int entry, T_HANDLE rcv, T_HANDLE *snd); | |
342 T_HANDLE vsi_c_open (T_HANDLE Caller, char *Name); | |
343 int vsi_c_close (T_HANDLE Caller, T_HANDLE ComHandle); | |
344 int vsi_c_clear (T_HANDLE Caller, T_HANDLE ComHandle); | |
345 T_VOID_STRUCT * vsi_c_pnew_generic(T_HANDLE Caller, ULONG Size, ULONG opc, ULONG flags FILE_LINE_TYPE); | |
346 T_VOID_STRUCT * vsi_c_pnew (ULONG Size, ULONG opc FILE_LINE_TYPE); | |
347 T_VOID_STRUCT * vsi_c_pnew_nb (ULONG Size, ULONG opc FILE_LINE_TYPE); | |
348 T_VOID_STRUCT * vsi_c_new_sdu (ULONG Size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset FILE_LINE_TYPE); | |
349 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); | |
350 T_VOID_STRUCT * vsi_c_ppass (T_VOID_STRUCT *prim, ULONG opc FILE_LINE_TYPE); | |
351 void vsi_c_pstore (T_VOID_STRUCT *prim FILE_LINE_TYPE); | |
352 int vsi_c_pattach (T_VOID_STRUCT *prim FILE_LINE_TYPE); | |
353 int vsi_c_pfree (T_VOID_STRUCT **Msg FILE_LINE_TYPE); | |
354 int vsi_c_ssend (T_HANDLE ComHandle, ULONG opc, | |
355 T_VOID_STRUCT *ptr, ULONG MsgLen FILE_LINE_TYPE); | |
356 int vsi_c_psend (T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE); | |
357 int vsi_c_psend_caller(T_HANDLE caller, T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE); | |
358 T_VOID_STRUCT * vsi_c_reuse (T_PRIM_HEADER *ptr, ULONG Size, | |
359 ULONG opc, USHORT sdu_len, USHORT sdu_offset, | |
360 USHORT encode_offset FILE_LINE_TYPE); | |
361 T_VOID_STRUCT * vsi_c_new (T_HANDLE Caller, ULONG Size, ULONG opc FILE_LINE_TYPE); | |
362 int vsi_c_send (T_HANDLE Caller, T_HANDLE ComHandle, | |
363 T_QMSG *Msg FILE_LINE_TYPE); | |
364 int vsi_c_free (T_HANDLE Caller, T_VOID_STRUCT **Msg FILE_LINE_TYPE); | |
365 int vsi_c_pmax_size (void); | |
366 int vsi_c_sync (T_HANDLE Caller, T_TIME timeout); | |
367 int vsi_c_alloc_send (T_HANDLE com_handle, char* rcv, char* snd, void *prim, char* string); | |
368 T_VOID_STRUCT * vsi_drpo_new (ULONG size, ULONG opc, ULONG guess FILE_LINE_TYPE); | |
369 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 ); | |
370 T_VOID_STRUCT * vsi_drp_new (ULONG size, ULONG guess FILE_LINE_TYPE); | |
371 T_VOID_STRUCT * vsi_dp_new (ULONG size, T_VOID_STRUCT *addr, ULONG guess FILE_LINE_TYPE); | |
372 int vsi_drp_bind (T_VOID_STRUCT *child, T_VOID_STRUCT *parent FILE_LINE_TYPE); | |
373 int vsi_free (T_VOID_STRUCT **Msg FILE_LINE_TYPE); | |
374 int vsi_dp_sum (T_VOID_STRUCT *addr, ULONG *size); | |
375 int vsi_dp_max_size (void); | |
376 int vsi_c_await (T_HANDLE Caller, T_HANDLE ComHandle, T_QMSG *Msg, | |
377 ULONG Timeout); | |
378 int vsi_c_primitive (T_HANDLE Caller, void *Prim); | |
379 int vsi_c_awake (T_HANDLE caller ); | |
380 int vsi_c_status (T_HANDLE q_handle, unsigned int *used, unsigned int *free); | |
381 | |
382 int vsi_t_start (T_HANDLE Caller, USHORT Index, T_TIME Value); | |
383 int vsi_t_pstart (T_HANDLE Caller, USHORT Index, T_TIME Value1, T_TIME Value2 ); | |
384 int vsi_t_stop (T_HANDLE Caller, USHORT Index ); | |
385 int vsi_t_status (T_HANDLE Caller, USHORT Index, T_TIME *Value ); | |
386 int vsi_t_config (T_HANDLE Caller, USHORT Index, UBYTE Mode, ULONG Value ); | |
387 int _vsi_t_config (T_HANDLE Caller, char *CfgString, const T_STR_IND *pTable ); | |
388 | |
389 T_HANDLE vsi_s_open (T_HANDLE Caller, char *Name, USHORT Count); | |
390 int vsi_s_close (T_HANDLE Caller, T_HANDLE SemHandle); | |
391 int vsi_s_get (T_HANDLE Caller, T_HANDLE SemHandle); | |
392 int vsi_s_release (T_HANDLE Caller, T_HANDLE SemHandle); | |
393 int vsi_s_status (T_HANDLE Caller, T_HANDLE SemHandle, USHORT *Count); | |
394 | |
395 /* *** ATTENTION START: A modification of the prototypes below requires a modification of STR2IND *** */ | |
396 int vsi_o_func_ttrace (const char * const format, ... ); | |
397 int vsi_o_event_ttrace(const char * const format, ... ); | |
398 int vsi_o_error_ttrace(const char * const format, ... ); | |
399 int vsi_o_state_ttrace(const char * const format, ... ); | |
400 int vsi_o_class_ttrace(ULONG TraceClass, const char * const format, ... ); | |
401 int vsi_o_func_itrace (ULONG index, const char * const format, ... ); | |
402 int vsi_o_event_itrace(ULONG index, const char * const format, ... ); | |
403 int vsi_o_error_itrace(ULONG index, const char * const format, ... ); | |
404 int vsi_o_state_itrace(ULONG index, const char * const format, ... ); | |
405 int vsi_o_class_itrace(ULONG TraceClass, ULONG index, const char * const format, ... ); | |
406 /* *** ATTENTION END: A modification of the prototypes above requires a modification of STR2IND *** */ | |
407 | |
408 int vsi_o_ttrace (T_HANDLE Caller, ULONG TraceClass, const char * const format, ... ); | |
409 int vsi_o_itrace (T_HANDLE Caller, ULONG TraceClass, ULONG index, const char * const format, ... ); | |
410 int vsi_o_ptrace (T_HANDLE Caller, ULONG opc, UBYTE dir ); | |
411 int vsi_o_strace (T_HANDLE Caller, const char *const machine, | |
412 const char *const curstate, | |
413 const char *const newstate); | |
414 void vsi_ext_trace_register (T_EXT_TRACE_FUNC * func); | |
415 int vsi_o_memtrace (T_HANDLE Caller, void *ptr, unsigned int len); | |
416 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); | |
417 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); | |
418 int vsi_o_assert (T_HANDLE Caller, USHORT cause, const char *file, int line, const char * const format, ...); | |
419 int vsi_settracemask (T_HANDLE Caller, T_HANDLE Handle, ULONG Mask ); | |
420 int vsi_gettracemask (T_HANDLE Caller, T_HANDLE Handle, ULONG *Mask ); | |
421 int vsi_trcsuspend (T_HANDLE Caller, T_HANDLE Handle, ULONG Suspend ); | |
422 int vsi_trc_free (T_HANDLE Caller, T_VOID_STRUCT **Msg); | |
423 ULONG get_suspend_state (T_HANDLE caller, int type); | |
424 | |
425 | |
426 void vsi_ppm_new (T_HANDLE Caller, ULONG Size, T_PRIM_HEADER *prim, const char* file, int line ); | |
427 void vsi_ppm_rec (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); | |
428 void vsi_ppm_access (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); | |
429 void vsi_ppm_store (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); | |
430 void vsi_ppm_send (T_HANDLE Caller, T_HANDLE rcv, T_PRIM_HEADER *prim, const char* file, int line ); | |
431 void vsi_ppm_reuse (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); | |
432 void vsi_ppm_free (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); | |
433 void vsi_ppm_setend (T_PRIM_HEADER *Prim, ULONG Size ); | |
434 | |
435 int vsi_gettaskname (T_HANDLE Caller, T_HANDLE Handle, char *Name); | |
436 T_HANDLE vsi_gettaskhandle (T_HANDLE Caller, char *Name); | |
437 int vsi_e_name (T_HANDLE Caller, T_HANDLE Handle, char *Name); | |
438 T_HANDLE vsi_e_handle (T_HANDLE Caller, char *Name); | |
439 int vsi_gettaskflags (T_HANDLE Caller, T_HANDLE Handle, U32 *Flags); | |
440 int vsi_t_time (T_HANDLE Caller, T_TIME *Value); | |
441 int vsi_t_sleep (T_HANDLE Caller, T_TIME Value); | |
442 int vsi_object_info (T_HANDLE caller, USHORT Id, USHORT Index, char *Buffer, USHORT Size); | |
443 | |
444 void vsi_d_callback (T_DRV_SIGNAL *Signal ); | |
445 int vsi_d_create (T_HANDLE Caller, T_TST_DRV_ENTRY *drv_info ); | |
446 int vsi_d_init (T_HANDLE Caller ); | |
447 int vsi_d_exit (T_HANDLE Caller, T_HANDLE DrvHandle ); | |
448 int vsi_d_open (T_HANDLE Caller, char *Name ); | |
449 int vsi_d_close (T_HANDLE Caller, T_HANDLE DrvHandle ); | |
450 int vsi_d_read (T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG *Size ); | |
451 int vsi_d_write (T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG Size ); | |
452 int vsi_d_flush (T_HANDLE Caller, T_HANDLE DrvHandle ); | |
453 int vsi_d_setsignal (T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ); | |
454 int vsi_d_resetsignal (T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ); | |
455 int vsi_d_setconfig (T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ); | |
456 int vsi_d_getconfig (T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ); | |
457 | |
458 void vsi_pcheck_init (void); | |
459 void vsi_pcheck_register(ULONG (*func)(ULONG, void*), ULONG ret_ok); | |
460 | |
461 /*==== MACROS ================================================================*/ | |
462 | |
463 #define ConfigTimer _vsi_t_config | |
464 | |
465 #ifdef MEMORY_SUPERVISION | |
466 #define VSI_PPM_REC(B,F,L) | |
467 #define VSI_PPM_RCV(B) vsi_ppm_rec (VSI_CALLER ((T_PRIM_HEADER*)(B)),__FILE__, __LINE__); | |
468 #define VSI_PPM_NEW(B,S) vsi_ppm_new (VSI_CALLER S,((T_PRIM_HEADER*)(B)),__FILE__, __LINE__); | |
469 #define VSI_PPM_FREE(B) vsi_ppm_free (VSI_CALLER ((T_PRIM_HEADER*)(B)),__FILE__, __LINE__); | |
470 #define VSI_PPM_REUSE(B) vsi_ppm_reuse (VSI_CALLER (T_PRIM_HEADER*)B,__FILE__,__LINE__); | |
471 #define VSI_PPM_ACCESS(B) vsi_ppm_access (VSI_CALLER (T_PRIM_HEADER*)B,__FILE__,__LINE__); | |
472 #define VSI_PPM_SEND(B,D) vsi_ppm_send (VSI_CALLER D,(T_PRIM_HEADER*)B,__FILE__,__LINE__); | |
473 #else | |
474 #define VSI_PPM_REC(B,F,L) | |
475 #define VSI_PPM_RCV(B) | |
476 #define VSI_PPM_NEW(B) | |
477 #define VSI_PPM_FREE(B) | |
478 #define VSI_PPM_REUSE(B) | |
479 #define VSI_PPM_ACCESS(B) | |
480 #define VSI_PPM_SEND(B,D) | |
481 #endif /* MEMORY_SUPERVISION */ | |
482 | |
483 #define ALIGN(S) (((S)+3)&~0x03) | |
484 #define ALIGN_SIZE(S) (((S)+sizeof(int)-1)&~(sizeof(int)-1)) | |
485 #define S_ALLOC_SIZE(S) (ALIGN((S)+sizeof(T_PRIM_HEADER)+sizeof(T_S_HEADER))) | |
486 #define S_HDR_OFFSET(S) (ALIGN(S)>>2) | |
487 #define D_ALLOC_SIZE(S) (ALIGN((S)+sizeof(T_PRIM_HEADER)+sizeof(T_DP_HEADER))) | |
488 #define D_HDR_OFFSET(S) (ALIGN((S)-sizeof(T_DP_HEADER))>>2) | |
489 | |
490 #define P2D(P) ((T_PRIM_HEADER*)(P)+1) | |
491 #define D2P(D) ((T_PRIM_HEADER*)(D)-1) | |
492 | |
493 #define P2D_AC(P,T) P2D(P) | |
494 | |
495 #define P_OPC(P) (((T_PRIM_HEADER*)(P))->opc) | |
496 #define P_OPC2(P) (((T_PRIM_HEADER*)(P))->opc2) | |
497 #define P_LEN(P) (((T_PRIM_HEADER*)(P))->len) | |
498 #define P_TID(P) (((T_PRIM_HEADER*)(P))->tid) | |
499 #define P_SDU(P) (((T_PRIM_HEADER*)(P))->sdu) | |
500 #define P_CNT(P) (((T_PRIM_HEADER*)(P))->use_cnt) | |
501 #define P_IDX(P) (*(ULONG*)(P)) | |
502 #define P_PPM_IDX(P) (*((ULONG*)(P)-PPM_OFFSET)) | |
503 #define P_PNR(P) (*((ULONG*)(P)-PPM_OFFSET) & 0xffff) | |
504 #define P_PGR(P) ((*((ULONG*)(P)-PPM_OFFSET) >> 16) & 0xffff) | |
505 #define P_SHDR(P) ((T_S_HEADER*)((ULONG*)(P)+((T_PRIM_HEADER*)(P))->sh_offset)) | |
506 #define P_RCV(P) (((T_S_HEADER*)P_SHDR(P))->rcv) | |
507 #define P_SND(P) (((T_S_HEADER*)P_SHDR(P))->snd) | |
508 #define P_TIME(P) (((T_S_HEADER*)P_SHDR(P))->time) | |
509 #define P_SHO(P) (((T_PRIM_HEADER*)(P))->sh_offset) | |
510 #define P_DPHO(P) (((T_PRIM_HEADER*)(P))->dph_offset) | |
511 #define P_MEMHANDLE(P) (*(U32*)P2D(P)) | |
512 #define P_MEMHANDLE_SDU(P) (*(((U32*)P2D(P))+1)) | |
513 | |
514 #define D_OPC(D) P_OPC(D2P(D)) | |
515 #define D_OPC2(D) P_OPC2(D2P(D)) | |
516 #define D_LEN(D) P_LEN(D2P(D)) | |
517 #define D_CNT(D) P_CNT(D2P(D)) | |
518 #define D_TID(D) P_TID(D2P(D)) | |
519 #define D_SDU(D) P_SDU(D2P(D)) | |
520 | |
521 #define D_SDU_LEN(D) (D_SDU(D)->l_buf) | |
522 #define D_SDU_OFF(D) (D_SDU(D)->o_buf) | |
523 | |
524 #define BITS_PER_BYTE 8 | |
525 #define BYTELEN(BITLEN) ((BITLEN)<=0?0:((((BITLEN)-1)/BITS_PER_BYTE)+1)) | |
526 #define BYTELEN_POS(BITLEN) (((BITLEN)+7)/BITS_PER_BYTE) | |
527 | |
528 #define SDU_TRAIL ((char*)(((T_sdu*)0)+1)-(char*)(((T_sdu*)0)->buf)) | |
529 #define PSIZE(D) D_LEN(D) | |
530 | |
531 #define SIZ(T) ((ULONG)(sizeof(T_PRIM_HEADER)+sizeof(T))) | |
532 #define SIZ_SDU(T,M) ((ULONG)(SIZ(T)+BYTELEN((M)+ENCODE_OFFSET)-SDU_TRAIL)) | |
533 /* NOTE : received SDUs may have a different ENCODE_OFFSET */ | |
534 | |
535 #ifndef ADD_BSIZE | |
536 #define ADD_BSIZE 0 | |
537 #endif | |
538 | |
539 #define NO_SDU 0xffff | |
540 | |
541 /*lint -e773 Info 773: Expression-like macro '...' not parenthesized | |
542 this message has to be disabled to avoid LINT complaining about missing parentesis in the macros | |
543 that create a pointer and initialize it. Here we cannot set paranthesis because in this case the | |
544 existing entity code will not compile without ';'. To disable this message is safe for these macros */ | |
545 | |
546 #define DRPO_ALLOC(T,G) (T_##T*)vsi_drpo_new(sizeof(T_##T),T,G FILE_LINE_MACRO) | |
547 #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) | |
548 #define DRP_ALLOC(S,G) (T_VOID_STRUCT*)vsi_drp_new(S,G FILE_LINE_MACRO) | |
549 #define DRP_BIND(C,P) vsi_drp_bind((T_VOID_STRUCT*)C,(T_VOID_STRUCT*)P FILE_LINE_MACRO) | |
550 #define DP_ALLOC(S,P,G) (T_VOID_STRUCT*)vsi_dp_new(S,(T_VOID_STRUCT*)P,G FILE_LINE_MACRO) | |
551 #define FREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\ | |
552 vsi_free((T_VOID_STRUCT **)&z FILE_LINE_MACRO);} | |
553 #define MALLOC(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) | |
554 #define M_ALLOC(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) | |
555 | |
556 #ifdef FF_FAST_MEMORY | |
557 #define FMALLOC(P,S) P = (void*)vsi_m_cnew(S,(FastGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) | |
558 #define FM_ALLOC(S) (void*)vsi_m_cnew(S,(FastGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) | |
559 #else | |
560 #define FMALLOC(P,S) MALLOC(P,S) | |
561 #define FM_ALLOC(S) M_ALLOC(S) | |
562 #endif | |
563 | |
564 #define MALLOC_GENERIC(P,S,G,F) P = (void*)vsi_m_cnew(S,(G|(F)) FILE_LINE_MACRO) | |
565 #define M_ALLOC_GENERIC(S,G,F) (void*)vsi_m_cnew(S,(G|(F)) FILE_LINE_MACRO) | |
566 | |
567 #define MALLOC_DESC1(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1) FILE_LINE_MACRO) | |
568 #define M_ALLOC_DESC1(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1) FILE_LINE_MACRO) | |
569 | |
570 #define MALLOC_DESC2(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2) FILE_LINE_MACRO) | |
571 #define M_ALLOC_DESC2(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2) FILE_LINE_MACRO) | |
572 | |
573 #define MALLOC_DESC3(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3) FILE_LINE_MACRO) | |
574 #define M_ALLOC_DESC3(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3) FILE_LINE_MACRO) | |
575 | |
576 #define MALLOC_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
577 #define M_ALLOC_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
578 | |
579 #define MALLOC_DESC1_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
580 #define M_ALLOC_DESC1_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
581 | |
582 #define MALLOC_DESC2_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
583 #define M_ALLOC_DESC2_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
584 | |
585 #define MALLOC_DESC3_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
586 #define M_ALLOC_DESC3_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) | |
587 | |
588 #define MATTACH(M) vsi_m_attach((T_VOID_STRUCT*)M FILE_LINE_MACRO) | |
589 #define M_ATTACH(M) vsi_m_attach((T_VOID_STRUCT*)M FILE_LINE_MACRO) | |
590 | |
591 #define DMALLOC(P,S) P = (void*)vsi_m_new(S,DmemGroupHandle FILE_LINE_MACRO) | |
592 #define D_ALLOC(S) (void*)vsi_m_new(S,DmemGroupHandle FILE_LINE_MACRO) | |
593 | |
594 #define DMALLOC_NB(P,S) P = (void*)vsi_m_new(S,DmemGroupHandle|VSI_MEM_NON_BLOCKING FILE_LINE_MACRO) | |
595 #define D_ALLOC_NB(S) (void*)vsi_m_new(S,DmemGroupHandle|VSI_MEM_NON_BLOCKING FILE_LINE_MACRO) | |
596 | |
597 #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) | |
598 #define P_ALLOC_GENERIC(T,G,F) (T_##T*)vsi_c_pnew_generic(0,sizeof(T_##T),T,(G|(F)) FILE_LINE_MACRO ) | |
599 | |
600 #define PALLOC(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO) | |
601 #define P_ALLOC(T) (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO ) | |
602 | |
603 #define PALLOC_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO) | |
604 #define P_ALLOC_NB(T) (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO ) | |
605 | |
606 #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) | |
607 #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) | |
608 | |
609 #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) | |
610 #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) | |
611 | |
612 #ifdef FF_FAST_MEMORY | |
613 #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) | |
614 #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) | |
615 #else | |
616 #define FPALLOC_SDU(D,T,N) PALLOC_SDU(D,T,N) | |
617 #define FP_ALLOC_SDU(T,N) P_ALLOC_SDU(T,N) | |
618 #endif | |
619 | |
620 #define PALLOC_DESC(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\ | |
621 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list)+sizeof(T_PRIM_HEADER))>>2)); | |
622 | |
623 #define PALLOC_DESC2(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\ | |
624 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list2)+sizeof(T_PRIM_HEADER))>>2)); | |
625 | |
626 #define PALLOC_DESC3(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\ | |
627 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list3)+sizeof(T_PRIM_HEADER))>>2)); | |
628 | |
629 #define PALLOC_DESC_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\ | |
630 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list)+sizeof(T_PRIM_HEADER))>>2)); | |
631 | |
632 #define PALLOC_DESC2_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\ | |
633 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list2)+sizeof(T_PRIM_HEADER))>>2)); | |
634 | |
635 #define PALLOC_DESC3_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\ | |
636 ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list3)+sizeof(T_PRIM_HEADER))>>2)); | |
637 | |
638 #define PATTACH(D) vsi_c_pattach((T_VOID_STRUCT*)D FILE_LINE_MACRO) | |
639 #define P_ATTACH(D) vsi_c_pattach((T_VOID_STRUCT*)D FILE_LINE_MACRO) | |
640 | |
641 #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) | |
642 #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) | |
643 | |
644 #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) | |
645 #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) | |
646 | |
647 #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) | |
648 #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) | |
649 | |
650 #define PSEND(E,D) vsi_c_psend ( E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) | |
651 #define P_SEND(E,D) vsi_c_psend ( E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) | |
652 | |
653 #define PSEND_CALLER(C,E,D) vsi_c_psend_caller ( C, E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) | |
654 #define P_SEND_CALLER(C,E,D) vsi_c_psend_caller ( C, E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) | |
655 | |
656 #define PSIGNAL(E,O,D) vsi_c_ssend ( E ,O,(T_VOID_STRUCT*)D,SIZ(T_##O) FILE_LINE_MACRO ) | |
657 #define P_SIGNAL(E,O,D) vsi_c_ssend ( E ,O,(T_VOID_STRUCT*)D,SIZ(T_##O) FILE_LINE_MACRO ) | |
658 | |
659 #define PRIM_SEND_TO_PC(S,R,P) vsi_o_primsend(S,TC_ENABLE,0,R,0,P,0 FILE_LINE_MACRO) | |
660 #define DATA_SEND_TO_PC(S,F,R,O,P,L) vsi_o_primsend(S,F,0,R,O,P,L FILE_LINE_MACRO) | |
661 | |
662 #define PFREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\ | |
663 vsi_c_pfree((T_VOID_STRUCT **)&z FILE_LINE_MACRO);} | |
664 #define P_FREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\ | |
665 vsi_c_pfree((T_VOID_STRUCT **)&z FILE_LINE_MACRO);} | |
666 | |
667 #define PPASS(D0,D,T) T_##T *D = (T_##T*)vsi_c_ppass ( (T_VOID_STRUCT*)D0, T FILE_LINE_MACRO ) | |
668 #define P_PASS(D0,D,T) T_##T *D = (T_##T*)vsi_c_ppass ( (T_VOID_STRUCT*)D0, T FILE_LINE_MACRO ) | |
669 | |
670 #define PACCESS(D) VSI_PPM_ACCESS(D2P(D)) | |
671 #define P_ACCESS(D) VSI_PPM_ACCESS(D2P(D)) | |
672 | |
673 #define PSTORE(D) vsi_c_pstore ((T_VOID_STRUCT*)D FILE_LINE_MACRO) | |
674 #define P_STORE(D) vsi_c_pstore ((T_VOID_STRUCT*)D FILE_LINE_MACRO) | |
675 | |
676 #define MFREE(P) vsi_m_cfree((T_VOID_STRUCT **)&P FILE_LINE_MACRO) | |
677 #define M_FREE(P) vsi_m_cfree((T_VOID_STRUCT **)&P FILE_LINE_MACRO) | |
678 | |
679 #define D_FREE(P) vsi_m_free((T_VOID_STRUCT **)&P FILE_LINE_MACRO) | |
680 | |
681 /*lint +e773 */ | |
682 | |
683 #ifdef TRACE_FUNC | |
684 #define TRACE_FUNCTION(a) vsi_o_func_ttrace(a) | |
685 #define TRACE_FUNCTION_P1(f,a1) vsi_o_func_ttrace(f,a1) | |
686 #define TRACE_FUNCTION_P2(f,a1,a2) vsi_o_func_ttrace(f,a1,a2) | |
687 #define TRACE_FUNCTION_P3(f,a1,a2,a3) vsi_o_func_ttrace(f,a1,a2,a3) | |
688 #define TRACE_FUNCTION_P4(f,a1,a2,a3,a4) vsi_o_func_ttrace(f,a1,a2,a3,a4) | |
689 #define TRACE_FUNCTION_P5(f,a1,a2,a3,a4,a5) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5) | |
690 #define TRACE_FUNCTION_P6(f,a1,a2,a3,a4,a5,a6) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6) | |
691 #define TRACE_FUNCTION_P7(f,a1,a2,a3,a4,a5,a6,a7) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6,a7) | |
692 #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) | |
693 #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) | |
694 #else | |
695 #define TRACE_FUNCTION(a) ((void)(0)) | |
696 #define TRACE_FUNCTION_P1(f,a1) ((void)(0)) | |
697 #define TRACE_FUNCTION_P2(f,a1,a2) ((void)(0)) | |
698 #define TRACE_FUNCTION_P3(f,a1,a2,a3) ((void)(0)) | |
699 #define TRACE_FUNCTION_P4(f,a1,a2,a3,a4) ((void)(0)) | |
700 #define TRACE_FUNCTION_P5(f,a1,a2,a3,a4,a5) ((void)(0)) | |
701 #define TRACE_FUNCTION_P6(f,a1,a2,a3,a4,a5,a6) ((void)(0)) | |
702 #define TRACE_FUNCTION_P7(f,a1,a2,a3,a4,a5,a6,a7) ((void)(0)) | |
703 #define TRACE_FUNCTION_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0)) | |
704 #define TRACE_FUNCTION_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0)) | |
705 #endif | |
706 | |
707 #ifdef TRACE_EVE | |
708 #define TRACE_EVENT(a) vsi_o_event_ttrace(a) | |
709 #define TRACE_EVENT_P1(f,a1) vsi_o_event_ttrace(f,a1) | |
710 #define TRACE_EVENT_P2(f,a1,a2) vsi_o_event_ttrace(f,a1,a2) | |
711 #define TRACE_EVENT_P3(f,a1,a2,a3) vsi_o_event_ttrace(f,a1,a2,a3) | |
712 #define TRACE_EVENT_P4(f,a1,a2,a3,a4) vsi_o_event_ttrace(f,a1,a2,a3,a4) | |
713 #define TRACE_EVENT_P5(f,a1,a2,a3,a4,a5) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5) | |
714 #define TRACE_EVENT_P6(f,a1,a2,a3,a4,a5,a6) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6) | |
715 #define TRACE_EVENT_P7(f,a1,a2,a3,a4,a5,a6,a7) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7) | |
716 #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) | |
717 #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) | |
718 #define TRACE_USER_CLASS(c,a) vsi_o_class_ttrace(c,a) | |
719 #define TRACE_USER_CLASS_P1(c,f,a1) vsi_o_class_ttrace(c,f,a1) | |
720 #define TRACE_USER_CLASS_P2(c,f,a1,a2) vsi_o_class_ttrace(c,f,a1,a2) | |
721 #define TRACE_USER_CLASS_P3(c,f,a1,a2,a3) vsi_o_class_ttrace(c,f,a1,a2,a3) | |
722 #define TRACE_USER_CLASS_P4(c,f,a1,a2,a3,a4) vsi_o_class_ttrace(c,f,a1,a2,a3,a4) | |
723 #define TRACE_USER_CLASS_P5(c,f,a1,a2,a3,a4,a5) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5) | |
724 #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) | |
725 #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) | |
726 #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) | |
727 #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) | |
728 #else | |
729 #define TRACE_EVENT(a) ((void)(0)) | |
730 #define TRACE_EVENT_P1(f,a1) ((void)(0)) | |
731 #define TRACE_EVENT_P2(f,a1,a2) ((void)(0)) | |
732 #define TRACE_EVENT_P3(f,a1,a2,a3) ((void)(0)) | |
733 #define TRACE_EVENT_P4(f,a1,a2,a3,a4) ((void)(0)) | |
734 #define TRACE_EVENT_P5(f,a1,a2,a3,a4,a5) ((void)(0)) | |
735 #define TRACE_EVENT_P6(f,a1,a2,a3,a4,a5,a6) ((void)(0)) | |
736 #define TRACE_EVENT_P7(f,a1,a2,a3,a4,a5,a6,a7) ((void)(0)) | |
737 #define TRACE_EVENT_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0)) | |
738 #define TRACE_EVENT_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0)) | |
739 #define TRACE_USER_CLASS(c,a) ((void)(0)) | |
740 #define TRACE_USER_CLASS_P1(c,f,a1) ((void)(0)) | |
741 #define TRACE_USER_CLASS_P2(c,f,a1,a2) ((void)(0)) | |
742 #define TRACE_USER_CLASS_P3(c,f,a1,a2,a3) ((void)(0)) | |
743 #define TRACE_USER_CLASS_P4(c,f,a1,a2,a3,a4) ((void)(0)) | |
744 #define TRACE_USER_CLASS_P5(c,f,a1,a2,a3,a4,a5) ((void)(0)) | |
745 #define TRACE_USER_CLASS_P6(c,f,a1,a2,a3,a4,a5,a6) ((void)(0)) | |
746 #define TRACE_USER_CLASS_P7(c,f,a1,a2,a3,a4,a5,a6,a7) ((void)(0)) | |
747 #define TRACE_USER_CLASS_P8(c,f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0)) | |
748 #define TRACE_USER_CLASS_P9(c,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0)) | |
749 #endif | |
750 | |
751 #ifdef TRACE_BIN | |
752 #define TRACE_MEMORY(s,p,l) vsi_o_memtrace(s,p,l) | |
753 #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) | |
754 #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) | |
755 #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);} | |
756 #define TRACE_HEXDUMP(s,p,l) vsi_o_primsend(s,TC_DATA,0,FRM_PCO_NAME,HEX_TRACE_OPC,p,l FILE_LINE_MACRO); | |
757 #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) | |
758 #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) | |
759 #define TRACE_PRIMDUMP(s,r,o,p,l) vsi_o_primsend(s,TC_DATA,r,FRM_PCO_NAME,o,p,l FILE_LINE_MACRO) | |
760 #else | |
761 #define TRACE_MEMORY(s,p,l) ((void)(0)) | |
762 #define TRACE_MEMORY_PRIM(s,r,o,p,l) ((void)(0)) | |
763 #define TRACE_USER_CLASS_MEMORY_PRIM(s,r,o,p,l) ((void)(0)) | |
764 #define TRACE_BINDUMP(s,m,d,p,l) ((void)(0)) | |
765 #define TRACE_HEXDUMP(s,p,l) ((void)(0)) | |
766 #define TRACE_SDU(s,r,e,d,t,p,l) ((void)(0)) | |
767 #define TRACE_IP(s,r,u,p,l) ((void)(0)) | |
768 #define TRACE_PRIMDUMP(s,r,o,p,l) ((void)(0)) | |
769 #endif | |
770 | |
771 #ifdef TRACE_ERR | |
772 #define TRACE_ERROR(a) vsi_o_error_ttrace(a) | |
773 #else | |
774 #define TRACE_ERROR(a) ((void)(0)) | |
775 #endif | |
776 | |
777 #ifdef TRACE_IS /* entity internal signals */ | |
778 #define TRACE_ISIG(a) vsi_o_class_ttrace( TC_ISIG,a) | |
779 #else | |
780 #define TRACE_ISIG(a) ((void)(0)) | |
781 #endif | |
782 | |
783 #ifdef TRACE_PRIM | |
784 #define PTRACE_IN(OPC) vsi_o_ptrace (VSI_CALLER OPC, 0) | |
785 #define PTRACE_OUT(OPC) vsi_o_ptrace (VSI_CALLER OPC, 1) | |
786 #else | |
787 #define PTRACE_IN(OPC) ((void)(0)) | |
788 #define PTRACE_OUT(OPC) ((void)(0)) | |
789 #endif | |
790 | |
791 #ifdef TRACE_PRF | |
792 #define PRF_LOG_FUNC_ENTRY(F) prf_log_function_entry(F) | |
793 #define PRF_LOG_FUNC_EXIT(F) prf_log_function_exit(F) | |
794 #define PRF_LOG_POI(P) prf_log_point_of_interest(P) | |
795 #else | |
796 #define PRF_LOG_FUNC_ENTRY(F) ((void)(0)) | |
797 #define PRF_LOG_FUNC_EXIT(F) ((void)(0)) | |
798 #define PRF_LOG_POI(P) ((void)(0)) | |
799 #endif | |
800 | |
801 #undef TRACE_ASSERT | |
802 #if defined NDEBUG | |
803 #define TRACE_ASSERT(e) ((void)(0)) | |
804 #else | |
805 #define _TRACE_ASSERT(e) ((void)((e)?0:vsi_o_assert(0,0x8000,__FILE__,__LINE__,#e))) | |
806 #define TRACE_ASSERT(e) ((void)((e)?0:vsi_o_assert(0,0x8000,__FILE__,__LINE__,"Assertion failed:" #e))) | |
807 #endif | |
808 | |
809 #ifdef assert | |
810 #undef assert | |
811 #endif | |
812 | |
813 #define assert TRACE_ASSERT | |
814 | |
815 #ifdef TRACE_SET_STATE | |
816 #define SET_STATE(PROCESS,STATE)\ | |
817 { vsi_o_state_ttrace ( #PROCESS ":%s -> " #STATE,\ | |
818 PROCESS##_NAME [ ENTITY_DATA->state[PROCESS] ]);\ | |
819 ENTITY_DATA->state[PROCESS] = STATE;} | |
820 #else /* TRACE_SET_STATE */ | |
821 #define SET_STATE(PROCESS,STATE) (ENTITY_DATA->state[PROCESS] = STATE) | |
822 #endif /* TRACE_SET_STATE */ | |
823 | |
824 #ifdef TRACE_GET_STATE | |
825 #define GET_STATE(PROCESS)\ | |
826 (vsi_o_state_ttrace (#PROCESS ":%s",\ | |
827 PROCESS##_NAME [ ENTITY_DATA->state[PROCESS] ]),\ | |
828 ENTITY_DATA->state[PROCESS] ) | |
829 #else /* TRACE_GET_STATE */ | |
830 #define GET_STATE(PROCESS) ENTITY_DATA->state[PROCESS] | |
831 #endif /* TRACE_GET_STATE */ | |
832 | |
833 | |
834 #endif /* VSI_H */ | |
835 |