FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/sndcp/sndcp_nds.c @ 183:219afcfc6250
src/g23m-gprs: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Oct 2016 04:24:13 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
182:f02d0a0e1849 | 183:219afcfc6250 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : sndcp_nds.c | |
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 : This modul is part of the entity SNDCP and implements all | |
18 | functions to handles the incoming process internal signals as | |
19 | described in the SDL-documentation (ND-statemachine) | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 | |
24 #define ENTITY_SNDCP | |
25 | |
26 /*==== INCLUDES =============================================================*/ | |
27 | |
28 #include "typedefs.h" /* to get Condat data types */ | |
29 #include "vsi.h" /* to get a lot of macros */ | |
30 #include "macdef.h" | |
31 #include "gsm.h" /* to get a lot of macros */ | |
32 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
33 | |
34 #include "dti.h" | |
35 | |
36 #include "sndcp.h" /* to get the global entity definitions */ | |
37 #include "sndcp_f.h" /* to get the functions to access the global arrays*/ | |
38 #include <string.h> /* to get memcpy() */ | |
39 | |
40 #include "sndcp_mgs.h" /* to get the signals to mg */ | |
41 #include "sndcp_sdas.h" /* to get the signals to sda */ | |
42 | |
43 | |
44 /*==== CONST ================================================================*/ | |
45 | |
46 /*==== LOCAL VARS ===========================================================*/ | |
47 | |
48 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
49 | |
50 /* | |
51 +------------------------------------------------------------------------------ | |
52 | Function : sndcp_reset_nd_nsapi_npdu_num | |
53 +------------------------------------------------------------------------------ | |
54 | Description : reset the npdu_num(N-PDU receive number) to zero in | |
55 | acknowledgement mode | |
56 | | |
57 | Parameters : nsapi number | |
58 | | |
59 +------------------------------------------------------------------------------ | |
60 */ | |
61 | |
62 #ifndef CF_FAST_EXEC | |
63 | |
64 GLOBAL void sndcp_reset_nd_nsapi_npdu_num(UBYTE nsapi) | |
65 { | |
66 TRACE_FUNCTION(" sndcp_reset_nd_nsapi_npdu_num "); | |
67 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
68 sndcp_data->nd->npdu_num = 0; | |
69 } | |
70 #endif /* CF_FAST_EXEC */ | |
71 | |
72 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
73 | |
74 /* | |
75 +------------------------------------------------------------------------------ | |
76 | Function : sig_mg_nd_get_rec_no | |
77 +------------------------------------------------------------------------------ | |
78 | Description : Handles the internal signal SIG_MG_GET_REC_NO | |
79 | | |
80 | Parameters : (UBYTE), the nsapi number to choose the instance | |
81 | | |
82 +------------------------------------------------------------------------------ | |
83 */ | |
84 #ifndef CF_FAST_EXEC | |
85 | |
86 #ifdef SNDCP_UPM_INCLUDED | |
87 GLOBAL U8 sig_mg_nd_get_rec_no (UBYTE nsapi) | |
88 #else | |
89 GLOBAL void sig_mg_nd_get_rec_no (UBYTE nsapi) | |
90 #endif /*SNDCP_UPM_INCLUDED*/ | |
91 { | |
92 TRACE_ISIG( "sig_mg_nd_get_rec_no" ); | |
93 | |
94 /* | |
95 * set service instance according to nsapi in primitive | |
96 */ | |
97 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
98 | |
99 switch( GET_STATE(ND) ) | |
100 { | |
101 case ND_DEFAULT: | |
102 case ND_RECOVER: | |
103 case ND_SUSPEND: | |
104 sig_nd_mg_rec_no(nsapi, sndcp_data->nd->npdu_num); | |
105 break; | |
106 default: | |
107 TRACE_ERROR( "SIG_MG_ND_GET_REC_NO unexpected" ); | |
108 break; | |
109 } | |
110 #ifdef SNDCP_UPM_INCLUDED | |
111 return sndcp_data->nd->npdu_num; | |
112 #endif /*SNDCP_UPM_INCLUDED*/ | |
113 } /* sig_mg_nd_get_rec_no() */ | |
114 | |
115 #endif /* CF_FAST_EXEC */ | |
116 | |
117 | |
118 /* | |
119 +------------------------------------------------------------------------------ | |
120 | Function : sig_mg_nd_recover | |
121 +------------------------------------------------------------------------------ | |
122 | Description : Handles the internal signal SIG_MG_ND_RECOVER | |
123 | | |
124 | Parameters : (UBYTE), the nsapi number to choose the instance | |
125 | | |
126 +------------------------------------------------------------------------------ | |
127 */ | |
128 #ifndef CF_FAST_EXEC | |
129 | |
130 GLOBAL void sig_mg_nd_recover (UBYTE nsapi) | |
131 { | |
132 TRACE_ISIG( "sig_mg_nd_recover" ); | |
133 | |
134 /* | |
135 * set service instance according to nsapi in primitive | |
136 */ | |
137 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
138 | |
139 switch( GET_STATE(ND) ) | |
140 { | |
141 case ND_DEFAULT: | |
142 SET_STATE (ND, ND_RECOVER); | |
143 break; | |
144 case ND_RECOVER: | |
145 case ND_SUSPEND: | |
146 break; | |
147 default: | |
148 TRACE_ERROR( "SIG_MG_ND_RECOVER unexpected" ); | |
149 break; | |
150 } | |
151 } /* sig_mg_nd_recover() */ | |
152 | |
153 #endif /* CF_FAST_EXEC */ | |
154 | |
155 /* | |
156 +------------------------------------------------------------------------------ | |
157 | Function : sig_mg_nd_reset_ind | |
158 +------------------------------------------------------------------------------ | |
159 | Description : Handles the internal signal SIG_MG_ND_RESET_IND | |
160 | | |
161 | Parameters : (UBYTE), the nsapi number to choose the instance | |
162 | | |
163 +------------------------------------------------------------------------------ | |
164 */ | |
165 #ifndef CF_FAST_EXEC | |
166 | |
167 GLOBAL void sig_mg_nd_reset_ind (UBYTE nsapi) | |
168 { | |
169 TRACE_ISIG( "sig_mg_nd_reset_ind" ); | |
170 | |
171 /* | |
172 * set service instance according to nsapi in primitive | |
173 */ | |
174 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
175 | |
176 switch( GET_STATE(ND) ) | |
177 { | |
178 case ND_DEFAULT: | |
179 case ND_RECOVER: | |
180 case ND_SUSPEND: | |
181 break; | |
182 default: | |
183 TRACE_ERROR( "SIG_MG_ND_RESET_IND unexpected" ); | |
184 break; | |
185 } | |
186 } /* sig_mg_nd_reset_ind() */ | |
187 | |
188 #endif /* CF_FAST_EXEC */ | |
189 | |
190 | |
191 /* | |
192 +------------------------------------------------------------------------------ | |
193 | Function : sig_mg_nd_resume | |
194 +------------------------------------------------------------------------------ | |
195 | Description : Handles the internal signal SIG_MG_ND_RESUME | |
196 | | |
197 | Parameters : (UBYTE), the nsapi number to choose the instance | |
198 | | |
199 +------------------------------------------------------------------------------ | |
200 */ | |
201 #ifndef CF_FAST_EXEC | |
202 | |
203 GLOBAL void sig_mg_nd_resume (UBYTE nsapi) | |
204 { | |
205 TRACE_ISIG( "sig_mg_nd_resume" ); | |
206 | |
207 /* | |
208 * set service instance according to nsapi in primitive | |
209 */ | |
210 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
211 | |
212 switch( GET_STATE(ND) ) | |
213 { | |
214 case ND_SUSPEND: | |
215 SET_STATE (ND, ND_RECOVER); | |
216 break; | |
217 default: | |
218 TRACE_ERROR( "SIG_MG_ND_RESUME unexpected" ); | |
219 break; | |
220 } | |
221 } /* sig_mg_nd_resume() */ | |
222 | |
223 #endif /* CF_FAST_EXEC */ | |
224 | |
225 /* | |
226 +------------------------------------------------------------------------------ | |
227 | Function : sig_mg_nd_suspend | |
228 +------------------------------------------------------------------------------ | |
229 | Description : Handles the internal signal SIG_MG_ND_SUSPEND | |
230 | | |
231 | Parameters : (UBYTE), the nsapi number to choose the instance | |
232 | | |
233 +------------------------------------------------------------------------------ | |
234 */ | |
235 #ifndef CF_FAST_EXEC | |
236 | |
237 GLOBAL void sig_mg_nd_suspend (UBYTE nsapi) | |
238 { | |
239 TRACE_ISIG( "sig_mg_nd_suspend" ); | |
240 | |
241 /* | |
242 * set service instance according to nsapi in primitive | |
243 */ | |
244 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
245 | |
246 switch( GET_STATE(ND) ) | |
247 { | |
248 case ND_DEFAULT: | |
249 case ND_RECOVER: | |
250 SET_STATE(ND, ND_SUSPEND); | |
251 break; | |
252 default: | |
253 TRACE_ERROR( "SIG_MG_ND_SUSPEND unexpected" ); | |
254 break; | |
255 } | |
256 } /* sig_mg_nd_suspend() */ | |
257 | |
258 #endif /* CF_FAST_EXEC */ | |
259 | |
260 /* | |
261 +------------------------------------------------------------------------------ | |
262 | Function : sig_sd_nd_unitdata_ind | |
263 +------------------------------------------------------------------------------ | |
264 | Description : Handles the internal signal SIG_SD_ND_UNITDATA_IND | |
265 | | |
266 | Parameters : nsapi number, | |
267 | T_SN_UNITDATA_IND, N-PDU to be sent to nsapidown in form | |
268 | of primitive struct | |
269 | | |
270 +------------------------------------------------------------------------------ | |
271 */ | |
272 /*#if defined(CF_FAST_EXEC) || defined(_SIMULATION_) || \ | |
273 !defined(SNDCP_UPM_INCLUDED) || defined(SNDCP_2to1) */ | |
274 | |
275 GLOBAL void sig_sd_nd_unitdata_ind (UBYTE nsapi, | |
276 T_SN_UNITDATA_IND* sn_unitdata_ind) | |
277 { | |
278 #ifdef _SNDCP_DTI_2_ | |
279 ULONG linkid = 0; | |
280 #endif /*_SNDCP_DTI_2_*/ | |
281 TRACE_ISIG( "sig_sd_nd_unitdata_ind" ); | |
282 | |
283 | |
284 #ifdef _SNDCP_MEAN_TRACE_ | |
285 #ifdef _SNDCP_DTI_2_ | |
286 sndcp_mean_trace(nsapi, | |
287 SNDCP_MEAN_DOWN, | |
288 SNDCP_MEAN_UNACK, | |
289 sn_unitdata_ind->desc_list2.list_len); | |
290 #else /*_SNDCP_DTI_2_*/ | |
291 sndcp_mean_trace(nsapi, | |
292 SNDCP_MEAN_DOWN, | |
293 SNDCP_MEAN_UNACK, | |
294 sn_unitdata_ind->desc_list.list_len); | |
295 #endif /*_SNDCP_DTI_2_*/ | |
296 | |
297 #endif /* _SNDCP_MEAN_TRACE_ */ | |
298 | |
299 /* | |
300 * set service instance according to nsapi in primitive | |
301 */ | |
302 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
303 | |
304 | |
305 #ifdef SNDCP_TRACE_IP_DATAGRAM | |
306 if(sndcp_data->trace_ip_header || sndcp_data->trace_ip_datagram){ | |
307 TRACE_EVENT("-------- Downlink IP datagram --------"); | |
308 #ifdef _SNDCP_DTI_2_ | |
309 sndcp_trace_ip_datagram(& sn_unitdata_ind->desc_list2); | |
310 #else /*_SNDCP_DTI_2_*/ | |
311 sndcp_trace_ip_datagram(& sn_unitdata_ind->desc_list); | |
312 #endif /*_SNDCP_DTI_2_*/ | |
313 TRACE_EVENT("--------------------------------------"); | |
314 } else { | |
315 #ifdef _SNDCP_DTI_2_ | |
316 sndcp_default_ip_trace(& sn_unitdata_ind->desc_list2, SNDCP_DL_PACKET); | |
317 #else /*_SNDCP_DTI_2_*/ | |
318 sndcp_default_ip_trace(& sn_unitdata_ind->desc_list, SNDCP_DL_PACKET); | |
319 #endif /*_SNDCP_DTI_2_*/ | |
320 } | |
321 if(sndcp_data->trace_ip_bin){ | |
322 #ifdef _SNDCP_DTI_2_ | |
323 sndcp_bin_trace_ip(& sn_unitdata_ind->desc_list2, SNDCP_DL_PACKET); | |
324 #else /*_SNDCP_DTI_2_*/ | |
325 sndcp_bin_trace_ip(& sn_unitdata_ind->desc_list, SNDCP_DL_PACKET); | |
326 #endif /*_SNDCP_DTI_2_*/ | |
327 } | |
328 | |
329 #else /* SNDCP_TRACE_IP_DATAGRAM */ | |
330 | |
331 #ifdef SNDCP_TRACE_BUFFER | |
332 #ifdef _SNDCP_DTI_2_ | |
333 TRACE_EVENT_P1("downlink at SN SAP: %d octets", | |
334 sn_unitdata_ind->desc_list2.list_len); | |
335 sndcp_trace_desc_list(& sn_unitdata_ind->desc_list2); | |
336 #else /*_SNDCP_DTI_2_*/ | |
337 TRACE_EVENT_P1("downlink at SN SAP: %d octets", | |
338 sn_unitdata_ind->desc_list.list_len); | |
339 sndcp_trace_desc_list(& sn_unitdata_ind->desc_list); | |
340 #endif /*_SNDCP_DTI_2_*/ | |
341 #endif /* SNDCP_TRACE_BUFFER */ | |
342 #endif /* SNDCP_TRACE_IP_DATAGRAM */ | |
343 | |
344 | |
345 switch( GET_STATE(ND) ) | |
346 { | |
347 case ND_DEFAULT: | |
348 | |
349 #ifdef _SNDCP_DTI_2_ | |
350 | |
351 /* | |
352 * Copy sn_unitdata_ind to dti2_data_ind. | |
353 */ | |
354 { | |
355 PALLOC_DESC2(dti_data_ind, DTI2_DATA_IND); | |
356 | |
357 sndcp_get_nsapi_linkid(nsapi, &linkid); | |
358 dti_data_ind->link_id = linkid; | |
359 dti_data_ind->parameters.p_id = sn_unitdata_ind->p_id; | |
360 dti_data_ind->parameters.st_lines.st_flow = 0; | |
361 dti_data_ind->parameters.st_lines.st_line_sa = 0; | |
362 dti_data_ind->parameters.st_lines.st_line_sb = 0; | |
363 dti_data_ind->parameters.st_lines.st_break_len = 0; | |
364 dti_data_ind->desc_list2 = sn_unitdata_ind->desc_list2; | |
365 | |
366 /* | |
367 * Free the received test primitive. | |
368 */ | |
369 MFREE (sn_unitdata_ind); | |
370 sn_unitdata_ind = NULL; | |
371 | |
372 dti_send_data(sndcp_data->hDTI, /* DTI_HANDLE hDTI, */ | |
373 0, /* U8 instance, */ | |
374 SNDCP_INTERFACE_UNACK, /* U8 interface, */ | |
375 nsapi,/* U8 channel, */ | |
376 dti_data_ind /* T_DTI2_DATA_IND *dti_data_ind);*/ | |
377 ); | |
378 | |
379 } | |
380 | |
381 #else /*_SNDCP_DTI_2_*/ | |
382 /* | |
383 * Copy sn_unitdata_ind to dti_data_ind. | |
384 */ | |
385 { | |
386 /* | |
387 * Copy sn_data_req_test to dti_data_ind. | |
388 */ | |
389 PALLOC_DESC(dti_data_ind, DTI_DATA_IND); | |
390 | |
391 dti_data_ind->p_id = sn_unitdata_ind->p_id; | |
392 dti_data_ind->desc_list = sn_unitdata_ind->desc_list; | |
393 dti_data_ind->op_ack = OP_ACK; | |
394 | |
395 /* | |
396 * Free the received test primitive. | |
397 */ | |
398 MFREE (sn_unitdata_ind); | |
399 sn_unitdata_ind = NULL; | |
400 | |
401 /* | |
402 * Trace p_id. | |
403 */ | |
404 | |
405 #ifdef SNDCP_TRACE_ALL | |
406 switch (dti_data_ind->p_id) { | |
407 case DTI_PID_IP: | |
408 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
409 dti_data_ind->p_id, | |
410 "DTI_PID_IP"); | |
411 break; | |
412 case DTI_PID_CTCP: | |
413 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
414 dti_data_ind->p_id, | |
415 "DTI_PID_CTCP"); | |
416 break; | |
417 case DTI_PID_UTCP: | |
418 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
419 dti_data_ind->p_id, | |
420 "DTI_PID_UTCP"); | |
421 break; | |
422 case DTI_PID_FRAME: | |
423 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
424 dti_data_ind->p_id, | |
425 "DTI_PID_FRAME"); | |
426 break; | |
427 default: | |
428 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
429 dti_data_ind->p_id, | |
430 "unknown"); | |
431 | |
432 | |
433 } | |
434 #endif /* SNDCP_TRACE_ALL */ | |
435 dti_send_data(sndcp_data->hDTI, /* DTI_HANDLE hDTI, */ | |
436 0, /* U8 instance, */ | |
437 SNDCP_INTERFACE_UNACK, /* U8 interface, */ | |
438 nsapi,/* U8 channel, */ | |
439 dti_data_ind /* T_DTI2_DATA_IND *dti_data_ind);*/ | |
440 ); | |
441 | |
442 } | |
443 #endif /*_SNDCP_DTI_2_*/ | |
444 break; | |
445 default: | |
446 if (sn_unitdata_ind != NULL) { | |
447 #ifdef _SNDCP_DTI_2_ | |
448 MFREE_PRIM (sn_unitdata_ind); | |
449 #else /*_SNDCP_DTI_2_*/ | |
450 PFREE_DESC (sn_unitdata_ind); | |
451 #endif /*_SNDCP_DTI_2_*/ | |
452 } | |
453 TRACE_ERROR( "SIG_SD_ND_UNITDATA_IND unexpected" ); | |
454 break; | |
455 } | |
456 } /* sig_sd_nd_unitdata_ind() */ | |
457 | |
458 /*#endif *//* CF_FAST_EXEC || _SIMULATION_ || !SNDCP_UPM_INCLUDED || SNDCP_2to1 */ | |
459 | |
460 /* | |
461 +------------------------------------------------------------------------------ | |
462 | Function : sig_sda_nd_data_ind | |
463 +------------------------------------------------------------------------------ | |
464 | Description : Handles the internal signal SIG_SDA_ND_DATA_IND | |
465 | | |
466 | Parameters : nsapi number, | |
467 | T_SN_DATA_IND, N-PDU to be sent to nsapidown in form | |
468 | of primitive struct, | |
469 | npdu number | |
470 | | |
471 +------------------------------------------------------------------------------ | |
472 */ | |
473 #ifndef CF_FAST_EXEC | |
474 | |
475 GLOBAL void sig_sda_nd_data_ind (UBYTE nsapi, | |
476 T_SN_DATA_IND* sn_data_ind, | |
477 UBYTE npdu_number) | |
478 { | |
479 #ifdef _SNDCP_DTI_2_ | |
480 ULONG linkid = 0; | |
481 #endif /*_SNDCP_DTI_2_*/ | |
482 UBYTE sapi = 0; | |
483 | |
484 TRACE_ISIG( "sig_sda_nd_data_ind" ); | |
485 | |
486 #ifdef _SNDCP_MEAN_TRACE_ | |
487 #ifdef _SNDCP_DTI_2_ | |
488 sndcp_mean_trace(nsapi, | |
489 SNDCP_MEAN_DOWN, | |
490 SNDCP_MEAN_ACK, | |
491 sn_data_ind->desc_list2.list_len); | |
492 #else /*_SNDCP_DTI_2_*/ | |
493 sndcp_mean_trace(nsapi, | |
494 SNDCP_MEAN_DOWN, | |
495 SNDCP_MEAN_ACK, | |
496 sn_data_ind->desc_list.list_len); | |
497 #endif /*_SNDCP_DTI_2_*/ | |
498 #endif /* _SNDCP_MEAN_TRACE_ */ | |
499 | |
500 | |
501 /* | |
502 * set service instance according to nsapi in primitive | |
503 */ | |
504 sndcp_data->nd = & sndcp_data->nd_base[nsapi]; | |
505 | |
506 #ifdef SNDCP_TRACE_IP_DATAGRAM | |
507 if(sndcp_data->trace_ip_header || sndcp_data->trace_ip_datagram){ | |
508 TRACE_EVENT("-------- Downlink IP datagram --------"); | |
509 #ifdef _SNDCP_DTI_2_ | |
510 sndcp_trace_ip_datagram(& sn_data_ind->desc_list2); | |
511 #else /*_SNDCP_DTI_2_*/ | |
512 sndcp_trace_ip_datagram(& sn_data_ind->desc_list); | |
513 #endif /*_SNDCP_DTI_2_*/ | |
514 TRACE_EVENT("--------------------------------------"); | |
515 } else { | |
516 #ifdef _SNDCP_DTI_2_ | |
517 sndcp_default_ip_trace(& sn_data_ind->desc_list2, SNDCP_DL_PACKET); | |
518 #else /*_SNDCP_DTI_2_*/ | |
519 sndcp_default_ip_trace(& sn_data_ind->desc_list, SNDCP_DL_PACKET); | |
520 #endif /*_SNDCP_DTI_2_*/ | |
521 } | |
522 if(sndcp_data->trace_ip_bin){ | |
523 #ifdef _SNDCP_DTI_2_ | |
524 sndcp_bin_trace_ip(& sn_data_ind->desc_list2, SNDCP_DL_PACKET); | |
525 #else /*_SNDCP_DTI_2_*/ | |
526 sndcp_bin_trace_ip(& sn_data_ind->desc_list, SNDCP_DL_PACKET); | |
527 #endif /*_SNDCP_DTI_2_*/ | |
528 } | |
529 #else /* SNDCP_TRACE_IP_DATAGRAM */ | |
530 | |
531 #ifdef SNDCP_TRACE_BUFFER | |
532 #ifdef _SNDCP_DTI_2_ | |
533 TRACE_EVENT_P1("downlink at SN SAP: %d octets", | |
534 sn_data_ind->desc_list2.list_len); | |
535 sndcp_trace_desc_list(& sn_data_ind->desc_list2); | |
536 #else /*_SNDCP_DTI_2_*/ | |
537 TRACE_EVENT_P1("downlink at SN SAP: %d octets", | |
538 sn_data_ind->desc_list.list_len); | |
539 sndcp_trace_desc_list(& sn_data_ind->desc_list); | |
540 #endif /*_SNDCP_DTI_2_*/ | |
541 #endif /* SNDCP_TRACE_BUFFER */ | |
542 #endif /* SNDCP_TRACE_IP_DATAGRAM */ | |
543 | |
544 | |
545 switch( GET_STATE(ND) ) | |
546 { | |
547 case ND_DEFAULT: | |
548 sndcp_data->nd->npdu_num++; | |
549 | |
550 #ifdef _SNDCP_DTI_2_ | |
551 /* | |
552 * Copy sn_unitdata_ind to dti_data_ind. | |
553 */ | |
554 { | |
555 /* | |
556 * Copy sn_data_req_test to dti_data_ind. | |
557 */ | |
558 PALLOC_DESC2(dti_data_ind, DTI2_DATA_IND); | |
559 | |
560 sndcp_get_nsapi_linkid(nsapi, &linkid); | |
561 dti_data_ind->link_id = linkid; | |
562 dti_data_ind->parameters.p_id = sn_data_ind->p_id; | |
563 dti_data_ind->parameters.st_lines.st_flow = 0; | |
564 dti_data_ind->parameters.st_lines.st_line_sa = 0; | |
565 dti_data_ind->parameters.st_lines.st_line_sb = 0; | |
566 dti_data_ind->parameters.st_lines.st_break_len = 0; | |
567 dti_data_ind->desc_list2 = sn_data_ind->desc_list2; | |
568 | |
569 /* | |
570 * Free the received test primitive. | |
571 */ | |
572 MFREE (sn_data_ind); | |
573 sn_data_ind = NULL; | |
574 | |
575 /* | |
576 * Trace p_id. | |
577 */ | |
578 #ifdef SNDCP_TRACE_ALL | |
579 switch (dti_data_ind->parameters.p_id) { | |
580 case DTI_PID_IP: | |
581 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
582 dti_data_ind->parameters.p_id, | |
583 "DTI_PID_IP"); | |
584 break; | |
585 case DTI_PID_CTCP: | |
586 TRACE_EVENT_P2("dti_data_ind->parameters.p_id: %02x (%s)", | |
587 dti_data_ind->parameters.p_id, | |
588 "DTI_PID_CTCP"); | |
589 break; | |
590 case DTI_PID_UTCP: | |
591 TRACE_EVENT_P2("dti_data_ind->parameters.p_id: %02x (%s)", | |
592 dti_data_ind->parameters.p_id, | |
593 "DTI_PID_UTCP"); | |
594 break; | |
595 case DTI_PID_UOS: | |
596 TRACE_EVENT_P2("dti_data_ind->parameters.p_id: %02x (%s)", | |
597 dti_data_ind->parameters.p_id, | |
598 "DTI_PID_FRAME"); | |
599 break; | |
600 default: | |
601 TRACE_EVENT_P2("dti_data_ind->parameters.p_id: %02x (%s)", | |
602 dti_data_ind->parameters.p_id, | |
603 "unknown"); | |
604 | |
605 | |
606 } | |
607 #endif /* SNDCP_TRACE_ALL */ | |
608 | |
609 dti_send_data(sndcp_data->hDTI, /* DTI_HANDLE hDTI, */ | |
610 0, /* U8 instance, */ | |
611 #ifdef SNDCP_UPM_INCLUDED | |
612 SNDCP_INTERFACE_UNACK, /* U8 interface, */ | |
613 #else | |
614 SNDCP_INTERFACE_ACK, /* U8 interface, */ | |
615 #endif | |
616 nsapi,/* U8 channel, */ | |
617 dti_data_ind /* T_DTI2_DATA_IND *dti_data_ind);*/ | |
618 ); | |
619 | |
620 } | |
621 | |
622 #else /*_SNDCP_DTI_2_*/ | |
623 /* | |
624 * Copy sn_unitdata_ind to dti_data_ind. | |
625 */ | |
626 { | |
627 /* | |
628 * Copy sn_data_req_test to dti_data_ind. | |
629 */ | |
630 PALLOC_DESC(dti_data_ind, DTI_DATA_IND); | |
631 | |
632 dti_data_ind->p_id = sn_data_ind->p_id; | |
633 dti_data_ind->desc_list = sn_data_ind->desc_list; | |
634 dti_data_ind->op_ack = OP_ACK; | |
635 | |
636 /* | |
637 * Free the received test primitive. | |
638 */ | |
639 MFREE (sn_data_ind); | |
640 sn_data_ind = NULL; | |
641 | |
642 /* | |
643 * Trace p_id. | |
644 */ | |
645 #ifdef SNDCP_TRACE_ALL | |
646 switch (dti_data_ind->p_id) { | |
647 case DTI_PID_IP: | |
648 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
649 dti_data_ind->p_id, | |
650 "DTI_PID_IP"); | |
651 break; | |
652 case DTI_PID_CTCP: | |
653 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
654 dti_data_ind->p_id, | |
655 "DTI_PID_CTCP"); | |
656 break; | |
657 case DTI_PID_UTCP: | |
658 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
659 dti_data_ind->p_id, | |
660 "DTI_PID_UTCP"); | |
661 break; | |
662 case DTI_PID_FRAME: | |
663 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
664 dti_data_ind->p_id, | |
665 "DTI_PID_FRAME"); | |
666 break; | |
667 default: | |
668 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
669 dti_data_ind->p_id, | |
670 "unknown"); | |
671 | |
672 | |
673 } | |
674 #endif /* SNDCP_TRACE_ALL */ | |
675 | |
676 dti_send_data(sndcp_data->hDTI, /* DTI_HANDLE hDTI, */ | |
677 0, /* U8 instance, */ | |
678 SNDCP_INTERFACE_ACK, /* U8 interface, */ | |
679 nsapi,/* U8 channel, */ | |
680 dti_data_ind /* T_DTI2_DATA_IND *dti_data_ind);*/ | |
681 ); | |
682 | |
683 } | |
684 #endif /*_SNDCP_DTI_2_*/ | |
685 | |
686 break; | |
687 case ND_RECOVER: | |
688 if (sndcp_data->nd->npdu_num == npdu_number) { | |
689 sndcp_data->nd->npdu_num++; | |
690 SET_STATE(ND, ND_DEFAULT); | |
691 | |
692 #ifdef _SNDCP_DTI_2_ | |
693 /* | |
694 * Copy sn_unitdata_ind to dti_data_ind. | |
695 */ | |
696 { | |
697 /* | |
698 * Copy sn_data_req_test to dti_data_ind. | |
699 */ | |
700 PALLOC_DESC2(dti_data_ind, DTI2_DATA_IND); | |
701 | |
702 sndcp_get_nsapi_linkid(nsapi, &linkid); | |
703 dti_data_ind->link_id = linkid; | |
704 dti_data_ind->parameters.p_id = sn_data_ind->p_id; | |
705 dti_data_ind->parameters.st_lines.st_flow = 0; | |
706 dti_data_ind->parameters.st_lines.st_line_sa = 0; | |
707 dti_data_ind->parameters.st_lines.st_line_sb = 0; | |
708 dti_data_ind->parameters.st_lines.st_break_len = 0; | |
709 dti_data_ind->desc_list2 = sn_data_ind->desc_list2; | |
710 | |
711 /* | |
712 * Free the received test primitive. | |
713 */ | |
714 MFREE (sn_data_ind); | |
715 sn_data_ind = NULL; | |
716 | |
717 dti_send_data(sndcp_data->hDTI, /* DTI_HANDLE hDTI, */ | |
718 0, /* U8 instance, */ | |
719 #ifdef SNDCP_UPM_INCLUDED | |
720 SNDCP_INTERFACE_UNACK, /* U8 interface, */ | |
721 #else | |
722 SNDCP_INTERFACE_ACK, /* U8 interface, */ | |
723 #endif | |
724 nsapi,/* U8 channel, */ | |
725 dti_data_ind /* T_DTI2_DATA_IND *dti_data_ind);*/ | |
726 ); | |
727 } | |
728 | |
729 #else /*_SNDCP_DTI_2_*/ | |
730 | |
731 /* | |
732 * Copy sn_unitdata_ind to dti_data_ind. | |
733 */ | |
734 { | |
735 /* | |
736 * Copy sn_data_req_test to dti_data_ind. | |
737 */ | |
738 PALLOC_DESC(dti_data_ind, DTI_DATA_IND); | |
739 | |
740 dti_data_ind->p_id = sn_data_ind->p_id; | |
741 dti_data_ind->desc_list = sn_data_ind->desc_list; | |
742 dti_data_ind->op_ack = OP_ACK; | |
743 | |
744 /* | |
745 * Free the received test primitive. | |
746 */ | |
747 MFREE (sn_data_ind); | |
748 sn_data_ind = NULL; | |
749 | |
750 /* | |
751 * Trace p_id. | |
752 */ | |
753 #ifdef SNDCP_TRACE_ALL | |
754 switch (dti_data_ind->p_id) { | |
755 case DTI_PID_IP: | |
756 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
757 dti_data_ind->p_id, | |
758 "DTI_PID_IP"); | |
759 break; | |
760 case DTI_PID_CTCP: | |
761 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
762 dti_data_ind->p_id, | |
763 "DTI_PID_CTCP"); | |
764 break; | |
765 case DTI_PID_UTCP: | |
766 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
767 dti_data_ind->p_id, | |
768 "DTI_PID_UTCP"); | |
769 break; | |
770 case DTI_PID_FRAME: | |
771 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
772 dti_data_ind->p_id, | |
773 "DTI_PID_FRAME"); | |
774 break; | |
775 default: | |
776 TRACE_EVENT_P2("dti_data_ind->p_id: %02x (%s)", | |
777 dti_data_ind->p_id, | |
778 "unknown"); | |
779 | |
780 | |
781 } | |
782 #endif /* SNDCP_TRACE_ALL */ | |
783 | |
784 dti_send_data(sndcp_data->hDTI, /* DTI_HANDLE hDTI, */ | |
785 0, /* U8 instance, */ | |
786 SNDCP_INTERFACE_ACK, /* U8 interface, */ | |
787 nsapi,/* U8 channel, */ | |
788 dti_data_ind /* T_DTI2_DATA_IND *dti_data_ind);*/ | |
789 ); | |
790 } | |
791 | |
792 #endif /*_SNDCP_DTI_2_*/ | |
793 } | |
794 else | |
795 { | |
796 /* | |
797 * Discard primitive. | |
798 */ | |
799 if (sn_data_ind != NULL) { | |
800 #ifdef _SNDCP_DTI_2_ | |
801 MFREE_PRIM(sn_data_ind); | |
802 #else /*_SNDCP_DTI_2_*/ | |
803 PFREE_DESC(sn_data_ind); | |
804 #endif /*_SNDCP_DTI_2_*/ | |
805 sn_data_ind = NULL; | |
806 } | |
807 /* | |
808 * Request next from sda. | |
809 */ | |
810 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
811 sig_nd_sda_getdata_req(sapi, nsapi); | |
812 }; | |
813 | |
814 break; | |
815 case ND_SUSPEND: | |
816 /* | |
817 * Discard primitive. | |
818 */ | |
819 if (sn_data_ind != NULL) { | |
820 #ifdef _SNDCP_DTI_2_ | |
821 MFREE_PRIM(sn_data_ind); | |
822 #else /*_SNDCP_DTI_2_*/ | |
823 PFREE_DESC(sn_data_ind); | |
824 #endif /*_SNDCP_DTI_2_*/ | |
825 sn_data_ind = NULL; | |
826 } | |
827 /* | |
828 * Request next from sda. | |
829 */ | |
830 sndcp_get_nsapi_sapi(nsapi, &sapi); | |
831 sig_nd_sda_getdata_req(sapi, nsapi); | |
832 break; | |
833 default: | |
834 TRACE_ERROR( "SIG_SDA_ND_DATA_IND unexpected" ); | |
835 #ifdef _SNDCP_DTI_2_ | |
836 MFREE_PRIM(sn_data_ind); | |
837 #else /*_SNDCP_DTI_2_*/ | |
838 PFREE_DESC(sn_data_ind); | |
839 #endif /*_SNDCP_DTI_2_*/ | |
840 sn_data_ind = NULL; | |
841 break; | |
842 } | |
843 } /* sig_sda_nd_data_ind() */ | |
844 | |
845 #endif /* CF_FAST_EXEC */ | |
846 |