comparison gsm-fw/g23m-gsm/rr/rr_atts.c @ 673:2f7df7a314f8

gsm-fw/g23m-gsm subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 28 Sep 2014 23:20:04 +0000
parents
children abfc662e0082
comparison
equal deleted inserted replaced
672:0dc6f9e8e980 673:2f7df7a314f8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 : Handling of BCCH System Information Message and BSIC
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef RR_ATTS_C
22 #define RR_ATTS_C
23
24 #define ENTITY_RR
25
26 /*==== INCLUDES ===================================================*/
27
28 #include <string.h>
29 #include <stdlib.h>
30 #include <stddef.h> /* offsetof */
31 #include "typedefs.h"
32 #include "pcm.h"
33 #include "pconst.cdg"
34 #include "mconst.cdg"
35 #include "message.h"
36 #include "ccdapi.h"
37 #include "vsi.h"
38 #include "custom.h"
39 #include "gsm.h"
40 #include "prim.h"
41 #include "cnf_rr.h"
42 #include "tok.h"
43 #include "rr.h"
44 #include "rr_em.h"
45
46 /*==== EXPORT =====================================================*/
47
48 /*==== PRIVAT =====================================================*/
49
50 /*==== VARIABLES ==================================================*/
51
52 /*==== FUNCTIONS ==================================================*/
53 LOCAL void att_sys_info_read(USHORT mess_bit);
54 LOCAL void att_copy_sys_info_2_2bis_par(UBYTE index,
55 T_VOID_STRUCT *sys_info_2_2bis,
56 T_LIST *new_2_2bis_list,
57 UBYTE ncell_ext,
58 T_SI_TYPE si_type,
59 UBYTE indicate_changes);
60 /*
61 * -------------------------------------------------------------------
62 * SIGNAL Processing functions
63 * -------------------------------------------------------------------
64 */
65
66 /*
67 +--------------------------------------------------------------------+
68 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
69 | STATE : code ROUTINE : att_dat_dedicated |
70 +--------------------------------------------------------------------+
71
72 PURPOSE : The data transfer process indicates that the dedicated
73 state is reached.
74
75 */
76
77 GLOBAL void att_dat_dedicated (void)
78 {
79 GET_INSTANCE_DATA;
80
81 TRACE_FUNCTION ("att_dat_dedicated()");
82
83 /*
84 * align attachment process state
85 */
86 SET_STATE (STATE_ATT, ATT_DEDICATED);
87 }
88
89 /*
90 +--------------------------------------------------------------------+
91 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
92 | STATE : code ROUTINE : att_dat_con_est |
93 +--------------------------------------------------------------------+
94
95 PURPOSE : The data transfer process indicates that the connection
96 establishment state is reached.
97
98 */
99 GLOBAL void att_dat_con_est (void)
100 {
101 GET_INSTANCE_DATA;
102 TRACE_FUNCTION ("att_dat_con_est()");
103
104 /*
105 * stop possibly parallel PLMN search
106 */
107 if ((rr_data->ms_data.rr_service EQ LIMITED_SERVICE) OR
108 (CS_GET_CURRENT_SEARCH_MODE EQ BLACK_LIST_SEARCH_MODE))
109 {
110 att_notify_stop_plmn_search (FALSE);
111 TRACE_EVENT(" PLMN_SEARCH_STOPPED");
112 }
113
114
115 /*
116 * If network search is ongoing, abort
117 * and allow cell reselection.
118 */
119 if (rr_data->ms_data.req_mm_service EQ FUNC_NET_SRCH_BY_MMI)
120 {
121 /*
122 * send Please Retry to the MMI
123 */
124 rr_data->sc_data.found_entries = 0;
125 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL);
126 }
127 /*
128 * reset multiband parameter
129 */
130 rr_data->ncell_mb = 0;
131
132 /*
133 * save the neighbour cell list valid in idle mode
134 * (derived from SI 2x) to restore it after
135 * dedicated mode shorter than 30 seconds
136 * Note: SI 5x may contain other neighbour cells than SI 2x
137 */
138 memcpy(&rr_data->sc_data.ncell_list_idle,
139 &rr_data->sc_data.cd.ncell_list,
140 sizeof(T_LIST));
141
142 /*
143 * align attachment process state
144 */
145 SET_STATE (STATE_ATT, ATT_CON_EST);
146 }
147
148 /*
149 +--------------------------------------------------------------------+
150 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
151 | STATE : code ROUTINE : att_get_index |
152 +--------------------------------------------------------------------+
153
154 PURPOSE : Calculates from the arfcn of the cell the index in the
155 data structures:
156
157 0-5 neighbour cell
158 6 serving cell (SC_INDEX)
159 7 cell reselection cell (CR_INDEX)
160 255 not present
161
162 */
163
164 GLOBAL UBYTE att_get_index (USHORT arfcn)
165 {
166 GET_INSTANCE_DATA;
167 UBYTE i;
168
169 TRACE_FUNCTION ("att_get_index()");
170
171 /*
172 * check first cell reselection index
173 */
174 if (arfcn EQ rr_data->nc_data[CR_INDEX].arfcn)
175 return CR_INDEX;
176
177 /*
178 * then check serving cell index
179 */
180 if (arfcn EQ rr_data->nc_data[SC_INDEX].arfcn)
181 return SC_INDEX;
182
183 /*
184 * third step is to check the neighbourcells
185 * if available
186 */
187 for (i=0;i<6;i++)
188 {
189 if (rr_data->nc_data[i].bcch_status NEQ EMPTY AND
190 rr_data->nc_data[i].arfcn EQ arfcn)
191 return i;
192 }
193
194 /*
195 * nothing found
196 */
197 return NOT_PRESENT_8BIT;
198 }
199
200
201 /*
202 +--------------------------------------------------------------------+
203 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
204 | STATE : code ROUTINE : att_for_sysinfo_type1 |
205 +--------------------------------------------------------------------+
206
207 PURPOSE : A system information message one has received.
208
209 */
210
211 GLOBAL void att_for_sysinfo_type1 (USHORT arfcn,
212 T_D_SYS_INFO_1 *sys_info_1,
213 T_LIST *cell_chan_desc)
214 {
215 GET_INSTANCE_DATA;
216 /*
217 * get the storage area by checking the channel number
218 */
219 UBYTE index = att_get_index (arfcn);
220
221 TRACE_FUNCTION ("att_for_sysinfo_type1()");
222
223 switch (GET_STATE (STATE_ATT))
224 {
225 case ATT_CS2:
226 /*
227 * during cell selection only CR_INDEX is taken in account
228 */
229 if (index EQ CR_INDEX)
230 {
231 /*
232 * copy relevant parameters and check bcch carrier
233 * if the BCCH is read completely.
234 */
235 att_copy_sys_info_1_par (CR_INDEX,
236 sys_info_1,
237 cell_chan_desc);
238 att_check_bcch_carrier_si ();
239 }
240 break;
241
242 case ATT_CS3:
243 /*
244 * during cell reselection only CR_INDEX is taken in account
245 */
246
247 /*
248 * copy relevant parameters and check neighbourcell bcch carrier
249 * if the BCCH is read completely.
250 */
251 att_copy_sys_info_1_par (index,
252 sys_info_1,
253 cell_chan_desc);
254
255 if (index EQ CR_INDEX)
256 {
257 att_check_neighbourcell_si_reestab();
258 }
259 break;
260
261 case ATT_IDLE:
262 case ATT_CON_EST:
263 switch (index)
264 {
265 case SC_INDEX:
266 /*
267 * changed system information type 1 message received for
268 * the serving cell. Store relevant parameter and reconfigure
269 * Layer 1 and MM if needed
270 */
271 att_copy_sys_info_1_par (SC_INDEX,
272 sys_info_1,
273 cell_chan_desc);
274 att_check_barred_status_in_idle ();
275 break;
276
277 case CR_INDEX:
278 att_copy_sys_info_1_par (CR_INDEX,
279 sys_info_1,
280 cell_chan_desc);
281 break;
282
283 default:
284 break;
285 }
286 break;
287 default:
288 break;
289 }
290 }
291
292 /* Implements RR Clone findings #19 */
293 /*unify functions: att_for_sysinfo_type2 , att_for_sysinfo_type2bis by adding a parameter si_type.*/
294
295 /*
296 +--------------------------------------------------------------------+
297 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
298 | STATE : code ROUTINE : att_for_sysinfo_type2_2bis |
299 +--------------------------------------------------------------------+
300
301 PURPOSE : This function handles the SI type 2 and 2Ter common parameters.
302
303 */
304 GLOBAL void att_for_sysinfo_type2_2bis (USHORT arfcn,
305 T_VOID_STRUCT *sys_info_2_2bis,
306 T_LIST *new_2_2bis_list,
307 UBYTE ncell_ext,
308 T_SI_TYPE si_type)
309
310 {
311 GET_INSTANCE_DATA;
312 /*
313 * get the storage area by checking the channel number
314 */
315 UBYTE index = att_get_index (arfcn);
316
317 TRACE_FUNCTION ("att_for_sysinfo_type2_2bis()");
318
319 switch (GET_STATE (STATE_ATT))
320 {
321 case ATT_CS2:
322 /*
323 * during cell selection only CR_INDEX is taken in account
324 */
325 if (index EQ CR_INDEX)
326 {
327 /*
328 * copy relevant parameters and check bcch carrier
329 * if the BCCH is read completely.
330 */
331
332 att_copy_sys_info_2_2bis_par (CR_INDEX,
333 sys_info_2_2bis,
334 new_2_2bis_list,
335 ncell_ext,
336 si_type,
337 FALSE);
338
339 att_check_bcch_carrier_si ();
340 }
341 break;
342
343 case ATT_CS3:
344 /*
345 * during cell reselection only CR_INDEX is taken in account
346 */
347
348 /*
349 * copy relevant parameters and check neighbourcell bcch carrier
350 * if the BCCH is read completely.
351 */
352 att_copy_sys_info_2_2bis_par (index,
353 sys_info_2_2bis,
354 new_2_2bis_list,
355 ncell_ext,
356 si_type,
357 FALSE);
358
359 if (index EQ CR_INDEX)
360 {
361 att_check_neighbourcell_si_reestab();
362 }
363 break;
364
365 case ATT_IDLE:
366 case ATT_CON_EST:
367 switch (index)
368 {
369 case SC_INDEX:
370 /*
371 * changed system information type 2/2bis message received for
372 * the serving cell. Store relevant parameter and reconfigure
373 * Layer 1 and MM if needed
374 */
375 att_copy_sys_info_2_2bis_par (SC_INDEX,
376 sys_info_2_2bis,
377 new_2_2bis_list,
378 ncell_ext,
379 si_type,
380 TRUE);
381
382 att_check_barred_status_in_idle ();
383 #ifdef GPRS
384 if(att_gprs_is_avail() AND (rr_data->sc_data.cd.sys_info_read EQ ALL_SYS_INFO_READ))
385 {
386 TRACE_EVENT ("SI 2 or 2bis received after SI 13");
387
388 if(rr_data->sc_data.selection_type EQ CELL_RESELECTION_ON_GPRS_ACT)
389 {
390 TIMERSTOP(T_RESELECT);
391 }
392
393 switch (GET_STATE(STATE_GPRS))
394 {
395 case GPRS_PIM_PBCCH:
396 att_gprs_stop_pl();
397 break;
398 case GPRS_PIM_BCCH:
399 att_build_idle_req(SC_INDEX, MODE_SYS_INFO_CHANGE);
400 break;
401 default:
402 break;
403 }
404 att_signal_gprs_support();
405 }
406 #endif
407 break;
408
409 case CR_INDEX:
410 /*
411 * for 2 case:system information 2 is only important to speed up the
412 * PLMN available search.
413 * for 2bis case:system information type 2bis message is stored. This is needed
414 * for PLMN available search. Really taken in account after
415 * reception of system info 2,3 or 4.
416 */
417 att_copy_sys_info_2_2bis_par (CR_INDEX,
418 sys_info_2_2bis,
419 new_2_2bis_list,
420 ncell_ext,
421 si_type,
422 FALSE);
423 if (si_type EQ SI_TYPE_2)
424 {
425 /*
426 * if all is read, add the PLMN to the found list
427 */
428 switch (rr_data->ms_data.req_mm_service)
429 {
430 case FUNC_NET_SRCH_BY_MMI:
431 att_check_bcch_carrier_si ();
432 break;
433 default:
434 TRACE_EVENT_P1 ( "req_mm_service:%d", rr_data->ms_data.req_mm_service );
435 break;
436 }
437 }
438 break;
439 }
440 break;
441 default:
442 break;
443 }
444 }
445
446
447 /*
448 +--------------------------------------------------------------------+
449 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
450 | STATE : code ROUTINE : att_for_sysinfo_type2ter |
451 +--------------------------------------------------------------------+
452
453 PURPOSE : A system information message 2ter has received.
454
455 */
456 GLOBAL void att_for_sysinfo_type2ter (USHORT arfcn,
457 T_D_SYS_INFO_2TER *sys_info_2ter,
458 T_LIST *new_2ter_list)
459 {
460 GET_INSTANCE_DATA;
461 /*
462 * get the storage area by checking the channel number
463 */
464 UBYTE index = att_get_index (arfcn);
465
466 TRACE_FUNCTION ("att_for_sysinfo_type2ter()");
467
468 switch (GET_STATE (STATE_ATT))
469 {
470 case ATT_CS2:
471 /*
472 * during cell selection only CR_INDEX is taken in account
473 */
474 if (index EQ CR_INDEX)
475 {
476 /*
477 * copy relevant parameters and check bcch carrier
478 * if the BCCH is read completely.
479 */
480 att_copy_sys_info_2ter_par (CR_INDEX,
481 sys_info_2ter,
482 new_2ter_list,
483 FALSE);
484
485 att_check_bcch_carrier_si ();
486 }
487 break;
488
489 case ATT_CS3:
490 /*
491 * during cell selection only CR_INDEX is taken in account
492 */
493
494 /*
495 * copy relevant parameters and check bcch carrier
496 * if the BCCH is read completely.
497 */
498 att_copy_sys_info_2ter_par (index,
499 sys_info_2ter,
500 new_2ter_list,
501 FALSE);
502
503 if (index EQ CR_INDEX)
504 {
505 att_check_neighbourcell_si_reestab();
506 }
507 break;
508
509 case ATT_IDLE:
510 case ATT_CON_EST:
511 switch (index)
512 {
513 case SC_INDEX:
514 /*
515 * changed system information type 2bis message received for
516 * the serving cell. Store relevant parameter and reconfigure
517 * Layer 1 and MM if needed
518 */
519 att_copy_sys_info_2ter_par (SC_INDEX,
520 sys_info_2ter,
521 new_2ter_list,
522 TRUE);
523 #ifdef GPRS
524 if(att_gprs_is_avail() AND (rr_data->sc_data.cd.sys_info_read EQ ALL_SYS_INFO_READ))
525 {
526 TRACE_EVENT ("SI 2ter received after SI 13");
527
528 if(rr_data->sc_data.selection_type EQ CELL_RESELECTION_ON_GPRS_ACT)
529 {
530 TIMERSTOP(T_RESELECT);
531 }
532
533 switch (GET_STATE(STATE_GPRS))
534 {
535 case GPRS_PIM_PBCCH:
536 att_gprs_stop_pl();
537 break;
538 case GPRS_PIM_BCCH:
539 att_build_idle_req(SC_INDEX, MODE_SYS_INFO_CHANGE);
540 break;
541 default:
542 break;
543 }
544 att_signal_gprs_support();
545 }
546 #endif
547 break;
548 case CR_INDEX:
549 /*
550 * system information type 2bis message is stored. This is needed
551 * for PLMN available search. Really taken in account after
552 * reception of system info 2,3 or 4.
553 */
554 att_copy_sys_info_2ter_par (CR_INDEX,
555 sys_info_2ter,
556 new_2ter_list,
557 FALSE);
558 break;
559 }
560 break;
561 default:
562 break;
563 }
564 }
565
566 /*
567 +--------------------------------------------------------------------+
568 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
569 | STATE : code ROUTINE : att_for_sysinfo_type3 |
570 +--------------------------------------------------------------------+
571
572 PURPOSE : A system information message 3 has received.
573
574 */
575
576 GLOBAL void att_for_sysinfo_type3 (USHORT arfcn,
577 T_D_SYS_INFO_3 *sys_info_3)
578 {
579 GET_INSTANCE_DATA;
580 /*
581 * get the storage area by checking the channel number
582 */
583 UBYTE index = att_get_index (arfcn);
584
585 TRACE_FUNCTION ("att_for_sysinfo_type3()");
586
587 TRACE_EVENT_P8 ("SI3: MCC=%X%X%X MNC=%X%X%X LAC=%04X CID=%04X",
588 sys_info_3->loc_area_ident.mcc[0],
589 sys_info_3->loc_area_ident.mcc[1],
590 sys_info_3->loc_area_ident.mcc[2],
591 sys_info_3->loc_area_ident.mnc[0],
592 sys_info_3->loc_area_ident.mnc[1],
593 sys_info_3->loc_area_ident.mnc[2],
594 sys_info_3->loc_area_ident.lac,
595 sys_info_3->cell_ident);
596
597 if ( index EQ NOT_PRESENT_8BIT )
598 return;
599
600 #ifdef GPRS
601 rr_data->nc_data[index].si13_loc_ind = SI13_NOT_PRESENT;
602 if(sys_info_3->si3_rest_oct.v_gprs_indic)
603 if(sys_info_3->si3_rest_oct.gprs_indic.si13_pos EQ SI13_ON_BCCH_EXT)
604 rr_data->nc_data[index].si13_loc_ind = EXTENDED_BCCH;
605 else
606 rr_data->nc_data[index].si13_loc_ind = NORMAL_BCCH;
607 #endif
608 switch (GET_STATE (STATE_ATT))
609 {
610 case ATT_CS2:
611 /*
612 * during cell selection only CR_INDEX is taken in account
613 */
614 if (index EQ CR_INDEX)
615 {
616 /*
617 * copy relevant parameters and check bcch carrier
618 * if the BCCH is read completely.
619 */
620 att_copy_sys_info_3_par (CR_INDEX,
621 sys_info_3,
622 FALSE);
623 /*
624 * During Cell Selection if received SI3 from a PLMN which doesn't match
625 * requested PLMN then no need to wait for remaining SI messages
626 * The First Scan First Attempt is for Full Service search and only
627 * the carriers with Normal Priority is scanned and for this if the PLMN
628 * doesnot match, then no need to read remaining SIs. In the sucessive scans
629 * i.e First Scan Second Attempt and Second scan all the carriers are scanned
630 * irrespective of the priority and all the SI messages need to be read.
631 */
632 if ((rr_data->cs_data.scan_mode EQ CS_FIRST_SCAN_FIRST_ATTEMPT) AND
633 (rr_data->ms_data.req_mm_service EQ FUNC_PLMN_SRCH) AND
634 (!dat_plmn_equal_req (sys_info_3->loc_area_ident.mcc,
635 sys_info_3->loc_area_ident.mnc,
636 rr_data->ms_data.plmn.mcc,
637 rr_data->ms_data.plmn.mnc)))
638 {
639 att_set_sys_info_read ( SYS_INFO_4_READ |
640 SYS_INFO_1_READ |
641 SYS_INFO_2_READ |
642 SYS_INFO_2BIS_READ |
643 SYS_INFO_2TER_READ, index);
644 #ifdef GPRS
645 att_set_sys_info_read (SYS_INFO_13_READ, index);
646 #endif
647 }
648 #ifdef GPRS
649 else
650 {
651 att_check_gprs_supp (sys_info_3->si3_rest_oct.v_gprs_indic,
652 &sys_info_3->si3_rest_oct.gprs_indic);
653 }
654 #endif
655 att_check_bcch_carrier_si ();
656 }
657 break;
658
659 case ATT_CS3:
660 /*
661 * during cell reselection only CR_INDEX is taken in account
662 */
663
664 /*
665 * copy relevant parameters and check neighbourcell bcch carrier
666 * if the BCCH is read completely.
667 */
668 att_copy_sys_info_3_par (index,
669 sys_info_3,
670 FALSE);
671
672 if (index EQ CR_INDEX)
673 {
674 #ifdef GPRS
675 att_check_gprs_supp (sys_info_3->si3_rest_oct.v_gprs_indic,
676 &sys_info_3->si3_rest_oct.gprs_indic);
677 #endif
678
679 att_check_neighbourcell_si_reestab();
680 }
681 else
682 {
683 /* We have received some SYS INFO which is not the CR candidate */
684 rr_data->nc_data[index].bcch_status = DECODED;
685 rr_data->nc_data[index].bcch_counter = 0;
686 rr_data->nc_data[index].c1_counter = 0;
687 }
688 break;
689
690 case ATT_IDLE:
691 case ATT_CON_EST:
692 switch (index)
693 {
694 case SC_INDEX:
695 /*
696 * changed system information type 3 message received for
697 * the serving cell. Store relevant parameter and reconfigure
698 * Layer 1 and MM if needed
699 */
700 #ifdef GPRS
701 att_check_gprs_supp (sys_info_3->si3_rest_oct.v_gprs_indic,
702 &sys_info_3->si3_rest_oct.gprs_indic);
703 #endif
704
705 att_copy_sys_info_3_par (SC_INDEX,
706 sys_info_3,
707 TRUE);
708
709 att_check_barred_status_in_idle ();
710 break;
711
712 case CR_INDEX:
713 /*
714 * it is for a cell which is read in parallel during idle mode
715 */
716 att_copy_sys_info_3_par (CR_INDEX,
717 sys_info_3,
718 FALSE);
719
720
721 /*
722 * depending on the requested MM service
723 */
724
725 /* Implements RR Clone findings #30 */
726 att_sys_info_read(SYS_INFO_4_READ);
727
728
729
730 break;
731
732 case NOT_PRESENT_8BIT:
733 /*
734 * unexpected channel number
735 */
736 break;
737
738 default:
739 {
740 BOOL plmn_ok = TRUE;
741
742 if(rr_data->ms_data.rr_service EQ FULL_SERVICE)
743 {
744 /*
745 * Sometimes the BA list contains cells from other PLMN's
746 */
747 plmn_ok = dat_plmn_equal_req (sys_info_3->loc_area_ident.mcc,
748 sys_info_3->loc_area_ident.mnc,
749 rr_data->ms_data.plmn.mcc,
750 rr_data->ms_data.plmn.mnc);
751 }
752 if(plmn_ok)
753 {
754 /*
755 * neighbour cell, copy parameters and set status to decoded.
756 */
757 att_copy_sys_info_3_par (index,sys_info_3,FALSE);
758 att_bcch_status_to_decoded (index);
759 }
760 else
761 TRACE_EVENT_P2("[%u]i%u Ignoring SI3 as plmn_ok = FALSE", rr_data->nc_data[index].arfcn, index);
762 }
763 break;
764 }
765 break;
766 default:
767 break;
768 }
769 }
770
771 /*
772 +--------------------------------------------------------------------+
773 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
774 | STATE : code ROUTINE : att_for_sysinfo_type4 |
775 +--------------------------------------------------------------------+
776
777 PURPOSE : A system information message 4 has received.
778
779 */
780
781 GLOBAL void att_for_sysinfo_type4 (USHORT arfcn,
782 T_D_SYS_INFO_4 *sys_info_4)
783 {
784 GET_INSTANCE_DATA;
785 /*
786 * get the storage area by checking the channel number
787 */
788 UBYTE index = att_get_index (arfcn);
789
790 TRACE_FUNCTION ("att_for_sysinfo_type4()");
791
792 TRACE_EVENT_P7 ("SI4: MCC=%X%X%X MNC=%X%X%X LAC=%04X",
793 sys_info_4->loc_area_ident.mcc[0],
794 sys_info_4->loc_area_ident.mcc[1],
795 sys_info_4->loc_area_ident.mcc[2],
796 sys_info_4->loc_area_ident.mnc[0],
797 sys_info_4->loc_area_ident.mnc[1],
798 sys_info_4->loc_area_ident.mnc[2],
799 sys_info_4->loc_area_ident.lac);
800
801 if ( index EQ NOT_PRESENT_8BIT )
802 return;
803
804 #ifdef GPRS
805 rr_data->nc_data[index].si13_loc_ind = SI13_NOT_PRESENT;
806 if(sys_info_4->si4_rest_oct.v_gprs_indic)
807 if(sys_info_4->si4_rest_oct.gprs_indic.si13_pos EQ SI13_ON_BCCH_EXT)
808 rr_data->nc_data[index].si13_loc_ind = EXTENDED_BCCH;
809 else
810 rr_data->nc_data[index].si13_loc_ind = NORMAL_BCCH;
811 #endif
812 switch (GET_STATE (STATE_ATT))
813 {
814 case ATT_CS2:
815 /*
816 * during cell selection only CR_INDEX is taken in account
817 */
818 if (index EQ CR_INDEX)
819 {
820 /*
821 * copy relevant parameters and check bcch carrier
822 * if the BCCH is read completely.
823 */
824 att_copy_sys_info_4_par (CR_INDEX,
825 sys_info_4,
826 FALSE);
827 /*
828 * During Cell Selection if received SI4 from a PLMN which doesn't match
829 * requested PLMN then no need to wait for remaining SI messages
830 * The First Scan First Attempt is for Full Service search and only
831 * the carriers with Normal Priority is scanned and for this if the PLMN
832 * doesnot match, then no need to read remaining SIs. In the sucessive scans
833 * i.e First Scan Second Attempt and Second scan all the carriers are scanned
834 * irrespective of the priority and all the SI messages need to be read.
835 */
836 if ((rr_data->cs_data.scan_mode EQ CS_FIRST_SCAN_FIRST_ATTEMPT) AND
837 (rr_data->ms_data.req_mm_service EQ FUNC_PLMN_SRCH) AND
838 (!dat_plmn_equal_req (sys_info_4->loc_area_ident.mcc,
839 sys_info_4->loc_area_ident.mnc,
840 rr_data->ms_data.plmn.mcc,
841 rr_data->ms_data.plmn.mnc)))
842 {
843 att_set_sys_info_read ( SYS_INFO_3_READ |
844 SYS_INFO_1_READ |
845 SYS_INFO_2_READ |
846 SYS_INFO_2BIS_READ |
847 SYS_INFO_2TER_READ, index);
848 #ifdef GPRS
849 att_set_sys_info_read (SYS_INFO_13_READ, index);
850 #endif
851 }
852 #ifdef GPRS
853 else
854 {
855 if (!sys_info_4->cell_select.acs)
856 {
857 att_check_gprs_supp(sys_info_4->si4_rest_oct.v_gprs_indic,
858 &sys_info_4->si4_rest_oct.gprs_indic);
859 }
860 }
861 #endif
862 att_check_bcch_carrier_si ();
863 }
864 break;
865
866 case ATT_CS3:
867 /*
868 * during cell reselection only CR_INDEX is taken in account
869 */
870
871 /*
872 * copy relevant parameters and check neighbourcell bcch carrier
873 * if the BCCH is read completely.
874 */
875 att_copy_sys_info_4_par (index,
876 sys_info_4,
877 FALSE);
878
879 if (index EQ CR_INDEX)
880 {
881 #ifdef GPRS
882 if (!sys_info_4->cell_select.acs)
883 {
884 att_check_gprs_supp(sys_info_4->si4_rest_oct.v_gprs_indic,
885 &sys_info_4->si4_rest_oct.gprs_indic);
886 }
887 #endif
888 att_check_neighbourcell_si_reestab();
889 }
890 else
891 {
892 if (!sys_info_4->cell_select.acs)
893 {
894 /*
895 * if system information type 4 contains all information
896 * for calculation C2, copy this parameter and declare channel
897 * as decoded, that means as a candidate for cell reselection.
898 */
899 att_copy_c2_parameter_si4 (index, &sys_info_4->si4_rest_oct);
900 rr_data->nc_data[index].bcch_status = DECODED;
901 rr_data->nc_data[index].bcch_counter = 0;
902 rr_data->nc_data[index].c1_counter = 0;
903 }
904 }
905 break;
906
907 case ATT_IDLE:
908 case ATT_CON_EST:
909 switch (index)
910 {
911 case SC_INDEX:
912 /*
913 * changed system information type 4 message received for
914 * the serving cell. Store relevant parameter and reconfigure
915 * Layer 1 and MM if needed
916 */
917 att_copy_sys_info_4_par (SC_INDEX,
918 sys_info_4,
919 TRUE);
920 att_check_barred_status_in_idle ();
921 break;
922
923 case NOT_PRESENT_8BIT:
924 /*
925 * unexpected channel number, ignore
926 */
927 break;
928
929 case CR_INDEX:
930 /*
931 * channel for which RR searches in parallel
932 */
933 att_copy_sys_info_4_par (CR_INDEX,
934 sys_info_4,
935 FALSE);
936 if (!sys_info_4->cell_select.acs)
937 {
938 att_copy_c2_parameter_si4 (index, &sys_info_4->si4_rest_oct);
939 }
940
941 /*
942 * depending on the service requested by MM
943 */
944
945 /* Implements RR Clone findings #30 */
946 att_sys_info_read(SYS_INFO_3_READ);
947
948
949 break;
950
951 default:
952 {
953 BOOL plmn_ok = TRUE;
954
955 if(rr_data->ms_data.rr_service EQ FULL_SERVICE)
956 {
957 /*
958 * Sometimes the BA list contains cells from other PLMN's
959 */
960 plmn_ok = dat_plmn_equal_req (sys_info_4->loc_area_ident.mcc,
961 sys_info_4->loc_area_ident.mnc,
962 rr_data->ms_data.plmn.mcc,
963 rr_data->ms_data.plmn.mnc);
964 }
965 if(plmn_ok)
966 {
967 /*
968 * Neighbour cell BCCH
969 */
970 att_copy_sys_info_4_par (index, sys_info_4, FALSE);
971
972 if (!sys_info_4->cell_select.acs)
973 {
974 /*
975 * if system information type 4 contains all information
976 * for calculation C2, copy this parameter and declare channel
977 * as decoded, that means as a candidate for cell reselection.
978 */
979 att_copy_c2_parameter_si4 (index, &sys_info_4->si4_rest_oct);
980 att_bcch_status_to_decoded (index);
981 }
982 }
983 else
984 TRACE_EVENT_P2("[%u]i%u Ignoring SI4 as plmn_ok = FALSE", rr_data->nc_data[index].arfcn, index);
985 }
986 break;
987 }
988 break;
989
990 default:
991 break;
992 }
993 }
994
995 /* Implements RR Clone findings #2 */
996 /*unify functions: att_for_sysinfo_type5, att_for_sysinfo_type5bis by adding a parameter si_type*/
997
998 /*
999 +--------------------------------------------------------------------+
1000 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1001 | STATE : code ROUTINE : att_for_sysinfo_type5_5bis |
1002 +--------------------------------------------------------------------+
1003
1004 PURPOSE : This function handles the system information type 5 and 5bis
1005 common parameters.
1006
1007 */
1008 GLOBAL void att_for_sysinfo_type5_5bis(USHORT arfcn,
1009 T_LIST *new_5_5bis_list,
1010 UBYTE old_index,
1011 UBYTE ncell_ext,
1012 T_SI_TYPE si_type)
1013
1014 {
1015 GET_INSTANCE_DATA;
1016 /*
1017 * calculate the index for the channel
1018 */
1019 UBYTE index = att_get_index (arfcn);
1020
1021 USHORT cur_si_type_read; /*Current SI type*/
1022 USHORT oth_si_type_read; /*The other SI type in this function*/
1023 USHORT oth_si_to_clean;/*The other SI to clean in this function*/
1024
1025 TRACE_FUNCTION("att_for_sysinfo_type5_5bis()");
1026
1027 /*
1028 * only messages for the serving cell are taken in account
1029 */
1030 if (index NEQ SC_INDEX)
1031 {
1032 return;
1033 }
1034
1035 switch (GET_STATE (STATE_ATT))
1036 {
1037 case ATT_DEDICATED:
1038 case ATT_CON_EST:
1039 if (dat_check_error_flag (SEND_NO_RR_STATUS))
1040 {
1041 /*
1042 * receiving a modified BA indicator forces discarding the current BA
1043 * receiving a SI5 while the bit SYS_INFO_5_READ is set or
1044 * receiving a SI5Bis while the bit SYS_INFO_5Bis_READ is set
1045 * indicates a change of the BA list
1046 * => clear old channel list
1047 * => delete other SI5x read bit mask
1048 */
1049 if(si_type EQ SI_TYPE_5)
1050 {
1051 cur_si_type_read = SYS_INFO_5_READ;
1052 oth_si_type_read = SYS_INFO_5BIS_READ;
1053 oth_si_to_clean = IND_SI_5BIS;
1054 }
1055 else
1056 {
1057 cur_si_type_read = SYS_INFO_5BIS_READ;
1058 oth_si_type_read = SYS_INFO_5_READ;
1059 oth_si_to_clean = IND_SI_5;
1060 }
1061
1062 if (old_index NEQ rr_data->sc_data.ba_index OR
1063 (rr_data->sc_data.cd.sys_info_read & ( cur_si_type_read) )EQ
1064 (cur_si_type_read))
1065 {
1066 srv_copy_list (&rr_data->sc_data.cd.ncell_list, new_5_5bis_list,
1067 sizeof (T_LIST));
1068 srv_clear_list(&rr_data->sc_data.five_ter_list);
1069 rr_data->sc_data.cd.sys_info_read &=
1070 ~((oth_si_type_read) | SYS_INFO_5TER_READ);
1071 att_clean_buf( (USHORT)((oth_si_to_clean) | IND_SI_5TER));
1072 }
1073 else if ( (rr_data->sc_data.cd.sys_info_read &
1074 (cur_si_type_read | oth_si_type_read)) EQ 0 )
1075 {
1076 /* neither SI5 nor SI5bis received before */
1077 srv_copy_list (&rr_data->sc_data.cd.ncell_list,
1078 new_5_5bis_list,
1079 sizeof (T_LIST));
1080 }
1081 else
1082 {
1083 /*
1084 * SI5bis/SI5 received before
1085 * merge list of sys info 5/sys info 5bis with the old neighbour cell list
1086 */
1087 srv_merge_list (&rr_data->sc_data.cd.ncell_list, new_5_5bis_list);
1088 }
1089 /* CSI-LLD section:4.1.1.11
1090 * This function Updates the black list with the BA list received in si5/si5bis
1091 */
1092 cs_remove_BA_MA_from_black_list(rr_data->cs_data.region,new_5_5bis_list);
1093
1094 /*
1095 * set concerning bit mask
1096 * if the extension indication not set,
1097 * the sys info carries the complete BA
1098 */
1099 att_set_sys_info_read ((cur_si_type_read), SC_INDEX);
1100 if (!ncell_ext) /* in case of 5bis, is't possible, that 5bis carries the complete BA???*/
1101 {
1102 att_set_sys_info_read ((oth_si_type_read), SC_INDEX);
1103 }
1104
1105 att_code_mph_ncell_req_dedicated ();
1106 }
1107 break;
1108
1109 default:
1110 break;
1111 }
1112 }
1113
1114 /*
1115 +--------------------------------------------------------------------+
1116 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1117 | STATE : code ROUTINE : att_for_sysinfo_type5ter |
1118 +--------------------------------------------------------------------+
1119
1120 PURPOSE : A system information message 5ter has received.
1121
1122 */
1123
1124 GLOBAL void att_for_sysinfo_type5ter (USHORT arfcn,
1125 T_LIST *new_5ter_list)
1126 {
1127 GET_INSTANCE_DATA;
1128 /*
1129 * calculate the index for the channel
1130 */
1131 UBYTE index = att_get_index (arfcn);
1132 TRACE_FUNCTION ("att_for_sysinfo_type5ter()");
1133
1134 /*
1135 * only messages for the serving cell are taken in account
1136 */
1137 if (index NEQ SC_INDEX)
1138 return;
1139
1140 switch (GET_STATE (STATE_ATT))
1141 {
1142 case ATT_DEDICATED:
1143 case ATT_CON_EST:
1144 if (dat_check_error_flag (SEND_NO_RR_STATUS))
1145 {
1146 /*
1147 * if there is received a new SI5ter, it replaces the old
1148 * five_ter_list
1149 */
1150 att_set_sys_info_read (SYS_INFO_5TER_READ, SC_INDEX);
1151 srv_copy_list (&rr_data->sc_data.five_ter_list, new_5ter_list,
1152 sizeof (T_LIST));
1153
1154 /* CSI-LLD section:4.1.1.11
1155 * This function Updates the black list with the BA list received in si5ter
1156 */
1157 cs_remove_BA_MA_from_black_list(rr_data->cs_data.region,new_5ter_list);
1158
1159 att_code_mph_ncell_req_dedicated ();
1160 }
1161 break;
1162
1163 default:
1164 break;
1165 }
1166 }
1167
1168 /*
1169 +--------------------------------------------------------------------+
1170 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1171 | STATE : code ROUTINE : att_for_sysinfo_type6 |
1172 +--------------------------------------------------------------------+
1173
1174 PURPOSE : A system information type 6 message has received.
1175
1176 */
1177
1178 /*
1179 * two tables to convert air-interface coding for dtx (depending on full
1180 * or halfrate) to the internal coding
1181 */
1182 static const UBYTE dtx_halfrate [8] =
1183 { FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE };
1184 static const UBYTE dtx_fullrate [8] =
1185 { TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE };
1186
1187
1188 GLOBAL void att_for_sysinfo_type6 (USHORT arfcn,
1189 T_D_SYS_INFO_6 *sys_info_6)
1190 {
1191 GET_INSTANCE_DATA;
1192 /*
1193 * calculate the index for the channel
1194 */
1195 UBYTE index = att_get_index (arfcn);
1196 UBYTE transfer = FALSE;
1197 UBYTE new_dtx;
1198
1199 TRACE_FUNCTION ("att_for_sysinfo_type6()");
1200
1201 /*
1202 * only messages for the serving cell are taken in account
1203 */
1204 if (index NEQ SC_INDEX)
1205 return;
1206
1207 switch (GET_STATE (STATE_ATT))
1208 {
1209 case ATT_DEDICATED:
1210 case ATT_CON_EST:
1211 if (dat_check_error_flag (SEND_NO_RR_STATUS))
1212 {
1213 /*
1214 * store location information for the serving cell
1215 */
1216 rr_data->nc_data[SC_INDEX].cell_id = sys_info_6->cell_ident;
1217 memcpy (&rr_data->nc_data[SC_INDEX].lai,
1218 &sys_info_6->loc_area_ident,
1219 sizeof (T_loc_area_ident));
1220
1221 /*
1222 * set new dtx values
1223 */
1224 rr_data->sc_data.cd.dtx_half = dtx_halfrate [(sys_info_6->cell_opt_sacch.dtx2_s << 2) +
1225 sys_info_6->cell_opt_sacch.dtx_s];
1226 rr_data->sc_data.cd.dtx_full = dtx_fullrate [(sys_info_6->cell_opt_sacch.dtx2_s << 2) +
1227 sys_info_6->cell_opt_sacch.dtx_s];
1228 if (rr_data->sc_data.chan_desc.chan_type EQ 2 OR
1229 rr_data->sc_data.chan_desc.chan_type EQ 3)
1230 new_dtx = rr_data->sc_data.cd.dtx_half;
1231 else
1232 new_dtx = rr_data->sc_data.cd.dtx_full;
1233
1234 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
1235 rr_data->sc_data.cd.band_indicator = sys_info_6->si6_rest_oct.band_indicator;
1236 att_update_std_band_indicator (rr_data->sc_data.cd.band_indicator);
1237 #endif
1238
1239 /*
1240 * Check change of DTX value
1241 */
1242 if (rr_data->sc_data.cd.dtx NEQ new_dtx)
1243 {
1244 transfer = TRUE;
1245 rr_data->sc_data.cd.dtx = new_dtx;
1246 }
1247
1248 /*
1249 * Check Power Control Indicator
1250 */
1251 if (rr_data->sc_data.cd.cell_options.pow_ctrl NEQ sys_info_6->cell_opt_sacch.pow_ctrl)
1252 {
1253 transfer = TRUE;
1254 rr_data->sc_data.cd.cell_options.pow_ctrl = sys_info_6->cell_opt_sacch.pow_ctrl;
1255 }
1256
1257 /*
1258 * Check Radio Link Timeout
1259 */
1260 if (rr_data->sc_data.cd.cell_options.rlt NEQ sys_info_6->cell_opt_sacch.rlt)
1261 {
1262 transfer = TRUE;
1263 rr_data->sc_data.cd.cell_options.rlt = sys_info_6->cell_opt_sacch.rlt;
1264 }
1265
1266 /*
1267 * Copy NCC Permitted
1268 */
1269 rr_data->sc_data.cd.ncc_permitted = sys_info_6->ncc_permit;
1270
1271 /*
1272 * transfer changed values to layer 1 if available
1273 */
1274 if (transfer)
1275 dat_code_sys_info_change (rr_data->sc_data.cd.dtx,
1276 rr_data->sc_data.cd.cell_options.pow_ctrl,
1277 rr_data->sc_data.cd.cell_options.rlt);
1278 }
1279 break;
1280 }
1281 }
1282
1283 /*
1284 +--------------------------------------------------------------------+
1285 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1286 | STATE : code ROUTINE : att_for_sysinfo_type7_8 |
1287 +--------------------------------------------------------------------+
1288
1289 PURPOSE : a system information message type 7 or 8 has received.
1290
1291 */
1292
1293 GLOBAL void att_for_sysinfo_type7_8 (USHORT arfcn,
1294 T_D_SYS_INFO_8 *sys_info_8)
1295 {
1296 GET_INSTANCE_DATA;
1297 /*
1298 * calculate the index for the channel
1299 */
1300 UBYTE index = att_get_index (arfcn);
1301
1302 TRACE_FUNCTION ("att_for_sysinfo_type7_8()");
1303
1304 if ( index EQ NOT_PRESENT_8BIT )
1305 return;
1306
1307 switch (GET_STATE (STATE_ATT))
1308 {
1309 case ATT_CS2:
1310 case ATT_IDLE:
1311 case ATT_CON_EST:
1312 switch (index)
1313 {
1314 case SC_INDEX:
1315 att_copy_sys_info_7_8_par (SC_INDEX,
1316 sys_info_8);
1317 break;
1318 case CR_INDEX:
1319 att_copy_sys_info_7_8_par (CR_INDEX,
1320 sys_info_8);
1321 break;
1322 case NOT_PRESENT_8BIT:
1323 break;
1324
1325 default:
1326 /*
1327 * Neighbour cell BCCH requested
1328 */
1329 att_copy_sys_info_7_8_par (index,
1330 sys_info_8);
1331 att_bcch_status_to_decoded (index);
1332 break;
1333 }
1334 break;
1335
1336 case ATT_CS3:
1337 att_copy_sys_info_7_8_par (index, sys_info_8);
1338 rr_data->nc_data[index].bcch_status = DECODED;
1339 rr_data->nc_data[index].bcch_counter = 0;
1340 rr_data->nc_data[index].c1_counter = 0;
1341 break;
1342 default:
1343 break;
1344 }
1345 }
1346
1347 /*
1348 +--------------------------------------------------------------------+
1349 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1350 | STATE : code ROUTINE : att_bsic_ind |
1351 +--------------------------------------------------------------------+
1352
1353 PURPOSE : Handling of the signal att_bsic_ind from the cell selection
1354 process. The signal is the positive result of a bsic request
1355 to layer 1.
1356
1357 */
1358
1359 GLOBAL void att_bsic_ind (USHORT arfcn, UBYTE rxlev, UBYTE bsic)
1360 {
1361 GET_INSTANCE_DATA;
1362 TRACE_FUNCTION ("att_bsic_ind()");
1363
1364 switch (GET_STATE (STATE_ATT))
1365 {
1366 case ATT_CS1:
1367 case ATT_CS2:
1368 /*
1369 * during cell selection
1370 *
1371 * store parameters of the carrier
1372 */
1373 rr_data->nc_data[CR_INDEX].arfcn = arfcn;
1374 rr_data->nc_data[CR_INDEX].rxlev = rxlev;
1375 rr_data->nc_data[CR_INDEX].bsic = bsic;
1376
1377 /*
1378 * prepare reading of the BCCH, clear bitmap
1379 * and start timer to control the end of BCCH reading.
1380 */
1381 att_init_cr_data();
1382 TIMERSTART (T_RESELECT, TRESELECT_VALUE);
1383 rr_data->nc_data[CR_INDEX].bcch_error = 0;
1384 srv_clear_list (&rr_data->cr_data.cd.ncell_list);
1385 SET_STATE (STATE_ATT, ATT_CS2);
1386 srv_use_stored_prim ();
1387 break;
1388
1389 case ATT_IDLE:
1390 case ATT_CON_EST:
1391 /*
1392 * A search in parallel to the idle mode is ongoing.
1393 */
1394 if (arfcn EQ rr_data->nc_data[SC_INDEX].arfcn)
1395 {
1396 /*
1397 * short cut if this is the current serving cell
1398 */
1399 PALLOC (mph_sync_req, MPH_SYNC_REQ);
1400
1401 mph_sync_req->cs = CS_STOP_BCCH_READING;
1402
1403 PSENDX (PL, mph_sync_req);
1404
1405 /*
1406 * simulate BCCH reading by copying serving cell data
1407 */
1408 memcpy (&rr_data->nc_data[CR_INDEX],
1409 &rr_data->nc_data[SC_INDEX],
1410 sizeof (T_NC_DATA));
1411 /* Copy the neighbour cell list also */
1412 memcpy (&rr_data->cr_data.cd, &rr_data->sc_data.cd,
1413 sizeof (T_CELL_DATA));
1414
1415 rr_data->nc_data[CR_INDEX].arfcn = arfcn;
1416 rr_data->nc_data[CR_INDEX].rxlev = rxlev;
1417 rr_data->nc_data[CR_INDEX].bsic = bsic;
1418
1419 att_check_bcch_carrier ();
1420 }
1421 else
1422 {
1423 /*
1424 * store the data from the BSIC confirmation
1425 */
1426 rr_data->nc_data[CR_INDEX].arfcn = arfcn;
1427 rr_data->nc_data[CR_INDEX].rxlev = rxlev;
1428 rr_data->nc_data[CR_INDEX].bsic = bsic;
1429
1430 /*
1431 * initialize parameters for BCCH reading
1432 */
1433 att_init_cr_data();
1434 TIMERSTART (T_RESELECT, TRESELECT_VALUE);
1435 srv_use_stored_prim ();
1436 rr_data->nc_data[CR_INDEX].bcch_error = 0;
1437 srv_clear_list (&rr_data->cr_data.cd.ncell_list);
1438 }
1439 break;
1440
1441 default:
1442 break;
1443 }
1444 }
1445
1446 /*
1447 +--------------------------------------------------------------------+
1448 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1449 | STATE : code ROUTINE : att_no_bsic_ind |
1450 +--------------------------------------------------------------------+
1451
1452 PURPOSE : no bsic indication from cell selection process indicates
1453 the end of the search for a carrier by BSIC requests.
1454
1455 */
1456
1457 GLOBAL void att_no_bsic_ind (void)
1458 {
1459 GET_INSTANCE_DATA;
1460 TRACE_FUNCTION ("att_no_bsic_ind()");
1461
1462 switch (GET_STATE (STATE_ATT))
1463 {
1464 case ATT_CS1:
1465 case ATT_CS2:
1466 /*
1467 * depending on the service requested by MM
1468 */
1469 switch (rr_data->ms_data.req_mm_service)
1470 {
1471 case FUNC_NET_SRCH_BY_MMI:
1472 /*
1473 * MM has requested the list of available
1474 * PLMNs. Allow cell reselection decision
1475 * again and send list to MM.
1476 */
1477 rr_data->ms_data.rr_service = NO_SERVICE;
1478 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL);
1479 SET_STATE (STATE_ATT, ATT_NO_SERVICE);
1480 att_start_registration_timer ();
1481 srv_use_stored_prim ();
1482 break;
1483
1484 default:
1485 /*
1486 * limited or full serivce requested by MM
1487 */
1488 switch (rr_data->ms_data.req_mm_service)
1489 {
1490 case FUNC_LIM_SERV_ST_SRCH:
1491 /*
1492 * If MM has requested FUNC_PLMN_SRCH
1493 * but no suitable cell was found and
1494 * RR tried to reach limited service
1495 * or MM only requested limited service
1496 * but RR could not find an acceptable cell
1497 * return no service
1498 */
1499 rr_data->ms_data.rr_service = NO_SERVICE;
1500 att_reset_old_lai_rac();
1501 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL);
1502 SET_STATE (STATE_ATT, ATT_NO_SERVICE);
1503 att_start_registration_timer ();
1504 srv_use_stored_prim ();
1505 break;
1506
1507 case FUNC_PLMN_SRCH:
1508 /*
1509 * no BCCH for full service found
1510 */
1511 if(rr_data->cs_data.scan_mode EQ CS_FIRST_SCAN_FIRST_ATTEMPT)
1512 {
1513
1514 rr_data->cs_data.scan_mode = CS_FIRST_SCAN_SECOND_ATTEMPT;
1515
1516 TRACE_EVENT("First Scan First Attempt done");
1517
1518 /*
1519 * first attempt then look for low priority cells
1520 */
1521 if (cs_def_list (LOW_PRIORITY_CELL))
1522 {
1523
1524 TRACE_EVENT("First Scan Second attempt started");
1525 /*
1526 * low priority cells available, then try it again
1527 */
1528 cs_start_sync ();
1529 break;
1530 }
1531 }
1532
1533 /*
1534 * no BCCH for full service available and the low
1535 * priority cells have been tried. Then try
1536 * to reach limited service by checking
1537 * for emergency cells
1538 */
1539 if (cs_def_list (EMERGENCY_CELL) AND
1540 rr_data->cs_data.scan_mode EQ CS_FIRST_SCAN_SECOND_ATTEMPT)
1541 {
1542 /*
1543 * emergency cells available
1544 */
1545 rr_data->cs_data.scan_mode = CS_SECOND_SCAN;
1546 rr_data->ms_data.rr_service = LIMITED_SERVICE;
1547 TRACE_EVENT ("no suitable cell found, find acceptable cell");
1548 /*
1549 * clear any pending RR_ESTABLISH_REQ
1550 * MM would retransmit RR_ESTABLISH_REQ for emergency calls
1551 */
1552 srv_clear_stored_prim (RR_ESTABLISH_REQ);
1553 cs_start_sync ();
1554 }
1555 else
1556 {
1557 /*
1558 * no emergency cells availabe, then no service.
1559 */
1560 srv_clear_stored_prim (RR_ESTABLISH_REQ);
1561 rr_data->ms_data.rr_service = NO_SERVICE;
1562 att_reset_old_lai_rac();
1563 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL);
1564 SET_STATE (STATE_ATT, ATT_NO_SERVICE);
1565
1566 /* CSI-LLD section:4.1.1.10
1567 * This function updates the black list after the first successful
1568 * FUNC_PLMN_SEARCH
1569 */
1570 if(rr_data->cs_data.initial_plmn_search EQ INITIAL_PLMN_SEARCH_ACTIVE)
1571 {
1572 cs_update_black_list();
1573 rr_data->cs_data.initial_plmn_search = INITIAL_PLMN_SEARCH_DONE;
1574 }
1575
1576 att_start_registration_timer ();
1577 TRACE_EVENT ("no acceptable cell found");
1578 srv_use_stored_prim ();
1579 }
1580 break;
1581 default:
1582 break;
1583 }
1584 break;
1585 }
1586 break;
1587
1588 case ATT_IDLE:
1589 case ATT_CON_EST:
1590 switch (rr_data->ms_data.req_mm_service)
1591 {
1592 case FUNC_NET_SRCH_BY_MMI:
1593 /*
1594 * allow cell reselection decision
1595 */
1596 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL);
1597 att_start_registration_timer ();
1598 srv_use_stored_prim ();
1599 break;
1600
1601 case FUNC_PLMN_SRCH:
1602 /*
1603 * no BCCH for full service found
1604 */
1605 TRACE_EVENT ("Full Requested, end of Search");
1606 if (rr_data->ms_data.rr_service EQ LIMITED_SERVICE)
1607 {
1608 /* we trap here if RR tried to reach the from MM requested
1609 FUNC_PLMN_SRCH service
1610 but could not find a suitable cell
1611 The acceptable cell will be the serving cell
1612 we don't look for another one.
1613 */
1614 att_reset_old_lai_rac();
1615 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL);
1616 }
1617 else
1618 {
1619 /* this was a search for the HPLMN don't inform
1620 * MM because we have FULL_SERVICE on a VPLMN
1621 */
1622 att_notify_stop_plmn_search (FALSE);
1623 #if 0
1624 if (rr_data->gprs_data.gprs_indic)
1625 {
1626 att_signal_gprs_support();
1627 }
1628 #endif
1629 EM_HPLMN_SEARCH_FAILED;
1630 }
1631
1632 att_start_registration_timer ();
1633 break;
1634 case FUNC_LIM_SERV_ST_SRCH:
1635 /*
1636 * no BCCH for limited service found
1637 */
1638 rr_data->ms_data.rr_service = NO_SERVICE;
1639 att_reset_old_lai_rac();
1640 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL);
1641 SET_STATE (STATE_ATT, ATT_NO_SERVICE);
1642 att_start_registration_timer ();
1643 srv_use_stored_prim ();
1644 break;
1645
1646 default:
1647 break;
1648 }
1649 break;
1650 }
1651 }
1652
1653
1654 /*
1655 +--------------------------------------------------------------------+
1656 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1657 | STATE : code ROUTINE : att_full_service_found |
1658 +--------------------------------------------------------------------+
1659
1660 PURPOSE : Performs all tasks required after reaching Full Service
1661 CSI-LLD section:4.1.3.4.1.7
1662
1663 */
1664
1665 GLOBAL void att_full_service_found(void)
1666 {
1667 GET_INSTANCE_DATA;
1668
1669 TRACE_FUNCTION("att_full_service_found()");
1670
1671 /* Stop search mode timers */
1672 TIMERSTOP(T_FAST_CS);
1673 TIMERSTOP(T_NORMAL_CS);
1674
1675 /* Update the white list */
1676 dat_convert_white_list();
1677
1678 /* Send SI2 info to MM */
1679 dat_send_bcchinfo_mm (rr_data->cr_data.cr_white_list.si2);
1680
1681 TRACE_EVENT("RR SERVICE = FULL SERVICE");
1682
1683 }
1684
1685
1686 /*convert into a function (si_type {SI3,SI4})*/
1687
1688 /*
1689 +--------------------------------------------------------------------+
1690 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1691 | STATE : code ROUTINE : att_sys_info_read |
1692 +--------------------------------------------------------------------+
1693
1694 PURPOSE : This function sets the sys_info_read flag based on the passed
1695 system information type
1696
1697 */
1698 LOCAL void att_sys_info_read(USHORT mess_bit)
1699 {
1700 GET_INSTANCE_DATA;
1701 TRACE_FUNCTION("att_sys_info_read()");
1702
1703 switch (rr_data->ms_data.req_mm_service)
1704 {
1705 case FUNC_NET_SRCH_BY_MMI:
1706 /*
1707 * PLMN available search
1708 *
1709 * it is useless to read system info 1, 2ter and 4
1710 */
1711 att_set_sys_info_read ( mess_bit |
1712 SYS_INFO_1_READ |
1713 SYS_INFO_2_READ |
1714 SYS_INFO_2BIS_READ |
1715 SYS_INFO_2TER_READ, CR_INDEX);
1716 #ifdef GPRS
1717 att_set_sys_info_read (SYS_INFO_13_READ, CR_INDEX);
1718 #endif
1719
1720 /*
1721 * enough info available for PLMN available search
1722 */
1723 att_check_bcch_carrier_si ();
1724 break;
1725
1726 case FUNC_PLMN_SRCH:
1727 switch (rr_data->ms_data.rr_service)
1728 {
1729 case LIMITED_SERVICE:
1730 /*
1731 * RR is in limited service. So this search triggered by
1732 * RR shall reach full service again.
1733 */
1734 att_check_fplmn_cell ();
1735 break;
1736
1737 default:
1738 break;
1739 }
1740 break;
1741 }
1742 }
1743 /*
1744 +--------------------------------------------------------------------+
1745 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
1746 | STATE : code ROUTINE : att_copy_sys_info_2_2bis_par |
1747 +--------------------------------------------------------------------+
1748
1749 PURPOSE : This function handles system information type 2 and 2bis common
1750 parameters
1751
1752 */
1753 LOCAL void att_copy_sys_info_2_2bis_par(UBYTE index,
1754 T_VOID_STRUCT *sys_info_2_2bis,
1755 T_LIST *new_2_2bis_list,
1756 UBYTE ncell_ext,
1757 T_SI_TYPE si_type,
1758 UBYTE indicate_changes)
1759 {
1760 TRACE_FUNCTION("att_copy_sys_info_2_2bis_par()");
1761
1762 if (si_type EQ SI_TYPE_2)
1763 {
1764 att_copy_sys_info_2_par (index,
1765 (T_D_SYS_INFO_2 *)sys_info_2_2bis,
1766 new_2_2bis_list,
1767 ncell_ext,
1768 indicate_changes);
1769 }
1770 else if (si_type EQ SI_TYPE_2BIS)
1771 {
1772 att_copy_sys_info_2bis_par (index,
1773 (T_D_SYS_INFO_2BIS *)sys_info_2_2bis,
1774 new_2_2bis_list,
1775 ncell_ext,
1776 indicate_changes);
1777 }
1778
1779 }
1780
1781
1782 #endif