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