FreeCalypso > hg > tcs211-l1-reconst
comparison gpf/INC/header.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: header.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 : Common header types. | |
17 +----------------------------------------------------------------------------- | |
18 */ | |
19 | |
20 #include "glob_defs.h" | |
21 | |
22 #ifndef __HEADER_H__ | |
23 #define __HEADER_H__ | |
24 | |
25 | |
26 /* | |
27 * T_PRIM_HEADER | |
28 * | |
29 * Description : This type definition defines the custom specific | |
30 * part of a primitive. All primitives have the | |
31 * general format: header followed by data. The | |
32 * header of a primitive is changeable according to | |
33 * the requirements of the target system. | |
34 * Hints: Only the operation code opc as a USHORT value must | |
35 * be present. For multi-instance protocol stacks | |
36 * the routing information must be include in the | |
37 * header (T_ROUTE route). | |
38 */ | |
39 | |
40 #if !defined (T_SDU_DEFINED) | |
41 | |
42 #define T_SDU_DEFINED | |
43 | |
44 typedef struct | |
45 { | |
46 USHORT l_buf; | |
47 USHORT o_buf; | |
48 UBYTE buf[1]; | |
49 } T_sdu; | |
50 | |
51 #endif /* T_SDU_DEFINED */ | |
52 | |
53 /* | |
54 * list of generic data descriptors | |
55 */ | |
56 | |
57 #ifndef __T_desc_list__ | |
58 #define __T_desc_list__ | |
59 | |
60 typedef struct | |
61 { | |
62 U16 list_len; /*< 0: 2> length in octets of whole data */ | |
63 U8 _align0; /*< 2: 1> alignment */ | |
64 U8 _align1; /*< 3: 1> alignment */ | |
65 U32 first; /*< 4: 4> pointer to first generic data descriptor */ | |
66 } T_desc_list; | |
67 #endif | |
68 | |
69 #ifndef __T_desc_list2__ | |
70 #define __T_desc_list2__ | |
71 | |
72 typedef struct | |
73 { | |
74 U16 list_len; /*< 0: 2> length in octets of whole data */ | |
75 U8 _align0; /*< 2: 1> alignment */ | |
76 U8 _align1; /*< 3: 1> alignment */ | |
77 U32 first; /*< 4: 4> pointer to first generic data descriptor */ | |
78 } T_desc_list2; | |
79 #endif | |
80 | |
81 #ifndef __T_desc_list3__ | |
82 #define __T_desc_list3__ | |
83 | |
84 typedef struct | |
85 { | |
86 U16 list_len; /*< 0: 2> length in octets of whole data */ | |
87 U8 _align0; /*< 2: 1> alignment */ | |
88 U8 _align1; /*< 3: 1> alignment */ | |
89 U32 first; /*< 4: 4> pointer to first generic data descriptor */ | |
90 } T_desc_list3; | |
91 #endif | |
92 | |
93 /* | |
94 * generic data descriptor | |
95 */ | |
96 #ifndef __T_desc__ | |
97 #define __T_desc__ /* to prevent double include in generated files */ | |
98 | |
99 typedef struct | |
100 { | |
101 ULONG next; /* next generic data descriptor */ | |
102 USHORT len; /* length of content in octets */ | |
103 UBYTE buffer[1]; /* buffer content */ | |
104 } T_desc; | |
105 #endif /* __T_desc__ */ | |
106 | |
107 #ifndef __T_desc2__ | |
108 #define __T_desc2__ /* to prevent double include in generated files */ | |
109 | |
110 typedef struct | |
111 { | |
112 U32 next; /*< 0: 4> next generic data descriptor */ | |
113 U16 offset; /*< 4: 2> offset in octets */ | |
114 U16 len; /*< 6: 2> length of content in octets */ | |
115 U16 size; /*< 8: 2> size of buffer in octets */ | |
116 U8 buffer[1]; /*< 10: 1> buffer content */ | |
117 } T_desc2; | |
118 #endif /* __T_desc2__ */ | |
119 | |
120 #ifndef __T_desc3__ | |
121 #define __T_desc3__ | |
122 | |
123 typedef struct | |
124 { | |
125 U32 next; /*< 0: 4> next generic data descriptor */ | |
126 U16 offset; /*< 4: 2> offset in octets */ | |
127 U16 len; /*< 6: 2> length of content in octets */ | |
128 U32 buffer; /*< 8: 4> pointer to buffer */ | |
129 } T_desc3; | |
130 #endif | |
131 | |
132 #if !defined (T_FRAME_DESC_DEFINED) | |
133 | |
134 #define T_FRAME_DESC_DEFINED | |
135 | |
136 typedef struct | |
137 { | |
138 UBYTE *Adr[2]; | |
139 USHORT Len[2]; | |
140 } T_FRAME_DESC; | |
141 | |
142 #endif /* T_FRAME_DESC_DEFINED */ | |
143 | |
144 #ifdef OPTION_MULTI_INSTANCES | |
145 typedef struct | |
146 { | |
147 USHORT inst_no; | |
148 USHORT chan_no; | |
149 UBYTE ts_no; | |
150 } T_ROUTE; | |
151 #endif | |
152 | |
153 typedef struct | |
154 { | |
155 char entity; | |
156 char dir; | |
157 char type; | |
158 char align1; | |
159 } T_SDU_TRACE; | |
160 | |
161 #if !defined (T_PRIM_HEADER_DEFINED) | |
162 #define T_PRIM_HEADER_DEFINED | |
163 | |
164 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
165 In the current implementation it is essential that the | |
166 T_PRIM_HEADER type has the same size as the T_DP_HEADER | |
167 type and that the element use_cnt is at the same position | |
168 in both header types! | |
169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ | |
170 typedef struct | |
171 { | |
172 ULONG opc; /* equal to int SignalCode */ | |
173 ULONG len; /* primitive length */ | |
174 LONG use_cnt; /* counter indicates cuurent number of users */ | |
175 T_sdu *sdu; /* pointer to sdu struct if available */ | |
176 ULONG sh_offset; /* offset of system header */ | |
177 ULONG dph_offset; /* offset of dynamic prim header */ | |
178 } T_PRIM_HEADER; | |
179 | |
180 #endif /* T_PRIM_HEADER_DEFINED */ | |
181 | |
182 typedef struct _T_DP_HEADER | |
183 { | |
184 ULONG magic_nr; /* magic number is checked at each access */ | |
185 ULONG size; /* available bytes in dynamic primitive partition */ | |
186 ULONG use_cnt; /* counter indicates current number of users */ | |
187 ULONG offset; /* offset from partition begin to next free byte */ | |
188 T_VOID_STRUCT** | |
189 drp_bound_list; /* pointer to the list of dynamic partitions bound to this partition */ | |
190 struct _T_DP_HEADER *next; | |
191 } T_DP_HEADER; | |
192 | |
193 typedef struct | |
194 { | |
195 SHORT ref_cnt; /* ref_cnt for MALLOC partitions */ | |
196 SHORT desc_type; /* descriptor type */ | |
197 } T_M_HEADER; | |
198 | |
199 /* | |
200 * flags in the opc | |
201 */ | |
202 #define EXTENDED_OPC 0x80000000 | |
203 #define VIRTUAL_OPC 0x40000000 | |
204 #define DOWNLINK_OPC 0x00004000 | |
205 #define UPLINK_OPC 0x00000000 | |
206 #define MEMHANDLE_OPC 0x20000000 | |
207 | |
208 #define SAP32_MASK 0x00007fff /* UL/DL Bit Part of SAP Nr.*/ | |
209 #define SAP16_MASK 0x7f00 | |
210 #define PRIM32_MASK 0x00ff0000 | |
211 #define PRIM16_MASK 0x00ff | |
212 #define OPC32BIT(opc) (opc&EXTENDED_OPC) | |
213 /* | |
214 * for 16bit opcs SAP_NR() returns the same result as (opc & SAP_MASK) in the old style. | |
215 * No shift right is done, e.g. 0x4d00 is returned instead of 0x4d. | |
216 * Also the UL/DL bit is part of the SAP to be downwards compatible with the | |
217 * existing code in the xxx_pei.c modules. | |
218 */ | |
219 #define SAP_NR(opc) (USHORT)((opc&0x80000000)?(opc&SAP32_MASK):(opc&SAP16_MASK)) | |
220 #define PRIM_NR(opc) (USHORT)((opc&0x80000000)?((opc&PRIM32_MASK)>>16):(opc&PRIM16_MASK)) | |
221 | |
222 #define HANDLE_BIT ((UBYTE)0x80) | |
223 #define HANDLE_MASK ((UBYTE)0x7F) | |
224 | |
225 typedef struct | |
226 { | |
227 ULONG magic_nr; | |
228 ULONG time; | |
229 char snd [RESOURCE_NAMELEN]; | |
230 char rcv [RESOURCE_NAMELEN]; | |
231 char org_rcv [RESOURCE_NAMELEN]; | |
232 } T_S_HEADER; | |
233 | |
234 typedef struct | |
235 { | |
236 T_PRIM_HEADER p_hdr; | |
237 T_PRIM_HEADER *prim_ptr; | |
238 } T_PRIM_X; | |
239 | |
240 #endif /* HEADER_H */ | |
241 |