comparison src/g23m-gsm/alr3/alr_main.c @ 2:3a14ee9a9843

src/g23m-gsm: same alr2 & alr3 structure as in Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:29:12 +0000
parents src/g23m-gsm/alr/alr_main.c@fa8dc04885d8
children
comparison
equal deleted inserted replaced
1:fa8dc04885d8 2:3a14ee9a9843
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS
4 | Modul : ALR_MAIN
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 Modul defines the functions for the SDL process
18 | Main_Control of the ALR functionality.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef ALR_MAIN_C
23 #define ALR_MAIN_C
24
25 #define ENTITY_PL
26
27 /*==== INCLUDES ===================================================*/
28 #include <string.h>
29 #include <stdlib.h>
30 #include <ctype.h>
31 #include "typedefs.h"
32 #include "message.h"
33 #include "ccdapi.h"
34 #include "vsi.h"
35 #include "custom.h"
36 #include "gsm.h"
37 #include "prim.h"
38 #include "cnf_alr.h"
39 #include "mon_alr.h"
40 #include "pei.h"
41 #include "tok.h"
42 #include "pcm.h"
43
44 #ifdef GPRS
45 #include "alr_gprs.h"
46 #endif
47
48 #if defined (WIN32)
49 #define TRACING
50 #else
51 /* #define TRACING */
52 /* #define DL_TRACE_ENABLED */
53 #endif
54
55 #include "alr.h"
56 #include "alr_em.h"
57
58 #if defined (TRACING)
59 #define ALR_TRACE_MAIN(a) ALR_TRACE(a)
60 #else
61 #define ALR_TRACE_MAIN(a)
62 #endif
63
64 #if defined (TRACING)
65
66 #define ALR_TRACE_MAIN_BSIC_REQ(s) TRACE_EVENT_P1 ("bsic_req state %d",s)
67 #define ALR_TRACE_MAIN_RAND_ACC(s,m) TRACE_EVENT_P2 ("con est on for: %d %d times", s, m);
68 #define ALR_TRACE_MAIN_SCELL(o,s) TRACE_EVENT_P2 ("SC [%d]->[%d]", o, s)
69 #define ALR_TRACE_MAIN_VALID_BLOCK(m) TRACE_EVENT_P1 ("VALID BLOCK %d", m)
70 #define ALR_TRACE_MAIN_SI_UNEQ(c) TRACE_EVENT_P1 ("si uneq %d", c)
71 #define ALR_TRACE_MAIN_CR(m) TRACE_EVENT_P1 ("VALID BLOCK CR %d",m)
72 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
73 #define ALR_TRACE_MAIN_RACH(t) TRACE_EVENT_P1 ("powerclass txpwr %d", t)
74 #else
75 #define ALR_TRACE_MAIN_RACH(p,t) TRACE_EVENT_P2 ("powerclass gsm %d txpwr %d", p, t)
76 #endif
77 #define ALR_TRACE_MAIN_POWER_CNF { USHORT i; \
78 TRACE_EVENT_P1 ("power cnf: %d channels", mph_power_cnf->num_of_chan)\
79 for (i = 0; i < mph_power_cnf->num_of_chan; i++) { \
80 TRACE_EVENT_P2 ("rx_lev[%4d]= %d", \
81 mph_power_cnf->arfcn[i]&ARFCN_MASK, \
82 mph_power_cnf->rx_lev[i]);} }
83 #define ALR_TRACE_MAIN_RA_CNF(t1,t2,t3) TRACE_EVENT_P3 ("af: %d %d %d", t1,t2,t3)
84
85 #else /* TRACING */
86
87 #define ALR_TRACE_MAIN_BSIC_REQ(s)
88 #define ALR_TRACE_MAIN_RAND_ACC(s,m)
89 #define ALR_TRACE_MAIN_SCELL(o,s)
90 #define ALR_TRACE_MAIN_VALID_BLOCK(m)
91 #define ALR_TRACE_MAIN_SI_UNEQ(c)
92 #define ALR_TRACE_MAIN_CR(m)
93 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
94 #define ALR_TRACE_MAIN_RACH(t)
95 #else
96 #define ALR_TRACE_MAIN_RACH(p,t)
97 #endif
98 #define ALR_TRACE_MAIN_POWER_CNF
99 #define ALR_TRACE_MAIN_RA_CNF(t1,t2,t3)
100
101 #endif /* TRACING */
102
103 /*==== EXPORT =====================================================*/
104
105 /*==== PRIVAT =====================================================*/
106
107 /*==== VARIABLES ==================================================*/
108 LOCAL UBYTE from_dedicated = FALSE;
109
110 /*==== FUNCTIONS ==================================================*/
111
112 LOCAL BOOL ma_compare_dedi_sys_buffer (T_MPHC_DATA_IND *mphc_data_ind,
113 UBYTE msg_t);
114 LOCAL void ma_fill_dedi_sys_buffer (T_MPHC_DATA_IND *mphc_data_ind,
115 UBYTE msg_t);
116 LOCAL void ma_stop_rxlev_periodic_req (void);
117 LOCAL BOOL ma_compare_sys_buffer (T_MPHC_DATA_IND *mphc_data_ind,
118 UBYTE msg_t);
119 LOCAL void ma_send_dedi_unitdata (T_MPHC_DATA_IND *data_ind);
120 LOCAL void ma_sync_ind (UBYTE cause, USHORT arfcn);
121 LOCAL void ma_set_si_bitmap (UBYTE msg_t);
122 LOCAL void ma_fill_sys_buffer (T_MPHC_DATA_IND *data_ind, UBYTE msg_t);
123 LOCAL void ma_dedi_data_out (T_PH_DATA_IND *data_ind);
124 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
125 LOCAL void compare_l1_frequency_band_with_ffs (T_MPHC_INIT_L1_CON *init_l1_cnf);
126 #endif
127
128 /*
129 +--------------------------------------------------------------------+
130 | PROJECT : GSM-PS (6103) MODULE : ALR_CS |
131 | STATE : code ROUTINE : ma_init |
132 +--------------------------------------------------------------------+
133
134 PURPOSE : Initialize Main Control.
135
136 */
137
138 GLOBAL void ma_init (void)
139 {
140 GET_INSTANCE_DATA;
141 memset (alr_data, 0, sizeof (T_ALR_DATA));
142 alr_data->state[STATE_MA] = MA_NULL;
143
144 alr_data->mmi = 2; /* EVA 4 Board */
145 alr_data->keypad = 2; /* EVA 4 Board */
146 alr_data->ext_display = FALSE; /* internal display */
147 alr_data->pch_data.last_start_ccch_req.bs_pa_mfrms = NOT_PRESENT_8BIT;
148 ma_clean_sys_buffer (IND_ALL_SI);
149 ma_clean_dedi_sys_buffer ();
150 }
151
152 /*
153 +--------------------------------------------------------------------+
154 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
155 | STATE : code ROUTINE : ma_mph_idle_req |
156 +--------------------------------------------------------------------+
157
158 PURPOSE : Process the primitive MPH_IDLE_REQ.
159
160 */
161
162 UBYTE v_eotd = 0; /* for test automation */
163
164 GLOBAL void ma_mph_idle_req (T_MPH_IDLE_REQ* idle)
165 {
166 GET_INSTANCE_DATA;
167 if(idle->mod EQ MODE_CELL_SELECTION)
168 {
169 alr_data->nc_data.eotd_avail = idle->eotd_avail | v_eotd;
170 #if defined (REL99) && defined (TI_PS_FF_EMR)
171 if(idle->si2quater_status EQ SI2QUATER_CONFIGURE)
172 {
173 alr_data->nc_data.si2quater_status = SI2QUATER_CONFIGURE;
174 alr_data->nc_data.si2quater_pos = idle->si2quater_pos;
175 }
176 else if(idle->si2quater_status EQ SI2QUATER_ABSENT )
177 {
178 alr_data->nc_data.si2quater_status = SI2QUATER_ABSENT;
179 }
180 alr_data->nc_data.si2_count = NOT_PRESENT_8BIT;
181 #endif
182 }
183
184 switch (GET_STATE (STATE_MA))
185 {
186 case MA_DEDICATED:
187 ALR_TRACE_MAIN ("leave dedi");
188 ma_stop_active_procs(DONT_STOP_PCH_READING);
189 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
190 nc_new_serving_cell (idle->arfcn);
191
192 switch(idle->mod)
193 {
194 case MODE_CELL_RESELECTION:
195 ALR_TRACE_MAIN ("CR");
196 trc_state_transition(__LINE__, MA_CELL_RESELECTION);
197 SET_STATE (STATE_MA, MA_CELL_RESELECTION);
198 #ifdef GPRS
199 /*
200 * if going to a PBCCH cell we have to update the
201 * ncell states with GRR
202 */
203 gprs_alr_init();
204 alr_data->nc_sync_with_grr = TRUE;
205 #endif
206 from_dedicated = TRUE;
207 rach_init ();
208 rach_configure_power (idle->power);
209 pch_configure (idle, PGM_REORG);
210 pch_save_pgm(PGM_REORG_CS); /* reset saved pgm to REORG_CS */
211 nc_suspend (); /* to set the nc state */
212 nc_start_reselect (idle->arfcn);
213 break;
214 case MODE_CELL_SELECTION:
215 ALR_TRACE_MAIN ("CS");
216 if (idle->arfcn NEQ alr_data->old_serving_cell)
217 {
218 ALR_TRACE_MAIN ("CS but different cell!!!");
219 }
220 trc_state_transition(__LINE__, MA_IDLE);
221 SET_STATE(STATE_MA, MA_IDLE);
222 nc_suspend(); /* stop dedicated mode activity */
223 nc_add_offset();
224 #ifdef GPRS
225 set_gprs_support(idle->gprs_support);
226 #endif
227 pch_configure (idle, SAVED_PGM);
228 pch_start_ccch_req();
229 cb_start();
230
231 nc_start_monitoring();
232 break;
233 #ifdef GPRS
234 case MODE_CONFIG_PL: /* Cell has PBCCH */
235 ma_stop_active_procs(STOP_PCH_READING);
236 nc_suspend(); /* stop dedicated mode activity */
237 gprs_alr_init();
238 set_gprs_support(idle->gprs_support);
239 alr_data->nc_sync_with_grr = TRUE;
240 alr_data->gprs_data.pbcch = TRUE;
241 nc_add_offset(); /* convert counters */
242
243
244 rach_init ();
245 rach_configure_power (idle->power);
246 pch_configure (idle, PGM_NORMAL);
247 alr_data->nc_sync_with_grr = TRUE;
248 SET_STATE(STATE_MA, MA_IDLE);
249 break;
250 #endif
251 default:
252 break;
253 }
254 break;
255 case MA_CON_EST:
256 #ifdef GPRS
257 if(idle->mod EQ MODE_PACKET_TRANSFER) /* transition to PTM */
258 { /*
259 * NC BCCH reading doesn't need to be stopped, because it has
260 * already been stopped when entering MA_CON_EST
261 */
262 ma_stop_active_procs(STOP_PCH_READING);
263 SET_STATE (STATE_MA, MA_PTM);
264 }
265 else
266 {
267 #endif /* GPRS */
268 ma_stop_active_procs(DONT_STOP_PCH_READING);
269 rach_configure_power (idle->power);
270 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
271 nc_new_serving_cell (idle->arfcn);
272 #ifdef GPRS
273 if(idle->mod EQ MODE_CONFIG_PL)
274 {
275 ma_stop_active_procs(STOP_PCH_READING);
276 gprs_alr_init();
277 set_gprs_support(idle->gprs_support);
278 alr_data->gprs_data.pbcch = TRUE;
279 alr_data->nc_sync_with_grr = TRUE;
280 rach_init ();
281 rach_configure_power (idle->power);
282 pch_configure (idle, PGM_NORMAL);
283 SET_STATE(STATE_MA, MA_IDLE);
284 }
285 else
286 {
287 #endif
288 if (idle->arfcn EQ alr_data->old_serving_cell)
289 {
290 /* coming back after RACH failure */
291 trc_state_transition(__LINE__, MA_IDLE);
292 SET_STATE (STATE_MA, MA_IDLE);
293 #ifdef GPRS
294 set_gprs_support(idle->gprs_support);
295 #endif
296 pch_configure (idle, SAVED_PGM);
297 pch_start_ccch_req();
298 cb_start();
299 nc_start_monitoring();
300 }
301 else
302 {
303 trc_state_transition(__LINE__, MA_CELL_RESELECTION);
304 SET_STATE (STATE_MA, MA_CELL_RESELECTION);
305 #ifdef GPRS
306 /*
307 * if going to a PBCCH cell we have to update the
308 * ncell states with GRR
309 */
310 gprs_alr_init();
311 alr_data->nc_sync_with_grr = TRUE;
312
313 #endif
314 pch_configure (idle, PGM_REORG);
315 pch_save_pgm(PGM_REORG_CS); /* reset saved pgm to REORG_CS */
316 nc_start_reselect (idle->arfcn);
317 }
318 #ifdef GPRS
319 }
320 }
321 #endif
322 break;
323 case MA_CELL_SELECTION:
324 TRACE_EVENT_P1 ("SC[%u] in use, leave CS", idle->arfcn);
325
326 #ifdef GPRS
327 if(idle->mod EQ MODE_CONFIG_PL)
328 {
329 ma_stop_active_procs(STOP_PCH_READING);
330 gprs_alr_init();
331 set_gprs_support(idle->gprs_support);
332 alr_data->gprs_data.pbcch = TRUE;
333 alr_data->nc_sync_with_grr = TRUE;
334 rach_init ();
335 rach_configure_power (idle->power);
336 nc_new_serving_cell (idle->arfcn);
337 pch_configure (idle, PGM_NORMAL);
338 SET_STATE(STATE_MA, MA_IDLE);
339 break;
340 }
341 #endif
342
343 ALR_EM_CONFIGURE_IDLE_MODE;
344
345 ma_stop_active_procs(DONT_STOP_PCH_READING);
346
347 trc_state_transition(__LINE__, MA_IDLE);
348 SET_STATE (STATE_MA, MA_IDLE);
349 #ifdef GPRS
350 alr_data->nc_sync_with_grr=FALSE;
351 set_gprs_support(idle->gprs_support);
352 #endif
353 rach_configure_power (idle->power);
354 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
355 nc_check_new_ncc_permitted (idle->ncc_permitted);
356 nc_new_serving_cell (idle->arfcn);
357 pch_configure (idle, PGM_REORG_CS);
358 pch_save_pgm(0); /* reset saved pgm to REORG_CS */
359 pch_start_ccch_req();
360 /*
361 * nc_start_monitoring will be called when ncell list from RR
362 * is received
363 */
364 break;
365
366 case MA_IDLE:
367 switch (idle->mod)
368 {
369 #ifdef GPRS
370 case MODE_PACKET_TRANSFER: /* transition to PTM */
371 /*NC BCCH reading will be stopped when leaving idle*/
372 ma_stop_active_procs(STOP_PCH_READING | STOP_MEASUREMENTS);
373 SET_STATE (STATE_MA, MA_PTM);
374 break;
375 case MODE_CONFIG_PL:
376 ma_stop_active_procs(STOP_PCH_READING|STOP_MEASUREMENTS);
377 gprs_alr_init();
378 set_gprs_support(idle->gprs_support);
379 /* PBCCH activated in cell */
380 alr_data->nc_sync_with_grr = TRUE;
381 alr_data->gprs_data.pbcch = TRUE;
382 rach_init ();
383 rach_configure_power (idle->power);
384 pch_configure (idle, PGM_NORMAL);
385 SET_STATE(STATE_MA, MA_IDLE);
386 break;
387 #endif /* GPRS */
388
389 case MODE_CELL_RESELECTION:
390 ALR_TRACE_MAIN ("idle mode cr");
391
392 ma_stop_active_procs(STOP_PCH_READING | STOP_MEASUREMENTS);
393
394 trc_state_transition(__LINE__, MA_CELL_RESELECTION);
395 SET_STATE (STATE_MA, MA_CELL_RESELECTION);
396 #ifdef GPRS
397 /*
398 * if going to a PBCCH cell we have to update the
399 * ncell states with GRR
400 */
401 gprs_alr_init();
402 alr_data->nc_sync_with_grr = TRUE;
403 #endif
404 rach_init ();
405 rach_configure_power (idle->power);
406 TRACE_EVENT("IDLE_REQ : Cell found after CR");
407 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
408 // nc_check_new_ncc_permitted(idle->ncc_permitted);
409 nc_new_serving_cell (idle->arfcn);
410 pch_configure (idle, PGM_REORG);
411 pch_save_pgm(PGM_REORG_CS); /* reset saved pgm to REORG_CS */
412 nc_start_reselect (idle->arfcn);
413 break;
414 #ifdef GPRS
415 case MODE_CELL_RESELECTION_SYNC_ONLY:
416 if(alr_data->gprs_data.pbcch)
417 {
418 alr_data->gprs_data.sync_only=1;
419 alr_data->gprs_data.ptm=0;
420 ma_stop_active_procs(STOP_PCH_READING);
421 trc_state_transition(__LINE__, MA_CELL_RESELECTION);
422 SET_STATE (STATE_MA, MA_CELL_RESELECTION);
423 nc_new_serving_cell (idle->arfcn);
424 nc_start_reselect (idle->arfcn);
425 }
426 break;
427 #endif
428 case MODE_SYS_INFO_CHANGE:
429 ALR_TRACE_MAIN ("idle mode sys info changed");
430 rach_init ();
431 rach_configure_power (idle->power);
432
433 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
434 nc_check_new_ncc_permitted (idle->ncc_permitted);
435
436 if((idle->tn/2) NEQ
437 (alr_data->pch_data.pl_idle.ccch_group)
438 #ifdef GPRS
439 OR alr_data->gprs_data.pbcch
440 #endif
441 )
442 {
443 /* stop CCCH reading beforehand */
444 ma_stop_active_procs(STOP_PCH_READING | STOP_MEASUREMENTS);
445 #ifdef GPRS
446 gprs_alr_init();
447 set_gprs_support(idle->gprs_support);
448 #endif
449 pch_configure (idle, PGM_REORG_CS);
450 pch_save_pgm(PGM_REORG_CS); /* reset saved pgm to REORG_CS */
451 pch_start_ccch_req();
452
453 nc_start_monitoring ();
454 }
455 else
456 {
457 #ifdef GPRS
458 if(idle->reorg_only EQ NORMAL_PGM AND
459 alr_data->gprs_data.ign_pgm EQ TRUE)
460 {
461 /*
462 * use last page mode read on PCH
463 * when the NON_DRX_TIMER has expired
464 */
465 pch_configure (idle, SAVED_PGM);
466 pch_start_ccch_req();
467 alr_data->gprs_data.ign_pgm = FALSE;
468 }
469 else if(alr_data->gprs_data.ign_pgm EQ FALSE)
470 {
471 set_gprs_support(idle->gprs_support);
472 if(gprs_alr_is_supported())
473 {
474 gprs_alr_init();
475 set_gprs_support(idle->gprs_support);
476 ma_stop_scell_bcch_req();
477 }
478 #endif
479 pch_save_pgm(0); /* save current pgm */
480 pch_configure (idle, SAVED_PGM);
481 pch_start_ccch_req();
482 #ifdef GPRS
483 }
484 /* other case should not happen */
485 #endif
486
487 }
488 break;
489 case MODE_CELL_SELECTION:
490 /* XXX does not seem to be used by RR*/
491 break;
492 default:
493 break;
494 }
495 break;
496 case MA_CELL_RESELECTION:
497 switch(idle->mod)
498 {
499 case MODE_CELL_SELECTION:
500
501 ALR_TRACE_MAIN ("from cr use cell");
502 /* we have found a suitable cell */
503 ma_stop_active_procs(DONT_STOP_PCH_READING);
504 rach_init ();
505 rach_configure_power (idle->power);
506 TRACE_EVENT("IDLE_REQ : PM config after CR");
507 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
508 nc_check_new_ncc_permitted (idle->ncc_permitted);
509 if (from_dedicated)
510 {
511 from_dedicated = FALSE;
512 nc_add_offset ();
513 }
514 pch_configure (idle, SAVED_PGM);
515
516 /* For OMAPS#90692 - Move to MA_IDLE before configuring
517 * the serving cell BCCH request, so as not to reset the
518 * si_bitmap again
519 */
520 trc_state_transition(__LINE__, MA_IDLE);
521 SET_STATE (STATE_MA, MA_IDLE);
522 pch_start_ccch_req();
523 #ifdef GPRS
524 alr_data->nc_sync_with_grr=FALSE;
525 set_gprs_support(idle->gprs_support);
526 #endif
527
528 /*
529 * resume neighbourcell operation
530 */
531 nc_start_monitoring ();
532 break;
533 case MODE_CELL_RESELECTION:
534 /* the last cell wasn't the right one, try again */
535 ma_stop_active_procs(STOP_PCH_READING);/* don´t forget to stop all processes */
536 #ifdef GPRS
537 gprs_alr_init();
538 #endif
539 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
540 // nc_check_new_ncc_permitted (idle->ncc_permitted);
541 nc_new_serving_cell (idle->arfcn);
542 pch_configure (idle, PGM_REORG);
543 pch_save_pgm(PGM_REORG_CS); /* reset saved pgm to REORG_CS */
544 nc_start_reselect (idle->arfcn);
545 break;
546 #ifdef GPRS
547 case MODE_CONFIG_PL:
548 ma_stop_active_procs(STOP_PCH_READING);
549 if (from_dedicated) from_dedicated = FALSE;
550
551 gprs_alr_init();
552 set_gprs_support(idle->gprs_support);
553 alr_data->gprs_data.pbcch = TRUE;
554 alr_data->nc_sync_with_grr = TRUE;
555 rach_init ();
556 rach_configure_power (idle->power);
557 pch_configure (idle, PGM_NORMAL);
558 SET_STATE(STATE_MA, MA_IDLE);
559 break;
560 #endif
561 default:
562 break;
563 }
564 break;
565 #ifdef GPRS
566 case MA_PTM:
567 /* back to packet idle */
568 ma_stop_active_procs(DONT_STOP_PCH_READING);
569 rach_configure_power (idle->power);
570 alr_data->bs_pa_mfrms = idle->bs_pa_mfrms;
571 nc_new_serving_cell (idle->arfcn);
572 nc_suspend();
573 if (idle->arfcn EQ alr_data->old_serving_cell)
574 {
575 trc_state_transition(__LINE__, MA_IDLE);
576 SET_STATE(STATE_MA, MA_IDLE);
577 #ifdef GPRS
578 set_gprs_support(idle->gprs_support);
579 #endif
580
581 if(idle->reorg_only EQ REORG_ONLY)
582 {
583 pch_configure (idle, PGM_REORG_CS);
584 alr_data->gprs_data.ign_pgm = TRUE;
585 }
586 else
587 {
588 pch_configure (idle, SAVED_PGM);
589 alr_data->gprs_data.ign_pgm = FALSE;
590 }
591 pch_start_ccch_req();
592 cb_start();
593 nc_start_monitoring();
594 }
595 else
596 {
597 trc_state_transition(__LINE__, MA_CELL_RESELECTION);
598 SET_STATE (STATE_MA, MA_CELL_RESELECTION);
599 #ifdef GPRS
600 /*
601 * if going to a PBCCH cell we have to update the
602 * ncell states with GRR
603 */
604 gprs_alr_init();
605 alr_data->nc_sync_with_grr = TRUE;
606 #endif
607 pch_configure (idle, PGM_REORG);
608 pch_save_pgm(PGM_REORG_CS); /* reset saved pgm to REORG_CS */
609 nc_start_reselect (idle->arfcn);
610 }
611 break;
612 #endif
613 default:
614 break;
615 }
616 PFREE (idle);
617 }
618
619
620 /*
621 +--------------------------------------------------------------------+
622 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
623 | STATE : code ROUTINE : ma_mph_neighbourcell_req |
624 +--------------------------------------------------------------------+
625
626 PURPOSE : Process the primitive MPH_NEIGHBOURCELL_REQ.
627
628 */
629
630 GLOBAL void ma_mph_neighbourcell_req (T_MPH_NEIGHBOURCELL_REQ* mph_neighbourcell_req)
631 {
632 GET_INSTANCE_DATA;
633
634 switch (GET_STATE (STATE_MA))
635 {
636 case MA_IDLE:
637 case MA_DEDICATED:
638 nc_ncell_list (mph_neighbourcell_req);
639
640 ALR_EM_CONFIGURE_NEIGHBOUERCELL_LIST;
641
642 break;
643 #ifdef GPRS
644 case MA_PTM:
645 /*In PTM just update the BA list. No need to start monitoring at L1 through MPHC*/
646 /*
647 * mix new list with old list
648 */
649 nc_update_ba_list (alr_data->serving_cell, mph_neighbourcell_req);
650 break;
651 #endif
652
653 default:
654 break;
655 }
656 PFREE (mph_neighbourcell_req);
657 }
658
659
660 /*
661 +--------------------------------------------------------------------+
662 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
663 | STATE : code ROUTINE : ma_mph_dedicated_req |
664 +--------------------------------------------------------------------+
665
666 PURPOSE : Process the primitive MPH_DEDICATED_REQ.
667
668 */
669
670 GLOBAL void ma_mph_dedicated_req (T_MPH_DEDICATED_REQ* dedi)
671 {
672 GET_INSTANCE_DATA;
673 switch (GET_STATE (STATE_MA))
674 {
675 case MA_CON_EST:
676 ALR_TRACE_MAIN ("dedi on");
677
678 ma_stop_active_procs (STOP_PCH_READING);
679 trc_state_transition(__LINE__, MA_DEDICATED);
680 SET_STATE (STATE_MA, MA_DEDICATED);
681 dedi_req (dedi);
682 ma_clean_dedi_sys_buffer ();
683 nc_start_dedicated (dedi->tr_para.pwrc, dedi->tr_para.dtx);
684 break;
685
686 case MA_DEDICATED:
687 dedi_req (dedi);
688 break;
689
690 default:
691 break;
692 }
693 PFREE (dedi);
694 }
695
696
697 /*
698 +--------------------------------------------------------------------+
699 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
700 | STATE : code ROUTINE : ma_mph_dedicated_fail_req |
701 +--------------------------------------------------------------------+
702
703 PURPOSE : Process the primitive MPH_DEDICATED_FAIL_REQ.
704
705 */
706
707 GLOBAL void ma_mph_dedicated_fail_req (T_MPH_DEDICATED_FAIL_REQ* mph_dedicated_fail_req)
708 {
709 dedi_fail_req ();
710 PFREE (mph_dedicated_fail_req);
711 }
712
713
714 /*
715 +--------------------------------------------------------------------+
716 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
717 | STATE : code ROUTINE : ma_mph_ciphering_req |
718 +--------------------------------------------------------------------+
719
720 PURPOSE : Process the primitive MPH_CIPHERING_REQ.
721
722 */
723
724 GLOBAL void ma_mph_ciphering_req (T_MPH_CIPHERING_REQ* mph_ciphering_req)
725 {
726 dedi_ciph_req (mph_ciphering_req);
727 PFREE(mph_ciphering_req);
728 }
729
730 /*
731 +--------------------------------------------------------------------+
732 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
733 | STATE : code ROUTINE : ma_mph_freq_redef_req |
734 +--------------------------------------------------------------------+
735
736 PURPOSE : Process the primitive MPH_FREQ_REDEF_REQ.
737
738 */
739
740 GLOBAL void ma_mph_freq_redef_req (T_MPH_FREQ_REDEF_REQ* mph_freq_redef_req)
741 {
742 dedi_freq_redef_req(mph_freq_redef_req);
743 PFREE(mph_freq_redef_req);
744 }
745
746 /*
747 +--------------------------------------------------------------------+
748 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
749 | STATE : code ROUTINE : ma_mph_channel_mode_req |
750 +--------------------------------------------------------------------+
751
752 PURPOSE : Process the primitive MPH_CHANNEL_MODE_REQ.
753
754 */
755
756 GLOBAL void ma_mph_channel_mode_req (T_MPH_CHANNEL_MODE_REQ* mph_channel_mode_req)
757 {
758 dedi_chan_mode_req (mph_channel_mode_req);
759 PFREE(mph_channel_mode_req);
760 }
761
762
763 /*
764 +--------------------------------------------------------------------+
765 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
766 | STATE : code ROUTINE : ma_mph_deactivate_req |
767 +--------------------------------------------------------------------+
768
769 PURPOSE : Process the primitive MPH_DEACTIVATE_REQ.
770
771 */
772
773 GLOBAL void ma_mph_deactivate_req (T_MPH_DEACTIVATE_REQ* mph_deactivate_req)
774 {
775 GET_INSTANCE_DATA;
776 UBYTE flags = 0;
777 PREUSE (mph_deactivate_req, mphc_deactivate_req, MPHC_DEACTIVATE_REQ);
778
779 if (alr_data->pch_data.last_start_ccch_req.bs_pa_mfrms NEQ NOT_PRESENT_8BIT)
780 flags |= STOP_PCH_READING;
781
782 switch (GET_STATE(STATE_MA))
783 {
784 case MA_CELL_SELECTION:
785 case MA_CELL_RESELECTION:
786 case MA_CON_EST:
787 case MA_DEDICATED:
788 #ifdef GPRS
789 case MA_PTM:
790 #endif
791 break;
792 case MA_IDLE:
793 #ifdef GPRS
794 if (alr_data->gprs_data.pbcch EQ TRUE)
795 break;
796 #endif
797 /*lint -fallthrough*/
798 default:
799 flags |= STOP_MEASUREMENTS;
800 break;
801 }
802
803 ma_stop_active_procs(flags);
804
805 ALR_EM_DEACTIVATE_L1;
806
807 /*
808 * There is no activation request for ALR. Therefore ALR is prepared
809 * here for the next powering on by stopping really all running processes
810 * and reinitialising the state variables.
811 */
812 nc_stop ();
813
814 cb_init ();
815 cs_init ();
816 pch_init ();
817 dedi_init ();
818 SET_STATE(STATE_MA, MA_NULL); /* it isn't clear whether the whole ma_init() should be performed */
819 ma_clean_sys_buffer (IND_ALL_SI);
820 ma_clean_dedi_sys_buffer ();
821
822 PSENDX(L1, mphc_deactivate_req);
823 }
824
825
826 /*
827 +--------------------------------------------------------------------+
828 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
829 | STATE : code ROUTINE : ma_mph_classmark_req |
830 +--------------------------------------------------------------------+
831
832 PURPOSE : Process the primitive MPH_CLASSMARK_REQ.
833
834 */
835
836 GLOBAL void ma_mph_classmark_req (T_MPH_CLASSMARK_REQ* classmark)
837 {
838 rach_configure_class (classmark->classmark.pclass,
839 classmark->classmark.pclass2);
840
841 ALR_EM_CONFIGURE_CLASSMARK;
842
843 PFREE (classmark);
844 }
845
846
847 /*
848 +--------------------------------------------------------------------+
849 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
850 | STATE : code ROUTINE : ma_mph_ext_meas_req |
851 +--------------------------------------------------------------------+
852
853 PURPOSE : Process the primitive MPH_EXT_MEAS_REQ.
854
855 */
856
857 GLOBAL void ma_mph_ext_meas_req (T_MPH_EXT_MEAS_REQ* mph_ext_meas_req)
858 {
859 GET_INSTANCE_DATA;
860 /* Process CS must be state CS_NULL (no Cell Selection active) */
861
862 if ( GET_STATE ( STATE_CS ) EQ CS_NULL )
863 {
864 mph_ext_meas_req->pch_interrupt = NO_PCH_INTERRUPT;
865
866 /* alr_data->cs_data.mph_ext_meas_req must be NULL */
867
868 if ( IS_EXT_MEAS_RUNNING ) /*alr_data->cs_data.mph_ext_meas_req NEQ NULL*/
869 {
870 PFREE ( alr_data->cs_data.mph_ext_meas_req );
871 }
872 alr_data->cs_data.mph_ext_meas_req = mph_ext_meas_req;
873 alr_data->cs_data.ext_meas_state_pend = CS_NULL;
874
875 ma_mph_power_req((T_MPH_POWER_REQ*) mph_ext_meas_req);
876 }
877 else
878 {
879 PALLOC ( mph_ext_meas_cnf, MPH_EXT_MEAS_CNF );
880 mph_ext_meas_cnf->num_of_chan = 0;
881 PSENDX ( RR, mph_ext_meas_cnf );
882
883 PFREE (mph_ext_meas_req);
884 }
885 }
886
887 /*
888 +--------------------------------------------------------------------+
889 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
890 | STATE : code ROUTINE : ma_mph_tch_loop_req |
891 +--------------------------------------------------------------------+
892
893 PURPOSE : Process the primitive MPH_TCH_LOOP_REQ.
894
895 */
896
897 GLOBAL void ma_mph_tch_loop_req (T_MPH_TCH_LOOP_REQ* mph_tch_loop_req)
898 {
899 dedi_tch_loop_req (mph_tch_loop_req);
900 PFREE(mph_tch_loop_req);
901 }
902
903
904 /*
905 +--------------------------------------------------------------------+
906 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
907 | STATE : code ROUTINE : ma_mph_dai_req |
908 +--------------------------------------------------------------------+
909
910 PURPOSE : Process the primitive MPH_DAI_REQ.
911
912 */
913
914 GLOBAL void ma_mph_dai_req (T_MPH_DAI_REQ* mph_dai_req)
915 {
916 dedi_dai_req (mph_dai_req);
917 PFREE(mph_dai_req);
918 }
919
920 /*
921 +--------------------------------------------------------------------+
922 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
923 | STATE : code ROUTINE : ma_mph_cbch_req |
924 +--------------------------------------------------------------------+
925
926 PURPOSE : Process the primitive MPH_CBCH_REQ.
927
928 */
929
930
931 GLOBAL void ma_mph_cbch_req (T_MPH_CBCH_REQ* cbch_req)
932 {
933 cb_mph_cbch_req( &cbch_req->cbch);
934 PFREE (cbch_req);
935 }
936
937 /*
938 +--------------------------------------------------------------------+
939 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
940 | STATE : code ROUTINE : ma_mph_identity_req |
941 +--------------------------------------------------------------------+
942
943 PURPOSE : Process the primitive MPH_IDENTITY_REQ.
944
945 */
946
947 GLOBAL void ma_mph_identity_req (T_MPH_IDENTITY_REQ* mph_identity_req)
948 {
949 pch_identity_req (mph_identity_req);
950 PFREE (mph_identity_req);
951 }
952
953 /*
954 +--------------------------------------------------------------------+
955 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
956 | STATE : code ROUTINE : ma_mph_sync_req |
957 +--------------------------------------------------------------------+
958
959 PURPOSE : Process the primitive MPH_SYNC_REQ.
960
961 */
962
963 GLOBAL void ma_mph_sync_req (T_MPH_SYNC_REQ* mph_sync_req)
964 {
965 GET_INSTANCE_DATA;
966 switch (mph_sync_req->cs)
967 {
968 case CS_CLEAN_SYS_INFO:
969 /*
970 * clean stored system information messages to force
971 * sending to RR.
972 */
973 ma_clean_dedi_sys_buffer ();
974 break;
975
976 case CS_STOP_BCCH_READING:
977 switch (GET_STATE (STATE_MA))
978 {
979 case MA_CELL_SELECTION:
980 cs_stop ();
981 break;
982 case MA_IDLE:
983 nc_stop_rr_activity (FALSE);
984 break;
985 }
986 break;
987
988 case CS_STOP_PLMN_SEARCH:
989 switch (GET_STATE (STATE_MA))
990 {
991 case MA_CELL_SELECTION:
992 cs_stop ();
993 break;
994 case MA_IDLE:
995 /*
996 * PLMN search is stopped. If mobile was in REORG before
997 * PLMN search, this is set again after finishing all BCCH reading.
998 */
999 if(alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_NC_SYNC)
1000 {
1001 alr_data->pch_data.pl_idle.page_mode = page_mode_before_hplmn_search;
1002 pch_start_ccch_req ();
1003 ALR_TRACE_MAIN ("PLMN search complete - REORG reestablished");
1004 }
1005 cs_stop ();
1006 nc_stop_rr_activity (TRUE);
1007 break;
1008 }
1009 break;
1010 case CS_STOP_PLMN_SEARCH_AND_DEACTIVATE:
1011 switch (GET_STATE (STATE_MA))
1012 {
1013 case MA_CELL_SELECTION:
1014 cs_stop ();
1015 break;
1016 case MA_IDLE:
1017 /*
1018 * If mobile was in REORG before PLMN search, this is set again after
1019 * finishing PLMN search. L1 is not configured, because PCH reading
1020 * is stopped anyway
1021 */
1022 if(alr_data->pch_data.pl_idle.page_mode EQ PGM_REORG_NC_SYNC)
1023 {
1024 alr_data->pch_data.pl_idle.page_mode = page_mode_before_hplmn_search;
1025 ALR_TRACE_MAIN ("PLMN search complete - REORG reestablished");
1026 }
1027 cs_stop ();
1028 nc_stop_rr_activity (TRUE);
1029 ma_stop_active_procs(STOP_PCH_READING | STOP_MEASUREMENTS);
1030 break;
1031 }
1032 {
1033 PALLOC(deact_req, MPHC_DEACTIVATE_REQ);
1034 PSENDX(L1, deact_req);
1035 }
1036 break;
1037 #ifdef GPRS
1038 case CS_START_PCCO:
1039 alr_data->gprs_data.pcco_active = TRUE;
1040 if ( GET_STATE(STATE_MA) EQ MA_PTM )
1041 {
1042 ma_stop_active_procs(STOP_MEASUREMENTS |STOP_PCH_READING);
1043 SET_STATE(STATE_MA, MA_IDLE);
1044 }
1045 break;
1046 #endif
1047 case CS_RXLEV_VAL_REQ:
1048 switch (GET_STATE(STATE_MA))
1049 {
1050 #ifdef GPRS
1051 case MA_PTM:
1052 case MA_IDLE:
1053 break;
1054 #endif /* GPRS */
1055 case MA_DEDICATED:
1056 /* EMO */
1057 break;
1058 }
1059 break;
1060 case CS_SYS_INFO_2BIS_SUPPORT_CHANGED:
1061 if((GET_STATE(STATE_MA) EQ MA_IDLE) AND
1062 (alr_data->pch_data.pl_idle.page_mode EQ PGM_NORMAL OR
1063 alr_data->pch_data.pl_idle.page_mode EQ PGM_EXTENDED) AND
1064 (alr_data->pch_data.reorg_bcch_reading EQ FALSE))
1065 {
1066 ma_stop_scell_bcch_req ();
1067 if(alr_data->cs_data.si_bitmap & SI_2BIS_READ)
1068 alr_data->cs_data.si_bitmap &= ~(SI_2BIS_READ);
1069 else
1070 alr_data->cs_data.si_bitmap |= SI_2BIS_READ;
1071 sc_start_periodic();
1072 }
1073 break;
1074 case CS_SYS_INFO_2TER_SUPPORT_CHANGED:
1075 /* Dont start periodic reading if we are in PGM_REORG */
1076 if((GET_STATE(STATE_MA) EQ MA_IDLE) AND
1077 (alr_data->pch_data.pl_idle.page_mode EQ PGM_NORMAL OR
1078 alr_data->pch_data.pl_idle.page_mode EQ PGM_EXTENDED) AND
1079 (alr_data->pch_data.reorg_bcch_reading EQ FALSE))
1080 {
1081 ma_stop_scell_bcch_req ();
1082 if(alr_data->cs_data.si_bitmap & SI_2TER_READ)
1083 alr_data->cs_data.si_bitmap &= ~(SI_2TER_READ);
1084 else
1085 alr_data->cs_data.si_bitmap |= SI_2TER_READ;
1086 sc_start_periodic();
1087 }
1088 break;
1089 default:
1090 break;
1091 }
1092
1093 PFREE (mph_sync_req);
1094 }
1095
1096 /*
1097 +--------------------------------------------------------------------+
1098 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1099 | STATE : code ROUTINE : ma_mph_clean_buf_req |
1100 +--------------------------------------------------------------------+
1101
1102 PURPOSE : Process the primitive MPH_CLEAN_BUF_REQ.
1103
1104 */
1105
1106 GLOBAL void ma_mph_clean_buf_req (T_MPH_CLEAN_BUF_REQ* mph_clean_buf_req)
1107 {
1108 ma_clean_sys_buffer(mph_clean_buf_req->si_to_clean);
1109 PFREE(mph_clean_buf_req);
1110 }
1111
1112 /*
1113 +--------------------------------------------------------------------+
1114 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1115 | STATE : code ROUTINE : ma_mph_stop_dedi_req |
1116 +--------------------------------------------------------------------+
1117
1118 PURPOSE : Process the primitive MPH_STOP_DEDICATED_REQ.
1119
1120 */
1121 GLOBAL void ma_mph_stop_dedi_req(T_MPH_STOP_DEDICATED_REQ *stop_dedi)
1122 {
1123 dedi_stop();
1124 PFREE(stop_dedi);
1125 }
1126
1127 /*
1128 +--------------------------------------------------------------------+
1129 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1130 | STATE : code ROUTINE : ma_mph_power_req |
1131 +--------------------------------------------------------------------+
1132
1133 PURPOSE : Process the primitive MPH_POWER_REQ and MPH_EXT_MEAS_REQ.
1134
1135 */
1136
1137 GLOBAL void ma_mph_power_req(T_MPH_POWER_REQ* mph_power_req)
1138 {
1139 GET_INSTANCE_DATA;
1140 if ( D_OPC(mph_power_req) EQ MPH_POWER_REQ && IS_EXT_MEAS_RUNNING )
1141 {
1142 PALLOC ( mph_power_cnf, MPH_POWER_CNF );
1143 mph_power_cnf->num_of_chan = 0;
1144 PSENDX ( RR, mph_power_cnf );
1145 TRACE_ERROR ( "Cell Sel during Ext Meas");
1146 PFREE (mph_power_req);
1147 return;
1148 }
1149
1150 if (mph_power_req->freq_bands EQ 0)
1151 {
1152 TRACE_ERROR ("MPH_POWER_REQ with freq_bands=0 (Invalid value)!");
1153 TRACE_ASSERT (mph_power_req->freq_bands EQ 0);
1154 }
1155
1156 if(!IS_EXT_MEAS_RUNNING)
1157 {
1158 /* CSI-LLD Section : 4.1.3.4.2.2 */
1159 if(alr_data->cs_data.p_power_req NEQ NULL)
1160 {
1161 TRACE_ERROR("MPH_POWER_REQ buffer leakage");
1162 PFREE(alr_data->cs_data.p_power_req);
1163 }
1164 /* Store the MPH_POWER_REQ pointer for later usage */
1165 alr_data->cs_data.p_power_req = mph_power_req;
1166 }
1167
1168 alr_data->cs_data.freq_bands = mph_power_req->freq_bands;
1169
1170 ALR_EM_POWER_MEASSUREMENT_REQUEST;
1171
1172 switch (mph_power_req->pch_interrupt)
1173 {
1174 case NO_PCH_INTERRUPT:
1175 /*
1176 * Full list power measurements without changing the current state
1177 */
1178 alr_data->plmn_search_running = TRUE;
1179 nc_suspend();
1180 cs_power_req (NO_PCH_INTERRUPT);
1181 break;
1182 case PCH_INTERRUPT:
1183 /*
1184 * Full list power measurements for Cell Selection
1185 */
1186 alr_data->plmn_search_running = FALSE;
1187 alr_multiband_std = NOT_PRESENT_8BIT;
1188 #ifdef GPRS
1189 gprs_alr_init();
1190 #endif
1191 switch (GET_STATE(STATE_MA))
1192 {
1193 case MA_NULL:
1194 case MA_CELL_SELECTION:
1195 ma_stop_active_procs(DONT_STOP_PCH_READING);
1196 SET_STATE(STATE_MA, MA_CELL_SELECTION);
1197 cs_power_req (PCH_INTERRUPT);
1198 break;
1199 case MA_CELL_RESELECTION:
1200 ma_stop_active_procs(STOP_PCH_READING | STOP_MEASUREMENTS);
1201 nc_stop();
1202 SET_STATE(STATE_MA, MA_CELL_SELECTION);
1203 cs_power_req (PCH_INTERRUPT);
1204 break;
1205 case MA_CON_EST:
1206 case MA_DEDICATED:
1207 case MA_IDLE:
1208 #ifdef GPRS
1209 case MA_PTM:
1210 alr_data->nc_sync_with_grr = TRUE;
1211 #endif
1212 ma_stop_active_procs(STOP_PCH_READING | STOP_MEASUREMENTS);
1213 /*
1214 * call this explicitly here, because stop_active_procs only
1215 * suspends ncell procedures
1216 */
1217 nc_stop();
1218 SET_STATE(STATE_MA, MA_CELL_SELECTION);
1219 cs_power_req (PCH_INTERRUPT);
1220 break;
1221 default:
1222 if(!IS_EXT_MEAS_RUNNING)
1223 {
1224 PFREE (mph_power_req);
1225 alr_data->cs_data.p_power_req = NULL;
1226 TRACE_ERROR ("MPH_POWER_REQ received in invalid MA state");
1227 }
1228 break;
1229 }
1230 break;
1231 default:
1232 if(!IS_EXT_MEAS_RUNNING)
1233 {
1234 PFREE (mph_power_req);
1235 alr_data->cs_data.p_power_req = NULL;
1236 TRACE_ERROR ("MPH_POWER_REQ: Invalid search type");
1237 }
1238 break;
1239 }
1240 }
1241
1242 /*
1243 +--------------------------------------------------------------------+
1244 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1245 | STATE : code ROUTINE : ma_mph_bsic_req |
1246 +--------------------------------------------------------------------+
1247
1248 PURPOSE : Process the primitive MPH_BSIC_REQ.
1249
1250 */
1251
1252 GLOBAL void ma_mph_bsic_req (T_MPH_BSIC_REQ* mph_bsic_req)
1253 {
1254 GET_INSTANCE_DATA;
1255 ALR_TRACE_MAIN_BSIC_REQ (GET_STATE(STATE_MA));
1256
1257 #ifdef GPRS
1258 if(alr_data->gprs_data.pcco_active)
1259 {
1260 cs_bsic_req(mph_bsic_req);
1261 PFREE (mph_bsic_req);
1262 return;
1263 }
1264 #endif
1265
1266 switch (GET_STATE (STATE_MA))
1267 {
1268 case MA_CELL_SELECTION:
1269 cs_bsic_req (mph_bsic_req);
1270 break;
1271 case MA_IDLE:
1272 nc_bsic_req (mph_bsic_req);
1273 break;
1274 #ifdef GPRS
1275 case MA_DEDICATED:
1276
1277 ma_stop_active_procs(STOP_PCH_READING | STOP_MEASUREMENTS); /* DEDI-state is now DEDI_INACTIVE */
1278 /* DEDI-state is now DEDI_INACTIVE */
1279 SET_STATE(STATE_NC, NC_NULL);
1280 #ifdef NOT_YET
1281 nc_suspend(); /* stop dedicated mode activity */
1282 #endif
1283
1284 SET_STATE(STATE_MA, MA_CELL_SELECTION);
1285 cs_bsic_req (mph_bsic_req);
1286 break;
1287 #endif
1288 default:
1289 break;
1290 }
1291
1292 PFREE (mph_bsic_req);
1293 }
1294
1295
1296 /*
1297 +--------------------------------------------------------------------+
1298 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1299 | STATE : code ROUTINE : ma_mph_meas_rep_req |
1300 +--------------------------------------------------------------------+
1301
1302 PURPOSE : Process the primitive MPH_MEAS_REP_REQ.
1303 */
1304
1305 #ifdef GPRS
1306 GLOBAL void ma_mph_meas_rep_req(T_MPH_MEAS_REP_REQ * mph_meas_rep_req)
1307 {
1308 GET_INSTANCE_DATA;
1309 USHORT i;
1310 TRACE_EVENT("mph_meas_rep_req");
1311
1312
1313 switch(mph_meas_rep_req->cause)
1314 {
1315 case NC_START_MEAS:
1316 /*
1317 * Reset nc mease results database
1318 */
1319 for(i=0;i<=BA_LIST_SIZE;i++)
1320 {
1321 alr_data->nc_data.cell[i].nc_rxlev = 0;
1322 alr_data->nc_data.cell[i].c_nc_rxlev = 0;
1323 }
1324 /*
1325 * activate rx_lev averaging when NC=1 or NC=2
1326 */
1327 alr_data->nwctrl_meas_active = TRUE;
1328 break;
1329 case NC_REPORT_MEAS:
1330 /*
1331 * Calculate rx_lev average and send the report to RR. RR forwards this to GRR
1332 */
1333 if(alr_data->nwctrl_meas_active)
1334 {
1335 PALLOC(mph_meas_rep_cnf, MPH_MEAS_REP_CNF);
1336 memset(mph_meas_rep_cnf,0,sizeof(T_MPH_MEAS_REP_CNF));
1337 nc_build_nwctrl_rr_report(mph_meas_rep_cnf);
1338 PSENDX ( RR, mph_meas_rep_cnf);
1339 for(i=0;i<=BA_LIST_SIZE;i++)
1340 {
1341 alr_data->nc_data.cell[i].nc_rxlev = 0;
1342 alr_data->nc_data.cell[i].c_nc_rxlev = 0;
1343 }
1344 }
1345 break;
1346 case NC_STOP_MEAS:
1347 /*
1348 * De-activate rx_lev averaging for Network control
1349 */
1350 alr_data->nwctrl_meas_active = FALSE;
1351 break;
1352 default:
1353 break;
1354 }
1355 PFREE(mph_meas_rep_req);
1356 }
1357 #endif
1358
1359
1360 /*
1361 +--------------------------------------------------------------------+
1362 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1363 | STATE : code ROUTINE : ma_mph_random_access_req |
1364 +--------------------------------------------------------------------+
1365
1366 PURPOSE : Process the primitive MPH_RANDOM_ACCESS_REQ.
1367
1368 */
1369
1370 GLOBAL void ma_mph_random_access_req (T_MPH_RANDOM_ACCESS_REQ* mph_random_access_req)
1371 {
1372 GET_INSTANCE_DATA;
1373 switch (GET_STATE (STATE_MA))
1374 {
1375 case MA_IDLE:
1376 ALR_TRACE_MAIN_RAND_ACC(alr_data->serving_cell, mph_random_access_req->send_mode.no);
1377
1378 /*
1379 * suspend neighbour cell procedures
1380 */
1381 ma_stop_active_procs(DONT_STOP_PCH_READING | STOP_MEASUREMENTS);
1382 SET_STATE (STATE_MA, MA_CON_EST);
1383 /*
1384 * switch to full downlink CCCH listening
1385 */
1386 pch_save_pgm(0);
1387 pch_configure(NULL, PGM_REORG_CS);
1388 pch_start_ccch_req ();
1389 /*
1390 * Send uplink Random Bursts
1391 */
1392 rach_random_req (mph_random_access_req);
1393 break;
1394 #ifdef GPRS
1395 case MA_PTM:
1396 ma_stop_active_procs(DONT_STOP_PCH_READING| STOP_MEASUREMENTS);
1397 // nc_suspend(); gprs_alr_nc_leave_ptm();
1398 SET_STATE (STATE_MA, MA_CON_EST);
1399 /*
1400 * switch to full downlink CCCH listening
1401 */
1402 /*pch_save_pgm(0);*/
1403 pch_configure(NULL, PGM_REORG_CS);
1404 pch_start_ccch_req ();
1405 /*
1406 * Send uplink Random Bursts
1407 */
1408 rach_random_req (mph_random_access_req);
1409 break;
1410 #endif
1411 case MA_CON_EST:
1412 SET_STATE (STATE_MA, MA_CON_EST);
1413 rach_random_req (mph_random_access_req);
1414 break;
1415
1416 default:
1417 break;
1418 }
1419
1420 PFREE (mph_random_access_req);
1421 }
1422
1423 /*
1424 +--------------------------------------------------------------------+
1425 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1426 | STATE : code ROUTINE : ma_mph_mph_emo_req |
1427 +--------------------------------------------------------------------+
1428
1429 PURPOSE : Process the primitive MPH_MPH_EMO_REQ.
1430
1431 */
1432
1433 GLOBAL void ma_mph_emo_req (T_MPH_EMO_REQ *mph_emo_req)
1434 {
1435 GET_INSTANCE_DATA;
1436 switch (GET_STATE (STATE_MA))
1437 {
1438 case MA_DEDICATED:
1439 {
1440 UBYTE i,n;
1441 USHORT *radio_freq;
1442 USHORT *arfcn;
1443 USHORT sc = alr_data->serving_cell;
1444 BOOL sc_ok;
1445 PALLOC (mphc_update_ba_list, MPHC_UPDATE_BA_LIST);
1446
1447 alr_data->dedi_data.emo_ba_id = mph_emo_req->ba_id;
1448
1449 n = mph_emo_req->c_arfcn;
1450 if ( n >= BA_LIST_SIZE )
1451 n = BA_LIST_SIZE;
1452
1453 /*
1454 * Initialize the outgoing primitive MPHC_UPDATE_BA_LIST.
1455 */
1456
1457 radio_freq = &mphc_update_ba_list->chan_list.radio_freq[0];
1458 arfcn = &mph_emo_req->arfcn[0];
1459 sc_ok = FALSE;
1460
1461 for ( i = 0; i < n; i++ )
1462 {
1463 radio_freq[i] = ARFCN_TO_L1 (arfcn[i]);
1464 if ( radio_freq[i] EQ sc )
1465 {
1466 sc_ok = TRUE;
1467 }
1468 }
1469 if ( !sc_ok AND n < BA_LIST_SIZE ) /* add the serving cell ARFCN */
1470 {
1471 radio_freq[n++] = sc;
1472 }
1473 mphc_update_ba_list->num_of_chans = n;
1474 mphc_update_ba_list->pwrc = alr_data->nc_data.pwrc;
1475 mphc_update_ba_list->dtx_allowed = alr_data->nc_data.dtx;
1476 mphc_update_ba_list->ba_id = mph_emo_req->ba_id;
1477
1478 PSENDX (L1, mphc_update_ba_list);
1479
1480 break;
1481 }
1482 }
1483 PFREE (mph_emo_req);
1484 }
1485 /*
1486 +--------------------------------------------------------------------+
1487 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1488 | STATE : code ROUTINE : ma_mph_mph_emo_req |
1489 +--------------------------------------------------------------------+
1490
1491 PURPOSE : Process the primitive MPH_MPH_EMO_REQ.
1492
1493 */
1494
1495 GLOBAL void ma_mph_ncell_pos_req (T_MPH_NCELL_POS_REQ *mph_ncell_pos_req)
1496 {
1497 nc_ncell_pos_req(mph_ncell_pos_req);
1498 }
1499 /* ------------------------------------------------------------------
1500 * ------------------------------------------------------------------
1501 * Functions for the lower layer(MPHC) primitive processing
1502 * ------------------------------------------------------------------
1503 * ------------------------------------------------------------------
1504 */
1505
1506
1507 /*
1508 +--------------------------------------------------------------------+
1509 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1510 | STATE : code ROUTINE : ma_mphc_rxlev_con |
1511 +--------------------------------------------------------------------+
1512
1513 PURPOSE : Process the primitive MPHC_RXLEV_CON.
1514
1515 */
1516
1517 GLOBAL void ma_mphc_rxlev_ind (T_MPHC_RXLEV_IND* rxlev_ind)
1518 {
1519 GET_INSTANCE_DATA;
1520
1521 USHORT cs_state = GET_STATE (STATE_CS);
1522 switch (cs_state)
1523 {
1524 default:
1525 TRACE_EVENT_P1 ("wrong CS state (%u) in ma_mphc_rxlev_ind()", cs_state);
1526 /*lint -fallthrough*/
1527 case CS_ACTIVE_MEASURE:
1528 SET_STATE(STATE_CS, CS_MEASURED);
1529 break;
1530 }
1531
1532 ALR_EM_FIELDSTRENGTH_MEASUREMENT_CONFIRM;
1533 cs_rxlev_ind (rxlev_ind);
1534 PFREE (rxlev_ind);
1535 }
1536
1537 /*
1538 +--------------------------------------------------------------------+
1539 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1540 | STATE : code ROUTINE : ma_mphc_stop_rxlev_con |
1541 +--------------------------------------------------------------------+
1542
1543 PURPOSE : Process the primitive MPHC_RXLEV_CON.
1544
1545 */
1546
1547 GLOBAL void ma_mphc_stop_rxlev_cnf (T_MPHC_STOP_RXLEV_CON * rxlev_cnf)
1548 {
1549 GET_INSTANCE_DATA;
1550 if ( IS_EXT_MEAS_RUNNING )
1551 {
1552 nc_stop_ext_meas_ind();
1553 alr_data->cs_data.ext_meas_state_pend = CS_NULL;
1554 }
1555 PFREE(rxlev_cnf);
1556 }
1557
1558
1559 /*
1560 +--------------------------------------------------------------------+
1561 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1562 | STATE : code ROUTINE : ma_stop_cnf |
1563 +--------------------------------------------------------------------+
1564
1565 PURPOSE : Processes the primitives MPHC_STOP_*_CON.
1566
1567 */
1568
1569 GLOBAL void ma_mphc_empty_cnf (void *cnf)
1570 {
1571 PFREE (cnf);
1572 }
1573
1574 /*
1575 +--------------------------------------------------------------------+
1576 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1577 | STATE : code ROUTINE : ma_mphc_network_sync_ind |
1578 +--------------------------------------------------------------------+
1579
1580 PURPOSE : Process the primitive MPHC_NETWORK_SYNC_IND.
1581
1582 */
1583
1584 GLOBAL void ma_mphc_network_sync_ind (T_MPHC_NETWORK_SYNC_IND* sync_ind)
1585 {
1586 TIMERSTOP(TIM_NW_SYNC_GUARD);
1587 cs_network_sync_ind (sync_ind);
1588 PFREE(sync_ind);
1589 }
1590
1591 #if defined(STOP_SYNC_TASK)
1592 /*
1593 +----------------------------------------------------------------------------+
1594 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1595 | STATE : code ROUTINE : ma_mphc_stop_network_sync_req |
1596 +----------------------------------------------------------------------------+
1597
1598 PURPOSE : Process the primitive MPHC_STOP_NETWORK_SYNC_REQ.
1599
1600 */
1601
1602 GLOBAL void ma_cs_stop_network_sync_req(void)
1603 {
1604 GET_INSTANCE_DATA;
1605 if (alr_data->cs_data.sync_active)
1606 {
1607 PALLOC (stop_sync_task, MPHC_STOP_NETWORK_SYNC_REQ); /* T_MPHC_STOP_NETWORK_SYNC_REQ */
1608 TRACE_EVENT ("STOP_NETWORK_SYNC_REQ");
1609 PSENDX(L1, stop_sync_task);
1610 }
1611 }
1612
1613 /*
1614 +----------------------------------------------------------------------------+
1615 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1616 | STATE : code ROUTINE : ma_mphc_stop_network_sync_cnf |
1617 +----------------------------------------------------------------------------+
1618
1619 PURPOSE : Process the primitive MPHC_STOP_NETWORK_SYNC_CON.
1620
1621 */
1622
1623 GLOBAL void ma_mphc_stop_network_sync_cnf(T_MPHC_STOP_NETWORK_SYNC_CON *stop_network_sync_cnf)
1624 {
1625 GET_INSTANCE_DATA;
1626 alr_data->cs_data.sync_active = FALSE;
1627 switch(GET_STATE(STATE_CS))
1628 {
1629 case CS_STOP_SYNC:
1630 SET_STATE (STATE_CS, CS_STOP_SYNC_DONE);
1631 cs_bsic_req(NULL);
1632 break;
1633
1634 case CS_NW_SYNC_TIMEOUT:
1635 /* Inform RR that no BCCH was found */
1636 SET_STATE (STATE_CS, CS_ACTIVE_SYNC);
1637
1638 {
1639 PALLOC (mph_bsic_cnf, MPH_BSIC_CNF);
1640 mph_bsic_cnf->cs = CS_NO_BCCH_AVAIL;
1641 PSENDX (RR, mph_bsic_cnf);
1642 }
1643 break;
1644
1645 default:
1646 break;
1647 }
1648
1649 PFREE(stop_network_sync_cnf);
1650 }
1651 #endif /* STOP_SYNC_TASK */
1652
1653 /*
1654 +--------------------------------------------------------------------+
1655 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1656 | STATE : code ROUTINE : ma_mphc_new_scell_cnf |
1657 +--------------------------------------------------------------------+
1658
1659 PURPOSE : Process the primitive MPHC_NEW_SCELL_CON.
1660
1661 */
1662
1663 GLOBAL void ma_mphc_new_scell_cnf (T_MPHC_NEW_SCELL_CON* new_scell_cnf)
1664 {
1665 GET_INSTANCE_DATA;
1666 /* we have a new serving cell */
1667 vsi_t_sleep(VSI_CALLER 10);
1668
1669 switch (GET_STATE(STATE_MA))
1670 {
1671 case MA_CELL_SELECTION:
1672 /*
1673 * we are synchronized to the new cell
1674 * now read the BCCH to check if the cell
1675 * is suitable
1676 */
1677 cs_read_scell_bcch ();
1678 break;
1679 case MA_CELL_RESELECTION:
1680 ALR_TRACE_MAIN ("new sc in cr");
1681 if (alr_data->old_serving_cell NEQ alr_data->serving_cell)
1682 {
1683 ALR_TRACE_MAIN_SCELL(alr_data->old_serving_cell, alr_data->serving_cell);
1684 ALR_TRACE_MAIN ("update timebase");
1685 /*
1686 * update the timebase now
1687 */
1688 nc_update_list (alr_data->serving_cell);
1689 /*
1690 * removing of the old serving cell only just if
1691 * RR gives a positive receipt for cell selection.
1692 * obsolet: nc_update_serving_cell (alr_data->old_serving_cell);
1693 */
1694
1695 /*
1696 * In case the serving cell has been changed, the last CCCH configuration
1697 * is not valid anymore! It will delete now, so that the sucessful
1698 * comparison inside ma_pch_start_ccch_req() will not prevent a new
1699 * CCCH configuration of L1.
1700 */
1701 memset (&alr_data->pch_data.last_start_ccch_req, 0,
1702 sizeof (alr_data->pch_data.last_start_ccch_req));
1703 }
1704 #ifdef GPRS
1705 if(alr_data->gprs_data.sync_only)
1706 {
1707 PALLOC(sync, MPH_SYNC_IND);
1708 sync->cs = CS_SCELL_IS_SYNCED;
1709 alr_data->gprs_data.sync_only=0;
1710 SET_STATE(STATE_MA, MA_IDLE);
1711 PSENDX (RR, sync);
1712 }
1713 else
1714 {
1715 #endif
1716 pch_start_ccch_req();
1717 #ifdef GPRS
1718 }
1719 #endif
1720 break;
1721 case MA_IDLE:
1722 ALR_TRACE_MAIN ("new sc in idle");
1723 if (alr_data->old_serving_cell NEQ alr_data->serving_cell)
1724 nc_update_list (alr_data->serving_cell);
1725 break;
1726 case MA_CON_EST:
1727 break;
1728 default:
1729 break;
1730 }
1731
1732 PFREE (new_scell_cnf);
1733 }
1734
1735 /*
1736 +--------------------------------------------------------------------+
1737 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1738 | STATE : code ROUTINE : ma_mphc_ncell_bcch_ind |
1739 +--------------------------------------------------------------------+
1740
1741 PURPOSE : Process the primitive MPHC_NCELL_BCCH_IND.
1742
1743 */
1744
1745 GLOBAL void ma_mphc_ncell_bcch_ind (T_MPHC_NCELL_BCCH_IND* ncell_bcch_ind)
1746 {
1747 nc_bcch_ind (ncell_bcch_ind);
1748 PFREE (ncell_bcch_ind);
1749 }
1750
1751 /*
1752 +--------------------------------------------------------------------+
1753 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1754 | STATE : code ROUTINE : ma_mphc_ncell_sync_ind |
1755 +--------------------------------------------------------------------+
1756
1757 PURPOSE : Process the primitive MPHC_NCELL_SYNC_IND.
1758
1759 */
1760
1761 GLOBAL void ma_mphc_ncell_sync_ind (T_MPHC_NCELL_SYNC_IND* ncell_sync_ind)
1762 {
1763 nc_sync_ind (ncell_sync_ind);
1764 PFREE (ncell_sync_ind);
1765 }
1766
1767 /*
1768 +--------------------------------------------------------------------+
1769 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1770 | STATE : code ROUTINE : ma_mphc_stop_ncell_sync_cnf |
1771 +--------------------------------------------------------------------+
1772
1773 PURPOSE : Process the primitive MPHC_NCELL_SYNC_IND.
1774
1775 */
1776
1777 GLOBAL void ma_mphc_stop_ncell_sync_cnf (T_MPHC_STOP_NCELL_SYNC_CON *cnf )
1778 {
1779 GET_INSTANCE_DATA;
1780 if ( IS_EXT_MEAS_RUNNING )
1781 {
1782 nc_stop_ext_meas_ind();
1783 alr_data->cs_data.ext_meas_state_pend = CS_NULL;
1784 }
1785 PFREE (cnf);
1786 }
1787
1788 /*
1789 +--------------------------------------------------------------------+
1790 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1791 | STATE : code ROUTINE : ma_mphc_ncell_bcch_ind |
1792 +--------------------------------------------------------------------+
1793
1794 PURPOSE : Process the primitive MPHC_RXLEV_PERIODIC_IND.
1795
1796 */
1797
1798 GLOBAL void ma_mphc_rxlev_periodic_ind (T_MPHC_RXLEV_PERIODIC_IND*
1799 rxlev_periodic_ind)
1800 {
1801 GET_INSTANCE_DATA;
1802
1803 switch (GET_STATE (STATE_MA))
1804 {
1805 case MA_CELL_RESELECTION:
1806 case MA_CON_EST:
1807 case MA_IDLE:
1808 nc_report (rxlev_periodic_ind);
1809 #ifdef TI_PS_HCOMM_CHANGE
1810 PSIGNAL (_hCommDL, PH_TRACE_IND, NULL);
1811 #else
1812 PSIGNAL (hCommDL, PH_TRACE_IND, NULL);
1813 #endif /* TI_PS_HCOMM_CHANGE */
1814 alr_trc_read (8);
1815 break;
1816
1817 default:
1818 break;
1819 }
1820 PFREE (rxlev_periodic_ind);
1821 }
1822
1823 /*
1824 +--------------------------------------------------------------------+
1825 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1826 | STATE : code ROUTINE : ma_mphc_ra_cnf |
1827 +--------------------------------------------------------------------+
1828
1829 PURPOSE : Process the primitive MPHC_RA_CON.
1830
1831 */
1832
1833 GLOBAL void ma_mphc_ra_cnf (T_MPHC_RA_CON* ra_cnf)
1834 {
1835 GET_INSTANCE_DATA;
1836
1837 switch (GET_STATE (STATE_MA))
1838 {
1839 case MA_CON_EST:
1840 rach_ra_cnf (ra_cnf);
1841 break;
1842 default:
1843 break;
1844 }
1845 PFREE (ra_cnf);
1846 }
1847
1848 /*
1849 +--------------------------------------------------------------------+
1850 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
1851 | STATE : code ROUTINE : ma_trc_data_ind |
1852 +--------------------------------------------------------------------+
1853
1854 PURPOSE : Trace the primitive MPHC_DATA_IND.
1855
1856 configure the output with the following command:
1857 CONFIG TRC_DATA_IND=n
1858
1859 the available decimal values of the bit mask 'n' are:
1860 ID_TRC_DATA_IND_ALL 255
1861 ID_TRC_DATA_IND_VALID 127
1862 ID_TRC_DATA_IND_INVALID 128
1863 ID_TRC_DATA_IND_BCCH 1 normal and extended BCCH
1864 ID_TRC_DATA_IND_PCH 2 normal and extended PCH
1865 ID_TRC_DATA_IND_CCCH 4
1866 ID_TRC_DATA_IND_CBCH 8
1867 ID_TRC_DATA_IND_SCCH 16 SACCH and SDCCH
1868 ID_TRC_DATA_IND_FCCH 32 full and half rate FACCH
1869 ID_TRC_DATA_IND_STATE 64 MA status
1870
1871 ID_TRC_DATA_IND_INIT 63 all valid frames without stati
1872 ID_TRC_DATA_IND_INIT2 31 ... without FACCH
1873 */
1874 #if !defined(NCONFIG)
1875 static void ma_trc_data_ind(T_MPHC_DATA_IND* data_ind)
1876 {
1877 GET_INSTANCE_DATA;
1878 char *msg_s = "";
1879 UBYTE msg_t = 0;
1880
1881 if (data_ind->error_flag NEQ VALID_BLOCK)
1882 {
1883 if (v_mon_trc_data_ind & ID_TRC_DATA_IND_INVALID)
1884 {
1885 #if !defined(DL_TRACE_ENABLED)
1886 SYST_TRACE ("invalid block");
1887 #else /* !DL_TRACE_ENABLED */
1888 DL_OFFLINE_TRACE ("invalid block");
1889 #endif /* !DL_TRACE_ENABLED */
1890 }
1891 return;
1892 }
1893
1894 switch (data_ind->l2_channel)
1895 {
1896 case L2_CHANNEL_SACCH:
1897 case L2_CHANNEL_SDCCH:
1898 if ((v_mon_trc_data_ind & ID_TRC_DATA_IND_SCCH) EQ 0)
1899 msg_t = (UBYTE)-1;
1900 break;
1901 case L2_CHANNEL_FACCH_H:
1902 case L2_CHANNEL_FACCH_F:
1903 if ((v_mon_trc_data_ind & ID_TRC_DATA_IND_FCCH) EQ 0)
1904 msg_t = (UBYTE)-1;
1905 break;
1906 case L2_CHANNEL_CCCH:
1907 if ((v_mon_trc_data_ind & ID_TRC_DATA_IND_CCCH) EQ 0)
1908 return;
1909 break;
1910 case L2_CHANNEL_NBCCH:
1911 case L2_CHANNEL_EBCCH:
1912 if ((v_mon_trc_data_ind & ID_TRC_DATA_IND_BCCH) EQ 0)
1913 msg_t = (UBYTE)-1;
1914 break;
1915 case L2_CHANNEL_PCH:
1916 case L2_CHANNEL_EPCH:
1917 if ((v_mon_trc_data_ind & ID_TRC_DATA_IND_PCH) EQ 0)
1918 msg_t = (UBYTE)-1;
1919 break;
1920 case L2_CHANNEL_CBCH:
1921 if ((v_mon_trc_data_ind & ID_TRC_DATA_IND_CBCH) EQ 0)
1922 msg_t = (UBYTE)-1;
1923 break;
1924 default:
1925 msg_t = (UBYTE)-1;
1926 SYST_TRACE_P((SYST, "trc_data_ind %02x ch=%d",
1927 v_mon_trc_data_ind, data_ind->l2_channel));
1928 break;
1929 }
1930
1931 if (msg_t)
1932 {
1933 return;
1934 }
1935
1936 if (data_ind->error_flag EQ VALID_BLOCK)
1937 {
1938 msg_t = data_ind->l2_frame.content[SI_CONTENTS_MSG_T];
1939 switch (msg_t)
1940 {
1941 case D_IMM_ASSIGN:
1942 msg_s = "IMM_ASS";
1943 break;
1944 case D_IMM_ASSIGN_EXT:
1945 msg_s = "IMM_ASS_EXT";
1946 break;
1947 case D_IMM_ASSIGN_REJ:
1948 msg_s = "IMM_ASS_REJ";
1949 break;
1950 case D_PAG_REQ_1:
1951 msg_s = "PAG1";
1952 break;
1953 case D_PAG_REQ_2:
1954 msg_s = "PAG2";
1955 break;
1956 case D_PAG_REQ_3:
1957 msg_s = "PAG3";
1958 break;
1959 case D_SYS_INFO_1:
1960 msg_s = "SI 1";
1961 break;
1962 case D_SYS_INFO_2:
1963 msg_s = "SI 2";
1964 break;
1965 case D_SYS_INFO_2BIS:
1966 msg_s = "SI 2bis";
1967 break;
1968 case D_SYS_INFO_2TER:
1969 msg_s = "SI 2ter";
1970 break;
1971 #if defined (REL99) && defined (TI_PS_FF_EMR)
1972 case D_SYS_INFO_2QUATER:
1973 msg_s = "SI 2quater";
1974 break;
1975 #endif
1976 case D_SYS_INFO_3:
1977 msg_s = "SI 3";
1978 /*
1979 TRACE_EVENT_P8 ("SI3: lai=%x%x%x %x%x%x %02x%02x",
1980 data_ind->l2_frame.content[5]&0x0f,
1981 data_ind->l2_frame.content[5]>>4,
1982 data_ind->l2_frame.content[6]&0x0f,
1983
1984 data_ind->l2_frame.content[7]&0x0f,
1985 data_ind->l2_frame.content[7]>>4,
1986 data_ind->l2_frame.content[6]>>4,
1987
1988 data_ind->l2_frame.content[8],
1989 data_ind->l2_frame.content[9]);
1990 */
1991 break;
1992 case D_SYS_INFO_4:
1993 msg_s = "SI 4";
1994 /*
1995 TRACE_EVENT_P8 ("SI4: lai=%x%x%x %x%x%x %02x%02x",
1996 data_ind->l2_frame.content[3]&0x0f,
1997 data_ind->l2_frame.content[3]>>4,
1998 data_ind->l2_frame.content[4]&0x0f,
1999
2000 data_ind->l2_frame.content[5]&0x0f,
2001 data_ind->l2_frame.content[5]>>4,
2002 data_ind->l2_frame.content[4]>>4,
2003
2004 data_ind->l2_frame.content[6],
2005 data_ind->l2_frame.content[7]);
2006 */
2007 break;
2008 case D_SYS_INFO_5:
2009 msg_s = "SI 5";
2010 break;
2011 case D_SYS_INFO_5BIS:
2012 msg_s = "SI 5bis";
2013 break;
2014 case D_SYS_INFO_5TER:
2015 msg_s = "SI 5ter";
2016 break;
2017 case D_SYS_INFO_6:
2018 msg_s = "SI 6";
2019 break;
2020 #ifdef GPRS
2021 case D_SYS_INFO_13:
2022 msg_s = "SI 13";
2023 break;
2024 #endif /* GPRS */
2025 default:
2026 if (data_ind->l2_channel EQ L2_CHANNEL_CBCH)
2027 msg_s = "CBCH";
2028 else
2029 msg_s = 0;
2030 break;
2031 }
2032 }
2033
2034 #if !defined(DL_TRACE_ENABLED)
2035 if (msg_s)
2036 {
2037 if (v_mon_trc_data_ind & ID_TRC_DATA_IND_STATE)
2038 {
2039 SYST_TRACE_P((SYST, "[%u] %s %s",
2040 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK,
2041 msg_s, STATE_MA_NAME[GET_STATE (STATE_MA)]));
2042 }
2043 else
2044 {
2045 SYST_TRACE_P((SYST, "[%u] %s",
2046 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, msg_s));
2047 }
2048 }
2049 else
2050 {
2051 /* protocol discriminator */
2052 UBYTE pd = data_ind->l2_frame.content[SI_CONTENTS_MSG_T-1];
2053 char buf[47];
2054
2055 if (v_mon_trc_data_ind & ID_TRC_DATA_IND_STATE)
2056 {
2057 SYST_TRACE_P((SYST, "[%u] unknown %02x (PD%02x, ch=%d) %s",
2058 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, msg_t, pd,
2059 data_ind->l2_channel, STATE_MA_NAME[GET_STATE (STATE_MA)]));
2060 }
2061 else
2062 {
2063 SYST_TRACE_P((SYST, "[%u] unknown %02x (PD%02x, ch=%d)",
2064 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK,
2065 msg_t, pd, data_ind->l2_channel));
2066 }
2067 for (pd=0; pd<23; pd++)
2068 sprintf (buf+(pd<<1), "%02x", (UBYTE)data_ind->l2_frame.content[pd]);
2069 SYST_TRACE(buf);
2070 }
2071 #else /* !DL_TRACE_ENABLED */
2072 {
2073 if (msg_s)
2074 {
2075 if (v_mon_trc_data_ind & ID_TRC_DATA_IND_STATE)
2076 {
2077 sprintf (dl_trace_buf, "[%u] %s %s",
2078 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK,
2079 msg_s, STATE_MA_NAME[GET_STATE (STATE_MA)]);
2080 }
2081 else
2082 {
2083 sprintf (dl_trace_buf, "[%u] %s",
2084 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, msg_s);
2085 }
2086 }
2087 else
2088 {
2089 /* protocol discriminator */
2090 UBYTE pd = data_ind->l2_frame.content[SI_CONTENTS_MSG_T-1];
2091
2092 sprintf (dl_trace_buf, "[%u] unknown %02x (PD%02x, ch=%d)",
2093 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK,
2094 msg_t, pd, data_ind->l2_channel);
2095 }
2096 DL_OFFLINE_TRACE (dl_trace_buf);
2097 }
2098 #endif /* !DL_TRACE_ENABLED */
2099 }
2100
2101 /*
2102 +--------------------------------------------------------------------+
2103 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
2104 | STATE : code ROUTINE : trc_state_transition |
2105 +--------------------------------------------------------------------+
2106
2107 PURPOSE : Traces state transition
2108
2109 */
2110
2111
2112 #if !defined(NTRACE) && defined(TRACE_STATE_TRANSITION)
2113 void trc_state_transition(int line, UBYTE newstate)
2114 {
2115 #if defined(DL_TRACE_ENABLED)
2116 sprintf (dl_trace_buf, "%s->%s (#%u)",
2117 STATE_MA_NAME[GET_STATE (STATE_MA)], STATE_MA_NAME[newstate], line);
2118 DL_OFFLINE_TRACE (dl_trace_buf);
2119 #else /* DL_TRACE_ENABLED */
2120 SYST_TRACE_P((SYST, "%s->%s (#%u)",
2121 STATE_MA_NAME[GET_STATE (STATE_MA)], STATE_MA_NAME[newstate], line));
2122 #endif /* DL_TRACE_ENABLED */
2123 }
2124 #endif /* !NTRACE && TRACE_STATE_TRANSITION */
2125 #endif /* !NCONFIG */
2126
2127 /*
2128 +--------------------------------------------------------------------+
2129 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
2130 | STATE : code ROUTINE : trc_paging |
2131 +--------------------------------------------------------------------+
2132
2133 PURPOSE : Traces state transition
2134
2135 */
2136
2137
2138 #if !defined(NTRACE) && 0
2139 void trc_paging(T_MPHC_DATA_IND* data_ind)
2140 {
2141 if ((data_ind->error_flag EQ VALID_BLOCK) AND
2142 ((data_ind->l2_channel EQ L2_CHANNEL_PCH) OR
2143 (data_ind->l2_channel EQ L2_CHANNEL_EPCH)))
2144 {
2145 char *str;
2146
2147 switch (data_ind->l2_frame.content[SI_CONTENTS_MSG_T]) // SI_CONTENTS_MSG_T=2
2148 {
2149 case D_PAG_REQ_1:
2150 str="D_PAG_REQ_1";
2151 break;
2152 case D_PAG_REQ_2:
2153 str="D_PAG_REQ_2";
2154 break;
2155 case D_PAG_REQ_3:
2156 str="D_PAG_REQ_3";
2157 break;
2158 default:
2159 str = NULL;
2160 break;
2161 }
2162
2163 if (str)
2164 {
2165 /* TRACE_BINDUMP first available with FRAME_2.9.18 */
2166 #ifdef TI_PS_HCOMM_CHANGE
2167 TRACE_BINDUMP(_hCommPL ,TC_EVENT, str, data_ind->l2_frame.content,
2168 MAX_L2_FRAME_SIZE);
2169 #else
2170 TRACE_BINDUMP(hCommPL ,TC_EVENT, str, data_ind->l2_frame.content,
2171 MAX_L2_FRAME_SIZE);
2172 #endif /* TI_PS_HCOMM_CHANGE */
2173 }
2174 }
2175
2176 }
2177 #endif /* !NTRACE */
2178
2179 /*
2180 +--------------------------------------------------------------------+
2181 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
2182 | STATE : code ROUTINE : ma_mphc_data_ind |
2183 +--------------------------------------------------------------------+
2184
2185 PURPOSE : Process the primitive MPHC_DATA_IND.
2186
2187 */
2188
2189 GLOBAL void ma_mphc_data_ind (T_MPHC_DATA_IND* data_ind)
2190 {
2191 GET_INSTANCE_DATA;
2192 USHORT length=0, valid=0;
2193 UBYTE msg_t;
2194
2195 alr_trc_read (1);
2196
2197 #if !defined(NTRACE) && 0
2198 trc_paging(data_ind);
2199 #endif /* !NTRACE */
2200
2201 #if !defined(NCONFIG)
2202 if (v_mon_trc_data_ind)
2203 ma_trc_data_ind(data_ind);
2204
2205 /* IOT and FT trace */
2206 if (data_ind->l2_channel NEQ L2_CHANNEL_CBCH AND
2207 data_ind->l2_channel NEQ L2_CHANNEL_SACCH)
2208 {
2209 /* Implements Measure#32: Row 90,...,101 */
2210 if(data_ind->error_flag EQ VALID_BLOCK)
2211 {
2212 length = MAX_L2_FRAME_SIZE;
2213 valid = 1;
2214 }
2215 switch (data_ind->l2_frame.content[SI_CONTENTS_MSG_T])
2216 {
2217 case D_SYS_INFO_1:
2218 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_1 block: Valid=%d",
2219 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2220 break;
2221 case D_SYS_INFO_2:
2222 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_2 block: Valid=%d",
2223 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2224 break;
2225 case D_SYS_INFO_2BIS:
2226 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_2BIS block: Valid=%d",
2227 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2228 break;
2229 case D_SYS_INFO_2TER:
2230 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_2TER block: Valid=%d",
2231 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2232 break;
2233 #if defined (REL99) && defined (TI_PS_FF_EMR)
2234 case D_SYS_INFO_2QUATER:
2235 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_2QUATER block: Valid=%d",
2236 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2237 break;
2238 #endif
2239 case D_SYS_INFO_3:
2240 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_3 block: Valid=%d",
2241 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2242 break;
2243 case D_SYS_INFO_4:
2244 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_4 block: Valid=%d",
2245 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2246 break;
2247 #ifdef GPRS
2248 case D_SYS_INFO_13:
2249 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_SYS_INFO_13 block: Valid=%d",
2250 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2251 break;
2252 #endif
2253 case D_IMM_ASSIGN:
2254 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_IMM_ASSIGN block: Valid=%d",
2255 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2256 break;
2257 case D_IMM_ASSIGN_EXT:
2258 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_IMM_ASSIGN_EXT block: Valid=%d",
2259 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2260 break;
2261 case D_IMM_ASSIGN_REJ:
2262 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] D_IMM_ASSIGN_REJ block: Valid=%d",
2263 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2264 break;
2265 case D_PAG_REQ_1:
2266 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] PAG_REQ_1 DL block: Valid=%d",
2267 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2268 break;
2269 case D_PAG_REQ_2:
2270 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] PAG_REQ_2 DL block: Valid=%d",
2271 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2272 break;
2273 case D_PAG_REQ_3:
2274 TRACE_USER_CLASS_P2 (TC_USER4, "[%u] PAG_REQ_3 DL block: Valid=%d",
2275 ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK, valid);
2276 break;
2277 default:
2278 break;
2279 }
2280 switch (data_ind->l2_frame.content[SI_CONTENTS_MSG_T])
2281 {
2282 case D_SYS_INFO_1:
2283 #ifdef TI_PS_HCOMM_CHANGE
2284 TRACE_BINDUMP(_hCommPL , TC_USER4,
2285 "D_SYS_INFO_1",
2286 data_ind->l2_frame.content,
2287 length);
2288 #else /* not TI_PS_HCOMM_CHANGE */
2289 TRACE_BINDUMP(hCommPL , TC_USER4,
2290 "D_SYS_INFO_1",
2291 data_ind->l2_frame.content,
2292 length);
2293 #endif /* TI_PS_HCOMM_CHANGE */
2294 break;
2295 case D_SYS_INFO_2:
2296 #ifdef TI_PS_HCOMM_CHANGE
2297 TRACE_BINDUMP(_hCommPL , TC_USER4,
2298 "D_SYS_INFO_2",
2299 data_ind->l2_frame.content,
2300 length);
2301 #else /* not TI_PS_HCOMM_CHANGE */
2302 TRACE_BINDUMP(hCommPL , TC_USER4,
2303 "D_SYS_INFO_2",
2304 data_ind->l2_frame.content,
2305 length);
2306 #endif /* TI_PS_HCOMM_CHANGE */
2307 break;
2308 case D_SYS_INFO_2BIS:
2309 #ifdef TI_PS_HCOMM_CHANGE
2310 TRACE_BINDUMP(_hCommPL , TC_USER4,
2311 "D_SYS_INFO_2BIS",
2312 data_ind->l2_frame.content,
2313 length);
2314 #else /* not TI_PS_HCOMM_CHANGE */
2315 TRACE_BINDUMP(hCommPL , TC_USER4,
2316 "D_SYS_INFO_2BIS",
2317 data_ind->l2_frame.content,
2318 length);
2319 #endif /* TI_PS_HCOMM_CHANGE */
2320 break;
2321 case D_SYS_INFO_2TER:
2322 #ifdef TI_PS_HCOMM_CHANGE
2323 TRACE_BINDUMP(_hCommPL , TC_USER4,
2324 "D_SYS_INFO_2TER",
2325 data_ind->l2_frame.content,
2326 length);
2327 #else /* not TI_PS_HCOMM_CHANGE */
2328 TRACE_BINDUMP(hCommPL , TC_USER4,
2329 "D_SYS_INFO_2TER",
2330 data_ind->l2_frame.content,
2331 length);
2332 #endif /* TI_PS_HCOMM_CHANGE */
2333 break;
2334 #if defined (REL99) && defined (TI_PS_FF_EMR)
2335 case D_SYS_INFO_2QUATER:
2336 #ifdef TI_PS_HCOMM_CHANGE
2337 TRACE_BINDUMP(_hCommPL , TC_USER4,
2338 "D_SYS_INFO_2QUATER",
2339 data_ind->l2_frame.content,
2340 length);
2341 #else /* not TI_PS_HCOMM_CHANGE */
2342 TRACE_BINDUMP(hCommPL , TC_USER4,
2343 "D_SYS_INFO_2QUATER",
2344 data_ind->l2_frame.content,
2345 length);
2346 #endif /* TI_PS_HCOMM_CHANGE */
2347 break;
2348 #endif
2349 case D_SYS_INFO_3:
2350 #ifdef TI_PS_HCOMM_CHANGE
2351 TRACE_BINDUMP(_hCommPL , TC_USER4,
2352 "D_SYS_INFO_3",
2353 data_ind->l2_frame.content,
2354 length);
2355 #else /* not TI_PS_HCOMM_CHANGE */
2356 TRACE_BINDUMP(hCommPL , TC_USER4,
2357 "D_SYS_INFO_3",
2358 data_ind->l2_frame.content,
2359 length);
2360 #endif /* TI_PS_HCOMM_CHANGE */
2361 break;
2362 case D_SYS_INFO_4:
2363 #ifdef TI_PS_HCOMM_CHANGE
2364 TRACE_BINDUMP(_hCommPL , TC_USER4,
2365 "D_SYS_INFO_4",
2366 data_ind->l2_frame.content,
2367 length);
2368 #else /* not TI_PS_HCOMM_CHANGE */
2369 TRACE_BINDUMP(hCommPL , TC_USER4,
2370 "D_SYS_INFO_4",
2371 data_ind->l2_frame.content,
2372 length);
2373 #endif /* TI_PS_HCOMM_CHANGE */
2374 break;
2375 #ifdef GPRS
2376 case D_SYS_INFO_13:
2377 #ifdef TI_PS_HCOMM_CHANGE
2378 TRACE_BINDUMP(_hCommPL , TC_USER4,
2379 "D_SYS_INFO_13",
2380 data_ind->l2_frame.content,
2381 length);
2382 #else /* not TI_PS_HCOMM_CHANGE */
2383 TRACE_BINDUMP(hCommPL , TC_USER4,
2384 "D_SYS_INFO_13",
2385 data_ind->l2_frame.content,
2386 length);
2387 #endif /* TI_PS_HCOMM_CHANGE */
2388 break;
2389 #endif
2390 case D_IMM_ASSIGN:
2391 #ifdef TI_PS_HCOMM_CHANGE
2392 TRACE_BINDUMP(_hCommPL , TC_USER4,
2393 "D_IMM_ASSIGN",
2394 data_ind->l2_frame.content,
2395 length);
2396 #else /* not TI_PS_HCOMM_CHANGE */
2397 TRACE_BINDUMP(hCommPL , TC_USER4,
2398 "D_IMM_ASSIGN",
2399 data_ind->l2_frame.content,
2400 length);
2401 #endif /* TI_PS_HCOMM_CHANGE */
2402 break;
2403 case D_IMM_ASSIGN_EXT:
2404 #ifdef TI_PS_HCOMM_CHANGE
2405 TRACE_BINDUMP(_hCommPL , TC_USER4,
2406 "D_IMM_ASSIGN_EXT",
2407 data_ind->l2_frame.content,
2408 length);
2409 #else /* not TI_PS_HCOMM_CHANGE */
2410 TRACE_BINDUMP(hCommPL , TC_USER4,
2411 "D_IMM_ASSIGN_EXT",
2412 data_ind->l2_frame.content,
2413 length);
2414 #endif /* TI_PS_HCOMM_CHANGE */
2415 break;
2416 case D_IMM_ASSIGN_REJ:
2417 #ifdef TI_PS_HCOMM_CHANGE
2418 TRACE_BINDUMP(_hCommPL , TC_USER4,
2419 "D_IMM_ASSIGN_REJ",
2420 data_ind->l2_frame.content,
2421 length);
2422 #else /* not TI_PS_HCOMM_CHANGE */
2423 TRACE_BINDUMP(hCommPL , TC_USER4,
2424 "D_IMM_ASSIGN_REJ",
2425 data_ind->l2_frame.content,
2426 length);
2427 #endif /* TI_PS_HCOMM_CHANGE */
2428 break;
2429 case D_PAG_REQ_1:
2430 #ifdef TI_PS_HCOMM_CHANGE
2431 TRACE_BINDUMP(_hCommPL , TC_USER4,
2432 "PAG_REQ_1 DL",
2433 data_ind->l2_frame.content,
2434 length);
2435 #else /* not TI_PS_HCOMM_CHANGE */
2436 TRACE_BINDUMP(hCommPL , TC_USER4,
2437 "PAG_REQ_1 DL",
2438 data_ind->l2_frame.content,
2439 length);
2440 #endif /* TI_PS_HCOMM_CHANGE */
2441 break;
2442 case D_PAG_REQ_2:
2443 #ifdef TI_PS_HCOMM_CHANGE
2444 TRACE_BINDUMP(_hCommPL , TC_USER4,
2445 "PAG_REQ_2 DL",
2446 data_ind->l2_frame.content,
2447 length);
2448 #else /* not TI_PS_HCOMM_CHANGE */
2449 TRACE_BINDUMP(hCommPL , TC_USER4,
2450 "PAG_REQ_2 DL",
2451 data_ind->l2_frame.content,
2452 length);
2453 #endif /* TI_PS_HCOMM_CHANGE */
2454 break;
2455 case D_PAG_REQ_3:
2456 #ifdef TI_PS_HCOMM_CHANGE
2457 TRACE_BINDUMP(_hCommPL , TC_USER4,
2458 "PAG_REQ_3 DL",
2459 data_ind->l2_frame.content,
2460 length);
2461 #else /* not TI_PS_HCOMM_CHANGE */
2462 TRACE_BINDUMP(hCommPL , TC_USER4,
2463 "PAG_REQ_3 DL",
2464 data_ind->l2_frame.content,
2465 length);
2466 #endif /* TI_PS_HCOMM_CHANGE */
2467 break;
2468 default:
2469 break;
2470 }
2471 }
2472 #endif /* !NCONFIG */
2473
2474
2475 if (data_ind->l2_channel EQ L2_CHANNEL_CBCH)
2476 {
2477 cb_data_ind (data_ind);
2478 }
2479 else
2480 {
2481 if (data_ind->error_flag EQ VALID_BLOCK AND
2482 data_ind->l2_channel EQ L2_CHANNEL_SACCH)
2483 {
2484 /*
2485 * store Timing Advance contained in every decodable downlink SACCH frame
2486 */
2487 nc_store_tav((USHORT)(data_ind->l2_frame.content[1] & 63));
2488 }
2489
2490 msg_t = data_ind->l2_frame.content[SI_CONTENTS_MSG_T];
2491 switch (GET_STATE (STATE_MA))
2492 {
2493 case MA_NULL:
2494 /*
2495 * no message expected
2496 */
2497 break;
2498 case MA_CELL_SELECTION:
2499 if (data_ind->error_flag EQ VALID_BLOCK)
2500 {
2501 ALR_TRACE_MAIN_VALID_BLOCK(msg_t);
2502
2503 switch (msg_t)
2504 {
2505 case D_SYS_INFO_1:
2506 case D_SYS_INFO_2:
2507 case D_SYS_INFO_2BIS:
2508 case D_SYS_INFO_2TER:
2509 #if defined (REL99) && defined (TI_PS_FF_EMR)
2510 case D_SYS_INFO_2QUATER:
2511 #endif
2512 case D_SYS_INFO_3:
2513 case D_SYS_INFO_4:
2514 #ifdef GPRS
2515 case D_SYS_INFO_13:
2516 #endif
2517 switch(data_ind->l2_channel)
2518 {
2519 case L2_CHANNEL_NBCCH:
2520 if (data_ind->tc EQ 0 AND msg_t NEQ D_SYS_INFO_1)
2521 ma_sync_ind (CS_SYS_INFO_1_NOT_NEEDED,
2522 ARFCN_TO_G23(data_ind->radio_freq));
2523 /*lint -fallthrough*/
2524 case L2_CHANNEL_EBCCH:
2525 ma_send_unitdata (data_ind);
2526 ma_fill_sys_buffer (data_ind, msg_t);
2527
2528 ma_set_si_bitmap(msg_t);
2529
2530 ALR_EM_IDLE_MODE_BCCH_PARAMETER_CHANGED;
2531 cs_increment_bfc();
2532
2533 break;
2534 default:
2535 ALR_TRACE_MAIN ("stray SI");
2536 break;
2537 }
2538 break;
2539 default:
2540 break;
2541 }
2542 }
2543 else
2544 {
2545 ALR_TRACE_MAIN ("INVALID BLOCK");
2546 if (data_ind->l2_channel EQ L2_CHANNEL_NBCCH OR
2547 data_ind->l2_channel EQ L2_CHANNEL_EBCCH)
2548 {
2549 ma_error_ind (CS_BCCH_READ_ERROR,
2550 ARFCN_TO_G23(data_ind->radio_freq));
2551 cs_decrement_bfc();
2552 }
2553 }
2554 break;
2555 case MA_IDLE:
2556 if (data_ind->error_flag EQ VALID_BLOCK)
2557 {
2558 switch (msg_t)
2559 {
2560 case D_SYS_INFO_2:
2561 /*
2562 * setting ncc permitted directly after receive sys info 2
2563 */
2564 nc_check_new_ncc_permitted (data_ind->l2_frame.content[SI_CONTENTS_MSG_T+17]);
2565 /*lint -fallthrough*/
2566 case D_SYS_INFO_1:
2567 case D_SYS_INFO_2BIS:
2568 case D_SYS_INFO_2TER:
2569 case D_SYS_INFO_3:
2570 case D_SYS_INFO_4:
2571 if(data_ind->l2_channel NEQ L2_CHANNEL_NBCCH)
2572 {
2573 ALR_TRACE_MAIN ("stray SI");
2574 }
2575
2576 if (data_ind->tc EQ 0 AND msg_t NEQ D_SYS_INFO_1)
2577 {
2578 ma_sync_ind (CS_SYS_INFO_1_NOT_NEEDED,
2579 ARFCN_TO_G23(data_ind->radio_freq));
2580 alr_data->pch_data.si_bitmap |= SYSTEM_INFO_1_READ;
2581 }
2582
2583 if( alr_data->pch_data.reorg_bcch_reading EQ TRUE)
2584 {
2585 if(msg_t EQ D_SYS_INFO_1)
2586 alr_data->pch_data.si_bitmap |= SYSTEM_INFO_1_READ;
2587 else if(msg_t EQ D_SYS_INFO_2)
2588 alr_data->pch_data.si_bitmap |= SYSTEM_INFO_2_READ;
2589 else if(msg_t EQ D_SYS_INFO_3)
2590 alr_data->pch_data.si_bitmap |= SYSTEM_INFO_3_READ;
2591 else if(msg_t EQ D_SYS_INFO_4)
2592 alr_data->pch_data.si_bitmap |= SYSTEM_INFO_4_READ;
2593
2594 ma_set_si_bitmap(msg_t);
2595
2596 #ifdef GPRS
2597 if( !gprs_alr_is_supported() )
2598 #endif
2599 {
2600 if( (alr_data->pch_data.si_bitmap & ALL_SI_READ_EXCEPT_SI13)
2601 EQ ALL_SI_READ_EXCEPT_SI13)
2602 {
2603 alr_data->pch_data.reorg_bcch_reading = FALSE;
2604 if((alr_data->pch_data.pl_idle.page_mode EQ PGM_NORMAL) OR
2605 (alr_data->pch_data.pl_idle.page_mode EQ PGM_EXTENDED))
2606 {
2607 sc_start_periodic();
2608 }
2609 }
2610 }
2611 }
2612 if (!ma_compare_sys_buffer (data_ind, msg_t))
2613 {
2614 ALR_TRACE_MAIN_SI_UNEQ(data_ind->l2_channel);
2615
2616 ma_send_unitdata (data_ind);
2617 ma_fill_sys_buffer (data_ind, msg_t);
2618
2619 ALR_EM_IDLE_MODE_BCCH_PARAMETER_CHANGED;
2620
2621 }
2622 #if defined (REL99) && defined (TI_PS_FF_EMR)
2623 if ( (msg_t EQ D_SYS_INFO_2) OR (msg_t EQ D_SYS_INFO_2BIS) OR (msg_t EQ D_SYS_INFO_2TER) )
2624 {
2625 if ( (alr_data->nc_data.si2_count NEQ NOT_PRESENT_8BIT ) AND
2626 (alr_data->nc_data.si2_count NEQ 0) )
2627 alr_data->nc_data.si2_count--;
2628 /*Required SI-2 variants have been acquired, now we will configure
2629 L1 for SI-2quater if it's required to be configured*/
2630 if ((alr_data->nc_data.si2quater_status NEQ SI2QUATER_ABSENT ) AND
2631 (alr_data->nc_data.si2quater_pos EQ SI2QUATER_ON_EBCCH) AND
2632 (alr_data->nc_data.si2_count EQ 0))
2633 {
2634 ma_scell_mon_si2quater_ebcch();
2635 alr_data->nc_data.si2_count = NOT_PRESENT_8BIT;
2636 }
2637 }
2638 break;
2639 case D_SYS_INFO_2QUATER:
2640 ALR_TRACE_MAIN_SI_UNEQ(data_ind->l2_channel);
2641 ma_send_unitdata (data_ind);
2642 #endif
2643 break;
2644 #ifdef GPRS
2645 case D_SYS_INFO_13:
2646 if(gprs_alr_is_supported())
2647 {
2648 alr_data->pch_data.si_bitmap |= SYSTEM_INFO_13_READ;
2649 alr_data->pch_data.reorg_bcch_reading = FALSE;
2650 }
2651 if(! pch_mode_reorg() AND gprs_alr_is_supported())
2652 {
2653 /* stop scell BCCH */
2654 ma_stop_scell_bcch_req();
2655 }
2656 ma_send_unitdata (data_ind);
2657 ma_fill_sys_buffer (data_ind, msg_t);
2658
2659 ALR_EM_IDLE_MODE_BCCH_PARAMETER_CHANGED;
2660
2661 ALR_TRACE_MAIN ("SI13");
2662 break;
2663 #endif /* GPRS */
2664
2665 case D_PAG_REQ_1:
2666 ALR_TRACE_MAIN("PG1");
2667
2668 pch_check_pag_1 (data_ind);
2669
2670 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2671 {
2672 /*
2673 * check only if it is the own paging group
2674 */
2675 #ifdef GPRS
2676 gprs_check_page_mode(data_ind);
2677 #else
2678 pch_check_page_mode (data_ind);
2679 #endif /* GPRS */
2680 pch_increment_dlt ();
2681 }
2682 break;
2683 case D_PAG_REQ_2:
2684 ALR_TRACE_MAIN ("PG2");
2685 if (alr_data->pch_data.pl_idle.page_mode EQ PGM_NORMAL)
2686 {
2687 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2688 pch_check_pag_2 (data_ind);
2689 else
2690 {
2691 ALR_TRACE_MAIN ("PCH block skipped");
2692 }
2693 }
2694 else
2695 pch_check_pag_2 (data_ind);
2696 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2697 {
2698 /* check only if it is the own paging group */
2699 #ifdef GPRS
2700 gprs_check_page_mode(data_ind);
2701 #else
2702 pch_check_page_mode (data_ind);
2703 #endif /* GPRS */
2704 pch_increment_dlt ();
2705 }
2706 break;
2707 case D_PAG_REQ_3:
2708 ALR_TRACE_MAIN ("PG3");
2709
2710 if (alr_data->pch_data.pl_idle.page_mode EQ PGM_NORMAL)
2711 {
2712 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2713 pch_check_pag_3 (data_ind);
2714 else
2715 {
2716 ALR_TRACE_MAIN ("PCH block skipped");
2717 }
2718 }
2719 else
2720 pch_check_pag_3 (data_ind);
2721 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2722 {
2723 /* check only if it is the own paging group */
2724 #ifdef GPRS
2725 gprs_check_page_mode(data_ind);
2726 #else
2727 pch_check_page_mode (data_ind);
2728 #endif/* GPRS */
2729 pch_increment_dlt ();
2730 }
2731 break;
2732 case D_IMM_ASSIGN:
2733 #ifdef GPRS
2734 gprs_alr_check_downlink_assign(data_ind);
2735 /*lint -fallthrough*/
2736 #endif
2737 case D_IMM_ASSIGN_EXT:
2738 case D_IMM_ASSIGN_REJ:
2739 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2740 {
2741 /* check only if it is the own paging group */
2742 #ifdef GPRS
2743 gprs_check_page_mode(data_ind);
2744 #else
2745 pch_check_page_mode (data_ind);
2746 #endif /* GPRS */
2747 pch_increment_dlt ();
2748 }
2749 break;
2750 default:
2751 break;
2752 } /* message type */
2753 }
2754 else
2755 {
2756 /*
2757 * invalid block
2758 */
2759 ALR_TRACE_MAIN ("INVALID");
2760 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2761 pch_decrement_dlt ();
2762 }
2763 break;
2764 #ifdef GPRS
2765 case MA_PTM:
2766 if (data_ind->error_flag EQ VALID_BLOCK)
2767 {
2768 switch (msg_t)
2769 {
2770 case D_SYS_INFO_2:
2771 /*
2772 * setting ncc permitted directly after receive sys info 2
2773 */
2774 nc_check_new_ncc_permitted (data_ind->l2_frame.content[SI_CONTENTS_MSG_T+17]);
2775 /*lint -fallthrough*/
2776 case D_SYS_INFO_1:
2777 case D_SYS_INFO_2BIS:
2778 case D_SYS_INFO_2TER:
2779 #if defined (REL99) && defined (TI_PS_FF_EMR)
2780 case D_SYS_INFO_2QUATER:
2781 #endif
2782 case D_SYS_INFO_3:
2783 case D_SYS_INFO_4:
2784 if(data_ind->l2_channel NEQ L2_CHANNEL_NBCCH)
2785 {
2786 ALR_TRACE_MAIN ("stray SI");
2787 }
2788 if (data_ind->tc EQ 0 AND msg_t NEQ D_SYS_INFO_1)
2789 ma_sync_ind (CS_SYS_INFO_1_NOT_NEEDED,
2790 ARFCN_TO_G23(data_ind->radio_freq));
2791 if (!ma_compare_sys_buffer (data_ind, msg_t))
2792 {
2793 ALR_TRACE_MAIN_SI_UNEQ(data_ind->l2_channel);
2794
2795 ma_send_unitdata (data_ind);
2796 ma_fill_sys_buffer (data_ind, msg_t);
2797
2798 ALR_EM_IDLE_MODE_BCCH_PARAMETER_CHANGED;
2799
2800 }
2801 break;
2802 case D_SYS_INFO_13:
2803 /* stop scell BCCH */
2804 ma_stop_scell_bcch_req();
2805
2806 ma_send_unitdata (data_ind);
2807
2808 ALR_EM_IDLE_MODE_BCCH_PARAMETER_CHANGED;
2809
2810 ma_fill_sys_buffer (data_ind, msg_t);
2811 break;
2812 case D_PAG_REQ_1:
2813 ALR_TRACE_MAIN("PG1");
2814
2815 pch_check_pag_1 (data_ind);
2816
2817 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2818 {
2819 /*
2820 * check only if it is the own paging group
2821 */
2822 //pch_increment_dlt ();
2823 }
2824 break;
2825 case D_PAG_REQ_2:
2826 pch_check_pag_2 (data_ind);
2827 //pch_increment_dlt ();
2828
2829 break;
2830 case D_PAG_REQ_3:
2831 pch_check_pag_3 (data_ind);
2832 //pch_increment_dlt ();
2833 break;
2834 default:
2835 break;
2836 }
2837 }
2838 break;
2839 #endif /* GPRS */
2840 case MA_CELL_RESELECTION:
2841 if (data_ind->error_flag EQ VALID_BLOCK)
2842 {
2843 ALR_TRACE_MAIN_CR(msg_t);
2844
2845 switch (msg_t)
2846 {
2847 case D_IMM_ASSIGN:
2848 #ifdef GPRS
2849 TRACE_EVENT_P1 ("downlink assign %02x", data_ind->l2_frame.content[3]);
2850 gprs_alr_check_downlink_assign(data_ind);
2851 /*lint -fallthrough*/
2852 #endif
2853 case D_IMM_ASSIGN_EXT:
2854 case D_IMM_ASSIGN_REJ:
2855 break;
2856 case D_PAG_REQ_1:
2857 ALR_TRACE_MAIN ("PG1");
2858 pch_check_pag_1 (data_ind);
2859 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2860 {
2861 pch_increment_dlt ();
2862 pch_check_page_mode_cr (data_ind);
2863 }
2864 break;
2865 case D_PAG_REQ_2:
2866 ALR_TRACE_MAIN ("PG2");
2867 pch_check_pag_2 (data_ind);
2868 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2869 {
2870 pch_increment_dlt ();
2871 pch_check_page_mode_cr (data_ind);
2872 }
2873 break;
2874 case D_PAG_REQ_3:
2875 ALR_TRACE_MAIN ("PG3");
2876 pch_check_pag_3 (data_ind);
2877 if (data_ind->l2_channel EQ L2_CHANNEL_PCH)
2878 {
2879 pch_increment_dlt ();
2880 pch_check_page_mode_cr (data_ind);
2881 }
2882 break;
2883 case D_SYS_INFO_1:
2884 case D_SYS_INFO_2:
2885 case D_SYS_INFO_2BIS:
2886 case D_SYS_INFO_2TER:
2887 #if defined (REL99) && defined (TI_PS_FF_EMR)
2888 case D_SYS_INFO_2QUATER:
2889 #endif
2890 case D_SYS_INFO_3:
2891 case D_SYS_INFO_4:
2892 #ifdef GPRS
2893 case D_SYS_INFO_13:
2894 #endif
2895 ALR_TRACE_MAIN ("cr si");
2896 if (data_ind->tc EQ 0 AND msg_t NEQ D_SYS_INFO_1)
2897 ma_sync_ind (CS_SYS_INFO_1_NOT_NEEDED, ARFCN_TO_G23(data_ind->radio_freq));
2898 ma_send_unitdata (data_ind);
2899 ma_fill_sys_buffer (data_ind, msg_t);
2900
2901 ma_set_si_bitmap(msg_t);
2902 ALR_EM_IDLE_MODE_BCCH_PARAMETER_CHANGED;
2903
2904 /*
2905 * When having received all SI in cell reselection state RR will
2906 * send an MPH_IDLE_REQ and ALR will send an MPHC_START_CCCH_REQ
2907 * This is not a good timing for FTA 20.19 because L1 is then
2908 * unable to detect a paging for some blocks. The test device will
2909 * not send the paging near the SI3. Therefore the
2910 * MPHC_START_CCCH_REQ is sent here (and may be overwritten be the
2911 * later when ALR receives the MPH_IDLE_REQ with other parameters).
2912 */
2913 if (msg_t EQ D_SYS_INFO_3 AND
2914 alr_data->pch_data.imsi[0] AND
2915 ARFCN_TO_G23(data_ind->radio_freq) EQ alr_data->serving_cell)
2916 pch_config_resel(data_ind);
2917 break;
2918 default:
2919 break;
2920 }
2921 }
2922 else /* invalid block */
2923 {
2924 if (data_ind->l2_channel EQ L2_CHANNEL_NBCCH OR
2925 data_ind->l2_channel EQ L2_CHANNEL_EBCCH)
2926 {
2927 ALR_TRACE_MAIN ("INVALID BLOCK");
2928 ma_error_ind (CS_BCCH_READ_ERROR,
2929 ARFCN_TO_G23(data_ind->radio_freq));
2930 cs_decrement_bfc();
2931 }
2932 }
2933
2934 break;
2935 case MA_CON_EST:
2936 if (data_ind->error_flag EQ VALID_BLOCK)
2937 {
2938 switch (msg_t)
2939 {
2940 case D_IMM_ASSIGN:
2941 case D_IMM_ASSIGN_EXT:
2942 case D_IMM_ASSIGN_REJ:
2943 ALR_TRACE_MAIN ("IA");
2944 ma_send_unitdata (data_ind);
2945 break;
2946 #ifdef GPRS
2947 case D_PAG_REQ_1:
2948 pch_check_pag_1 (data_ind);
2949 break;
2950 case D_PAG_REQ_2:
2951 pch_check_pag_2 (data_ind);
2952 break;
2953 case D_PAG_REQ_3:
2954 pch_check_pag_3 (data_ind);
2955 break;
2956 #endif /* GPRS */
2957 default:
2958 break;
2959 }
2960 }
2961 break;
2962 case MA_DEDICATED:
2963 if (data_ind->error_flag EQ VALID_BLOCK)
2964 {
2965 switch (data_ind->l2_channel)
2966 {
2967 case L2_CHANNEL_SACCH:
2968 if ((data_ind->l2_frame.content[3] & 0xEF) EQ 3) /* layer 2 Control field octet */
2969 {
2970 /*
2971 * check control field of l2 header
2972 * UI Frame received
2973 */
2974 UBYTE msg_t = data_ind->l2_frame.content[6]; /* layer 3 Message Type octet */
2975
2976 switch (msg_t)
2977 {
2978 case D_SYS_INFO_6:
2979 /*
2980 * setting ncc permitted directly after receive sys info 6
2981 */
2982 nc_check_new_ncc_permitted (data_ind->l2_frame.content[15]);
2983
2984 /*lint -fallthrough*/
2985 case D_SYS_INFO_5:
2986 case D_SYS_INFO_5BIS:
2987 case D_SYS_INFO_5TER:
2988
2989 if (!ma_compare_dedi_sys_buffer (data_ind, msg_t))
2990 {
2991 ma_send_dedi_unitdata (data_ind);
2992 ma_fill_dedi_sys_buffer (data_ind, msg_t);
2993 }
2994 break;
2995
2996 case D_EXT_MEAS_ORDER:
2997 ma_send_dedi_unitdata (data_ind);
2998 break;
2999
3000 default:
3001 break;
3002 }
3003 }
3004 else
3005 {
3006 /*
3007 * no unacknowledged frame or short PD header (format type Bter)
3008 * must be handled by DL
3009 * is forwarded in original primitive format
3010 */
3011 ma_dedi_data_out ((T_PH_DATA_IND *)data_ind);
3012 data_ind = NULL; /* must not be freed by ALR */
3013 }
3014 dedi_increment_rlt ();
3015 break;
3016 default:
3017 break;
3018 } /*l2_channel*/
3019 }
3020 else
3021 {
3022 /* invalid block */
3023 if (data_ind->l2_channel EQ L2_CHANNEL_SACCH)
3024 dedi_decrement_rlt ();
3025 }
3026 break;
3027 default:
3028 break;
3029 }
3030 }
3031
3032 if (data_ind)
3033 {
3034 PFREE (data_ind);
3035 }
3036 }
3037
3038
3039 /*
3040 +----------------------------------------------------------------------+
3041 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3042 | STATE : code ROUTINE : ma_mphc_change_frequency_cnf |
3043 +----------------------------------------------------------------------+
3044
3045 PURPOSE : Process the primitive MPHC_CHANGE_FREQUENCY_CON.
3046
3047 */
3048
3049 GLOBAL void ma_mphc_change_frequency_cnf (T_MPHC_CHANGE_FREQUENCY_CON* change_frequency_cnf)
3050 {
3051 PFREE (change_frequency_cnf);
3052 dedi_change_freq_cnf ();
3053 }
3054
3055 /*
3056 +--------------------------------------------------------------------+
3057 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3058 | STATE : code ROUTINE : ma_mphc_async_ho_cnf |
3059 +--------------------------------------------------------------------+
3060
3061 PURPOSE : Process the primitive MPHC_ASYNC_HO_CNF.
3062
3063 */
3064
3065 GLOBAL void ma_mphc_async_ho_cnf (T_MPHC_ASYNC_HO_CON* async_ho_cnf)
3066 {
3067 PFREE (async_ho_cnf);
3068 dedi_ho_cnf(HO_TYPE_ASYNC);
3069 }
3070
3071 /*
3072 +---------------------------------------------------------------------+
3073 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3074 | STATE : code ROUTINE : ma_mphc_channel_assign_cnf |
3075 +---------------------------------------------------------------------+
3076
3077 PURPOSE : Process the primitive MPHC_CHANNEL_ASSIGN_CON.
3078
3079 */
3080
3081 GLOBAL void ma_mphc_channel_assign_cnf (T_MPHC_CHANNEL_ASSIGN_CON* channel_assign_cnf)
3082 {
3083 PFREE (channel_assign_cnf);
3084 #if defined(DL_TRACE_ENABLED)
3085 DL_OFFLINE_TRACE ("MPHC_CHANNEL_ASSIGN_CON");
3086 #else
3087 SYST_TRACE ("dedi chan ass con");
3088 #endif /* DL_TRACE_ENABLED */
3089 dedi_chan_ass_cnf ();
3090 }
3091
3092 /*
3093 +--------------------------------------------------------------------+
3094 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3095 | STATE : code ROUTINE : ma_mphc_handover_fail_cnf |
3096 +--------------------------------------------------------------------+
3097
3098 PURPOSE : Process the primitive MPHC_HANDOVER_FAIL_CON.
3099
3100 */
3101
3102 GLOBAL void ma_mphc_handover_fail_cnf (T_MPHC_HANDOVER_FAIL_CON* handover_fail_cnf)
3103 {
3104 PFREE (handover_fail_cnf);
3105 dedi_ho_fail_cnf ();
3106 }
3107
3108 /*
3109 +--------------------------------------------------------------------+
3110 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3111 | STATE : code ROUTINE : ma_mphc_immed_assign_cnf |
3112 +--------------------------------------------------------------------+
3113
3114 PURPOSE : Process the primitive MPHC_IMMED_ASSIGN_CON.
3115
3116 */
3117
3118 GLOBAL void ma_mphc_immed_assign_cnf (T_MPHC_IMMED_ASSIGN_CON* immed_assign_cnf)
3119 {
3120 PFREE (immed_assign_cnf);
3121 #if defined(DL_TRACE_ENABLED)
3122 DL_OFFLINE_TRACE ("MPHC_IMMED_ASSIGN_CON");
3123 #endif /* DL_TRACE_ENABLED */
3124 dedi_imm_ass_cnf ();
3125 }
3126
3127 /*
3128 +--------------------------------------------------------------------+
3129 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3130 | STATE : code ROUTINE : ma_mphc_pre_sync_ho_cnf |
3131 +--------------------------------------------------------------------+
3132
3133 PURPOSE : Process the primitive MPHC_PRE_SYNC_HO_CON.
3134
3135 */
3136
3137 GLOBAL void ma_mphc_pre_sync_ho_cnf (T_MPHC_PRE_SYNC_HO_CON* pre_sync_ho_cnf)
3138 {
3139 PFREE (pre_sync_ho_cnf);
3140 dedi_ho_cnf(HO_TYPE_PRE_SYNC);
3141 }
3142
3143
3144 /*
3145 +--------------------------------------------------------------------+
3146 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3147 | STATE : code ROUTINE : ma_mphc_sync_ho_cnf |
3148 +--------------------------------------------------------------------+
3149
3150 PURPOSE : Process the primitive MPHC_SYNC_HO_CON.
3151
3152 */
3153
3154 GLOBAL void ma_mphc_sync_ho_cnf (T_MPHC_SYNC_HO_CON* sync_ho_cnf)
3155 {
3156 PFREE (sync_ho_cnf);
3157 dedi_ho_cnf(HO_TYPE_SYNC);
3158 }
3159
3160 /*
3161 +--------------------------------------------------------------------+
3162 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3163 | STATE : code ROUTINE : ma_mphc_ta_fail_ind |
3164 +--------------------------------------------------------------------+
3165
3166 PURPOSE : Process the primitive MPHC_TA_FAIL_IND.
3167
3168 */
3169
3170 GLOBAL void ma_mphc_ta_fail_ind (T_MPHC_TA_FAIL_IND* ta_fail_ind)
3171 {
3172 PFREE (ta_fail_ind);
3173 dedi_ta_fail_ind ();
3174 }
3175
3176 /*
3177 +-----------------------------------------------------------------------+
3178 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3179 | STATE : code ROUTINE : ma_mphc_handover_finished_ind |
3180 +-----------------------------------------------------------------------+
3181
3182 PURPOSE : Process the primitive MPHC_HANDOVER_FINISHED.
3183
3184 */
3185
3186 GLOBAL void ma_mphc_handover_finished_ind (T_MPHC_HANDOVER_FINISHED* ho_finished)
3187 {
3188 dedi_ho_finished (ho_finished);
3189 PFREE (ho_finished);
3190 }
3191
3192 /*
3193 +--------------------------------------------------------------------+
3194 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3195 | STATE : code ROUTINE : ma_mphc_meas_report_ind_emo|
3196 +--------------------------------------------------------------------+
3197
3198 PURPOSE : Process the primitive MPHC_MEAS_REPORT for
3199 Extended Measurement procedure.
3200
3201 */
3202
3203 LOCAL BOOL ma_mphc_meas_report_ind_emo (T_MPHC_MEAS_REPORT* mphc_meas_report)
3204 {
3205 GET_INSTANCE_DATA;
3206 UBYTE emo_ba_id = alr_data->dedi_data.emo_ba_id;
3207 UBYTE rep_ba_id = mphc_meas_report->ba_id;
3208
3209 if ( INRANGE(RR_BA_LOW,rep_ba_id,RR_BA_HIGH) AND
3210 mphc_meas_report->meas_valid )
3211 {
3212 if ( rep_ba_id EQ emo_ba_id )
3213 {
3214 T_ncell_meas *ncell_meas = &mphc_meas_report->ncell_meas;
3215 T_res_list *res_list = &ncell_meas->res_list[0];
3216 T_meas_results *meas_results;
3217 USHORT k,n;
3218 UBYTE nmax;
3219
3220 PALLOC (mph_emo_meas_ind, MPH_EMO_MEAS_IND);
3221
3222 meas_results = &mph_emo_meas_ind->meas_results[0];
3223
3224 mph_emo_meas_ind->ba_id = mphc_meas_report->ba_id;
3225 mph_emo_meas_ind->dtx = mphc_meas_report->dtx_used;
3226
3227 nmax = sizeof mph_emo_meas_ind->meas_results /
3228 sizeof mph_emo_meas_ind->meas_results[0];
3229
3230 if ( mphc_meas_report->no_of_ncells_meas > nmax )
3231 mphc_meas_report->no_of_ncells_meas = nmax;
3232
3233 n = mph_emo_meas_ind->c_meas_results = mphc_meas_report->no_of_ncells_meas;
3234 for ( k = 0; k < n; k++ )
3235 {
3236 SHORT rx_lev = (SHORT)res_list[k].rxlev_acc /
3237 (BYTE) res_list[k].rxlev_nbr_meas;
3238
3239 if ( rx_lev < 0 )
3240 rx_lev = 0;
3241
3242 meas_results[k].rx_lev = (UBYTE) rx_lev;
3243 meas_results[k].arfcn = ARFCN_TO_G23 ( res_list[k].bcch_freq );
3244 }
3245
3246 PSENDX(RR, mph_emo_meas_ind);
3247 }
3248 return TRUE; /* primitive handled */
3249 }
3250
3251 return FALSE; /* indicate that the primitive has not been handled */
3252 }
3253
3254 /*
3255 +--------------------------------------------------------------------+
3256 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3257 | STATE : code ROUTINE : ma_mphc_meas_report_ind |
3258 +--------------------------------------------------------------------+
3259
3260 PURPOSE : Process the primitive MPHC_MEAS_REPORT.
3261
3262 */
3263
3264 GLOBAL void ma_mphc_meas_report_ind (T_MPHC_MEAS_REPORT* report)
3265 {
3266 GET_INSTANCE_DATA;
3267 switch (GET_STATE (STATE_MA))
3268 {
3269 case MA_DEDICATED:
3270
3271 if (report->meas_valid)
3272 {
3273 if ( ma_mphc_meas_report_ind_emo ( report ) )
3274 {
3275 PFREE ( report ); /*report isn't used any more*/
3276 return;
3277 }
3278 nc_report_dedicated (report);
3279 }
3280 else
3281 {
3282 PALLOC (rr_report, MPH_MEASUREMENT_IND);
3283 memset (rr_report, 0, sizeof (T_MPH_MEASUREMENT_IND));
3284
3285 #ifdef GPRS
3286 rr_report->gprs_sync = NORMAL_MEAS_REP;
3287 #endif
3288
3289 if (alr_data->nc_data.update)
3290 nc_fill_report_sc_dedi (rr_report, 0);
3291 ma_nc_report_res (rr_report);
3292 }
3293 alr_data->nc_data.update = FALSE;
3294 break;
3295 default:
3296 break;
3297 }
3298
3299 PFREE (report);
3300 }
3301
3302 /*
3303 +--------------------------------------------------------------------+
3304 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3305 | STATE : code ROUTINE : mphc_adc_ind |
3306 +--------------------------------------------------------------------+
3307
3308 PURPOSE : Process the primitive CST_ADC_RESULT.
3309 */
3310
3311
3312 GLOBAL void ma_mphc_adc_ind (T_MPHC_ADC_IND *adc_results)
3313 {
3314 PFREE (adc_results);
3315
3316 }
3317
3318 /* -------------------------------------------------------------------
3319 * -------------------------------------------------------------------
3320 * SIGNAL Processing functions
3321 * These are called by the other ALR processes
3322 * -------------------------------------------------------------------
3323 * -------------------------------------------------------------------
3324 */
3325
3326 /*
3327 +--------------------------------------------------------------------+
3328 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3329 | STATE : code ROUTINE : ma_rach_ra_req |
3330 +--------------------------------------------------------------------+
3331
3332 PURPOSE : Process the signal rach_ra_req from SDL process
3333 RACH_Control.
3334
3335 */
3336
3337 GLOBAL void ma_rach_ra_req (T_MPHC_RA_REQ * mph_ra_req)
3338 {
3339 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
3340 ALR_TRACE_MAIN_RACH (mph_ra_req->txpwr);
3341 #else
3342 ALR_TRACE_MAIN_RACH (mph_ra_req->powerclass_gsm, mph_ra_req->txpwr);
3343 #endif
3344 #ifdef TI_PS_HCOMM_CHANGE
3345 TRACE_BINDUMP(_hCommPL,
3346 TC_USER4,
3347 "CHANNEL_REQ UL",
3348 &mph_ra_req->channel_request,
3349 sizeof(mph_ra_req->channel_request));
3350 #else
3351 TRACE_BINDUMP(hCommPL,
3352 TC_USER4,
3353 "CHANNEL_REQ UL",
3354 &mph_ra_req->channel_request,
3355 sizeof(mph_ra_req->channel_request));
3356 #endif /* TI_PS_HCOMM_CHANGE */
3357
3358 PSENDX (L1, mph_ra_req);
3359 }
3360
3361 /*
3362 +--------------------------------------------------------------------+
3363 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3364 | STATE : code ROUTINE : ma_cs_power_cnf |
3365 +--------------------------------------------------------------------+
3366
3367 PURPOSE : Sends the power measurement results to RR.
3368
3369 */
3370
3371 GLOBAL void ma_cs_power_cnf (T_MPH_POWER_CNF *mph_power_cnf)
3372 {
3373 GET_INSTANCE_DATA;
3374 #if 0 || defined(TRACING)
3375 int i;
3376 TRACE_EVENT_P1 ("mph_power_cnf: %u freq.", mph_power_cnf->num_of_chan);
3377
3378 for (i = 0; i < mph_power_cnf->num_of_chan AND i<10; i++)
3379 TRACE_EVENT_P3("[%u] std=%u rx_lev=%u",
3380 mph_power_cnf->arfcn[i]&ARFCN_MASK,
3381 STD_GET_FROM_ARFCN(mph_power_cnf->arfcn[i]),
3382 mph_power_cnf->rx_lev[i]);
3383 #endif /* TRACING */
3384
3385 if ( IS_EXT_MEAS_RUNNING ) /*alr_data->cs_data.mph_ext_meas_req NEQ NULL */
3386 {
3387 D_OPC ( mph_power_cnf ) = MPH_EXT_MEAS_CNF;
3388 }
3389
3390 PSENDX (RR, mph_power_cnf);
3391 }
3392
3393 /*
3394 +--------------------------------------------------------------------+
3395 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3396 | STATE : code ROUTINE : ma_cs_rxlev_req |
3397 +--------------------------------------------------------------------+
3398
3399 PURPOSE : Process the signal cs_rxlev_req from SDL process
3400 Cell_Selection.
3401
3402 */
3403
3404 GLOBAL void ma_cs_rxlev_req (void)
3405 {
3406 GET_INSTANCE_DATA;
3407 T_POWER_MEAS* power_meas = NULL;
3408
3409 TRACE_FUNCTION ("ma_cs_rxlev_req()");
3410
3411 switch (GET_STATE (STATE_CS))
3412 {
3413 case CS_INIT_L1:
3414 power_meas = cs_prepare_power_req();
3415 /* init radio band before measurement */
3416 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
3417 ma_cs_init_l1_req();
3418 #else
3419 ma_cs_init_l1_req(alr_data->cs_data.std);
3420 #endif
3421 SET_STATE(STATE_CS, CS_INIT_ACTIVE);
3422 return; /* wait of MPHC_INIT_L1_CON */
3423 case CS_INIT_ACTIVE:
3424 return; /* wait of MPHC_INIT_L1_CON */
3425 case CS_INIT_DONE:
3426 /* go through and wait or start the first resp. next measurement */
3427 case CS_START_MEASURE:
3428 /* without or after configuration of radio band */
3429 if (IS_TIMER_ACTIVE(TIM_POWERMEAS))
3430 {
3431 /*
3432 * use time to spread power measurements also to write out
3433 * possible available DL offline traces
3434 */
3435 #ifdef TI_PS_HCOMM_CHANGE
3436 PSIGNAL (_hCommDL, PH_TRACE_IND, NULL);
3437 #else
3438 PSIGNAL (hCommDL, PH_TRACE_IND, NULL);
3439 #endif /* TI_PS_HCOMM_CHANGE */
3440 return; /* do nothing and wait for timer delay */
3441 }
3442 break; /* OK start the first resp. next measurement */
3443 default:
3444 TRACE_EVENT_P1 ("wrong CS state (%u) in ma_cs_rxlev_req()", GET_STATE (STATE_CS));
3445 return;
3446 }
3447
3448 power_meas = cs_prepare_power_req();
3449 if (power_meas)
3450 {
3451 PALLOC(rxlev_req, MPHC_RXLEV_REQ);
3452 rxlev_req->shared_ptr = (ULONG) power_meas;
3453 SET_STATE(STATE_CS, CS_ACTIVE_MEASURE);
3454 PSENDX(L1, rxlev_req);
3455 /* start timer new */
3456 TIMERSTART(TIM_POWERMEAS, alr_data->cs_data.c_tim_meas);
3457
3458 ALR_EM_FIELDSTRENGTH_MEASUREMENT_REQUEST;
3459
3460 }
3461 }
3462
3463
3464 /*
3465 +--------------------------------------------------------------------+
3466 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3467 | STATE : code ROUTINE : ma_cs_init_l1_req |
3468 +--------------------------------------------------------------------+
3469
3470 PURPOSE : set the radio band configuration.
3471 */
3472
3473 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
3474 GLOBAL void ma_cs_init_l1_req ()
3475 #else
3476 GLOBAL void ma_cs_init_l1_req (UBYTE radio_band_config)
3477 #endif
3478 {
3479 PALLOC (init_l1_req, MPHC_INIT_L1_REQ); /* T_MPHC_INIT_L1_REQ */
3480 /* No need to configure L1 for different bands. l1 is capable of scanning across different bands */
3481 #ifndef TI_PS_FF_QUAD_BAND_SUPPORT
3482 init_l1_req->radio_band_config = radio_band_config;
3483 TRACE_EVENT_P1 ("radio_band_config=%u", init_l1_req->radio_band_config);
3484 #endif
3485 PSENDX(L1, init_l1_req);
3486 cs_set_wideband_sync();
3487 }
3488
3489 /*
3490 +--------------------------------------------------------------------+
3491 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3492 | STATE : code ROUTINE : ma_cs_network_sync_req |
3493 +--------------------------------------------------------------------+
3494
3495 PURPOSE : Process the signal cs_network_sync_req from SDL process
3496 Cell_Selection.
3497 */
3498
3499 GLOBAL void ma_cs_network_sync_req (USHORT channel)
3500 {
3501 GET_INSTANCE_DATA;
3502 PALLOC (network_sync_req, MPHC_NETWORK_SYNC_REQ);
3503
3504 network_sync_req->radio_freq = channel;
3505 network_sync_req->fn_offset = 0;
3506 network_sync_req->time_alignment = 0;
3507 network_sync_req->timing_validity = TV_INVALID_TIMING_INFO;
3508 network_sync_req->search_mode = alr_data->cs_data.search_mode;
3509 alr_data->cs_data.sync_active = TRUE;
3510 PSENDX(L1, network_sync_req);
3511
3512 TIMERSTART(TIM_NW_SYNC_GUARD, TIM_NW_SYNC_GUARD_VALUE);
3513
3514 }
3515
3516
3517 /*
3518 +--------------------------------------------------------------------+
3519 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3520 | STATE : code ROUTINE : ma_nc_rxlev_periodic_req |
3521 +--------------------------------------------------------------------+
3522
3523 PURPOSE : Process the signal nc_rxlev_periodic_req from SDL process
3524 Idle_Neighbour_Cell.
3525
3526 */
3527
3528 GLOBAL void ma_nc_rxlev_periodic_req (T_MPHC_RXLEV_PERIODIC_REQ* update)
3529 {
3530 GET_INSTANCE_DATA;
3531 switch (GET_STATE (STATE_MA))
3532 {
3533 case MA_CELL_RESELECTION:
3534 case MA_IDLE:
3535 PSENDX (L1, update);
3536 break;
3537
3538 default:
3539 PFREE (update);
3540 break;
3541 }
3542 }
3543
3544
3545 /*
3546 +--------------------------------------------------------------------+
3547 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3548 | STATE : code ROUTINE : ma_nc_stop_ncell_bcch_req |
3549 +--------------------------------------------------------------------+
3550
3551 PURPOSE : Process the signal nc_stop_ncell_bcch_req from SDL process
3552 Idle_Neighbour_Cell.
3553
3554 */
3555
3556 GLOBAL void ma_nc_stop_ncell_bcch_req (USHORT arfcn)
3557 {
3558 PALLOC(stop_req, MPHC_STOP_NCELL_BCCH_REQ);
3559
3560 memset (stop_req, 0, sizeof(T_MPHC_STOP_NCELL_BCCH_REQ));
3561 stop_req->radio_freq_array_size = 1;
3562 stop_req->radio_freq_array[0] = ARFCN_TO_L1(arfcn);
3563
3564 PSENDX(L1, stop_req);
3565
3566 }
3567
3568 /*
3569 +--------------------------------------------------------------------+
3570 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3571 | STATE : code ROUTINE : ma_nc_stop_ncell_bcch_req |
3572 +--------------------------------------------------------------------+
3573
3574 PURPOSE : Process the signal nc_stop_ncell_bcch_req from SDL process
3575 Idle_Neighbour_Cell.
3576
3577 */
3578
3579 GLOBAL void ma_nc_stop_ncell_sync_req (USHORT arfcn)
3580 {
3581 PALLOC (mphc_stop_ncell_sync_req, MPHC_STOP_NCELL_SYNC_REQ);
3582
3583 mphc_stop_ncell_sync_req->radio_freq_array_size = 1;
3584 mphc_stop_ncell_sync_req->radio_freq_array[0] = ARFCN_TO_L1(arfcn);
3585
3586 PSENDX(L1, mphc_stop_ncell_sync_req);
3587 }
3588 /*
3589 +--------------------------------------------------------------------+
3590 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3591 | STATE : code ROUTINE : ma_nc_sync_req |
3592 +--------------------------------------------------------------------+
3593
3594 PURPOSE : Process the signal nc_sync_req from SDL process
3595 Idle_Neighbour_Cell.
3596
3597 */
3598
3599 GLOBAL void ma_nc_sync_req (T_MPHC_NCELL_SYNC_REQ *sync_req)
3600 {
3601 PSENDX(L1, sync_req);
3602 }
3603
3604 /*
3605 +--------------------------------------------------------------------+
3606 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3607 | STATE : code ROUTINE : ma_nc_list_sync_req |
3608 +--------------------------------------------------------------------+
3609
3610 PURPOSE : Process the signal nc_list_sync_req from SDL process
3611 Idle_Neighbour_Cell.
3612
3613 */
3614
3615 GLOBAL void ma_nc_list_sync_req (T_MPHC_NCELL_LIST_SYNC_REQ *list_sync_req)
3616 {
3617 PSENDX(L1, list_sync_req);
3618 }
3619
3620 /*
3621 +--------------------------------------------------------------------+
3622 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3623 | STATE : code ROUTINE : ma_nc_bcch_req |
3624 +--------------------------------------------------------------------+
3625
3626 PURPOSE : Process the signal nc_bcch_req from SDL process
3627 Idle_Neighbour_Cell.
3628
3629 */
3630
3631 GLOBAL void ma_nc_bcch_req (T_MPHC_NCELL_BCCH_REQ *bcch_req)
3632 {
3633
3634 ALR_EM_READ_NEIGHBOURCELL_BCCH;
3635
3636 PSENDX(L1, bcch_req);
3637 }
3638
3639 /*
3640 +--------------------------------------------------------------------+
3641 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3642 | STATE : code ROUTINE : ma_nc_update_ba_list |
3643 +--------------------------------------------------------------------+
3644
3645 PURPOSE : Process the signal nc_update_ba_list from SDL process
3646 Idle_Neighbour_Cell.
3647
3648 */
3649
3650 GLOBAL void ma_nc_update_ba_list (T_MPHC_UPDATE_BA_LIST *update_ba_list)
3651 {
3652 GET_INSTANCE_DATA;
3653 switch (GET_STATE (STATE_MA))
3654 {
3655 case MA_DEDICATED:
3656 PSENDX (L1, update_ba_list);
3657 break;
3658
3659 default:
3660 PFREE (update_ba_list);
3661 break;
3662 }
3663 }
3664
3665
3666 /*
3667 +--------------------------------------------------------------------+
3668 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3669 | STATE : code ROUTINE : ma_nc_report_res |
3670 +--------------------------------------------------------------------+
3671
3672 PURPOSE : Process the signal nc_report_res from SDL process
3673 Idle_Neighbour_Cell.
3674
3675 */
3676
3677 GLOBAL void ma_nc_report_res (T_MPH_MEASUREMENT_IND *mph_measurement_ind)
3678 {
3679 /* Implements Measure#32: Row 112 */
3680 GET_INSTANCE_DATA;
3681 TRACE_ASSERT((GET_STATE(STATE_MA) NEQ MA_NULL) OR (GET_STATE(STATE_MA) NEQ MA_CELL_SELECTION));
3682
3683 switch (GET_STATE (STATE_MA))
3684 {
3685 case MA_IDLE:
3686 #ifdef GPRS
3687 case MA_PTM:
3688 #endif
3689 case MA_CON_EST:
3690 case MA_CELL_RESELECTION:
3691 case MA_DEDICATED:
3692 PSENDX (RR, mph_measurement_ind);
3693 break;
3694 default:
3695 PFREE (mph_measurement_ind);
3696 break;
3697 }
3698 }
3699
3700 /*
3701 +--------------------------------------------------------------------+
3702 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3703 | STATE : code ROUTINE : ma_dedi_stop_req |
3704 +--------------------------------------------------------------------+
3705
3706 PURPOSE : Process the signal ma_dedi_stop_req from SDL process
3707 Dedicated_Control.
3708
3709 */
3710
3711 GLOBAL void ma_dedi_stop_req (void)
3712 {
3713 PALLOC (stop_dedicated, MPHC_STOP_DEDICATED_REQ);
3714 #if defined(DL_TRACE_ENABLED)
3715 DL_OFFLINE_TRACE ("MPHC_STOP_DEDICATED_REQ");
3716 #endif /* DL_TRACE_ENABLED */
3717 PSENDX (L1, stop_dedicated);
3718 }
3719
3720 /*
3721 +--------------------------------------------------------------------+
3722 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3723 | STATE : code ROUTINE : ma_dedi_cnf |
3724 +--------------------------------------------------------------------+
3725
3726 PURPOSE : Process the signal ma_dedi_cnf from SDL process
3727 Dedicated_Control.
3728
3729 */
3730
3731 GLOBAL void ma_dedi_cnf (UBYTE cause)
3732 {
3733 PALLOC (dedicated_cnf, MPH_DEDICATED_CNF);
3734
3735 dedicated_cnf->dedi_res = cause;
3736 PSENDX (RR, dedicated_cnf);
3737 }
3738
3739 /*
3740 +--------------------------------------------------------------------+
3741 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3742 | STATE : code ROUTINE : ma_dedi_chan_ass_req |
3743 +--------------------------------------------------------------------+
3744
3745 PURPOSE : Process the signal ma_dedi_chan_ass_req from SDL process
3746 Dedi Control.
3747
3748 */
3749
3750 GLOBAL void ma_dedi_chan_ass_req (T_MPHC_CHANNEL_ASSIGN_REQ *mphc_channel_assign_req)
3751 {
3752 #if defined(DL_TRACE_ENABLED)
3753 DL_OFFLINE_TRACE ("MPHC_CHANNEL_ASSIGN_REQ");
3754 #else
3755 SYST_TRACE_P ((SYST, "dedi chan ass req %d",
3756 mphc_channel_assign_req->channel_desc_1.channel_type));
3757 #endif /* DL_TRACE_ENABLED */
3758 PSENDX (L1, mphc_channel_assign_req);
3759 }
3760
3761 /*
3762 +--------------------------------------------------------------------+
3763 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3764 | STATE : code ROUTINE : ma_dedi_async_ho_req |
3765 +--------------------------------------------------------------------+
3766
3767 PURPOSE : Process the signal ma_dedi_async_ho_req from SDL process
3768 Dedi Control.
3769
3770 */
3771
3772 GLOBAL void ma_dedi_async_ho_req (T_MPHC_ASYNC_HO_REQ *async_ho_req)
3773 {
3774 PSENDX (L1, async_ho_req);
3775 }
3776
3777 /*
3778 +--------------------------------------------------------------------+
3779 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3780 | STATE : code ROUTINE : ma_dedi_sync_ho_req |
3781 +--------------------------------------------------------------------+
3782
3783 PURPOSE : Process the signal ma_dedi_sync_ho_req from SDL process
3784 Dedi Control.
3785
3786 */
3787
3788 GLOBAL void ma_dedi_sync_ho_req (T_MPHC_SYNC_HO_REQ * sync_ho_req)
3789 {
3790 PSENDX (L1, sync_ho_req);
3791 }
3792
3793 /*
3794 +--------------------------------------------------------------------+
3795 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3796 | STATE : code ROUTINE : ma_dedi_pre_sync_ho_req |
3797 +--------------------------------------------------------------------+
3798
3799 PURPOSE : Process the signal ma_dedi_pre_sync_ho_req from
3800 SDL process Dedi Control.
3801
3802 */
3803
3804 GLOBAL void ma_dedi_pre_sync_ho_req (T_MPHC_PRE_SYNC_HO_REQ *pre_sync_ho_req)
3805 {
3806 PSENDX (L1, pre_sync_ho_req);
3807 }
3808
3809 /*
3810 +--------------------------------------------------------------------+
3811 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3812 | STATE : code ROUTINE : ma_dedi_fail_cnf |
3813 +--------------------------------------------------------------------+
3814
3815 PURPOSE : Process the signal ma_dedi_fail_cnf from SDL process
3816 Dedicated_Control.
3817
3818 */
3819
3820 GLOBAL void ma_dedi_fail_cnf (void)
3821 {
3822 PALLOC (mph_dedicated_fail_cnf, MPH_DEDICATED_FAIL_CNF);
3823 PSENDX (RR, mph_dedicated_fail_cnf);
3824 }
3825
3826 /*
3827 +--------------------------------------------------------------------+
3828 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3829 | STATE : code ROUTINE : ma_dedi_ho_fail_req |
3830 +--------------------------------------------------------------------+
3831
3832 PURPOSE : Process the signal ma_dedi_ho_fail_req from SDL process
3833 Dedicated_Control.
3834
3835 */
3836
3837 GLOBAL void ma_dedi_ho_fail_req (void)
3838 {
3839 PALLOC (handover_fail_req, MPHC_HANDOVER_FAIL_REQ);
3840 PSENDX (L1, handover_fail_req);
3841 }
3842
3843 /*
3844 +--------------------------------------------------------------------+
3845 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3846 | STATE : code ROUTINE : ma_dedi_imm_ass_req |
3847 +--------------------------------------------------------------------+
3848
3849 PURPOSE : Process the signal ma_dedi_imm_ass_req from SDL process
3850 Dedicated_Control.
3851
3852 */
3853
3854 GLOBAL void ma_dedi_imm_ass_req (T_MPHC_IMMED_ASSIGN_REQ *immed_assign_req)
3855 {
3856 #if defined(DL_TRACE_ENABLED)
3857 DL_OFFLINE_TRACE ("MPHC_IMMED_ASSIGN_REQ");
3858 #else
3859 SYST_TRACE_P ((SYST, "dedi imm ass req %d",
3860 immed_assign_req->channel_desc.channel_type));
3861 #endif /* DL_TRACE_ENABLED */
3862 PSENDX (L1, immed_assign_req);
3863 }
3864
3865 /*
3866 +--------------------------------------------------------------------+
3867 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3868 | STATE : code ROUTINE : ma_dedi_change_freq_req |
3869 +--------------------------------------------------------------------+
3870
3871 PURPOSE : Process the signal ma_dedi_change_freq_req from
3872 SDL process Dedicated_Control.
3873
3874 */
3875
3876 GLOBAL void ma_dedi_change_freq_req (T_MPHC_CHANGE_FREQUENCY *change_frequency)
3877 {
3878 PSENDX (L1, change_frequency);
3879 }
3880
3881 /*
3882 +--------------------------------------------------------------------+
3883 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3884 | STATE : code ROUTINE : ma_dedi_chan_mode_req |
3885 +--------------------------------------------------------------------+
3886
3887 PURPOSE : Process the signal ma_dedi_chan_mode_req from
3888 SDL process Dedicated_Control.
3889
3890 */
3891
3892 GLOBAL void ma_dedi_chan_mode_req (T_MPHC_CHANNEL_MODE_MODIFY_REQ *channel_mode_modify_req)
3893 {
3894 PSENDX (L1, channel_mode_modify_req);
3895 }
3896
3897
3898 /*
3899 +--------------------------------------------------------------------+
3900 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3901 | STATE : code ROUTINE : ma_dedi_ciph_req |
3902 +--------------------------------------------------------------------+
3903
3904 PURPOSE : Process the signal ma_dedi_ciph_req from
3905 SDL process Dedicated_Control.
3906
3907 */
3908
3909 GLOBAL void ma_dedi_ciph_req (T_MPHC_SET_CIPHERING_REQ *set_ciphering_req)
3910 {
3911 PSENDX (L1, set_ciphering_req);
3912 }
3913
3914 /*
3915 +--------------------------------------------------------------------+
3916 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3917 | STATE : code ROUTINE : ma_dedi_data_out |
3918 +--------------------------------------------------------------------+
3919
3920 PURPOSE : Acknowledged frame or short PD header (format type Bter)
3921 Forward the message to DL. Uses the original primitive format.
3922
3923 */
3924
3925 LOCAL void ma_dedi_data_out (T_PH_DATA_IND *data_ind)
3926 {
3927 PPASS (data_ind, ph_data_ind, PH_DATA_IND);
3928 PSENDX (DL, ph_data_ind);
3929 }
3930
3931
3932 /*
3933 +--------------------------------------------------------------------+
3934 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
3935 | STATE : code ROUTINE : ma_send_dedi_unitdata |
3936 +--------------------------------------------------------------------+
3937
3938 PURPOSE : Sends an unacknowledged message on SACCH to RR.
3939
3940 */
3941
3942 LOCAL void ma_send_dedi_unitdata (T_MPHC_DATA_IND *data_ind)
3943 {
3944 USHORT len_in_bits = 19 * 8;
3945 PALLOC_SDU (data_out, MPH_UNITDATA_IND, len_in_bits);
3946
3947 data_out->sdu.l_buf = 18 * 8;
3948 data_out->sdu.o_buf = 8;
3949 data_out->sdu.buf[0] = 0;
3950 /*lint -e{419} (Warning -- Apparent data overrun) */
3951 memcpy (&data_out->sdu.buf[1], &data_ind->l2_frame.content[5], 18);
3952 data_out->arfcn = ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK;
3953 data_out->fn = data_ind->fn;
3954
3955 PSENDX (RR, data_out);
3956 }
3957 /*
3958 +--------------------------------------------------------------------+
3959 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3960 | STATE : code ROUTINE : ma_dedi_open_tch_loop_req |
3961 +--------------------------------------------------------------------+
3962
3963 PURPOSE : Process the signal ma_dedi_open_tch_loop_req from
3964 SDL process Dedicated_Control.
3965
3966 */
3967
3968 GLOBAL void ma_dedi_open_tch_loop_req (void)
3969 {
3970 PALLOC (oml1_open_tch_loop_req, OML1_OPEN_TCH_LOOP_REQ);
3971 PSENDX (L1, oml1_open_tch_loop_req);
3972 }
3973
3974
3975 /*
3976 +--------------------------------------------------------------------+
3977 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3978 | STATE : code ROUTINE : ma_dedi_stop_dai_req |
3979 +--------------------------------------------------------------------+
3980
3981 PURPOSE : Process the signal ma_dedi_stop_dai_req from
3982 SDL process Dedicated_Control.
3983
3984 */
3985 GLOBAL void ma_dedi_stop_dai_req (void)
3986 {
3987 PALLOC (oml1_stop_dai_test_req, OML1_STOP_DAI_TEST_REQ);
3988 PSENDX (L1, oml1_stop_dai_test_req);
3989 }
3990
3991
3992 /*
3993 +--------------------------------------------------------------------+
3994 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
3995 | STATE : code ROUTINE : ma_dedi_close_tch_loop_req |
3996 +--------------------------------------------------------------------+
3997
3998 PURPOSE : Process the signal ma_dedi_close_tch_loop_req from
3999 SDL process Dedicated_Control.
4000
4001 */
4002
4003 GLOBAL void ma_dedi_close_tch_loop_req (T_OML1_CLOSE_TCH_LOOP_REQ *oml1_close_tch_loop_req)
4004 {
4005 PSENDX (L1, oml1_close_tch_loop_req);
4006 }
4007
4008
4009 /*
4010 +--------------------------------------------------------------------+
4011 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
4012 | STATE : code ROUTINE : ma_dedi_start_dai_req |
4013 +--------------------------------------------------------------------+
4014
4015 PURPOSE : Process the signal ma_dedi_start_dai_req from
4016 SDL process Dedicated_Control.
4017
4018 */
4019
4020 GLOBAL void ma_dedi_start_dai_req (T_OML1_START_DAI_TEST_REQ *oml1_start_dai_test_req)
4021 {
4022 PSENDX (L1, oml1_start_dai_test_req);
4023 }
4024
4025 /*
4026 +--------------------------------------------------------------------+
4027 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4028 | STATE : code ROUTINE : ma_rach_stop_ra_req |
4029 +--------------------------------------------------------------------+
4030
4031 PURPOSE : Process the signal rach_stop_ra_req from SDL process
4032 RACH_Control.
4033
4034 */
4035
4036 GLOBAL void ma_rach_stop_ra_req (void)
4037 {
4038 PALLOC (stop_ra_req, MPHC_STOP_RA_REQ);
4039
4040 PSENDX (L1, stop_ra_req);
4041 }
4042
4043 /*
4044 +--------------------------------------------------------------------+
4045 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4046 | STATE : code ROUTINE : ma_pch_start_ccch_req |
4047 +--------------------------------------------------------------------+
4048
4049 PURPOSE : Process the signal pch_start_ccch_req from SDL process
4050 PCH_Control.
4051
4052 */
4053
4054 GLOBAL void ma_pch_start_ccch_req (T_MPHC_START_CCCH_REQ *pl_idle)
4055 {
4056 GET_INSTANCE_DATA;
4057 if (memcmp ( &(alr_data->pch_data.last_start_ccch_req),
4058 pl_idle,
4059 sizeof(T_MPHC_START_CCCH_REQ) ) NEQ 0)
4060 {
4061 memcpy ( &(alr_data->pch_data.last_start_ccch_req),
4062 pl_idle,
4063 sizeof(T_MPHC_START_CCCH_REQ));
4064 PSENDX (L1, pl_idle);
4065 }
4066 else
4067 {
4068 PFREE(pl_idle);
4069 }
4070 }
4071
4072 /*
4073 +--------------------------------------------------------------------+
4074 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4075 | STATE : code ROUTINE : ma_rach_random_cnf |
4076 +--------------------------------------------------------------------+
4077
4078 PURPOSE : Process the signal rach_random_cnf from SDL process
4079 RACH_Control.
4080
4081 */
4082
4083 GLOBAL void ma_rach_random_cnf (T_MPH_RANDOM_ACCESS_CNF * mph_random_access_cnf)
4084 {
4085 GET_INSTANCE_DATA;
4086 switch (GET_STATE (STATE_MA))
4087 {
4088 case MA_CON_EST:
4089 ALR_TRACE_MAIN_RA_CNF(mph_random_access_cnf->frame_no.t1,
4090 mph_random_access_cnf->frame_no.t2,
4091 mph_random_access_cnf->frame_no.t3);
4092
4093 #if !defined (NCONFIG)
4094 if(v_cfg_rach_failure)
4095 memset(mph_random_access_cnf,0, sizeof(T_MPH_RANDOM_ACCESS_CNF));
4096 #endif
4097
4098 PSENDX (RR, mph_random_access_cnf);
4099 break;
4100
4101 default:
4102 PFREE (mph_random_access_cnf);
4103 break;
4104 }
4105 }
4106
4107 /*
4108 +--------------------------------------------------------------------+
4109 | PROJECT : GSM-PS (6103) MODULE : ALR_PCH |
4110 | STATE : code ROUTINE : ma_pch_paging_ind |
4111 +--------------------------------------------------------------------+
4112
4113 PURPOSE : Sends a paging indication to RR.
4114
4115 */
4116
4117 GLOBAL void ma_pch_paging_ind (UBYTE id_type, UBYTE channel_needed)
4118 {
4119 PALLOC (mph_paging_ind, MPH_PAGING_IND);
4120
4121 ALR_EM_PAGING_DETECTED;
4122
4123 mph_paging_ind->identity_type = id_type;
4124 mph_paging_ind->channel_needed = channel_needed;
4125
4126 // vsi_o_ttrace(VSI_CALLER 0xFFFF, "PAG IND ch=%x", channel_needed);
4127 #if defined(DL_TRACE_ENABLED)
4128 {
4129 sprintf (dl_trace_buf, "PAG%u ch=%u", id_type,channel_needed);
4130 DL_OFFLINE_TRACE (dl_trace_buf);
4131 }
4132 #else /* DL_TRACE_ENABLED */
4133 SYST_TRACE_P ((SYST, "PAG%u ch=%u", id_type,channel_needed));
4134 #endif /* DL_TRACE_ENABLED */
4135
4136
4137 PSENDX (RR, mph_paging_ind);
4138 }
4139
4140 /*
4141 +--------------------------------------------------------------------+
4142 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4143 | STATE : code ROUTINE : ma_pch_stop |
4144 +--------------------------------------------------------------------+
4145
4146 PURPOSE : Stop CCCH reading.
4147 */
4148
4149 GLOBAL void ma_pch_stop(void)
4150 {
4151 GET_INSTANCE_DATA;
4152 PALLOC(stop_req, MPHC_STOP_CCCH_REQ);
4153 alr_data->pch_data.last_start_ccch_req.bs_pa_mfrms = NOT_PRESENT_8BIT;
4154 PSENDX(L1, stop_req);
4155 }
4156
4157
4158
4159 /*
4160 +--------------------------------------------------------------------+
4161 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4162 | STATE : code ROUTINE : ma_mmi_cbch_req |
4163 +--------------------------------------------------------------------+
4164
4165 PURPOSE : Process the primitive MMI_CBCH_REQ.
4166
4167 */
4168
4169 GLOBAL void ma_mmi_cbch_req (T_MMI_CBCH_REQ *cbch_req)
4170 {
4171 TRACE_EVENT ("MMI_CBCH_REQ");
4172 cb_mmi_cbch_req (cbch_req);
4173 PFREE (cbch_req);
4174 }
4175
4176 /*
4177 +--------------------------------------------------------------------+
4178 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4179 | STATE : code ROUTINE : ma_mmi_cbch_req |
4180 +--------------------------------------------------------------------+
4181
4182 PURPOSE : Process the primitive MMI_CBCH_REQ.
4183
4184 */
4185
4186 GLOBAL void ma_mmi_sat_cbch_dwnld_req (T_MMI_SAT_CBCH_DWNLD_REQ *cbch_req)
4187 {
4188 TRACE_EVENT ("MMI_SAT_CBCH_DWNLD_REQ");
4189 cb_mmi_sat_cbch_req (cbch_req);
4190 PFREE (cbch_req);
4191 }
4192
4193 /*
4194 +--------------------------------------------------------------------+
4195 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4196 | STATE : code ROUTINE : ma_cb_stop_cbch_req |
4197 +--------------------------------------------------------------------+
4198
4199 PURPOSE : Process the signal ma_cb_stop_cbch_req.
4200
4201 */
4202 GLOBAL void ma_cb_stop_cbch_req (void)
4203 {
4204 PALLOC(stop_cbch_req, MPHC_STOP_CBCH_REQ);
4205
4206 stop_cbch_req->normal_cbch = CBCH_STOP;
4207 stop_cbch_req->extended_cbch = CBCH_STOP;
4208 TRACE_EVENT ("MPHC_STOP_CBCH_REQ");
4209 PSENDX(L1, stop_cbch_req);
4210 }
4211
4212 /*
4213 +--------------------------------------------------------------------+
4214 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4215 | STATE : code ROUTINE : ma_cb_sched_req |
4216 +--------------------------------------------------------------------+
4217
4218 PURPOSE : Process the signal ma_cb_sched_req.
4219
4220 */
4221 GLOBAL void ma_cb_sched_req (T_MPHC_CBCH_SCHEDULE_REQ *sched_req)
4222 {
4223 /*
4224 TRACE_EVENT ("MPHC_CBCH_SCHEDULE_REQ");
4225 */
4226 PSENDX (L1, sched_req);
4227 }
4228
4229 /*
4230 +--------------------------------------------------------------------+
4231 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4232 | STATE : code ROUTINE : ma_cb_config_cbch |
4233 +--------------------------------------------------------------------+
4234
4235 PURPOSE : Process the signal ma_cb_config_cbch.
4236
4237 */
4238 GLOBAL void ma_cb_config_cbch (T_MPHC_CONFIG_CBCH_REQ *config_cbch)
4239 {
4240 TRACE_EVENT ("MPHC_CONFIG_CBCH_REQ");
4241 PSENDX(L1, config_cbch);
4242 }
4243
4244 /*
4245 +--------------------------------------------------------------------+
4246 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4247 | STATE : code ROUTINE : ma_cb_mmi_cbch_ind |
4248 +--------------------------------------------------------------------+
4249
4250 PURPOSE : Process the signal ma_cb_mmi_cbch_ind.
4251
4252 */
4253 GLOBAL void ma_cb_mmi_cbch_ind (T_MMI_CBCH_IND *mmi_cbch_ind)
4254 {
4255 TRACE_EVENT ("MMI_CBCH_IND");
4256 PSENDX (MMI, mmi_cbch_ind);
4257 }
4258
4259 /*
4260 +--------------------------------------------------------------------+
4261 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4262 | STATE : code ROUTINE : ma_cb_info_req |
4263 +--------------------------------------------------------------------+
4264
4265 PURPOSE : Process the signal ma_cb_info_req.
4266
4267 */
4268 GLOBAL void ma_cb_info_req (UBYTE bitmap)
4269 {
4270 PALLOC(info_req, MPHC_CBCH_INFO_REQ);
4271
4272 info_req->tb_bitmap = bitmap;
4273 TRACE_EVENT ("MPHC_CBCH_INFO_REQ");
4274 PSENDX (L1, info_req);
4275 }
4276 /*====================================================================
4277 *Functions used by more than one process
4278 *====================================================================
4279
4280 +--------------------------------------------------------------------+
4281 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4282 | STATE : code ROUTINE : ma_scell_nbcch_req |
4283 +--------------------------------------------------------------------+
4284
4285 PURPOSE : Process the signal ma_scell_nbcch_req .
4286
4287 */
4288
4289 GLOBAL void ma_scell_full_nbcch (void)
4290 {
4291 GET_INSTANCE_DATA;
4292 PALLOC(scell_nbcch_req, MPHC_SCELL_NBCCH_REQ);
4293
4294 ALR_TRACE_MAIN ("start full sc bcch");
4295
4296 switch(GET_STATE(STATE_MA))
4297 {
4298 case MA_CELL_SELECTION:
4299 case MA_CELL_RESELECTION:
4300 alr_data->cs_data.si_bitmap = 0;
4301 break;
4302 }
4303 scell_nbcch_req->schedule_array_size = 1;
4304 scell_nbcch_req->schedule_array[0].modulus = 1;
4305 scell_nbcch_req->schedule_array[0].relative_position = 0;
4306 ma_scell_nbcch_req(scell_nbcch_req);
4307 }
4308
4309 GLOBAL void ma_scell_nbcch_req (T_MPHC_SCELL_NBCCH_REQ *nbcch_req)
4310 {
4311 ALR_TRACE_MAIN ("start sc bcch");
4312
4313 PSENDX (L1, nbcch_req);
4314 }
4315
4316 /*
4317 +--------------------------------------------------------------------+
4318 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4319 | STATE : code ROUTINE : ma_scell_ebcch_req |
4320 +--------------------------------------------------------------------+
4321
4322 PURPOSE : Process the signal cs_scell_nbcch_req from SDL process
4323 Cell_Selection.
4324 */
4325
4326 GLOBAL void ma_scell_ebcch_req (T_MPHC_SCELL_EBCCH_REQ *ebcch_req)
4327 {
4328 PSENDX (L1, ebcch_req);
4329 }
4330
4331
4332 /*
4333 +--------------------------------------------------------------------+
4334 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4335 | STATE : code ROUTINE : ma_stop_active_procs |
4336 +--------------------------------------------------------------------+
4337
4338 PURPOSE : Stop all active procedures.
4339 */
4340 GLOBAL void ma_stop_active_procs (UBYTE flags)
4341 {
4342 GET_INSTANCE_DATA;
4343 if (flags & STOP_PCH_READING)
4344 {
4345 pch_stop();
4346 }
4347
4348 if (flags & STOP_MEASUREMENTS)
4349 {
4350 ma_stop_rxlev_periodic_req();
4351 }
4352
4353 switch (GET_STATE(STATE_MA))
4354 {
4355 case MA_CELL_SELECTION:
4356 /*
4357 * if we are doing measurements or synchronising or
4358 * reading the BCCH of a cell, stop the process
4359 */
4360 cs_stop();
4361 break;
4362 case MA_CELL_RESELECTION:
4363 ma_stop_scell_bcch_req ();
4364 break;
4365 case MA_CON_EST:
4366 /*
4367 * Stop Uplink Random Burst Sending
4368 */
4369 rach_stop();
4370 break;
4371 case MA_DEDICATED:
4372 dedi_stop();
4373 break;
4374 case MA_IDLE:
4375 /* if we are reading the FCH or SCH of a ncell
4376 or reading its BCCH, stop it */
4377 nc_suspend();
4378 #if defined (REL99) && defined (TI_PS_FF_EMR)
4379 /* before stop reading the scell BCCH reset the SIq_status to configure
4380 when it is in pending state, so that it is easy to reconfigure again*/
4381 if((alr_data->nc_data.si2quater_status EQ SI2QUATER_ACQ_PENDING) OR
4382 (alr_data->nc_data.si2quater_status EQ SI2QUATER_ACQ_FULL_BCCH))
4383 {
4384 alr_data->nc_data.si2quater_status = SI2QUATER_CONFIGURE;
4385 }
4386 #endif
4387 /* if we are reading the BCCH of the serving cell,
4388 stop it */
4389 ma_stop_scell_bcch_req();
4390 /* if we are reading the CBCH, stop it */
4391 cb_stop();
4392 break;
4393 #ifdef GPRS
4394 case MA_PTM:
4395 /* if we are reading the FCH or SCH of a ncell
4396 or reading its BCCH, stop it */
4397 nc_suspend();
4398 /* if we are reading the BCCH of the serving cell,
4399 stop it */
4400 /*
4401 ma_stop_scell_bcch_req();
4402 */
4403 break;
4404 #endif /* GPRS */
4405 };
4406 }
4407
4408 /*
4409 +--------------------------------------------------------------------+
4410 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4411 | STATE : code ROUTINE : ma_send_unitdata |
4412 +--------------------------------------------------------------------+
4413
4414 PURPOSE : Cut pseudo length and send data directly to RR.
4415
4416 */
4417
4418 GLOBAL void ma_send_unitdata (T_MPHC_DATA_IND * data_ind)
4419 {
4420 #define SYS_INFO_LEN 24
4421
4422 USHORT len_in_bits = SYS_INFO_LEN * BITS_PER_BYTE;
4423
4424 PALLOC_SDU (data_out, MPH_UNITDATA_IND, len_in_bits);
4425
4426 /* No IE and Pseudo Length */
4427 data_out->sdu.l_buf = (SYS_INFO_LEN - 2) * BITS_PER_BYTE;
4428 /* Pseudo Length */
4429 data_out->sdu.o_buf = 1 * BITS_PER_BYTE;
4430 /* No IE */
4431 /*lint -e{419} (Warning -- Apparent data overrun) */
4432 memcpy (data_out->sdu.buf, &data_ind->l2_frame, SYS_INFO_LEN - 1);
4433 data_out->arfcn = ARFCN_TO_G23(data_ind->radio_freq)&ARFCN_MASK;
4434 data_out->fn = data_ind->fn;
4435
4436 #if 0 && defined(DL_TRACE_ENABLED)
4437 {
4438 sprintf (dl_trace_buf, "DATA ind msg=%u", msg_t);
4439 DL_OFFLINE_TRACE (dl_trace_buf);
4440 }
4441 #endif /* DL_TRACE_ENABLED */
4442
4443 PSENDX (RR, data_out);
4444 }
4445
4446 /*
4447 +--------------------------------------------------------------------+
4448 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
4449 | STATE : code ROUTINE : ma_error_ind |
4450 +--------------------------------------------------------------------+
4451
4452 PURPOSE : send a MPH_ERROR_IND to RR.
4453
4454 */
4455
4456 GLOBAL void ma_error_ind (UBYTE cause, USHORT arfcn)
4457 {
4458 PALLOC (error_ind, MPH_ERROR_IND);
4459
4460 ALR_TRACE_MAIN ("err ind");
4461
4462 ALR_EM_ERROR_IND(cause, arfcn);
4463
4464 error_ind->cs = cause;
4465 error_ind->arfcn = arfcn;
4466
4467 PSENDX (RR, error_ind);
4468 /*
4469 * These errors could mean that the AFC value in L1 might be srewed
4470 * up somehow. So go back to wide band search mode for next CS to be
4471 * safe.
4472 */
4473 if( (cause EQ CS_DOWN_LINK_FAIL) OR (cause EQ CS_RADIO_LINK_FAIL))
4474 cs_set_wideband_sync();
4475 }
4476
4477 /*
4478 +--------------------------------------------------------------------+
4479 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
4480 | STATE : code ROUTINE : ma_sync_ind |
4481 +--------------------------------------------------------------------+
4482
4483 PURPOSE : Send a synchronisation primitive to RR.
4484
4485 */
4486
4487 LOCAL void ma_sync_ind (UBYTE cause,
4488 USHORT arfcn)
4489 {
4490 PALLOC (sync_ind, MPH_SYNC_IND);
4491
4492 TRACE_FUNCTION ("ma_sync_ind()");
4493
4494 sync_ind->cs = cause;
4495 sync_ind->arfcn = arfcn;
4496 PSENDX (RR, sync_ind);
4497 }
4498
4499
4500 /*
4501 +--------------------------------------------------------------------+
4502 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4503 | STATE : code ROUTINE : ma_stop_scell_bcch_req |
4504 +--------------------------------------------------------------------+
4505
4506 PURPOSE : Process the signal cs_stop_bcch_reading from SDL processes
4507 Cell_Selection or Serving_Cell.
4508
4509 */
4510
4511 GLOBAL void ma_stop_scell_bcch_req (void)
4512 {
4513 PALLOC (stop_bcch_req, MPHC_STOP_SCELL_BCCH_REQ);
4514
4515 ALR_TRACE_MAIN ("stop sc bcch");
4516
4517 PSENDX (L1, stop_bcch_req);
4518 }
4519
4520 /*
4521 +--------------------------------------------------------------------+
4522 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4523 | STATE : code ROUTINE : ma_stop_rxlev_periodic_req |
4524 +--------------------------------------------------------------------+
4525
4526 PURPOSE : Stops the periodic fieldstrength measurements during
4527 idle mode.
4528
4529 */
4530
4531
4532 LOCAL void ma_stop_rxlev_periodic_req (void)
4533 {
4534 PALLOC (stop_rxlev_req, MPHC_STOP_RXLEV_PERIODIC_REQ);
4535
4536 ALR_TRACE_MAIN ("stop rxlev perio.");
4537
4538 PSENDX (L1, stop_rxlev_req);
4539 }
4540
4541
4542
4543 /*
4544 +--------------------------------------------------------------------+
4545 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4546 | STATE : code ROUTINE : ma_bsic_cnf |
4547 +--------------------------------------------------------------------+
4548
4549 PURPOSE : Sends the synchronisation result to RR.
4550
4551 */
4552
4553 GLOBAL void ma_bsic_cnf (T_MPH_BSIC_CNF* mph_bsic_cnf)
4554 {
4555 PSENDX (RR, mph_bsic_cnf);
4556 }
4557
4558 /*
4559 +--------------------------------------------------------------------+
4560 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4561 | STATE : code ROUTINE : ma_new_scell_req |
4562 +--------------------------------------------------------------------+
4563
4564 PURPOSE : Sends a new scell request to layer 1.
4565
4566 */
4567
4568 GLOBAL void ma_new_scell_req(T_MPHC_NEW_SCELL_REQ *new_scell)
4569 {
4570 GET_INSTANCE_DATA;
4571 alr_data->bsic = new_scell->tsc;
4572 PSENDX(L1, new_scell);
4573 }
4574
4575 /*
4576 +--------------------------------------------------------------------+
4577 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
4578 | STATE : code ROUTINE : ma_mphc_init_l1_cnf |
4579 +--------------------------------------------------------------------+
4580
4581 PURPOSE : Process the primitive MPHC_INIT_L1_CON.
4582
4583 */
4584
4585 GLOBAL void ma_mphc_init_l1_cnf (T_MPHC_INIT_L1_CON *init_l1_cnf)
4586 {
4587 GET_INSTANCE_DATA;
4588
4589 switch (GET_STATE (STATE_CS))
4590 {
4591 case CS_INIT_ACTIVE:
4592 SET_STATE (STATE_CS, CS_INIT_DONE);
4593 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
4594 compare_l1_frequency_band_with_ffs (init_l1_cnf);
4595 #endif
4596 ma_cs_rxlev_req ();
4597 break;
4598 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
4599 default :
4600 TRACE_EVENT_P1 ("MPHC_INIT_L1_CON received in the wrong CS state %d", GET_STATE (STATE_CS));
4601 break;
4602 #else
4603 case CS_INIT_SYNC:
4604 SET_STATE (STATE_CS, CS_INIT_DONE);
4605 cs_bsic_req (NULL);
4606 #endif
4607 }
4608 PFREE (init_l1_cnf);
4609 }
4610
4611 /*
4612 +--------------------------------------------------------------------+
4613 | PROJECT : GSM-PS (6302) MODULE : ALR_MAIN |
4614 | STATE : code ROUTINE : ma_mphc_stop_dedi_con |
4615 +--------------------------------------------------------------------+
4616
4617 PURPOSE : Process the primitive MPHC_STOP_DEDICATED_CON.
4618
4619 */
4620
4621 GLOBAL void ma_mphc_stop_dedi_con (T_MPHC_STOP_DEDICATED_CON *stop_cnf)
4622 {
4623 #ifdef GPRS
4624 GET_INSTANCE_DATA;
4625 #endif
4626 PFREE (stop_cnf);
4627
4628 #ifdef GPRS
4629 if(alr_data->dedi_data.act_mode EQ MODE_PDCH_ASSIGN)
4630 {
4631 /*
4632 * Notify RR about the actions performed due to PDCH Assignment.
4633 * Note that MPH_DEDICATED_CNF is misleading as L1 is in Idle Mode now.
4634 */
4635 ma_dedi_cnf (DEDI_RES_OK);
4636 trc_state_transition(0, MA_IDLE);
4637 SET_STATE(STATE_MA, MA_IDLE); /* allow PTM with next MPH_IDLE_REQ(PTM) */
4638 return;
4639 }
4640 #endif
4641 {
4642 PALLOC(mph_dedi_cnf, MPH_STOP_DEDICATED_CNF);
4643 PSENDX ( RR, mph_dedi_cnf );
4644 }
4645 }
4646
4647 /*
4648 +--------------------------------------------------------------------+
4649 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4650 | STATE : code ROUTINE : convert_arfcn_to_l1 |
4651 +--------------------------------------------------------------------+
4652
4653 PURPOSE : Convert_arfcn_to_l1 converts the arfcn given by the upper
4654 layer (ETSI GSM spec.) to the internal format of layer 1.
4655
4656 Frequency Band config. ETSI GSM spec. coding used in L1
4657 GSM 900 STD_900 1-124 1-124
4658 E-GSM STD_EGSM 1-124, 1-124,
4659 975-1023, 0 975-1023, 0
4660 PCS 1900 STD_1900 512-810 1024-1322
4661 DCS 1800 STD_1800 512-885 512-885
4662 GSM 900/DCS 1800 STD_DUAL 1-124, 1-124,
4663 512-885 512-885
4664 E-GSM/DCS 1800 STD_DUAL_EGSM 1-124, 1-124,
4665 975-1023,0 975-1023,0
4666 512-885 512-885
4667 GSM 850 STD_850 128-251 128-251
4668 GSM 850/PCS 1900 STD_DUAL_US 128-251, 128-251,
4669 512-810 1024-1322
4670 GSM 850/DCS 1800 STD_850_1800 128-251, 128-251,
4671 512-885 512-885
4672 GSM 900/PCS 1900 STD_900_1900 1-124, 1-124,
4673 512-810 1024-1322
4674 */
4675
4676 GLOBAL USHORT convert_arfcn_to_l1 (USHORT arfcn, UBYTE local_std)
4677 {
4678 #ifdef WIN32
4679 GET_INSTANCE_DATA;
4680 if (!alr_data->mb_testing)
4681 arfcn = arfcn&ARFCN_MASK;
4682 else
4683 {
4684 #endif
4685 if (local_std EQ 0)
4686 local_std = std;
4687 arfcn &= ARFCN_MASK;
4688 switch (local_std)
4689 {
4690 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
4691 case STD_1900:
4692 case STD_DUAL_US:
4693 case STD_900_1900:
4694 case STD_850_900_1900:
4695 if ((arfcn >= LOW_CHANNEL_1900) AND (arfcn <= HIGH_CHANNEL_1900))
4696 arfcn += LOW_CHANNEL_1900;
4697 break;
4698 #else
4699 case STD_DUAL:
4700 if (arfcn >= LOW_CHANNEL_1800)
4701 arfcn -= (LOW_CHANNEL_1800-125);
4702 break;
4703
4704 case STD_EGSM:
4705 case STD_DUAL_EGSM:
4706 if (arfcn >= LOW_CHANNEL_EGSM)
4707 arfcn -= (LOW_CHANNEL_EGSM-125);
4708 else if (arfcn >= LOW_CHANNEL_1800)
4709 arfcn -= (LOW_CHANNEL_1800-175);
4710 else if (arfcn EQ CHANNEL_0)
4711 arfcn = 174;
4712 break;
4713
4714 case STD_DUAL_US:
4715 if (arfcn >= LOW_CHANNEL_1900)
4716 arfcn -= (LOW_CHANNEL_1900-125);
4717 else
4718 arfcn -= (LOW_CHANNEL_850-1);
4719 break;
4720 #endif
4721 default:
4722 break;
4723 }
4724 #ifdef WIN32
4725 }
4726 #endif
4727 return arfcn;
4728 }
4729
4730 /*
4731 +--------------------------------------------------------------------+
4732 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4733 | STATE : code ROUTINE : convert_arfcn_to_g23 |
4734 +--------------------------------------------------------------------+
4735
4736 PURPOSE : Convert_arfcn_to_g23 converts the radio frequence given by
4737 layer 1 to the common format of the upper layer (ETSI GSM spec.).
4738
4739 Frequency Band config. ETSI GSM spec. coding used in L1
4740 GSM 900 STD_900 1-124 1-124
4741 E-GSM STD_EGSM 1-124, 1-124,
4742 975-1023, 0 975-1023, 0
4743 PCS 1900 STD_1900 512-810 1024-1322
4744 DCS 1800 STD_1800 512-885 512-885
4745 GSM 900/DCS 1800 STD_DUAL 1-124, 1-124,
4746 512-885 512-885
4747 E-GSM/DCS 1800 STD_DUAL_EGSM 1-124, 1-124,
4748 975-1023,0 975-1023,0
4749 512-885 512-885
4750 GSM 850 STD_850 128-251 128-251
4751 GSM 850/PCS 1900 STD_DUAL_US 128-251, 128-251,
4752 512-810 1024-1322
4753 GSM 850/DCS 1800 STD_850_1800 128-251, 128-251,
4754 512-885 512-885
4755 GSM 900/PCS 1900 STD_900_1900 1-124, 1-124,
4756 512-810 1024-1322
4757 */
4758
4759 GLOBAL USHORT convert_arfcn_to_g23 (USHORT arfcn, UBYTE local_std)
4760 {
4761 #ifdef WIN32
4762 GET_INSTANCE_DATA;
4763 if (!alr_data->mb_testing)
4764 arfcn = arfcn&ARFCN_MASK;
4765 else
4766 {
4767 #endif
4768 if (local_std EQ 0)
4769 local_std = std;
4770 arfcn &= ARFCN_MASK;
4771 switch (local_std)
4772 {
4773 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
4774 case STD_1900:
4775 case STD_DUAL_US:
4776 case STD_900_1900:
4777 case STD_850_900_1900:
4778 if (arfcn >= LOW_CHANNEL_1900_INTERNAL)
4779 arfcn -= LOW_CHANNEL_1900;
4780 break;
4781 #else
4782 case STD_DUAL:
4783 if (arfcn >=125)
4784 arfcn += (LOW_CHANNEL_1800-125);
4785 break;
4786
4787 case STD_EGSM:
4788 case STD_DUAL_EGSM:
4789 if (arfcn >= 175)
4790 arfcn += (LOW_CHANNEL_1800-175);
4791 else if (arfcn EQ 174)
4792 arfcn = CHANNEL_0;
4793 else if (arfcn >= 125)
4794 arfcn += (LOW_CHANNEL_EGSM-125);
4795 break;
4796
4797 case STD_DUAL_US:
4798 if (arfcn >= 125)
4799 arfcn += (LOW_CHANNEL_1900-125);
4800 else
4801 arfcn += (LOW_CHANNEL_850-1);
4802 /*lint -fallthrough*/
4803 case STD_850:
4804 case STD_1900:
4805 /* only for MPH_POWER_CNF and MPH_BSIC_CNF
4806 arfcn |= US_BIT;
4807 */
4808 break;
4809 #endif
4810 default:
4811 break;
4812 }
4813 #ifdef WIN32
4814 }
4815 #endif
4816 return arfcn;
4817 }
4818
4819 /*
4820 +--------------------------------------------------------------------+
4821 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4822 | STATE : code ROUTINE : ma_clean_dedi_sys_buffer |
4823 +--------------------------------------------------------------------+
4824
4825 PURPOSE : Cleans System Information Message from SACCH.
4826
4827 */
4828
4829 GLOBAL void ma_clean_dedi_sys_buffer (void)
4830 {
4831 GET_INSTANCE_DATA;
4832 memset (alr_data->ma_data.sys_info_5, 0, 18);
4833 memset (alr_data->ma_data.sys_info_5bis, 0, 18);
4834 memset (alr_data->ma_data.sys_info_5ter, 0, 18);
4835 memset (alr_data->ma_data.sys_info_6, 0, 18);
4836 }
4837
4838
4839 /*
4840 +--------------------------------------------------------------------+
4841 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4842 | STATE : code ROUTINE : ma_set_si_bitmap |
4843 +--------------------------------------------------------------------+
4844
4845 PURPOSE : Updates the si_bitmap.
4846
4847 */
4848
4849 LOCAL void ma_set_si_bitmap (UBYTE msg_t)
4850 {
4851 GET_INSTANCE_DATA;
4852 switch(msg_t)
4853 {
4854 case D_SYS_INFO_1:
4855 alr_data->cs_data.si_bitmap |= SI_1_READ;
4856 break;
4857 case D_SYS_INFO_2:
4858 alr_data->cs_data.si_bitmap |= SI_2_READ;
4859 break;
4860 case D_SYS_INFO_3:
4861 alr_data->cs_data.si_bitmap |= SI_3_READ;
4862 break;
4863 case D_SYS_INFO_4:
4864 alr_data->cs_data.si_bitmap |= SI_4_READ;
4865 break;
4866 case D_SYS_INFO_2BIS:
4867 alr_data->cs_data.si_bitmap |= SI_2BIS_READ;
4868 break;
4869 case D_SYS_INFO_2TER:
4870 alr_data->cs_data.si_bitmap |= SI_2TER_READ;
4871 break;
4872 default:
4873 break;
4874 }
4875 }
4876 /*
4877 +--------------------------------------------------------------------+
4878 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4879 | STATE : code ROUTINE : ma_fill_sys_buffer |
4880 +--------------------------------------------------------------------+
4881
4882 PURPOSE : Stores a System Information Message.
4883
4884 */
4885
4886 LOCAL void ma_fill_sys_buffer (T_MPHC_DATA_IND* data_ind, UBYTE msg_t)
4887 {
4888 GET_INSTANCE_DATA;
4889 switch (msg_t)
4890 {
4891 case D_SYS_INFO_1:
4892 memcpy (alr_data->ma_data.sys_info_1,
4893 &data_ind->l2_frame.content[1], 22);
4894 break;
4895 case D_SYS_INFO_2:
4896 memcpy (alr_data->ma_data.sys_info_2,
4897 &data_ind->l2_frame.content[1], 22);
4898 break;
4899 case D_SYS_INFO_2BIS:
4900 memcpy (alr_data->ma_data.sys_info_2bis,
4901 &data_ind->l2_frame.content[1], 22);
4902 break;
4903 case D_SYS_INFO_2TER:
4904 memcpy (alr_data->ma_data.sys_info_2ter,
4905 &data_ind->l2_frame.content[1], 22);
4906 break;
4907 #if defined (REL99) && defined (TI_PS_FF_EMR)
4908 case D_SYS_INFO_2QUATER:
4909 memcpy (alr_data->ma_data.sys_info_2quater,
4910 &data_ind->l2_frame.content[1], 22);
4911 break;
4912 #endif
4913 case D_SYS_INFO_3:
4914 memcpy (alr_data->ma_data.sys_info_3,
4915 &data_ind->l2_frame.content[1], 22);
4916 break;
4917 case D_SYS_INFO_4:
4918 memcpy (alr_data->ma_data.sys_info_4,
4919 &data_ind->l2_frame.content[1], 22);
4920 break;
4921 #ifdef GPRS
4922 case D_SYS_INFO_13:
4923 memcpy (alr_data->ma_data.sys_info_13,
4924 &data_ind->l2_frame.content[1], 22);
4925 break;
4926 #endif /* GPRS */
4927 default:
4928 break;
4929 }
4930 }
4931
4932 /*
4933 +--------------------------------------------------------------------+
4934 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
4935 | STATE : code ROUTINE : ma_compare_sys_buffer |
4936 +--------------------------------------------------------------------+
4937
4938 PURPOSE : Compares a System Information Message.
4939
4940 */
4941 LOCAL BOOL ma_compare_sys_buffer (T_MPHC_DATA_IND *mphc_data_ind,
4942 UBYTE msg_t)
4943 {
4944 GET_INSTANCE_DATA;
4945 switch (msg_t)
4946 {
4947 case D_SYS_INFO_1:
4948 return (!memcmp (alr_data->ma_data.sys_info_1,
4949 &mphc_data_ind->l2_frame.content[1], 22));
4950 /*break;*/
4951 case D_SYS_INFO_2:
4952 return (!memcmp (alr_data->ma_data.sys_info_2,
4953 &mphc_data_ind->l2_frame.content[1], 22));
4954 /*break;*/
4955 case D_SYS_INFO_2BIS:
4956 return (!memcmp (alr_data->ma_data.sys_info_2bis,
4957 &mphc_data_ind->l2_frame.content[1], 22));
4958 /*break;*/
4959 case D_SYS_INFO_2TER:
4960 return (!memcmp (alr_data->ma_data.sys_info_2ter,
4961 &mphc_data_ind->l2_frame.content[1], 18));/* Ignore si2ter_rest_octets changes */
4962 /*break;*/
4963 #if defined (REL99) && defined (TI_PS_FF_EMR)
4964 case D_SYS_INFO_2QUATER:
4965 return 0;
4966 /*break;*/
4967 #endif
4968 case D_SYS_INFO_3:
4969 return (!memcmp (alr_data->ma_data.sys_info_3,
4970 &mphc_data_ind->l2_frame.content[1], 22));
4971 /*break;*/
4972 case D_SYS_INFO_4:
4973 return (!memcmp (alr_data->ma_data.sys_info_4,
4974 &mphc_data_ind->l2_frame.content[1], 22));
4975 /*break;*/
4976 #ifdef GPRS
4977 case D_SYS_INFO_13:
4978 return (!memcmp (alr_data->ma_data.sys_info_13,
4979 &mphc_data_ind->l2_frame.content[1], 22));
4980 /*break;*/
4981 #endif /* GPRS */
4982 default:
4983 break;
4984 }
4985 return 0;
4986 }
4987
4988
4989 GLOBAL void sc_start_periodic (void)
4990 {
4991 GET_INSTANCE_DATA;
4992 #ifdef GPRS
4993 if(gprs_check_read_si13_only())
4994 #endif /* GPRS */
4995 {
4996 USHORT i;
4997 UBYTE k, si_bitmap = alr_data->cs_data.si_bitmap;
4998 PALLOC(scell_bcch_req, MPHC_SCELL_NBCCH_REQ);
4999
5000 /* 3GPP TS 05.02 Section 6.3.1.3: If only one of SI2bis and
5001 * SI2ter is there it will be sent when TC=5
5002 */
5003 if((si_bitmap&SI_2BIS_READ) EQ 0 AND
5004 (si_bitmap&SI_2TER_READ) NEQ 0)
5005 si_bitmap = (si_bitmap & ~(SI_2TER_READ)) | SI_2BIS_READ;
5006
5007 /* we want to read all SYSTEM INFO's broadcasted, TC=0..7 */
5008 for (i=0,k=0; i < 8; i++ )
5009 {
5010 if( (si_bitmap&(1<<i)) != 0)
5011 {
5012 scell_bcch_req->schedule_array[k].modulus = THIRTY_SECONDS_SCELL_BCCH;
5013 scell_bcch_req->schedule_array[k].relative_position = i;
5014 k++;
5015 }
5016 }
5017 scell_bcch_req->schedule_array_size = k;
5018 ma_scell_nbcch_req(scell_bcch_req);
5019 }
5020
5021 }
5022
5023 /*
5024 +--------------------------------------------------------------------+
5025 | PROJECT : GSM-PS (6103) MODULE : alr_MAIN |
5026 | STATE : code ROUTINE : ma_is_ptm |
5027 +--------------------------------------------------------------------+
5028
5029 PURPOSE : Returns True if the current state is MA_PTM,
5030 otherwise returns FALSE.
5031
5032 */
5033
5034
5035 #ifdef GPRS
5036 GLOBAL BOOL ma_is_ptm(void)
5037 {
5038 GET_INSTANCE_DATA;
5039 if(GET_STATE(STATE_MA) EQ MA_PTM)
5040 return TRUE;
5041 else
5042 return FALSE;
5043 }
5044 #endif /* GPRS */
5045
5046 /*
5047 +--------------------------------------------------------------------+
5048 | PROJECT : GSM-PS (6103) MODULE : alr_MAIN |
5049 | STATE : code ROUTINE : ma_nc_rxlev_sc_req |
5050 +--------------------------------------------------------------------+
5051
5052 PURPOSE : A new RXLEV value of the serving cell has been measured.
5053 Inform GPL in case it is necessary.
5054
5055 */
5056 #ifdef GPRS
5057
5058 GLOBAL void ma_nc_rxlev_sc_req (T_TB_RXLEV_SC_REQ *rxlev_sc_req)
5059 {
5060 GET_INSTANCE_DATA;
5061 if(GET_STATE (STATE_MA) EQ MA_IDLE AND
5062 gprs_alr_is_supported( ) EQ TRUE )
5063 {
5064 PSENDX (GPL, rxlev_sc_req);
5065 }
5066 else
5067 {
5068 PFREE (rxlev_sc_req);
5069 }
5070 }
5071
5072 #endif /* #ifdef GPRS */
5073
5074 /*
5075 *--------------------------------------------------------------------
5076 * helper functions for main process
5077 * these should all be LOCAL
5078 *--------------------------------------------------------------------
5079 */
5080
5081 /*
5082 +--------------------------------------------------------------------+
5083 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
5084 | STATE : code ROUTINE : ma_clean_sys_buffer |
5085 +--------------------------------------------------------------------+
5086
5087 PURPOSE : Cleans System Information Message from BCCH.
5088
5089 */
5090
5091 GLOBAL void ma_clean_sys_buffer (USHORT si_mask)
5092 {
5093 GET_INSTANCE_DATA;
5094 if ( si_mask & IND_SI_1 ) memset (alr_data->ma_data.sys_info_1, 0, 22);
5095 if ( si_mask & IND_SI_2 ) memset (alr_data->ma_data.sys_info_2, 0, 22);
5096 if ( si_mask & IND_SI_2BIS ) memset (alr_data->ma_data.sys_info_2bis, 0, 22);
5097 if ( si_mask & IND_SI_3 ) memset (alr_data->ma_data.sys_info_3, 0, 22);
5098 if ( si_mask & IND_SI_4 ) memset (alr_data->ma_data.sys_info_4, 0, 22);
5099 if ( si_mask & IND_SI_2TER ) memset (alr_data->ma_data.sys_info_2ter, 0, 22);
5100 #if defined (REL99) && defined (TI_PS_FF_EMR)
5101 if ( si_mask & IND_SI_2QUATER ) memset (alr_data->ma_data.sys_info_2quater, 0, 22);
5102 #endif
5103 #ifdef GPRS
5104 if ( si_mask & IND_SI_13 ) memset (alr_data->ma_data.sys_info_13, 0, 22);
5105 #endif
5106 if ( si_mask & IND_SI_5 ) memset (alr_data->ma_data.sys_info_5, 0, 18);
5107 if ( si_mask & IND_SI_5BIS ) memset (alr_data->ma_data.sys_info_5bis, 0, 18);
5108 if ( si_mask & IND_SI_5TER ) memset (alr_data->ma_data.sys_info_5ter, 0, 18);
5109 if ( si_mask & IND_SI_6 ) memset (alr_data->ma_data.sys_info_6, 0, 18);
5110 }
5111
5112
5113
5114 /*
5115 +--------------------------------------------------------------------+
5116 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
5117 | STATE : code ROUTINE : ma_fill_dedi_sys_buffer |
5118 +--------------------------------------------------------------------+
5119
5120 PURPOSE : Stores a System Information Message from SACCH.
5121
5122 */
5123 LOCAL void ma_fill_dedi_sys_buffer (T_MPHC_DATA_IND * mphc_data_ind,
5124 UBYTE msg_t)
5125 {
5126 GET_INSTANCE_DATA;
5127 switch (msg_t)
5128 {
5129 case D_SYS_INFO_5:
5130 memcpy (alr_data->ma_data.sys_info_5,
5131 &mphc_data_ind->l2_frame.content[5], 18);
5132 break;
5133 case D_SYS_INFO_5BIS:
5134 memcpy (alr_data->ma_data.sys_info_5bis,
5135 &mphc_data_ind->l2_frame.content[5], 18);
5136 break;
5137 case D_SYS_INFO_5TER:
5138 memcpy (alr_data->ma_data.sys_info_5ter,
5139 &mphc_data_ind->l2_frame.content[5], 18);
5140 break;
5141 case D_SYS_INFO_6:
5142 memcpy (alr_data->ma_data.sys_info_6,
5143 &mphc_data_ind->l2_frame.content[5], 18);
5144 break;
5145 }
5146 }
5147
5148 /*
5149 +--------------------------------------------------------------------+
5150 | PROJECT : GSM-PS (6103) MODULE : alr_MAIN |
5151 | STATE : code ROUTINE : ma_compare_dedi_sys_buffer |
5152 +--------------------------------------------------------------------+
5153
5154 PURPOSE : Compares a System Information Message on SACCH.
5155
5156 */
5157
5158 LOCAL BOOL ma_compare_dedi_sys_buffer (T_MPHC_DATA_IND * mphc_data_ind,
5159 UBYTE msg_t)
5160 {
5161 GET_INSTANCE_DATA;
5162 switch (msg_t)
5163 {
5164 case D_SYS_INFO_5:
5165 return (!memcmp (alr_data->ma_data.sys_info_5,
5166 &mphc_data_ind->l2_frame.content[5], 18));
5167 /*break;*/
5168 case D_SYS_INFO_5BIS:
5169 return (!memcmp (alr_data->ma_data.sys_info_5bis,
5170 &mphc_data_ind->l2_frame.content[5], 18));
5171 /*break;*/
5172 case D_SYS_INFO_5TER:
5173 return (!memcmp (alr_data->ma_data.sys_info_5ter,
5174 &mphc_data_ind->l2_frame.content[5], 18));
5175 /*break;*/
5176 case D_SYS_INFO_6:
5177 return (!memcmp (alr_data->ma_data.sys_info_6,
5178 &mphc_data_ind->l2_frame.content[5], 18));
5179 /*break;*/
5180 default:
5181 break;
5182 }
5183 return FALSE;
5184 }
5185
5186 /*
5187 +--------------------------------------------------------------------+
5188 | PROJECT : GSM-PS (6147) MODULE : RR_ATT |
5189 | STATE : code ROUTINE : tim_stop_sync_to_nw |
5190 +--------------------------------------------------------------------+
5191
5192 PURPOSE : Timeout of TIM_NW_SYNC_GUARD - Time to cancel Nw
5193 search as it is taking too long
5194
5195 */
5196 GLOBAL void tim_stop_sync_to_nw( void )
5197 {
5198 GET_INSTANCE_DATA;
5199 /* Change the CS State to CS_NW_SYNC_TIMEOUT only if NW Sync is active */
5200 if(alr_data->cs_data.sync_active)
5201 {
5202 SET_STATE(STATE_CS, CS_NW_SYNC_TIMEOUT);
5203 ma_cs_stop_network_sync_req();
5204 }
5205 }
5206
5207 #ifdef _TARGET_
5208 #ifndef FAX_AND_DATA
5209 /*
5210 * Dummy functions for RA (needed when building voice-only PS w/ F&D TI
5211 * layer 1 libs).
5212 */
5213 GLOBAL void dll_data_ul
5214 (
5215 USHORT *_ul_buffer_address,
5216 USHORT *_d_ra_conf,
5217 USHORT *_d_ra_act,
5218 USHORT *_d_ra_test,
5219 USHORT *_d_ra_statu,
5220 USHORT *_d_fax
5221 )
5222 {
5223 /* do nothing */
5224 }
5225
5226 GLOBAL void dll_data_dl
5227 (
5228 USHORT *_dl_buffer_address,
5229 USHORT *_d_ra_act,
5230 USHORT *_d_ra_statd
5231 )
5232 {
5233 /* do nothing */
5234 }
5235 #endif /* !_FAX_AND_DATA_ */
5236
5237 #ifndef GPRS
5238 /*
5239 * Dummy functions for GRR (needed when building non-GPRS PS w/ GPRS TI
5240 * layer 1 libs).
5241 */
5242 typedef void T_ul_poll_resp;
5243 typedef void T_ul_data;
5244 typedef void T_dl_struct;
5245 typedef UBYTE UWORD8;
5246 typedef ULONG UWORD32;
5247 #define WORD8 UBYTE
5248 #define UWORD16 USHORT
5249
5250 GLOBAL void maca_power_control ( UWORD8 assignment_id,
5251 BOOL crc_error,
5252 WORD8 bcch_level,
5253 UWORD16 *radio_freq,
5254 WORD8 *burst_level,
5255 UWORD8 *pch )
5256 {
5257 /* do nothing */
5258 }
5259
5260 GLOBAL void rlc_uplink ( UWORD8 assignment_id,
5261 UWORD8 tx_data_no,
5262 UWORD32 fn,
5263 UWORD8 timing_advance_value,
5264 T_ul_poll_resp * ul_poll_response,
5265 T_ul_data * ul_data,
5266 BOOL allocation_exhausted)
5267 {
5268 /* do nothing */
5269 }
5270
5271 GLOBAL void rlc_downlink ( UWORD8 assignment_id,
5272 UWORD32 fn,
5273 T_dl_struct *data_ptr,
5274 UWORD8 rlc_blocks_sent,
5275 UWORD8 last_poll_response)
5276 {
5277 /* do nothing */
5278 }
5279 #endif /* !GPRS */
5280 #endif /* _TARGET_ */
5281 #if defined (REL99) && defined (TI_PS_FF_EMR)
5282 /*
5283 +--------------------------------------------------------------------+
5284 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
5285 | STATE : code ROUTINE : ma_mph_enhpara_update_req |
5286 +--------------------------------------------------------------------+
5287
5288 PURPOSE : Process the primitive MPH_ENHPARA_UPDATE_REQ.
5289
5290 */
5291
5292 GLOBAL void ma_mph_enhpara_update_req (T_MPH_ENHPARA_UPDATE_REQ* p_enh)
5293 {
5294 GET_INSTANCE_DATA;
5295 /*UBYTE i=0;*/
5296
5297 alr_data->nc_data.emr_data.rep_type = p_enh->rep_type;
5298 alr_data->nc_data.emr_data.enh_para = p_enh->enh_para;
5299 PFREE(p_enh);
5300 return;
5301 }
5302
5303 /*
5304 +--------------------------------------------------------------------+
5305 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
5306 | STATE : code ROUTINE : ma_mph_mon_ctrl_req |
5307 +--------------------------------------------------------------------+
5308
5309 PURPOSE : Process the primitive MPH_MON_CTRL_REQ.
5310
5311 */
5312 GLOBAL void ma_mph_mon_ctrl_req(T_MPH_MON_CTRL_REQ* ctrl_req)
5313 {
5314 GET_INSTANCE_DATA;
5315 TRACE_EVENT ("ma_mph_mon_ctrl_req");
5316 /*Note: Request for monitoring SI-2quater will always be
5317 given for serving cell and when it is in stable IDLE state
5318 So, no need to check for MA_STATE here*/
5319 if ( (ctrl_req->action EQ START_MON_NBCCH ) AND
5320 (ctrl_req->si_to_read EQ UPDATE_SI2QUATER ) )
5321 {
5322 if(alr_data->ma_data.sys_info_2quater[1] EQ D_SYS_INFO_2QUATER)
5323 {
5324 ma_send_stored_SI2qtr(&alr_data->ma_data.sys_info_2quater[0]);
5325 memset (alr_data->ma_data.sys_info_2quater, 0, 22);
5326 }
5327 ma_scell_mon_si2quater_nbcch();
5328 }
5329 else if ( (ctrl_req->action EQ START_MON_EBCCH ) AND
5330 (ctrl_req->si_to_read EQ UPDATE_SI2QUATER ) )
5331 {
5332 if(alr_data->ma_data.sys_info_2quater[1] EQ D_SYS_INFO_2QUATER)
5333 {
5334 ma_send_stored_SI2qtr(&alr_data->ma_data.sys_info_2quater[0]);
5335 memset (alr_data->ma_data.sys_info_2quater, 0, 22);
5336 }
5337 ma_scell_mon_si2quater_ebcch();
5338 }
5339 else if((ctrl_req->si_to_read EQ UPDATE_SI2QUATER_AGAIN) AND
5340 (ctrl_req->action EQ START_MON_EBCCH ))
5341 {
5342 ma_scell_mon_si2quater_ebcch();
5343 }
5344 else if((ctrl_req->si_to_read EQ UPDATE_SI2QUATER_AGAIN) AND
5345 (ctrl_req->action EQ START_MON_NBCCH ))
5346 {
5347 ma_scell_mon_si2quater_nbcch();
5348 }
5349
5350 else if ( (ctrl_req->action EQ STOP_MON_BCCH)AND
5351 (ctrl_req->si_to_read EQ UPDATE_SI2QUATER ) )
5352 {
5353 if ( alr_data->nc_data.si2quater_status EQ SI2QUATER_ACQ_PENDING)
5354 {
5355 if(alr_data->nc_data.si2quater_pos EQ SI2QUATER_ON_EBCCH)
5356 {
5357 ma_stop_scell_bcch_req();
5358 }
5359 sc_start_periodic();
5360 }
5361 alr_data->nc_data.si2quater_status = SI2QUATER_ACQ_COMP;
5362 }
5363 else if((ctrl_req->action EQ STOP_MON_BCCH)AND
5364 (ctrl_req->si_to_read EQ UPDATE_SI2QUATER_AGAIN) )
5365 {
5366 if (alr_data->nc_data.si2quater_status EQ SI2QUATER_ACQ_PENDING)
5367 {
5368 if(alr_data->nc_data.si2quater_pos EQ SI2QUATER_ON_EBCCH)
5369 {
5370 ma_stop_scell_bcch_req();
5371 }
5372 sc_start_periodic();
5373 }
5374 alr_data->nc_data.si2quater_status = SI2QUATER_ACQ_WRONG_BAIND;
5375 }
5376
5377 #ifdef GPRS
5378 else
5379 {
5380 gprs_alr_mon_ctrl_req(ctrl_req);
5381 return;
5382 }
5383 #endif
5384
5385 #ifdef _SIMULATION_
5386 switch(alr_data->nc_data.si2quater_status) {
5387 case SI2QUATER_ACQ_PENDING:
5388 TRACE_EVENT ("Status of SI-2quater : SI2QUATER_ACQ_PENDING");
5389 break;
5390 case SI2QUATER_ACQ_FULL_BCCH:
5391 TRACE_EVENT ("Status of SI-2quater : SI2QUATER_ACQ_FULL_BCCH");
5392 break;
5393 case SI2QUATER_ACQ_COMP:
5394 TRACE_EVENT ("Status of SI-2quater : SI2QUATER_ACQ_COMP");
5395 break;
5396 case SI2QUATER_ACQ_WRONG_BAIND:
5397 TRACE_EVENT ("Status of SI-2quater : SI2QUATER_ACQ_WRONG_BAIND");
5398 break;
5399 default:
5400 TRACE_EVENT ("Status of SI-2quater : SI2QUATER_ABSENT");
5401 }
5402 #endif
5403 PFREE(ctrl_req);
5404 return;
5405 }
5406
5407 /*
5408 +--------------------------------------------------------------------+
5409 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
5410 | STATE : code ROUTINE : ma_scell_mon_si2quater_ebcch |
5411 +--------------------------------------------------------------------+
5412
5413 PURPOSE : configure L1 for monitoring SI-2quater on EBCCH.
5414
5415 */
5416 GLOBAL void ma_scell_mon_si2quater_ebcch(void)
5417 {
5418 GET_INSTANCE_DATA;
5419 PALLOC(req, MPHC_SCELL_EBCCH_REQ);
5420 TRACE_EVENT ("ma_scell_mon_si2quater_ebcch");
5421 req->schedule_array_size = 1;
5422 req->schedule_array[0].relative_position = 5;
5423 req->schedule_array[0].modulus = 8;
5424 ma_scell_ebcch_req(req);
5425 alr_data->nc_data.si2quater_status = SI2QUATER_ACQ_PENDING;
5426 }
5427
5428 /*
5429 +--------------------------------------------------------------------+
5430 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
5431 | STATE : code ROUTINE : ma_scell_mon_si2quater_nbcch |
5432 +--------------------------------------------------------------------+
5433
5434 PURPOSE : configure L1 for monitoring SI-2quater on NBCCH.
5435
5436 */
5437 GLOBAL void ma_scell_mon_si2quater_nbcch(void)
5438 {
5439 GET_INSTANCE_DATA;
5440 PALLOC(req, MPHC_SCELL_NBCCH_REQ);
5441 TRACE_EVENT ("ma_scell_mon_si2quater_nbcch");
5442 /*on N-BCCH, SI-2quater can be received on either
5443 TC = 5 or 4 depending on scheduling of SI-2bis/ter */
5444 req->schedule_array_size = 2;
5445 req->schedule_array[0].relative_position = 5;
5446 req->schedule_array[0].modulus = 8;
5447 req->schedule_array[1].relative_position = 4;
5448 req->schedule_array[1].modulus = 8;
5449 ma_scell_nbcch_req(req);
5450 alr_data->nc_data.si2quater_status = SI2QUATER_ACQ_PENDING;
5451 return;
5452 }
5453
5454 /* BCCH MAPPING
5455 ====================================================================
5456 System Information Message | Sent when TC = | Allocation
5457 ====================================================================
5458 Type 1 0 BCCH Norm
5459 -----------------------------------------------------------------
5460 Type 2 1 BCCH Norm
5461 -----------------------------------------------------------------
5462 Type 2 bis 5 BCCH Norm
5463 -----------------------------------------------------------------
5464 Type 2 ter 5 or 4 BCCH Norm
5465 -----------------------------------------------------------------
5466 Type 2 quater 5 BCCH Norm
5467 or
5468 4or5 BCCH Ext
5469 -----------------------------------------------------------------
5470 Type 3 2 and 6 BCCH Norm
5471 -----------------------------------------------------------------
5472 Type 4 3 and 7 BCCH Norm
5473 -----------------------------------------------------------------
5474 Type 7 7 BCCH Ext
5475 -----------------------------------------------------------------
5476 Type 8 3 BCCH Ext
5477 -----------------------------------------------------------------
5478 Type 9 4 BCCH Norm
5479 -----------------------------------------------------------------
5480 Type 13 4 BCCH Norm
5481 or
5482 0 BCCH Ext
5483 -----------------------------------------------------------------
5484 Type 16 6 BCCH Ext
5485 -----------------------------------------------------------------
5486 Type 17 2 BCCH Ext
5487 -----------------------------------------------------------------
5488 */
5489
5490 /*
5491 +--------------------------------------------------------------------+
5492 | PROJECT : GSM-PS (6103) MODULE : ALR_MAIN |
5493 | STATE : code ROUTINE : ma_send_stored_SI2qtr |
5494 +--------------------------------------------------------------------+
5495
5496 PURPOSE : Cut pseudo length and send the stored SI2qtr data to RR.
5497
5498 */
5499 GLOBAL void ma_send_stored_SI2qtr(UBYTE* si_2quater)
5500 {
5501 GET_INSTANCE_DATA;
5502 USHORT len_in_bits = 22 * BITS_PER_BYTE;
5503 PALLOC_SDU (data_out, MPH_UNITDATA_IND, len_in_bits);
5504
5505 /* No IE and Pseudo Length */
5506 data_out->sdu.l_buf = (22 ) * BITS_PER_BYTE;
5507 /* Pseudo Length */
5508 data_out->sdu.o_buf = 0;
5509 /* No IE */
5510 /*lint -e{419} (Warning -- Apparent data overrun) */
5511 memcpy (data_out->sdu.buf, &si_2quater[0], 22 );
5512 data_out->arfcn = alr_data->serving_cell;
5513 TRACE_EVENT("SI2qtr sent from the function ma_send_stored_SI2qtr");
5514 PSENDX (RR, data_out);
5515 }
5516 #endif
5517
5518 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
5519 LOCAL void compare_l1_frequency_band_with_ffs (T_MPHC_INIT_L1_CON *init_l1_cnf)
5520 {
5521 GET_INSTANCE_DATA;
5522 int i;
5523 U16 freq_band ;
5524
5525 PALLOC(mph_init_rr_ind, MPH_INIT_RR_IND);
5526
5527 for (i=0; i<NB_MAX_GSM_BANDS; i++)
5528 {
5529 if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_PGSM900)
5530 {
5531 freq_band |= BAND_GSM_900;
5532 mph_init_rr_ind->pclass_900 = init_l1_cnf->multiband_power_class[i].power_class;
5533 }
5534 else if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_GSM850)
5535 {
5536 freq_band |= BAND_GSM_850;
5537 mph_init_rr_ind->pclass_850 = init_l1_cnf->multiband_power_class[i].power_class;
5538 }
5539 else if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_PCS1900)
5540 {
5541 freq_band |= BAND_PCS_1900;
5542 mph_init_rr_ind->pclass_1900 = init_l1_cnf->multiband_power_class[i].power_class;
5543 }
5544 else if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_DCS1800)
5545 {
5546 freq_band |= BAND_DCS_1800;
5547 mph_init_rr_ind->pclass_1800 = init_l1_cnf->multiband_power_class[i].power_class;
5548 }
5549 else if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_GSM480)
5550 {
5551 freq_band |= BAND_GSM_480;
5552 }
5553 else if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_GSM450)
5554 {
5555 freq_band |= BAND_GSM_450;
5556 }
5557 else if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_EGSM900)
5558 {
5559 freq_band |= BAND_E_GSM;
5560 mph_init_rr_ind->pclass_900 = init_l1_cnf->multiband_power_class[i].power_class;
5561 }
5562 else if (init_l1_cnf->multiband_power_class[i].radio_band == RADIO_BAND_RGSM900)
5563 {
5564 freq_band |= BAND_R_GSM;
5565 }
5566 }
5567
5568 mph_init_rr_ind->freq_bands = freq_band;
5569 PSENDX (RR, mph_init_rr_ind);
5570 /*
5571 if (freq_band NEQ alr_data->cs_data.freq_bands)
5572 {
5573 TRACE_EVENT_P2 ("FFS data %x, doen't match L1 compilation flag %x", alr_data->cs_data.freq_bands, freq_band);
5574 TRACE_ERROR ("FFS data doesn't match L1 compilation flag");
5575 TRACE_ASSERT (freq_band NEQ alr_data->cs_data.freq_bands);
5576 }*/
5577 }
5578 #endif
5579
5580 #endif /* ALR_MAIN_C */