comparison src/condat3/com/include/dti.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
comparison
equal deleted inserted replaced
17:6323e661f2ed 18:c8bd5a927942
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : DTILIB
4 | Modul : DTI
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 : Definitions for the Data Transmission Interface, DTI.
18 | Includefile for every entity using DTILIB.
19 +-----------------------------------------------------------------------------
20 */
21 /*
22 * Version 1.6
23 */
24
25 /**********************************************************************************/
26
27 /* NOTE:
28 * there is a MACRO definition for "interface" in objbase.h
29 * which says
30 * #define interface struct
31 * and thus would collide with the name "interface"
32 * as a quick fix, all "interface" have been changed to "interfac"
33 * in the dtilib project. This should not affect any external files
34 */
35
36 /**********************************************************************************/
37
38 #ifndef DTI_H
39 #define DTI_H
40
41 /**********************************************************************************/
42
43 #if defined (DTI2)
44 /*
45 * Use SAP DTI2.DOC
46 */
47 #include "P_DTI2.h"
48 #else
49 /*
50 * Make this code compatible to SAP dti.doc.
51 */
52 #include "P_DTI.h"
53
54 #define T_DTI2_DATA_IND T_DTI_DATA_IND
55 #define T_DTI2_DATA_REQ T_DTI_DATA_REQ
56 #define T_DTI2_READY_IND T_DTI_READY_IND
57 #define T_DTI2_GETDATA_REQ T_DTI_GETDATA_REQ
58 #define T_DTI2_DATA_TEST_REQ T_DTI_DATA_TEST_REQ
59 #define T_DTI2_DATA_TEST_IND T_DTI_DATA_TEST_IND
60
61 /*
62 * By use the SAP DTI.DOC and the DTI2.DOC there could be double
63 * defines. So an undef is used.
64 */
65
66 #ifdef DTI2_DATA_IND
67 #undef DTI2_DATA_IND
68 #endif
69 #ifdef DTI2_DATA_REQ
70 #undef DTI2_DATA_REQ
71 #endif
72 #ifdef DTI2_READY_IND
73 #undef DTI2_READY_IND
74 #endif
75 #ifdef DTI2_GETDATA_REQ
76 #undef DTI2_GETDATA_REQ
77 #endif
78 #ifdef DTI2_DATA_TEST_REQ
79 #undef DTI2_DATA_TEST_REQ
80 #endif
81 #ifdef DTI2_DATA_TEST_IND
82 #undef DTI2_DATA_TEST_IND
83 #endif
84
85 /*
86 * For calling the primitives over the macros.
87 */
88 #define DTI2_DATA_IND DTI_DATA_IND
89 #define DTI2_DATA_REQ DTI_DATA_REQ
90 #define DTI2_READY_IND DTI_READY_IND
91 #define DTI2_GETDATA_REQ DTI_GETDATA_REQ
92 #define DTI2_DATA_TEST_REQ DTI_DATA_TEST_REQ
93 #define DTI2_DATA_TEST_IND DTI_DATA_TEST_IND
94
95 /*
96 * Version related to DTI SAP 1.
97 */
98
99 #define T_desc2 T_desc
100 #define T_desc_list2 T_desc_list
101 #define desc_list2 desc_list
102
103 #endif
104
105 /**********************************************************************************
106 * Externally visible dtilib defines
107 **********************************************************************************/
108 /*
109 * Reason parameter for the callback function
110 */
111 #define DTI_NO_SIGNAL 0 /* No signal shall be sended */
112 #define DTI_REASON_CONNECTION_OPENED 1 /* DTI connection opened or reseted */
113 #define DTI_REASON_CONNECTION_CLOSED 2 /* DTI connection closed */
114 #define DTI_REASON_DATA_RECEIVED 3 /* UL Data primitive received */
115 #define DTI_REASON_TX_BUFFER_FULL 4 /* DTI send-queue full */
116 #define DTI_REASON_TX_BUFFER_READY 5 /* DTI DTI send-queue no longer full */
117
118 /*
119 * Connection states
120 */
121 #define DTI_CLOSED 0 /* DTI connection is not established */
122 #define DTI_SETUP 1 /* Waiting for connection_opened signal from DTILIB */
123 #define DTI_IDLE 2 /* DTI connection is opened */
124
125 /*
126 * dti_open - direction parameter
127 *
128 * to lower layer: send request primitives (_REQ / _CNF)
129 * to higher layer: send indications (_IND / _RES)
130 * null link: do not send anything
131 */
132 #define DTI_CHANNEL_TO_HIGHER_LAYER 0x00
133 #define DTI_CHANNEL_TO_LOWER_LAYER 0x01
134 #define DTI_NULL_LINK 0x02 /* null link (null device) */
135
136 /*
137 * dti_open - link_options parameter
138 *
139 * the 0 is legacy from previous versions - upon reception of this value
140 * the queue-length parameter has to be used to find out about desired
141 * behaviour for the send queue
142 * #define FLOW_CNTRL_ENABLED 0 -- Flow control enabled
143 */
144 #define DTI_FLOW_CNTRL_DISABLED 1 /* Flow control entirely disabled */
145 /*
146 * Modes for handling of the send queue
147 *
148 * Queue is not used
149 */
150 #define DTI_QUEUE_UNUSED 2
151 /*
152 * Queue without size limitation
153 */
154 #define DTI_QUEUE_UNBOUNDED 3
155 /*
156 * Notify entity when queue is full,
157 * afterwards discard oldest piece of data upon arrival of new data packets
158 */
159 #define DTI_QUEUE_RM_FIFO 4
160 /*
161 * Notify entity when queue is full,
162 * afterwards discard newly arriving data packets
163 */
164 #define DTI_QUEUE_RM_LIFO 5
165 /*
166 * Notify entity when queue is full but keep all buffered data
167 */
168 #define DTI_QUEUE_WATERMARK 6
169
170 /*
171 * dti_init - entity_options (flags!)
172 */
173 #define DTI_DEFAULT_OPTIONS 0x0
174 #define DTI_NO_TRACE (1<<0)
175
176 /*
177 * Some parameter which are used for initialization.
178 */
179 #define D_NO_DATA_BASE NULL
180 #define D_NO_INSTANCE 0xFF
181 #define D_NO_INTERFACE 0xFF
182 #define D_NO_CHANNEL_NR 0xFF
183
184 /**********************************************************************************
185 * Obsolete dtilib defines
186 *
187 * NOTE: use of these defines is STRONGLY DISCOURAGED since their functionality
188 * is no longer needed and they will be removed some time in the future
189 *
190 **********************************************************************************/
191
192 /*
193 * NOTE: this is _obsolete_ and maintained only for compatibility reasons!!
194 * (see link_options parameter)
195 */
196 #define DTI_QUEUE_DISABLED 0 /* Queue not used */
197 #define DTI_QUEUE_UNLIMITED 255 /* Queue without limitations in size */
198
199 /*
200 * Home and neighbor entity.
201 * NOTE: this is _obsolete_ and maintained only for compatibility reasons!!
202 * instead use the defines
203 * DTI_CHANNEL_TO_HIGHER_LAYER and
204 * DTI_CHANNEL_TO_LOWER_LAYER
205 */
206 #define HOME TRUE /* Indicate the entity or instance which send dti_connect_req */
207 #define NEIGHBOR FALSE /* Indicate the entity or instance which send dti_connect_ind */
208
209 /*
210 * Type of the link
211 */
212
213 #define ENTITY_LINK 0x01 /* normal link with an entity */
214 #define NULL_LINK 0x02 /* null link (null device) */
215 #define RIVIERA_BT_LINK 0x03 /* link to BT riviera entity */
216 #define RIVIERA_ATP_LINK 0x04 /* link to RNET riviera entity */
217
218 /*
219 * Communication type
220 * NOTE: this is _obsolete_ and maintained only for compatibility reasons!!
221 * (see link_options parameter)
222 */
223 #define FLOW_CNTRL_ENABLED 0 /* Flow control enabled */
224 #define FLOW_CNTRL_DISABLED 1 /* Flow control disabled */
225
226 /*
227 * Connection states
228 * NOTE: this is _obsolete_ and maintained only for compatibility reasons!!
229 * these states should be defined in the entities or the prefixec versiones
230 * above should be used
231 */
232 #define CLOSED 0 /* DTI connection is not established */
233 #define SETUP 1 /* Waiting for connection_opened signal from DTILIB */
234 #define IDLE 2 /* DTI connection is opened */
235
236 /*
237 * Entity states for sending
238 * NOTE: this is _obsolete_ and maintained only for compatibility reasons!!
239 * these states should be defined in the entity itself
240 * to ensure proper prefixing
241 */
242 #define TX_IDLE 3 /* The entity must not send data primitives (initial state) */
243 #define TX_READY 4 /* The entity can send data primitives */
244
245 /*
246 * Entity states for receiving
247 * NOTE: this is _obsolete_ and maintained only for compatibility reasons!!
248 * these states should be defined in the entity itself
249 * to ensure proper prefixing
250 */
251 #define RX_IDLE 5 /* Data reception stopped (initial state) */
252 #define RX_READY 6 /* Ready to receive data */
253
254 #define ENTITY_NAME_LEN 0x6
255
256 #define MAX_ATP_LINKS 0x4 /* max. number of links towards the RIV/ATP environment,
257 set by AAA*/
258 /*
259 * Value constants for capability
260 */
261 #define DTI_CPBLTY_NO 0x0 /* used as initial value = no capabilities */
262 #define DTI_CPBLTY_CMD 0x1 /* AT cmd capability */
263 #define DTI_CPBLTY_PKT 0x2 /* packet capability */
264 #define DTI_CPBLTY_SER 0x4 /* serial capability */
265
266 /**********************************************************************************
267 * typedefs
268 **********************************************************************************/
269
270 /*
271 * Data Base for each entity.
272 */
273
274 typedef struct
275 {
276 T_HANDLE handle; /* GPF task handle */
277 U8 max_links; /* Number of links in the link list
278 - started from the pointer first_link */
279 U32 entity_options; /* user specified entity_options */
280 void ((*sig_callback) /* Callback function */
281 (U8 instance, /* Instance of the entity */
282 U8 interfac, /* Interface of the entity */
283 U8 channel, /* Channel */
284 U8 reason, /* Reason for the callback */
285 T_DTI2_DATA_IND *dti_data_ind)); /* Data primitive ul */
286 #ifdef FF_TCP_IP
287 char* own_name; /* name of the own entity, held by AAA */
288 U16 entity_id_p; /* entity id within ATP, the same for all
289 entities and AAA */
290 #endif
291 U32 first_link; /* Pointer to link table */
292 } DTI_DATA_BASE;
293
294 typedef DTI_DATA_BASE * DTI_HANDLE; /* For calling the data base */
295
296
297 /*
298 * Link Table, parameter for each DTI connection.
299 * For detail information - please see the MSC DTILIB.DOC
300 */
301 typedef struct
302 {
303 U32 link_id; /* Identity for the link communication */
304 U8 direction; /* Direction for the link communication */
305 U32 version; /* DTI Version */
306 U8 instance; /* Instance of the entity */
307 U8 interfac; /* Selected interface */
308 U8 channel; /* Channel number */
309 U32 link_options; /* type of flow control, queueing, .. */
310 T_HANDLE link_handle; /* Handle for the communication channel */
311 U8 queue_size; /* DTI queue size */
312 U8 queue_len; /* length of the queue */
313 T_DTI2_DATA_IND *dti_data_ind; /* DTI data primitive */
314 U8 connect_state; /* State for connect */
315 U8 rx_state; /* State for receive */
316 U8 tx_state; /* State for send */
317 U32 next_link; /* Pointer to next DTI_LINK struct, last */
318 /* linkpointer = NULL */
319 U8 link_type; /* indicate Riviera, NULL or GPF link */
320 #ifdef FF_TCP_IP
321 U16 ul_next_atp_data; /* data to be got from ATP */
322 U8 atp_tx_state; /* flow state of ATP */
323 U8 dti_id; /* ACI identity for the link */
324 DTI_DATA_BASE* entity_db; /* pointer back to home database */
325 UINT16 port_nb; /* port number, if linked towards RIV */
326 #endif
327
328 } DTI_LINK;
329
330 /**********************************************************************************
331 * Prototypes for DTILIB
332 **********************************************************************************/
333
334 EXTERN DTI_HANDLE dti_init(
335 U8 maximum_links,
336 T_HANDLE handle,
337 U32 entity_options,
338 void (sig_callback(
339 U8 instance,
340 U8 interfac,
341 U8 channel,
342 U8 reason,
343 T_DTI2_DATA_IND *dti_data_ind
344 ) )
345 );
346
347 EXTERN void dti_deinit( DTI_HANDLE hDTI);
348
349 EXTERN BOOL dti_open(
350 DTI_HANDLE hDTI,
351 U8 instance,
352 U8 interfac,
353 U8 channel,
354 U8 queue_size,
355 U8 direction,
356 U32 link_options,
357 U32 version,
358 U8 *neighbor_entity,
359 U32 link_id
360 );
361
362 EXTERN BOOL dti_resolve_link_id(
363 DTI_HANDLE hDTI,
364 U8 instance,
365 U8 interfac,
366 U8 channel,
367 U32 *link_id
368 );
369
370 EXTERN void dti_close(
371 DTI_HANDLE hDTI,
372 U8 instance,
373 U8 interfac,
374 U8 channel,
375 BOOL flush
376 );
377
378 EXTERN void dti_start( DTI_HANDLE hDTI, U8 instance, U8 interfac, U8 channel);
379
380 EXTERN void dti_stop( DTI_HANDLE hDTI, U8 instance, U8 interfac, U8 channel);
381
382 EXTERN void dti_send_data(
383 DTI_HANDLE hDTI,
384 U8 instance,
385 U8 interfac,
386 U8 channel,
387 T_DTI2_DATA_IND *dti_data_ind
388 );
389
390 EXTERN void mfree_desc(DTI_HANDLE hDTI, T_desc_list2 * desc_list2);
391
392 EXTERN BOOL dti_tx_buffer_status(
393 DTI_HANDLE hDTI,
394 U8 instance,
395 U8 interfac,
396 U8 channel,
397 U8 *queue_len
398 );
399
400 /**********************************************************************************
401 * Functions in ip_kerp.c
402 **********************************************************************************/
403
404 #if defined (DTI2)
405 EXTERN GLOBAL void dti_dti_connect_req (DTI_HANDLE hDTI,
406 T_DTI2_CONNECT_REQ *dti_connect_req);
407
408 EXTERN GLOBAL void dti_dti_disconnect_req (DTI_HANDLE hDTI,
409 T_DTI2_DISCONNECT_REQ *dti_disconnect_req);
410
411 EXTERN GLOBAL void dti_dti_disconnect_ind (DTI_HANDLE hDTI,
412 T_DTI2_DISCONNECT_IND *dti_disconnect_ind);
413
414 EXTERN GLOBAL void dti_dti_connect_cnf (DTI_HANDLE hDTI,
415 T_DTI2_CONNECT_CNF *dti_connect_cnf);
416
417 EXTERN GLOBAL void dti_dti_connect_res (DTI_HANDLE hDTI,
418 T_DTI2_CONNECT_RES *dti_connect_res);
419
420 EXTERN GLOBAL void dti_dti_connect_ind (DTI_HANDLE hDTI,
421 T_DTI2_CONNECT_IND *dti_connect_ind);
422 #endif
423
424 EXTERN GLOBAL void dti_dti_ready_ind (DTI_HANDLE hDTI,
425 T_DTI2_READY_IND *dti_ready_ind);
426
427 EXTERN GLOBAL void dti_dti_data_req (DTI_HANDLE hDTI,
428 T_DTI2_DATA_REQ *dti_data_req);
429
430 EXTERN GLOBAL void dti_dti_getdata_req (DTI_HANDLE hDTI,
431 T_DTI2_GETDATA_REQ *dti_getdata_req);
432
433 EXTERN GLOBAL void dti_dti_data_ind (DTI_HANDLE hDTI,
434 T_DTI2_DATA_IND *dti_data_ind);
435
436 /**********************************************************************************
437 * Test functions used in the windows operating system.
438 **********************************************************************************/
439
440 #if defined (_SIMULATION_)
441 EXTERN void dti_dti_data_test_ind (DTI_HANDLE hDTI,
442 T_DTI2_DATA_TEST_IND *dti_data_test_ind);
443
444 EXTERN void dti_dti_data_test_req (DTI_HANDLE hDTI,
445 T_DTI2_DATA_TEST_REQ *dti_data_test_req);
446
447 EXTERN BOOL dti_make_new_desc (DTI_HANDLE hDTI,
448 T_desc2 **p_desc_new,
449 U16 malloc_len,
450 BOOL buff_init_0);
451
452 #endif /* _SIMULATION_ */
453 #endif /* DTI_H */