comparison src/g23m-gprs/grr/grr_psis.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 : 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 | PSI of entity GRR.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef GRR_PSIS_C
23 #define GRR_PSIS_C
24 #endif
25
26 #define ENTITY_GRR
27
28 /*==== INCLUDES =============================================================*/
29
30 #include "typedefs.h" /* to get Condat data types */
31 #include <string.h>
32
33 #include "vsi.h" /* to get a lot of macros */
34 #include "macdef.h"
35 #include "gprs.h"
36 #include "gsm.h" /* to get a lot of macros */
37 #include "ccdapi.h" /* to get CCD API */
38 #include "cnf_grr.h" /* to get cnf-definitions */
39 #include "mon_grr.h" /* to get mon-definitions */
40 #include "prim.h" /* to get the definitions of used SAP and directions */
41 #include "message.h"
42 #include "grr.h" /* to get the global entity definitions */
43
44 #include "grr_f.h" /* To use global functions*/
45
46 #include "grr_psif.h" /* */
47
48 #include "grr_ctrls.h" /* */
49
50 #include "grr_psis.h" /* */
51
52 #include <stdio.h>
53
54 /*==== CONST ================================================================*/
55
56 /*==== LOCAL VARS ===========================================================*/
57
58 /*==== PRIVATE FUNCTIONS ====================================================*/
59
60 /*==== PUBLIC FUNCTIONS =====================================================*/
61
62
63 /*
64 +------------------------------------------------------------------------------
65 | Function : sig_ctrl_psi_si13_received
66 +------------------------------------------------------------------------------
67 | Description : Handles the internal signal SIG_CTRL_PSI_SI13_RECEIVED
68 |
69 | Parameters : T_RRGRR_SI13_IND *rrgrr_si13_ind
70 |
71 +------------------------------------------------------------------------------
72 */
73 GLOBAL void sig_ctrl_psi_si13_received ( T_RRGRR_GPRS_SI13_IND *rrgrr_si13_ind,
74 BOOL ba_bcch_changed )
75 {
76 MCAST(si13,D_SYS_INFO_13);
77 UBYTE in_state = GET_STATE( PSI );
78 UBYTE pb, ab_type;
79 TRACE_ISIG( "sig_ctrl_psi_si13_received" );
80
81 #ifndef _TARGET_
82
83 switch(psc_db->acq_type)
84 {
85 case NONE:
86 /*
87 * SI13 was not requested
88 */
89 TRACE_ERROR("SI13 not requested!");
90 return;
91 }
92
93 #endif
94
95 pb = psc_db->g_pwr_par.pb;
96 ab_type = psc_db->gprs_cell_opt.ab_type;
97
98 switch( in_state )
99 {
100 case PSI_NULL:
101 grr_data->psi.is_start_of_10_sec_allowed = TRUE;
102 psi_start_60sec();
103 /*
104 * This is the first SI13 message received by the service PSI, except in
105 * case of having SI13 without rest octets in the former SI13 message
106 */
107 switch(psi_process_si13(si13))
108 {
109 case SI13_OK:
110 SET_STATE( PSI, PSI_BCCH_IDLE );
111 TRACE_EVENT("NULL: BCCH present");
112 psi_is_access_class_changed();
113 sig_psi_ctrl_si13_processed();
114 /*
115 * Stop and restart 60 sec. timer
116 */
117 psi_stop_60sec ( TRUE );
118 psi_start_30sec();
119 /*
120 * Check acq state of SI messages
121 */
122 switch(psi_acq_state_of_si(rrgrr_si13_ind->si_states))
123 {
124 case ACQ_COMP_OK:
125 /*
126 * packet access enabled
127 */
128 psi_send_access_enable_if_needed();
129 psc_db->acq_type = NONE; /* e.g. wait 30 sec for reread SI13*/
130 /* BCCH reading is automatically stopped by RR/ALR */
131
132 /*stop the timer 3172 timer if it is already running in old cell*/
133 if(grr_t_status( T3172_1 ) > 0)
134 {
135 vsi_t_stop(GRR_handle,T3172_1);
136 }
137 break;
138 case ACQ_RUNNING:
139 sig_psi_ctrl_read_si( COMPLETE_SI );
140 psc_db->acq_type = COMPLETE;
141 break;
142 default:
143 TRACE_ERROR("Unexpected acq state of SI in PSI_NULL");
144 break;
145 }
146 break;/* switch SI13_OK */
147 case SI13_REREAD:
148 /*
149 * Only in case of no rest octets
150 * Do not stop 60 sec. timer. Request new SI13
151 */
152 psc_db->acq_type = PARTIAL;
153 sig_psi_ctrl_read_si( UPDATE_SI13 );
154 break;
155 case SI13_COMPLETE_PSI:
156 /*
157 * SI13 contains PBCCH description. Start complete acq of PSI
158 */
159 SET_STATE( PSI, PSI_IDLE );
160 TRACE_EVENT("PBCCH present");
161 psi_update_data_to_request(INIT_NEEDED);
162 sig_psi_ctrl_si13_processed();
163 psi_complete_acq(COMPLETE);
164 psi_stop_60sec ( TRUE );
165 break;
166 default:
167 TRACE_ERROR("Unexpected SI13 return in PSI_NULL");
168 break;
169 }
170 break;
171 case PSI_BCCH_IDLE:
172 /*
173 * Reading periodical SI13 message or reread because of absence of SI13 rest octets
174 * or partial acq or complete acq because of change field in the former SI13 message
175 * or PCCCH was released and we reread SI13
176 */
177 grr_data->psi.is_start_of_10_sec_allowed = TRUE;
178 switch(psi_process_si13(si13))
179 {
180 case SI13_OK:
181 /*
182 * Stop and restart 60 sec. timer
183 */
184 psi_stop_60sec ( TRUE );
185 psi_stop_30sec ( TRUE );
186 if(psi_is_access_class_changed())
187 {
188 /*
189 * Implies the CTRL to send CELL_IND
190 */
191 sig_psi_ctrl_access_changed();
192 }
193
194 /*
195 * Check acq state of SI messages
196 */
197 switch(psi_acq_state_of_si(rrgrr_si13_ind->si_states))
198 {
199 case ACQ_PERIOD_OK:
200 psc_db->acq_type = NONE; /* e.g. wait 30 sec for reread SI13*/
201 /* BCCH reading is automatically stopped by RR/ALR */
202 break;
203 case ACQ_PART_OK:
204 psi_stop_10sec(); /* partial acquisition completed */
205 /*
206 * packet access enabled
207 */
208 psi_send_access_enable_if_needed();
209 psc_db->acq_type = NONE; /* e.g. wait 30 sec for reread SI13*/
210 /* BCCH reading is automatically stopped by RR/ALR */
211 break;
212 case ACQ_COMP_OK:
213 /*
214 * packet access enabled
215 */
216 psi_send_access_enable_if_needed();
217 psc_db->acq_type = NONE; /* e.g. wait 30 sec for reread SI13*/
218 /* BCCH reading is automatically stopped by RR/ALR */
219 break;
220 case ACQ_RUNNING:
221 break;
222 default:
223 TRACE_ERROR("Unexpected acq state of SI in PSI_BCCH_IDLE");
224 break;
225 }
226 sig_psi_ctrl_meas_param_valid_si13( ba_bcch_changed );
227 break;/* SI13_OK */
228 case SI13_REREAD:
229 /* Only in case of no rest octets
230 * Do not stop 60 sec. timer. Request new SI13
231 */
232 psi_stop_30sec ( TRUE );
233 psc_db->acq_type = PARTIAL;
234 sig_psi_ctrl_read_si( UPDATE_SI13 );
235 sig_psi_ctrl_meas_param_invalid_si13( );
236 break;
237 case SI13_PARTIAL_SI:
238 /*
239 * Partial acq has to be started
240 */
241 psi_stop_30sec ( TRUE );
242 sig_psi_ctrl_read_si(si13->si13_rest_oct.si13_info.si_cf);
243 psc_db->acq_type = PARTIAL;
244 psi_start_10sec();
245 sig_psi_ctrl_meas_param_valid_si13( ba_bcch_changed );
246 break;
247 case SI13_COMPLETE_SI:
248 psi_initiate_read_complete_si( );
249 sig_psi_ctrl_meas_param_valid_si13( ba_bcch_changed );
250 break;
251 case SI13_COMPLETE_PSI:
252 SET_STATE( PSI, PSI_NULL );
253 /* BCCH reading is automatically stopped by RR/ALR */
254 psi_initiate_pbcch_switching( PSI_DC_PBCCH_ESTABLISHED );
255 break;
256 default:
257 TRACE_ERROR("Unexpected SI13 return in PSI_BCCH_IDLE");
258 break;
259 }
260 break;
261 case PSI_BCCH_TRANSFER:
262 /*
263 * Reread SI13 because of PBCCH release indicated in PSI1
264 * or change/release of PBCCH description indicated in PSI13
265 * message. Both PSI13 and PSI1 are sent on PACCH
266 */
267 /*
268 * Read SI13. We probably were not able to read PSI13 in transfer mode within
269 * 30 seconds, so we requested SI13.
270 */
271 grr_data->psi.is_start_of_10_sec_allowed = FALSE;
272 switch(psi_process_si13(si13))
273 {
274 case SI13_OK:
275 /*
276 * Stop and restart 60 sec. timer
277 * The MS may continue its operation on transfer mode
278 */
279 psi_stop_60sec ( TRUE );
280 psi_stop_30sec ( TRUE );
281
282 if(psi_is_access_class_changed())
283 {
284 /*
285 * Implies the CTRL to send CELL_IND
286 */
287 sig_psi_ctrl_access_changed();
288 }
289
290 switch(psi_acq_state_of_si(rrgrr_si13_ind->si_states))
291 {
292 case ACQ_PERIOD_OK:
293 psc_db->acq_type = NONE; /* e.g. wait 30 sec for reread SI13*/
294 /* BCCH reading is automatically stopped by RR/ALR */
295 break;
296 case ACQ_PART_OK:
297 psi_stop_10sec(); /* partial acquisition completed */
298 psc_db->acq_type = NONE; /* e.g. wait 30 sec for reread SI13*/
299 /* BCCH reading is automatically stopped by RR/ALR */
300 break;
301 case ACQ_COMP_OK:
302 /*
303 * packet access enabled
304 */
305 psi_send_access_enable_if_needed();
306 psc_db->acq_type = NONE; /* e.g. wait 30 sec for reread SI13*/
307 /* BCCH reading is automatically stopped by RR/ALR */
308 break;
309 case ACQ_RUNNING:
310 break;
311 default:
312 TRACE_ERROR("Unexpected acq state of SI in PSI_BCCH_TRANSFER");
313 break;
314 }
315
316 if( ab_type NEQ psc_db->gprs_cell_opt.ab_type OR
317 pb NEQ psc_db->g_pwr_par.pb )
318 {
319 grr_update_pacch();
320 }
321
322 sig_psi_ctrl_meas_param_valid_si13( ba_bcch_changed );
323 break;
324 case SI13_REREAD:
325 /*
326 * Only in case of no rest octets
327 * Do not stop 60 sec. timer. Request new SI13
328 */
329 psi_stop_30sec ( TRUE );
330 psc_db->acq_type = PARTIAL;
331 sig_psi_ctrl_read_si( UPDATE_SI13 );
332 sig_psi_ctrl_meas_param_invalid_si13( );
333 break;
334
335 case SI13_PARTIAL_SI:
336 /*
337 * Partial acq has to be started
338 */
339 psi_stop_30sec ( TRUE );
340 sig_psi_ctrl_read_si(si13->si13_rest_oct.si13_info.si_cf);
341 psc_db->acq_type = PARTIAL;
342 psi_start_10sec();
343 sig_psi_ctrl_meas_param_valid_si13( ba_bcch_changed );
344 TRACE_EVENT ("SI 13 with partial SI");
345 break;
346
347 case SI13_COMPLETE_SI:
348 psc_db->acq_type =COMPLETE;
349 sig_psi_ctrl_read_si( COMPLETE_SI);
350 TRACE_EVENT ("SI 13 with complete SI");
351 break;
352
353 case SI13_COMPLETE_PSI:
354 SET_STATE( PSI, PSI_NULL );
355 /* BCCH reading is automatically stopped by RR/ALR */
356 psi_initiate_pbcch_switching( PSI_DC_PBCCH_ESTABLISHED );
357 break;
358 default:
359 TRACE_ERROR("SIG_CTRL_PSI_SI13_RECEIVED: unexpected return value of type T_SI13_RET");
360 break;
361 }
362 break;
363 default:
364 TRACE_ERROR( "SIG_CTRL_PSI_SI13_RECEIVED unexpected" );
365 break;
366 }
367 } /* sig_ctrl_psi_si13_received() */
368
369
370
371 /*
372 +------------------------------------------------------------------------------
373 | Function : sig_ctrl_psi_pim
374 +------------------------------------------------------------------------------
375 | Description : Handles the internal signal SIG_CTRL_PSI_PIM
376 |
377 | Parameters : void
378 |
379 +------------------------------------------------------------------------------
380 */
381 GLOBAL void sig_ctrl_psi_pim ( void )
382 {
383 UBYTE state;
384 TRACE_ISIG( "sig_ctrl_psi_pim" );
385
386 state = GET_STATE( PSI );
387 switch( state )
388 {
389 case PSI_NULL:
390 case PSI_TRANSFER:
391 SET_STATE( PSI, PSI_IDLE );
392 /*lint -fallthrough*/
393 case PSI_IDLE:
394 /* Partial acquisition in this case is not taken care */
395 if(psc_db->acq_type EQ PERIODICAL_PSI1_READING)
396 {
397 TRACE_EVENT("Trigger PSI1 : Packet->Idle");
398 psi_receive_psi(READ_PSI1_IN_PSI1_REPEAT_PERIODS);
399 }
400 break;
401 case PSI_BCCH_TRANSFER:
402 SET_STATE( PSI, PSI_BCCH_IDLE );
403
404 /*lint -fallthrough*/
405
406 case PSI_BCCH_IDLE:
407 if(psc_db->acq_type EQ PERIODICAL_SI13_READING)
408 {
409 sig_psi_ctrl_read_si( UPDATE_SI13 );
410 }
411 break;
412 default:
413 TRACE_EVENT_P1("PSI_PIM PSI: %d",state);
414 break;
415 }
416 } /* sig_ctrl_psi_pim() */
417
418
419 /*
420 +------------------------------------------------------------------------------
421 | Function : sig_ctrl_psi_pam
422 +------------------------------------------------------------------------------
423 | Description : Handles the internal signal SIG_CTRL_PSI_PAM
424 |
425 | Parameters : void
426 |
427 +------------------------------------------------------------------------------
428 */
429 GLOBAL void sig_ctrl_psi_pam ( void )
430 {
431 UBYTE state;
432 TRACE_ISIG( "sig_ctrl_psi_pam" );
433
434 state = GET_STATE( PSI );
435 switch( state )
436 {
437 case PSI_IDLE:
438 /* PBCCH reading process is running, we have to stop it*/
439 if (psc_db->acq_type EQ PERIODICAL_PSI1_READING)
440 {
441 /* When entering Idle go for PSI1 acquisition
442 * acq_type is changed to PERIODICAL_PSI1_READING */
443 psi_stop_psi_reading(PERIODICAL_PSI1_READING);
444 }
445 else if (psc_db->acq_type NEQ NONE)
446 {
447 /* Limitation: partial acquisition of other PSIs not taken care */
448 psi_stop_psi_reading(NONE);
449 }
450 break;
451 case PSI_BCCH_IDLE:
452 case PSI_BCCH_TRANSFER:
453 /* BCCH reading is automatically stopped by RR/ALR */
454 break;
455 default:
456 TRACE_EVENT_P1("PSI_PAM PSI: %d",state);
457 break;
458 }
459 } /* sig_ctrl_psi_pam() */
460
461 /*
462 +------------------------------------------------------------------------------
463 | Function : sig_ctrl_psi_ptm
464 +------------------------------------------------------------------------------
465 | Description : Handles the internal signal SIG_CTRL_PSI_PTM
466 |
467 | Parameters : void
468 |
469 +------------------------------------------------------------------------------
470 */
471 GLOBAL void sig_ctrl_psi_ptm ( void )
472 {
473 UBYTE state;
474
475 TRACE_ISIG( "sig_ctrl_psi_ptm" );
476
477 state = GET_STATE( PSI ) ;
478 switch( state )
479 {
480 case PSI_IDLE:
481 SET_STATE( PSI, PSI_TRANSFER );
482 /* acquisition has been running, so we have to stop this acq.*/
483 if (psc_db->acq_type EQ PERIODICAL_PSI1_READING)
484 {
485 /* When entering Idle go for PSI1 acquisition
486 * acq_type is changed to PERIODICAL_PSI1_READING */
487 psi_stop_psi_reading(PERIODICAL_PSI1_READING);
488 }
489 else if (psc_db->acq_type NEQ NONE)
490 {
491 /* Limitation: partial acquisition of other PSIs not taken care */
492 psi_stop_psi_reading(NONE);
493 }
494
495 if(psc_db->send_psi_status AND psc_db->psi1_params.psi_status_supported)
496 {
497 /* MS should acquire PSI messages; we have to send PACKET PSI STATUS message*/
498 psi_send_psi_status();
499 }
500 /* PSI STATUS*/
501 break;
502 case PSI_NULL:
503 case PSI_BCCH_IDLE:
504 SET_STATE( PSI, PSI_BCCH_TRANSFER );
505 if(psc_db->acq_type EQ PERIODICAL_SI13_READING )
506 {
507 /* SI reading has been running and therefore it has to be restarted. */
508 sig_psi_ctrl_read_si( UPDATE_SI13 );
509 }
510 break;
511 default:
512 /* TRACE_EVENT_P1( "PSI_PTM PSI: %d",state);*/
513 break;
514 }
515 } /* sig_ctrl_psi_ptm() */
516
517
518
519 /*
520 +------------------------------------------------------------------------------
521 | Function : sig_ctrl_psi_suspend
522 +------------------------------------------------------------------------------
523 | Description : Handles the internal signal SIG_CTRL_PSI_SUSPEND
524 |
525 | Parameters : void
526 |
527 +------------------------------------------------------------------------------
528 */
529 GLOBAL void sig_ctrl_psi_suspend ( void )
530 {
531 TRACE_ISIG( "sig_ctrl_psi_suspend" );
532
533 SET_STATE(PSI, PSI_SUSPENDED);
534
535 if(psc_db->acq_type NEQ NONE) /* acquisition has been running, so we have to stop this acq.*/
536 {
537 psi_stop_psi_reading(NONE);
538 }
539 psi_stop_timer();
540
541 } /* sig_ctrl_psi_suspend() */
542
543
544
545 /*
546 +------------------------------------------------------------------------------
547 | Function : sig_ctrl_psi_resumpt
548 +------------------------------------------------------------------------------
549 | Description : Handles the internal signal SIG_CTRL_PSI_RESUMPT
550 |
551 | Parameters : void
552 |
553 +------------------------------------------------------------------------------
554 */
555 GLOBAL void sig_ctrl_psi_resumpt ( void )
556 {
557 TRACE_ISIG( "sig_ctrl_psi_resumpt" );
558
559 switch( GET_STATE( PSI ) )
560 {
561 case PSI_SUSPENDED:
562 if(grr_is_pbcch_present())
563 {
564 SET_STATE(PSI, PSI_IDLE);
565 }
566 else
567 {
568 SET_STATE(PSI, PSI_BCCH_IDLE);
569 }
570 /*
571 * start timer 30, 60 sec. to be able to read PSI1 or SI13
572 */
573 psi_start_60sec();
574 psi_start_30sec();
575 break;
576 default:
577 TRACE_ERROR( "SIG_CTRL_PSI_RESUMPT unexpected" );
578 break;
579 }
580 } /* sig_ctrl_psi_resumpt() */
581
582
583
584 /*
585 +------------------------------------------------------------------------------
586 | Function : sig_ctrl_psi_stop
587 +------------------------------------------------------------------------------
588 | Description : Handles the internal signal SIG_CTRL_PSI_STOP
589 |
590 | Parameters : void
591 |
592 +------------------------------------------------------------------------------
593 */
594 GLOBAL void sig_ctrl_psi_stop ( void)
595 {
596 TRACE_ISIG( "sig_ctrl_psi_stop" );
597
598 switch( GET_STATE( PSI ) )
599 {
600 case PSI_IDLE:
601 case PSI_TRANSFER:
602 SET_STATE( PSI, PSI_NULL );
603 if(psc_db->acq_type NEQ NONE) /* acquisition has been running, so we have to stop this acq.*/
604 {
605 TRACE_EVENT("Acq. running: send MPHP_SCELL_PBCCH_STOP_REQ");
606 psi_stop_psi_reading(NONE);
607 }
608 psi_stop_timer();
609 psi_init_params();
610 break;
611 case PSI_SUSPENDED:
612 SET_STATE( PSI, PSI_NULL );
613 psi_stop_timer();
614 psi_init_params();
615 break;
616 case PSI_BCCH_IDLE:
617 case PSI_BCCH_TRANSFER:
618 SET_STATE( PSI, PSI_NULL );
619 psi_stop_timer();
620 if(psc_db->acq_type NEQ COMPLETE) /* acquisition has been running, so we have to stop this acq.*/
621 {
622 TRACE_EVENT("Acq. running: send STOP SI READING");
623 psc_db->acq_type = COMPLETE;
624 /* BCCH reading is automatically stopped by RR/ALR */
625 }
626 psi_reset_si_entries();
627 break;
628 default:
629 TRACE_EVENT( "PSI stopped/not running" );
630 break;
631 }
632 } /* sig_ctrl_psi_stop() */
633
634
635 /*
636 +------------------------------------------------------------------------------
637 | Function : sig_ctrl_psi_sync_ok
638 +------------------------------------------------------------------------------
639 | Description : Handles the internal signal SIG_CTRL_PSI_SYNC_OK
640 | PSI can start PBCCH reading process
641 |
642 | Parameters : void
643 |
644 +------------------------------------------------------------------------------
645 */
646 GLOBAL void sig_ctrl_psi_sync_ok ( void)
647 {
648 TRACE_ISIG( "sig_ctrl_psi_sync_ok" );
649 switch( GET_STATE( PSI ) )
650 {
651 case PSI_IDLE:
652 psi_complete_acq(COMPLETE);
653 break;
654 default:
655 TRACE_ERROR( "SIG_CTRL_PSI_SYNC_OK unexpected" );
656 break;
657 }
658 } /* sig_ctrl_psi_sync_ok() */
659
660 /*
661 +------------------------------------------------------------------------------
662 | Function : SIG_CTRL_PSI_READ_FULL_PSI_IN_NEW_CELL
663 +------------------------------------------------------------------------------
664 | Description : Handles the internal signal SIG_CTRL_PSI_READ_FULL_PSI_IN_NEW_CELL
665 | PSI can starts PBCCH reading process in the possible new cell
666 |
667 | Parameters : void
668 |
669 +------------------------------------------------------------------------------
670 */
671 GLOBAL void sig_ctrl_psi_read_full_psi_in_new_cell ( void)
672 {
673 TRACE_ISIG( "sig_ctrl_psi_read_full_psi_in_new_cell" );
674 switch( GET_STATE( PSI ) )
675 {
676 case PSI_NULL:
677 SET_STATE(PSI, PSI_IDLE);
678
679 /*lint -fallthrough*/
680
681 case PSI_IDLE:
682 case PSI_TRANSFER:
683 case PSI_SUSPENDED:
684 case PSI_BCCH_IDLE:
685 case PSI_BCCH_TRANSFER:
686
687 psc_db->state_of_PSI[PSI13].state = RECEIPT_OK; /* we do not need to read PSI13 again*/
688 /*
689 * read PSI: update it with PBCCH desc
690 */
691 psi_update_data_to_request(INIT_NOT_NEEDED);
692
693 psi_complete_acq(FULL_PSI_IN_NEW_CELL);
694 break;
695 default:
696 TRACE_ERROR( "SIG_CTRL_PSI_READ_FULL_PSI_IN_NEW_CELL unexpected" );
697 break;
698 }
699 } /* sig_ctrl_psi_read_full_psi_in_new_cell() */
700
701 /*
702 +------------------------------------------------------------------------------
703 | Function : SIG_CTRL_PSI_REL_STATE
704 +------------------------------------------------------------------------------
705 | Description : Handles the internal signal sig_ctrl_psi_rel_state
706 | Check whether we have to start PBCCH request or not
707 |
708 | Parameters : T_RELEASE_STATE rel_state
709 |
710 +------------------------------------------------------------------------------
711 */
712 GLOBAL void sig_ctrl_psi_rel_state(T_RELEASE_STATE rel_state)
713 {
714 TRACE_ISIG("sig_ctrl_psi_rel_state");
715
716 if(rel_state EQ REL_PERFORMED)
717 {
718 grr_data->psi.is_pbcch_req_allowed = TRUE;
719 if(grr_data->psi.is_pbcch_req_needed)
720 {
721 TRACE_EVENT("Release of TBF, stop of RR task, etc. performed.There is a waiting PBCCH req. We can start it now");
722 grr_data->psi.is_pbcch_req_needed =FALSE;
723 {
724 PALLOC(mphp_scell_pbcch_req, MPHP_SCELL_PBCCH_REQ);
725 psi_prepare_scell_pbcch_req(mphp_scell_pbcch_req, grr_data->psi.reading_type);
726 PSEND(hCommL1,mphp_scell_pbcch_req);
727 }
728 }
729 /* else
730 {
731 TRACE_EVENT("Release performed.There is NO waiting PBCCH req.");
732 }
733 */
734 }
735 else
736 {
737 /*
738 * If a PBCCH req was running L1 stops automatically the reading procedure
739 * we have to set the grr_data->psi.is_pbcch_req_needed to TRUE to continue
740 * after performing release
741 *
742 * if(psc_db->acq_type NEQ NONE)
743 * {
744 * grr_data->psi.is_pbcch_req_needed = TRUE;
745 * }
746 *
747 * TRACE_EVENT("We may have to stop running PBCCH request.PBCCH req. NOT allowed");
748 */
749 grr_data->psi.is_pbcch_req_allowed = FALSE;
750 }
751
752 }
753
754
755 /*
756 +------------------------------------------------------------------------------
757 | Function : sig_ctrl_psi_resumpt_cc
758 +------------------------------------------------------------------------------
759 | Description : Handles the internal signal SIG_CTRL_PSI_RESUMPT_CC
760 |
761 | Parameters : void
762 |
763 +------------------------------------------------------------------------------
764 */
765 GLOBAL void sig_ctrl_psi_resumpt_cc ( void )
766 {
767 MCAST(si13,D_SYS_INFO_13);
768
769 TRACE_ISIG( "sig_ctrl_psi_resumpt_cc" );
770 /* because get_state(PSI) makes no difference of the psi status
771 *between the old and new cell, it must be directly from the datadase */
772
773 grr_set_pbcch( si13->si13_rest_oct.si13_info.v_pbcch_des );
774
775 if(( grr_t_status( T3176 ) > 0 ) /* in case of packet cell change failure, SI13 should be processed */
776 AND
777 (psc_db->psi_assigned_data.state EQ PSI_SUSPENDED))
778 {
779 if (grr_is_pbcch_present())
780 {
781 psc_db->psi_assigned_data.state = PSI_IDLE;
782 psi_start_60sec();
783 psi_start_30sec();
784 }
785 else
786 {
787 psc_db->psi_assigned_data.state = PSI_BCCH_IDLE;
788 }
789 }
790 } /* sig_ctrl_psi_resumpt_cc() */
791
792
793
794 /*
795 +------------------------------------------------------------------------------
796 | Function : sig_gfp_psi_1_ptm
797 +------------------------------------------------------------------------------
798 | Description : Handles
799 |
800 | Parameters :
801 |
802 +------------------------------------------------------------------------------
803 */
804 GLOBAL void sig_gfp_psi_1_ptm ( void )
805 {
806 MCAST(psi1, PSI_1);
807
808 TRACE_ISIG( "sig_gfp_psi_1_ptm" );
809
810
811 switch( GET_STATE( PSI ) )
812 {
813 case PSI_TRANSFER:
814 psi_stop_60sec(TRUE);
815 psi_stop_30sec(TRUE);
816 {
817 UBYTE pb, ab_type;
818
819 pb = psc_db->g_pwr_par.pb;
820 ab_type = psc_db->gprs_cell_opt.ab_type;
821
822 psi_handle_psi1(psi1);
823
824 if(
825 (ab_type NEQ psc_db->gprs_cell_opt.ab_type)
826 OR
827 (pb NEQ psc_db->g_pwr_par.pb)
828 )
829 {
830 /*
831 * update PACCH parameters
832 */
833 grr_update_pacch();
834 }
835 }
836 break;
837 case PSI_BCCH_TRANSFER:
838 psi_handle_psi1(psi1);
839 break;
840
841 default:
842 TRACE_ERROR( "SIG_GFP_PSI_1_PTM unexpected" );
843 break;
844 }
845 } /* sig_gfp_psi_1_ptm() */
846
847 /*
848 +------------------------------------------------------------------------------
849 | Function : sig_gfp_psi_2_ptm
850 +------------------------------------------------------------------------------
851 | Description : Handles
852 |
853 | Parameters : void
854 |
855 +------------------------------------------------------------------------------
856 */
857 GLOBAL void sig_gfp_psi_2_ptm (void)
858 {
859 MCAST(psi2, PSI_2);
860
861 TRACE_ISIG( "sig_gfp_psi_2_ptm " );
862
863 switch( GET_STATE( PSI ) )
864 {
865 case PSI_TRANSFER:
866 psi_handle_psi2(psi2);
867 break;
868 default:
869 TRACE_ERROR( "SIG_GFP_PSI_2_PTM unexpected" );
870 break;
871 }
872 } /* sig_gfp_psi_2_ptm () */
873
874
875
876 /*
877 +------------------------------------------------------------------------------
878 | Function : sig_gfp_psi_3_ptm
879 +------------------------------------------------------------------------------
880 | Description : Handles
881 |
882 | Parameters :
883 |
884 +------------------------------------------------------------------------------
885 */
886 GLOBAL void sig_gfp_psi_3_ptm (void)
887 {
888 MCAST(psi3, PSI_3);
889
890 TRACE_ISIG( "sig_gfp_psi_3_ptm " );
891
892 switch( GET_STATE( PSI ) )
893 {
894 case PSI_TRANSFER:
895 psi_handle_psi3(psi3);
896 break;
897 default:
898 TRACE_ERROR( "SIG_GFP_PSI_3_PTM unexpected" );
899 break;
900 }
901 } /* sig_gfp_psi_3_ptm () */
902
903
904
905
906 /*
907 +------------------------------------------------------------------------------
908 | Function : sig_gfp_psi_3_bis_ptm
909 +------------------------------------------------------------------------------
910 | Description : Handles
911 |
912 | Parameters :
913 |
914 +------------------------------------------------------------------------------
915 */
916 GLOBAL void sig_gfp_psi_3_bis_ptm ( void )
917 {
918 MCAST(psi3bis, PSI_3_BIS);
919
920 TRACE_ISIG( "sig_gfp_psi_3_bis_ptm " );
921
922
923 switch( GET_STATE( PSI ) )
924 {
925 case PSI_TRANSFER:
926 psi_handle_psi3bis(psi3bis);
927 break;
928 default:
929 TRACE_ERROR( "SIG_GFP_PSI_3_BIS_PTM unexpected" );
930 break;
931 }
932 } /* sig_gfp_psi_3_bis_ptm () */
933
934
935 #if defined (REL99) AND defined (TI_PS_FF_EMR)
936 /*
937 +------------------------------------------------------------------------------
938 | Function : sig_gfp_psi_3_ter_ptm
939 +------------------------------------------------------------------------------
940 | Description : Handles the internal signal SIG_GFP_PSI_3_TER_PTM
941 |
942 | Parameters :
943 |
944 +------------------------------------------------------------------------------
945 */
946 GLOBAL void sig_gfp_psi_3_ter_ptm ( void )
947 {
948 MCAST(psi3ter, PSI_3_TER);
949
950 TRACE_ISIG( "sig_gfp_psi_3_ter_ptm " );
951
952
953 switch( GET_STATE( PSI ) )
954 {
955 case PSI_TRANSFER:
956 psi_handle_psi3ter(psi3ter);
957 break;
958 default:
959 TRACE_ERROR( "SIG_GFP_PSI_3_TER_PTM unexpected" );
960 break;
961 }
962 } /* sig_gfp_psi_3_ter_ptm () */
963 #endif
964
965 /*
966 +------------------------------------------------------------------------------
967 | Function : sig_gff_psi_4
968 +------------------------------------------------------------------------------
969 | Description : Handles
970 |
971 | Parameters :
972 |
973 +------------------------------------------------------------------------------
974 */
975 GLOBAL void sig_gfp_psi_4_ptm ( void )
976 {
977 MCAST(psi4, PSI_4);
978
979 TRACE_ISIG( "sig_gfp_psi_4_ptm " );
980
981 switch( GET_STATE( PSI ) )
982 {
983 case PSI_TRANSFER:
984 psi_handle_psi4(psi4);
985 break;
986 default:
987 TRACE_ERROR( "SIG_GFP_PSI_4_PTM unexpected" );
988 break;
989 }
990 } /* sig_gfp_psi_4_ptm() */
991
992 #ifdef REL99
993 /*
994 +------------------------------------------------------------------------------
995 | Function : sig_gfp_psi_8_ptm
996 +------------------------------------------------------------------------------
997 | Description : Handles psi 8 messsage received on PACCH.
998 |
999 | Parameters :
1000 |
1001 +------------------------------------------------------------------------------
1002 */
1003 GLOBAL void sig_gfp_psi_8_ptm ( void )
1004 {
1005 MCAST(psi8, PSI_8);
1006
1007 TRACE_ISIG( "sig_gfp_psi_8_ptm " );
1008
1009 switch( GET_STATE( PSI ) )
1010 {
1011 case PSI_TRANSFER:
1012 psi_handle_psi8(psi8);
1013 break;
1014 default:
1015 TRACE_ERROR( "SIG_GFP_PSI_8_PTM unexpected" );
1016 break;
1017 }
1018 } /* sig_gfp_psi_8_ptm() */
1019 #endif
1020
1021 /*
1022 +------------------------------------------------------------------------------
1023 | Function : sig_gfp_psi_13_ptm
1024 +------------------------------------------------------------------------------
1025 | Description : Handles
1026 |
1027 | Parameters :
1028 |
1029 +------------------------------------------------------------------------------
1030 */
1031 GLOBAL void sig_gfp_psi_13_ptm(void)
1032 {
1033 MCAST(psi13,PSI_13);
1034
1035 UBYTE pb, ab_type;
1036
1037 TRACE_ISIG( "sig_gfp_psi_13_ptm" );
1038
1039 grr_data->psi.is_start_of_10_sec_allowed = TRUE;
1040
1041 pb = psc_db->g_pwr_par.pb;
1042 ab_type = psc_db->gprs_cell_opt.ab_type;
1043
1044 switch( GET_STATE( PSI ) )
1045 {
1046 case PSI_BCCH_TRANSFER:
1047 case PSI_TRANSFER:
1048 switch(psi_process_psi13(psi13))
1049 {
1050 case PSI13_OK:
1051 psi_stop_60sec(TRUE);
1052 psi_stop_30sec(TRUE);
1053
1054 if( ab_type NEQ psc_db->gprs_cell_opt.ab_type OR
1055 pb NEQ psc_db->g_pwr_par.pb )
1056 {
1057 grr_update_pacch();
1058 }
1059 sig_psi_ctrl_meas_param_valid_si13( FALSE );
1060 break;
1061 case PSI13_PARTIAL_SI:
1062 psi_stop_60sec(TRUE);
1063 psi_stop_30sec(TRUE);
1064 sig_psi_ctrl_read_si(psi13->si_change_ma);
1065 psc_db->acq_type = PARTIAL;
1066 psi_start_10sec();
1067 sig_psi_ctrl_meas_param_valid_si13( FALSE );
1068 break;
1069 case PSI13_COMPLETE_SI:
1070 psi_stop_60sec(TRUE);
1071 psi_stop_30sec(TRUE);
1072 psc_db->acq_type =COMPLETE;
1073 sig_psi_ctrl_read_si( COMPLETE_SI);
1074 psi_start_10sec();
1075 sig_psi_ctrl_meas_param_valid_si13( FALSE );
1076 TRACE_EVENT ("PSI 13 with complete SI");
1077 //psi_initiate_read_complete_si( );
1078 //sig_psi_ctrl_meas_param_valid_si13( FALSE );
1079 break;
1080 case PSI13_COMPLETE_PSI:
1081 SET_STATE( PSI, PSI_IDLE );
1082 psi_initiate_read_complete_psi( INIT_NEEDED );
1083 break;
1084 case PSI13_PBCCH_RELEASED:
1085 SET_STATE( PSI, PSI_NULL );
1086 psi_initiate_pbcch_switching( PSI_DC_PBCCH_RELEASED );
1087 break;
1088 case PSI13_PBCCH_ESTABLISHED:
1089 SET_STATE( PSI, PSI_NULL );
1090 psi_initiate_pbcch_switching( PSI_DC_PBCCH_ESTABLISHED );
1091 break;
1092 default:
1093 TRACE_ERROR("SIG_GFP_PSI_13_PTM: unexpected return value of type T_PSI13_RET");
1094 break;
1095 }
1096 break;
1097 default:
1098 TRACE_ERROR( "SIG_GFP_PSI_13_PTM unexpected" );
1099 break;
1100 }
1101 } /* sig_gfp_psi_13_ptm() */
1102
1103
1104
1105 /*
1106 +------------------------------------------------------------------------------
1107 | Function : sig_gfp_psi_1
1108 +------------------------------------------------------------------------------
1109 | Description : Handles
1110 |
1111 | Parameters :
1112 |
1113 +------------------------------------------------------------------------------
1114 */
1115 GLOBAL void sig_gfp_psi_1 ( void )
1116 {
1117 MCAST(psi1, PSI_1);
1118
1119 ACQ_TYPE old_acq_type = psc_db->acq_type;
1120 T_DB_MODE old_db_mode = grr_get_db_mode( );
1121
1122 TRACE_ISIG( "sig_gfp_psi_1" );
1123
1124 switch(psc_db->acq_type)
1125 {
1126 case FULL_PSI_IN_NEW_CELL:
1127 if( old_db_mode NEQ DB_MODE_CC_REQ )
1128 {
1129 grr_set_db_ptr( DB_MODE_SWAP );
1130 }
1131 break;
1132 }
1133
1134 switch( GET_STATE( PSI ) )
1135 {
1136 case PSI_IDLE:
1137 /*
1138 * Handle 60, 30, 10 sec. timer within psi_handle_psi1
1139 */
1140 grr_data->psi.is_start_of_10_sec_allowed = FALSE;
1141 psi_handle_psi1(psi1);
1142 break;
1143 case PSI_TRANSFER:
1144 /*
1145 * Handle 60, 30, 10 sec. timer within psi_handle_psi1
1146 */
1147 grr_data->psi.is_start_of_10_sec_allowed = TRUE;
1148 {
1149 UBYTE pb, ab_type;
1150
1151 pb = psc_db->g_pwr_par.pb;
1152 ab_type = psc_db->gprs_cell_opt.ab_type;
1153
1154 psi_handle_psi1(psi1);
1155
1156 if(
1157 (ab_type NEQ psc_db->gprs_cell_opt.ab_type)
1158 OR
1159 (pb NEQ psc_db->g_pwr_par.pb)
1160 )
1161 {
1162 /*
1163 * update PACCH parameters
1164 */
1165 grr_update_pacch();
1166 }
1167 }
1168 break;
1169 default:
1170 TRACE_ERROR( "SIG_GFP_PSI_1 unexpected" );
1171 break;
1172 }
1173 switch(old_acq_type)
1174 {
1175 case FULL_PSI_IN_NEW_CELL:
1176 if( old_db_mode NEQ DB_MODE_CC_REQ )
1177 {
1178 grr_set_db_ptr( DB_MODE_SWAP );
1179 }
1180 break;
1181 default:
1182 break;
1183 }
1184
1185 } /* sig_gfp_psi_1() */
1186
1187 /*
1188 +------------------------------------------------------------------------------
1189 | Function : sig_gfp_psi_2
1190 +------------------------------------------------------------------------------
1191 | Description : Handles
1192 |
1193 | Parameters : UBYTE received_in: relative position to B0
1194 |
1195 +------------------------------------------------------------------------------
1196 */
1197 GLOBAL void sig_gfp_psi_2 (UBYTE rel_pos_i)
1198 {
1199 MCAST (psi2, PSI_2);
1200
1201 ACQ_TYPE old_acq_type = psc_db->acq_type;
1202 T_DB_MODE old_db_mode = grr_get_db_mode( );
1203
1204 TRACE_ISIG( "sig_gfp_psi_2" );
1205
1206 psi_store_rel_pos(grr_data->psi.psi2_pos, rel_pos_i, MAX_NR_OF_INSTANCES_OF_PSI2); /*MODIF*/
1207
1208 switch(psc_db->acq_type)
1209 {
1210 case NONE:
1211 case PERIODICAL_PSI1_READING:
1212 /*
1213 * PSI2 was not requested
1214 */
1215
1216 #ifdef _SIMULATION_
1217 TRACE_ERROR("PSI2 not requested!");
1218 #endif /* #ifdef _SIMULATION_ */
1219 return;
1220 case FULL_PSI_IN_NEW_CELL:
1221 if( old_db_mode NEQ DB_MODE_CC_REQ )
1222 {
1223 grr_set_db_ptr( DB_MODE_SWAP );
1224 }
1225 break;
1226 }
1227
1228 switch( GET_STATE( PSI ) )
1229 {
1230 case PSI_IDLE:
1231 case PSI_TRANSFER: /* In case of acq on PBCCH, if we are in transfer mode*/
1232 psi_handle_psi2(psi2);
1233 break;
1234 default:
1235 TRACE_ERROR( "SIG_GFP_PSI_2 unexpected" );
1236 break;
1237 }
1238
1239 switch(old_acq_type)
1240 {
1241 case FULL_PSI_IN_NEW_CELL:
1242 if( old_db_mode NEQ DB_MODE_CC_REQ )
1243 {
1244 grr_set_db_ptr( DB_MODE_SWAP );
1245 }
1246 break;
1247 default:
1248 break;
1249 }
1250
1251 } /* sig_gfp_psi_2() */
1252
1253 /*
1254 +------------------------------------------------------------------------------
1255 | Function : sig_gfp_psi_3
1256 +------------------------------------------------------------------------------
1257 | Description : Handles
1258 |
1259 | Parameters : UBYTE received_in: relative position to B0
1260 |
1261 +------------------------------------------------------------------------------
1262 */
1263 GLOBAL void sig_gfp_psi_3 (UBYTE rel_pos_i)
1264 {
1265 MCAST (psi3, PSI_3);
1266
1267 ACQ_TYPE old_acq_type = psc_db->acq_type;
1268 T_DB_MODE old_db_mode = grr_get_db_mode( );
1269
1270 TRACE_ISIG( "sig_gfp_psi_3" );
1271 #if defined (REL99) AND defined (TI_PS_FF_EMR)
1272 psi_store_rel_pos(grr_data->psi.psi3_set_pos,
1273 rel_pos_i,
1274 MAX_NR_OF_INSTANCES_OF_PSI3TER+
1275 MAX_NR_OF_INSTANCES_OF_PSI3BIS+MAX_NR_OF_INSTANCES_OF_PSI3); /*MODIF*/
1276 #else
1277 psi_store_rel_pos(grr_data->psi.psi3bis_pos,
1278 rel_pos_i,
1279 MAX_NR_OF_INSTANCES_OF_PSI3BIS+MAX_NR_OF_INSTANCES_OF_PSI3); /*MODIF*/
1280 #endif
1281
1282 switch(psc_db->acq_type)
1283 {
1284 case NONE:
1285 case PERIODICAL_PSI1_READING:
1286 /*
1287 * PSI3 was not requested
1288 */
1289 #ifdef _SIMULATION_
1290 TRACE_ERROR("PSI3 not requested!");
1291 #endif /* #ifdef _SIMULATION_ */
1292 return;
1293 case FULL_PSI_IN_NEW_CELL:
1294 if( old_db_mode NEQ DB_MODE_CC_REQ )
1295 {
1296 grr_set_db_ptr( DB_MODE_SWAP );
1297 }
1298 break;
1299 }
1300
1301 switch( GET_STATE( PSI ) )
1302 {
1303 case PSI_IDLE:
1304 case PSI_TRANSFER: /* In case of acq on PBCCH, if we are in transfer mode*/
1305 psi_handle_psi3(psi3);
1306 break;
1307 default:
1308 TRACE_ERROR( "SIG_GFP_PSI_3 unexpected" );
1309 break;
1310 }
1311
1312 switch(old_acq_type)
1313 {
1314 case FULL_PSI_IN_NEW_CELL:
1315 if( old_db_mode NEQ DB_MODE_CC_REQ )
1316 {
1317 grr_set_db_ptr( DB_MODE_SWAP );
1318 }
1319 break;
1320 default:
1321 break;
1322 }
1323
1324 } /* sig_gfp_psi_3() */
1325
1326 /*
1327 +------------------------------------------------------------------------------
1328 | Function : sig_gfp_psi_3_bis
1329 +------------------------------------------------------------------------------
1330 | Description : Handles
1331 |
1332 | Parameters : UBYTE received_in: relative position to B0
1333 |
1334 +------------------------------------------------------------------------------
1335 */
1336 GLOBAL void sig_gfp_psi_3_bis (UBYTE rel_pos_i)
1337 {
1338 MCAST(psi3bis, PSI_3_BIS);
1339
1340 ACQ_TYPE old_acq_type = psc_db->acq_type;
1341 T_DB_MODE old_db_mode = grr_get_db_mode( );
1342
1343 TRACE_ISIG( "sig_gfp_psi_3_bis" );
1344 #if defined (REL99) AND defined (TI_PS_FF_EMR)
1345 psi_store_rel_pos(grr_data->psi.psi3_set_pos,
1346 rel_pos_i,
1347 MAX_NR_OF_INSTANCES_OF_PSI3TER+
1348 MAX_NR_OF_INSTANCES_OF_PSI3BIS+MAX_NR_OF_INSTANCES_OF_PSI3); /*MODIF*/
1349 #else
1350 psi_store_rel_pos(grr_data->psi.psi3bis_pos,
1351 rel_pos_i,
1352 MAX_NR_OF_INSTANCES_OF_PSI3BIS+MAX_NR_OF_INSTANCES_OF_PSI3); /*MODIF*/
1353 #endif
1354
1355 switch(psc_db->acq_type)
1356 {
1357 case NONE:
1358 case PERIODICAL_PSI1_READING:
1359 /*
1360 * PSI3BIS was not requested
1361 */
1362 #ifdef _SIMULATION_
1363 TRACE_ERROR("PSI3BIS not requested!");
1364 #endif /* #ifdef _SIMULATION_ */
1365 return;
1366 case FULL_PSI_IN_NEW_CELL:
1367 if( old_db_mode NEQ DB_MODE_CC_REQ )
1368 {
1369 grr_set_db_ptr( DB_MODE_SWAP );
1370 }
1371 break;
1372 }
1373
1374 switch( GET_STATE( PSI ) )
1375 {
1376 case PSI_IDLE:
1377 case PSI_TRANSFER: /* In case of acq on PBCCH, if we are in transfer mode*/
1378 psi_handle_psi3bis(psi3bis);
1379 break;
1380 default:
1381 TRACE_ERROR( "SIG_GFP_PSI_3_BIS unexpected" );
1382 break;
1383 }
1384
1385 switch(old_acq_type)
1386 {
1387 case FULL_PSI_IN_NEW_CELL:
1388 if( old_db_mode NEQ DB_MODE_CC_REQ )
1389 {
1390 grr_set_db_ptr( DB_MODE_SWAP );
1391 }
1392 break;
1393 default:
1394 break;
1395 }
1396
1397 } /* sig_gfp_psi_3_bis() */
1398
1399
1400 #if defined (REL99) AND defined (TI_PS_FF_EMR)
1401 /*
1402 +------------------------------------------------------------------------------
1403 | Function : sig_gfp_psi_3_ter
1404 +------------------------------------------------------------------------------
1405 | Description : Handles the internal signal SIG_GFP_PSI_3_TER
1406 |
1407 | Parameters : UBYTE received_in: relative position to B0
1408 |
1409 +------------------------------------------------------------------------------
1410 */
1411 GLOBAL void sig_gfp_psi_3_ter (UBYTE rel_pos_i)
1412 {
1413 MCAST(psi3ter, PSI_3_TER);
1414
1415 ACQ_TYPE old_acq_type = psc_db->acq_type;
1416 T_DB_MODE old_db_mode = grr_get_db_mode( );
1417
1418 TRACE_ISIG( "sig_gfp_psi_3_ter" );
1419
1420 psi_store_rel_pos(grr_data->psi.psi3_set_pos,
1421 rel_pos_i,
1422 MAX_NR_OF_INSTANCES_OF_PSI3TER+MAX_NR_OF_INSTANCES_OF_PSI3BIS
1423 +MAX_NR_OF_INSTANCES_OF_PSI3);
1424
1425 switch(psc_db->acq_type)
1426 {
1427 case NONE:
1428 case PERIODICAL_PSI1_READING:
1429 /*
1430 * PSI3TER was not requested
1431 */
1432 #ifdef _SIMULATION_
1433 TRACE_ERROR("PSI3TER not requested!");
1434 #endif /* #ifdef _SIMULATION_ */
1435 return;
1436 case FULL_PSI_IN_NEW_CELL:
1437 if( old_db_mode NEQ DB_MODE_CC_REQ )
1438 {
1439 grr_set_db_ptr( DB_MODE_SWAP );
1440 }
1441 break;
1442 }
1443
1444 switch( GET_STATE( PSI ) )
1445 {
1446 case PSI_IDLE:
1447 case PSI_TRANSFER: /* In case of acq on PBCCH, if we are in transfer mode*/
1448 psi_handle_psi3ter(psi3ter);
1449 break;
1450 default:
1451 TRACE_ERROR( "SIG_GFP_PSI_3_TER unexpected" );
1452 break;
1453 }
1454
1455 switch(old_acq_type)
1456 {
1457 case FULL_PSI_IN_NEW_CELL:
1458 if( old_db_mode NEQ DB_MODE_CC_REQ )
1459 {
1460 grr_set_db_ptr( DB_MODE_SWAP );
1461 }
1462 break;
1463 default:
1464 break;
1465 }
1466
1467 } /* sig_gfp_psi_3_ter() */
1468 #endif
1469
1470 /*
1471 +------------------------------------------------------------------------------
1472 | Function : sig_gfp_psi_4
1473 +------------------------------------------------------------------------------
1474 | Description : Handles
1475 |
1476 | Parameters : UBYTE received_in: relative position to B0
1477 |
1478 +------------------------------------------------------------------------------
1479 */
1480 GLOBAL void sig_gfp_psi_4 ( UBYTE rel_pos_i)
1481 {
1482 MCAST(psi4, PSI_4);
1483
1484 ACQ_TYPE old_acq_type = psc_db->acq_type;
1485 T_DB_MODE old_db_mode = grr_get_db_mode( );
1486
1487 TRACE_ISIG( "sig_gfp_psi_4" );
1488
1489 psi_store_rel_pos(grr_data->psi.psi4_pos, rel_pos_i, MAX_NR_OF_INSTANCES_OF_PSI4);
1490
1491 switch(psc_db->acq_type)
1492 {
1493 case NONE:
1494 case PERIODICAL_PSI1_READING:
1495 /*
1496 * PSI4 was not requested
1497 */
1498 #ifdef _SIMULATION_
1499 TRACE_ERROR("PSI4 not requested!");
1500 #endif /* #ifdef _SIMULATION_ */
1501 return;
1502 case FULL_PSI_IN_NEW_CELL:
1503 if( old_db_mode NEQ DB_MODE_CC_REQ )
1504 {
1505 grr_set_db_ptr( DB_MODE_SWAP );
1506 }
1507 break;
1508 }
1509
1510 switch( GET_STATE( PSI ) )
1511 {
1512 case PSI_IDLE:
1513 case PSI_TRANSFER: /* In case of acq on PBCCH, if we are in transfer mode*/
1514 psi_handle_psi4(psi4);
1515 break;
1516 default:
1517 TRACE_ERROR( "SIG_GFP_PSI_4 unexpected" );
1518 break;
1519 }
1520
1521 switch(old_acq_type)
1522 {
1523 case FULL_PSI_IN_NEW_CELL:
1524 if( old_db_mode NEQ DB_MODE_CC_REQ )
1525 {
1526 grr_set_db_ptr( DB_MODE_SWAP );
1527 }
1528 break;
1529 default:
1530 break;
1531 }
1532 } /* sig_gfp_psi_4() */
1533
1534 /*
1535 +------------------------------------------------------------------------------
1536 | Function : sig_gfp_psi_5
1537 +------------------------------------------------------------------------------
1538 | Description : Handles
1539 |
1540 | Parameters : UBYTE received_in: relative position to B0
1541 |
1542 +------------------------------------------------------------------------------
1543 */
1544 GLOBAL void sig_gfp_psi_5 ( UBYTE rel_pos_i)
1545 {
1546 MCAST(psi5, PSI_5);
1547
1548 ACQ_TYPE old_acq_type = psc_db->acq_type;
1549 T_DB_MODE old_db_mode = grr_get_db_mode( );
1550
1551 TRACE_ISIG( "sig_gfp_psi_5" );
1552
1553 psi_store_rel_pos(grr_data->psi.psi5_pos, rel_pos_i, MAX_NR_OF_INSTANCES_OF_PSI5); /*MODIF*/
1554
1555 switch(psc_db->acq_type)
1556 {
1557 case NONE:
1558 case PERIODICAL_PSI1_READING:
1559 /*
1560 * PSI5 was not requested
1561 */
1562 #ifdef _SIMULATION_
1563 TRACE_ERROR("PSI5 not requested!");
1564 #endif /* #ifdef _SIMULATION_ */
1565 return;
1566 case FULL_PSI_IN_NEW_CELL:
1567 if( old_db_mode NEQ DB_MODE_CC_REQ )
1568 {
1569 grr_set_db_ptr( DB_MODE_SWAP );
1570 }
1571 break;
1572 }
1573
1574 switch( GET_STATE( PSI ) )
1575 {
1576 case PSI_IDLE:
1577 case PSI_TRANSFER: /* In case of acq on PBCCH, if we are in transfer mode*/
1578 switch(psi_process_psi5(psi5))
1579 {
1580 case PSI5_REREAD:
1581 psi_reread_psi5();
1582 /*
1583 * NC measurement parameters and Extended Measurement Parameters are invalid.
1584 * We have to inform CS and MEAS-Service
1585 */
1586 sig_psi_ctrl_meas_param_invalid_psi5();
1587 break;
1588 case PSI5_MEAS_PARAM_VALID:
1589 sig_psi_ctrl_meas_param_valid_psi5();
1590
1591 /*lint -fallthrough*/
1592
1593 case PSI5_OK:
1594 /*
1595 * check the acquisition state: it is only for having a complete set of information
1596 */
1597 switch(psi_check_acq_state())
1598 {
1599 case ACQ_RUNNING:
1600 /*
1601 * Nothing to do
1602 */
1603 break;
1604 case ACQ_PART_OK:
1605 psi_stop_psi_reading(NONE);
1606 #ifdef _TARGET_
1607 TRACE_EVENT("PSI5->NEW_PCCCH");
1608 sig_psi_ctrl_new_pccch();
1609 #endif
1610 break;
1611 case ACQ_COMP_OK:
1612 case ACQ_NPSI_OK:
1613 psi_stop_psi_reading(NONE);
1614 /*
1615 * Access to the network is allowed
1616 */
1617 psi_send_access_enable_if_needed();
1618 break;
1619 default:
1620 TRACE_ERROR("Unexpected acq_ret in PSI5");
1621 break;
1622 }/*switch check_acq*/
1623 break;
1624 }
1625 break;
1626 default:
1627 TRACE_ERROR( "SIG_GFP_PSI_5 unexpected" );
1628 break;
1629 }
1630 switch(old_acq_type)
1631 {
1632 case FULL_PSI_IN_NEW_CELL:
1633 if( old_db_mode NEQ DB_MODE_CC_REQ )
1634 {
1635 grr_set_db_ptr( DB_MODE_SWAP );
1636 }
1637 break;
1638 default:
1639 break;
1640 }
1641 } /* sig_gfp_psi_5() */
1642
1643 #ifdef REL99
1644 /*
1645 +------------------------------------------------------------------------------
1646 | Function : sig_gfp_psi_8
1647 +------------------------------------------------------------------------------
1648 | Description : Handles PSI8 message received on PBCCH.
1649 |
1650 | Parameters : UBYTE received_in: relative position to B0
1651 |
1652 +------------------------------------------------------------------------------
1653 */
1654 GLOBAL void sig_gfp_psi_8 ( UBYTE rel_pos_i)
1655 {
1656 MCAST(psi8, PSI_8);
1657
1658 ACQ_TYPE old_acq_type = psc_db->acq_type;
1659 T_DB_MODE old_db_mode = grr_get_db_mode( );
1660
1661 TRACE_ISIG( "sig_gfp_psi_8" );
1662
1663 psi_store_rel_pos(grr_data->psi.psi8_pos, rel_pos_i, MAX_NR_OF_INSTANCES_OF_PSI8);
1664
1665 switch(psc_db->acq_type)
1666 {
1667 case NONE:
1668 case PERIODICAL_PSI1_READING:
1669 /*
1670 * PSI8 was not requested
1671 */
1672 #ifdef _SIMULATION_
1673 TRACE_ERROR("PSI8 not requested!");
1674 #endif /* #ifdef _SIMULATION_ */
1675 return;
1676 case FULL_PSI_IN_NEW_CELL:
1677 if( old_db_mode NEQ DB_MODE_CC_REQ )
1678 {
1679 grr_set_db_ptr( DB_MODE_SWAP );
1680 }
1681 break;
1682 }
1683
1684 switch( GET_STATE( PSI ) )
1685 {
1686 case PSI_IDLE:
1687 case PSI_TRANSFER: /* In case of acq on PBCCH, if we are in transfer mode*/
1688 psi_handle_psi8(psi8);
1689 break;
1690 default:
1691 TRACE_ERROR( "SIG_GFP_PSI_8 unexpected" );
1692 break;
1693 }
1694
1695 switch(old_acq_type)
1696 {
1697 case FULL_PSI_IN_NEW_CELL:
1698 if( old_db_mode NEQ DB_MODE_CC_REQ )
1699 {
1700 grr_set_db_ptr( DB_MODE_SWAP );
1701 }
1702 break;
1703 default:
1704 break;
1705 }
1706 } /* sig_gfp_psi_8() */
1707 #endif
1708
1709
1710 /*
1711 +------------------------------------------------------------------------------
1712 | Function : sig_gfp_psi_prach
1713 +------------------------------------------------------------------------------
1714 | Description : Handles
1715 |
1716 | Parameters : void
1717 |
1718 +------------------------------------------------------------------------------
1719 */
1720 GLOBAL void sig_gfp_psi_prach (void )
1721 {
1722 MCAST(prach, D_PRACH_PAR);
1723
1724 TRACE_ISIG( "sig_gfp_psi_prach" );
1725
1726 switch( GET_STATE( PSI ) )
1727 {
1728 case PSI_IDLE:
1729 psi_process_prach(&prach->prach_ctrl_par);
1730 if(psi_is_access_class_changed())
1731 {
1732 /*
1733 * Implies the CTRL to send CELL_IND
1734 */
1735 sig_psi_ctrl_access_changed();
1736 }
1737 break;
1738 default:
1739 TRACE_ERROR( "SIG_GFP_PSI_PRACH unexpected" );
1740 break;
1741 }
1742
1743 } /* sig_gfp_psi_prach() */
1744
1745
1746 /*
1747 +------------------------------------------------------------------------------
1748 | Function : sig_gfp_psi_scell_pbcch_stop_con
1749 +------------------------------------------------------------------------------
1750 | Description : Handles the internal signal SIG_GFP_PSI_SCELL_PBCCH_STOP_CON
1751 |
1752 | Parameters : T_MPHP_SCELL_PBCCH_STOP_CON *mphp_scell_pbcch_stop_con
1753 |
1754 +------------------------------------------------------------------------------
1755 */
1756 GLOBAL void sig_gfp_psi_scell_pbcch_stop_con ( T_MPHP_SCELL_PBCCH_STOP_CON *mphp_scell_pbcch_stop_con)
1757 {
1758 TRACE_ISIG( "sig_gfp_psi_scell_pbcch_stop_con" );
1759
1760 } /* sig_gfp_psi_scell_pbcch_stop_con() */
1761
1762 /*
1763 +------------------------------------------------------------------------------
1764 | Function : sig_gfp_psi_ncell_pbcch_ind
1765 +------------------------------------------------------------------------------
1766 | Description : Handles the internal signal SIG_GFP_PSI_NCELL_PBCCH_IND
1767 |
1768 | Parameters : T_MPHP_NCELL_PBCCH_IND *mphp_ncell_pbcch_ind
1769 |
1770 +------------------------------------------------------------------------------
1771 */
1772 GLOBAL void sig_gfp_psi_ncell_pbcch_ind ( T_MPHP_NCELL_PBCCH_IND *mphp_ncell_pbcch_ind)
1773 {
1774 TRACE_ISIG( "sig_gfp_psi_ncell_pbcch_ind" );
1775 /* Not needed */
1776 PFREE(mphp_ncell_pbcch_ind);
1777 } /* sig_gfp_psi_ncell_pbcch_ind() */
1778
1779 /*
1780 +------------------------------------------------------------------------------
1781 | Function : sig_gfp_psi_save_persistence_level
1782 +------------------------------------------------------------------------------
1783 | Description : Handles
1784 |
1785 | Parameters : T_pers_lev *pers_lev
1786 |
1787 +------------------------------------------------------------------------------
1788 */
1789 GLOBAL void sig_gfp_psi_save_persistence_level( T_pers_lev *pers_lev )
1790 {
1791 TRACE_ISIG( "sig_gfp_psi_save_persistence_level" );
1792
1793 switch( GET_STATE( PSI ) )
1794 {
1795 case PSI_IDLE:
1796 case PSI_TRANSFER:
1797 case PSI_SUSPENDED:
1798 case PSI_BCCH_IDLE:
1799 case PSI_BCCH_TRANSFER:
1800 grr_save_persistence_level(pers_lev);
1801 break;
1802 default:
1803 TRACE_ERROR( "SIG_GFP_PSI_SAVE_PERSISTENCE_LEVEL unexpected" );
1804 break;
1805 }
1806
1807 } /* sig_gfp_psi_save_persistence_level() */
1808
1809 /*
1810 +------------------------------------------------------------------------------
1811 | Function : sig_ctrl_psi_access_disabled
1812 +------------------------------------------------------------------------------
1813 | Description : Handles the internal signal SIG_CTRL_PSI_ACCESS_DISABLED
1814 |
1815 | Parameters : void
1816 |
1817 +------------------------------------------------------------------------------
1818 */
1819 GLOBAL void sig_ctrl_psi_access_disabled ( T_PSI_DISABLE_CAUSE dc )
1820 {
1821 TRACE_ISIG( "sig_ctrl_psi_access_disabled" );
1822
1823 switch( dc )
1824 {
1825 case PSI_DC_OTHER:
1826 psc_db->acq_type = COMPLETE;
1827
1828 psi_start_10sec( );
1829 break;
1830
1831 case PSI_DC_READ_PSI:
1832 psi_complete_acq(COMPLETE);
1833 psi_start_10sec();
1834 break;
1835 }
1836 } /* sig_ctrl_psi_access_disabled() */