annotate src/condat3/com/inc/macdef.h @ 18:c8bd5a927942

src/condat3: import of "condat" tree from TCS3.2, pruned
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 27 Sep 2016 21:25:36 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Project :
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | Modul :
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | All rights reserved.
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 |
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | Instruments Berlin, AG
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | Purpose : Contains macros for the unified implementation of the
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 | Protocol Stack
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 +-----------------------------------------------------------------------------
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 */
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #ifndef MACDEF_H
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #define MACDEF_H
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 /*
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 * Get/Set state for one incarnation. Init state has to be called first.
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 */
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #undef GET_STATE
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #undef SET_STATE
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #ifdef TRACE_STATE
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #define INIT_STATE(P,S) ENTITY_DATA->P name = SERVICE_NAME_##P; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 ENTITY_DATA->P state = S; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 ENTITY_DATA->P state_name = #S;
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #define SET_STATE(P,S) {ENTITY_DATA->P state = S; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 vsi_o_ttrace (VSI_CALLER \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 TC_STATE, \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #P ":%s -> " #S, \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 ENTITY_DATA->P state_name ); \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 ENTITY_DATA->P state_name = #S;}
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 #define GET_STATE(P) (vsi_o_ttrace (VSI_CALLER \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 TC_STATE, \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #P ":%s", ENTITY_DATA->P state_name ), \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 ENTITY_DATA->P state)
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 #else
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 #define INIT_STATE(P,S) {ENTITY_DATA->P state = S;}
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 #define SET_STATE(P,S) {ENTITY_DATA->P state = S;}
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 #define GET_STATE(P) (ENTITY_DATA->P state)
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 #endif /* TRACE_STATE */
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 /*
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * MFREE_DESC() is used to free the given descriptor, along with all following
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 * descriptors.
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 *
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * Parameters: d -- "pointer" to the descriptor, either of type T_desc *, or
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 * an ULONG
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 */
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #define MFREE_DESC(d) { T_desc *desc = (T_desc *)d; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 T_desc *next_desc; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 while (desc NEQ NULL) \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 { \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 next_desc = (T_desc *)desc->next; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 MFREE (desc); \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 desc = next_desc; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 } \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 }
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 /*
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 * PFREE_DESC() is used to free the given primitive, along with all
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 * descriptors in the descriptor list of the primitive.
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 *
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 * Parameters: p -- pointer to the primitive containing a descriptor list
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 * (if it is an ULONG, it has to be casted to the pointer
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 * because the type cannot be determined by the macro!)
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 */
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 #define PFREE_DESC(p) { MFREE_DESC ((p)->desc_list.first); \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 PFREE ((p)); \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 }
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 /*
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 * MFREE_DESC() is used to free the given descriptor, along with all following
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 * descriptors.
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 *
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 * Parameters: d -- "pointer" to the descriptor, either of type T_desc *, or
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 * an ULONG
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 */
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 #define MFREE_DESC2(d) { T_desc2 *desc2 = (T_desc2 *)d; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 T_desc2 *next_desc2; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 while (desc2 NEQ NULL) \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 { \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 next_desc2 = (T_desc2 *)desc2->next; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 MFREE (desc2); \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 desc2 = next_desc2; \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 } \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 }
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 /*
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 * PFREE_DESC() is used to free the given primitive, along with all
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 * descriptors in the descriptor list of the primitive.
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 *
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 * Parameters: p -- pointer to the primitive containing a descriptor list
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 * (if it is an ULONG, it has to be casted to the pointer
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 * because the type cannot be determined by the macro!)
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 */
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 #define PFREE_DESC2(p) { MFREE_DESC2 ((p)->desc_list2.first); \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 PFREE ((p)); \
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 }
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
c8bd5a927942 src/condat3: import of "condat" tree from TCS3.2, pruned
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 #endif /* !MACDEF_H */