comparison g23m-gsm/rr/rr_atts.c @ 0:75a11d740a02

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