FreeCalypso > hg > freecalypso-citrine
comparison g23m-gsm/rr/rr_em.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This Module defines the engineering mode (EM) device driver for the | |
18 | G23 protocol stack. This driver is used to control all engineering | |
19 | mode related functions. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef RR_EM_C | |
24 #define RR_EM_C | |
25 | |
26 #include "config.h" | |
27 #include "fixedconf.h" | |
28 #include "condat-features.h" | |
29 | |
30 #define ENTITY_RR | |
31 | |
32 /*==== INCLUDES ===================================================*/ | |
33 | |
34 #include <string.h> | |
35 #include <stdlib.h> | |
36 #include <stddef.h> /* offsetof */ | |
37 #include <stdio.h> /* sprintf */ | |
38 #include "typedefs.h" | |
39 #include "pcm.h" | |
40 #include "pconst.cdg" | |
41 #include "mconst.cdg" | |
42 #include "message.h" | |
43 #include "ccdapi.h" | |
44 #include "vsi.h" | |
45 #include "custom.h" | |
46 #include "gsm.h" | |
47 #include "prim.h" | |
48 #include "cnf_rr.h" | |
49 #include "tok.h" | |
50 #include "rr.h" | |
51 #include "rr_em.h" | |
52 | |
53 /*==== EXPORT =====================================================*/ | |
54 | |
55 /*==== VARIABLES ==================================================*/ | |
56 | |
57 #ifdef FF_EM_MODE | |
58 | |
59 /* | |
60 These variables are used between entities. Even this is not a clean solution it is a straigth forward | |
61 way to reduce the overhead to a minimum. A clean solution would be based on an only usage of primitives | |
62 which would stress the os with no aditional advantage!! | |
63 */ | |
64 /* these are accessed by ACI */ | |
65 GLOBAL UBYTE em_rr_sem_buffer [EM_RR_SEM_SIZE]; /*lint -esym(552,em_rr_sem_buffer) -esym(765,em_rr_sem_buffer ) */ | |
66 GLOBAL UBYTE em_rr_sem_index; /*lint -esym(765,em_rr_sem_index)*/ | |
67 GLOBAL UBYTE em_act_dlt = 0; /*lint -esym(765,em_act_dlt) | used by ALR */ | |
68 GLOBAL UBYTE em_act_rlt = 0; /*lint -esym(765,em_act_rlt) | used by ALR */ | |
69 | |
70 static USHORT ma [MAX_MA_CHANNELS]; /* MA list after starting time */ | |
71 static USHORT ma2[MAX_MA_CHANNELS]; /* MA list before starting time if available */ | |
72 static UBYTE v_start=0; /* starting time valid */ | |
73 static UBYTE maio2=0; | |
74 | |
75 static T_HANDLE sem_EM_RR; | |
76 static UBYTE em_rr_trace_occured; | |
77 | |
78 | |
79 /* Event tracing flags for EM */ | |
80 GLOBAL BOOL rr_v[EM_MAX_RR_EVENTS]; | |
81 GLOBAL USHORT em_assign_fail_rr_cause; | |
82 GLOBAL USHORT em_handover_fail_rr_cause; | |
83 | |
84 LOCAL void em_rr_sem_clear (void); | |
85 LOCAL void rr_em_first_event_check(void); | |
86 | |
87 #endif /* FF_EM_MODE */ | |
88 | |
89 /*==== FUNCTIONS ==================================================*/ | |
90 #ifdef FF_EM_MODE | |
91 | |
92 | |
93 /* | |
94 +------------------------------------------------------------------------------ | |
95 | Function : dat_em_get_hchn | |
96 +------------------------------------------------------------------------------ | |
97 | Description : This function stores the hopping channels after change occured. | |
98 | | |
99 | Parameters : channel_array - channel mode 1 | |
100 | channel2_array - channel mode 2 | |
101 | start - valid flag for channel mode2 | |
102 | maio_2 - MAIO for before time configuration | |
103 | | |
104 | Return : void | |
105 +------------------------------------------------------------------------------ | |
106 */ | |
107 | |
108 GLOBAL void dat_em_get_hchn (USHORT* channel_array, USHORT* channel2_array, UBYTE start,UBYTE maio_2) | |
109 { | |
110 TRACE_FUNCTION ("dat_em_get_hchn()"); | |
111 | |
112 memset(ma, 0, 65); | |
113 memset(ma2, 0, 65); | |
114 memcpy(ma, channel_array, 65); | |
115 v_start = start; | |
116 if (v_start) { | |
117 maio2 = maio_2; | |
118 memcpy(ma2, channel2_array, 65); } | |
119 } | |
120 /* | |
121 +------------------------------------------------------------------------------ | |
122 | Function : em_init_get_hchn | |
123 +------------------------------------------------------------------------------ | |
124 | Description : initiates the hopping list. This is necessary, because a request | |
125 | of the hopping list immideatly after switch on causes a reset. | |
126 | | |
127 | Return : void | |
128 +------------------------------------------------------------------------------ | |
129 */ | |
130 | |
131 GLOBAL void em_init_get_hchn () | |
132 { | |
133 TRACE_FUNCTION ("em_init_get_hchn()"); | |
134 | |
135 ma[0] = NOT_PRESENT_16BIT; | |
136 ma2[0] = NOT_PRESENT_16BIT; | |
137 } | |
138 | |
139 /* | |
140 +------------------------------------------------------------------------------ | |
141 | Function : em_get_first_codec | |
142 +------------------------------------------------------------------------------ | |
143 | Description : Returns the highest bit rate AMR codec mode | |
144 | | |
145 | Parameters : acs - Active codec set | |
146 | | |
147 | Return : void | |
148 +------------------------------------------------------------------------------ | |
149 */ | |
150 | |
151 GLOBAL UBYTE em_get_first_codec(UBYTE acs) | |
152 { | |
153 UBYTE i; | |
154 | |
155 /* Find Highest bit rate codec mode from ACS */ | |
156 for(i=0;i<8;i++) | |
157 { | |
158 if((0x80>>i) & acs ) | |
159 break; | |
160 } | |
161 | |
162 /* First codec( Highest bit rate codec mode) */ | |
163 return (EM_AMR_MODE_12_2-i); | |
164 } | |
165 | |
166 /* | |
167 +------------------------------------------------------------------------------ | |
168 | Function : dat_em_sc_info_req | |
169 +------------------------------------------------------------------------------ | |
170 | Description : Process the primitive EM_SC_INFO_REQ. | |
171 | | |
172 | Parameters : Primitive from EM - T_EM_SC_INFO_REQ | |
173 | | |
174 | Return : void | |
175 +------------------------------------------------------------------------------ | |
176 */ | |
177 GLOBAL void dat_em_sc_info_req (T_EM_SC_INFO_REQ *em_sc_info_req) | |
178 { | |
179 GET_INSTANCE_DATA; | |
180 PALLOC(em_sc_info_cnf, EM_SC_INFO_CNF); | |
181 memset (em_sc_info_cnf, 0, sizeof (T_EM_SC_INFO_CNF)); | |
182 | |
183 PFREE(em_sc_info_req); | |
184 TRACE_FUNCTION ("dat_em_sc_info_req()"); | |
185 | |
186 em_sc_info_cnf->vocoder = EM_VOC_NA; | |
187 | |
188 switch (GET_STATE (STATE_ATT)) | |
189 { | |
190 case ATT_IDLE: | |
191 if (rr_data->nc_data[SC_INDEX].bcch_status EQ DECODED) | |
192 { | |
193 em_sc_info_cnf->arfcn = rr_data->nc_data[SC_INDEX].arfcn; | |
194 em_sc_info_cnf->c1 = rr_data->nc_data[SC_INDEX].c1; | |
195 em_sc_info_cnf->c2 = rr_data->nc_data[SC_INDEX].c2; | |
196 em_sc_info_cnf->rxlev = rr_data->nc_data[SC_INDEX].rxlev; | |
197 em_sc_info_cnf->bsic = rr_data->nc_data[SC_INDEX].bsic; | |
198 em_sc_info_cnf->dsc = em_act_dlt; | |
199 em_sc_info_cnf->txlev = rr_data->sc_data.cd.cell_options.pow_ctrl; | |
200 em_sc_info_cnf->tn = rr_data->sc_data.chan_desc.tn; | |
201 em_sc_info_cnf->lac = rr_data->nc_data[SC_INDEX].lai.lac; | |
202 em_sc_info_cnf->cba = rr_data->nc_data[SC_INDEX].rach.cell_bar_access; | |
203 em_sc_info_cnf->cbq = rr_data->nc_data[SC_INDEX].c2_par.cbq; | |
204 em_sc_info_cnf->cell_id = rr_data->nc_data[SC_INDEX].cell_id; | |
205 em_sc_info_cnf->cell_type_ind = EM_CELL_GSM; | |
206 #ifdef GPRS | |
207 if(rr_data->nc_data[SC_INDEX].rac NEQ NOT_PRESENT_8BIT) | |
208 em_sc_info_cnf->cell_type_ind = EM_CELL_GPRS; | |
209 #endif | |
210 } | |
211 else if (rr_data->nc_data[SC_INDEX].bcch_status EQ NON_DECODED) | |
212 { | |
213 em_sc_info_cnf->arfcn = rr_data->nc_data[SC_INDEX].arfcn; | |
214 em_sc_info_cnf->rxlev = rr_data->nc_data[SC_INDEX].rxlev; | |
215 em_sc_info_cnf->bsic = rr_data->nc_data[SC_INDEX].bsic; | |
216 } | |
217 break; | |
218 | |
219 case ATT_DEDICATED: | |
220 if (!rr_data->ms_data.measurement_report.valid) | |
221 break; | |
222 | |
223 em_sc_info_cnf->arfcn = rr_data->ms_data.measurement_report.arfcn; | |
224 em_sc_info_cnf->bsic = rr_data->nc_data[SC_INDEX].bsic; | |
225 em_sc_info_cnf->txlev = rr_data->sc_data.cd.cell_options.pow_ctrl; | |
226 em_sc_info_cnf->tn = rr_data->sc_data.chan_desc.tn; | |
227 em_sc_info_cnf->lac = rr_data->nc_data[SC_INDEX].lai.lac; | |
228 em_sc_info_cnf->cell_id = rr_data->nc_data[SC_INDEX].cell_id; | |
229 em_sc_info_cnf->rxlev_f = rr_data->ms_data.measurement_report.rx_lev_full; | |
230 em_sc_info_cnf->rxlev_s = rr_data->ms_data.measurement_report.rx_lev_sub; | |
231 em_sc_info_cnf->rlt = em_act_rlt; | |
232 em_sc_info_cnf->tav = rr_data->sc_data.new_ta; | |
233 em_sc_info_cnf->rxqual_f = rr_data->ms_data.measurement_report.rx_qual_full; | |
234 em_sc_info_cnf->rxqual_s = rr_data->ms_data.measurement_report.rx_qual_sub; | |
235 em_sc_info_cnf->vocoder = rr_data->sc_data.ch_mode; | |
236 if (rr_data->nc_data[SC_INDEX].bcch_status EQ DECODED) | |
237 { | |
238 em_sc_info_cnf->cell_type_ind = EM_CELL_GSM; | |
239 #ifdef GPRS | |
240 if(rr_data->nc_data[SC_INDEX].rac NEQ NOT_PRESENT_8BIT) | |
241 em_sc_info_cnf->cell_type_ind = EM_CELL_GPRS; | |
242 #endif | |
243 } | |
244 break; | |
245 | |
246 default: | |
247 break; | |
248 }/*switch*/ | |
249 PSENDX(MMI, em_sc_info_cnf); | |
250 } /*dat_em_sc_info_req*/ | |
251 | |
252 /* | |
253 +------------------------------------------------------------------------------ | |
254 | Function : dat_em_nc_info_req | |
255 +------------------------------------------------------------------------------ | |
256 | Description : Process the primitive EM_NC_INFO_REQ. | |
257 | | |
258 | Parameters : Primitive from EM - T_EM_NC_INFO_REQ | |
259 | | |
260 | Return : void | |
261 +------------------------------------------------------------------------------ | |
262 */ | |
263 GLOBAL void dat_em_nc_info_req (T_EM_NC_INFO_REQ *em_nc_info_req) | |
264 { | |
265 GET_INSTANCE_DATA; | |
266 UBYTE index = 0; | |
267 UBYTE index2 = 0; | |
268 PALLOC(em_nc_info_cnf, EM_NC_INFO_CNF); | |
269 memset (em_nc_info_cnf, 0, sizeof (T_EM_NC_INFO_CNF)); | |
270 memset (em_nc_info_cnf->rac, 0xff, EM_MAX_NUM_NC); | |
271 | |
272 PFREE(em_nc_info_req); | |
273 TRACE_FUNCTION ("dat_em_nc_info_req()"); | |
274 | |
275 switch (GET_STATE (STATE_ATT)) | |
276 { | |
277 case ATT_IDLE: | |
278 for (index = 0 , index2 = 0 ; index < EM_MAX_NUM_NC ; index++) | |
279 { | |
280 if (rr_data->nc_data[index].bcch_status EQ DECODED) | |
281 { | |
282 em_nc_info_cnf->arfcn_nc[index2] = rr_data->nc_data[index].arfcn; | |
283 em_nc_info_cnf->c1_nc[index2] = rr_data->nc_data[index].c1; | |
284 em_nc_info_cnf->c2_nc[index2] = rr_data->nc_data[index].c2; | |
285 em_nc_info_cnf->rxlev_nc[index2] = rr_data->nc_data[index].rxlev; | |
286 em_nc_info_cnf->bsic_nc[index2] = rr_data->nc_data[index].bsic; | |
287 em_nc_info_cnf->cell_id_nc[index2] = rr_data->nc_data[index].cell_id; | |
288 em_nc_info_cnf->lac_nc[index2] = rr_data->nc_data[index].lai.lac; | |
289 em_nc_info_cnf->frame_offset[index2] = rr_data->ms_data.measurement_report.ncells.frame_offset[index]; | |
290 em_nc_info_cnf->time_alignmt[index2] = rr_data->ms_data.measurement_report.ncells.time_alignmt[index]; | |
291 em_nc_info_cnf->cba_nc[index2] = rr_data->nc_data[index].rach.cell_bar_access; | |
292 em_nc_info_cnf->cbq_nc[index2] = rr_data->nc_data[index].c2_par.cbq; | |
293 em_nc_info_cnf->cell_type_ind[index2] = EM_CELL_GSM; | |
294 #ifdef GPRS | |
295 em_nc_info_cnf->rac[index2] = rr_data->nc_data[index].rac; | |
296 | |
297 /* rac in nc_data is set only when v_gprs_ind is present in SI3/SI4 rest | |
298 octets. Since v_gprs_ind is not stored,rac is used to check gprs | |
299 support in the cell */ | |
300 if(em_nc_info_cnf->rac[index2] NEQ NOT_PRESENT_8BIT) | |
301 em_nc_info_cnf->cell_type_ind[index2] = EM_CELL_GPRS; | |
302 #endif | |
303 em_nc_info_cnf->cell_resel_offset[index2] = rr_data->nc_data[index].c2_par.cell_reselect_offset; | |
304 em_nc_info_cnf->temp_offset[index2] = rr_data->nc_data[index].c2_par.temp_offset; | |
305 em_nc_info_cnf->rxlev_acc_min[index2] = rr_data->nc_data[index].select_para.rxlev_access_min; | |
306 index2++; | |
307 } /* if decoded */ | |
308 | |
309 else if (rr_data->nc_data[index].bcch_status EQ NON_DECODED) | |
310 { | |
311 em_nc_info_cnf->arfcn_nc[index2] = rr_data->nc_data[index].arfcn; | |
312 em_nc_info_cnf->rxlev_nc[index2] = rr_data->nc_data[index].rxlev; | |
313 em_nc_info_cnf->bsic_nc[index2] = rr_data->nc_data[index].bsic; | |
314 index2++; | |
315 } /* if non decoded */ | |
316 } /* for */ | |
317 em_nc_info_cnf->no_ncells = rr_data->ms_data.measurement_report.ncells.no_of_ncells; | |
318 break; | |
319 | |
320 case ATT_DEDICATED: | |
321 { | |
322 if (!rr_data->ms_data.measurement_report.valid) | |
323 break; | |
324 | |
325 em_nc_info_cnf->no_ncells = rr_data->ms_data.measurement_report.ncells.no_of_ncells; | |
326 | |
327 for (index = 0; index< rr_data->ms_data.measurement_report.ncells.no_of_ncells; index++) | |
328 { | |
329 /*in the measurement report the cells are ordered by fieldstrength*/ | |
330 em_nc_info_cnf->arfcn_nc[index] = rr_data->ms_data.measurement_report.ncells.arfcn[index]; | |
331 em_nc_info_cnf->rxlev_nc[index] = rr_data->ms_data.measurement_report.ncells.rx_lev[index]; | |
332 em_nc_info_cnf->bsic_nc[index] = rr_data->ms_data.measurement_report.ncells.bsic[index]; | |
333 em_nc_info_cnf->frame_offset[index]= rr_data->ms_data.measurement_report.ncells.frame_offset[index]; | |
334 em_nc_info_cnf->time_alignmt[index]= rr_data->ms_data.measurement_report.ncells.time_alignmt[index]; | |
335 } /*for*/ | |
336 }/*case*/ | |
337 break; | |
338 | |
339 default: | |
340 break; | |
341 }/*switch*/ | |
342 PSENDX(MMI, em_nc_info_cnf); | |
343 }/*dat_em_nc_info_req*/ | |
344 | |
345 /* | |
346 +------------------------------------------------------------------------------ | |
347 | Function : dat_em_loc_pag_info_req | |
348 +------------------------------------------------------------------------------ | |
349 | Description : Process the primitive EM_LOC_PAG_INFO_REQ. | |
350 | | |
351 | Parameters : Primitive from EM - T_EM_LOC_PAG_INFO_REQ | |
352 | | |
353 | Return : void | |
354 +------------------------------------------------------------------------------ | |
355 */ | |
356 GLOBAL void dat_em_loc_pag_info_req (T_EM_LOC_PAG_INFO_REQ *em_loc_pag_info_req) | |
357 { | |
358 GET_INSTANCE_DATA; | |
359 PALLOC(em_loc_pag_info_cnf, EM_LOC_PAG_INFO_CNF); | |
360 memset (em_loc_pag_info_cnf, 0, sizeof (T_EM_LOC_PAG_INFO_CNF)); | |
361 | |
362 PFREE(em_loc_pag_info_req); | |
363 TRACE_FUNCTION ("dat_em_loc_pag_info_req()"); | |
364 | |
365 if (rr_data->nc_data[SC_INDEX].bcch_status EQ DECODED) | |
366 { | |
367 memcpy(em_loc_pag_info_cnf->mcc, rr_data->nc_data[SC_INDEX].lai.mcc, SIZE_MCC); | |
368 | |
369 /*check for MNC with 2 digits*/ | |
370 /* Fixed for Issue 21468 */ | |
371 if (rr_data->nc_data[SC_INDEX].lai.mnc[2] NEQ 0xF) /*defines a 3 digit NMC*/ | |
372 { | |
373 memcpy(em_loc_pag_info_cnf->mnc, rr_data->nc_data[SC_INDEX].lai.mnc, SIZE_MNC); | |
374 } | |
375 else /*2 digit -> leave the first value empty*/ | |
376 { | |
377 em_loc_pag_info_cnf->mnc[1] = rr_data->nc_data[SC_INDEX].lai.mnc[0]; | |
378 em_loc_pag_info_cnf->mnc[2] = rr_data->nc_data[SC_INDEX].lai.mnc[1]; | |
379 } | |
380 | |
381 em_loc_pag_info_cnf->bs_pa_mfrms = rr_data->nc_data[SC_INDEX].control_descr.bs_pa_mfrms; | |
382 em_loc_pag_info_cnf->t3212 = rr_data->nc_data[SC_INDEX].control_descr.t3212; | |
383 } | |
384 | |
385 if (rr_data->ms_data.tmsi_available EQ TRUE) | |
386 em_loc_pag_info_cnf->tmsi = rr_data->ms_data.tmsi_binary; | |
387 | |
388 PSENDX(MMI, em_loc_pag_info_cnf); | |
389 }/*dat_em_loc_pag_info_req*/ | |
390 | |
391 /* | |
392 +------------------------------------------------------------------------------ | |
393 | Function : dat_em_plmn_info_req | |
394 +------------------------------------------------------------------------------ | |
395 | Description : Process the primitive EM_PLMN_INFO_REQ. | |
396 | | |
397 | Parameters : Primitive from EM - T_EM_PLMN_INFO_REQ | |
398 | | |
399 | Return : void | |
400 +------------------------------------------------------------------------------ | |
401 */ | |
402 GLOBAL void dat_em_plmn_info_req (T_EM_PLMN_INFO_REQ *em_plmn_info_req) | |
403 { | |
404 GET_INSTANCE_DATA; | |
405 PALLOC(em_plmn_info_cnf, EM_PLMN_INFO_CNF); | |
406 memset (em_plmn_info_cnf, 0, sizeof (T_EM_PLMN_INFO_CNF)); | |
407 | |
408 PFREE(em_plmn_info_req); | |
409 TRACE_FUNCTION ("dat_em_plmn_info_req()"); | |
410 | |
411 em_plmn_info_cnf->no_creq_max = rr_data->nc_data[SC_INDEX].rach.max_retrans; | |
412 em_plmn_info_cnf->reest_flag = rr_data->nc_data[SC_INDEX].rach.re; | |
413 em_plmn_info_cnf->txpwr_max = rr_data->nc_data[SC_INDEX].select_para.ms_txpwr_max_cch; | |
414 em_plmn_info_cnf->rxlev_min = rr_data->nc_data[SC_INDEX].select_para.rxlev_access_min; | |
415 em_plmn_info_cnf->rel_cause = 0xff; /* these info will be parsed by aci */ | |
416 | |
417 PSENDX(MMI, em_plmn_info_cnf); | |
418 }/*dat_em_plmn_info_req*/ | |
419 /* | |
420 +------------------------------------------------------------------------------ | |
421 | Function : dat_em_cip_hop_dtx_info_req | |
422 +------------------------------------------------------------------------------ | |
423 | Description : Process the primitive EM_CIP_HOP_DTX_INFO_REQ. | |
424 | | |
425 | Parameters : Primitive from EM - T_EM_CIP_HOP_DTX_INFO_REQ | |
426 | | |
427 | Return : void | |
428 +------------------------------------------------------------------------------ | |
429 */ | |
430 GLOBAL void dat_em_cip_hop_dtx_info_req (T_EM_CIP_HOP_DTX_INFO_REQ *em_cip_hop_dtx_info_req) | |
431 { | |
432 GET_INSTANCE_DATA; | |
433 UBYTE i; | |
434 PALLOC(em_cip_hop_dtx_info_cnf, EM_CIP_HOP_DTX_INFO_CNF); | |
435 memset (em_cip_hop_dtx_info_cnf, 0, sizeof (T_EM_CIP_HOP_DTX_INFO_CNF)); | |
436 | |
437 PFREE(em_cip_hop_dtx_info_req); | |
438 TRACE_FUNCTION ("dat_em_cip_hop_dtx_info_req()"); | |
439 | |
440 /* Intialize to 0xffff. No hopping channels */ | |
441 em_cip_hop_dtx_info_cnf->hop_chn.ma[0] = NOT_PRESENT_16BIT; | |
442 em_cip_hop_dtx_info_cnf->hop_chn2.ma[0] = NOT_PRESENT_16BIT; | |
443 | |
444 if ((GET_STATE(STATE_ATT) EQ ATT_DEDICATED) AND | |
445 (GET_STATE(STATE_DAT) EQ DAT_DEDICATED)) | |
446 { | |
447 /* cipher status */ | |
448 em_cip_hop_dtx_info_cnf->ciph_stat = rr_data->sc_data.ciph_on; | |
449 | |
450 /* Hopping status */ | |
451 em_cip_hop_dtx_info_cnf->hop = rr_data->sc_data.chan_desc.hop; | |
452 | |
453 if (rr_data->sc_data.chan_desc.hop EQ H_NO) | |
454 { /* Hopping is not configured */ | |
455 em_cip_hop_dtx_info_cnf->arfcn = rr_data->sc_data.chan_desc.arfcn; | |
456 } | |
457 else | |
458 { /* hopping sequence no */ | |
459 em_cip_hop_dtx_info_cnf->hsn = rr_data->sc_data.chan_desc.hsn; | |
460 } | |
461 | |
462 if(em_cip_hop_dtx_info_cnf->hop NEQ H_NO) | |
463 { | |
464 /* MAIO */ | |
465 em_cip_hop_dtx_info_cnf->hop_chn.maio = rr_data->sc_data.chan_desc.maio; | |
466 | |
467 i=0; | |
468 while((i<MAX_MA_CHANNELS) AND (ma[i] NEQ NOT_PRESENT_16BIT)) | |
469 { | |
470 em_cip_hop_dtx_info_cnf->hop_chn.ma[i] = ma[i]; | |
471 i++; | |
472 } | |
473 | |
474 /* Number of hopping channels */ | |
475 em_cip_hop_dtx_info_cnf->hop_chn.nr_arfcns = i; | |
476 if(i < MAX_MA_CHANNELS) | |
477 { | |
478 em_cip_hop_dtx_info_cnf->hop_chn.ma[i] = NOT_PRESENT_16BIT; | |
479 } | |
480 | |
481 /* starting time status */ | |
482 em_cip_hop_dtx_info_cnf->v_start = v_start; | |
483 | |
484 /* Hopping list after time */ | |
485 if (v_start) | |
486 { | |
487 /* MAIO */ | |
488 em_cip_hop_dtx_info_cnf->hop_chn2.maio = maio2; | |
489 | |
490 i=0; | |
491 while((i<MAX_MA_CHANNELS) AND (ma2[i] NEQ NOT_PRESENT_16BIT)) | |
492 { | |
493 em_cip_hop_dtx_info_cnf->hop_chn2.ma[i] = ma2[i]; | |
494 i++; | |
495 } | |
496 /* Number of hopping channels */ | |
497 em_cip_hop_dtx_info_cnf->hop_chn2.nr_arfcns = i; | |
498 if(i < MAX_MA_CHANNELS) | |
499 { | |
500 em_cip_hop_dtx_info_cnf->hop_chn2.ma[i] = NOT_PRESENT_16BIT; | |
501 } | |
502 } /* v_start */ | |
503 | |
504 } /* hop NEQ H_NO */ | |
505 | |
506 } /* dedicated state */ | |
507 | |
508 /* DTX status */ | |
509 em_cip_hop_dtx_info_cnf->dtx_stat = rr_data->sc_data.cd.dtx; | |
510 | |
511 PSENDX(MMI, em_cip_hop_dtx_info_cnf); | |
512 }/*dat_em_cip_hop_dtx_info_req*/ | |
513 | |
514 /* | |
515 +------------------------------------------------------------------------------ | |
516 | Function : dat_em_mobdata_power_info_req | |
517 +------------------------------------------------------------------------------ | |
518 | Description : Process the primitive EM_POWER_INFO_REQ. | |
519 | | |
520 | Parameters : Primitive from EM - T_EM_POWER_INFO_REQ | |
521 | | |
522 | Return : void | |
523 +------------------------------------------------------------------------------ | |
524 */ | |
525 GLOBAL void dat_em_mobdata_power_info_req (T_EM_POWER_INFO_REQ *em_power_info_req) | |
526 { | |
527 GET_INSTANCE_DATA; | |
528 PALLOC(em_power_info_cnf, EM_POWER_INFO_CNF); | |
529 | |
530 PFREE(em_power_info_req); | |
531 | |
532 TRACE_FUNCTION ("dat_em_mobdata_power_info_req()"); | |
533 | |
534 memset (em_power_info_cnf, 0, sizeof (T_EM_POWER_INFO_CNF)); | |
535 memcpy(&em_power_info_cnf->classm2, &rr_data->ms_data.classmark2, sizeof (T_classm2)); | |
536 memcpy(&em_power_info_cnf->classm3, &rr_data->ms_data.classmark3, sizeof (T_classm3)); | |
537 | |
538 PSENDX(MMI, em_power_info_cnf); | |
539 }/*dat_em_mobdata_power_info_req*/ | |
540 | |
541 /* | |
542 +------------------------------------------------------------------------------ | |
543 | Function : dat_em_mobdata_id_info_req | |
544 +------------------------------------------------------------------------------ | |
545 | Description : Process the primitive EM_IDENTITY_INFO_REQ. | |
546 | | |
547 | Parameters : Primitive from EM - T_EM_IDENTITY_INFO_REQ | |
548 | | |
549 | Return : void | |
550 +------------------------------------------------------------------------------ | |
551 */ | |
552 GLOBAL void dat_em_mobdata_id_info_req (T_EM_IDENTITY_INFO_REQ *em_identity_info_req) | |
553 { | |
554 GET_INSTANCE_DATA; | |
555 PALLOC(em_identity_info_cnf, EM_IDENTITY_INFO_CNF); | |
556 memset (em_identity_info_cnf, 0, sizeof (T_EM_IDENTITY_INFO_CNF)); | |
557 | |
558 PFREE(em_identity_info_req); | |
559 TRACE_FUNCTION ("dat_em_mobdata_id_info_req()"); | |
560 | |
561 /* | |
562 * The values for IMEI and IMEISV are identical up to the last 4bits. The 'ident_type' distinguish | |
563 * IMEI and IMEISV where ident_type = 3 is synonymously with IMEISV. In case only IMEI is needed, | |
564 * em_mm_mobdata_id_info_req->em_imei.ident_dig[16] should not considered. | |
565 */ | |
566 | |
567 em_identity_info_cnf->em_imeisv.ident_type = rr_data->ms_data.imei.ident_type; | |
568 em_identity_info_cnf->em_imeisv.v_ident_dig = rr_data->ms_data.imei.v_ident_dig; | |
569 em_identity_info_cnf->em_imeisv.c_ident_dig = rr_data->ms_data.imei.c_ident_dig; | |
570 em_identity_info_cnf->em_imeisv.odd_even = rr_data->ms_data.imei.odd_even; | |
571 memcpy (em_identity_info_cnf->em_imeisv.ident_dig, rr_data->ms_data.imei.ident_dig, 16); | |
572 | |
573 if (rr_data->ms_data.imsi_available) /* SIM available */ | |
574 { | |
575 em_identity_info_cnf->em_imsi.ident_type = rr_data->ms_data.imsi.ident_type; | |
576 em_identity_info_cnf->em_imsi.v_ident_dig = rr_data->ms_data.imsi.v_ident_dig; | |
577 em_identity_info_cnf->em_imsi.c_ident_dig = rr_data->ms_data.imsi.c_ident_dig; | |
578 em_identity_info_cnf->em_imsi.odd_even = rr_data->ms_data.imsi.odd_even; | |
579 memcpy (em_identity_info_cnf->em_imsi.ident_dig, rr_data->ms_data.imsi.ident_dig, 16); | |
580 } | |
581 | |
582 if (rr_data->ms_data.tmsi_available EQ TRUE) | |
583 em_identity_info_cnf->tmsi = rr_data->ms_data.tmsi_binary; | |
584 | |
585 PSENDX(MMI, em_identity_info_cnf); | |
586 } /*dat_em_mobdata_id_info_req*/ | |
587 | |
588 /* | |
589 +------------------------------------------------------------------------------ | |
590 | Function : dat_em_mobdata_version_info_req | |
591 +------------------------------------------------------------------------------ | |
592 | Description : Process the primitive EM_SW_VERSION_INFO_REQ. | |
593 | | |
594 | Parameters : Primitive from EM - T_EM_SW_VERSION_INFO_REQ | |
595 | | |
596 | Return : void | |
597 +------------------------------------------------------------------------------ | |
598 */ | |
599 GLOBAL void dat_em_mobdata_version_info_req (T_EM_SW_VERSION_INFO_REQ *em_sw_version_info_req) | |
600 { | |
601 PALLOC(em_sw_version_info_cnf, EM_SW_VERSION_INFO_CNF); | |
602 PFREE(em_sw_version_info_req); | |
603 | |
604 TRACE_FUNCTION ("dat_em_mobdata_version_info_req()"); | |
605 | |
606 memset (em_sw_version_info_cnf, 0, sizeof (T_EM_SW_VERSION_INFO_CNF)); | |
607 | |
608 em_sw_version_info_cnf->v_mmi = 0xFF; | |
609 em_sw_version_info_cnf->v_sim = 0xFF; | |
610 em_sw_version_info_cnf->v_cc = 0xFF; | |
611 em_sw_version_info_cnf->v_ss = 0xFF; | |
612 em_sw_version_info_cnf->v_sms = 0xFF; | |
613 em_sw_version_info_cnf->v_mm = 0xFF; | |
614 em_sw_version_info_cnf->v_rr = 0xFF; | |
615 em_sw_version_info_cnf->v_dl = 0xFF; | |
616 em_sw_version_info_cnf->v_l1 = 0xFF; | |
617 | |
618 PSENDX(MMI, em_sw_version_info_cnf); | |
619 }/*dat_em_mobdata_version_info_req*/ | |
620 | |
621 | |
622 /* | |
623 +------------------------------------------------------------------------------ | |
624 | Function : dat_em_amr_info_req | |
625 +------------------------------------------------------------------------------ | |
626 | Description : Process the primitive EM_AMR_INFO_REQ. | |
627 | | |
628 | Parameters : Primitive from EM - T_EM_AMR_INFO_REQ | |
629 | | |
630 | Return : void | |
631 +------------------------------------------------------------------------------ | |
632 */ | |
633 GLOBAL void dat_em_amr_info_req (T_EM_AMR_INFO_REQ *em_amr_info_req) | |
634 { | |
635 GET_INSTANCE_DATA; | |
636 UBYTE i=0; | |
637 PALLOC(em_amr_info_cnf, EM_AMR_INFO_CNF); | |
638 memset (em_amr_info_cnf, 0, sizeof (T_EM_AMR_INFO_CNF)); | |
639 | |
640 PFREE(em_amr_info_req); | |
641 TRACE_FUNCTION ("dat_em_amr_info_req()"); | |
642 | |
643 /* AMR information is valid only in dedicated state, when chan mode is AMR */ | |
644 if ((GET_STATE(STATE_ATT) EQ ATT_DEDICATED) AND | |
645 (GET_STATE(STATE_DAT) EQ DAT_DEDICATED)) | |
646 { | |
647 if(rr_data->sc_data.ch_mode EQ CM_AMR) | |
648 { | |
649 /* AMR vocoder type */ | |
650 em_amr_info_cnf->amr_vocoder = rr_data->sc_data.chan_desc.chan_type; | |
651 | |
652 /* Initial codec mode indicator */ | |
653 em_amr_info_cnf->amr_icmi = rr_data->sc_data.amr_conf.icmi; | |
654 | |
655 /* Initial codec mode. Valid if icmi = 1(Start mode signalled) */ | |
656 em_amr_info_cnf->amr_icm = rr_data->sc_data.amr_conf.st_mode; | |
657 | |
658 /* Active codec set */ | |
659 em_amr_info_cnf->amr_acs = rr_data->sc_data.amr_conf.set_amr; | |
660 | |
661 /* First codec( Highest bit rate codec mode) */ | |
662 em_amr_info_cnf->amr_first_codec = | |
663 em_get_first_codec(rr_data->sc_data.amr_conf.set_amr); | |
664 | |
665 if(rr_data->sc_data.amr_conf.v_cod_prop) | |
666 { | |
667 /* Number of codec modes */ | |
668 em_amr_info_cnf->amr_nr_modes = rr_data->sc_data.amr_conf.c_cod_prop + 1; | |
669 | |
670 /* Threshold and Hysteresis properties between codec modes */ | |
671 for(i=0;i<rr_data->sc_data.amr_conf.c_cod_prop;i++) | |
672 { | |
673 memcpy(&em_amr_info_cnf->amr_cod_prop[i],&rr_data->sc_data.amr_conf.cod_prop[i], | |
674 sizeof(T_amr_cod_prop)); | |
675 } | |
676 } | |
677 else | |
678 { | |
679 /* Number of codec modes */ | |
680 em_amr_info_cnf->amr_nr_modes = 1; | |
681 } | |
682 } /* CM_AMR */ | |
683 } /* ATT DEDICATED */ | |
684 | |
685 PSENDX(MMI, em_amr_info_cnf); | |
686 } /*dat_em_amr_info_req*/ | |
687 | |
688 /* | |
689 +------------------------------------------------------------------------------ | |
690 | Function : em_init_rr_event_trace | |
691 +------------------------------------------------------------------------------ | |
692 | Description : Initialize the event tracing flags for RR | |
693 | | |
694 | Parameters : void | |
695 | | |
696 | Return : void | |
697 | | |
698 +------------------------------------------------------------------------------ | |
699 */ | |
700 GLOBAL void em_init_rr_event_trace(void) | |
701 { | |
702 UBYTE i; | |
703 | |
704 TRACE_FUNCTION ("em_init_rr_event_trace()"); | |
705 | |
706 for (i=0; i< EM_MAX_RR_EVENTS; i++) | |
707 rr_v[i] = 0; | |
708 } | |
709 | |
710 /* | |
711 +------------------------------------------------------------------------------ | |
712 | Function : rr_em_rr_event_req | |
713 +------------------------------------------------------------------------------ | |
714 | Description : Set the event tracing flags according the bitmask | |
715 | | |
716 | Parameters : Primitive - Bitmask(T_EM_RR_EVENT_REQ) | |
717 | | |
718 | Return : void | |
719 | | |
720 +------------------------------------------------------------------------------ | |
721 */ | |
722 GLOBAL void rr_em_rr_event_req (T_EM_RR_EVENT_REQ *em_rr_event_req) | |
723 { | |
724 UBYTE i; | |
725 | |
726 TRACE_FUNCTION ("rr_em_rr_event_req()"); | |
727 | |
728 /* | |
729 * The event tracing flags are set according the bitmask. rr_v[i] are | |
730 * the flags belonging to the event number described in 8443.601 | |
731 */ | |
732 for(i=1; i<33; i++) | |
733 rr_v[i] = ((em_rr_event_req->bitmask_rr_l & (0x01<<(i-1))) > 0) ? TRUE : FALSE; | |
734 | |
735 for(i=33; i<(EM_MAX_RR_EVENTS); i++) | |
736 rr_v[i] = ((em_rr_event_req->bitmask_rr_h & (0x01<<(i-1))) > 0) ? TRUE : FALSE; | |
737 | |
738 /* | |
739 A new event trace is generated therefor the flag is set to 0. | |
740 */ | |
741 em_rr_trace_occured = 0; | |
742 | |
743 PFREE(em_rr_event_req); | |
744 } | |
745 | |
746 /* | |
747 +------------------------------------------------------------------------------ | |
748 | Function : em_write_buffer_2 | |
749 +------------------------------------------------------------------------------ | |
750 | Description : Perform buffer check and store corresponding data in it. | |
751 | | |
752 | Parameters : Event number | |
753 | | |
754 | Return : TRUE/FALSE | |
755 | | |
756 +------------------------------------------------------------------------------ | |
757 */ | |
758 #define EVT_LEN_OFFSET 2 /* Event Number and Length value bytes */ | |
759 #define BUFFER_2_LENGTH 2 | |
760 GLOBAL UBYTE em_write_buffer_2 (UBYTE event_no) | |
761 { | |
762 UBYTE em_rr_event_buffer[BUFFER_2_LENGTH]; | |
763 UBYTE em_rr_buffer_write = 0; | |
764 | |
765 TRACE_FUNCTION ("rr_em_write_buffer_2()"); | |
766 | |
767 /* | |
768 ACI is informed about the first event trace, used for later data processing. | |
769 */ | |
770 rr_em_first_event_check(); | |
771 | |
772 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
773 em_rr_event_buffer[em_rr_buffer_write] = 0x00; /* Value length - 0 equals no data */ | |
774 | |
775 return (em_rr_sem (BUFFER_2_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
776 } | |
777 | |
778 /* | |
779 +------------------------------------------------------------------------------ | |
780 | Function : em_write_buffer_3 | |
781 +------------------------------------------------------------------------------ | |
782 | Description : Perform buffer check and store corresponding data in it. | |
783 | | |
784 | Parameters : Event number, data value | |
785 | | |
786 | Return : TRUE/FALSE | |
787 | | |
788 +------------------------------------------------------------------------------ | |
789 */ | |
790 #define BUFFER_3_LENGTH 3 | |
791 GLOBAL UBYTE em_write_buffer_3 (UBYTE event_no, UBYTE value) | |
792 { | |
793 UBYTE em_rr_event_buffer[BUFFER_3_LENGTH]; | |
794 UBYTE em_rr_buffer_write = 0; | |
795 | |
796 TRACE_FUNCTION ("rr_em_write_buffer_3()"); | |
797 | |
798 /* | |
799 ACI is informed about the first event trace, used for later data processing. | |
800 */ | |
801 rr_em_first_event_check(); | |
802 | |
803 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
804 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_3_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
805 em_rr_event_buffer[em_rr_buffer_write] = value; /* Data to be stored */ | |
806 | |
807 return (em_rr_sem (BUFFER_3_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
808 } | |
809 | |
810 /* | |
811 +------------------------------------------------------------------------------ | |
812 | Function : em_write_buffer_3a | |
813 +------------------------------------------------------------------------------ | |
814 | Description : Perform buffer check and store corresponding data in it. | |
815 | | |
816 | Parameters : Event number, data value (USHORT) | |
817 | | |
818 | Return : TRUE/FALSE | |
819 | | |
820 +------------------------------------------------------------------------------ | |
821 */ | |
822 #define BUFFER_3A_LENGTH 4 | |
823 GLOBAL UBYTE em_write_buffer_3a (UBYTE event_no, USHORT value) | |
824 { | |
825 UBYTE em_rr_event_buffer[BUFFER_3A_LENGTH]; | |
826 UBYTE em_rr_buffer_write = 0; | |
827 | |
828 TRACE_FUNCTION ("rr_em_write_buffer_3a()"); | |
829 | |
830 /* | |
831 ACI is informed about the first event trace, used for later data processing. | |
832 */ | |
833 rr_em_first_event_check(); | |
834 | |
835 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
836 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_3A_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
837 em_rr_event_buffer[em_rr_buffer_write++] = (UBYTE)(value >> 8); /* Data to be stored - MSB first */ | |
838 em_rr_event_buffer[em_rr_buffer_write++] = (UBYTE)(value ); /* LSB second */ | |
839 | |
840 return (em_rr_sem (BUFFER_3A_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
841 } | |
842 | |
843 /* | |
844 +------------------------------------------------------------------------------ | |
845 | Function : em_write_buffer_4 | |
846 +------------------------------------------------------------------------------ | |
847 | Description : Perform buffer check and store corresponding data in it. | |
848 | | |
849 | Parameters : Event number, length of data and value1 and value2 | |
850 | | |
851 | Return : TRUE/FALSE | |
852 | | |
853 +------------------------------------------------------------------------------ | |
854 */ | |
855 #define BUFFER_4_LENGTH 4 | |
856 GLOBAL UBYTE em_write_buffer_4 (UBYTE event_no, UBYTE value1, UBYTE value2) | |
857 { | |
858 UBYTE em_rr_event_buffer[BUFFER_4_LENGTH]; | |
859 UBYTE em_rr_buffer_write = 0; | |
860 | |
861 TRACE_FUNCTION ("rr_em_write_buffer_4()"); | |
862 | |
863 /* | |
864 ACI is informed about the first event trace, used for later data processing. | |
865 */ | |
866 rr_em_first_event_check(); | |
867 | |
868 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
869 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_4_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
870 em_rr_event_buffer[em_rr_buffer_write++] = value1; /* Value 1 */ | |
871 em_rr_event_buffer[em_rr_buffer_write++] = value2; /* Value 2 */ | |
872 | |
873 return (em_rr_sem (BUFFER_4_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
874 } | |
875 | |
876 /* | |
877 +------------------------------------------------------------------------------ | |
878 | Function : em_write_buffer_4a | |
879 +------------------------------------------------------------------------------ | |
880 | Description : Perform buffer check and store corresponding data in it. | |
881 | | |
882 | Parameters : Event number, data value, data cs (USHORT) | |
883 | | |
884 | Return : TRUE/FALSE | |
885 | | |
886 +------------------------------------------------------------------------------ | |
887 */ | |
888 #define BUFFER_4A_LENGTH 5 | |
889 GLOBAL UBYTE em_write_buffer_4a (UBYTE event_no, UBYTE value, USHORT cs) | |
890 { | |
891 UBYTE em_rr_event_buffer[BUFFER_4A_LENGTH]; | |
892 UBYTE em_rr_buffer_write = 0; | |
893 | |
894 TRACE_FUNCTION ("rr_em_write_buffer_4a()"); | |
895 | |
896 /* | |
897 ACI is informed about the first event trace, used for later data processing. | |
898 */ | |
899 rr_em_first_event_check(); | |
900 | |
901 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
902 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_4A_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
903 em_rr_event_buffer[em_rr_buffer_write++] = value; /* first data info */ | |
904 em_rr_event_buffer[em_rr_buffer_write++] = (UBYTE)(cs >> 8); /* Data to be stored - MSB first */ | |
905 em_rr_event_buffer[em_rr_buffer_write++] = (UBYTE)(cs); /* LSB second */ | |
906 | |
907 return (em_rr_sem (BUFFER_4A_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
908 } | |
909 | |
910 /* | |
911 +------------------------------------------------------------------------------ | |
912 | Function : em_write_buffer_4b | |
913 +------------------------------------------------------------------------------ | |
914 | Description : Perform buffer check and store corresponding data in it. | |
915 | | |
916 | Parameters : Event number, data value, data plmn (T_plmn) | |
917 | | |
918 | Return : TRUE/FALSE | |
919 | | |
920 +------------------------------------------------------------------------------ | |
921 */ | |
922 #define BUFFER_4B_LENGTH 9 | |
923 GLOBAL UBYTE em_write_buffer_4b (UBYTE event_no, UBYTE value, T_plmn plmn) | |
924 { | |
925 UBYTE em_rr_event_buffer[BUFFER_4B_LENGTH]; | |
926 UBYTE em_rr_buffer_write = 0; | |
927 | |
928 TRACE_FUNCTION ("rr_em_write_buffer_4b()"); | |
929 | |
930 /* | |
931 ACI is informed about the first event trace, used for later data processing. | |
932 */ | |
933 rr_em_first_event_check(); | |
934 | |
935 memset(em_rr_event_buffer, 0, BUFFER_4B_LENGTH); | |
936 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
937 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_4B_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
938 em_rr_event_buffer[em_rr_buffer_write++] = value; | |
939 if(plmn.v_plmn) | |
940 { | |
941 memcpy(&em_rr_event_buffer[em_rr_buffer_write], plmn.mcc, SIZE_MCC); | |
942 em_rr_buffer_write += SIZE_MCC; | |
943 memcpy(&em_rr_event_buffer[em_rr_buffer_write], plmn.mnc, SIZE_MNC); | |
944 } | |
945 | |
946 return (em_rr_sem (BUFFER_4B_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
947 } | |
948 | |
949 /* | |
950 +------------------------------------------------------------------------------ | |
951 | Function : em_write_buffer_4c | |
952 +------------------------------------------------------------------------------ | |
953 | Description : Perform buffer check and store corresponding data in it. | |
954 | | |
955 | Parameters : Event number, data value1, data plmn (T_plmn) | |
956 | | |
957 | Return : TRUE/FALSE | |
958 | | |
959 +------------------------------------------------------------------------------ | |
960 */ | |
961 #define BUFFER_4C_LENGTH ((MAX_PLMN*(SIZE_MCC+SIZE_MNC))+EVT_LEN_OFFSET) | |
962 GLOBAL UBYTE em_write_buffer_4c (UBYTE event_no, UBYTE value1, T_plmn plmn[MAX_PLMN]) | |
963 { | |
964 UBYTE em_rr_event_buffer[BUFFER_4C_LENGTH]; | |
965 UBYTE em_rr_buffer_write = 0; | |
966 UBYTE length = 0; | |
967 UBYTE i; | |
968 | |
969 TRACE_FUNCTION ("rr_em_write_buffer_4c()"); | |
970 /* Ensure value1 is within specified boundaries */ | |
971 if( value1 > MAX_PLMN ) | |
972 { | |
973 value1 = MAX_PLMN; | |
974 } | |
975 | |
976 /* | |
977 ACI is informed about the first event trace, used for later data processing. | |
978 */ | |
979 rr_em_first_event_check(); | |
980 | |
981 memset(em_rr_event_buffer, 0, BUFFER_4C_LENGTH); | |
982 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
983 em_rr_event_buffer[em_rr_buffer_write++] = 1+value1*(SIZE_MCC + SIZE_MNC); /* Value length - 0 equals no value */ | |
984 for (i=0; i<value1; i++) { | |
985 if(plmn[i].v_plmn) | |
986 { | |
987 memcpy(em_rr_event_buffer + em_rr_buffer_write, plmn[i].mcc, SIZE_MCC); | |
988 em_rr_buffer_write += SIZE_MCC; | |
989 memcpy(em_rr_event_buffer + em_rr_buffer_write, plmn[i].mnc, SIZE_MNC); | |
990 em_rr_buffer_write += SIZE_MNC; | |
991 } | |
992 } | |
993 length = (EVT_LEN_OFFSET + value1*(SIZE_MCC + SIZE_MNC)); | |
994 | |
995 return (em_rr_sem (length, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
996 } | |
997 | |
998 /* | |
999 +------------------------------------------------------------------------------ | |
1000 | Function : em_write_buffer_5 | |
1001 +------------------------------------------------------------------------------ | |
1002 | Description : Perform buffer check and store corresponding data in it. | |
1003 | | |
1004 | Parameters : Event number, data value1, data value2, data cs (USHORT) | |
1005 | | |
1006 | Return : TRUE/FALSE | |
1007 | | |
1008 +------------------------------------------------------------------------------ | |
1009 */ | |
1010 #define BUFFER_5_LENGTH 5 | |
1011 GLOBAL UBYTE em_write_buffer_5 (UBYTE event_no, UBYTE value1, UBYTE value2, UBYTE value3) | |
1012 { | |
1013 UBYTE em_rr_event_buffer[BUFFER_5_LENGTH]; | |
1014 UBYTE em_rr_buffer_write = 0; | |
1015 | |
1016 TRACE_FUNCTION ("rr_em_write_buffer_5()"); | |
1017 | |
1018 /* | |
1019 ACI is informed about the first event trace, used for later data processing. | |
1020 */ | |
1021 rr_em_first_event_check(); | |
1022 | |
1023 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
1024 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_5_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
1025 em_rr_event_buffer[em_rr_buffer_write++] = value1; /* first data info */ | |
1026 em_rr_event_buffer[em_rr_buffer_write++] = value2; /* second data info */ | |
1027 em_rr_event_buffer[em_rr_buffer_write++] = value3; /* Data */ | |
1028 | |
1029 return (em_rr_sem (BUFFER_5_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
1030 } | |
1031 | |
1032 /* | |
1033 +------------------------------------------------------------------------------ | |
1034 | Function : em_write_buffer_5c | |
1035 +------------------------------------------------------------------------------ | |
1036 | Description : Perform buffer check and store corresponding data in it. | |
1037 | | |
1038 | Parameters : Event number, data value, data plmn (T_plmn) | |
1039 | | |
1040 | Return : TRUE/FALSE | |
1041 | | |
1042 +------------------------------------------------------------------------------ | |
1043 */ | |
1044 #define BUFFER_5C_LENGTH 10 | |
1045 GLOBAL UBYTE em_write_buffer_5c (UBYTE event_no, UBYTE value1, UBYTE value2, T_plmn plmn) | |
1046 { | |
1047 UBYTE em_rr_event_buffer[BUFFER_5C_LENGTH]; | |
1048 UBYTE em_rr_buffer_write = 0; | |
1049 | |
1050 TRACE_FUNCTION ("rr_em_write_buffer_5c()"); | |
1051 | |
1052 /* | |
1053 ACI is informed about the first event trace, used for later data processing. | |
1054 */ | |
1055 rr_em_first_event_check(); | |
1056 | |
1057 memset(em_rr_event_buffer, 0, BUFFER_5C_LENGTH); | |
1058 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
1059 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_5C_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
1060 em_rr_event_buffer[em_rr_buffer_write++] = value1; | |
1061 em_rr_event_buffer[em_rr_buffer_write++] = value2; | |
1062 if(plmn.v_plmn) | |
1063 { | |
1064 memcpy(em_rr_event_buffer + em_rr_buffer_write, plmn.mcc, SIZE_MCC); | |
1065 em_rr_buffer_write += SIZE_MCC; | |
1066 memcpy(em_rr_event_buffer + em_rr_buffer_write, plmn.mnc, SIZE_MNC); | |
1067 } | |
1068 | |
1069 return (em_rr_sem (BUFFER_5C_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
1070 } | |
1071 | |
1072 /* | |
1073 +------------------------------------------------------------------------------ | |
1074 | Function : em_write_buffer_8 | |
1075 +------------------------------------------------------------------------------ | |
1076 | Description : Perform buffer check and store corresponding data in it. | |
1077 | | |
1078 | Parameters : Event number, data value1, data value2, data cs (USHORT) | |
1079 | | |
1080 | Return : TRUE/FALSE | |
1081 | | |
1082 +------------------------------------------------------------------------------ | |
1083 */ | |
1084 #define BUFFER_8_LENGTH 8 | |
1085 GLOBAL UBYTE em_write_buffer_8 (UBYTE event_no, UBYTE value1, UBYTE value2, UBYTE value3, UBYTE value4, | |
1086 UBYTE value5, UBYTE value6) | |
1087 { | |
1088 UBYTE em_rr_event_buffer[BUFFER_8_LENGTH]; | |
1089 UBYTE em_rr_buffer_write = 0; | |
1090 | |
1091 TRACE_FUNCTION ("rr_em_write_buffer_8()"); | |
1092 | |
1093 /* | |
1094 ACI is informed about the first event trace, used for later data processing. | |
1095 */ | |
1096 rr_em_first_event_check(); | |
1097 | |
1098 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
1099 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_8_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
1100 em_rr_event_buffer[em_rr_buffer_write++] = value1; /* first data info */ | |
1101 em_rr_event_buffer[em_rr_buffer_write++] = value2; /* second data info */ | |
1102 em_rr_event_buffer[em_rr_buffer_write++] = value3; /* data */ | |
1103 em_rr_event_buffer[em_rr_buffer_write++] = value4; /* data */ | |
1104 em_rr_event_buffer[em_rr_buffer_write++] = value5; /* data */ | |
1105 em_rr_event_buffer[em_rr_buffer_write++] = value6; /* data */ | |
1106 | |
1107 return (em_rr_sem (BUFFER_8_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
1108 } | |
1109 | |
1110 /* | |
1111 +------------------------------------------------------------------------------ | |
1112 | Function : em_write_buffer_9 | |
1113 +------------------------------------------------------------------------------ | |
1114 | Description : Perform buffer check and store corresponding data in it. | |
1115 | | |
1116 | Parameters : Event number, data value1, data value2, data cs (USHORT) | |
1117 | | |
1118 | Return : TRUE/FALSE | |
1119 | | |
1120 +------------------------------------------------------------------------------ | |
1121 */ | |
1122 #define BUFFER_9_LENGTH 9 | |
1123 GLOBAL UBYTE em_write_buffer_9 (UBYTE event_no, UBYTE value1, UBYTE value2, UBYTE value3, | |
1124 UBYTE value4, UBYTE value5, UBYTE value6, UBYTE value7) | |
1125 { | |
1126 UBYTE em_rr_event_buffer[BUFFER_9_LENGTH]; | |
1127 UBYTE em_rr_buffer_write = 0; | |
1128 | |
1129 TRACE_FUNCTION ("rr_em_write_buffer_9()"); | |
1130 | |
1131 /* | |
1132 ACI is informed about the first event trace, used for later data processing. | |
1133 */ | |
1134 rr_em_first_event_check(); | |
1135 | |
1136 em_rr_event_buffer[em_rr_buffer_write++] = event_no; /* Event number */ | |
1137 em_rr_event_buffer[em_rr_buffer_write++] = BUFFER_9_LENGTH-EVT_LEN_OFFSET; /* Value length - 0 equals no value */ | |
1138 em_rr_event_buffer[em_rr_buffer_write++] = value1; /* first data info */ | |
1139 em_rr_event_buffer[em_rr_buffer_write++] = value2; /* second data info */ | |
1140 em_rr_event_buffer[em_rr_buffer_write++] = value3; /* data */ | |
1141 em_rr_event_buffer[em_rr_buffer_write++] = value4; /* data */ | |
1142 em_rr_event_buffer[em_rr_buffer_write++] = value5; /* data */ | |
1143 em_rr_event_buffer[em_rr_buffer_write++] = value6; /* data */ | |
1144 em_rr_event_buffer[em_rr_buffer_write++] = value7; /* data */ | |
1145 | |
1146 return (em_rr_sem (BUFFER_9_LENGTH, em_rr_event_buffer)); /* Data is stored inside buffer, reset flag */ | |
1147 } | |
1148 | |
1149 /* | |
1150 +------------------------------------------------------------------------------ | |
1151 | Function : rr_semaphore_err | |
1152 +------------------------------------------------------------------------------ | |
1153 | Description : Semaphor error | |
1154 | | |
1155 | | |
1156 | Parameters : void | |
1157 | | |
1158 | Return : void | |
1159 | | |
1160 +------------------------------------------------------------------------------ | |
1161 */ | |
1162 static void rr_semaphore_err (void) | |
1163 { | |
1164 static UCHAR out = 0; | |
1165 | |
1166 if (!out) | |
1167 { | |
1168 out = 1; | |
1169 /* Implements Measure#32: Row 224 */ | |
1170 TRACE_EVENT ("semaphore error"); | |
1171 } | |
1172 } | |
1173 | |
1174 | |
1175 /* | |
1176 +------------------------------------------------------------------------------ | |
1177 | Function : rr_enter_critical_section | |
1178 +------------------------------------------------------------------------------ | |
1179 | Description : | |
1180 | Attempt to access critical section by taking control | |
1181 | of the semaphore | |
1182 | | |
1183 | Parameters : void | |
1184 | | |
1185 | Return : int | |
1186 | | |
1187 +------------------------------------------------------------------------------ | |
1188 */ | |
1189 static int rr_enter_critical_section (T_HANDLE sem) | |
1190 { | |
1191 if (vsi_s_get (VSI_CALLER sem) NEQ VSI_OK) | |
1192 { | |
1193 SYST_TRACE ( "** Enter Critical Sec:semaphore NOT cleared **"); | |
1194 rr_semaphore_err(); | |
1195 return -1; | |
1196 } | |
1197 else | |
1198 { | |
1199 return 0; | |
1200 } | |
1201 } | |
1202 | |
1203 /* | |
1204 +------------------------------------------------------------------------------ | |
1205 | Function : rr_leave_critical_section | |
1206 +------------------------------------------------------------------------------ | |
1207 | Description : | |
1208 | Relinquish control of semaphore and release access to | |
1209 | critical section | |
1210 | | |
1211 | Parameters : void | |
1212 | | |
1213 | Return : int | |
1214 | | |
1215 +------------------------------------------------------------------------------ | |
1216 */ | |
1217 static int rr_leave_critical_section (T_HANDLE sem) | |
1218 { | |
1219 if (vsi_s_release (VSI_CALLER sem) NEQ VSI_OK) | |
1220 { | |
1221 SYST_TRACE ( "** Leave Critical Sec:semaphore NOT cleared **"); | |
1222 rr_semaphore_err(); | |
1223 return -1; | |
1224 } | |
1225 else | |
1226 { | |
1227 return 0; | |
1228 } | |
1229 } | |
1230 | |
1231 /* | |
1232 +------------------------------------------------------------------------------ | |
1233 | Function : em_rr_sem_init | |
1234 +------------------------------------------------------------------------------ | |
1235 | Description : | |
1236 | Initialise Semaphore | |
1237 | | |
1238 | Parameters : void | |
1239 | | |
1240 | Return : int | |
1241 | | |
1242 +------------------------------------------------------------------------------ | |
1243 */ | |
1244 GLOBAL void em_rr_sem_init (void) | |
1245 { | |
1246 sem_EM_RR = vsi_s_open (VSI_CALLER "EM_RR_SEM",1); | |
1247 | |
1248 if (sem_EM_RR NEQ VSI_ERROR) | |
1249 em_rr_sem_clear (); | |
1250 else | |
1251 SYST_TRACE ("RR:can't open semaphore \"EM_RR_SEM\""); | |
1252 } | |
1253 | |
1254 /* | |
1255 +------------------------------------------------------------------------------ | |
1256 | Function : em_rr_sem_exit | |
1257 +------------------------------------------------------------------------------ | |
1258 | Description : | |
1259 | Close the semaphore | |
1260 | | |
1261 | Parameters : void | |
1262 | | |
1263 | Return : void | |
1264 | | |
1265 +------------------------------------------------------------------------------ | |
1266 */ | |
1267 GLOBAL void em_rr_sem_exit (void) | |
1268 { | |
1269 if (sem_EM_RR NEQ VSI_ERROR) | |
1270 vsi_s_close (VSI_CALLER sem_EM_RR); | |
1271 } | |
1272 | |
1273 /* | |
1274 +------------------------------------------------------------------------------ | |
1275 | Function : em_rr_sem_clear | |
1276 +------------------------------------------------------------------------------ | |
1277 | Description : | |
1278 | Clear semaphore | |
1279 | | |
1280 | Parameters : void | |
1281 | | |
1282 | Return : void | |
1283 | | |
1284 +------------------------------------------------------------------------------ | |
1285 */ | |
1286 LOCAL void em_rr_sem_clear (void) | |
1287 { | |
1288 if (rr_enter_critical_section(sem_EM_RR)) | |
1289 { | |
1290 return; | |
1291 } | |
1292 | |
1293 em_rr_sem_index = 0; | |
1294 if(rr_leave_critical_section(sem_EM_RR)) | |
1295 { | |
1296 return; | |
1297 } | |
1298 SYST_TRACE ( "RR:em_rr_sem_index cleared"); | |
1299 } | |
1300 | |
1301 /* | |
1302 +------------------------------------------------------------------------------ | |
1303 | Function : em_rr_sem_reset | |
1304 +------------------------------------------------------------------------------ | |
1305 | Description : | |
1306 | Reset the semaphore | |
1307 | | |
1308 | Parameters : void | |
1309 | | |
1310 | Return : UBYTE | |
1311 | | |
1312 +------------------------------------------------------------------------------ | |
1313 */ | |
1314 /*lint -esym(714,em_rr_sem_reset) | Symbol not referenced | used by ACI */ | |
1315 /*lint -esym(765,em_rr_sem_reset) | external could be made static | used by ACI */ | |
1316 | |
1317 GLOBAL void em_rr_sem_reset (void) | |
1318 { | |
1319 em_rr_sem_index = 0; | |
1320 if(rr_leave_critical_section(sem_EM_RR)) | |
1321 { | |
1322 return; | |
1323 } | |
1324 | |
1325 SYST_TRACE ( "RR:em_rr_sem_index reset OK"); | |
1326 } | |
1327 | |
1328 /* | |
1329 +------------------------------------------------------------------------------ | |
1330 | Function : em_rr_sem_read | |
1331 +------------------------------------------------------------------------------ | |
1332 | Description : | |
1333 | Read state of the semaphore. The rr semaphor will be read by | |
1334 | the engineering mode via aci. | |
1335 | | |
1336 | Parameters : void | |
1337 | | |
1338 | Return : UBYTE | |
1339 | | |
1340 +------------------------------------------------------------------------------ | |
1341 */ | |
1342 /*lint -esym(714,em_rr_sem_read) | Symbol not referenced | used by ACI */ | |
1343 /*lint -esym(765,em_rr_sem_read) | external could be made static | used by ACI */ | |
1344 | |
1345 GLOBAL void em_rr_sem_read (void) | |
1346 { | |
1347 TRACE_FUNCTION ("em_rr_sem_read()"); | |
1348 | |
1349 { | |
1350 USHORT semCount; | |
1351 | |
1352 if (vsi_s_status (VSI_CALLER sem_EM_RR, &semCount) NEQ VSI_OK) | |
1353 { | |
1354 SYST_TRACE ( "** RR:sem status error **"); | |
1355 rr_semaphore_err(); | |
1356 return; | |
1357 } | |
1358 if (semCount EQ 0) | |
1359 { | |
1360 vsi_o_ttrace(VSI_CALLER TC_EVENT, "semCount = %d", semCount); | |
1361 SYST_TRACE ( "semCount EQ 0"); | |
1362 return; | |
1363 } | |
1364 } | |
1365 | |
1366 rr_enter_critical_section(sem_EM_RR); | |
1367 } | |
1368 | |
1369 /* | |
1370 +------------------------------------------------------------------------------ | |
1371 | Function : em_rr_sem | |
1372 +------------------------------------------------------------------------------ | |
1373 | Description : | |
1374 | | |
1375 | | |
1376 | Parameters : void | |
1377 | | |
1378 | Return : TRUE/FALSE - TRUE keeps the event flag valid, | |
1379 | FALSE indicates a successful flag handle | |
1380 | | |
1381 +------------------------------------------------------------------------------ | |
1382 */ | |
1383 /*lint -esym(714,em_rr_sem) | Symbol not referenced | used by ACI */ | |
1384 /*lint -esym(765,em_rr_sem) | external could be made static | used by ACI */ | |
1385 GLOBAL UBYTE em_rr_sem (UBYTE length, UBYTE *data) | |
1386 { | |
1387 UBYTE i; | |
1388 | |
1389 TRACE_FUNCTION ("em_rr_sem()"); | |
1390 | |
1391 { | |
1392 USHORT semCount; | |
1393 | |
1394 if (vsi_s_status (VSI_CALLER sem_EM_RR, &semCount) NEQ VSI_OK) | |
1395 { | |
1396 rr_semaphore_err(); | |
1397 return FALSE; | |
1398 } | |
1399 if (semCount EQ 0) | |
1400 { | |
1401 vsi_o_ttrace(VSI_CALLER TC_EVENT, "semCount = %d", semCount); | |
1402 SYST_TRACE ( "semCount EQ 0"); | |
1403 return FALSE; | |
1404 } | |
1405 } | |
1406 | |
1407 /* | |
1408 * buffer overflow protection | |
1409 */ | |
1410 if (( em_rr_sem_index + length) > EM_RR_SEM_SIZE ) | |
1411 { | |
1412 TRACE_FUNCTION ("rr buffer overflow"); | |
1413 return FALSE; | |
1414 } | |
1415 | |
1416 if(rr_enter_critical_section(sem_EM_RR)) | |
1417 return FALSE; | |
1418 | |
1419 for (i=0; i<length; i++) | |
1420 em_rr_sem_buffer[em_rr_sem_index++] = *(data++); | |
1421 | |
1422 if(rr_leave_critical_section(sem_EM_RR)) | |
1423 { | |
1424 SYST_TRACE ( "** Unable to clear semaphore **"); | |
1425 return FALSE; | |
1426 } | |
1427 | |
1428 return TRUE; /* indicates that flag was handled */ | |
1429 } /* endfunc em_rr_sem */ | |
1430 | |
1431 | |
1432 /* | |
1433 +------------------------------------------------------------------------------ | |
1434 | Function : rr_em_first_event_check() | |
1435 +------------------------------------------------------------------------------ | |
1436 | Description : Checks if first EM-Event ocured | |
1437 | | |
1438 | Parameters : None | |
1439 | | |
1440 | Return : None | |
1441 | | |
1442 +------------------------------------------------------------------------------ | |
1443 */ | |
1444 | |
1445 /* | |
1446 ACI is informed about the first event trace, used for later data processing. | |
1447 */ | |
1448 | |
1449 LOCAL void rr_em_first_event_check(void) | |
1450 { | |
1451 TRACE_FUNCTION("rr_em_first_event_check()"); | |
1452 | |
1453 if(em_rr_trace_occured EQ 0) | |
1454 { | |
1455 PALLOC(em_notification, EM_DATA_IND); | |
1456 em_notification->entity = EM_RR; | |
1457 PSENDX(MMI, em_notification); | |
1458 em_rr_trace_occured++; | |
1459 } | |
1460 } | |
1461 | |
1462 /* | |
1463 +------------------------------------------------------------------------------ | |
1464 | Function : rr_em_pco_trace_req | |
1465 +------------------------------------------------------------------------------ | |
1466 | Description : Process the primitive EM_PCO_TRACE_REQ. | |
1467 | | |
1468 | Parameters : UBYTE pco_bitmap | |
1469 | | |
1470 | Return : void | |
1471 | | |
1472 | Purpose : with this primitive the requested EM Data is traced in the PCO. | |
1473 +------------------------------------------------------------------------------ | |
1474 */ | |
1475 GLOBAL void rr_em_pco_trace_req (T_EM_PCO_TRACE_REQ *em_pco_trace_req) | |
1476 { | |
1477 GET_INSTANCE_DATA; | |
1478 UBYTE em_cell_type = EM_CELL_NA; | |
1479 TRACE_FUNCTION("rr_em_pco_trace_req()"); | |
1480 | |
1481 /*check for SC data*/ | |
1482 if(em_pco_trace_req->pco_bitmap & EM_PCO_SC_INFO) | |
1483 { | |
1484 switch (GET_STATE (STATE_ATT)) | |
1485 { | |
1486 case ATT_IDLE: | |
1487 | |
1488 if (rr_data->nc_data[SC_INDEX].bcch_status EQ DECODED) | |
1489 { | |
1490 em_cell_type = EM_CELL_GSM; | |
1491 #ifdef GPRS | |
1492 if(rr_data->nc_data[SC_INDEX].rac NEQ NOT_PRESENT_8BIT) | |
1493 em_cell_type = EM_CELL_GPRS; | |
1494 #endif | |
1495 | |
1496 TRACE_EVENT_EM_P8("EM_SC_INFO_REQ_IDLE_DECODED: arfcn:%d c1:%d c2:%d rxlev:%d bsic:%d cell_id:%d dsc:%d cell_type:%d", | |
1497 | |
1498 rr_data->nc_data[SC_INDEX].arfcn, | |
1499 rr_data->nc_data[SC_INDEX].c1, | |
1500 rr_data->nc_data[SC_INDEX].c2, | |
1501 rr_data->nc_data[SC_INDEX].rxlev, | |
1502 rr_data->nc_data[SC_INDEX].bsic, | |
1503 rr_data->nc_data[SC_INDEX].cell_id, | |
1504 em_act_dlt, | |
1505 em_cell_type); | |
1506 | |
1507 TRACE_EVENT_EM_P5("EM_SC_INFO_REQ_IDLE_DECODED: txlev:%d tn:%d lac:%d cba:%d cbq:%d", | |
1508 rr_data->sc_data.cd.cell_options.pow_ctrl, | |
1509 rr_data->sc_data.chan_desc.tn, | |
1510 rr_data->nc_data[SC_INDEX].lai.lac, | |
1511 rr_data->nc_data[SC_INDEX].rach.cell_bar_access, | |
1512 rr_data->nc_data[SC_INDEX].c2_par.cbq); | |
1513 } | |
1514 else if (rr_data->nc_data[SC_INDEX].bcch_status EQ NON_DECODED) | |
1515 { | |
1516 TRACE_EVENT_EM_P4("EM_SC_INFO_REQ_IDLE_NON_DECODED: cell_type:%d arfcn:%d rxlev:%d bsic:%d", | |
1517 em_cell_type, | |
1518 rr_data->nc_data[SC_INDEX].arfcn, | |
1519 rr_data->nc_data[SC_INDEX].rxlev, | |
1520 rr_data->nc_data[SC_INDEX].bsic); | |
1521 } | |
1522 break; | |
1523 | |
1524 case ATT_DEDICATED: | |
1525 if (!rr_data->ms_data.measurement_report.valid) | |
1526 break; | |
1527 | |
1528 em_cell_type = EM_CELL_GSM; | |
1529 | |
1530 #ifdef GPRS | |
1531 if(rr_data->nc_data[SC_INDEX].rac NEQ NOT_PRESENT_8BIT) | |
1532 em_cell_type = EM_CELL_GPRS; | |
1533 #endif | |
1534 | |
1535 TRACE_EVENT_EM_P1("EM_SC_INFO_REQ_DEDICATED: cell_type:%d", em_cell_type); | |
1536 | |
1537 TRACE_EVENT_EM_P6("EM_SC_INFO_REQ_DEDICATED: arfcn:%d bsic:%d cell_id:%d txlev:%d tn:%d rxlev_f:%d", | |
1538 rr_data->ms_data.measurement_report.arfcn, | |
1539 rr_data->nc_data[SC_INDEX].bsic, | |
1540 rr_data->nc_data[SC_INDEX].cell_id, | |
1541 rr_data->sc_data.cd.cell_options.pow_ctrl, | |
1542 rr_data->sc_data.chan_desc.tn, | |
1543 rr_data->ms_data.measurement_report.rx_lev_full); | |
1544 | |
1545 TRACE_EVENT_EM_P6("EM_SC_INFO_REQ_DEDICATED: rxlev_s:%d rlt:%d ta:%d rxqual_f:%d rxqual_s:%d vocoder:%d", | |
1546 rr_data->ms_data.measurement_report.rx_lev_sub, | |
1547 em_act_rlt, | |
1548 rr_data->sc_data.new_ta, | |
1549 rr_data->ms_data.measurement_report.rx_qual_full, | |
1550 rr_data->ms_data.measurement_report.rx_qual_sub, | |
1551 rr_data->sc_data.ch_mode); | |
1552 | |
1553 break; | |
1554 | |
1555 default: | |
1556 break; | |
1557 }/*switch - state*/ | |
1558 }/*if - SC data*/ | |
1559 | |
1560 /*check NC data*/ | |
1561 if(em_pco_trace_req->pco_bitmap & EM_PCO_NC_INFO) | |
1562 { | |
1563 UBYTE index = 0; | |
1564 UBYTE rac = 0xff; | |
1565 | |
1566 switch (GET_STATE (STATE_ATT)) | |
1567 { | |
1568 case ATT_IDLE: | |
1569 | |
1570 TRACE_EVENT_EM_P1("EM_NC_INFO_REQ_IDLE: num_nc:%d", /*number of neighbour cells*/ | |
1571 rr_data->ms_data.measurement_report.ncells.no_of_ncells); | |
1572 | |
1573 for (index = 0; index < EM_MAX_NUM_NC ; index++) /*report cells ordered by index in NC list*/ | |
1574 { | |
1575 em_cell_type = EM_CELL_NA; | |
1576 | |
1577 if (rr_data->nc_data[index].bcch_status EQ DECODED) | |
1578 { | |
1579 em_cell_type = EM_CELL_GSM; | |
1580 rac = 0xff; | |
1581 #ifdef GPRS | |
1582 rac = rr_data->nc_data[index].rac; | |
1583 if(rr_data->nc_data[index].rac NEQ NOT_PRESENT_8BIT) | |
1584 em_cell_type = EM_CELL_GPRS; | |
1585 #endif | |
1586 | |
1587 TRACE_EVENT_EM_P8("EM_NC_INFO_REQ_IDLE_DECODED: cell_type:%d rac:%d index:%d arfcn:%d c1:%d c2:%d rxlev:%d bsic:%d", | |
1588 em_cell_type, | |
1589 rac, | |
1590 index, | |
1591 rr_data->nc_data[index].arfcn, | |
1592 rr_data->nc_data[index].c1, | |
1593 rr_data->nc_data[index].c2, | |
1594 rr_data->nc_data[index].rxlev, | |
1595 rr_data->nc_data[index].bsic); | |
1596 | |
1597 TRACE_EVENT_EM_P6("EM_NC_INFO_REQ_IDLE_DECODED: cid:%d lac:%d f_o:%ld t_a:%ld cba:%d cbq:%d", | |
1598 rr_data->nc_data[index].cell_id, | |
1599 rr_data->nc_data[index].lai.lac, | |
1600 rr_data->ms_data.measurement_report.ncells.frame_offset[index], | |
1601 rr_data->ms_data.measurement_report.ncells.time_alignmt[index], | |
1602 rr_data->nc_data[index].rach.cell_bar_access, | |
1603 rr_data->nc_data[index].c2_par.cbq); | |
1604 | |
1605 TRACE_EVENT_EM_P3("EM_NC_INFO_REQ_IDLE_DECODED: cell_resel_off:%d temp_off:%d rxlev_acc_min:%ld", | |
1606 rr_data->nc_data[index].c2_par.cell_reselect_offset, | |
1607 rr_data->nc_data[index].c2_par.temp_offset, | |
1608 rr_data->nc_data[index].select_para.rxlev_access_min); | |
1609 | |
1610 } /* if decoded */ | |
1611 | |
1612 else if (rr_data->nc_data[index].bcch_status EQ NON_DECODED) | |
1613 { | |
1614 TRACE_EVENT_EM_P4("EM_NC_INFO_REQ_IDLE_NON_DECODED: cell_type:%d arfcn:%d rxlev:%d bsic:%d", | |
1615 em_cell_type, | |
1616 rr_data->nc_data[index].arfcn, | |
1617 rr_data->nc_data[index].rxlev, | |
1618 rr_data->nc_data[index].bsic); | |
1619 } /* if non decoded */ | |
1620 } /* for */ | |
1621 | |
1622 break; | |
1623 | |
1624 case ATT_DEDICATED: | |
1625 { | |
1626 if (!rr_data->ms_data.measurement_report.valid) | |
1627 break; | |
1628 | |
1629 TRACE_EVENT_EM_P1("EM_NC_INFO_REQ_DEDICATED: num_nc:%d", | |
1630 rr_data->ms_data.measurement_report.ncells.no_of_ncells); | |
1631 | |
1632 for (index = 0; index< rr_data->ms_data.measurement_report.ncells.no_of_ncells; index++) | |
1633 { | |
1634 /*in the measurement report the cells are ordered by fieldstrength - | |
1635 non valid measurements are at the end*/ | |
1636 TRACE_EVENT_EM_P6("EM_NC_INFO_REQ_DEDICATED: index:%d arfcn:%d rx_lev:%d bsic:%d f_o:%ld t_a:%ld", | |
1637 index, | |
1638 rr_data->ms_data.measurement_report.ncells.arfcn[index], | |
1639 rr_data->ms_data.measurement_report.ncells.rx_lev[index], | |
1640 rr_data->ms_data.measurement_report.ncells.bsic[index], | |
1641 rr_data->ms_data.measurement_report.ncells.frame_offset[index], | |
1642 rr_data->ms_data.measurement_report.ncells.time_alignmt[index]); | |
1643 }/*for*/ | |
1644 | |
1645 }/*case*/ | |
1646 break; | |
1647 | |
1648 default: | |
1649 break; | |
1650 }/*switch - state*/ | |
1651 }/*if - NC data*/ | |
1652 | |
1653 /*check Location and Paging data*/ | |
1654 if(em_pco_trace_req->pco_bitmap & EM_PCO_LOC_PAG_INFO) | |
1655 { | |
1656 if (rr_data->nc_data[SC_INDEX].bcch_status EQ DECODED) | |
1657 { | |
1658 TRACE_EVENT_EM_P8("EM_LOC_PAG_INFO_REQ_DECODED: mcc:%d %d %d mnc:%d %d %d bs_pa_mfrms:%d t3212:%d", | |
1659 rr_data->nc_data[SC_INDEX].lai.mcc[0], | |
1660 rr_data->nc_data[SC_INDEX].lai.mcc[1], | |
1661 rr_data->nc_data[SC_INDEX].lai.mcc[2], | |
1662 | |
1663 /*2 digits vs. 3 digits*/ | |
1664 rr_data->nc_data[SC_INDEX].lai.mnc[2] NEQ 0xF ? rr_data->nc_data[SC_INDEX].lai.mnc[0] : | |
1665 0 , | |
1666 rr_data->nc_data[SC_INDEX].lai.mnc[2] NEQ 0xF ? rr_data->nc_data[SC_INDEX].lai.mnc[1] : | |
1667 rr_data->nc_data[SC_INDEX].lai.mnc[0], | |
1668 rr_data->nc_data[SC_INDEX].lai.mnc[2] NEQ 0xF ? rr_data->nc_data[SC_INDEX].lai.mnc[2] : | |
1669 rr_data->nc_data[SC_INDEX].lai.mnc[1], | |
1670 | |
1671 rr_data->nc_data[SC_INDEX].control_descr.bs_pa_mfrms, | |
1672 rr_data->nc_data[SC_INDEX].control_descr.t3212); | |
1673 } | |
1674 if (rr_data->ms_data.tmsi_available EQ TRUE) | |
1675 TRACE_EVENT_EM_P1("EM_LOC_PAG_INFO_REQ_TMSI: %d", rr_data->ms_data.tmsi_binary); | |
1676 }/*if - Location and Paging data*/ | |
1677 | |
1678 /*check PLMN parameters*/ | |
1679 if(em_pco_trace_req->pco_bitmap & EM_PCO_PLMN_INFO) | |
1680 { | |
1681 TRACE_EVENT_EM_P4("EM_PLMN_INFO_REQ: no_creq_max:%d re_flag:%d TXPOW_max:%d RXLEV_acc_min:%d", | |
1682 rr_data->nc_data[SC_INDEX].rach.max_retrans, | |
1683 rr_data->nc_data[SC_INDEX].rach.re, | |
1684 rr_data->nc_data[SC_INDEX].select_para.ms_txpwr_max_cch, | |
1685 rr_data->nc_data[SC_INDEX].select_para.rxlev_access_min); | |
1686 | |
1687 }/* if - PLMN parameters*/ | |
1688 | |
1689 /*check Ciphering Hopping DTX data*/ | |
1690 if(em_pco_trace_req->pco_bitmap & EM_PCO_CIPH_HOP_DTX_INFO) | |
1691 { | |
1692 UBYTE i,offset; | |
1693 /* Implements Measure#32: Row 242 */ | |
1694 char *basestr="EM_CIP_HOP_DTX_INFO_REQ_FREQ"; | |
1695 | |
1696 /*to store the trace output*/ | |
1697 char hop_freq_list[MAX_SPRINTF_STRING_LEN]; /*lint !e813 , info about length*/ | |
1698 | |
1699 if ((GET_STATE(STATE_ATT) EQ ATT_DEDICATED) AND | |
1700 (GET_STATE(STATE_DAT) EQ DAT_DEDICATED)) | |
1701 { | |
1702 | |
1703 TRACE_EVENT_EM_P6("EM_CIP_HOP_DTX_INFO_REQ_DEDICATED: ciph:%d dtx:%d v_start:%d hop:%d hsn:%d arfcn:%d", | |
1704 rr_data->sc_data.ciph_on, | |
1705 rr_data->sc_data.cd.dtx, | |
1706 v_start, | |
1707 rr_data->sc_data.chan_desc.hop, | |
1708 rr_data->sc_data.chan_desc.hop NEQ H_NO ? rr_data->sc_data.chan_desc.hsn : NOT_PRESENT_16BIT, | |
1709 rr_data->sc_data.chan_desc.arfcn); | |
1710 | |
1711 if(rr_data->sc_data.chan_desc.hop NEQ H_NO) | |
1712 { | |
1713 /* Implements Measure#32: Row 242 */ | |
1714 offset = sprintf(hop_freq_list, "%s1: ", basestr); | |
1715 | |
1716 | |
1717 for (i = 0; (i < MAX_MA_CHANNELS) AND (ma[i] NEQ NOT_PRESENT_16BIT); i++) | |
1718 { | |
1719 offset += sprintf(hop_freq_list+offset, "%u ", ma[i]); | |
1720 /* | |
1721 * 4 spaces for freq + 1 blank space + 1 space for '\0' | |
1722 */ | |
1723 if(offset > MAX_SPRINTF_STRING_LEN - 6) | |
1724 { | |
1725 TRACE_EVENT_EM (hop_freq_list); | |
1726 /* Implements Measure#32: Row 245 */ | |
1727 offset = sprintf(hop_freq_list, "%s1_CONT: ", basestr); | |
1728 } | |
1729 } | |
1730 TRACE_EVENT_EM (hop_freq_list); | |
1731 TRACE_EVENT_EM_P2("EM_CIP_HOP_DTX_INFO_REQ_FREQ1: nr_arfcns:%d, maio:%d", | |
1732 i,rr_data->sc_data.chan_desc.maio); | |
1733 } /* If hopping valid */ | |
1734 | |
1735 if (v_start) | |
1736 { | |
1737 | |
1738 /* Implements Measure#32: Row 247 */ | |
1739 offset = sprintf(hop_freq_list, "%s2: ", basestr);/*before starting time*/ | |
1740 | |
1741 for (i = 0; (i < MAX_MA_CHANNELS) AND (ma2[i] NEQ NOT_PRESENT_16BIT); i++) | |
1742 { | |
1743 offset += sprintf(hop_freq_list+offset, "%u ", ma2[i]); | |
1744 if(offset > MAX_SPRINTF_STRING_LEN - 6) | |
1745 { | |
1746 TRACE_EVENT_EM (hop_freq_list); | |
1747 /* Implements Measure#32: Row 248 */ | |
1748 offset = sprintf(hop_freq_list, "%s2_CONT: ", basestr); | |
1749 } | |
1750 } | |
1751 TRACE_EVENT_EM (hop_freq_list); | |
1752 TRACE_EVENT_EM_P2("EM_CIP_HOP_DTX_INFO_REQ_FREQ2: nr_arfcns:%d, maio:%d",i, maio2); | |
1753 | |
1754 }/*if - starting time valid*/ | |
1755 } /* ATT dedicated state */ | |
1756 else | |
1757 { | |
1758 TRACE_EVENT_EM_P1("EM_CIP_HOP_DTX_INFO_REQ_IDLE: dtx:%d", rr_data->sc_data.cd.dtx); | |
1759 } /* ATT idle state */ | |
1760 }/*if - ciphering, hopping, dtx*/ | |
1761 | |
1762 /*check Power (Classmark) data*/ | |
1763 if(em_pco_trace_req->pco_bitmap & EM_PCO_POWER_INFO) | |
1764 {/*here the em_power_info_cnf struckture is used, because I couldn't find classmark definition*/ | |
1765 PALLOC(em_power_info_cnf, EM_POWER_INFO_CNF); | |
1766 memset (em_power_info_cnf, 0, sizeof (T_EM_POWER_INFO_CNF)); | |
1767 memcpy(&em_power_info_cnf->classm2, &rr_data->ms_data.classmark2, sizeof (T_classm2)); | |
1768 memcpy(&em_power_info_cnf->classm3, &rr_data->ms_data.classmark3, sizeof (T_classm3)); | |
1769 | |
1770 TRACE_EVENT_EM_P6("EM_POWER_INFO_REQ_CLASSMARK_2: rev_lev:%d es_ind:%d a5_1:%d rf_pow_cap:%d ps_cap:%d ss_screen:%d", | |
1771 em_power_info_cnf->classm2.rev_lev, em_power_info_cnf->classm2.es_ind, | |
1772 em_power_info_cnf->classm2.a5_1, em_power_info_cnf->classm2.rf_pow_cap, | |
1773 em_power_info_cnf->classm2.ps_cap, em_power_info_cnf->classm2.ss_screen); | |
1774 TRACE_EVENT_EM_P6("EM_POWER_INFO_REQ_CLASSMARK_2: sm_cap:%d freq_cap:%d class_3:%d cmsp:%d a5_3:%d a5_2:%d", | |
1775 em_power_info_cnf->classm2.sm_cap, em_power_info_cnf->classm2.freq_cap, | |
1776 em_power_info_cnf->classm2.class_3, em_power_info_cnf->classm2.cmsp, | |
1777 em_power_info_cnf->classm2.a5_3, em_power_info_cnf->classm2.a5_2); | |
1778 | |
1779 TRACE_EVENT_EM_P6("EM_POWER_INFO_REQ_CLASSMARK_3: mb_sub:%d a5_7:%d a5_6:%d a5_5:%d a5_4:%d v_radio_cap_2:%d", | |
1780 em_power_info_cnf->classm3.mb_sub, em_power_info_cnf->classm3.a5_7, | |
1781 em_power_info_cnf->classm3.a5_6, em_power_info_cnf->classm3.a5_5, | |
1782 em_power_info_cnf->classm3.a5_4, em_power_info_cnf->classm3.v_radio_cap_2); | |
1783 TRACE_EVENT_EM_P6("EM_POWER_INFO_REQ_CLASSMARK_3: ra_cap_2:%d v_ra_cap_1:%d ra_cap_1:%d v_r_sup:%d r_sup:%d v_m_s_class:%d", | |
1784 em_power_info_cnf->classm3.radio_cap_2, em_power_info_cnf->classm3.v_radio_cap_1, | |
1785 em_power_info_cnf->classm3.radio_cap_1, em_power_info_cnf->classm3.v_r_support, | |
1786 em_power_info_cnf->classm3.r_support, em_power_info_cnf->classm3.v_m_s_class); | |
1787 TRACE_EVENT_EM_P6("EM_POWER_INFO_REQ_CLASSMARK_3: m_s_class:%d ucs2_treat:%d ext_meas_cap:%d v_meas_cap:%d sw_time:%d sws_time:%d", | |
1788 em_power_info_cnf->classm3.m_s_class, em_power_info_cnf->classm3.ucs2_treat, | |
1789 em_power_info_cnf->classm3.ext_meas_cap, em_power_info_cnf->classm3.v_meas_cap, | |
1790 em_power_info_cnf->classm3.meas_cap.sw_time, em_power_info_cnf->classm3.meas_cap.sws_time); | |
1791 | |
1792 PFREE(em_power_info_cnf); | |
1793 | |
1794 }/* if - Power (Classmark) data*/ | |
1795 | |
1796 /*check Identity data*/ | |
1797 if(em_pco_trace_req->pco_bitmap & EM_PCO_IDENTITY_INFO) | |
1798 { | |
1799 TRACE_EVENT_EM_P4("EM_IDENTITY_INFO_REQ_IMEI: id_type:%d v_id:%d c_id:%d odd_even:%d", | |
1800 rr_data->ms_data.imei.ident_type, | |
1801 rr_data->ms_data.imei.v_ident_dig, | |
1802 rr_data->ms_data.imei.c_ident_dig, | |
1803 rr_data->ms_data.imei.odd_even); | |
1804 | |
1805 TRACE_EVENT_EM_P8("EM_IDENTITY_INFO_REQ: imei_1: %d %d %d %d %d %d %d %d", | |
1806 rr_data->ms_data.imei.ident_dig[0], rr_data->ms_data.imei.ident_dig[1], | |
1807 rr_data->ms_data.imei.ident_dig[2], rr_data->ms_data.imei.ident_dig[3], | |
1808 rr_data->ms_data.imei.ident_dig[4], rr_data->ms_data.imei.ident_dig[5], | |
1809 rr_data->ms_data.imei.ident_dig[6], rr_data->ms_data.imei.ident_dig[7]); | |
1810 TRACE_EVENT_EM_P8("EM_IDENTITY_INFO_REQ: imei_2: %d %d %d %d %d %d %d %d", | |
1811 rr_data->ms_data.imei.ident_dig[8], rr_data->ms_data.imei.ident_dig[9], | |
1812 rr_data->ms_data.imei.ident_dig[10], rr_data->ms_data.imei.ident_dig[11], | |
1813 rr_data->ms_data.imei.ident_dig[12], rr_data->ms_data.imei.ident_dig[13], | |
1814 rr_data->ms_data.imei.ident_dig[14], rr_data->ms_data.imei.ident_dig[15]); | |
1815 | |
1816 if (rr_data->ms_data.imsi_available) /* SIM available */ | |
1817 { | |
1818 TRACE_EVENT_EM_P4("EM_IDENTITY_INFO_REQ_IMSI: id_type:%d v_id:%d c_id:%d odd_even:%d", | |
1819 rr_data->ms_data.imsi.ident_type, | |
1820 rr_data->ms_data.imsi.v_ident_dig, | |
1821 rr_data->ms_data.imsi.c_ident_dig, | |
1822 rr_data->ms_data.imsi.odd_even); | |
1823 TRACE_EVENT_EM_P8("EM_IDENTITY_INFO_REQ: imsi_1: %d %d %d %d %d %d %d %d", | |
1824 rr_data->ms_data.imsi.ident_dig[0], rr_data->ms_data.imsi.ident_dig[1], | |
1825 rr_data->ms_data.imsi.ident_dig[2], rr_data->ms_data.imsi.ident_dig[3], | |
1826 rr_data->ms_data.imsi.ident_dig[4], rr_data->ms_data.imsi.ident_dig[5], | |
1827 rr_data->ms_data.imsi.ident_dig[6], rr_data->ms_data.imsi.ident_dig[7]); | |
1828 TRACE_EVENT_EM_P8("EM_IDENTITY_INFO_REQ: imsi_2: %d %d %d %d %d %d %d %d", | |
1829 rr_data->ms_data.imsi.ident_dig[8], rr_data->ms_data.imsi.ident_dig[9], | |
1830 rr_data->ms_data.imsi.ident_dig[10], rr_data->ms_data.imsi.ident_dig[11], | |
1831 rr_data->ms_data.imsi.ident_dig[12], rr_data->ms_data.imsi.ident_dig[13], | |
1832 rr_data->ms_data.imsi.ident_dig[14], rr_data->ms_data.imsi.ident_dig[15]); | |
1833 }/*if - SIM available*/ | |
1834 | |
1835 if (rr_data->ms_data.tmsi_available EQ TRUE) | |
1836 TRACE_EVENT_EM_P1("EM_IDENTITY_INFO_REQ: tmsi_bin: %ld", rr_data->ms_data.tmsi_binary); | |
1837 }/*if - Identity data*/ | |
1838 | |
1839 /*check AMR configuration data*/ | |
1840 if(em_pco_trace_req->pco_bitmap & EM_PCO_AMR_INFO) | |
1841 { | |
1842 if ((GET_STATE(STATE_ATT) EQ ATT_DEDICATED) AND | |
1843 (GET_STATE(STATE_DAT) EQ DAT_DEDICATED)) | |
1844 { | |
1845 if(rr_data->sc_data.ch_mode EQ CM_AMR) | |
1846 { | |
1847 UBYTE amr_index,amr_nr_modes = 1; | |
1848 | |
1849 TRACE_EVENT_EM_P5("EM_AMR_INFO_REQ_DEDICATED: vocoder:%d icmi:%d icm:%d acs:%d first_codec:%d", | |
1850 rr_data->sc_data.chan_desc.chan_type, | |
1851 rr_data->sc_data.amr_conf.icmi, | |
1852 rr_data->sc_data.amr_conf.st_mode, | |
1853 rr_data->sc_data.amr_conf.set_amr, | |
1854 em_get_first_codec(rr_data->sc_data.amr_conf.set_amr)); | |
1855 | |
1856 if(rr_data->sc_data.amr_conf.v_cod_prop) | |
1857 { | |
1858 /* Number of codec modes */ | |
1859 amr_nr_modes = rr_data->sc_data.amr_conf.c_cod_prop + 1; | |
1860 | |
1861 TRACE_EVENT_EM_P1("EM_AMR_INFO_REQ_DEDICATED: amr_num_modes:%d", | |
1862 amr_nr_modes); | |
1863 | |
1864 /* Threshold and Hysteresis properties between codec modes */ | |
1865 for(amr_index=0;amr_index<amr_nr_modes;amr_index++) | |
1866 { | |
1867 TRACE_EVENT_EM_P2("EM_AMR_COD_PROP: thr:%d hyst:%d", | |
1868 rr_data->sc_data.amr_conf.cod_prop[amr_index].codec_thr, | |
1869 rr_data->sc_data.amr_conf.cod_prop[amr_index].codec_hyst); | |
1870 } | |
1871 } /* codec properties */ | |
1872 } /* AMR configured */ | |
1873 else | |
1874 { | |
1875 TRACE_EVENT_EM("EM_AMR_INFO_REQ_DEDICATED: AMR not configured"); | |
1876 } /* AMR not configured in dedicated state */ | |
1877 } /* ATT dedicated state */ | |
1878 else | |
1879 { | |
1880 TRACE_EVENT_EM("EM_AMR_INFO_REQ_IDLE: Not Applicable"); | |
1881 } /* ATT idle state */ | |
1882 } /* EM_PCO_AMR_INFO */ | |
1883 | |
1884 #if !defined (WIN32) | |
1885 /*check SW Version data*/ | |
1886 if(em_pco_trace_req->pco_bitmap & EM_PCO_SW_VERSION_INFO) | |
1887 { | |
1888 TRACE_EVENT_EM_P1("EM_SW_SIM: %s",sim_version()); | |
1889 TRACE_EVENT_EM_P1("EM_SW_SMS: %s",sms_version()); | |
1890 TRACE_EVENT_EM_P1("EM_SW_SS: %s",ss_version()) ; | |
1891 TRACE_EVENT_EM_P1("EM_SW_CC: %s",cc_version()) ; | |
1892 TRACE_EVENT_EM_P1("EM_SW_MM: %s",mm_version()) ; | |
1893 TRACE_EVENT_EM_P1("EM_SW_RR: %s",rr_version()) ; | |
1894 TRACE_EVENT_EM_P1("EM_SW_DL: %s",dl_version()) ; | |
1895 TRACE_EVENT_EM_P1("EM_SW_L1: %s",l1_version()) ; | |
1896 }/*if - SW Version data*/ | |
1897 #endif | |
1898 | |
1899 PFREE(em_pco_trace_req); | |
1900 }/*rr_em_pco_trace_req*/ | |
1901 | |
1902 | |
1903 /* ------------------ Microtec Cooperation Functions ----------*/ | |
1904 #ifdef GPRS /* changes for later: Include extra compile switch for fmm */ | |
1905 /* | |
1906 +------------------------------------------------------------------------------ | |
1907 | Function : dat_em_fmm_sc_info_req | |
1908 +------------------------------------------------------------------------------ | |
1909 | Description : This function provides the data for microtec fmm - Program | |
1910 | | |
1911 | Parameters : Primitive from EM - T_EM_FMM_SC_INFO_REQ | |
1912 | | |
1913 | Return : void | |
1914 +------------------------------------------------------------------------------ | |
1915 This function sends the latest stored data of the SC. It is only interesting | |
1916 during a GPRS connection (PTM). Therefor the ATT_STATE is ATT_IDLE (or RE_SELECTION). | |
1917 | |
1918 */ | |
1919 | |
1920 GLOBAL void dat_em_fmm_sc_info_req (T_EM_FMM_SC_INFO_REQ *em_fmm_sc_info_req) | |
1921 { | |
1922 /*GET_INSTANCE_DATA;*/ | |
1923 PFREE(em_fmm_sc_info_req); | |
1924 | |
1925 TRACE_FUNCTION ("dat_fmm_em_sc_info_req()"); | |
1926 | |
1927 #ifdef FF_WAP | |
1928 { | |
1929 PALLOC(em_fmm_sc_info_cnf, EM_FMM_SC_INFO_CNF); | |
1930 | |
1931 memset (em_fmm_sc_info_cnf, 0, sizeof (T_EM_FMM_SC_INFO_CNF)); | |
1932 | |
1933 switch (GET_STATE (STATE_ATT)) | |
1934 { | |
1935 case ATT_IDLE: | |
1936 if (rr_data->nc_data[SC_INDEX].bcch_status EQ DECODED) | |
1937 { | |
1938 em_fmm_sc_info_cnf->arfcn = rr_data->nc_data[SC_INDEX].arfcn; | |
1939 em_fmm_sc_info_cnf->c1 = rr_data->nc_data[SC_INDEX].c1; | |
1940 em_fmm_sc_info_cnf->c2 = rr_data->nc_data[SC_INDEX].c2; | |
1941 em_fmm_sc_info_cnf->rac = rr_data->nc_data[SC_INDEX].rac; | |
1942 em_fmm_sc_info_cnf->hyst = rr_data->nc_data[SC_INDEX].select_para.cell_resel_hyst; | |
1943 em_fmm_sc_info_cnf->c32 = rr_data->nc_data[SC_INDEX].c32; /*c32_used abfragen ?*/ | |
1944 em_fmm_sc_info_cnf->gprs_prio_class = rr_data->nc_data[SC_INDEX].cr_par.priority_class; | |
1945 } | |
1946 else if (rr_data->nc_data[SC_INDEX].bcch_status EQ NON_DECODED) | |
1947 { | |
1948 em_fmm_sc_info_cnf->arfcn = rr_data->nc_data[SC_INDEX].arfcn; | |
1949 } | |
1950 break; | |
1951 case ATT_CS3: | |
1952 break; /* Cell reselection - if needed can be included later*/ | |
1953 default: | |
1954 break; | |
1955 } /*switch*/ | |
1956 | |
1957 /* TRACE_EVENT_P7("arfcn:%d c1:%d c2:%d rac:%d hyst:%d c32:%d prio:%d" , em_fmm_sc_info_cnf->arfcn,\ | |
1958 em_fmm_sc_info_cnf->c1 , em_fmm_sc_info_cnf->c2 , em_fmm_sc_info_cnf->rac , em_fmm_sc_info_cnf->hyst,\ | |
1959 em_fmm_sc_info_cnf->c32, em_fmm_sc_info_cnf->gprs_prio_class);*/ | |
1960 | |
1961 PSENDX( WAP, em_fmm_sc_info_cnf); | |
1962 } | |
1963 | |
1964 #endif /*FF_WAP*/ | |
1965 | |
1966 } | |
1967 | |
1968 | |
1969 /* | |
1970 +------------------------------------------------------------------------------ | |
1971 | Function : dat_em_fmm_nc_info_req | |
1972 +------------------------------------------------------------------------------ | |
1973 | Description : Process the primitive EM_FMM_NC_INFO_REQ. | |
1974 | | |
1975 | Parameters : Primitive from EM - T_EM_FMM_NC_INFO_REQ | |
1976 | | |
1977 | Return : void | |
1978 +------------------------------------------------------------------------------ | |
1979 This function sends the latest stored data of the NC. It is only interesting | |
1980 during a GPRS connection (PTM). Therefor the ATT_STATE is ATT_IDLE or RE_SELECTION. | |
1981 So the measurement report results should also be available in the nc_data. | |
1982 */ | |
1983 GLOBAL void dat_em_fmm_nc_info_req (T_EM_FMM_NC_INFO_REQ *em_fmm_nc_info_req) | |
1984 { | |
1985 /*GET_INSTANCE_DATA;*/ | |
1986 PFREE(em_fmm_nc_info_req); | |
1987 | |
1988 TRACE_FUNCTION ("dat_em_fmm_nc_info_req()"); | |
1989 | |
1990 #ifdef FF_WAP | |
1991 { | |
1992 UBYTE index = 0, index2 = 0; | |
1993 PALLOC(em_fmm_nc_info_cnf, EM_FMM_NC_INFO_CNF); | |
1994 | |
1995 memset (em_fmm_nc_info_cnf, 0, sizeof (T_EM_FMM_NC_INFO_CNF)); | |
1996 | |
1997 switch (GET_STATE (STATE_ATT)) | |
1998 { | |
1999 case ATT_IDLE: | |
2000 em_fmm_nc_info_cnf->no_ncells = rr_data->ms_data.measurement_report.ncells.no_of_ncells; | |
2001 for (index = index2 = 0; index< EM_MAX_NUM_NC; index++) | |
2002 { | |
2003 if (rr_data->nc_data[index].bcch_status EQ DECODED) | |
2004 { | |
2005 em_fmm_nc_info_cnf->arfcn_nc[index2] = rr_data->nc_data[index].arfcn; | |
2006 em_fmm_nc_info_cnf->c2_nc[index2] = rr_data->nc_data[index].c2; | |
2007 em_fmm_nc_info_cnf->rac_nc[index2] = rr_data->nc_data[index].rac; | |
2008 em_fmm_nc_info_cnf->c31_nc[index2] = rr_data->nc_data[index].c31; | |
2009 em_fmm_nc_info_cnf->c32_nc[index2] = rr_data->nc_data[index].c32; | |
2010 em_fmm_nc_info_cnf->gprs_prio_class_nc[index2] = rr_data->nc_data[index].cr_par.priority_class; | |
2011 index2++; | |
2012 } /* if decoded */ | |
2013 | |
2014 else if (rr_data->nc_data[index].bcch_status EQ NON_DECODED) | |
2015 { | |
2016 em_fmm_nc_info_cnf->arfcn_nc[index] = rr_data->nc_data[index].arfcn; | |
2017 } /* if non decoded */ | |
2018 } /* for */ | |
2019 | |
2020 break; | |
2021 default: | |
2022 break; | |
2023 }/*switch*/ | |
2024 | |
2025 /* for (index = 0 ; index < EM_MAX_NUM_NC ; index++) | |
2026 TRACE_EVENT_P6("arfcn:%d c2:%d rac:%d c31:%d c32:%d prio:%d", em_fmm_nc_info_cnf->arfcn_nc[index],\ | |
2027 em_fmm_nc_info_cnf->c2_nc[index], em_fmm_nc_info_cnf->rac_nc[index],\ | |
2028 em_fmm_nc_info_cnf->c31_nc[index], em_fmm_nc_info_cnf->c32_nc[index],\ | |
2029 em_fmm_nc_info_cnf->gprs_prio_class_nc[index]);*/ | |
2030 | |
2031 PSENDX( WAP, em_fmm_nc_info_cnf); | |
2032 } | |
2033 | |
2034 #endif /*FF_WAP*/ | |
2035 | |
2036 | |
2037 } | |
2038 | |
2039 /* | |
2040 +------------------------------------------------------------------------------ | |
2041 | Function : dat_em_fmm_reselection_start_ind | |
2042 +------------------------------------------------------------------------------ | |
2043 | Description : Indicates the start of an cell reselection to FMM | |
2044 | | |
2045 | Parameters : void | |
2046 | | |
2047 | Return : void | |
2048 +------------------------------------------------------------------------------ | |
2049 */ | |
2050 GLOBAL void dat_em_fmm_reselection_start_ind (void) | |
2051 { | |
2052 /*GET_INSTANCE_DATA;*/ | |
2053 TRACE_FUNCTION("dat_em_fmm_reselection_start_ind()"); | |
2054 #ifdef FF_WAP | |
2055 { | |
2056 PALLOC(em_fmm_reselection_start_ind, EM_FMM_RESELECTION_START_IND); | |
2057 memset (em_fmm_reselection_start_ind, 0, sizeof (T_EM_FMM_RESELECTION_START_IND)); | |
2058 em_fmm_reselection_start_ind->arfcn = rr_data->nc_data[rr_data->reselect_index].arfcn; | |
2059 em_fmm_reselection_start_ind->rac = rr_data->nc_data[rr_data->reselect_index].rac; | |
2060 em_fmm_reselection_start_ind->res_type = rr_data->sc_data.selection_type; | |
2061 | |
2062 /* TRACE_EVENT_P3("em_fmm_reselection_start_ind %d,%d,%d",em_fmm_reselection_start_ind->arfcn, | |
2063 em_fmm_reselection_start_ind->rac,em_fmm_reselection_start_ind->res_type );*/ | |
2064 | |
2065 PSENDX(WAP, em_fmm_reselection_start_ind); | |
2066 } | |
2067 | |
2068 #endif /*FF_WAP */ | |
2069 | |
2070 } | |
2071 | |
2072 /* | |
2073 +------------------------------------------------------------------------------ | |
2074 | Function : dat_em_fmm_reselection_end_ind | |
2075 +------------------------------------------------------------------------------ | |
2076 | Description : Indicates the end of an cell reselection to FMM | |
2077 | | |
2078 | Parameters : void | |
2079 | | |
2080 | Return : void | |
2081 +------------------------------------------------------------------------------ | |
2082 */ | |
2083 GLOBAL void dat_em_fmm_reselection_end_ind (void) | |
2084 { | |
2085 /*GET_INSTANCE_DATA;*/ | |
2086 TRACE_FUNCTION("dat_em_fmm_reselection_end_ind()"); | |
2087 #ifdef FF_WAP | |
2088 { | |
2089 PALLOC(em_fmm_resel_end_ind, EM_FMM_RESELECTION_END_IND); | |
2090 memset (em_fmm_resel_end_ind, 0, sizeof (T_EM_FMM_RESELECTION_END_IND)); | |
2091 em_fmm_resel_end_ind->arfcn = rr_data->nc_data[SC_INDEX].arfcn; | |
2092 em_fmm_resel_end_ind->rac = rr_data->nc_data[SC_INDEX].rac; | |
2093 /* TRACE_EVENT_P2("em_fmm_reselection_end_ind %d,%d",em_fmm_resel_end_ind->arfcn, | |
2094 em_fmm_resel_end_ind->rac);*/ | |
2095 | |
2096 PSENDX(WAP, em_fmm_resel_end_ind); | |
2097 } | |
2098 | |
2099 #endif /*FF_WAP*/ | |
2100 | |
2101 } | |
2102 | |
2103 #endif /* GPRS */ | |
2104 | |
2105 #endif /* FF_EM_MODE */ | |
2106 | |
2107 #endif /* RR_EM_C */ |