FreeCalypso > hg > fc-tourmaline
comparison src/g23m-gsm/rr/rr_attp.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
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 : This module defines the functions for the attachment | |
18 | capability of the module Radio Resource. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef RR_ATTP_C | |
23 #define RR_ATTP_C | |
24 | |
25 #define ENTITY_RR | |
26 | |
27 /*==== INCLUDES ===================================================*/ | |
28 | |
29 #include <string.h> | |
30 #include <stdlib.h> | |
31 #include <stddef.h> /* offsetof */ | |
32 #include "typedefs.h" | |
33 #include "pcm.h" | |
34 #include "pconst.cdg" | |
35 #include "mconst.cdg" | |
36 #include "message.h" | |
37 #include "ccdapi.h" | |
38 #include "vsi.h" | |
39 #include "custom.h" | |
40 #include "gsm.h" | |
41 #include "prim.h" | |
42 #include "cnf_rr.h" | |
43 #include "tok.h" | |
44 #include "rr.h" | |
45 #include "rr_em.h" | |
46 #include "cl_shrd.h" | |
47 | |
48 #if defined (_SIMULATION_) | |
49 #include <stdio.h> | |
50 #endif | |
51 | |
52 | |
53 /*==== EXPORT =====================================================*/ | |
54 | |
55 /*==== PRIVATE =====================================================*/ | |
56 /*==== PROTOTYPES =================================================*/ | |
57 | |
58 LOCAL void att_align_sc_meas (T_MPH_MEASUREMENT_IND * mph_meas_ind, | |
59 UBYTE index); | |
60 | |
61 /*==== VARIABLES ==================================================*/ | |
62 /* | |
63 * ------------------------------------------------------------------- | |
64 * PRIMITIVE Processing functions | |
65 * ------------------------------------------------------------------- | |
66 */ | |
67 | |
68 /* | |
69 +--------------------------------------------------------------------+ | |
70 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
71 | STATE : code ROUTINE : att_mph_error_ind | | |
72 +--------------------------------------------------------------------+ | |
73 | |
74 PURPOSE : Process the primitive MPH_ERROR_IND received from PL. | |
75 | |
76 */ | |
77 | |
78 #define MAX_ERROR_CS 9 | |
79 #define MAX_ERROR_IDLE 4 | |
80 | |
81 GLOBAL void att_mph_error_ind (T_MPH_ERROR_IND *mph_error_ind) | |
82 { | |
83 GET_INSTANCE_DATA; | |
84 UBYTE index; | |
85 | |
86 TRACE_FUNCTION ("att_mph_error_ind()"); | |
87 | |
88 switch (GET_STATE (STATE_ATT)) | |
89 { | |
90 case ATT_CS2: | |
91 /* | |
92 * during cell selection | |
93 */ | |
94 switch (mph_error_ind->cs) | |
95 { | |
96 case CS_BCCH_READ_ERROR: | |
97 /* | |
98 * BCCH read error | |
99 */ | |
100 rr_data->bcch_error++; | |
101 if (rr_data->bcch_error EQ MAX_ERROR_CS) | |
102 { | |
103 /* | |
104 * maximum of BCCH read errors reached | |
105 * start next sync request if possible | |
106 */ | |
107 rr_data->bcch_error = 0; | |
108 srv_clear_list (&rr_data->cr_data.cd.ncell_list); | |
109 if (cs_sync_next ()) | |
110 { | |
111 SET_STATE (STATE_ATT, ATT_CS1); | |
112 } | |
113 break; | |
114 } | |
115 break; | |
116 | |
117 case CS_DOWN_LINK_FAIL: | |
118 /* | |
119 * downlink failure, | |
120 * layer 1 has received too many undecodable paging messages | |
121 * that means the synchronisation to the BS is lost | |
122 */ | |
123 TRACE_EVENT ("downlink failure"); | |
124 | |
125 EM_DOWNLINK_FAILURE; | |
126 | |
127 /* | |
128 * stop the controlling timer | |
129 */ | |
130 TIMERSTOP (T_RESELECT); | |
131 | |
132 /* | |
133 * start cell selection, actually its questionable | |
134 * if this ever happens, maybe except for the primitive crossing | |
135 * case | |
136 */ | |
137 /*XY:n don't inform GRR, but call start_cs anyway */ | |
138 #ifdef GPRS | |
139 att_start_cell_selection_gprs ((UBYTE)(rr_data->sc_data.mm_started),FULL_SEARCH_MODE); | |
140 #else | |
141 att_start_cell_selection (rr_data->sc_data.mm_started, CS_NOT_PARALLEL,FULL_SEARCH_MODE); | |
142 #endif | |
143 break; | |
144 | |
145 } | |
146 break; | |
147 | |
148 case ATT_CS3: | |
149 /* | |
150 * during cell reselection | |
151 */ | |
152 switch (mph_error_ind->cs) | |
153 { | |
154 case CS_BCCH_READ_ERROR: | |
155 /* | |
156 * BCCH read error | |
157 */ | |
158 rr_data->bcch_error++; | |
159 TRACE_EVENT_P2 ("bcch_error=%u (%u)", rr_data->bcch_error, MAX_ERROR_CS); | |
160 if (rr_data->bcch_error EQ MAX_ERROR_CS) | |
161 { | |
162 /* | |
163 * the maximum of read errors is reached | |
164 * try the next cell for cell reselection | |
165 */ | |
166 #ifdef GPRS | |
167 if(rr_data->gprs_data.cr_pbcch_active EQ TRUE) | |
168 { | |
169 att_cell_reselection_gprs_failed(); | |
170 } | |
171 else | |
172 { | |
173 #endif | |
174 rr_data->bcch_error = 0; | |
175 rr_data->pag_rec = FALSE; | |
176 srv_clear_stored_prim (MPH_PAGING_IND); | |
177 att_continue_cell_reselect (); | |
178 #ifdef GPRS | |
179 } | |
180 #endif | |
181 } | |
182 break; | |
183 | |
184 case CS_DOWN_LINK_FAIL: | |
185 /* | |
186 * downlink failure, | |
187 * layer 1 has received too many undecodable paging messages | |
188 * that means the synchronisation to the BS is lost | |
189 */ | |
190 TRACE_EVENT ("downlink failure"); | |
191 EM_DOWNLINK_FAILURE; | |
192 | |
193 | |
194 /* | |
195 * try the next candidate for the cell reselection | |
196 */ | |
197 att_continue_cell_reselect () ; | |
198 break; | |
199 | |
200 case CS_NC_SYNC_FAILED: | |
201 /* | |
202 * Cell has no valid synchronization information | |
203 */ | |
204 TRACE_EVENT ("No Valid Sync info"); | |
205 | |
206 /* | |
207 * try the next candidate for the cell reselection | |
208 */ | |
209 att_continue_cell_reselect () ; | |
210 break; | |
211 | |
212 } | |
213 break; | |
214 | |
215 case ATT_DEDICATED: | |
216 /* | |
217 * during dedicated mode | |
218 */ | |
219 switch (mph_error_ind->cs) | |
220 { | |
221 case CS_RADIO_LINK_FAIL: | |
222 /* | |
223 * radio link failure. | |
224 * That means layer 1 has received too many | |
225 * undecodable SACCH blocks in the downlink | |
226 * The synchronisation to the BS is lost. | |
227 */ | |
228 TRACE_EVENT ("radio link failure"); | |
229 | |
230 /* | |
231 * dynamic configuration command : IHO | |
232 * Lock the DUT to the cell it is already camping - | |
233 * Ignore the Radio Link Failures. | |
234 */ | |
235 | |
236 if(rr_data->dyn_config.iho AND (rr_data->sc_data.ch_mode EQ CM_AMR)) | |
237 { | |
238 TRACE_EVENT("MPH_ERROR_IND : IHO"); | |
239 } | |
240 else | |
241 { | |
242 EM_RADIO_LINK_FAILURE; | |
243 | |
244 rr_data->net_lost = TRUE; | |
245 | |
246 /* | |
247 * Inform MM about the radio link failure and | |
248 * start cell reslection | |
249 */ | |
250 att_code_rr_abort_ind (RRCS_ABORT_RAD_LNK_FAIL); | |
251 att_stop_dedicated(); | |
252 } | |
253 break; | |
254 } | |
255 break; | |
256 | |
257 case ATT_IDLE: | |
258 case ATT_CON_EST: | |
259 /* | |
260 * during idle mode or connection establishment | |
261 */ | |
262 switch (mph_error_ind->cs) | |
263 { | |
264 case CS_BCCH_READ_ERROR: | |
265 /* | |
266 * A BCCH read error has occured. | |
267 * It is checked whether the BCCH reading | |
268 * is done for a PLMN search activity | |
269 * originated by RR, else it is ignored. | |
270 */ | |
271 index = att_get_index (mph_error_ind->arfcn); | |
272 if (index EQ CR_INDEX) | |
273 { | |
274 rr_data->bcch_error++; | |
275 if (rr_data->bcch_error EQ MAX_ERROR_IDLE) | |
276 { | |
277 /* | |
278 * if the maximum of read errors is reached | |
279 * the next cell is tried. | |
280 */ | |
281 rr_data->bcch_error = 0; | |
282 TIMERSTOP (T_RESELECT); | |
283 srv_clear_list (&rr_data->cr_data.cd.ncell_list); | |
284 cs_sync_next (); | |
285 } | |
286 break; | |
287 } | |
288 break; | |
289 | |
290 case CS_DOWN_LINK_FAIL: | |
291 /* | |
292 * downlink failure | |
293 */ | |
294 TRACE_EVENT ("downlink failure"); | |
295 EM_DOWNLINK_FAILURE; | |
296 | |
297 rr_data->net_lost = TRUE; | |
298 | |
299 if(GET_STATE (STATE_ATT) EQ ATT_CON_EST) | |
300 { | |
301 switch (rr_data->ms_data.establish_cause) | |
302 { | |
303 #ifdef GPRS | |
304 case ESTCS_GPRS_1P: | |
305 case ESTCS_GPRS_SB: | |
306 case ESTCS_GPRS_PAGING: | |
307 SET_STATE(STATE_GPRS, GPRS_PIM_BCCH); | |
308 break; | |
309 case ESTCS_PAGING: | |
310 dat_rr_release_ind(RRCS_ABNORM_UNSPEC, 0); | |
311 #else | |
312 case ESTCS_PAGING: | |
313 #endif | |
314 break; | |
315 default: | |
316 dat_rr_release_ind(RRCS_ABNORM_UNSPEC, 0); | |
317 break; | |
318 } | |
319 } | |
320 | |
321 /* | |
322 * Only start reselection, if isnīt any PLMN search active | |
323 */ | |
324 if (rr_data->start_cell_reselection) | |
325 { | |
326 /*XY:n inform GRR, and wait for CR_RSP | |
327 should only happen in PIM_BCCH */ | |
328 #ifdef GPRS | |
329 att_start_cell_reselection_gprs (CELL_RESELECTION); | |
330 #else | |
331 att_start_cell_reselection (CELL_RESELECTION); | |
332 #endif | |
333 } | |
334 break; | |
335 | |
336 } | |
337 break; | |
338 | |
339 default: | |
340 break; | |
341 } | |
342 | |
343 | |
344 PFREE (mph_error_ind); | |
345 } | |
346 | |
347 /* | |
348 +--------------------------------------------------------------------+ | |
349 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
350 | STATE : code ROUTINE : att_mph_sync_ind | | |
351 +--------------------------------------------------------------------+ | |
352 | |
353 PURPOSE : Process the primitive MPH_SYNC_IND received from PL. | |
354 | |
355 */ | |
356 | |
357 GLOBAL void att_mph_sync_ind (T_MPH_SYNC_IND *mph_sync_ind) | |
358 { | |
359 GET_INSTANCE_DATA; | |
360 TRACE_FUNCTION ("att_mph_sync_ind()"); | |
361 | |
362 switch (GET_STATE (STATE_ATT)) | |
363 { | |
364 case ATT_CS2: | |
365 case ATT_CS3: | |
366 if (mph_sync_ind->cs EQ CS_SYS_INFO_1_NOT_NEEDED) | |
367 { | |
368 /* | |
369 * layer 1 indicates that system information message type 1 | |
370 * is not available. Update the bitmap of the read messages. | |
371 */ | |
372 att_set_sys_info_read (SYS_INFO_1_READ, CR_INDEX); | |
373 } | |
374 #ifdef GPRS | |
375 else if(mph_sync_ind->cs EQ CS_SCELL_IS_SYNCED) | |
376 { | |
377 if(rr_data->gprs_data.cr_pbcch_active) | |
378 { | |
379 PALLOC(sync_ind, RRGRR_SYNC_IND); | |
380 sync_ind->sync_res = SYNC_OK; | |
381 PSENDX(GRR, sync_ind); | |
382 | |
383 SET_STATE(STATE_GPRS,GPRS_PIM_PBCCH); | |
384 rr_data->gprs_data.cr_pbcch_active = FALSE; | |
385 rr_data->nc_data[CR_INDEX].arfcn = NOT_PRESENT_16BIT; | |
386 SET_STATE (STATE_ATT, ATT_IDLE); | |
387 } | |
388 } | |
389 #endif | |
390 break; | |
391 | |
392 #ifdef GPRS | |
393 case ATT_IDLE: | |
394 { | |
395 T_GPRS_DATA *gprs_data = &rr_data->gprs_data; | |
396 T_RRGRR_EXT_MEAS_REQ *rrgrr_ext_meas_req = gprs_data->rrgrr_ext_meas_req; | |
397 T_RRGRR_EXT_MEAS_CNF *rrgrr_ext_meas_cnf = gprs_data->rrgrr_ext_meas_cnf; | |
398 | |
399 if ( mph_sync_ind->cs EQ CS_STOP_PLMN_SEARCH AND | |
400 rrgrr_ext_meas_req NEQ NULL ) | |
401 { | |
402 rrgrr_ext_meas_cnf->call_ref = rrgrr_ext_meas_req->call_ref; | |
403 if ( gprs_data->ext_meas_ctrl & EXT_MEAS_RESET ) | |
404 rrgrr_ext_meas_cnf->xmeas_cause = EXT_MEAS_RESET; | |
405 else | |
406 rrgrr_ext_meas_cnf->xmeas_cause = EXT_MEAS_OK; | |
407 | |
408 att_ext_meas_end(FALSE); | |
409 SET_STATE (STATE_CELL_SEL, CS_IDLE); | |
410 PSENDX ( GRR, rrgrr_ext_meas_cnf ); | |
411 } | |
412 } | |
413 break; | |
414 #endif | |
415 | |
416 default: | |
417 break; | |
418 } | |
419 PFREE (mph_sync_ind); | |
420 } | |
421 | |
422 /* | |
423 +--------------------------------------------------------------------+ | |
424 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
425 | STATE : code ROUTINE : att_mph_measurement_ind | | |
426 +--------------------------------------------------------------------+ | |
427 | |
428 PURPOSE : Process MPH_MEASUREMENT_IND received from layer 1. | |
429 | |
430 */ | |
431 | |
432 GLOBAL void att_mph_measurement_ind (T_MPH_MEASUREMENT_IND *mph_measurement_ind) | |
433 { | |
434 GET_INSTANCE_DATA; | |
435 TRACE_FUNCTION ("att_mph_measurement_ind()"); | |
436 | |
437 /* | |
438 * Defines the time in frame numbers from the last measurements. | |
439 */ | |
440 rr_data->ms_data.fn_offset = (ULONG)mph_measurement_ind->fn_offset; | |
441 | |
442 switch (GET_STATE (STATE_ATT)) | |
443 { | |
444 case ATT_CS2: | |
445 /* | |
446 * FTA problem with 20.19 testcase | |
447 * This function is used to eliminate poor serving cell | |
448 * RX level values due to spurious measurements. | |
449 */ | |
450 #if defined(_SIMULATION_) | |
451 TRACE_EVENT_WIN_P5 ("ATT_CS2: MPH_MEASUREMENT_IND[%u] rx=%d %svalid (NC%u[%u])", | |
452 mph_measurement_ind->arfcn, mph_measurement_ind->rx_lev_full, | |
453 mph_measurement_ind->valid ? "" : "in", SC_INDEX, | |
454 rr_data->nc_data[SC_INDEX].arfcn); | |
455 #endif | |
456 att_align_sc_meas (mph_measurement_ind, SC_INDEX); | |
457 break; | |
458 | |
459 case ATT_CS3: | |
460 /* | |
461 * clear the barrier for the candidate if exists and | |
462 * update the fieldstrength value | |
463 */ | |
464 #if defined(_SIMULATION_) | |
465 TRACE_EVENT_WIN_P5 ("ATT_CS3: MPH_MEASUREMENT_IND[%u] rx=%d %svalid (NC%u[%u])", | |
466 mph_measurement_ind->arfcn, mph_measurement_ind->rx_lev_full, | |
467 mph_measurement_ind->valid ? "" : "in", | |
468 CR_INDEX, rr_data->nc_data[CR_INDEX].arfcn); | |
469 #endif | |
470 reset_tnnn (CR_INDEX); | |
471 // rr_data->nc_data[CR_INDEX].rxlev = mph_measurement_ind->rx_lev_full; | |
472 att_align_sc_meas (mph_measurement_ind, CR_INDEX); | |
473 break; | |
474 | |
475 case ATT_DEDICATED: | |
476 | |
477 if (mph_measurement_ind->valid) | |
478 { | |
479 /* | |
480 * if the measurement report is valid, store it | |
481 * for later use (building of measurement message | |
482 * and ranking of cells if coming back to idle mode). | |
483 */ | |
484 memcpy (&rr_data->ms_data.measurement_report, mph_measurement_ind, | |
485 sizeof (T_MPH_MEASUREMENT_IND)); | |
486 | |
487 /*Store most recently received timing advance for SC*/ | |
488 rr_data->sc_data.new_ta = rr_data->ms_data.measurement_report.otd/2; | |
489 att_set_tim_advance_info(); | |
490 /* | |
491 * This function is used to eliminate poor serving cell | |
492 * RX level values due to spurious measurements. | |
493 */ | |
494 att_align_sc_meas (mph_measurement_ind, SC_INDEX); | |
495 | |
496 /* | |
497 * Set fieldstrength in dedicated mode, use rxlev sub due to DTX | |
498 */ | |
499 #ifdef FF_PS_RSSI | |
500 RX_SetValue (mph_measurement_ind->rx_lev_sub, | |
501 mph_measurement_ind->rx_qual_sub, | |
502 RX_ACCE_UNAVAILABLE); | |
503 #else | |
504 RX_SetValue (mph_measurement_ind->rx_lev_sub); | |
505 #endif | |
506 } | |
507 | |
508 reset_tnnn (SC_INDEX); | |
509 | |
510 /* | |
511 * increase power on time to delete forbidden | |
512 * location area list after 12 hours | |
513 */ | |
514 att_increase_power_on_time ((USHORT)(rr_data->ms_data.fn_offset / | |
515 PERIOD_1_SEC)); | |
516 | |
517 /* | |
518 * build the uplink SACCH message Measurement Report | |
519 */ | |
520 #if defined (REL99) && defined (TI_PS_FF_EMR) | |
521 if ( ((rr_data->sc_data.enh_para_status EQ ENH_PARA_IDLE) OR | |
522 (rr_data->sc_data.enh_para_status EQ ENH_PARA_DEDICATED)) AND | |
523 rr_data->sc_data.emr_data_current.rep_type EQ REP_TYPE_ENH ) | |
524 dat_code_enh_measure_report (mph_measurement_ind); | |
525 else | |
526 #endif | |
527 dat_code_measure_report (mph_measurement_ind); | |
528 break; | |
529 | |
530 case ATT_IDLE: | |
531 #ifdef GPRS | |
532 #if defined (REL99) && defined (TI_PS_FF_EMR) | |
533 rr_data->sc_data.emr_data_current.scale_used_last = | |
534 mph_measurement_ind->scale_used; | |
535 #endif | |
536 if(att_check_sync_results(mph_measurement_ind)) | |
537 return; | |
538 #endif | |
539 /* | |
540 * special trick for FTA testcase 20.7. | |
541 * The first paging is delayed until the | |
542 * first measurement from layer 1 arrives. | |
543 */ | |
544 rr_data->first_meas_received = TRUE; | |
545 | |
546 /* | |
547 * two dynamic configs to perform | |
548 * fast or slow cell reselection in the lab | |
549 */ | |
550 if (rr_data->dyn_config.fcr) | |
551 mph_measurement_ind->rx_lev_full = 0; | |
552 | |
553 if (rr_data->dyn_config.scr) | |
554 { | |
555 rr_data->dyn_config.scr++; | |
556 if (rr_data->dyn_config.scr < mph_measurement_ind->rx_lev_full) | |
557 mph_measurement_ind->rx_lev_full -= rr_data->dyn_config.scr; | |
558 else | |
559 mph_measurement_ind->rx_lev_full = 0; | |
560 } | |
561 | |
562 if (mph_measurement_ind->valid) | |
563 { | |
564 /* | |
565 * if the measurement report from layer 1 is valid | |
566 * | |
567 * set RX value | |
568 */ | |
569 #ifdef FF_PS_RSSI | |
570 RX_SetValue (mph_measurement_ind->rx_lev_full, | |
571 mph_measurement_ind->rx_qual_full, | |
572 rr_data->nc_data[SC_INDEX].select_para.rxlev_access_min); | |
573 #else | |
574 RX_SetValue (mph_measurement_ind->rx_lev_full); | |
575 #endif | |
576 | |
577 /* | |
578 * store the measurement report for later use, remove | |
579 * bad neighbourcells and analyze the data from layer 1 | |
580 * (remove cells which are not inside the report, | |
581 * store new cells, update counter etc.). | |
582 */ | |
583 mph_measurement_ind->rx_lev_sub = mph_measurement_ind->rx_lev_full; | |
584 memcpy (&rr_data->ms_data.measurement_report, mph_measurement_ind, | |
585 sizeof (T_MPH_MEASUREMENT_IND)); | |
586 | |
587 /* L1 always report BCCH RXLev as Zero in Idle mode, so copy | |
588 * BCCH RXLev as receivied level (rx_lev_full) on BCCH | |
589 * This will be used when we go into dedicated mode | |
590 * And comback to Idle mode within 480MS Or | |
591 * Dedicated mode was very-short duration and | |
592 * RR didn't receive any valid measurement report into | |
593 * dedicate mode. If we don't do this Cell-Reselction | |
594 * will fail as rr_data->nc_data[SC_INDEX].rxlev will be zero | |
595 * Because it is assigned as bcch_rxlev_of_sc of measurement_report | |
596 * in function att_build_back_from_dedicated. | |
597 */ | |
598 rr_data->ms_data.measurement_report.bcch_rxlev_of_sc = mph_measurement_ind->rx_lev_full; | |
599 | |
600 att_remove_bad_ncell (mph_measurement_ind); | |
601 att_analyze_measure_report (mph_measurement_ind); | |
602 | |
603 if( rr_data->c_ncell_bcch EQ NOT_INITIALISED ) | |
604 rr_data->c_ncell_bcch = mph_measurement_ind->ncells.no_of_ncells; | |
605 | |
606 if( (rr_data->c_ncell_bcch EQ 0) AND (rr_data->resel_pending EQ TRUE) ) | |
607 { | |
608 PFREE (mph_measurement_ind); | |
609 #ifdef GPRS | |
610 att_start_cell_reselection_gprs(CELL_RESELECTION_RACH); | |
611 #else | |
612 att_start_cell_reselection(CELL_RESELECTION_RACH); | |
613 #endif | |
614 rr_data->resel_pending = FALSE; | |
615 rr_data->c_ncell_bcch = NOT_INITIALISED; | |
616 return; | |
617 } | |
618 /* | |
619 * check whether a paging has been stored before receiving | |
620 * the measurement from layer 1. | |
621 */ | |
622 if (rr_data->pag_rec) | |
623 { | |
624 srv_use_stored_prim (); | |
625 rr_data->pag_rec = FALSE; | |
626 } | |
627 | |
628 /* | |
629 * delay cell reselection if network search is still ongoing | |
630 * or RR initiated plmn search has started. | |
631 */ | |
632 att_check_reselect_decision (rr_data->start_cell_reselection); | |
633 | |
634 /* | |
635 * increase power on time to delete forbidden | |
636 * location area list after 12 hours | |
637 */ | |
638 att_increase_power_on_time ((USHORT)(rr_data->ms_data.fn_offset / | |
639 PERIOD_1_SEC)); | |
640 | |
641 } | |
642 break; | |
643 | |
644 case ATT_CON_EST: | |
645 /* | |
646 * Measurements from layer 1 during connection establishment | |
647 */ | |
648 if (mph_measurement_ind->valid) | |
649 { | |
650 /* | |
651 * store the measurement report for later use, remove | |
652 * bad neighbourcells and analyze the data from layer 1 | |
653 * (remove cells which are not inside the report, | |
654 * store new cells, update counter etc.). | |
655 */ | |
656 mph_measurement_ind->rx_lev_sub = mph_measurement_ind->rx_lev_full; | |
657 memcpy (&rr_data->ms_data.measurement_report, mph_measurement_ind, | |
658 sizeof (T_MPH_MEASUREMENT_IND)); | |
659 | |
660 /* L1 always report BCCH RXLev as Zero in Connection Establishment mode, so copy | |
661 * BCCH RXLev as receivied level (rx_lev_full). | |
662 * This will be used when we go into dedicated mode | |
663 * And comback to Idle mode within 480MS Or | |
664 * Dedicated mode was very-short duration and | |
665 * RR didn't receive any valid measurement report into | |
666 * dedicate mode. If we don't do this Cell-Reselction | |
667 * will fail as rr_data->nc_data[SC_INDEX].rxlev will be zero | |
668 * Because it is assigned as bcch_rxlev_of_sc of measurement_report | |
669 * in function att_build_back_from_dedicated. | |
670 */ | |
671 rr_data->ms_data.measurement_report.bcch_rxlev_of_sc = mph_measurement_ind->rx_lev_full; | |
672 | |
673 att_remove_bad_ncell (mph_measurement_ind); | |
674 att_analyze_measure_report (mph_measurement_ind); | |
675 | |
676 /* | |
677 * make a cell reselection decision, but do not start it. | |
678 */ | |
679 att_check_reselect_decision (FALSE); | |
680 | |
681 /* | |
682 * increase power on time to delete forbidden | |
683 * location area list after 12 hours | |
684 */ | |
685 att_increase_power_on_time ((USHORT)(rr_data->ms_data.fn_offset / | |
686 PERIOD_1_SEC)); | |
687 } | |
688 break; | |
689 | |
690 default: | |
691 break; | |
692 } | |
693 PFREE (mph_measurement_ind); | |
694 } | |
695 | |
696 /* | |
697 +--------------------------------------------------------------------+ | |
698 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
699 | STATE : code ROUTINE : att_rr_activate_req | | |
700 +--------------------------------------------------------------------+ | |
701 | |
702 PURPOSE : Process the primitive RR_ACTIVATE_REQ received from MM. | |
703 | |
704 */ | |
705 | |
706 GLOBAL void att_rr_activate_req (T_RR_ACTIVATE_REQ *rr_activate_req) | |
707 { | |
708 GET_INSTANCE_DATA; | |
709 #ifdef GPRS | |
710 T_loc_area_ident * lai = &rr_data->nc_data[SC_INDEX].lai; | |
711 #endif /* GPRS */ | |
712 | |
713 TRACE_FUNCTION ("att_rr_activate_req()"); | |
714 | |
715 /* | |
716 * set cell test operation | |
717 */ | |
718 rr_data->cell_test_operation = rr_activate_req->cell_test; | |
719 rr_data->cs_data.check_hplmn = rr_activate_req->check_hplmn; | |
720 TRACE_EVENT_P1 ( "Cell Test Operation =%d", rr_data->cell_test_operation ); | |
721 | |
722 switch (GET_STATE (STATE_ATT)) | |
723 { | |
724 case ATT_NULL: | |
725 #ifdef GPRS | |
726 if(rr_activate_req->gprs_indication AND | |
727 rr_data->gprs_data.start_proc EQ START_PROC_NOTHING) | |
728 { | |
729 att_set_gprs_indication(rr_activate_req->gprs_indication); | |
730 att_rrgrr_cr_ind(CR_NORMAL); | |
731 rr_data->gprs_data.start_proc = START_PROC_ACTIVATE_REQ; | |
732 if ( srv_check_stored_prim (RR_ACTIVATE_REQ) ) | |
733 srv_clear_stored_prim(RR_ACTIVATE_REQ); | |
734 | |
735 if( !srv_store_prim ((T_PRIM *)D2P(rr_activate_req)) ) | |
736 { | |
737 /* | |
738 * primitive already in queue or storing failed | |
739 */ | |
740 PFREE (rr_activate_req); | |
741 } | |
742 /* on CR_RSP use_stored_prim is called */ | |
743 } | |
744 else | |
745 att_handle_rr_act_req (TRUE, rr_activate_req); | |
746 #else | |
747 att_handle_rr_act_req (TRUE, rr_activate_req); | |
748 #endif | |
749 break; | |
750 | |
751 case ATT_CS_INIT: | |
752 #ifdef GPRS | |
753 if(rr_activate_req->gprs_indication AND | |
754 rr_data->gprs_data.start_proc EQ START_PROC_NOTHING) | |
755 { | |
756 TRACE_EVENT("Activating GPRS in ATT_CS_INIT"); | |
757 att_set_gprs_indication(rr_activate_req->gprs_indication); | |
758 att_rrgrr_cr_ind(CR_NORMAL); | |
759 rr_data->gprs_data.start_proc = START_PROC_ACTIVATE_REQ; | |
760 /* go ahead for storing the activate_req message */ | |
761 } | |
762 else | |
763 { | |
764 #endif | |
765 att_handle_rr_act_req (FALSE, rr_activate_req); | |
766 break; | |
767 #ifdef GPRS | |
768 } | |
769 #endif | |
770 /*lint -fallthrough*/ | |
771 | |
772 case ATT_CS1: | |
773 if ( GET_STATE (STATE_CELL_SEL) EQ CS_IDLE_ACTIVE ) | |
774 { | |
775 #ifdef GPRS | |
776 if(rr_activate_req->gprs_indication AND | |
777 rr_data->gprs_data.start_proc EQ START_PROC_NOTHING AND | |
778 rr_data->ms_data.req_mm_service EQ FUNC_LIM_SERV_ST_SRCH) | |
779 { | |
780 TRACE_EVENT("Activating GPRS in ATT_CS1"); | |
781 att_set_gprs_indication(rr_activate_req->gprs_indication); | |
782 att_rrgrr_cr_ind(CR_NORMAL); | |
783 rr_data->gprs_data.start_proc = START_PROC_ACTIVATE_REQ; | |
784 /* go ahead for storing the activate_req message */ | |
785 } | |
786 else | |
787 { | |
788 #endif | |
789 att_handle_rr_act_req (FALSE, rr_activate_req); | |
790 return; | |
791 #ifdef GPRS | |
792 } | |
793 #endif | |
794 } | |
795 /*lint -fallthrough*/ | |
796 case ATT_CS3: | |
797 case ATT_DEDICATED: | |
798 /* | |
799 * store rr activate request during cell reselection and while dedicated | |
800 * only store the latest instance of an ACTIVATE_REQ | |
801 */ | |
802 if ( srv_check_stored_prim (RR_ACTIVATE_REQ) ) | |
803 srv_clear_stored_prim(RR_ACTIVATE_REQ); | |
804 | |
805 if( !srv_store_prim ((T_PRIM *)D2P(rr_activate_req)) ) | |
806 { | |
807 /* | |
808 * primitive already in queue or storing failed | |
809 */ | |
810 PFREE (rr_activate_req); | |
811 } | |
812 break; | |
813 case ATT_CS2: | |
814 case ATT_NO_SERVICE: | |
815 case ATT_IDLE: | |
816 case ATT_CON_EST: | |
817 | |
818 #ifdef GPRS | |
819 | |
820 if(rr_activate_req->gprs_indication AND | |
821 rr_activate_req->op.func NEQ FUNC_NET_SRCH_BY_MMI AND | |
822 rr_data->gprs_data.start_proc EQ START_PROC_NOTHING) | |
823 { | |
824 if( | |
825 ( rr_data->ms_data.operation_mode EQ | |
826 ( (rr_activate_req->op.ts << 7) + (rr_activate_req->op.m << 6) + | |
827 (rr_activate_req->op.sim_ins << 5) | |
828 ) | |
829 ) | |
830 AND | |
831 ( rr_data->ms_data.req_mm_service EQ rr_activate_req->op.func) | |
832 AND | |
833 ( GET_STATE(STATE_GPRS) EQ GPRS_NULL) | |
834 AND | |
835 ( rr_data->nc_data[SC_INDEX].si13_loc_ind NEQ SI13_NOT_PRESENT ) | |
836 AND | |
837 (GET_STATE(STATE_ATT) EQ ATT_IDLE ) | |
838 AND | |
839 (dat_plmn_equal_req ( lai->mcc, | |
840 lai->mnc, | |
841 rr_activate_req->plmn.mcc, | |
842 rr_activate_req->plmn.mnc) ) | |
843 ) | |
844 { | |
845 TRACE_EVENT("gprs activation - cell reselection to same cell"); | |
846 rr_data->gprs_data.start_proc = START_PROC_GPRS_ACT; | |
847 rr_data->sc_data.selection_type = CELL_RESELECTION_ON_GPRS_ACT; | |
848 att_set_gprs_indication(rr_activate_req->gprs_indication); | |
849 PFREE (rr_activate_req); | |
850 } | |
851 else | |
852 { | |
853 rr_data->gprs_data.start_proc = START_PROC_ACTIVATE_REQ; | |
854 att_set_gprs_indication(rr_activate_req->gprs_indication); | |
855 | |
856 /* on CR_RSP use_stored_prim is called */ | |
857 if ( srv_check_stored_prim (RR_ACTIVATE_REQ) ) | |
858 srv_clear_stored_prim(RR_ACTIVATE_REQ); | |
859 if( !srv_store_prim ((T_PRIM *)D2P(rr_activate_req)) ) | |
860 { | |
861 | |
862 /* | |
863 * primitive already in queue or storing failed | |
864 */ | |
865 PFREE (rr_activate_req); | |
866 } | |
867 } | |
868 | |
869 att_rrgrr_cr_ind(CR_NORMAL); | |
870 } | |
871 else if (rr_activate_req->op.func EQ FUNC_NET_SRCH_BY_MMI AND | |
872 (GET_STATE(STATE_GPRS) EQ GPRS_PTM_BCCH OR | |
873 GET_STATE(STATE_GPRS) EQ GPRS_PTM_PBCCH OR | |
874 GET_STATE(STATE_GPRS) EQ GPRS_PAM_BCCH OR | |
875 GET_STATE(STATE_GPRS) EQ GPRS_PAM_PBCCH )) | |
876 { | |
877 rr_data->gprs_data.start_proc = START_PROC_NOTHING; | |
878 /* | |
879 * send Please Retry to the MMI instead of | |
880 * storing the primitive | |
881 */ | |
882 rr_data->sc_data.found_entries = 0; | |
883 att_code_rr_abort_ind(RRCS_ABORT_PTM); | |
884 PFREE (rr_activate_req); | |
885 } | |
886 else if (rr_activate_req->op.func EQ FUNC_NET_SRCH_BY_MMI) | |
887 { | |
888 /* this is a parallel search, don't inform GRR */ | |
889 rr_data->gprs_data.start_proc = START_PROC_NOTHING; | |
890 att_handle_rr_act_req (FALSE, rr_activate_req); | |
891 } | |
892 else if( | |
893 (rr_activate_req->gprs_indication EQ FALSE) AND | |
894 (rr_activate_req->op.func NEQ FUNC_NET_SRCH_BY_MMI) AND | |
895 (GET_STATE(STATE_ATT) EQ ATT_IDLE ) AND | |
896 (rr_data->ms_data.req_mm_service EQ rr_activate_req->op.func) AND | |
897 ( | |
898 rr_data->ms_data.operation_mode EQ | |
899 ((rr_activate_req->op.ts << 7)+(rr_activate_req->op.m << 6)+(rr_activate_req->op.sim_ins << 5)) | |
900 ) AND | |
901 (GET_STATE(STATE_GPRS) EQ GPRS_PIM_BCCH) | |
902 ) | |
903 { | |
904 att_set_gprs_indication(rr_activate_req->gprs_indication); | |
905 att_set_sys_info_read(SYS_INFO_13_READ, SC_INDEX); | |
906 att_build_idle_req(SC_INDEX, MODE_SYS_INFO_CHANGE); | |
907 att_code_rr_act_cnf(); | |
908 PFREE(rr_activate_req); | |
909 } | |
910 else /* called after, the CR_RSP is received or | |
911 if GPRS is not activated */ | |
912 att_handle_rr_act_req (FALSE, rr_activate_req); | |
913 #else | |
914 att_handle_rr_act_req (FALSE, rr_activate_req); | |
915 #endif | |
916 | |
917 break; | |
918 | |
919 | |
920 default: | |
921 PFREE (rr_activate_req); | |
922 break; | |
923 } | |
924 } | |
925 | |
926 /* | |
927 +--------------------------------------------------------------------+ | |
928 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
929 | STATE : code ROUTINE : att_rr_deactivate_req | | |
930 +--------------------------------------------------------------------+ | |
931 | |
932 PURPOSE : Process the primitive RR_DEACTIVATE_REQ received from MM. | |
933 | |
934 */ | |
935 | |
936 GLOBAL void att_rr_deactivate_req (T_RR_DEACTIVATE_REQ *rr_deactivate_req) | |
937 { | |
938 GET_INSTANCE_DATA; | |
939 UBYTE tim_idx; | |
940 PREUSE (rr_deactivate_req, mph_deactivate_req, MPH_DEACTIVATE_REQ); | |
941 | |
942 TRACE_FUNCTION ("att_rr_deactivate_req()"); | |
943 | |
944 EM_DEACTIVATION; | |
945 | |
946 #if defined(_SIMULATION_FFS_) | |
947 if(!dat_test_sim_available()) | |
948 { | |
949 /* store the white list from RAM to FFS */ | |
950 if(rr_data->ms_data.rr_service EQ FULL_SERVICE) | |
951 { | |
952 cs_store_white_list(); | |
953 } | |
954 | |
955 /* store the Black list from RAM to FFS */ | |
956 cs_store_black_list(); | |
957 } | |
958 #endif | |
959 | |
960 /* | |
961 * stop any timer which might be running | |
962 */ | |
963 for (tim_idx = 0; tim_idx < NUM_OF_RR_TIMERS; tim_idx++) | |
964 TIMERSTOP (tim_idx); | |
965 /* | |
966 * reset process states and initialize the | |
967 * gsm related data. | |
968 */ | |
969 dat_att_null (); | |
970 att_init_gsm_data (); | |
971 #ifdef GPRS | |
972 gprs_init_gprs_data(); | |
973 #endif | |
974 | |
975 cs_init_process(); | |
976 SET_STATE (STATE_ATT, ATT_NULL); | |
977 | |
978 /* | |
979 * deactivate layer 1 | |
980 */ | |
981 PSENDX (PL, mph_deactivate_req); | |
982 } | |
983 | |
984 /* | |
985 +--------------------------------------------------------------------+ | |
986 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
987 | STATE : code ROUTINE : att_rr_sync_req | | |
988 +--------------------------------------------------------------------+ | |
989 | |
990 PURPOSE : Process the primitive RR_SYNC_REQ received from MM. | |
991 | |
992 */ | |
993 | |
994 GLOBAL void att_rr_sync_req (T_RR_SYNC_REQ *rr_sync_req) | |
995 { | |
996 GET_INSTANCE_DATA; | |
997 TRACE_FUNCTION ("att_rr_sync_req()"); | |
998 | |
999 TRACE_EVENT_P2 ("RR_SYNC_REQ cs=%x att st=%u", rr_sync_req->synccs, GET_STATE (STATE_ATT)); | |
1000 | |
1001 if ((rr_sync_req->synccs NEQ NOT_PRESENT_16BIT) AND | |
1002 (rr_sync_req->synccs NEQ SYNCCS_LAI_ALLOW)) | |
1003 { | |
1004 rr_data->mode_after_dedi = MODE_CELL_RESELECTION; | |
1005 TRACE_EVENT ("rr_sync_req: MODE_CELL_RESELECTION"); | |
1006 #if defined(DL_TRACE_ENABLED) | |
1007 { | |
1008 sprintf (dl_trace_buf, "sync_req cs=%04x ->mode=%u #%u:%s", | |
1009 rr_sync_req->synccs, rr_data->mode_after_dedi, __LINE__, __FILE10__); | |
1010 DL_OFFLINE_TRACE (dl_trace_buf); | |
1011 } | |
1012 #endif /* DL_TRACE_ENABLED */ | |
1013 } | |
1014 | |
1015 if (rr_sync_req->kcv.v_kc) | |
1016 { | |
1017 /* | |
1018 * change of cipher parameter | |
1019 */ | |
1020 memcpy (rr_data->ms_data.new_kc, &rr_sync_req->kcv.kc, KC_STRING_SIZE); | |
1021 rr_data->ms_data.cksn = rr_sync_req->cksn; | |
1022 }/*if v_kc*/ | |
1023 | |
1024 if (rr_sync_req->tmsi_struct.v_mid) | |
1025 { | |
1026 /* | |
1027 * change of TMSI (a new value is defined) | |
1028 */ | |
1029 rr_data->ms_data.tmsi_available = TRUE; | |
1030 rr_data->ms_data.tmsi_binary = rr_sync_req->tmsi_struct.tmsi_dig; | |
1031 /* | |
1032 * forward the new TMSI to layer 1 | |
1033 */ | |
1034 att_mph_identity_req (); | |
1035 }/* if v_mid*/ | |
1036 | |
1037 if (rr_sync_req->op.v_op) | |
1038 { | |
1039 /* | |
1040 * change of the operation mode, typically | |
1041 * change from automatic to manual mode | |
1042 */ | |
1043 rr_data->ms_data.operation_mode = | |
1044 (rr_sync_req->op.ts << SHIFT_FOR_SIM_TYPE) + | |
1045 (rr_sync_req->op.m << SHIFT_FOR_SEARCH_OFFSET) + | |
1046 (rr_sync_req->op.sim_ins << SHIFT_FOR_SIM_INSERTED); | |
1047 att_set_func (rr_sync_req->op.func); | |
1048 | |
1049 | |
1050 switch (GET_STATE (STATE_ATT)) | |
1051 { | |
1052 case ATT_NO_SERVICE: | |
1053 case ATT_IDLE: | |
1054 case ATT_CON_EST: | |
1055 /* | |
1056 * changes from automatic to manual mode and vice versa | |
1057 * may lead to start or stop of HPLMN search. | |
1058 */ | |
1059 if (rr_data->ms_data.rr_service EQ FULL_SERVICE) | |
1060 att_start_registration_timer (); | |
1061 break; | |
1062 default: | |
1063 break; | |
1064 }/*STATE_ATT*/ | |
1065 | |
1066 }/*if v_op*/ | |
1067 | |
1068 switch (GET_STATE (STATE_ATT)) | |
1069 { | |
1070 case ATT_CS1: | |
1071 switch (rr_sync_req->synccs) | |
1072 { | |
1073 case SYNCCS_TMSI_CKSN_KC_INVAL: | |
1074 case SYNCCS_TMSI_CKSN_KC_INVAL_NO_PAG: | |
1075 /* | |
1076 * store the primitive during cell selection (power measurements) | |
1077 */ | |
1078 if (!srv_store_prim ((T_PRIM *)D2P(rr_sync_req))) | |
1079 { | |
1080 PFREE (rr_sync_req); | |
1081 }/*if*/ | |
1082 return; | |
1083 default: | |
1084 break; | |
1085 }/*synccs*/ | |
1086 break; | |
1087 | |
1088 case ATT_CS2: | |
1089 switch (rr_sync_req->synccs) | |
1090 { | |
1091 case SYNCCS_TMSI_CKSN_KC_INVAL: | |
1092 case SYNCCS_TMSI_CKSN_KC_INVAL_NO_PAG: | |
1093 /* | |
1094 * location updating reject or authentication | |
1095 * failure indicates that a new start of the cell | |
1096 * selection is needed. | |
1097 */ | |
1098 TIMERSTOP (T_RESELECT); | |
1099 /*XY:n don't inform GRR , but call start_cs anyway */ | |
1100 #ifdef GPRS | |
1101 att_start_cell_selection_gprs (RR_ORIGINATED,FULL_SEARCH_MODE); | |
1102 #else | |
1103 att_start_cell_selection (RR_ORIGINATED, CS_NOT_PARALLEL,FULL_SEARCH_MODE); | |
1104 #endif | |
1105 break; | |
1106 default: | |
1107 break; | |
1108 }/*synccs*/ | |
1109 break; | |
1110 | |
1111 case ATT_CS3: | |
1112 case ATT_DEDICATED: | |
1113 case ATT_NO_SERVICE: | |
1114 case ATT_IDLE: | |
1115 case ATT_CON_EST: | |
1116 switch (rr_sync_req->synccs) | |
1117 { | |
1118 case SYNCCS_TMSI_CKSN_KC_INVAL: | |
1119 /* | |
1120 * clear TMSI, CKSN and KC | |
1121 */ | |
1122 att_clear_reg_without_imsi (); | |
1123 break; | |
1124 | |
1125 case SYNCCS_TMSI_CKSN_KC_INVAL_NO_PAG: | |
1126 /* | |
1127 * clear TMSI, IMSI, CKSN and KC | |
1128 */ | |
1129 att_clear_registration_data (); | |
1130 break; | |
1131 default: | |
1132 break; | |
1133 }/*synccs*/ | |
1134 break; | |
1135 | |
1136 default: | |
1137 break;/*state*/ | |
1138 }/*STATE_ATT*/ | |
1139 | |
1140 | |
1141 switch (rr_sync_req->synccs) | |
1142 { | |
1143 case SYNCCS_EPLMN_LIST: | |
1144 /* | |
1145 * If sync info contains an EPLMN list | |
1146 * then this is copied regardless of state. | |
1147 * When EPLMN is not available stored EPLMN | |
1148 * is marked as invalid. | |
1149 */ | |
1150 att_copy_eplmn_list(&rr_sync_req->eq_plmn_list); | |
1151 break; | |
1152 | |
1153 case SYNCCS_LAI_ALLOW: | |
1154 | |
1155 /* Store Last Registered PLMN data from the white list */ | |
1156 rr_data->cs_data.last_reg_plmn.v_plmn = V_PLMN_PRES; | |
1157 | |
1158 memcpy (rr_data->cs_data.last_reg_plmn.mcc, rr_data->cs_data.white_list.last_sc_lac.mcc, SIZE_MCC); | |
1159 memcpy (rr_data->cs_data.last_reg_plmn.mnc, rr_data->cs_data.white_list.last_sc_lac.mnc, SIZE_MNC); | |
1160 | |
1161 TRACE_EVENT("LRPLMN copied from white list"); | |
1162 | |
1163 /* | |
1164 * successful end of location updating request, | |
1165 * remove lai from forbidden list if stored | |
1166 */ | |
1167 att_rem_lai_from_forb_list (&rr_sync_req->plmn, | |
1168 rr_sync_req->lac); | |
1169 break; | |
1170 | |
1171 case SYNCCS_LAI_NOT_ALLOW: | |
1172 /* | |
1173 * location updating reject, lai must be added to the | |
1174 * forbidden lai list. | |
1175 */ | |
1176 att_add_to_forb_list (FORBIDDEN_LIST_NORMAL, | |
1177 &rr_sync_req->plmn, | |
1178 rr_sync_req->lac); | |
1179 /* Specifications 24.008 (section 4.4.4.7) - | |
1180 * # 12: (Location Area not allowed); | |
1181 * The MS shall perform a cell selection when back to the MM IDLE state | |
1182 * according to 3GPP TS 03.22 and 3GPP TS 25.304. | |
1183 */ | |
1184 rr_data->ms_data.req_mm_service = FUNC_NET_SRCH_BY_MMI; | |
1185 att_start_cell_selection (RR_ORIGINATED, CS_PARALLEL,NORMAL_SEARCH_MODE); | |
1186 | |
1187 break; | |
1188 | |
1189 case SYNCCS_LAI_NOT_ALLOW_FOR_ROAMING: | |
1190 /* | |
1191 * location updating reject, lai must be added to the | |
1192 * forbidden lai list for roaming. | |
1193 */ | |
1194 att_add_to_forb_list (FORBIDDEN_LIST_ROAMING, | |
1195 &rr_sync_req->plmn, | |
1196 rr_sync_req->lac); | |
1197 break; | |
1198 | |
1199 case SYNCCS_TMSI_INVAL: | |
1200 /* | |
1201 * TMSI is invalid. Clear in RR and inform layer 1 | |
1202 */ | |
1203 rr_data->ms_data.tmsi_available = FALSE; | |
1204 att_mph_identity_req (); | |
1205 break; | |
1206 | |
1207 case SYNCCS_LIMITED_SERVICE: | |
1208 /* Plmn received matches with LRPLMN, flush LRPLMN */ | |
1209 if (rr_sync_req->plmn.v_plmn EQ V_PLMN_PRES) | |
1210 { | |
1211 if(!memcmp(rr_sync_req->plmn.mcc, rr_data->cs_data.last_reg_plmn.mcc, SIZE_MCC) AND | |
1212 !memcmp(rr_sync_req->plmn.mnc, rr_data->cs_data.last_reg_plmn.mnc, SIZE_MNC) | |
1213 ) | |
1214 { | |
1215 rr_data->cs_data.last_reg_plmn.v_plmn = V_PLMN_NOT_PRES; | |
1216 TRACE_EVENT ("LRPLMN Cleared"); | |
1217 } | |
1218 } | |
1219 | |
1220 /* | |
1221 * Indication to RR that only limited service | |
1222 * is possible due to location updating reject cause | |
1223 */ | |
1224 rr_data->ms_data.rr_service = LIMITED_SERVICE; | |
1225 TRACE_EVENT_P7 ("CLEAR plmn, (old MCC/MNC=%x%x%x/%x%x%x) #%u", | |
1226 rr_data->ms_data.plmn.mcc[0], | |
1227 rr_data->ms_data.plmn.mcc[1], | |
1228 rr_data->ms_data.plmn.mcc[2], | |
1229 rr_data->ms_data.plmn.mnc[0], | |
1230 rr_data->ms_data.plmn.mnc[1], | |
1231 rr_data->ms_data.plmn.mnc[2], | |
1232 __LINE__); | |
1233 memset (&rr_data->ms_data.plmn, 0, sizeof (T_plmn)); | |
1234 att_set_rr_service_info(); | |
1235 | |
1236 switch (GET_STATE (STATE_ATT)) | |
1237 { | |
1238 case ATT_NO_SERVICE: | |
1239 case ATT_IDLE: | |
1240 case ATT_CON_EST: | |
1241 att_start_registration_timer(); | |
1242 break; | |
1243 default: | |
1244 break; | |
1245 }/*STATE_ATT*/ | |
1246 | |
1247 #ifdef GPRS | |
1248 if(att_gprs_is_avail()) | |
1249 { | |
1250 /*XY: inform GRR, and wait for CR_RSP */ | |
1251 /* att_rrgrr_cr_ind(CR_NORMAL); */ | |
1252 /* rr_data->gprs_data.start_proc = START_PROC_ENTER_LIMITED; */ | |
1253 | |
1254 /* | |
1255 * During cell reselection, we should not send the primitive | |
1256 * RRGRR_GPRS_SI13_IND to GRR to inform Limited Service. | |
1257 * As this primitive is also used to mark the end of cell reselection. | |
1258 */ | |
1259 if( GET_STATE(STATE_ATT) NEQ ATT_CS3) | |
1260 att_signal_gprs_support(); | |
1261 /* action will follow after cr_rsp */ | |
1262 } | |
1263 #endif | |
1264 | |
1265 break; | |
1266 | |
1267 case SYNCCS_ACCC: | |
1268 rr_data->ms_data.access_classes = rr_sync_req->accc; | |
1269 break; /* SIM's access class by SAT changed */ | |
1270 | |
1271 default: | |
1272 if(!rr_sync_req->op.v_op OR | |
1273 !rr_sync_req->kcv.v_kc OR | |
1274 !rr_sync_req->tmsi_struct.v_mid) | |
1275 TRACE_ERROR ("Unexpected sync event"); | |
1276 break; | |
1277 }/*synccs*/ | |
1278 | |
1279 PFREE (rr_sync_req); | |
1280 | |
1281 }/*att_rr_sync_reg*/ | |
1282 | |
1283 /* | |
1284 +--------------------------------------------------------------------+ | |
1285 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
1286 | STATE : code ROUTINE : att_mph_meas_rep_cnf | | |
1287 +--------------------------------------------------------------------+ | |
1288 | |
1289 PURPOSE : Process the primitive mph_meas_rep_cnf from ALR. | |
1290 | |
1291 */ | |
1292 | |
1293 #ifdef GPRS | |
1294 GLOBAL void att_mph_meas_rep_cnf(T_MPH_MEAS_REP_CNF* mph_meas_rep_cnf) | |
1295 { | |
1296 UBYTE count; | |
1297 PALLOC(rrgrr_meas_rep_cnf, RRGRR_MEAS_REP_CNF); | |
1298 TRACE_FUNCTION("rrgrr_meas_rep_cnf()"); | |
1299 | |
1300 /*lint -e661 (Possible access of out-of-bounds pointer (26 beyond end of data) by operator '[') */ | |
1301 /*lint -e662 (Possible creation of out-of-bounds pointer (26 beyond end of data) by operator '[') */ | |
1302 for(count=0;count<RRGRR_MEAS_REP_LIST_SIZE;count++) | |
1303 { | |
1304 rrgrr_meas_rep_cnf->meas_res[count].arfcn = mph_meas_rep_cnf->meas_rep[count].arfcn; | |
1305 rrgrr_meas_rep_cnf->meas_res[count].bsic = mph_meas_rep_cnf->meas_rep[count].bsic; | |
1306 rrgrr_meas_rep_cnf->meas_res[count].rxlev = mph_meas_rep_cnf->meas_rep[count].rx_lev; | |
1307 } | |
1308 PFREE(mph_meas_rep_cnf); | |
1309 PSENDX( GRR, rrgrr_meas_rep_cnf ); | |
1310 /*lint +e662 (Possible creation of out-of-bounds pointer (26 beyond end of data) by operator '[') */ | |
1311 /*lint +e661 (Possible access of out-of-bounds pointer (26 beyond end of data) by operator '[') */ | |
1312 } | |
1313 #endif | |
1314 | |
1315 | |
1316 | |
1317 /* | |
1318 +--------------------------------------------------------------------+ | |
1319 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
1320 | STATE : code ROUTINE : att_mph_meas_order_cnf | | |
1321 +--------------------------------------------------------------------+ | |
1322 | |
1323 PURPOSE : | |
1324 | |
1325 */ | |
1326 | |
1327 GLOBAL void att_mph_meas_order_cnf (T_MPH_MEAS_ORDER_CNF* meas) | |
1328 { | |
1329 PFREE(meas); | |
1330 } | |
1331 | |
1332 /* | |
1333 +--------------------------------------------------------------------+ | |
1334 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
1335 | STATE : code ROUTINE : att_align_sc_meas | | |
1336 +--------------------------------------------------------------------+ | |
1337 | |
1338 PURPOSE : | |
1339 | |
1340 index == SC_INDEX: In this case the function is used to eliminate | |
1341 poor serving cell RX level values due to | |
1342 spurious measurements. | |
1343 | |
1344 This function is related to FTA test case 20.19. | |
1345 | |
1346 index == CR_INDEX: In this case the function is used to set the | |
1347 right aligned level of a delayed measurement report | |
1348 during cell reselection (ATT_CS3) to the cell | |
1349 with the CR_INDEX. | |
1350 | |
1351 */ | |
1352 | |
1353 LOCAL void att_align_sc_meas (T_MPH_MEASUREMENT_IND * mph_meas_ind, | |
1354 UBYTE index) | |
1355 { | |
1356 GET_INSTANCE_DATA; | |
1357 UBYTE i; | |
1358 | |
1359 TRACE_FUNCTION ("att_align_sc_meas()"); | |
1360 | |
1361 if (mph_meas_ind->valid) | |
1362 { | |
1363 if (rr_data->nc_data[index].arfcn EQ mph_meas_ind->arfcn) | |
1364 { | |
1365 /* | |
1366 * update the serving cell or cr cell fieldstrength | |
1367 */ | |
1368 #if defined(_SIMULATION_) | |
1369 TRACE_EVENT_WIN_P3 ("att_align_sc_meas(idx=%u): SC/CR=[%u], rx=%d", | |
1370 index, mph_meas_ind->arfcn, mph_meas_ind->rx_lev_full); | |
1371 #endif | |
1372 rr_data->nc_data[index].rxlev = mph_meas_ind->rx_lev_full; | |
1373 } | |
1374 else | |
1375 { | |
1376 /* | |
1377 * check all neighbourcells | |
1378 */ | |
1379 for (i=0;i<mph_meas_ind->ncells.no_of_ncells;i++) | |
1380 { | |
1381 /* | |
1382 * if the cell is also inside the neighbourcells, take | |
1383 * this fieldstrength value. | |
1384 */ | |
1385 if (mph_meas_ind->ncells.arfcn[i] EQ rr_data->nc_data[index].arfcn) | |
1386 { | |
1387 #if defined(_SIMULATION_) | |
1388 TRACE_EVENT_WIN_P3 ("att_align_sc_meas(idx=%u): nc[%u] found, rx=%d", | |
1389 index, mph_meas_ind->ncells.arfcn[i], mph_meas_ind->ncells.rx_lev[i]); | |
1390 #endif | |
1391 rr_data->nc_data[index].rxlev = mph_meas_ind->ncells.rx_lev[i]; | |
1392 return; | |
1393 } | |
1394 } | |
1395 } | |
1396 } | |
1397 } | |
1398 | |
1399 /* | |
1400 +--------------------------------------------------------------------+ | |
1401 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
1402 | STATE : code ROUTINE : att_rr_sync_hplmn_req | | |
1403 +--------------------------------------------------------------------+ | |
1404 | |
1405 PURPOSE : Process the primitive RR_SYNC_HPLMN_REQ received from MM. | |
1406 | |
1407 */ | |
1408 | |
1409 GLOBAL void att_rr_sync_hplmn_req (T_RR_SYNC_HPLMN_REQ *rr_sync_hplmn_req) | |
1410 { | |
1411 GET_INSTANCE_DATA; | |
1412 TRACE_FUNCTION ("att_rr_sync_hplmn_req()"); | |
1413 memcpy (&rr_data->ms_data.ahplmn, &rr_sync_hplmn_req->plmn, sizeof (T_plmn)); | |
1414 rr_data->ms_data.v_eq_plmn = FALSE; | |
1415 memset(&rr_data->ms_data.eq_plmn_list, 0xFF, SIZE_EPLMN); | |
1416 PFREE(rr_sync_hplmn_req); | |
1417 } | |
1418 | |
1419 #if defined FF_EOTD | |
1420 /* | |
1421 +--------------------------------------------------------------------+ | |
1422 | PROJECT : GSM-PS (6147) MODULE : RR_ATT | | |
1423 | STATE : code ROUTINE : att_mph_ncell_pos_ind | | |
1424 +--------------------------------------------------------------------+ | |
1425 | |
1426 PURPOSE : Process the primitive MPH_NCELL_POS_IND received from PL. | |
1427 | |
1428 */ | |
1429 | |
1430 GLOBAL void att_mph_ncell_pos_ind (T_MPH_NCELL_POS_IND *mph_ncell_pos_ind) | |
1431 { | |
1432 GET_INSTANCE_DATA; | |
1433 TRACE_FUNCTION ("att_mph_ncell_pos_ind()"); | |
1434 | |
1435 if ( mph_ncell_pos_ind->eotd_res EQ EOTD_SUCC ) | |
1436 { | |
1437 /* Forward input primitive to LC adding some parameters */ | |
1438 | |
1439 T_loc_area_ident *loc_area_ident; | |
1440 T_NC_DATA *sc; | |
1441 int i,n; | |
1442 | |
1443 PALLOC (rrlc_meas_ind, RRLC_MEAS_IND); | |
1444 | |
1445 sc = &rr_data->nc_data[SC_INDEX]; | |
1446 loc_area_ident = &sc->lai; | |
1447 | |
1448 memcpy ( &rrlc_meas_ind->mcc[0], &loc_area_ident->mcc[0], 3 * sizeof rrlc_meas_ind->mcc[0]); | |
1449 memcpy ( &rrlc_meas_ind->mnc[0], &loc_area_ident->mnc[0], 3 * sizeof rrlc_meas_ind->mnc[0]); | |
1450 rrlc_meas_ind->lac = loc_area_ident->lac; | |
1451 rrlc_meas_ind->cell_id = sc->cell_id; | |
1452 rrlc_meas_ind->req_id = mph_ncell_pos_ind->req_id; | |
1453 rrlc_meas_ind->tav = mph_ncell_pos_ind->ta; | |
1454 rrlc_meas_ind->fn = mph_ncell_pos_ind->fn; | |
1455 rrlc_meas_ind->eotd_sc_res = mph_ncell_pos_ind->eotd_sc_res; | |
1456 rrlc_meas_ind->eotd_sc_res1 = mph_ncell_pos_ind->eotd_sc_res1; | |
1457 n = | |
1458 rrlc_meas_ind->c_eotd_nc_res = mph_ncell_pos_ind->c_eotd_nc_res; | |
1459 for ( i = 0; i < n; ++i ) | |
1460 rrlc_meas_ind->eotd_nc_res[i] = mph_ncell_pos_ind->eotd_nc_res[i]; | |
1461 | |
1462 if ( GET_STATE (STATE_ATT) EQ ATT_DEDICATED | |
1463 #ifdef GPRS | |
1464 OR (GET_STATE (STATE_ATT) EQ ATT_IDLE AND | |
1465 GET_STATE(STATE_GPRS) EQ GPRS_PTM_BCCH AND | |
1466 GET_STATE(STATE_GPRS) EQ GPRS_PTM_PBCCH ) | |
1467 #endif | |
1468 ) | |
1469 rrlc_meas_ind->eotd_mode = EOTD_DEDIC; | |
1470 else | |
1471 rrlc_meas_ind->eotd_mode = EOTD_IDLE; | |
1472 | |
1473 /* | |
1474 * If this is a response to an explicit position measurement request, | |
1475 * then reset the flag which enables handover indications to LC. | |
1476 */ | |
1477 | |
1478 if ( rr_data->eotd_req_id NEQ NOT_PRESENT_16BIT AND | |
1479 rr_data->eotd_req_id EQ mph_ncell_pos_ind->req_id ) | |
1480 rr_data->eotd_req_id = NOT_PRESENT_16BIT; | |
1481 | |
1482 PSENDX (LC, rrlc_meas_ind); | |
1483 } | |
1484 else | |
1485 { | |
1486 PALLOC (rrlc_error_ind, RRLC_ERROR_IND); | |
1487 rrlc_error_ind->cause = LCS_WRONG_BTS; /* exact cause is unclear, assume wrong BTS */ | |
1488 PSENDX (LC, rrlc_error_ind); | |
1489 } | |
1490 PFREE(mph_ncell_pos_ind); | |
1491 } | |
1492 #endif /* FF_EOTD */ | |
1493 | |
1494 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
1495 GLOBAL void att_mph_init_rr_ind(T_MPH_INIT_RR_IND* mph_init_rr_ind) | |
1496 { | |
1497 GET_INSTANCE_DATA; | |
1498 UBYTE freq_bands; | |
1499 T_rf_power *rfp = &rr_data->ms_data.rf_cap.rf_power; | |
1500 | |
1501 TRACE_FUNCTION ("att_mph_init_rr_ind()"); | |
1502 rr_csf_get_freq_bands (&freq_bands); | |
1503 if (mph_init_rr_ind->freq_bands NEQ freq_bands) | |
1504 { | |
1505 TRACE_EVENT_P2 ("FFS data %x, doesn't match L1 compilation flag %x", freq_bands, mph_init_rr_ind->freq_bands); | |
1506 TRACE_ERROR ("FFS data doesn't match L1 compilation flag"); | |
1507 TRACE_ASSERT (freq_bands NEQ mph_init_rr_ind->freq_bands); | |
1508 } | |
1509 | |
1510 if (rfp->pow_class4[IDX_PWRCLASS_900].pow_class NEQ mph_init_rr_ind->pclass_900 OR | |
1511 rfp->pow_class4[IDX_PWRCLASS_850].pow_class NEQ mph_init_rr_ind->pclass_850 OR | |
1512 rfp->pow_class4[IDX_PWRCLASS_1800].pow_class NEQ mph_init_rr_ind->pclass_1800 OR | |
1513 rfp->pow_class4[IDX_PWRCLASS_1900].pow_class NEQ mph_init_rr_ind->pclass_1900) | |
1514 { | |
1515 TRACE_EVENT ("FFS Power Class info doesn't match L1 Powe Class info"); | |
1516 TRACE_ERROR ("FFS Power Class info doesn't match L1 Powe Class info"); | |
1517 TRACE_ASSERT (mph_init_rr_ind->pclass_900 NEQ rfp->pow_class4[IDX_PWRCLASS_900].pow_class); | |
1518 } | |
1519 PFREE(mph_init_rr_ind); | |
1520 } | |
1521 #endif | |
1522 | |
1523 #endif |