comparison src/g23m-aci/dti/dti_kerp.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
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 Protocol Stack Library
18 | DTI
19 +-----------------------------------------------------------------------------
20 */
21
22 /*
23 * Version 1.6
24 */
25
26 #ifndef DTI_KERP_C
27 #define DTI_KERP_C
28 #endif
29
30 #include <string.h>
31 #include "typedefs.h"
32 #include "pconst.cdg"
33 #include "vsi.h"
34 #include "pconst.cdg"
35 #include "custom.h"
36 #include "gsm.h"
37 #include "prim.h"
38 #include "pei.h"
39 #include "tok.h"
40 #include "ccdapi.h"
41 #include "dti.h"
42 #include "dti_int_def.h"
43 #include "dti_int_prot.h"
44
45
46 /*==== CONST =======================================================*/
47
48 /*==== TYPES =======================================================*/
49
50 /*==== VAR EXPORT ==================================================*/
51
52 /*==== VAR LOCAL ===================================================*/
53
54
55 /*==== MACROS ======================================================*/
56
57
58 /*==== prototypes ==================================================*/
59
60 /*==== FUNCTIONS ===================================================*/
61
62 /*
63 +--------------------------------------------------------------------+
64 | PROJECT : DTILIB MODULE : DTI_KERP |
65 | STATE : code ROUTINE : dti_dti_connect_req |
66 +--------------------------------------------------------------------+
67
68 PURPOSE : Process primitive DTI_CONNECT_REQ received from neighbour DTI.
69 */
70
71 GLOBAL void dti_dti_connect_req (DTI_HANDLE hDTI,
72 T_DTI2_CONNECT_REQ *dti_connect_req)
73 {
74 #define VSI_CALLER hDTI->handle,
75
76 trace_function(hDTI->handle,
77 "dti_dti_connect_req()",
78 hDTI->entity_options);
79
80 if( !(hDTI->entity_options & DTI_NO_TRACE) )
81 {
82 PACCESS (dti_connect_req);
83 }
84
85 trace_message_link_id(hDTI->handle,
86 " IN: DTI2_CONNECT_REQ",
87 dti_connect_req->link_id,
88 hDTI->entity_options);
89
90 connect_init_prim_received(hDTI,
91 dti_connect_req->link_id,
92 dti_connect_req->version,
93 DTI_CHANNEL_TO_HIGHER_LAYER);
94
95 PFREE (dti_connect_req);
96
97 #undef VSI_CALLER
98 } /* dti_dti_connect_req() */
99
100
101
102 /*
103 +--------------------------------------------------------------------+
104 | PROJECT : DTILIB MODULE : DTI_KERP |
105 | STATE : code ROUTINE : dti_dti_connect_ind |
106 +--------------------------------------------------------------------+
107
108 PURPOSE : Process primitive DTI_CONNECT_IND received from neighbour DTI
109 */
110
111 GLOBAL void dti_dti_connect_ind (DTI_HANDLE hDTI,
112 T_DTI2_CONNECT_IND *dti_connect_ind)
113 {
114 #define VSI_CALLER hDTI->handle,
115
116 trace_function(hDTI->handle,
117 "dti_dti_connect_ind()",
118 hDTI->entity_options);
119
120 if( !(hDTI->entity_options & DTI_NO_TRACE) )
121 {
122 PACCESS (dti_connect_ind);
123 }
124
125 trace_message_link_id(hDTI->handle,
126 " IN: DTI2_CONNECT_IND",
127 dti_connect_ind->link_id,
128 hDTI->entity_options);
129
130 connect_init_prim_received(hDTI,
131 dti_connect_ind->link_id,
132 dti_connect_ind->version,
133 DTI_CHANNEL_TO_LOWER_LAYER);
134
135 PFREE(dti_connect_ind);
136
137 #undef VSI_CALLER
138 } /* dti_dti_connect_ind() */
139
140
141
142 /*
143 +--------------------------------------------------------------------+
144 | PROJECT : DTILIB MODULE : DTI_KERP |
145 | STATE : code ROUTINE : dti_dti_disconnect_req |
146 +--------------------------------------------------------------------+
147
148 PURPOSE : Process primitive DTI2_DISCONNECT_REQ received from neighbour DTI
149 */
150
151 GLOBAL void dti_dti_disconnect_req (DTI_HANDLE hDTI,
152 T_DTI2_DISCONNECT_REQ *dti_disconnect_req)
153 {
154 #define VSI_CALLER hDTI->handle,
155
156 trace_function(hDTI->handle,
157 "dti_dti_disconnect_req()",
158 hDTI->entity_options);
159
160 if( !(hDTI->entity_options & DTI_NO_TRACE) )
161 {
162 PACCESS (dti_disconnect_req);
163 }
164
165 trace_message_link_id(hDTI->handle,
166 " IN: DTI2_DISCONNECT_REQ",
167 dti_disconnect_req->link_id,
168 hDTI->entity_options);
169
170 disconnect_prim_received(hDTI,
171 dti_disconnect_req->link_id,
172 DTI_CHANNEL_TO_HIGHER_LAYER);
173
174 PFREE (dti_disconnect_req);
175
176 #undef VSI_CALLER
177 } /* dti_dti_disconnect_req() */
178
179
180
181 /*
182 +--------------------------------------------------------------------+
183 | PROJECT : DTILIB MODULE : DTI_KERP |
184 | STATE : code ROUTINE : dti_dti_disconnect_ind |
185 +--------------------------------------------------------------------+
186
187 PURPOSE : Process primitive DTI_DISCONNECT_IND received from neighbour DTI
188 */
189
190 GLOBAL void dti_dti_disconnect_ind (DTI_HANDLE hDTI,
191 T_DTI2_DISCONNECT_IND *dti_disconnect_ind)
192 {
193 #define VSI_CALLER hDTI->handle,
194
195 trace_function(hDTI->handle,
196 "dti_dti_disconnect_ind()",
197 hDTI->entity_options);
198
199 if( !(hDTI->entity_options & DTI_NO_TRACE) )
200 {
201 PACCESS (dti_disconnect_ind);
202 }
203
204 trace_message_link_id(hDTI->handle,
205 " IN: DTI2_DISCONNECT_IND",
206 dti_disconnect_ind->link_id,
207 hDTI->entity_options);
208
209 disconnect_prim_received(hDTI,
210 dti_disconnect_ind->link_id,
211 DTI_CHANNEL_TO_LOWER_LAYER);
212
213 PFREE (dti_disconnect_ind);
214
215 #undef VSI_CALLER
216 } /* dti_dti_disconnect_ind() */
217
218
219
220 /*
221 +--------------------------------------------------------------------+
222 | PROJECT : DTILIB MODULE : DTI_KERP |
223 | STATE : code ROUTINE : dti_dti_connect_cnf |
224 +--------------------------------------------------------------------+
225
226 PURPOSE : Process primitive DTI_CONNECT_CNF received from neighbour DTI
227 */
228
229 GLOBAL void dti_dti_connect_cnf (DTI_HANDLE hDTI,
230 T_DTI2_CONNECT_CNF *dti_connect_cnf)
231 {
232 #define VSI_CALLER hDTI->handle,
233
234 trace_function(hDTI->handle,
235 "dti_dti_connect_cnf()",
236 hDTI->entity_options);
237
238 if( !(hDTI->entity_options & DTI_NO_TRACE) )
239 {
240 PACCESS (dti_connect_cnf);
241 }
242
243 trace_message_link_id(hDTI->handle,
244 " IN: DTI2_CONNECT_CNF",
245 dti_connect_cnf->link_id,
246 hDTI->entity_options);
247
248 connect_confirm_prim_received(hDTI,
249 dti_connect_cnf->link_id,
250 dti_connect_cnf->version,
251 DTI_CHANNEL_TO_LOWER_LAYER);
252
253 PFREE (dti_connect_cnf);
254
255 #undef VSI_CALLER
256 } /* dti_dti_connect_cnf() */
257
258
259
260 /*
261 +--------------------------------------------------------------------+
262 | PROJECT : DTILIB MODULE : DTI_KERP |
263 | STATE : code ROUTINE : dti_dti_connect_res |
264 +--------------------------------------------------------------------+
265
266 PURPOSE : Process primitive DTI_CONNECT_RES received from neighbour DTI
267 */
268
269 GLOBAL void dti_dti_connect_res (DTI_HANDLE hDTI,
270 T_DTI2_CONNECT_RES *dti_connect_res)
271 {
272 #define VSI_CALLER hDTI->handle,
273
274 trace_function(hDTI->handle,
275 "dti_dti_connect_res()",
276 hDTI->entity_options);
277
278 if( !(hDTI->entity_options & DTI_NO_TRACE) )
279 {
280 PACCESS (dti_connect_res);
281 }
282
283 trace_message_link_id(hDTI->handle,
284 " IN: DTI2_CONNECT_RES",
285 dti_connect_res->link_id,
286 hDTI->entity_options);
287
288 connect_confirm_prim_received(hDTI,
289 dti_connect_res->link_id,
290 dti_connect_res->version,
291 DTI_CHANNEL_TO_HIGHER_LAYER);
292
293 PFREE (dti_connect_res);
294
295 #undef VSI_CALLER
296 } /* dti_dti_connect_res() */
297
298
299
300 /*
301 +--------------------------------------------------------------------+
302 | PROJECT : DTILIB MODULE : DTI_KERP |
303 | STATE : code ROUTINE : dti_dti_data_req |
304 +--------------------------------------------------------------------+
305
306 PURPOSE : Process primitive DTI_DATA_REQ received from neighbour DTI
307 */
308
309 GLOBAL void dti_dti_data_req (DTI_HANDLE hDTI,
310 T_DTI2_DATA_REQ *dti_data_req)
311 {
312 #define VSI_CALLER hDTI->handle,
313
314 trace_function(hDTI->handle,
315 "dti_dti_data_req()",
316 hDTI->entity_options);
317
318 if( !(hDTI->entity_options & DTI_NO_TRACE) )
319 {
320 PACCESS (dti_data_req);
321 }
322
323 trace_message_l_dl(hDTI->handle,
324 " IN: DTI2_DATA_REQ",
325 dti_data_req->link_id,
326 dti_data_req->desc_list2.list_len,
327 hDTI->entity_options);
328
329 if(hDTI->entity_options & DTI_NO_TRACE)
330 {
331 PPASS_NTRACE(dti_data_req, dti_data_ind, DTI2_DATA_IND);
332 data_prim_received (hDTI, dti_data_ind, DTI_CHANNEL_TO_HIGHER_LAYER);
333 }
334 else
335 {
336 PPASS(dti_data_req, dti_data_ind, DTI2_DATA_IND);
337 data_prim_received (hDTI, dti_data_ind, DTI_CHANNEL_TO_HIGHER_LAYER);
338 }
339
340 #undef VSI_CALLER
341 } /* dti_dti_data_req() */
342
343
344
345 /*
346 +--------------------------------------------------------------------+
347 | PROJECT : DTILIB MODULE : DTI_KERP |
348 | STATE : code ROUTINE : dti_dti_data_ind |
349 +--------------------------------------------------------------------+
350
351 PURPOSE : Process primitive DTI_DATA_IND received from neighbour DTI
352 */
353
354 GLOBAL void dti_dti_data_ind (DTI_HANDLE hDTI,
355 T_DTI2_DATA_IND *dti_data_ind)
356 {
357 #define VSI_CALLER hDTI->handle,
358
359 trace_function(hDTI->handle,
360 "dti_dti_data_ind()",
361 hDTI->entity_options);
362
363 if( !(hDTI->entity_options & DTI_NO_TRACE) )
364 {
365 PACCESS (dti_data_ind);
366 }
367
368 trace_message_l_dl(hDTI->handle,
369 " IN: DTI2_DATA_IND",
370 dti_data_ind->link_id,
371 dti_data_ind->desc_list2.list_len,
372 hDTI->entity_options);
373
374 data_prim_received (hDTI, dti_data_ind, DTI_CHANNEL_TO_LOWER_LAYER);
375
376 #undef VSI_CALLER
377 } /* dti_dti_data_ind() */
378
379
380
381 /*
382 +--------------------------------------------------------------------+
383 | PROJECT : DTILIB MODULE : DTI_KERP |
384 | STATE : code ROUTINE : dti_dti_getdata_req |
385 +--------------------------------------------------------------------+
386
387 PURPOSE : Process primitive DTI_GETDATA_REQ received from neighbour DTI
388 */
389
390 GLOBAL void dti_dti_getdata_req (DTI_HANDLE hDTI,
391 T_DTI2_GETDATA_REQ *dti_getdata_req)
392 {
393 #define VSI_CALLER hDTI->handle,
394
395 trace_function(hDTI->handle,
396 "dti_dti_getdata_req()",
397 hDTI->entity_options);
398
399 if( !(hDTI->entity_options & DTI_NO_TRACE) )
400 {
401 PACCESS (dti_getdata_req);
402 }
403
404 trace_message_link_id(hDTI->handle,
405 " IN: DTI2_GETDATA_REQ",
406 dti_getdata_req->link_id,
407 hDTI->entity_options);
408
409 flow_control_prim_received(hDTI,
410 dti_getdata_req->link_id,
411 DTI_CHANNEL_TO_HIGHER_LAYER);
412
413 PFREE (dti_getdata_req);
414
415 #undef VSI_CALLER
416 } /* dti_dti_getdata_req() */
417
418
419
420 /*
421 +--------------------------------------------------------------------+
422 | PROJECT : DTILIB MODULE : DTI_KERP |
423 | STATE : code ROUTINE : dti_dti_ready_ind |
424 +--------------------------------------------------------------------+
425
426 PURPOSE : Process primitive DTI_READY_IND received from neighbour DTI
427 */
428
429 GLOBAL void dti_dti_ready_ind (DTI_HANDLE hDTI,
430 T_DTI2_READY_IND *dti_ready_ind)
431 {
432 #define VSI_CALLER hDTI->handle,
433
434 trace_function(hDTI->handle,
435 "dti_dti_ready_ind()",
436 hDTI->entity_options);
437
438 if( !(hDTI->entity_options & DTI_NO_TRACE) )
439 {
440 PACCESS (dti_ready_ind);
441 }
442
443 trace_message_link_id(hDTI->handle,
444 " IN: DTI2_READY_IND",
445 dti_ready_ind->link_id,
446 hDTI->entity_options);
447
448 flow_control_prim_received(hDTI,
449 dti_ready_ind->link_id,
450 DTI_CHANNEL_TO_LOWER_LAYER);
451
452 PFREE (dti_ready_ind);
453
454 #undef VSI_CALLER
455 } /* dti_dti_ready_ind() */
456
457
458 #ifdef _SIMULATION_
459
460 /*
461 +--------------------------------------------------------------------+
462 | PROJECT : WAP MODULE : ip_kerp.c |
463 | STATE : code ROUTINE : ker_dti_data_test_ind|
464 +--------------------------------------------------------------------+
465
466 PURPOSE : Process primitive T_DTI2_DATA_TEST_IND
467 */
468
469 GLOBAL void dti_dti_data_test_ind (DTI_HANDLE hDTI,
470 T_DTI2_DATA_TEST_IND *dti_data_test_ind)
471 {
472 #define VSI_CALLER hDTI->handle,
473
474 trace_function(hDTI->handle,
475 "dti_dti_data_test_ind()",
476 hDTI->entity_options);
477
478 if( !(hDTI->entity_options & DTI_NO_TRACE) )
479 {
480 PACCESS (dti_data_test_ind);
481 }
482
483 trace_message_l_dl(hDTI->handle,
484 " IN: DTI2_DATA_TEST_IND",
485 dti_data_test_ind->link_id,
486 (U16)(dti_data_test_ind->sdu.l_buf>>3),
487 hDTI->entity_options);
488
489 data_test_prim_received(hDTI,
490 dti_data_test_ind,
491 DTI_CHANNEL_TO_LOWER_LAYER);
492
493 #undef VSI_CALLER
494 } /* dti_dti_data_test_ind() */
495
496
497
498 /*
499 +--------------------------------------------------------------------+
500 | PROJECT : WAP MODULE : ip_kerp.c |
501 | STATE : code ROUTINE : ker_dti_data_test_req|
502 +--------------------------------------------------------------------+
503
504 PURPOSE : Process primitive T_DTI2_DATA_TEST_REQ
505 */
506
507 GLOBAL void dti_dti_data_test_req (DTI_HANDLE hDTI,
508 T_DTI2_DATA_TEST_REQ *dti_data_test_req)
509 {
510 #define VSI_CALLER hDTI->handle,
511
512 trace_function(hDTI->handle,
513 "dti_dti_data_test_req()",
514 hDTI->entity_options);
515
516 trace_message_l_dl(hDTI->handle,
517 " IN: DTI2_DATA_TEST_IND",
518 dti_data_test_req->link_id,
519 (U16)(dti_data_test_req->sdu.l_buf>>3),
520 hDTI->entity_options);
521
522 if(hDTI->entity_options & DTI_NO_TRACE)
523 {
524 PPASS_NTRACE(dti_data_test_req, dti_data_test_ind, DTI2_DATA_TEST_IND);
525 data_test_prim_received(hDTI,
526 dti_data_test_ind,
527 DTI_CHANNEL_TO_HIGHER_LAYER);
528 }
529 else
530 {
531 PACCESS (dti_data_test_req);
532 {
533 PPASS(dti_data_test_req, dti_data_test_ind, DTI2_DATA_TEST_IND);
534 data_test_prim_received(hDTI,
535 dti_data_test_ind,
536 DTI_CHANNEL_TO_HIGHER_LAYER);
537 }
538 }
539
540 #undef VSI_CALLER
541 } /* dti_dti_data_test_req() */
542
543 #endif /*_SIMULATION_ */