comparison gsm-fw/include/condat/macdef.h @ 669:b3def8c01572

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