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