FreeCalypso > hg > fc-selenite
comparison src/g23m-gprs/grr/grr_css.c @ 1:d393cd9bb723
src/g23m-*: initial import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 04:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b6a5e36de839 | 1:d393cd9bb723 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : GRR | |
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 implements signal handler functions for service | |
18 | CS of entity GRR. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef GRR_CSS_C | |
23 #define GRR_CSS_C | |
24 #endif | |
25 | |
26 #define ENTITY_GRR | |
27 | |
28 /*==== INCLUDES =============================================================*/ | |
29 | |
30 #include "typedefs.h" /* to get Condat data types */ | |
31 | |
32 #include "vsi.h" /* to get a lot of macros */ | |
33 #include "macdef.h" | |
34 #include "gprs.h" | |
35 #include "gsm.h" /* to get a lot of macros */ | |
36 #include "ccdapi.h" /* to get CCD API */ | |
37 #include "cnf_grr.h" /* to get cnf-definitions */ | |
38 #include "mon_grr.h" /* to get mon-definitions */ | |
39 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
40 #include "message.h" | |
41 #include "grr.h" /* to get the global entity definitions */ | |
42 #include "grr_f.h" | |
43 #include "grr_css.h" | |
44 #include "grr_csf.h" | |
45 #include "grr_meass.h" | |
46 #include "grr_pgs.h" | |
47 #include "grr_tcs.h" | |
48 | |
49 /*==== CONST ================================================================*/ | |
50 | |
51 /*==== LOCAL VARS ===========================================================*/ | |
52 | |
53 | |
54 EXTERN T_NC_DATA* nc_data; | |
55 | |
56 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
57 /* | |
58 +------------------------------------------------------------------------------ | |
59 | Function : cs_cell_change_order_ind | |
60 +------------------------------------------------------------------------------ | |
61 | Description : | |
62 | | |
63 | Parameters : *d_cell_chan_order - Ptr to packet cell change order message | |
64 | | |
65 +------------------------------------------------------------------------------ | |
66 */ | |
67 LOCAL void cs_cell_change_order_ind ( T_nc_meas_par *nc_meas_par, | |
68 UBYTE v_nc_freq_list, | |
69 T_nc_freq_list *nc_freq_list | |
70 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
71 , UBYTE v_enh_meas_param_pcco, | |
72 T_enh_meas_param_pcco *enh_meas_param_pcco | |
73 #endif | |
74 ) | |
75 | |
76 | |
77 { | |
78 TRACE_FUNCTION( "cs_cell_change_order_ind" ); | |
79 | |
80 switch( GET_STATE( CS ) ) | |
81 { | |
82 case CS_IDLE: | |
83 | |
84 /* process the CS main process */ | |
85 SET_STATE( CS, CS_CR_NETWORK ); | |
86 | |
87 cs_process_cc_order( nc_meas_par, v_nc_freq_list, nc_freq_list | |
88 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
89 , v_enh_meas_param_pcco, enh_meas_param_pcco | |
90 #endif | |
91 ); | |
92 | |
93 | |
94 | |
95 if( grr_is_pbcch_present( ) EQ TRUE ) | |
96 { | |
97 if( grr_data->cs_meas.packet_mode NEQ PACKET_MODE_PTM ) | |
98 { | |
99 cs_send_cr_meas_stop_req( ); | |
100 } | |
101 } | |
102 | |
103 grr_data->cs_meas.packet_mode = PACKET_MODE_NULL; | |
104 | |
105 /*cs_init_nc_ref_list( &grr_data->db.nc_ref_lst );*/ | |
106 | |
107 /* inform service MEAS about stop of cell re-selection measurements */ | |
108 sig_cs_meas_stop( ); | |
109 | |
110 /* process the CS measurement process */ | |
111 cs_cancel_meas_report( ); | |
112 | |
113 SET_STATE( CS_MEAS, CS_MEAS_NULL ); | |
114 | |
115 cs_process_t3158( ); | |
116 | |
117 TRACE_EVENT_P4( "NC Cell Re-Selection Parameter: %d %d %d %d", | |
118 cs_get_network_ctrl_order( FALSE ), | |
119 grr_data->db.nc_ref_lst.param->rep_per_i, | |
120 grr_data->db.nc_ref_lst.param->rep_per_t, | |
121 grr_data->db.nc_ref_lst.param->non_drx_per ); | |
122 break; | |
123 | |
124 default: | |
125 TRACE_ERROR( "PACKET CELL CHANGE ORDER unexpected" ); | |
126 break; | |
127 } | |
128 }/* cs_cell_change_order_ind */ | |
129 | |
130 /* | |
131 +------------------------------------------------------------------------------ | |
132 | Function : cs_all_cells_with_cr_param | |
133 +------------------------------------------------------------------------------ | |
134 | Description : | |
135 | | |
136 | Parameters : | |
137 +------------------------------------------------------------------------------ | |
138 */ | |
139 LOCAL BOOL cs_all_cells_with_cr_param ( void ) | |
140 { | |
141 UBYTE i; /* used for counting */ | |
142 BOOL all_cells_with_cr_param = TRUE; | |
143 | |
144 TRACE_FUNCTION( "cs_all_cells_with_cr_param" ); | |
145 | |
146 for( i = 0; | |
147 i < grr_data->db.nc_ref_lst.number AND all_cells_with_cr_param EQ TRUE; | |
148 i++ ) | |
149 { | |
150 all_cells_with_cr_param = grr_data->db.nc_ref_lst.info[i]->v_cr_par; | |
151 } | |
152 | |
153 return( all_cells_with_cr_param ); | |
154 }/* cs_all_cells_with_cr_param */ | |
155 | |
156 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
157 /* | |
158 +------------------------------------------------------------------------------ | |
159 | Function : sig_ctrl_cs_start | |
160 +------------------------------------------------------------------------------ | |
161 | Description : Handles the internal signal SIG_CTRL_CS_START | |
162 | | |
163 | Parameters : dummy - description of parameter dummy | |
164 | | |
165 +------------------------------------------------------------------------------ | |
166 */ | |
167 GLOBAL void sig_ctrl_cs_start ( void) | |
168 { | |
169 UBYTE state = GET_STATE( CS ); | |
170 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
171 UBYTE psi3_cm = grr_get_psi3_cm(); | |
172 #endif | |
173 | |
174 TRACE_ISIG( "sig_ctrl_cs_start" ); | |
175 | |
176 switch( state ) | |
177 { | |
178 case CS_NULL: | |
179 SET_STATE( CS, CS_IDLE ); | |
180 | |
181 /*lint -fallthrough*/ | |
182 | |
183 case CS_IDLE: | |
184 | |
185 /*lint -fallthrough*/ | |
186 | |
187 case CS_CR_MOBILE: | |
188 case CS_CR_NETWORK: | |
189 | |
190 grr_data->db.scell_info.cell_barred = FALSE; | |
191 grr_data->cs.reselect_cause = CS_RESELECT_CAUSE_CS_NORMAL; | |
192 | |
193 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
194 /* If PCCO is received with PSI3_CM and BA_IND, then NC_FREQ list is | |
195 used in the network directed cell, only if PSI3_CM and BA_IND matches | |
196 with the ones received in PSIs or SIs in the new cell */ | |
197 if( state EQ CS_CR_NETWORK ) | |
198 { | |
199 if( ( grr_is_pbcch_present() AND (psc_db->nc_ms.psi3_cm NEQ NOT_SET) AND | |
200 (psc_db->nc_ms.psi3_cm NEQ psi3_cm) ) | |
201 OR | |
202 ( !grr_is_pbcch_present() AND (psc_db->nc_ms.ba_ind NEQ NOT_SET) AND | |
203 (psc_db->nc_ms.ba_ind NEQ psc_db->ba_ind) ) ) | |
204 { | |
205 psc_db->nc_ms.ncmeas.list.number = 0; | |
206 psc_db->nc_ms.rfreq.number = 0; | |
207 } | |
208 psc_db->nc_ms.psi3_cm = NOT_SET; | |
209 psc_db->nc_ms.ba_ind = NOT_SET; | |
210 } | |
211 #endif | |
212 | |
213 | |
214 if( grr_is_pbcch_present( ) ) | |
215 { | |
216 grr_data->cs.is_upd_ncell_stat_needed = TRUE; | |
217 | |
218 cs_build_nc_ref_list( psc_db, FALSE ); | |
219 cs_reset_nc_change_mark( psc_db ); | |
220 cs_send_cr_meas_req( CS_DELETE_MEAS_RSLT ); | |
221 sig_cs_meas_start( ); | |
222 } | |
223 else | |
224 { | |
225 cs_init_nc_mval_lst( ); | |
226 cs_build_nc_ref_list( psc_db, FALSE ); | |
227 cs_reset_nc_change_mark( psc_db ); | |
228 | |
229 if( state EQ CS_CR_NETWORK ) | |
230 { | |
231 cs_send_update_ba_req ( psc_db ); | |
232 } | |
233 } | |
234 | |
235 cs_process_t3158( ); | |
236 | |
237 TRACE_EVENT_P4( "NC Cell Re-Selection Parameter: %d %d %d %d", | |
238 cs_get_network_ctrl_order( FALSE ), | |
239 grr_data->db.nc_ref_lst.param->rep_per_i, | |
240 grr_data->db.nc_ref_lst.param->rep_per_t, | |
241 grr_data->db.nc_ref_lst.param->non_drx_per ); | |
242 break; | |
243 | |
244 default: | |
245 /* do nothing */ | |
246 break; | |
247 } | |
248 } /* sig_ctrl_cs_start() */ | |
249 | |
250 /* | |
251 +------------------------------------------------------------------------------ | |
252 | Function : sig_ctrl_cs_stop | |
253 +------------------------------------------------------------------------------ | |
254 | Description : Handles the internal signal SIG_CTRL_CS_STOP | |
255 | | |
256 | Parameters : dummy - description of parameter dummy | |
257 | | |
258 +------------------------------------------------------------------------------ | |
259 */ | |
260 GLOBAL void sig_ctrl_cs_stop ( T_CS_DC_STATUS dc_stat ) | |
261 { | |
262 TRACE_ISIG( "sig_ctrl_cs_stop" ); | |
263 | |
264 switch(dc_stat) | |
265 { | |
266 case CS_DC_DEDICATED: | |
267 cs_stop_t3158( ); | |
268 cs_reset_all_rxlev_results( ); | |
269 /* | |
270 * Stop rx_lev averaging when NC=1 or NC=2 in ALR | |
271 */ | |
272 if( grr_is_pbcch_present( ) EQ FALSE AND | |
273 grr_data->cs_meas.nc_meas_cause NEQ NC_STOP_MEAS ) | |
274 { | |
275 cs_send_meas_rep_req ( NC_STOP_MEAS ); | |
276 } | |
277 break; | |
278 case CS_DC_OTHER: | |
279 default: | |
280 /* do nothing */ | |
281 break; | |
282 } | |
283 | |
284 switch( GET_STATE( CS ) ) | |
285 { | |
286 case CS_NULL: | |
287 /* do nothing */ | |
288 break; | |
289 | |
290 case CS_IDLE: | |
291 SET_STATE( CS, CS_NULL ); | |
292 | |
293 /*lint -fallthrough*/ | |
294 | |
295 case CS_CR_NETWORK: | |
296 cs_stop_t_reselect( ); | |
297 | |
298 /*lint -fallthrough*/ | |
299 | |
300 default: | |
301 cs_cancel_meas_report( ); | |
302 grr_data->cs.nc_sync_rep_pd = 0; | |
303 | |
304 SET_STATE( CS_MEAS, CS_MEAS_NULL ); | |
305 | |
306 if( GET_STATE( CS ) NEQ CS_CR_MOBILE AND | |
307 grr_is_pbcch_present( ) EQ TRUE AND | |
308 grr_data->cs_meas.packet_mode NEQ PACKET_MODE_PTM ) | |
309 { | |
310 cs_send_cr_meas_stop_req( ); | |
311 } | |
312 | |
313 grr_data->cs_meas.packet_mode = PACKET_MODE_NULL; | |
314 | |
315 if( grr_t_status( T3158) NEQ 0 ) | |
316 { | |
317 vsi_t_stop( GRR_handle, T3158); | |
318 TRACE_EVENT( "Timer T3158 stopped" ); | |
319 } | |
320 | |
321 /*cs_init_nc_ref_list( &grr_data->db.nc_ref_lst );*/ | |
322 | |
323 /* inform service MEAS about stop of cell re-selection measurements */ | |
324 sig_cs_meas_stop( ); | |
325 break; | |
326 } | |
327 } /* sig_ctrl_cs_stop() */ | |
328 | |
329 /* | |
330 +------------------------------------------------------------------------------ | |
331 | Function : sig_ctrl_cs_check_bsic_ind | |
332 +------------------------------------------------------------------------------ | |
333 | Description : Handles the internal signal SIG_CTRL_CS_CHECK_BSIC_IND | |
334 | | |
335 | Parameters : rrgrr_check_bsic_ind - pointer to primitive | |
336 | | |
337 +------------------------------------------------------------------------------ | |
338 */ | |
339 GLOBAL void sig_ctrl_cs_check_bsic_ind | |
340 ( T_RRGRR_NCELL_SYNC_IND *rrgrr_check_bsic_ind ) | |
341 { | |
342 TRACE_ISIG( "sig_ctrl_cs_check_bsic_ind" ); | |
343 | |
344 switch( GET_STATE( CS ) ) | |
345 { | |
346 case CS_IDLE: | |
347 case CS_CR_MOBILE: | |
348 case CS_CR_NETWORK: | |
349 cs_compare_bsic( rrgrr_check_bsic_ind ); | |
350 break; | |
351 | |
352 default: | |
353 TRACE_ERROR( "SIG_CTRL_CS_CHECK_BSIC_IND unexpected" ); | |
354 break; | |
355 } | |
356 } /* sig_ctrl_cs_check_bsic_ind() */ | |
357 | |
358 /* | |
359 +------------------------------------------------------------------------------ | |
360 | Function : sig_ctrl_cs_cc_result | |
361 +------------------------------------------------------------------------------ | |
362 | Description : Handles the internal signal SIG_CTRL_CS_CC_RESULT | |
363 | | |
364 | Parameters : cc_status - if cc_status is true then cell reselection was | |
365 | successful performed. Otherwise cell reselection is | |
366 | failed. | |
367 | | |
368 +------------------------------------------------------------------------------ | |
369 */ | |
370 GLOBAL void sig_ctrl_cs_cc_result ( BOOL cc_status ) | |
371 { | |
372 TRACE_ISIG( "sig_ctrl_cs_cc_result" ); | |
373 | |
374 switch( GET_STATE( CS ) ) | |
375 { | |
376 case CS_CR_MOBILE: | |
377 if( cc_status ) | |
378 { | |
379 /* | |
380 * Cell Reselection with the given candidate was successfull | |
381 */ | |
382 SET_STATE( CS, CS_NULL ); | |
383 | |
384 cs_stop_t_reselect( ); | |
385 } | |
386 else | |
387 { | |
388 /* | |
389 * Cell Reselection with the given candidate was NOT successfull | |
390 */ | |
391 SET_STATE( CS, CS_IDLE ); | |
392 | |
393 cs_cr_decision( CRDM_CR_CONT ); | |
394 } | |
395 break; | |
396 | |
397 case CS_CR_NETWORK: | |
398 /* | |
399 * Timer T_RESLECT should be stopped during processing of a | |
400 * Packet Cell Change Order. Timer T3174 is used instead. | |
401 */ | |
402 cs_stop_t_reselect( ); | |
403 | |
404 if( cc_status ) | |
405 { | |
406 /* | |
407 * network controlled cell re-selection was successfull, so we | |
408 * stay in the already selected cell and just go to idle mode, | |
409 * cell re-slection measurements are already requested so no | |
410 * further action is required. | |
411 */ | |
412 SET_STATE( CS, CS_IDLE ); | |
413 } | |
414 else | |
415 { | |
416 /* | |
417 * network controlled cell re-selection was unsuccessfull, so | |
418 * we are back in the old cell and start of cell re-selection | |
419 * measurements will be requested immediately. | |
420 */ | |
421 SET_STATE( CS, CS_NULL ); | |
422 } | |
423 break; | |
424 | |
425 default: | |
426 TRACE_EVENT( "SIG_CTRL_CS_CC_RESULT unexpected" ); | |
427 break; | |
428 } | |
429 } /* sig_ctrl_cs_cc_result() */ | |
430 | |
431 /* | |
432 +------------------------------------------------------------------------------ | |
433 | Function : sig_ctrl_cs_gmm_state | |
434 +------------------------------------------------------------------------------ | |
435 | Description : Handles the internal signal SIG_CTRL_CS_GMM_STATE | |
436 | If this signal is received GMM has changed its state. | |
437 | | |
438 | Parameters : state | |
439 | | |
440 +------------------------------------------------------------------------------ | |
441 */ | |
442 GLOBAL void sig_ctrl_cs_gmm_state (T_GMM_STATES state ) | |
443 { | |
444 T_NC_ORDER ctrl_order; | |
445 | |
446 TRACE_ISIG( "sig_ctrl_cs_gmm_state " ); | |
447 | |
448 switch( GET_STATE( CS ) ) | |
449 { | |
450 case CS_IDLE: | |
451 case CS_CR_MOBILE: | |
452 case CS_CR_NETWORK: | |
453 | |
454 if( state EQ READY_STATE ) | |
455 { | |
456 grr_data->cs.gmm_state = state; | |
457 ctrl_order = cs_get_network_ctrl_order( TRUE ); | |
458 } | |
459 else | |
460 { | |
461 ctrl_order = cs_get_network_ctrl_order( TRUE ); | |
462 /* A set of measurement reporting parameters (NETWORK_CONTROL_ORDER and | |
463 * NC_REPORTING_PERIOD(s)) is broadcast on PBCCH. The parameters may also | |
464 * be sent individually to an MS on PCCCH or PACCH, in which case it | |
465 * overrides the broadcast parameters. The individual parameters are valid | |
466 * until the RESET command is sent to the MS or there is a downlink | |
467 * signalling failure or the MS goes to the Standby state or the MS enters | |
468 * dedicated mode. */ | |
469 cs_reset_meas_rep_params (psc_db); | |
470 grr_data->cs.gmm_state = state; | |
471 } | |
472 | |
473 if( grr_is_pbcch_present( ) EQ TRUE AND | |
474 ctrl_order EQ NC_NC2 AND | |
475 cs_all_cells_with_cr_param( ) EQ FALSE ) | |
476 { | |
477 cs_send_cr_meas_req( CS_DELETE_MEAS_RSLT ); | |
478 } | |
479 | |
480 if( cs_is_meas_reporting( ) EQ FALSE ) | |
481 { | |
482 cs_build_nc_ref_list( psc_db, FALSE ); | |
483 /* if we already sent a measurement report to L1 then GRR should wait untill | |
484 mphp_single_block_con comes from the L1, GRR should not send stop_single_block_req | |
485 cs_cancel_meas_report( ); */ | |
486 } | |
487 | |
488 cs_process_t3158( ); | |
489 break; | |
490 | |
491 default: | |
492 grr_data->cs.gmm_state = state; | |
493 break; | |
494 } | |
495 } /* sig_ctrl_cs_gmm_state () */ | |
496 | |
497 /* | |
498 +------------------------------------------------------------------------------ | |
499 | Function : sig_ctrl_cs_reselect | |
500 +------------------------------------------------------------------------------ | |
501 | Description : Handles the internal signal SIG_CTRL_CS_RESELECT | |
502 | | |
503 | Parameters : state | |
504 | | |
505 +------------------------------------------------------------------------------ | |
506 */ | |
507 GLOBAL void sig_ctrl_cs_reselect ( T_CS_RESELECT_CAUSE reselect_cause ) | |
508 { | |
509 TRACE_ISIG( "sig_ctrl_cs_reselect" ); | |
510 | |
511 switch( GET_STATE( CS ) ) | |
512 { | |
513 case CS_NULL: | |
514 case CS_IDLE: | |
515 grr_data->db.scell_info.cell_barred = TRUE; | |
516 grr_data->cs.reselect_cause = reselect_cause; | |
517 | |
518 cs_cr_decision( CRDM_CR_CTRL ); | |
519 break; | |
520 | |
521 default: | |
522 TRACE_ERROR( "SIG_CTRL_CS_RESELECT unexpected" ); | |
523 break; | |
524 } | |
525 } /* sig_ctrl_cs_reselect () */ | |
526 | |
527 /* | |
528 +------------------------------------------------------------------------------ | |
529 | Function : sig_ctrl_cs_ptm | |
530 +------------------------------------------------------------------------------ | |
531 | Description : Handles the internal signal SIG_CTRL_CS_PTM | |
532 | | |
533 | Parameters : void | |
534 | | |
535 +------------------------------------------------------------------------------ | |
536 */ | |
537 GLOBAL void sig_ctrl_cs_ptm ( void ) | |
538 { | |
539 TRACE_ISIG( "sig_ctrl_cs_ptm" ); | |
540 | |
541 if( grr_data->cs_meas.packet_mode NEQ PACKET_MODE_PTM ) | |
542 { | |
543 sig_ctrl_tc_delete_cs_msg (); | |
544 switch( GET_STATE( CS ) ) | |
545 { | |
546 case CS_NULL: | |
547 grr_data->cs_meas.packet_mode = PACKET_MODE_PTM; | |
548 break; | |
549 | |
550 case CS_IDLE: | |
551 case CS_CR_MOBILE: | |
552 case CS_CR_NETWORK: | |
553 grr_data->cs_meas.packet_mode = PACKET_MODE_PTM; | |
554 | |
555 /* | |
556 * reset the update condition in GRR | |
557 */ | |
558 if( !grr_is_pbcch_present( ) ) | |
559 { | |
560 cs_send_cr_meas_stop_req( ); | |
561 } | |
562 | |
563 cs_process_t3158( ); | |
564 break; | |
565 | |
566 default: | |
567 TRACE_ERROR( "SIG_CTRL_CS_PTM unexpected" ); | |
568 break; | |
569 } | |
570 } | |
571 | |
572 #ifdef _SIMULATION_ | |
573 | |
574 else | |
575 { | |
576 TRACE_EVENT( "Service CS is already in PTM" ); | |
577 } | |
578 | |
579 #endif /* #ifdef _SIMULATION_ */ | |
580 | |
581 } /* sig_ctrl_cs_ptm() */ | |
582 | |
583 | |
584 /* | |
585 +------------------------------------------------------------------------------ | |
586 | Function : sig_ctrl_cs_leave_to_pam | |
587 +------------------------------------------------------------------------------ | |
588 | Description : Handles the internal signal SIG_CTRL_CS_LEAVE_TO_PAM. | |
589 | If this signal is received GRR starts the packet access | |
590 | procedure. | |
591 | | |
592 | Parameters : | |
593 | | |
594 +------------------------------------------------------------------------------ | |
595 */ | |
596 GLOBAL void sig_ctrl_cs_leave_to_pam ( void ) | |
597 { | |
598 TRACE_ISIG( "sig_ctrl_cs_leave_to_pam" ); | |
599 | |
600 | |
601 if( grr_data->cs_meas.packet_mode NEQ PACKET_MODE_PAM AND | |
602 grr_data->cs_meas.packet_mode NEQ PACKET_MODE_PTM ) | |
603 { | |
604 switch( GET_STATE( CS ) ) | |
605 { | |
606 case CS_NULL: | |
607 grr_data->cs_meas.packet_mode = PACKET_MODE_PAM; | |
608 break; | |
609 | |
610 case CS_IDLE: | |
611 case CS_CR_MOBILE: | |
612 case CS_CR_NETWORK: | |
613 grr_data->cs_meas.packet_mode = PACKET_MODE_PAM; | |
614 | |
615 /* | |
616 * reset the update condition in GRR | |
617 */ | |
618 if( !grr_is_pbcch_present( ) ) | |
619 { | |
620 cs_send_cr_meas_stop_req( ); | |
621 } | |
622 break; | |
623 | |
624 default: | |
625 TRACE_ERROR( "SIG_CTRL_CS_LEAVE_TO_PAM unexpected" ); | |
626 break; | |
627 } | |
628 } | |
629 | |
630 #ifdef _SIMULATION_ | |
631 | |
632 else | |
633 { | |
634 TRACE_EVENT( "Service CS is already in PAM" ); | |
635 } | |
636 | |
637 #endif /* #ifdef _SIMULATION_ */ | |
638 | |
639 } /* sig_ctrl_cs_leave_to_pam () */ | |
640 | |
641 | |
642 /* | |
643 +------------------------------------------------------------------------------ | |
644 | Function : sig_ctrl_cs_enter_pam | |
645 +------------------------------------------------------------------------------ | |
646 | Description : Handles the internal signal SIG_CTRL_CS_ENTER_PAM. | |
647 | If this signal is received GRR starts the packet access | |
648 | procedure. | |
649 | | |
650 | Parameters : | |
651 | | |
652 +------------------------------------------------------------------------------ | |
653 */ | |
654 GLOBAL void sig_ctrl_cs_enter_pam ( void ) | |
655 { | |
656 T_PACKET_MODE packet_mode = grr_data->cs_meas.packet_mode; | |
657 | |
658 TRACE_ISIG( "sig_ctrl_cs_enter_pam" ); | |
659 | |
660 if( packet_mode EQ PACKET_MODE_PTM ) | |
661 { | |
662 switch( GET_STATE( CS ) ) | |
663 { | |
664 case CS_NULL: | |
665 grr_data->cs_meas.packet_mode = PACKET_MODE_PAM; | |
666 break; | |
667 | |
668 case CS_IDLE: | |
669 grr_data->cs_meas.packet_mode = PACKET_MODE_PAM; | |
670 | |
671 if( grr_is_pbcch_present( ) EQ TRUE ) | |
672 { | |
673 cs_send_cr_meas_req( CS_KEEP_MEAS_RSLT ); | |
674 } | |
675 | |
676 cs_process_t3158( ); | |
677 break; | |
678 | |
679 case CS_CR_NETWORK: | |
680 grr_data->cs_meas.packet_mode = PACKET_MODE_PAM; | |
681 | |
682 cs_process_t3158( ); | |
683 break; | |
684 | |
685 default: | |
686 TRACE_ERROR( "SIG_CTRL_CS_ENTER_PAM unexpected" ); | |
687 break; | |
688 } | |
689 } | |
690 | |
691 #ifdef _SIMULATION_ | |
692 | |
693 else | |
694 { | |
695 TRACE_EVENT( "Service CS is already in PAM" ); | |
696 } | |
697 | |
698 #endif /* #ifdef _SIMULATION_ */ | |
699 | |
700 } /* sig_ctrl_cs_enter_pam () */ | |
701 | |
702 | |
703 /* | |
704 +------------------------------------------------------------------------------ | |
705 | Function : sig_ctrl_cs_pim | |
706 +------------------------------------------------------------------------------ | |
707 | Description : Handles the internal signal SIG_CTRL_CS_PIM | |
708 | If this signal is received GRR returns in packet idle mode. | |
709 | Cell reselection measurements has to restarted in idle mode. | |
710 | | |
711 | Parameters : | |
712 | | |
713 +------------------------------------------------------------------------------ | |
714 */ | |
715 GLOBAL void sig_ctrl_cs_pim ( void ) | |
716 { | |
717 T_PACKET_MODE packet_mode = grr_data->cs_meas.packet_mode; | |
718 | |
719 TRACE_ISIG( "sig_ctrl_cs_pim" ); | |
720 | |
721 if( packet_mode NEQ PACKET_MODE_PIM ) | |
722 { | |
723 switch( GET_STATE( CS ) ) | |
724 { | |
725 case CS_NULL: | |
726 grr_data->cs_meas.packet_mode = PACKET_MODE_PIM; | |
727 break; | |
728 | |
729 case CS_IDLE: | |
730 grr_data->cs_meas.packet_mode = PACKET_MODE_PIM; | |
731 | |
732 if( grr_is_pbcch_present( ) EQ TRUE AND | |
733 packet_mode EQ PACKET_MODE_PTM ) | |
734 { | |
735 cs_send_cr_meas_req( CS_KEEP_MEAS_RSLT ); | |
736 } | |
737 | |
738 cs_process_t3158( ); | |
739 break; | |
740 | |
741 case CS_CR_NETWORK: | |
742 grr_data->cs_meas.packet_mode = PACKET_MODE_PIM; | |
743 | |
744 cs_process_t3158( ); | |
745 break; | |
746 | |
747 default: | |
748 TRACE_ERROR( "SIG_CTRL_CS_PIM unexpected" ); | |
749 break; | |
750 } | |
751 } | |
752 | |
753 #ifdef _SIMULATION_ | |
754 | |
755 else | |
756 { | |
757 TRACE_EVENT( "Service CS is already in PIM" ); | |
758 } | |
759 | |
760 #endif /* #ifdef _SIMULATION_ */ | |
761 | |
762 } /* sig_ctrl_cs_pim () */ | |
763 | |
764 /* | |
765 +------------------------------------------------------------------------------ | |
766 | Function : sig_ctrl_cs_meas_rep_cnf | |
767 +------------------------------------------------------------------------------ | |
768 | Description : Handles the internal signal SIG_CTRL_CS_MEAS_REP_CNF | |
769 | | |
770 | Parameters : rrgrr_meas_rep_cnf - Pointer to primitive payload | |
771 | | |
772 +------------------------------------------------------------------------------ | |
773 */ | |
774 GLOBAL void sig_ctrl_cs_meas_rep_cnf (T_RRGRR_MEAS_REP_CNF *rrgrr_meas_rep_cnf) | |
775 { | |
776 | |
777 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
778 BOOL is_enh_meas = cs_is_enh_meas_reporting(); | |
779 #endif | |
780 | |
781 TRACE_ISIG( "sig_ctrl_cs_meas_rep_cnf" ); | |
782 | |
783 switch( GET_STATE( CS ) ) | |
784 { | |
785 case CS_IDLE: | |
786 switch( GET_STATE( CS_MEAS ) ) | |
787 { | |
788 case( CS_MEAS_REP_REQ ): | |
789 cs_store_meas_rep_cnf( rrgrr_meas_rep_cnf ); | |
790 cs_build_strongest( ); | |
791 | |
792 SET_STATE( CS_MEAS, CS_MEAS_PMR_SENDING ); | |
793 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
794 if( ((is_enh_meas EQ TRUE) AND (cs_send_enh_meas_rpt() EQ FALSE)) | |
795 OR | |
796 ((is_enh_meas EQ FALSE) AND (cs_send_meas_rpt(TRUE) EQ FALSE)) ) | |
797 #else | |
798 if(cs_send_meas_rpt( TRUE ) EQ FALSE ) | |
799 #endif | |
800 { | |
801 /* | |
802 * The additional state check is necessary because signals might | |
803 * be send during the processing of the function cs_send_meas_rpt. | |
804 */ | |
805 if( GET_STATE( CS_MEAS ) EQ CS_MEAS_PMR_SENDING ) | |
806 { | |
807 SET_STATE( CS_MEAS, CS_MEAS_NULL ); | |
808 /* | |
809 cs_process_t3158( ); | |
810 */ | |
811 } | |
812 } | |
813 break; | |
814 | |
815 default: | |
816 TRACE_ERROR( "SIG_CTRL_CS_MEAS_REP_CNF unexpected 1" ); | |
817 break; | |
818 } | |
819 break; | |
820 | |
821 default: | |
822 TRACE_ERROR( "SIG_CTRL_CS_MEAS_REP_CNF unexpected 2" ); | |
823 break; | |
824 } | |
825 } /* sig_ctrl_cs_meas_rep_cnf () */ | |
826 | |
827 | |
828 /* | |
829 +------------------------------------------------------------------------------ | |
830 | Function : sig_meas_cs_meas_order | |
831 +------------------------------------------------------------------------------ | |
832 | Description : Handles the internal signal SIG_MEAS_CS_MEAS_ORDER | |
833 | | |
834 | Parameters : dummy - description of parameter dummy | |
835 | | |
836 +------------------------------------------------------------------------------ | |
837 */ | |
838 GLOBAL void sig_meas_cs_meas_order ( T_NC_ORDER prev_ctrl_order ) | |
839 { | |
840 T_NC_ORDER ctrl_order; | |
841 T_NC_ORDER applied_ctrl_order; | |
842 T_NC_ORDER prev_applied_ctrl_order; | |
843 | |
844 TRACE_ISIG( "sig_meas_cs_meas_order" ); | |
845 | |
846 switch( GET_STATE( CS ) ) | |
847 { | |
848 case CS_IDLE: | |
849 case CS_CR_NETWORK: | |
850 cs_build_nc_ref_list( psc_db, FALSE ); | |
851 | |
852 if( grr_is_pbcch_present( ) ) | |
853 { | |
854 /* begin temporary replacement of NETWORK CONTROL ORDER value */ | |
855 ctrl_order = cs_get_network_ctrl_order( FALSE ); | |
856 | |
857 grr_data->db.nc_ref_lst.param->ctrl_order = prev_ctrl_order; | |
858 prev_applied_ctrl_order = cs_get_network_ctrl_order( TRUE ); | |
859 | |
860 grr_data->db.nc_ref_lst.param->ctrl_order = ctrl_order; | |
861 applied_ctrl_order = cs_get_network_ctrl_order( TRUE ); | |
862 /* end temporary replacement of NETWORK CONTROL ORDER value */ | |
863 | |
864 if( | |
865 ( | |
866 psc_db->nc_cw.list.chng_mrk.prev NEQ | |
867 psc_db->nc_cw.list.chng_mrk.curr | |
868 OR | |
869 psc_db->nc_ms.ncmeas.list.chng_mrk.prev NEQ | |
870 psc_db->nc_ms.ncmeas.list.chng_mrk.curr | |
871 ) | |
872 OR | |
873 ( | |
874 ( | |
875 ( | |
876 applied_ctrl_order EQ NC_NC2 AND | |
877 prev_applied_ctrl_order NEQ NC_NC2 | |
878 ) | |
879 OR | |
880 ( | |
881 applied_ctrl_order NEQ NC_NC2 AND | |
882 prev_applied_ctrl_order EQ NC_NC2 | |
883 ) | |
884 ) | |
885 AND | |
886 ( | |
887 cs_all_cells_with_cr_param( ) EQ FALSE | |
888 ) | |
889 ) | |
890 ) | |
891 { | |
892 cs_send_cr_meas_req( CS_DELETE_MEAS_RSLT ); | |
893 | |
894 psc_db->nc_cw.list.chng_mrk.prev = psc_db->nc_cw.list.chng_mrk.curr; | |
895 psc_db->nc_ms.ncmeas.list.chng_mrk.prev = | |
896 psc_db->nc_ms.ncmeas.list.chng_mrk.curr; | |
897 } | |
898 } | |
899 else | |
900 { | |
901 if( | |
902 psc_db->nc_cw.list.chng_mrk.prev NEQ | |
903 psc_db->nc_cw.list.chng_mrk.curr | |
904 OR | |
905 psc_db->nc_ms.ncmeas.list.chng_mrk.prev NEQ | |
906 psc_db->nc_ms.ncmeas.list.chng_mrk.curr | |
907 OR | |
908 prev_ctrl_order NEQ | |
909 cs_get_network_ctrl_order( FALSE ) | |
910 ) | |
911 { | |
912 cs_send_update_ba_req ( psc_db ); | |
913 | |
914 if( grr_data->cs_meas.packet_mode EQ PACKET_MODE_PTM ) | |
915 { | |
916 cs_send_cr_meas_req( CS_DELETE_MEAS_RSLT ); | |
917 } | |
918 | |
919 psc_db->nc_cw.list.chng_mrk.prev = psc_db->nc_cw.list.chng_mrk.curr; | |
920 psc_db->nc_ms.ncmeas.list.chng_mrk.prev = | |
921 psc_db->nc_ms.ncmeas.list.chng_mrk.curr; | |
922 } | |
923 } | |
924 | |
925 if( | |
926 psc_db->nc_cw.param.chng_mrk.prev NEQ | |
927 psc_db->nc_cw.param.chng_mrk.curr | |
928 OR | |
929 psc_db->nc_ms.ncmeas.param.chng_mrk.prev NEQ | |
930 psc_db->nc_ms.ncmeas.param.chng_mrk.curr | |
931 ) | |
932 { | |
933 if( cs_is_meas_reporting( ) EQ FALSE ) | |
934 { | |
935 cs_cancel_meas_report( ); | |
936 } | |
937 | |
938 cs_process_t3158( ); | |
939 | |
940 psc_db->nc_cw.param.chng_mrk.prev = psc_db->nc_cw.param.chng_mrk.curr; | |
941 psc_db->nc_ms.ncmeas.param.chng_mrk.prev = | |
942 psc_db->nc_ms.ncmeas.param.chng_mrk.curr; | |
943 } | |
944 | |
945 TRACE_EVENT_P4( "NC Cell Re-Selection Parameter: %d %d %d %d", | |
946 cs_get_network_ctrl_order( FALSE ), | |
947 grr_data->db.nc_ref_lst.param->rep_per_i, | |
948 grr_data->db.nc_ref_lst.param->rep_per_t, | |
949 grr_data->db.nc_ref_lst.param->non_drx_per ); | |
950 break; | |
951 | |
952 default: | |
953 TRACE_ERROR( "SIG_MEAS_CS_MEAS_ORDER unexpected" ); | |
954 break; | |
955 } | |
956 } /* sig_meas_cs_meas_order() */ | |
957 | |
958 /* | |
959 +------------------------------------------------------------------------------ | |
960 | Function : sig_ctrl_cs_install_new_scell | |
961 +------------------------------------------------------------------------------ | |
962 | Description : | |
963 | | |
964 | Parameters : | |
965 | | |
966 +------------------------------------------------------------------------------ | |
967 */ | |
968 GLOBAL void sig_ctrl_cs_install_new_scell ( void ) | |
969 { | |
970 TRACE_ISIG( "sig_ctrl_cs_install_new_scell" ); | |
971 | |
972 grr_data->db.cr_cell = NULL; | |
973 | |
974 grr_set_db_ptr( DB_MODE_CC_ACC ); | |
975 /* cs_build_nc_ref_list( posc_db, FALSE ); */ | |
976 /* cs_reset_nc_change_mark( posc_db ); */ | |
977 | |
978 }/* sig_ctrl_cs_install_new_scell */ | |
979 | |
980 /* | |
981 +------------------------------------------------------------------------------ | |
982 | Function : sig_ctrl_cs_start_cell_selection | |
983 +------------------------------------------------------------------------------ | |
984 | Description : | |
985 | | |
986 | Parameters : | |
987 | | |
988 +------------------------------------------------------------------------------ | |
989 */ | |
990 GLOBAL void sig_ctrl_cs_start_cell_selection ( UBYTE cr_type ) | |
991 { | |
992 TRACE_ISIG( "sig_ctrl_cs_start_cell_selection" ); | |
993 | |
994 switch( GET_STATE( CS ) ) | |
995 { | |
996 case( CS_NULL ): | |
997 case( CS_IDLE ): | |
998 case( CS_CR_MOBILE ): | |
999 | |
1000 switch( cr_type ) | |
1001 { | |
1002 case( CR_NEW ): | |
1003 TRACE_EVENT( "CTRL->CS: start cell re-selection" ); | |
1004 | |
1005 grr_data->db.cr_cell->mode = CS_MODE_SELECTION_PERFORMED; | |
1006 | |
1007 SET_STATE( CS, CS_CR_MOBILE ); | |
1008 | |
1009 cs_start_t_reselect( ); | |
1010 break; | |
1011 | |
1012 case( CR_CS ): | |
1013 TRACE_EVENT( "CTRL->CS: start cell selection" ); | |
1014 | |
1015 SET_STATE( CS, CS_NULL ); | |
1016 | |
1017 cs_stop_t_reselect( ); | |
1018 break; | |
1019 | |
1020 case( CR_CONT ): | |
1021 TRACE_EVENT( "CTRL->CS: continue cell (re-)selection" ); | |
1022 break; | |
1023 | |
1024 default: | |
1025 TRACE_ASSERT( cr_type EQ CR_NEW OR | |
1026 cr_type EQ CR_CS OR | |
1027 cr_type EQ CR_CONT ); | |
1028 break; | |
1029 } | |
1030 break; | |
1031 case( CS_CR_NETWORK ): | |
1032 | |
1033 switch( cr_type ) | |
1034 { | |
1035 case( CR_NEW ): | |
1036 case( CR_NEW_NOT_SYNCED ): | |
1037 TRACE_EVENT( "CTRL->CS: CS_CR_NETWORK:cell re-selection" ); | |
1038 | |
1039 grr_data->db.cr_cell->mode = CS_MODE_SELECTION_PERFORMED; | |
1040 | |
1041 /* | |
1042 * Timer T_RESLECT should be stopped during processing of a | |
1043 * Packet Cell Change Order. Timer T3174 is used instead. | |
1044 */ | |
1045 break; | |
1046 | |
1047 default: | |
1048 TRACE_ASSERT( cr_type EQ CR_NEW OR cr_type EQ CR_NEW_NOT_SYNCED ); | |
1049 break; | |
1050 } | |
1051 break; | |
1052 | |
1053 default: | |
1054 TRACE_ERROR( "SIG_CTRL_CS_START_CELL_SELECTION unexpected" ); | |
1055 break; | |
1056 } | |
1057 }/* sig_ctrl_cs_start_cell_selection */ | |
1058 | |
1059 /* | |
1060 +------------------------------------------------------------------------------ | |
1061 | Function : sig_ctrl_cs_cc_order_ind | |
1062 +------------------------------------------------------------------------------ | |
1063 | Description : | |
1064 | | |
1065 | Parameters : | |
1066 | | |
1067 +------------------------------------------------------------------------------ | |
1068 */ | |
1069 GLOBAL void sig_ctrl_cs_cc_order_ind ( T_D_CELL_CHAN_ORDER *d_cell_chan_order, | |
1070 T_D_CHANGE_ORDER *d_change_order ) | |
1071 { | |
1072 TRACE_ISIG( "sig_ctrl_cs_cc_order_ind" ); | |
1073 | |
1074 if( d_cell_chan_order NEQ NULL ) | |
1075 { | |
1076 if( d_change_order EQ NULL ) | |
1077 { | |
1078 cs_cell_change_order_ind | |
1079 ( &d_cell_chan_order->tgt_cell_gsm_info.gsm_target_cell.nc_meas_par_list.nc_meas_par, | |
1080 d_cell_chan_order->tgt_cell_gsm_info.gsm_target_cell.nc_meas_par_list.v_nc_freq_list, | |
1081 &d_cell_chan_order->tgt_cell_gsm_info.gsm_target_cell.nc_meas_par_list.nc_freq_list | |
1082 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
1083 , d_cell_chan_order->tgt_cell_gsm_info.gsm_target_cell.release_98_str_pcco.v_release_99_str_pcco, | |
1084 &d_cell_chan_order->tgt_cell_gsm_info.gsm_target_cell.release_98_str_pcco.release_99_str_pcco.enh_meas_param_pcco | |
1085 #endif | |
1086 ); | |
1087 } | |
1088 else | |
1089 { | |
1090 TRACE_ERROR( "Call error 1 in sig_ctrl_cs_cc_order_ind" ); | |
1091 } | |
1092 } | |
1093 else if( d_change_order NEQ NULL ) | |
1094 { | |
1095 T_nc_meas_par nc_meas_par; | |
1096 | |
1097 nc_meas_par.v_nc_meas_per = FALSE; | |
1098 | |
1099 switch( d_change_order->nc_mode.ncm ) | |
1100 { | |
1101 case( NC_0 ): nc_meas_par.ctrl_order = NCMEAS_NC0; break; | |
1102 case( NC_1 ): nc_meas_par.ctrl_order = NCMEAS_NC1; break; | |
1103 case( NC_2 ): nc_meas_par.ctrl_order = NCMEAS_NC2; break; | |
1104 case( NC_TARGET ): | |
1105 default : nc_meas_par.ctrl_order = NCMEAS_RESET; break; | |
1106 } | |
1107 | |
1108 cs_cell_change_order_ind( &nc_meas_par, FALSE, NULL | |
1109 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
1110 , FALSE, NULL | |
1111 #endif | |
1112 ); | |
1113 } | |
1114 else | |
1115 { | |
1116 TRACE_ERROR( "Call error 2 in sig_ctrl_cs_cc_order_ind" ); | |
1117 } | |
1118 }/* sig_ctrl_cs_cc_order_ind */ | |
1119 | |
1120 /* | |
1121 +------------------------------------------------------------------------------ | |
1122 | Function : sig_ctrl_cs_check_c1_new_scell | |
1123 +------------------------------------------------------------------------------ | |
1124 | Description : | |
1125 | | |
1126 | Parameters : | |
1127 | | |
1128 +------------------------------------------------------------------------------ | |
1129 */ | |
1130 GLOBAL BOOL sig_ctrl_cs_check_c1_new_scell ( BOOL cell_change_order, | |
1131 UBYTE gprs_rxlev_access_min, | |
1132 UBYTE gprs_ms_txpwr_max_cch ) | |
1133 { | |
1134 BOOL result = TRUE; | |
1135 T_ncell_info *ncell_info; | |
1136 T_NC_MVAL *nc_mval; | |
1137 T_CR_PAR_1 cr_par_1; | |
1138 T_CR_CRITERIONS cr_crit; | |
1139 | |
1140 TRACE_ISIG( "sig_ctrl_cs_check_c1_new_scell" ); | |
1141 | |
1142 /* | |
1143 * GRR should not recalculate the C1 value for the serving cell once received | |
1144 * the System Information on the new cell in case a cell change order has been | |
1145 * processed previously. | |
1146 */ | |
1147 if( cell_change_order EQ FALSE ) | |
1148 { | |
1149 if( grr_data->db.cr_cell NEQ NULL ) | |
1150 { | |
1151 nc_mval = &grr_data->db.nc_mval_list.nc_mval[grr_data->db.cr_cell->idx]; | |
1152 ncell_info = grr_get_ncell_info( nc_mval->arfcn, nc_mval->sync_info.bsic ); | |
1153 | |
1154 if( ncell_info NEQ NULL ) | |
1155 { | |
1156 cr_par_1.cr_pow_par.gprs_rxlev_access_min = gprs_rxlev_access_min; | |
1157 cr_par_1.cr_pow_par.gprs_ms_txpwr_max_cch = gprs_ms_txpwr_max_cch; | |
1158 | |
1159 /* | |
1160 * the HCS parameter are not present because | |
1161 * they are not determined by the entity RR | |
1162 */ | |
1163 cr_par_1.v_hcs_par = FALSE; | |
1164 | |
1165 /* | |
1166 * calculate the cell re-selection criterions for the new serving cell | |
1167 * taking under account the new cell re-selection parameters determined | |
1168 * by the entity RR | |
1169 */ | |
1170 cs_calc_cr_criterion( &cr_crit, | |
1171 ncell_info->arfcn, | |
1172 &nc_mval->rla_p, | |
1173 &cr_par_1 ); | |
1174 | |
1175 TRACE_EVENT_P1( "RECALC C1 SCELL: %d", cr_crit.c1 ); | |
1176 | |
1177 /* | |
1178 * if the path loss criterion is not fulfilled for the new serving cell | |
1179 * forget it for any further operations | |
1180 */ | |
1181 result = ( cr_crit.c1 >= 0 ); | |
1182 } | |
1183 else | |
1184 { | |
1185 TRACE_ERROR( "sig_ctrl_cs_check_c1_new_scell: ncell_info EQ NULL" ); | |
1186 } | |
1187 } | |
1188 else | |
1189 { | |
1190 TRACE_ERROR( "sig_ctrl_cs_check_c1_new_scell: grr_data->db.cr_cell EQ NULL" ); | |
1191 } | |
1192 } | |
1193 else | |
1194 { | |
1195 TRACE_EVENT( "sig_ctrl_cs_check_c1_new_scell: skip check" ); | |
1196 } | |
1197 | |
1198 return( result ); | |
1199 | |
1200 }/* sig_ctrl_cs_check_c1_new_scell */ | |
1201 | |
1202 /* | |
1203 +------------------------------------------------------------------------------ | |
1204 | Function : sig_ctrl_cs_pmr_accept | |
1205 +------------------------------------------------------------------------------ | |
1206 | Description : Handles the internal signal SIG_CTRL_CS_PMR_ACCEPT | |
1207 | Parameters : void | |
1208 | | |
1209 +------------------------------------------------------------------------------ | |
1210 */ | |
1211 GLOBAL void sig_ctrl_cs_pmr_accept ( void ) | |
1212 { | |
1213 UBYTE nc_non_drx_period = grr_data->db.nc_ref_lst.param->non_drx_per; | |
1214 | |
1215 TRACE_ISIG( "sig_ctrl_cs_pmr_accept" ); | |
1216 | |
1217 switch( GET_STATE( CS_MEAS ) ) | |
1218 { | |
1219 case( CS_MEAS_PMR_SENDING ): | |
1220 | |
1221 #if defined (REL99) AND (TI_PS_FF_EMR) | |
1222 if( ( ( cs_is_enh_meas_reporting() EQ FALSE ) AND ( cs_send_meas_rpt( FALSE ) EQ FALSE ) ) | |
1223 OR | |
1224 ( cs_is_enh_meas_reporting() EQ TRUE ) | |
1225 ) | |
1226 #else | |
1227 if( cs_send_meas_rpt( FALSE ) EQ FALSE ) | |
1228 #endif | |
1229 { | |
1230 SET_STATE( CS_MEAS, CS_MEAS_NULL ); | |
1231 cs_process_t3158( ); | |
1232 } | |
1233 | |
1234 sig_cs_pg_start_t_nc2_ndrx( nc_non_drx_period ); | |
1235 break; | |
1236 | |
1237 default: | |
1238 TRACE_ERROR( "SIG_MEAS_CS_PMR_ACCEPT unexpected" ); | |
1239 break; | |
1240 } | |
1241 } /* sig_ctrl_cs_pmr_accept() */ | |
1242 | |
1243 /* | |
1244 +------------------------------------------------------------------------------ | |
1245 | Function : sig_ctrl_cs_pmr_reject | |
1246 +------------------------------------------------------------------------------ | |
1247 | Description : Handles the internal signal SIG_CTRL_CS_PMR_REJECT | |
1248 | Parameters : void | |
1249 | | |
1250 +------------------------------------------------------------------------------ | |
1251 */ | |
1252 GLOBAL void sig_ctrl_cs_pmr_reject ( void ) | |
1253 { | |
1254 TRACE_ISIG( "sig_ctrl_cs_pmr_reject" ); | |
1255 | |
1256 switch( GET_STATE( CS_MEAS ) ) | |
1257 { | |
1258 case( CS_MEAS_PMR_SENDING ): | |
1259 SET_STATE( CS_MEAS, CS_MEAS_NULL ); | |
1260 | |
1261 cs_process_t3158( ); | |
1262 break; | |
1263 | |
1264 default: | |
1265 TRACE_ERROR( "SIG_MEAS_CS_PMR_REJECT unexpected" ); | |
1266 break; | |
1267 } | |
1268 } /* sig_ctrl_cs_pmr_reject() */ | |
1269 | |
1270 /* | |
1271 +------------------------------------------------------------------------------ | |
1272 | Function : sig_ctrl_cs_check_cell_location | |
1273 +------------------------------------------------------------------------------ | |
1274 | Description : Check the location of the target cell when packet cell change | |
1275 | has to be processed | |
1276 | | |
1277 | Parameters : void | |
1278 | | |
1279 +------------------------------------------------------------------------------ | |
1280 */ | |
1281 GLOBAL void sig_ctrl_cs_check_cell_location ( USHORT arfcn, UBYTE bsic ) | |
1282 { | |
1283 T_NC_MVAL *nc_mval; | |
1284 UBYTE nc_mval_idx; | |
1285 | |
1286 TRACE_EVENT( "sig_ctrl_cs_check_cell_location" ); | |
1287 | |
1288 /* check whether the cell is in the neighbour cell list */ | |
1289 nc_mval = grr_get_nc_mval( arfcn, bsic, &nc_mval_idx ); | |
1290 | |
1291 if( nc_mval NEQ NULL ) | |
1292 { | |
1293 TRACE_EVENT( "sig_ctrl_cs_check_cell_location: cell part of neighbour cell list" ); | |
1294 | |
1295 grr_data->db.cr_cell = &grr_data->db.nc_nw_slctd.strgst; | |
1296 grr_data->db.cr_cell->idx = nc_mval_idx; | |
1297 grr_data->db.cr_cell->mode = CS_MODE_IDLE; | |
1298 grr_data->db.cr_cell->avail_time = 0; | |
1299 } | |
1300 else | |
1301 { | |
1302 /* | |
1303 * In case of a BCCH only environment no neighbor cell measured values | |
1304 * nc_mval are present at all. As result always the cell re-selection | |
1305 * cell cr_cell should be created and error traces should be suppressed. | |
1306 */ | |
1307 cs_create_cr_cell( arfcn, bsic ); | |
1308 } | |
1309 } /* sig_ctrl_cs_check_cell_location */ | |
1310 | |
1311 /* | |
1312 +------------------------------------------------------------------------------ | |
1313 | Function : sig_gfp_cs_cr_meas_ind | |
1314 +------------------------------------------------------------------------------ | |
1315 | Description : Handles the signal SIG_GFP_CS_CR_MEAS_IND | |
1316 | | |
1317 | Parameters : *mphp_cr_meas_ind - Ptr to primitive payload | |
1318 | | |
1319 +------------------------------------------------------------------------------ | |
1320 */ | |
1321 GLOBAL void sig_gfp_cs_cr_meas_ind( T_MPHP_CR_MEAS_IND * mphp_cr_meas_ind ) | |
1322 { | |
1323 | |
1324 UBYTE state = GET_STATE( CS ); | |
1325 BOOL cr_initiated = FALSE; | |
1326 BOOL strgst_changed = FALSE; | |
1327 | |
1328 TRACE_FUNCTION( "sig_gfp_cs_cr_meas_ind" ); | |
1329 | |
1330 switch( state ) | |
1331 { | |
1332 case CS_IDLE: | |
1333 case CS_CR_NETWORK: | |
1334 if( mphp_cr_meas_ind->list_id EQ ( UBYTE )( grr_data->cs.list_id - 1 ) ) | |
1335 { | |
1336 if( mphp_cr_meas_ind->nmeas > MPHP_NUMC_BA_GPRS_SC OR | |
1337 mphp_cr_meas_ind->nmeas NEQ nc_data->c_cell ) | |
1338 { | |
1339 TRACE_EVENT_P2( "sig_gfp_cs_cr_meas_ind: wrong number of measurements - %d %d", | |
1340 mphp_cr_meas_ind->nmeas, nc_data->c_cell ); | |
1341 return; | |
1342 } | |
1343 | |
1344 cs_fill_meas_rslt( mphp_cr_meas_ind, NULL ); | |
1345 cs_store_meas_values( ); | |
1346 | |
1347 if( cs_find_strongest( mphp_cr_meas_ind->reporting_period ) OR | |
1348 grr_data->cs.is_upd_ncell_stat_needed ) | |
1349 { | |
1350 strgst_changed = TRUE; | |
1351 grr_data->cs.is_upd_ncell_stat_needed = FALSE; | |
1352 } | |
1353 | |
1354 | |
1355 if( state EQ CS_IDLE ) | |
1356 { | |
1357 cr_initiated = cs_cr_decision( CRDM_CR_INITIAL ); | |
1358 } | |
1359 #if defined (REL99) AND (TI_PS_FF_EMR) | |
1360 if( ( (strgst_changed EQ TRUE) OR (cs_is_enh_meas_reporting()) ) | |
1361 AND cr_initiated EQ FALSE ) | |
1362 #else | |
1363 if( strgst_changed EQ TRUE AND cr_initiated EQ FALSE ) | |
1364 #endif | |
1365 | |
1366 { | |
1367 cs_update_bsic( ); | |
1368 } | |
1369 } | |
1370 else | |
1371 { | |
1372 TRACE_EVENT_P2( "sig_gfp_cs_cr_meas_ind: mismatch of list_id - %d %d", | |
1373 mphp_cr_meas_ind->list_id, ( UBYTE )( grr_data->cs.list_id - 1 ) ); | |
1374 } | |
1375 cs_check_nc_sync_timer(mphp_cr_meas_ind->reporting_period); | |
1376 break; | |
1377 | |
1378 default: | |
1379 TRACE_ERROR( "SIG_GFP_CS_CR_MEAS_IND unexpected" ); | |
1380 break; | |
1381 } | |
1382 } /* sig_gfp_cs_cr_meas_ind() */ | |
1383 | |
1384 | |
1385 | |
1386 | |
1387 /* | |
1388 +------------------------------------------------------------------------------ | |
1389 | Function : sig_gfp_cs_tcr_meas_ind | |
1390 +------------------------------------------------------------------------------ | |
1391 | Description : Handles the signal SIG_GFP_TCS_CR_MEAS_IND | |
1392 | | |
1393 | Parameters : *mphp_tcr_meas_ind - Ptr to primitive payload | |
1394 | | |
1395 +------------------------------------------------------------------------------ | |
1396 */ | |
1397 GLOBAL void sig_gfp_cs_tcr_meas_ind( T_MPHP_TCR_MEAS_IND * mphp_tcr_meas_ind ) | |
1398 { | |
1399 UBYTE state = GET_STATE( CS ); | |
1400 BOOL cr_initiated = FALSE; | |
1401 BOOL strgst_changed = FALSE; | |
1402 | |
1403 TRACE_FUNCTION( "sig_gfp_cs_cr_meas_ind" ); | |
1404 | |
1405 switch( state ) | |
1406 { | |
1407 case CS_IDLE: | |
1408 case CS_CR_NETWORK: | |
1409 if( grr_is_pbcch_present() ) | |
1410 { | |
1411 cs_fill_meas_rslt( NULL, mphp_tcr_meas_ind ); | |
1412 cs_store_meas_values( ); | |
1413 | |
1414 if( cs_find_strongest( CS_RPT_PRD_PTM ) OR | |
1415 grr_data->cs.is_upd_ncell_stat_needed ) | |
1416 { | |
1417 strgst_changed = TRUE; | |
1418 grr_data->cs.is_upd_ncell_stat_needed = FALSE; | |
1419 } | |
1420 | |
1421 if( state EQ CS_IDLE ) | |
1422 { | |
1423 cr_initiated = cs_cr_decision( CRDM_CR_INITIAL ); | |
1424 } | |
1425 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
1426 if( ( (strgst_changed EQ TRUE) OR (cs_is_enh_meas_reporting()) ) | |
1427 AND cr_initiated EQ FALSE ) | |
1428 #else | |
1429 if( strgst_changed EQ TRUE AND cr_initiated EQ FALSE ) | |
1430 #endif | |
1431 { | |
1432 cs_update_bsic( ); | |
1433 } | |
1434 cs_check_nc_sync_timer(CS_RPT_PRD_PTM); | |
1435 } | |
1436 else | |
1437 { | |
1438 cs_tcr_meas_ind_to_pl( mphp_tcr_meas_ind ); | |
1439 } | |
1440 break; | |
1441 | |
1442 default: | |
1443 TRACE_ERROR( "SIG_GFP_CS_TCR_MEAS_IND unexpected" ); | |
1444 break; | |
1445 } | |
1446 } /* sig_gfp_cs_tcr_meas_ind() */ | |
1447 | |
1448 | |
1449 | |
1450 /* | |
1451 +------------------------------------------------------------------------------ | |
1452 | Function : sig_pg_cs_pause | |
1453 +------------------------------------------------------------------------------ | |
1454 | Description : Handles the internal signal SIG_PG_CS_PAUSE | |
1455 | | |
1456 | Parameters : void | |
1457 | | |
1458 +------------------------------------------------------------------------------ | |
1459 */ | |
1460 GLOBAL void sig_pg_cs_pause ( void ) | |
1461 { | |
1462 TRACE_ISIG( "sig_pg_cs_pause" ); | |
1463 | |
1464 switch( GET_STATE( CS ) ) | |
1465 { | |
1466 case CS_NULL: | |
1467 case CS_IDLE: | |
1468 if( grr_data->cs_meas.packet_mode EQ PACKET_MODE_PIM AND | |
1469 grr_data->nc_data.c_cell NEQ 0 ) | |
1470 { | |
1471 cs_stop_cr_meas( ); | |
1472 } | |
1473 break; | |
1474 | |
1475 default: | |
1476 TRACE_ERROR( "SIG_PG_CS_PAUSE unexpected" ); | |
1477 break; | |
1478 } | |
1479 } /* sig_pg_cs_pause() */ | |
1480 | |
1481 /* | |
1482 +------------------------------------------------------------------------------ | |
1483 | Function : sig_pg_cs_resume | |
1484 +------------------------------------------------------------------------------ | |
1485 | Description : Handles the internal signal SIG_PG_CS_RESUME | |
1486 | | |
1487 | Parameters : void | |
1488 | | |
1489 +------------------------------------------------------------------------------ | |
1490 */ | |
1491 GLOBAL void sig_pg_cs_resume ( void ) | |
1492 { | |
1493 TRACE_ISIG( "sig_pg_cs_resume" ); | |
1494 | |
1495 switch( GET_STATE( CS ) ) | |
1496 { | |
1497 case CS_NULL: | |
1498 case CS_IDLE: | |
1499 cs_req_cr_meas( ); | |
1500 break; | |
1501 | |
1502 default: | |
1503 TRACE_ERROR( "SIG_PG_CS_RESUME unexpected" ); | |
1504 break; | |
1505 } | |
1506 } /* sig_pg_cs_resume() */ | |
1507 | |
1508 /* | |
1509 +------------------------------------------------------------------------------ | |
1510 | Function : sig_gfp_cs_cr_meas_stop_con | |
1511 +------------------------------------------------------------------------------ | |
1512 | Description : Handles the internal signal SIG_GFP_CS_CR_MEAS_STOP_CON | |
1513 | | |
1514 | Parameters : void | |
1515 | | |
1516 +------------------------------------------------------------------------------ | |
1517 */ | |
1518 GLOBAL void sig_gfp_cs_cr_meas_stop_con ( T_MPHP_CR_MEAS_STOP_CON * dummy) | |
1519 { | |
1520 TRACE_ISIG( "sig_gfp_cs_cr_meas_stop_con" ); | |
1521 | |
1522 switch( GET_STATE( CS ) ) | |
1523 { | |
1524 case CS_IDLE: | |
1525 grr_data->cs.stop_req = FALSE; | |
1526 break; | |
1527 default: | |
1528 TRACE_ERROR( "SIG_GFP_CS_CR_MEAS_STOP_CON unexpected" ); | |
1529 break; | |
1530 } | |
1531 } /* sig_gfp_cs_cr_meas_stop_con() */ | |
1532 | |
1533 /* | |
1534 +------------------------------------------------------------------------------ | |
1535 | Function : sig_ctrl_cs_simu_timer_stop | |
1536 +------------------------------------------------------------------------------ | |
1537 | Description : Handles the internal signal SIG_CTRL_CS_SIMU_TIMER_STOP | |
1538 | | |
1539 | Parameters : dummy - description of parameter dummy | |
1540 | | |
1541 +------------------------------------------------------------------------------ | |
1542 */ | |
1543 GLOBAL void sig_ctrl_cs_simu_timer_stop ( void ) | |
1544 { | |
1545 TRACE_ISIG( "sig_ctrl_cs_simu_timer_stop" ); | |
1546 | |
1547 #ifdef _SIMULATION_ | |
1548 cs_stop_t_reselect( ); | |
1549 cs_stop_t3158( ); | |
1550 | |
1551 if( grr_is_pbcch_present( ) EQ FALSE AND | |
1552 grr_data->cs_meas.nc_meas_cause NEQ NC_STOP_MEAS ) | |
1553 { | |
1554 cs_send_meas_rep_req ( NC_STOP_MEAS ); | |
1555 } | |
1556 #endif | |
1557 } /* sig_ctrl_cs_stop() */ | |
1558 | |
1559 /* | |
1560 +------------------------------------------------------------------------------ | |
1561 | Function : sig_ctrl_cs_nc_param_invalid | |
1562 +------------------------------------------------------------------------------ | |
1563 | Description : Handles the internal signal SIG_CTRL_CS_NC_PARAM_INVALID | |
1564 | | |
1565 | Parameters : void | |
1566 | | |
1567 +------------------------------------------------------------------------------ | |
1568 */ | |
1569 GLOBAL void sig_ctrl_cs_nc_param_invalid ( void ) | |
1570 { | |
1571 TRACE_ISIG( "sig_ctrl_cs_nc_param_invalid" ); | |
1572 | |
1573 switch( GET_STATE( CS ) ) | |
1574 { | |
1575 case CS_IDLE: | |
1576 case CS_CR_MOBILE: | |
1577 case CS_CR_NETWORK: | |
1578 psc_db->nc_cw.param.ctrl_order = NC_NC0; | |
1579 | |
1580 cs_process_t3158( ); | |
1581 | |
1582 TRACE_EVENT_P4( "NC Cell Re-Selection Parameter: %d %d %d %d", | |
1583 cs_get_network_ctrl_order( FALSE ), | |
1584 grr_data->db.nc_ref_lst.param->rep_per_i, | |
1585 grr_data->db.nc_ref_lst.param->rep_per_t, | |
1586 grr_data->db.nc_ref_lst.param->non_drx_per ); | |
1587 break; | |
1588 | |
1589 case CS_NULL: | |
1590 default: | |
1591 /* do nothing */ | |
1592 break; | |
1593 } | |
1594 } /* sig_ctrl_cs_nc_param_invalid() */ | |
1595 | |
1596 /* | |
1597 +------------------------------------------------------------------------------ | |
1598 | Function : sig_ctrl_cs_nc_param_valid | |
1599 +------------------------------------------------------------------------------ | |
1600 | Description : Handles the internal signal SIG_CTRL_CS_NC_PARAM_VALID | |
1601 | | |
1602 | Parameters : void | |
1603 | | |
1604 +------------------------------------------------------------------------------ | |
1605 */ | |
1606 GLOBAL void sig_ctrl_cs_nc_param_valid ( void ) | |
1607 { | |
1608 TRACE_ISIG( "sig_ctrl_cs_nc_param_valid" ); | |
1609 | |
1610 switch( GET_STATE( CS ) ) | |
1611 { | |
1612 case CS_IDLE: | |
1613 case CS_CR_MOBILE: | |
1614 case CS_CR_NETWORK: | |
1615 cs_process_t3158( ); | |
1616 | |
1617 TRACE_EVENT_P4( "NC Cell Re-Selection Parameter: %d %d %d %d", | |
1618 cs_get_network_ctrl_order( FALSE ), | |
1619 grr_data->db.nc_ref_lst.param->rep_per_i, | |
1620 grr_data->db.nc_ref_lst.param->rep_per_t, | |
1621 grr_data->db.nc_ref_lst.param->non_drx_per ); | |
1622 break; | |
1623 | |
1624 case CS_NULL: | |
1625 default: | |
1626 /* do nothing */ | |
1627 break; | |
1628 } | |
1629 } /* sig_ctrl_cs_nc_param_valid() */ | |
1630 | |
1631 /* | |
1632 +------------------------------------------------------------------------------ | |
1633 | Function : sig_ctrl_cs_ba_changed | |
1634 +------------------------------------------------------------------------------ | |
1635 | Description : Handles the internal signal SIG_CTRL_CS_BA_CHANGED | |
1636 | | |
1637 | Parameters : void | |
1638 | | |
1639 +------------------------------------------------------------------------------ | |
1640 */ | |
1641 GLOBAL void sig_ctrl_cs_ba_changed ( void ) | |
1642 { | |
1643 TRACE_ISIG( "sig_ctrl_cs_ba_changed" ); | |
1644 | |
1645 switch( GET_STATE( CS ) ) | |
1646 { | |
1647 case CS_IDLE: | |
1648 case CS_CR_MOBILE: | |
1649 case CS_CR_NETWORK: | |
1650 cs_init_nc_mval_lst( ); | |
1651 cs_build_nc_ref_list( psc_db, FALSE ); | |
1652 cs_reset_nc_change_mark( psc_db ); | |
1653 | |
1654 if( grr_data->cs_meas.packet_mode EQ PACKET_MODE_PTM ) | |
1655 { | |
1656 cs_send_cr_meas_req( CS_DELETE_MEAS_RSLT ); | |
1657 } | |
1658 break; | |
1659 | |
1660 case CS_NULL: | |
1661 default: | |
1662 /* do nothing */ | |
1663 break; | |
1664 } | |
1665 } /* sig_ctrl_cs_ba_changed() */ | |
1666 | |
1667 /* | |
1668 +------------------------------------------------------------------------------ | |
1669 | Function : sig_ctrl_cs_reset_meas_rep_params | |
1670 +------------------------------------------------------------------------------ | |
1671 | Description : Handles the internal signal SIG_CTRL_CS_RESET_MEAS_REP_PARAMS | |
1672 | | |
1673 | Parameters : void | |
1674 | | |
1675 +------------------------------------------------------------------------------ | |
1676 */ | |
1677 GLOBAL void sig_ctrl_cs_reset_meas_rep_params ( void ) | |
1678 { | |
1679 TRACE_ISIG( "sig_ctrl_cs_reset_meas_rep_params" ); | |
1680 | |
1681 cs_reset_meas_rep_params (psc_db); | |
1682 | |
1683 } /* sig_ctrl_cs_reset_meas_rep_params() */ | |
1684 | |
1685 #if defined (REL99) AND defined (TI_PS_FF_EMR) | |
1686 /* | |
1687 +------------------------------------------------------------------------------ | |
1688 | Function : sig_ctrl_cs_si2quater_ind | |
1689 +------------------------------------------------------------------------------ | |
1690 | Description : Handles the internal signal SIG_CTRL_CS_SI2QUATER_IND | |
1691 | | |
1692 | Parameters : rrgrr_si2quater_ind - Pointer to primitive payload | |
1693 | | |
1694 +------------------------------------------------------------------------------ | |
1695 */ | |
1696 GLOBAL void sig_ctrl_cs_si2quater_ind ( T_RRGRR_SI2QUATER_IND | |
1697 *rrgrr_si2quater_ind) | |
1698 { | |
1699 TRACE_ISIG( "sig_ctrl_cs_si2quater_ind" ); | |
1700 | |
1701 switch( GET_STATE( CS ) ) | |
1702 { | |
1703 case CS_IDLE: | |
1704 case CS_CR_NETWORK: | |
1705 grr_copy_enh_and_nc_params_from_si2qtr(rrgrr_si2quater_ind); | |
1706 break; | |
1707 | |
1708 default: | |
1709 TRACE_ERROR( "SIG_CTRL_CS_SI2QUATER_IND unexpected" ); | |
1710 break; | |
1711 } | |
1712 } | |
1713 | |
1714 #endif | |
1715 |