comparison src/g23m-gprs/sndcp/sndcp_nus.c @ 1:d393cd9bb723

src/g23m-*: initial import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 04:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
0:b6a5e36de839 1:d393cd9bb723
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GPRS (8441)
4 | Modul : sndcp_nus.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 (NU-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 /*---- HISTORY --------------------------------------------------------------*/
24
25 #define ENTITY_SNDCP
26
27 /*==== INCLUDES =============================================================*/
28
29 #include "typedefs.h" /* to get Condat data types */
30 #include "vsi.h" /* to get a lot of macros */
31 #include "macdef.h"
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
39 #include "sndcp_nuf.h" /* to get internal functions for service nu. */
40 #include "sndcp_suas.h" /* to get signals to sua. */
41
42 /*==== CONST ================================================================*/
43
44 /*==== LOCAL VARS ===========================================================*/
45
46 /*==== PRIVATE FUNCTIONS ====================================================*/
47
48 /*
49 +------------------------------------------------------------------------------
50 | Function : nu_send_pending
51 +------------------------------------------------------------------------------
52 | Description : Re-sends the next not yet acknowledged N-PDU. If this was the
53 | last one, ready is set to TRUE, otherwise to FALSE.
54 | Ready is also set to TRUE, if there is no pending NPDU at all.
55 |
56 | Parameters : ready
57 | Pre : correct instance of nu service is active.
58 |
59 +------------------------------------------------------------------------------
60 */
61 #ifndef CF_FAST_EXEC
62
63 LOCAL void nu_send_pending (BOOL* ready)
64 {
65 T_SN_DATA_REQ* sn_data_req = NULL;
66 UBYTE npdu_number = 0;
67 UBYTE sapi = 0;
68
69 TRACE_FUNCTION( "nu_send_pending" );
70
71 if (sndcp_data->nu->next_resend == NULL) {
72 *ready = TRUE;
73 return;
74 }
75 sn_data_req = sndcp_data->nu->next_resend->sn_data_req;
76 sndcp_get_nsapi_sapi(sndcp_data->nu->nsapi, &sapi);
77 npdu_number = sndcp_data->nu->next_resend->npdu_number;
78
79
80 /*
81 * Set next_resend to the next one if possible.
82 */
83 if (sndcp_data->nu->next_resend->next == NULL) {
84 *ready = TRUE;
85 SET_STATE(NU, NU_ACK_SUA_NOT_RECEPTIVE);
86 } else {
87 *ready = FALSE;
88 sndcp_data->nu->next_resend = sndcp_data->nu->next_resend->next;
89 SET_STATE(NU, NU_REC_SUA_NOT_RECEPTIVE);
90 }
91
92 sig_nu_sua_data_req(sn_data_req,
93 npdu_number,
94 sndcp_data->nu->nsapi,
95 sapi);
96
97 } /* nu_send_pending() */
98
99 #endif /* CF_FAST_EXEC */
100
101 /*
102 +------------------------------------------------------------------------------
103 | Function : nu_config_send_pending
104 +------------------------------------------------------------------------------
105 | Description : Re-sends the next not yet acknowledged N-PDU. If this was the
106 | last one, ready is set to TRUE, otherwise to FALSE.
107 | Ready is also set to TRUE, if there is no pending NPDU at all.
108 | The same function as nu_send_pending, but for tests with config send.
109 |
110 | Parameters : ready
111 | Pre : correct instance of nu service is active.
112 |
113 +------------------------------------------------------------------------------
114 */
115 #ifndef CF_FAST_EXEC
116 #ifndef NCONFIG
117
118 LOCAL void nu_config_send_pending (BOOL* ready)
119 {
120 T_SN_DATA_REQ* sn_data_req = NULL;
121 UBYTE npdu_number = 0;
122 UBYTE sapi = 0;
123
124 TRACE_FUNCTION( "nu_config_send_pending" );
125
126 if (sndcp_data->nu->next_resend == NULL) {
127 *ready = TRUE;
128 return;
129 }
130 sn_data_req = sndcp_data->nu->next_resend->sn_data_req;
131 sndcp_get_nsapi_sapi(sndcp_data->nu->nsapi, &sapi);
132 npdu_number = sndcp_data->nu->next_resend->npdu_number;
133
134 /*
135 * Set next_resend to the next one if possible.
136 */
137 if (sndcp_data->nu->next_resend->next == NULL) {
138 *ready = TRUE;
139 SET_STATE(NU, NU_SEND_ACK_SUA_NOT_RECEPTIVE);
140 } else {
141 *ready = FALSE;
142 sndcp_data->nu->next_resend = sndcp_data->nu->next_resend->next;
143 SET_STATE(NU, NU_SEND_REC_SUA_NOT_RECEPTIVE);
144 }
145 sig_nu_sua_data_req(sn_data_req,
146 npdu_number,
147 sndcp_data->nu->nsapi,
148 sapi);
149
150 } /* nu_config_send_pending() */
151
152 #endif /* NCONFIG */
153 #endif /* CF_FAST_EXEC */
154
155 /*==== PUBLIC FUNCTIONS =====================================================*/
156
157
158 /*
159 +------------------------------------------------------------------------------
160 | Function : sig_mg_nu_delete_npdus
161 +------------------------------------------------------------------------------
162 | Description : Handles the internal signal SIG_MG_NU_DELETE_NPDUS. All the
163 | buffered N-PDUs waiting for confirmation are deleted.
164 |
165 | Parameters : UBYTE nsapi: the affected NSAPI
166 |
167 +------------------------------------------------------------------------------
168 */
169 #ifndef CF_FAST_EXEC
170
171 GLOBAL void sig_mg_nu_delete_npdus (UBYTE nsapi)
172 {
173 TRACE_ISIG( "sig_mg_nu_delete_npdus" );
174 /*
175 * set service instance according to nsapi in primitive
176 */
177 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
178
179 switch( GET_STATE( NU ) )
180 {
181 case NU_ACK_SUA_NOT_RECEPTIVE:
182 case NU_ACK_SUA_RECEPTIVE:
183 case NU_SUS_SUA_NOT_RECEPTIVE:
184 case NU_SUS_SUA_RECEPTIVE:
185 case NU_REC_SUA_NOT_RECEPTIVE:
186 nu_delete_npdus();
187 break;
188
189 case NU_UNACK_SU_RECEPTIVE :
190 case NU_UNACK_SU_NOT_RECEPTIVE:
191 #ifndef NCONFIG
192 case NU_SEND_UNACK_SU_RECEPTIVE:
193 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
194 case NU_SEND_ACK_SUA_RECEPTIVE:
195 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
196 case NU_SEND_SUS_SUA_RECEPTIVE:
197 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
198 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
199 #endif
200 break;
201 default:
202 TRACE_ERROR( "SIG_SU_NU_DELETE_NPDUS unexpected" );
203 break;
204 }
205 } /* sig_mg_nu_delete_npdus() */
206
207 #endif /* CF_FAST_EXEC */
208
209 /*
210 +------------------------------------------------------------------------------
211 | Function : sig_mg_nu_delete_to
212 +------------------------------------------------------------------------------
213 | Description : Handles the internal signal SIG_MG_NU_DELETE_TO. All the
214 | buffered N-PDUs waiting for confirmation are deleted until the
215 | N-PDU with the given number is reached, beacuse this is the one
216 | that is expected atthe peer side..
217 |
218 | Parameters : naspi, npdu_num
219 |
220 +------------------------------------------------------------------------------
221 */
222 #ifndef CF_FAST_EXEC
223
224 GLOBAL void sig_mg_nu_delete_to (UBYTE nsapi, UBYTE npdu_num)
225 {
226 T_NPDU_BUFFER* help = NULL;
227 /*
228 * Has npdu number been found?
229 */
230 BOOL found = FALSE;
231
232 TRACE_ISIG( "sig_mg_nu_delete_to" );
233
234 /*
235 * set service instance according to nsapi in primitive
236 */
237 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
238
239 switch( GET_STATE( NU ) )
240 {
241 case NU_ACK_SUA_NOT_RECEPTIVE:
242 case NU_ACK_SUA_RECEPTIVE:
243 case NU_SUS_SUA_NOT_RECEPTIVE:
244 case NU_SUS_SUA_RECEPTIVE:
245 case NU_REC_SUA_NOT_RECEPTIVE:
246
247 help = sndcp_data->nu->first_buffered_npdu;
248 while (help != NULL && ! found) {
249 T_NPDU_BUFFER* buf = help;
250
251 help = help->next;
252 if (buf->npdu_number == npdu_num) {
253 found = TRUE;
254 } else {
255 nu_delete_npdu(nsapi, buf->npdu_number);
256 }
257 }
258 break;
259 case NU_UNACK_SU_RECEPTIVE :
260 case NU_UNACK_SU_NOT_RECEPTIVE:
261 #ifndef NCONFIG
262 case NU_SEND_UNACK_SU_RECEPTIVE:
263 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
264 case NU_SEND_ACK_SUA_RECEPTIVE:
265 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
266 case NU_SEND_SUS_SUA_RECEPTIVE:
267 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
268 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
269 #endif
270 break;
271 default:
272 TRACE_ERROR( "SIG_MG_NU_DELETE_TO unexpected" );
273 break;
274 }
275 } /* sig_mg_nu_delete_to() */
276
277 #endif /* CF_FAST_EXEC */
278
279
280 /*
281 +------------------------------------------------------------------------------
282 | Function : sig_mg_nu_recover
283 +------------------------------------------------------------------------------
284 | Description : Handles the internal signal SIG_MG_NU_RECOVER.
285 |
286 | Parameters : UBYTE nsapi: the affected NSAPI
287 |
288 +------------------------------------------------------------------------------
289 */
290 #ifndef CF_FAST_EXEC
291
292 GLOBAL void sig_mg_nu_recover (UBYTE nsapi)
293 {
294 BOOL ready = FALSE;
295
296 TRACE_ISIG( "sig_mg_nu_recover" );
297
298 /*
299 * set service instance according to nsapi in primitive
300 */
301 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
302 /*
303 * If there is resend, start with first pdu!
304 */
305 sndcp_data->nu->next_resend = sndcp_data->nu->first_buffered_npdu;
306
307 switch( GET_STATE( NU ) )
308 {
309 case NU_ACK_SUA_NOT_RECEPTIVE:
310 /*
311 * Is there at least 1 not yet acknowledged N-PDU?
312 */
313 if (sndcp_data->nu->first_buffered_npdu != NULL) {
314 SET_STATE(NU, NU_REC_SUA_NOT_RECEPTIVE);
315 }
316 break;
317 case NU_ACK_SUA_RECEPTIVE:
318 nu_send_pending(&ready);
319 break;
320 #ifndef NCONFIG
321 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
322 /*
323 * Is there at least 1 not yet acknowledged N-PDU?
324 */
325 if (sndcp_data->nu->first_buffered_npdu != NULL) {
326 SET_STATE(NU, NU_SEND_REC_SUA_NOT_RECEPTIVE);
327 }
328 break;
329 case NU_SEND_ACK_SUA_RECEPTIVE:
330 case NU_SEND_SUS_SUA_RECEPTIVE:
331 nu_config_send_pending(&ready);
332 break;
333 #endif /* NCONFIG */
334 case NU_SUS_SUA_RECEPTIVE:
335 case NU_SUS_SUA_NOT_RECEPTIVE:
336 break;
337 default:
338 TRACE_ERROR( "SIG_MG_NU_RECOVER unexpected" );
339 break;
340 }
341 } /* sig_mg_nu_recover() */
342
343 #endif /* CF_FAST_EXEC */
344
345 /*
346 +------------------------------------------------------------------------------
347 | Function : sig_mg_nu_reset_ind
348 +------------------------------------------------------------------------------
349 | Description : Handles the internal signal SIG_MG_NU_RESET_IND.
350 |
351 | Parameters : UBYTE nsapi: the affected NSAPI
352 |
353 +------------------------------------------------------------------------------
354 */
355 #ifndef CF_FAST_EXEC
356
357 GLOBAL void sig_mg_nu_reset_ind (UBYTE nsapi)
358 {
359 TRACE_ISIG( "sig_mg_nu_reset_ind" );
360
361 /*
362 * set service instance according to nsapi in primitive
363 */
364 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
365
366 switch( GET_STATE( NU ) )
367 {
368 case NU_UNACK_SU_NOT_RECEPTIVE:
369 case NU_UNACK_SU_RECEPTIVE:
370 case NU_ACK_SUA_NOT_RECEPTIVE:
371 case NU_ACK_SUA_RECEPTIVE:
372 case NU_SUS_SUA_NOT_RECEPTIVE:
373 case NU_SUS_SUA_RECEPTIVE:
374 case NU_REC_SUA_NOT_RECEPTIVE:
375 #ifndef NCONFIG
376 case NU_SEND_UNACK_SU_RECEPTIVE:
377 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
378 case NU_SEND_ACK_SUA_RECEPTIVE:
379 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
380 case NU_SEND_SUS_SUA_RECEPTIVE:
381 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
382 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
383 #endif
384 sndcp_data->nu->send_npdu_number_unack = 0;
385 break;
386 default:
387 TRACE_ERROR( "SIG_MG_NU_RESET_IND unexpected" );
388 break;
389 }
390 } /* sig_mg_nu_reset_ind() */
391
392 #endif /* CF_FAST_EXEC */
393
394
395 /*
396 +------------------------------------------------------------------------------
397 | Function : sig_mg_nu_resume
398 +------------------------------------------------------------------------------
399 | Description : Handles the internal signal SIG_MG_NU_RESUME.
400 |
401 | Parameters : UBYTE nsapi: the affected NSAPI
402 |
403 +------------------------------------------------------------------------------
404 */
405 #ifndef CF_FAST_EXEC
406
407 GLOBAL void sig_mg_nu_resume (UBYTE nsapi)
408 {
409 BOOL ready = FALSE;
410 USHORT sapi_state = 0;
411 UBYTE sapi = 0;
412 TRACE_ISIG( "sig_mg_nu_resume" );
413
414 /*
415 * set service instance according to nsapi in primitive
416 */
417 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
418
419 switch( GET_STATE( NU ) )
420 {
421 case NU_SUS_SUA_NOT_RECEPTIVE:
422 /*
423 * Is there at least 1 not yet acknowledged N-PDU?
424 */
425 if (sndcp_data->nu->first_buffered_npdu != NULL) {
426 SET_STATE(NU, NU_REC_SUA_NOT_RECEPTIVE);
427 } else {
428 SET_STATE(NU, NU_ACK_SUA_NOT_RECEPTIVE);
429 }
430 break;
431 case NU_SUS_SUA_RECEPTIVE:
432 /*
433 * Is there at least 1 not yet acknowledged N-PDU?
434 */
435 sndcp_get_nsapi_sapi(nsapi, &sapi);
436 sndcp_get_sapi_state(sapi, &sapi_state);
437 /*
438 * In ACK mode, the PDU send should not resume until LL_ESTB_IND is received
439 * Refer 3GPP 04.65 sec 5.1.2.26
440 */
441 if ((sndcp_data->nu->first_buffered_npdu != NULL) AND
442 ((sapi_state & MG_EST_IND) == 0)) {
443 nu_send_pending(&ready);
444 } else {
445 sndcp_unset_sapi_state(sapi, MG_EST_IND);
446 SET_STATE(NU, NU_ACK_SUA_RECEPTIVE);
447 }
448 break;
449 case NU_UNACK_SU_RECEPTIVE:
450 case NU_UNACK_SU_NOT_RECEPTIVE:
451
452 case NU_ACK_SUA_RECEPTIVE:
453
454 #ifndef NCONFIG
455 case NU_SEND_UNACK_SU_RECEPTIVE:
456 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
457 case NU_SEND_ACK_SUA_RECEPTIVE:
458 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
459 case NU_SEND_SUS_SUA_RECEPTIVE:
460 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
461 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
462 #endif
463 break;
464 default:
465 TRACE_ERROR( "SIG_MG_NU_RESUME unexpected" );
466 break;
467 }
468 } /* sig_mg_nu_resume() */
469
470 #endif /* CF_FAST_EXEC */
471
472
473 /*
474 +------------------------------------------------------------------------------
475 | Function : sig_mg_nu_suspend
476 +------------------------------------------------------------------------------
477 | Description : Handles the internal signal SIG_MG_NU_SUSPEND.
478 |
479 | Parameters : UBYTE nsapi: the affected NSAPI
480 |
481 +------------------------------------------------------------------------------
482 */
483 #ifndef CF_FAST_EXEC
484
485 GLOBAL void sig_mg_nu_suspend (UBYTE nsapi)
486 {
487 TRACE_ISIG( "sig_mg_nu_suspend" );
488
489 /*
490 * set service instance according to nsapi in primitive
491 */
492 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
493
494 switch( GET_STATE( NU ) )
495 {
496 case NU_ACK_SUA_NOT_RECEPTIVE:
497 SET_STATE(NU, NU_SUS_SUA_NOT_RECEPTIVE);
498 break;
499 case NU_ACK_SUA_RECEPTIVE:
500 SET_STATE(NU, NU_SUS_SUA_RECEPTIVE);
501 break;
502 #ifndef NCONFIG
503 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
504 SET_STATE(NU, NU_SEND_SUS_SUA_NOT_RECEPTIVE);
505 break;
506 case NU_SEND_ACK_SUA_RECEPTIVE:
507 SET_STATE(NU, NU_SEND_SUS_SUA_RECEPTIVE);
508 break;
509 case NU_SEND_UNACK_SU_RECEPTIVE:
510 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
511 case NU_SEND_SUS_SUA_RECEPTIVE:
512 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
513 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
514 #endif
515 case NU_SUS_SUA_RECEPTIVE:
516 case NU_UNACK_SU_RECEPTIVE :
517 case NU_UNACK_SU_NOT_RECEPTIVE:
518 break;
519 default:
520 TRACE_ERROR( "SIG_MG_NU_SUSPEND unexpected" );
521 break;
522 }
523 } /* sig_mg_nu_suspend() */
524
525 #endif /* CF_FAST_EXEC */
526
527
528 /*
529 +------------------------------------------------------------------------------
530 | Function : sig_mg_nu_reset
531 +------------------------------------------------------------------------------
532 | Description : Handles the internal signal SIG_MG_NU_RESET. The
533 | send_npdu_number_unack is set to 0 and GACI gets an
534 | SN_UNITREADY_IND for the affected NSAPI.
535 |
536 | Parameters : UBYTE nsapi: the affected NSAPI, discard ready flag
537 | (is old unitready_ind to be discarded?
538 |
539 +------------------------------------------------------------------------------
540 */
541 #ifndef CF_FAST_EXEC
542
543 GLOBAL void sig_mg_nu_reset (UBYTE nsapi, BOOL discard_ready)
544 {
545 TRACE_ISIG( "sig_mg_nu_reset" );
546
547 /*
548 * set service instance according to nsapi in primitive
549 */
550 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
551
552 switch( GET_STATE( NU ) )
553 {
554
555 case NU_UNACK_SU_RECEPTIVE :
556 case NU_UNACK_SU_NOT_RECEPTIVE:
557 case NU_ACK_SUA_RECEPTIVE:
558 case NU_ACK_SUA_NOT_RECEPTIVE:
559 case NU_SUS_SUA_RECEPTIVE:
560 case NU_SUS_SUA_NOT_RECEPTIVE:
561 case NU_REC_SUA_NOT_RECEPTIVE:
562
563 sndcp_data->nu->send_npdu_number_unack = 0;
564 sndcp_data->nu->send_npdu_number_ack = 0;
565 sndcp_data->nu->rec_npdu_number_ack = 0;
566 nu_delete_npdus();
567 if (discard_ready) {
568 sndcp_data->nu->sn_unitready_ind_pending = FALSE;
569 }
570 nu_unitready_ind_if_nec(nsapi);
571 SET_STATE(NU, NU_UNACK_SU_RECEPTIVE);
572 break;
573 #ifndef NCONFIG
574 case NU_SEND_UNACK_SU_RECEPTIVE:
575 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
576 case NU_SEND_ACK_SUA_RECEPTIVE:
577 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
578 case NU_SEND_SUS_SUA_RECEPTIVE:
579 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
580 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
581
582 sndcp_data->nu->send_npdu_number_unack = 0;
583 sndcp_data->nu->send_npdu_number_ack = 0;
584 sndcp_data->nu->rec_npdu_number_ack = 0;
585 nu_delete_npdus();
586 if (discard_ready) {
587 sndcp_data->nu->sn_unitready_ind_pending = FALSE;
588 }
589 nu_unitready_ind_if_nec(nsapi);
590 SET_STATE(NU, NU_UNACK_SU_RECEPTIVE);
591 break;
592 #endif /* NCONFIG */
593 default:
594 TRACE_ERROR( "SIG_MG_NU_RESET unexpected" );
595 break;
596 }
597 } /* sig_mg_nu_reset() */
598
599 #endif /* CF_FAST_EXEC */
600
601 /*
602 +------------------------------------------------------------------------------
603 | Function : sig_mg_nu_reset_ack
604 +------------------------------------------------------------------------------
605 | Description : Handles the internal signal SIG_MG_NU_RESET_ACK. The
606 | send_npdu_number_ack and rec_npdu_number_ack are set to 0 and
607 | GACI gets an
608 | SN_READY_IND for the affected NSAPI.
609 |
610 | Parameters : UBYTE nsapi: the affected NSAPI, send npdu number,
611 | rec npdu number, discard_ready flag
612 |
613 +------------------------------------------------------------------------------
614 */
615 #ifndef CF_FAST_EXEC
616
617 GLOBAL void sig_mg_nu_reset_ack (UBYTE nsapi, UBYTE send_no, UBYTE rec_no, BOOL discard_ready)
618 {
619 TRACE_ISIG( "sig_mg_nu_reset_ack" );
620
621 /*
622 * set service instance according to nsapi in primitive
623 */
624 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
625
626 switch( GET_STATE( NU ) )
627 {
628 case NU_UNACK_SU_RECEPTIVE :
629 case NU_UNACK_SU_NOT_RECEPTIVE:
630 case NU_ACK_SUA_RECEPTIVE:
631 case NU_ACK_SUA_NOT_RECEPTIVE:
632 case NU_SUS_SUA_RECEPTIVE:
633 case NU_SUS_SUA_NOT_RECEPTIVE:
634 case NU_REC_SUA_NOT_RECEPTIVE:
635 sndcp_data->nu->send_npdu_number_unack = 0;
636 sndcp_data->nu->send_npdu_number_ack = send_no;
637 sndcp_data->nu->rec_npdu_number_ack = rec_no;
638 nu_delete_npdus();
639 if (discard_ready) {
640 sndcp_data->nu->sn_ready_ind_pending = FALSE;
641 }
642 nu_ready_ind_if_nec(nsapi);
643 SET_STATE(NU, NU_ACK_SUA_RECEPTIVE);
644 break;
645 #ifndef NCONFIG
646 case NU_SEND_UNACK_SU_RECEPTIVE:
647 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
648 case NU_SEND_ACK_SUA_RECEPTIVE:
649 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
650 case NU_SEND_SUS_SUA_RECEPTIVE:
651 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
652 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
653
654 sndcp_data->nu->send_npdu_number_unack = 0;
655 sndcp_data->nu->send_npdu_number_ack = send_no;
656 sndcp_data->nu->rec_npdu_number_ack = rec_no;
657 nu_delete_npdus();
658 if (discard_ready) {
659 sndcp_data->nu->sn_ready_ind_pending = FALSE;
660 }
661 nu_ready_ind_if_nec(nsapi);
662 SET_STATE(NU, NU_ACK_SUA_RECEPTIVE);
663 break;
664 #endif /* NCONFIG */
665 default:
666 TRACE_ERROR( "SIG_MG_NU_RESET_ACK unexpected" );
667 break;
668 }
669 } /* sig_mg_nu_reset_ack() */
670
671 #endif /* CF_FAST_EXEC */
672
673
674 /*
675 +------------------------------------------------------------------------------
676 | Function : sig_su_nu_ready_ind
677 +------------------------------------------------------------------------------
678 | Description : Handles the internal signal SIG_SU_NU_READY_IND
679 |
680 | Parameters : UBYTE nsapi: the affected NSAPI
681 |
682 +------------------------------------------------------------------------------
683 */
684 /*f defined(CF_FAST_EXEC) || defined(_SIMULATION_) || \
685 !defined(SNDCP_UPM_INCLUDED) || defined(SNDCP_2to1) */
686
687 GLOBAL void sig_su_nu_ready_ind (UBYTE nsapi)
688 {
689 TRACE_ISIG( "sig_su_nu_ready_ind" );
690
691 /*
692 * Set service instance according to nsapi in signal.
693 */
694 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
695
696 switch( GET_STATE( NU ) )
697 {
698 case NU_ACK_SUA_NOT_RECEPTIVE:
699 break;
700 case NU_ACK_SUA_RECEPTIVE:
701 break;
702 case NU_UNACK_SU_NOT_RECEPTIVE:
703 SET_STATE(NU, NU_UNACK_SU_RECEPTIVE);
704 nu_unitready_ind_if_nec(nsapi);
705 break;
706 case NU_UNACK_SU_RECEPTIVE:
707 break;
708 #ifndef NCONFIG
709 case NU_SEND_ACK_SUA_RECEPTIVE:
710 break;
711 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
712 break;
713 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
714 SET_STATE(NU, NU_SEND_UNACK_SU_RECEPTIVE);
715 nu_unitready_ind_if_nec(nsapi);
716 break;
717 case NU_SEND_UNACK_SU_RECEPTIVE:
718 /*SET_STATE(NU, NU_SEND_UNACK_SU_RECEPTIVE);*/
719 nu_config_send_next(nsapi);
720 break;
721 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
722 break;
723 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
724 break;
725 case NU_SEND_SUS_SUA_RECEPTIVE:
726 break;
727 #endif
728 default:
729 TRACE_ERROR( "SIG_SU_NU_READY_IND unexpected" );
730 break;
731 }
732 } /* sig_su_nu_ready_ind() */
733
734 /*#endif *//* CF_FAST_EXEC || _SIMULATION_ || !SNDCP_UPM_INCLUDED || SNDCP_2to1 */
735
736 /*
737 +------------------------------------------------------------------------------
738 | Function : sig_sua_nu_data_cnf
739 +------------------------------------------------------------------------------
740 | Description : Handles the internal signal SIG_SUA_NU_DATA_CNF. The N-PDU
741 | with the given N-PDU number has been confirmed completely by
742 | the network and service nu is notified abou this.
743 |
744 | Parameters : UBYTE nsapi: the affected NSAPI, UBYTE npdu_number: the number
745 |
746 +------------------------------------------------------------------------------
747 */
748 #ifndef CF_FAST_EXEC
749
750 GLOBAL void sig_sua_nu_data_cnf (UBYTE nsapi, UBYTE npdu_number)
751 {
752 TRACE_ISIG( "sig_sua_nu_npdu_number" );
753
754 /*
755 * Set service instance according to nsapi in signal.
756 */
757 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
758
759 switch( GET_STATE( NU ) )
760 {
761 case NU_ACK_SUA_NOT_RECEPTIVE:
762 case NU_REC_SUA_NOT_RECEPTIVE:
763 case NU_ACK_SUA_RECEPTIVE:
764 case NU_SUS_SUA_NOT_RECEPTIVE:
765 case NU_SUS_SUA_RECEPTIVE:
766 #ifndef NCONFIG
767 case NU_SEND_ACK_SUA_RECEPTIVE:
768 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
769 case NU_SEND_SUS_SUA_RECEPTIVE:
770 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
771 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
772 #endif /* NCONFIG */
773 nu_delete_npdu(nsapi, npdu_number);
774 break;
775 case NU_UNACK_SU_NOT_RECEPTIVE:
776 break;
777 case NU_UNACK_SU_RECEPTIVE:
778 break;
779 default:
780 TRACE_ERROR( "SIG_SUA_NU_DATA_CNF unexpected" );
781 break;
782 }
783 } /* sig_sua_nu_data_cnf() */
784
785 #endif /* CF_FAST_EXEC */
786
787 /*
788 +------------------------------------------------------------------------------
789 | Function : sig_sua_nu_ready_ind
790 +------------------------------------------------------------------------------
791 | Description : Handles the internal signal SIG_SUA_NU_READY_IND
792 |
793 | Parameters : UBYTE nsapi: the affected NSAPI
794 |
795 +------------------------------------------------------------------------------
796 */
797 #ifndef CF_FAST_EXEC
798
799 GLOBAL void sig_sua_nu_ready_ind (UBYTE nsapi)
800 {
801 BOOL ready;
802 #ifndef NCONFIG
803 U32 *data_count;
804 data_count = &sndcp_data->data_count[nsapi];
805 #endif
806
807 TRACE_FUNCTION( "sig_sua_nu_ready_ind" );
808
809 /*
810 * set service instance according to nsapi in primitive
811 */
812 sndcp_data->nu = & sndcp_data->nu_base[nsapi];
813
814 switch( GET_STATE( NU ) )
815 {
816 case NU_ACK_SUA_NOT_RECEPTIVE:
817 #ifndef NCONFIG
818 if (*data_count == 0) {
819 SET_STATE(NU, NU_ACK_SUA_RECEPTIVE);
820 nu_ready_ind_if_nec(nsapi);
821 } else {
822 SET_STATE(NU, NU_SEND_ACK_SUA_NOT_RECEPTIVE);
823 nu_config_send_next(sndcp_data->nu->nsapi);
824 }
825 #else
826 SET_STATE(NU, NU_ACK_SUA_RECEPTIVE);
827 nu_ready_ind_if_nec(nsapi);
828 #endif
829 break;
830 case NU_REC_SUA_NOT_RECEPTIVE:
831 nu_send_pending(&ready);
832 break;
833 case NU_SUS_SUA_NOT_RECEPTIVE:
834 SET_STATE(NU, NU_SUS_SUA_RECEPTIVE);
835 break;
836 case NU_ACK_SUA_RECEPTIVE:
837 break;
838 #ifndef NCONFIG
839 case NU_SEND_ACK_SUA_RECEPTIVE:
840 nu_config_send_next(nsapi);
841 break;
842 case NU_SEND_ACK_SUA_NOT_RECEPTIVE:
843 SET_STATE(NU, NU_SEND_ACK_SUA_RECEPTIVE);
844 nu_ready_ind_if_nec(nsapi);
845 break;
846 case NU_SEND_UNACK_SU_NOT_RECEPTIVE:
847 break;
848 case NU_SEND_UNACK_SU_RECEPTIVE:
849 SET_STATE(NU, NU_SEND_UNACK_SU_RECEPTIVE);
850 break;
851 case NU_SEND_REC_SUA_NOT_RECEPTIVE:
852 nu_config_send_pending(&ready);
853 break;
854 case NU_SEND_SUS_SUA_NOT_RECEPTIVE:
855 break;
856 case NU_SEND_SUS_SUA_RECEPTIVE:
857 break;
858 #endif
859 default:
860 TRACE_ERROR( "SIG_SUA_NU_READY_IND unexpected" );
861 break;
862 }
863 } /* sig_sua_nu_ready_ind() */
864
865 #endif /* CF_FAST_EXEC */
866
867
868