comparison src/g23m-fad/rlp/rlp_snds.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : CSD (8411)
4 | Modul : Rlp_snds.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 defines the functions for processing
18 | of incomming signals for the component
19 | Radio Link Protocol of the base station
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef RLP_SNDS_C
24 #define RLP_SNDS_C
25 #endif
26
27 #define ENTITY_RLP
28
29 /*==== INCLUDES ===================================================*/
30
31 #include <string.h>
32 #include "typedefs.h"
33 #include "vsi.h"
34 #include "macdef.h"
35 #include "custom.h"
36 #include "gsm.h"
37 #include "cus_rlp.h"
38 #include "prim.h"
39 #include "tok.h"
40 #include "rlp.h"
41
42 /*==== CONST =======================================================*/
43
44 /*==== TYPES =======================================================*/
45
46 /*==== VAR EXPORT ==================================================*/
47
48 /*==== VAR LOCAL ===================================================*/
49
50 /*==== FUNCTIONS ===================================================*/
51
52 /*
53 +------------------------------------------------------------------------------
54 | Function : sig_ker_snd_sabm_req
55 +------------------------------------------------------------------------------
56 | Description : Process signal SIG_SABM_REQ received from process kernel.
57 |
58 | Parameters : -
59 |
60 |
61 | Return : -
62 +------------------------------------------------------------------------------
63 */
64
65
66 GLOBAL void sig_ker_snd_sabm_req
67 (
68 void
69 )
70 {
71 TRACE_FUNCTION ("sig_ker_snd_sabm_req()");
72
73 switch (GET_STATE (SND))
74 {
75 case SPDU_WAIT_EVENT:
76 /*
77 * processing for state SPDU_WAIT_EVENT
78 */
79 TRACE_EVENT ("Snd SABM");
80 snd_send_u_frame (UF_SABM, 1, 1, NULL);
81 break;
82 }
83 }
84
85 /*
86 +------------------------------------------------------------------------------
87 | Function : sig_ker_snd_disc_req
88 +------------------------------------------------------------------------------
89 | Description : Process signal SIG_DISC_REQ received from process kernel.
90 |
91 | Parameters : pFBit -
92 |
93 |
94 | Return : -
95 +------------------------------------------------------------------------------
96 */
97
98
99 GLOBAL void sig_ker_snd_disc_req
100 (
101 T_BIT pFBit
102 )
103 {
104 TRACE_FUNCTION ("sig_ker_snd_disc_req()");
105
106 switch (GET_STATE (SND))
107 {
108 case SPDU_WAIT_EVENT:
109 /*
110 * processing for state SPDU_WAIT_EVENT
111 */
112 if (pFBit)
113 {
114 TRACE_EVENT ("Snd DISC (P/F=1)");
115 }
116 else
117 {
118 TRACE_EVENT ("Snd DISC (P/F=0)");
119 }
120 snd_send_u_frame (UF_DISC, pFBit, 1, NULL);
121 break;
122 }
123 }
124
125 /*
126 +------------------------------------------------------------------------------
127 | Function : sig_ker_snd_ua_req
128 +------------------------------------------------------------------------------
129 | Description : Process signal SIG_UA_REQ received from process kernel.
130 |
131 | Parameters : pFBit -
132 |
133 |
134 | Return : -
135 +------------------------------------------------------------------------------
136 */
137
138
139 GLOBAL void sig_ker_snd_ua_req
140 (
141 T_BIT pFBit
142 )
143 {
144 TRACE_FUNCTION ("sig_ker_snd_ua_req()");
145
146 switch (GET_STATE (SND))
147 {
148 case SPDU_WAIT_EVENT:
149 /*
150 * processing for state SPDU_WAIT_EVENT
151 */
152 if (pFBit)
153 {
154 TRACE_EVENT ("Snd UA (P/F=1)");
155 }
156 else
157 {
158 TRACE_EVENT ("Snd UA (P/F=0)");
159 }
160 snd_send_u_frame (UF_UA, pFBit, 0, NULL);
161 break;
162 }
163 }
164
165 /*
166 +------------------------------------------------------------------------------
167 | Function : sig_ker_snd_dm_req
168 +------------------------------------------------------------------------------
169 | Description : Process signal SIG_DM_REQ received from process kernel.
170 |
171 | Parameters : pFBit -
172 |
173 |
174 | Return : -
175 +------------------------------------------------------------------------------
176 */
177
178
179 GLOBAL void sig_ker_snd_dm_req
180 (
181 T_BIT pFBit
182 )
183 {
184 TRACE_FUNCTION ("sig_ker_snd_dm_req()");
185
186 switch (GET_STATE (SND))
187 {
188 case SPDU_WAIT_EVENT:
189 /*
190 * processing for state SPDU_WAIT_EVENT
191 */
192 if (pFBit)
193 {
194 TRACE_EVENT ("Snd DM (P/F=1)");
195 }
196 else
197 {
198 TRACE_EVENT ("Snd DM (P/F=0)");
199 }
200 snd_send_u_frame (UF_DM, pFBit, 0, NULL);
201 break;
202 }
203 }
204
205 /*
206 +------------------------------------------------------------------------------
207 | Function : sig_ker_snd_rr_req
208 +------------------------------------------------------------------------------
209 | Description : Process signal SIG_RR_REQ received from process kernel.
210 |
211 | Parameters : cBit -
212 | pFBit -
213 | nr -
214 | dtx -
215 |
216 |
217 | Return : -
218 +------------------------------------------------------------------------------
219 */
220
221 #ifdef ENABLE_DTX
222 GLOBAL void sig_ker_snd_rr_req(T_BIT cBit, T_BIT pFBit, T_FRAME_NUM nr, T_BIT dtx)
223 #else
224 GLOBAL void sig_ker_snd_rr_req(T_BIT cBit, T_BIT pFBit, T_FRAME_NUM nr)
225 #endif
226 {
227 TRACE_FUNCTION ("sig_ker_snd_rr_req()");
228
229 switch (GET_STATE (SND))
230 {
231 case SPDU_WAIT_EVENT:
232 /*
233 * processing for state SPDU_WAIT_EVENT
234 */
235 #ifdef ENABLE_DTX
236 if (dtx EQ 0)
237 #endif
238 snd_send_s_frame (SF_RR, nr, pFBit, cBit, NULL);
239 break;
240 }
241 }
242
243 /*
244 +------------------------------------------------------------------------------
245 | Function : sig_ker_snd_rnr_req
246 +------------------------------------------------------------------------------
247 | Description : Process signal SIG_RNR_REQ received from process kernel.
248 |
249 | Parameters : cBit -
250 | pFBit -
251 | nr -
252 | dtx -
253 |
254 |
255 | Return : -
256 +------------------------------------------------------------------------------
257 */
258
259
260 GLOBAL void sig_ker_snd_rnr_req
261 (
262 T_BIT cBit,
263 T_BIT pFBit,
264 T_FRAME_NUM nr,
265 T_BIT dtx
266 )
267 {
268 TRACE_FUNCTION ("sig_ker_snd_rnr_req()");
269
270 switch (GET_STATE (SND))
271 {
272 case SPDU_WAIT_EVENT:
273 /*
274 * processing for state SPDU_WAIT_EVENT
275 */
276 #ifdef ENABLE_DTX
277 if (dtx EQ 0)
278 #endif
279 snd_send_s_frame (SF_RNR, nr, pFBit, cBit, NULL);
280 break;
281 }
282 }
283
284 /*
285 +------------------------------------------------------------------------------
286 | Function : sig_ker_snd_rej_req
287 +------------------------------------------------------------------------------
288 | Description : Process signal SIG_REJ_REQ received from process kernel.
289 |
290 | Parameters : cBit -
291 | pFBit -
292 | nr -
293 |
294 |
295 | Return : -
296 +------------------------------------------------------------------------------
297 */
298
299
300 GLOBAL void sig_ker_snd_rej_req
301 (
302 T_BIT cBit,
303 T_BIT pFBit,
304 T_FRAME_NUM nr
305 )
306 {
307 TRACE_FUNCTION ("sig_ker_snd_rej_req()");
308
309 switch (GET_STATE (SND))
310 {
311 case SPDU_WAIT_EVENT:
312 /*
313 * processing for state SPDU_WAIT_EVENT
314 */
315 snd_send_s_frame (SF_REJ, nr, pFBit, cBit, NULL);
316 break;
317 }
318 }
319
320 /*
321 +------------------------------------------------------------------------------
322 | Function : sig_ker_snd_srej_req
323 +------------------------------------------------------------------------------
324 | Description : Process signal SIG_SREJ_REQ received from process kernel.
325 |
326 | Parameters : cBit -
327 | pFBit -
328 | nr -
329 |
330 | Return : -
331 +------------------------------------------------------------------------------
332 */
333
334
335 GLOBAL void sig_ker_snd_srej_req
336 (
337 T_BIT cBit,
338 T_BIT pFBit,
339 T_FRAME_NUM nr
340 )
341 {
342 TRACE_FUNCTION ("sig_ker_snd_srej_req()");
343
344 switch (GET_STATE (SND))
345 {
346 case SPDU_WAIT_EVENT:
347 /*
348 * processing for state SPDU_WAIT_EVENT
349 */
350 snd_send_s_frame (SF_SREJ, nr, pFBit, cBit, NULL);
351 break;
352 }
353 }
354
355 /*
356 +------------------------------------------------------------------------------
357 | Function : sig_ker_snd_rr_i_req
358 +------------------------------------------------------------------------------
359 | Description : Process signal SIG_RR_I_REQ received from process kernel.
360 |
361 | Parameters :
362 |
363 |
364 | Return :
365 +------------------------------------------------------------------------------
366 */
367
368
369 GLOBAL void sig_ker_snd_rr_i_req
370 (
371 T_BIT cBit,
372 T_BIT pFBit,
373 T_FRAME_NUM nr,
374 T_FRAME_NUM ns,
375 T_FRAME_DESC *dataDesc
376 )
377 {
378 TRACE_FUNCTION ("sig_ker_snd_rr_i_req()");
379
380 switch (GET_STATE (SND))
381 {
382 case SPDU_WAIT_EVENT:
383 /*
384 * processing for state SPDU_WAIT_EVENT
385 */
386 snd_send_si_frame (SF_RR, nr, pFBit, ns, cBit, dataDesc);
387 break;
388 }
389 }
390
391 /*
392 +------------------------------------------------------------------------------
393 | Function : sig_ker_snd_rnr_i_req
394 +------------------------------------------------------------------------------
395 | Description : Process signal SIG_RNR_I_REQ received from process kernel.
396 |
397 | Parameters : cBit
398 | pFBit
399 | nr
400 | ns
401 | dataDesc
402 |
403 | Return : -
404 +------------------------------------------------------------------------------
405 */
406
407
408 GLOBAL void sig_ker_snd_rnr_i_req
409 (
410 T_BIT cBit,
411 T_BIT pFBit,
412 T_FRAME_NUM nr,
413 T_FRAME_NUM ns,
414 T_FRAME_DESC *dataDesc
415 )
416 {
417 TRACE_FUNCTION ("sig_ker_snd_rnr_i_req()");
418
419 switch (GET_STATE (SND))
420 {
421 case SPDU_WAIT_EVENT:
422 /*
423 * processing for state SPDU_WAIT_EVENT
424 */
425 snd_send_si_frame (SF_RNR, nr, pFBit, ns, cBit, dataDesc);
426 break;
427 }
428 }
429
430 /*
431 +------------------------------------------------------------------------------
432 | Function : sig_ker_snd_rej_i_req
433 +------------------------------------------------------------------------------
434 | Description : Process signal SIG_REJ_I_REQ received from process kernel.
435 |
436 | Parameters : cBit -
437 | pFBit -
438 | nr -
439 | ns -
440 | dataDesc -
441 |
442 | Return : -
443 +------------------------------------------------------------------------------
444 */
445
446
447 GLOBAL void sig_ker_snd_rej_i_req
448 (
449 T_BIT cBit,
450 T_BIT pFBit,
451 T_FRAME_NUM nr,
452 T_FRAME_NUM ns,
453 T_FRAME_DESC *dataDesc
454 )
455 {
456 TRACE_FUNCTION ("sig_ker_snd_rej_i_req()");
457
458 switch (GET_STATE (SND))
459 {
460 case SPDU_WAIT_EVENT:
461 /*
462 * processing for state SPDU_WAIT_EVENT
463 */
464 snd_send_si_frame (SF_REJ, nr, pFBit, ns, cBit, dataDesc);
465 break;
466 }
467 }
468
469 /*
470 +------------------------------------------------------------------------------
471 | Function : sig_ker_snd_srej_i_req
472 +------------------------------------------------------------------------------
473 | Description : Process signal SIG_SREJ_I_REQ received from process kernel.
474 |
475 | Parameters : cBit -
476 | pFBit -
477 | nr -
478 | ns -
479 | dataDesc -
480 |
481 |
482 | Return : -
483 +------------------------------------------------------------------------------
484 */
485
486
487 GLOBAL void sig_ker_snd_srej_i_req
488 (
489 T_BIT cBit,
490 T_BIT pFBit,
491 T_FRAME_NUM nr,
492 T_FRAME_NUM ns,
493 T_FRAME_DESC *dataDesc
494 )
495 {
496 TRACE_FUNCTION ("sig_ker_snd_srej_i_req()");
497
498 switch (GET_STATE (SND))
499 {
500 case SPDU_WAIT_EVENT:
501 /*
502 * processing for state SPDU_WAIT_EVENT
503 */
504 snd_send_si_frame (SF_SREJ, nr, pFBit, ns, cBit, dataDesc);
505 break;
506 }
507 }
508
509 /*
510 +------------------------------------------------------------------------------
511 | Function : sig_ker_snd_ui_req
512 +------------------------------------------------------------------------------
513 | Description : Process signal SIG_UI_REQ received from process kernel.
514 |
515 | Parameters : cBit -
516 | pFBit -
517 | dataDesc -
518 |
519 | Return : -
520 +------------------------------------------------------------------------------
521 */
522
523
524 GLOBAL void sig_ker_snd_ui_req
525 (
526 T_BIT cBit,
527 T_BIT pFBit,
528 T_FRAME_DESC *dataDesc
529 )
530 {
531 TRACE_FUNCTION ("sig_ker_snd_ui_req()");
532
533 switch (GET_STATE (SND))
534 {
535 case SPDU_WAIT_EVENT:
536 /*
537 * processing for state SPDU_WAIT_EVENT
538 */
539 TRACE_EVENT ("Snd UI");
540 snd_send_u_frame (UF_UI, pFBit, cBit, dataDesc);
541 break;
542 }
543 }
544
545 /*
546 +------------------------------------------------------------------------------
547 | Function : sig_ker_snd_xid_req
548 +------------------------------------------------------------------------------
549 | Description : Process signal SIG_SABM_REQ received from process kernel.
550 |
551 | Parameters : cBit
552 | pFBit
553 | dataDesc
554 |
555 |
556 | Return : -
557 +------------------------------------------------------------------------------
558 */
559
560
561 GLOBAL void sig_ker_snd_xid_req
562 (
563 T_BIT cBit,
564 T_BIT pFBit,
565 T_FRAME_DESC *dataDesc
566 )
567 {
568 TRACE_FUNCTION ("sig_ker_snd_xid_req()");
569
570 switch (GET_STATE (SND))
571 {
572 case SPDU_WAIT_EVENT:
573 /*
574 * processing for state SPDU_WAIT_EVENT
575 */
576 if (pFBit)
577 {
578 if (cBit)
579 {
580 TRACE_EVENT ("Snd XID C (P/F=1)");
581 }
582 else
583 {
584 TRACE_EVENT ("Snd XID R (P/F=1)");
585 }
586 }
587 else
588 {
589 if (cBit)
590 {
591 TRACE_EVENT ("Snd XID C (P/F=0)");
592 }
593 else
594 {
595 TRACE_EVENT ("Snd XID R (P/F=0)");
596 }
597 }
598
599 snd_send_u_frame (UF_XID, pFBit, cBit, dataDesc);
600 break;
601 }
602 }
603
604 /*
605 +------------------------------------------------------------------------------
606 | Function : sig_ker_snd_test_req
607 +------------------------------------------------------------------------------
608 | Description : Process signal SIG_TEST_REQ received from process kernel.
609 |
610 | Parameters : cBit -
611 | pFBit -
612 | dataDesc -
613 |
614 |
615 | Return : -
616 +------------------------------------------------------------------------------
617 */
618
619
620 GLOBAL void sig_ker_snd_test_req
621 (
622 T_BIT cBit,
623 T_BIT pFBit,
624 T_FRAME_DESC *dataDesc
625 )
626 {
627 TRACE_FUNCTION ("sig_ker_snd_test_req()");
628
629 switch (GET_STATE (SND))
630 {
631 case SPDU_WAIT_EVENT:
632 /*
633 * processing for state SPDU_WAIT_EVENT
634 */
635 TRACE_EVENT ("Snd TEST");
636 snd_send_u_frame (UF_TEST, pFBit, cBit, dataDesc);
637 break;
638 }
639 }
640
641 /*
642 +------------------------------------------------------------------------------
643 | Function : sig_ker_snd_remap_req
644 +------------------------------------------------------------------------------
645 | Description : Process signal SIG_REMAP_REQ received from process kernel.
646 |
647 | Parameters : dataDesc -
648 |
649 |
650 | Return : -
651 +------------------------------------------------------------------------------
652 */
653
654
655 GLOBAL void sig_ker_snd_remap_req
656 (
657 T_FRAME_DESC *dataDesc
658 )
659 {
660 TRACE_FUNCTION ("sig_ker_snd_remap_req()");
661
662 switch (GET_STATE (SND))
663 {
664 case SPDU_WAIT_EVENT:
665 /*
666 * processing for state SPDU_WAIT_EVENT
667 */
668 TRACE_EVENT ("Snd REMAP");
669 snd_send_u_frame (UF_REMAP, 0, 1, dataDesc);
670 break;
671 }
672 }
673
674 /*
675 +------------------------------------------------------------------------------
676 | Function : sig_ker_snd_null_req
677 +------------------------------------------------------------------------------
678 | Description : Process signal SIG_NULL_REQ received from process kernel.
679 |
680 | Parameters : -
681 |
682 |
683 | Return : -
684 +------------------------------------------------------------------------------
685 */
686
687
688 GLOBAL void sig_ker_snd_null_req(void)
689 {
690 TRACE_FUNCTION ("sig_ker_snd_null_req()");
691
692 if (GET_STATE (SND) EQ SPDU_WAIT_EVENT)
693 {
694 snd_send_u_frame (UF_NULL, 0, 1, NULL);
695 }
696 }
697
698 /*
699 +------------------------------------------------------------------------------
700 | Function : sig_ker_snd_set_frame_size_req
701 +------------------------------------------------------------------------------
702 | Description : Process signal SIG_SET_FRAME_SIZE_REQ received from process kernel.
703 |
704 | Parameters : frameSize -
705 |
706 |
707 | Return : -
708 +------------------------------------------------------------------------------
709 */
710
711
712 GLOBAL void sig_ker_snd_set_frame_size_req
713 (
714 USHORT frameSize
715 )
716 {
717 USHORT i;
718 /*
719 TRACE_FUNCTION ("sig_ker_snd_set_frame_size_req()");
720 */
721
722 switch (GET_STATE (SND))
723 {
724 case SPDU_WAIT_EVENT:
725 /*
726 * initialize the header only frame descriptor
727 */
728 rlp_data->snd.HO_FrameDesc.Adr[0] = rlp_data->snd.HO_Frame;
729 rlp_data->snd.HO_FrameDesc.Len[0] = frameSize;
730 rlp_data->snd.HO_FrameDesc.Adr[1] = NULL;
731 rlp_data->snd.HO_FrameDesc.Len[1] = 0;
732
733 for (i=2; i<frameSize; i++)
734 {
735 rlp_data->snd.HO_Frame[i] = 0x41 + (UBYTE)i;
736 }
737
738 rlp_data->snd.FrameSize = frameSize;
739 break;
740 }
741 }
742