FreeCalypso > hg > fc-magnetite
comparison src/g23m-gsm/rr/rr_csf.c @ 104:27a4235405c6
src/g23m-gsm: import from LoCosto source
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 04 Oct 2016 18:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
103:76d139c7a25e | 104:27a4235405c6 |
---|---|
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 custom specific functions | |
18 | for the component RR of the mobile station | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef RR_CSF_C | |
23 #define RR_CSF_C | |
24 | |
25 #define ENTITY_RR | |
26 #define SAP_ACI | |
27 | |
28 /*==== INCLUDES ===================================================*/ | |
29 | |
30 #include <string.h> | |
31 #include <stdlib.h> | |
32 #include <stddef.h> /* offsetof */ | |
33 #include "typedefs.h" | |
34 #include "pcm.h" | |
35 #include "pconst.cdg" | |
36 #include "mconst.cdg" | |
37 #include "message.h" | |
38 #include "ccdapi.h" | |
39 #include "vsi.h" | |
40 #include "custom.h" | |
41 #include "gsm.h" | |
42 #include "prim.h" | |
43 #include "cnf_rr.h" | |
44 #include "tok.h" | |
45 #include "rr.h" | |
46 #include "cl_imei.h" /* IMEI common library */ | |
47 #if defined(_SIMULATION_FFS_) | |
48 #include "ffs/ffs.h" | |
49 #include "ffs_coat.h" | |
50 #endif /* _SIMULATION_FFS_ */ | |
51 | |
52 /*==== EXPORT =====================================================*/ | |
53 | |
54 /*==== PRIVAT =====================================================*/ | |
55 #if defined(_SIMULATION_FFS_) | |
56 LOCAL BOOL rr_csf_handle_ffs_read_result(T_FFS_SIZE status_read); | |
57 LOCAL BOOL rr_csf_handle_ffs_write_result(T_FFS_RET status_write); | |
58 LOCAL void rr_csf_check_ffs_dirs( void ); | |
59 LOCAL void rr_csf_create_ffs_dirs(const char *dir_name); | |
60 #endif /* _SIMULATION_FFS_ */ | |
61 | |
62 | |
63 | |
64 /*==== VARIABLES ==================================================*/ | |
65 /* Cell selection improvements LLD section 4.1.1.1 */ | |
66 #if defined(_SIMULATION_) | |
67 T_LIST win_black_list[MAX_REGIONS]; /* Simulates FFS for "Black List" */ | |
68 T_CS_WHITE_LIST win_white_list; /* Simulates FFS for "White List */ | |
69 | |
70 /*Simulates FFS for lower rxlevel thresholds*/ | |
71 UBYTE win_lower_rxlev_thr[MAX_NUM_BANDS] = { LOWER_RXLEV_THRESHOLD_850, LOWER_RXLEV_THRESHOLD, \ | |
72 LOWER_RXLEV_THRESHOLD, LOWER_RXLEV_THRESHOLD, LOWER_RXLEV_THRESHOLD }; | |
73 /*Simulates FFS for medium rxlevel thresholds*/ | |
74 UBYTE win_medium_rxlev_thr[MAX_NUM_BANDS] = { MEDIUM_RXLEV_THRESHOLD, MEDIUM_RXLEV_THRESHOLD, \ | |
75 MEDIUM_RXLEV_THRESHOLD, MEDIUM_RXLEV_THRESHOLD, MEDIUM_RXLEV_THRESHOLD }; | |
76 /*Simulates FFS for upper rxlevel thresholds*/ | |
77 UBYTE win_upper_rxlev_thr[MAX_NUM_BANDS] = { UPPER_RXLEV_THRESHOLD, UPPER_RXLEV_THRESHOLD, \ | |
78 UPPER_RXLEV_THRESHOLD, UPPER_RXLEV_THRESHOLD, UPPER_RXLEV_THRESHOLD }; | |
79 /* Initialize the simulated rxlevel thresholds here itself */ | |
80 #endif | |
81 | |
82 /* | |
83 +--------------------------------------------------------------------+ | |
84 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
85 | STATE : code ROUTINE : rr_csf_read_imei | | |
86 +--------------------------------------------------------------------+ | |
87 | |
88 PURPOSE : The function reads the International mobile identity number | |
89 from the non-volantile memory into an internal data structure. | |
90 | |
91 */ | |
92 | |
93 GLOBAL void rr_csf_read_imei (T_mob_ident *imei) | |
94 { | |
95 UBYTE buf[CL_IMEI_SIZE]; | |
96 | |
97 TRACE_FUNCTION ("rr_csf_read_imei()"); | |
98 | |
99 imei->v_ident_dig = TRUE; | |
100 imei->v_tmsi_1 = FALSE; | |
101 imei->ident_type = 3; /* set to TYPE_IMEISV */ | |
102 imei->c_ident_dig = 16; | |
103 imei->odd_even = 0; | |
104 | |
105 /* Get IMEISV from IMEI common library */ | |
106 cl_get_imeisv(CL_IMEI_SIZE, buf, CL_IMEI_GET_SECURE_IMEI); | |
107 | |
108 /* copy digits */ | |
109 imei->ident_dig[0] = (buf [0] >> 4) & 0x0F; /* TAC 8 byte */ | |
110 imei->ident_dig[1] = buf [0] & 0x0F; | |
111 imei->ident_dig[2] = (buf [1] >> 4) & 0x0F; | |
112 imei->ident_dig[3] = buf [1] & 0x0F; | |
113 imei->ident_dig[4] = (buf [2] >> 4) & 0x0F; | |
114 imei->ident_dig[5] = buf [2] & 0x0F; | |
115 imei->ident_dig[6] = (buf [3] >> 4) & 0x0F; | |
116 imei->ident_dig[7] = buf [3] & 0x0F; | |
117 imei->ident_dig[8] = (buf [4] >> 4) & 0x0F; /* SNR 6 byte */ | |
118 imei->ident_dig[9] = buf [4] & 0x0F; | |
119 imei->ident_dig[10]= (buf [5] >> 4) & 0x0F; | |
120 imei->ident_dig[11]= buf [5] & 0x0F; | |
121 imei->ident_dig[12]= (buf [6] >> 4) & 0x0F; | |
122 imei->ident_dig[13]= buf [6] & 0x0F; | |
123 imei->ident_dig[14]= (buf [7] >> 4) & 0x0F; /* SV 2 byte */ | |
124 imei->ident_dig[15]= buf [7] & 0x0F; | |
125 | |
126 TRACE_EVENT_P8("RR INFO IMEI: TAC %1x%1x%1x%1x%1x%1x%1x%1x", | |
127 imei->ident_dig[0], imei->ident_dig[1], imei->ident_dig[2], | |
128 imei->ident_dig[3], imei->ident_dig[4], imei->ident_dig[5], | |
129 imei->ident_dig[6], imei->ident_dig[7]); | |
130 TRACE_EVENT_P6("RR INFO IMEI: SNR %1x%1x%1x%1x%1x%1x", | |
131 imei->ident_dig[8], imei->ident_dig[9], imei->ident_dig[10], | |
132 imei->ident_dig[11], imei->ident_dig[12], imei->ident_dig[13]); | |
133 TRACE_EVENT_P2("RR INFO IMEI: SV %1x%1x", imei->ident_dig[14], | |
134 imei->ident_dig[15]); | |
135 } | |
136 | |
137 #if !defined(NTRACE) | |
138 GLOBAL void rr_csf_trace_power (void) | |
139 { | |
140 GET_INSTANCE_DATA; | |
141 UBYTE setbands = rr_data->ms_data.rf_cap.setbands; | |
142 UBYTE bands = rr_data->ms_data.rf_cap.bands; | |
143 UBYTE stdbands; | |
144 | |
145 if (setbands EQ 0) | |
146 { | |
147 setbands = bands; /* auto detection, use all supported bands */ | |
148 } | |
149 else | |
150 setbands &= bands;/* bands set, use only supported bands */ | |
151 | |
152 /* bands which might be supported with current std */ | |
153 stdbands = std_bands[std-1]; | |
154 | |
155 TRACE_EVENT_P5 ("std=%d(%02x), (set)bands=%02x(%02x)->%02x", | |
156 std, stdbands, rr_data->ms_data.rf_cap.setbands, | |
157 rr_data->ms_data.rf_cap.bands, setbands); | |
158 TRACE_EVENT_P6 ("%sGSM 900: power class=%u %s,%s%s%s", | |
159 (bands&0x08)?"E":" ", | |
160 rr_data->ms_data.rf_cap.rf_power.pow_class4[IDX_PWRCLASS_900].pow_class, | |
161 (bands&0x09)?"rfcap":" ", | |
162 (stdbands&0x09)?"std":" ", | |
163 (setbands&0x09)?",supported":"", | |
164 ((setbands&0x09) AND (setbands&0x09) EQ 0x01)?" (only GSM)":""); | |
165 TRACE_EVENT_P4 ("DCS 1800: power class=%u %s,%s%s", | |
166 rr_data->ms_data.rf_cap.rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class, | |
167 (bands&0x02)?"rfcap":" ", | |
168 (stdbands&0x02)?"std":" ", | |
169 (setbands&0x02)?",supported":""); | |
170 TRACE_EVENT_P4 ("PCS 1900: power class=%u %s,%s%s", | |
171 rr_data->ms_data.rf_cap.rf_power.pow_class4[IDX_PWRCLASS_1900].pow_class, | |
172 (bands&0x04)?"rfcap":" ", | |
173 (stdbands&0x04)?"std":" ", | |
174 (setbands&0x04)?",supported":""); | |
175 TRACE_EVENT_P4 ("GSM 850: power class=%u %s,%s%s", | |
176 rr_data->ms_data.rf_cap.rf_power.pow_class4[IDX_PWRCLASS_850].pow_class, | |
177 (bands&0x10)?"rfcap":" ", | |
178 (stdbands&0x10)?"std":" ", | |
179 (setbands&0x10)?",supported":""); | |
180 TRACE_EVENT_P4 ("GSM 400: power class=%u %s,%s%s", | |
181 rr_data->ms_data.rf_cap.rf_power.pow_class4[IDX_PWRCLASS_400].pow_class, | |
182 (bands&0x60)?"rfcap":" ", | |
183 (stdbands&0x60)?"std":" ", | |
184 (setbands&0x60)?",supported":""); | |
185 TRACE_EVENT_P1 ("GPRS multislot class =%u", | |
186 rr_data->ms_data.rf_cap.rf_ms.gprs_ms_class); | |
187 } | |
188 #endif /* !NTRACE */ | |
189 | |
190 #if defined(_SIMULATION_) && !defined(NTRACE) | |
191 #define TRACE_STRUCT(struct_member) TRACE_EVENT_P1("0x%02x " #struct_member , *((unsigned int*)&struct_member)) | |
192 | |
193 LOCAL void rr_csf_trace_class1 (T_mob_class_1* cm1) | |
194 { | |
195 TRACE_STRUCT (cm1->rev_lev); | |
196 TRACE_STRUCT (cm1->es_ind); | |
197 TRACE_STRUCT (cm1->a5_1); | |
198 TRACE_STRUCT (cm1->rf_pow_cap); | |
199 } | |
200 | |
201 LOCAL void rr_csf_trace_class2 (T_mob_class_2* cm2) | |
202 { | |
203 TRACE_STRUCT (cm2->rev_lev); | |
204 TRACE_STRUCT (cm2->es_ind); | |
205 TRACE_STRUCT (cm2->a5_1); | |
206 TRACE_STRUCT (cm2->rf_pow_cap); | |
207 TRACE_STRUCT (cm2->ps); | |
208 TRACE_STRUCT (cm2->ss_screen); | |
209 TRACE_STRUCT (cm2->mt_pp_sms); | |
210 TRACE_STRUCT (cm2->vbs); | |
211 TRACE_STRUCT (cm2->vgcs); | |
212 TRACE_STRUCT (cm2->egsm); | |
213 TRACE_STRUCT (cm2->class3); | |
214 TRACE_STRUCT (cm2->lcsva); | |
215 TRACE_STRUCT (cm2->ucs2_treat); | |
216 TRACE_STRUCT (cm2->solsa); | |
217 TRACE_STRUCT (cm2->cmsp); | |
218 TRACE_STRUCT (cm2->a5_3); | |
219 TRACE_STRUCT (cm2->a5_2); | |
220 } | |
221 | |
222 LOCAL void rr_csf_trace_class3 (T_mob_class_3* cm3) | |
223 { | |
224 TRACE_STRUCT (cm3->mb_value); | |
225 TRACE_STRUCT (cm3->a5_7); | |
226 TRACE_STRUCT (cm3->a5_6); | |
227 TRACE_STRUCT (cm3->a5_5); | |
228 TRACE_STRUCT (cm3->a5_4); | |
229 if (cm3->v_radio_cap_2) | |
230 { | |
231 TRACE_STRUCT (cm3->radio_cap_2); | |
232 } | |
233 if (cm3->v_radio_cap_1) | |
234 { | |
235 TRACE_STRUCT (cm3->radio_cap_1); | |
236 } | |
237 if (cm3->v_rgsm_class) | |
238 { | |
239 TRACE_STRUCT (cm3->rgsm_class); | |
240 } | |
241 if (cm3->v_ms_class) | |
242 { | |
243 TRACE_STRUCT (cm3->ms_class); | |
244 } | |
245 | |
246 TRACE_STRUCT (cm3->ucs2_treat); | |
247 TRACE_STRUCT (cm3->ext_meas); | |
248 if (cm3->v_measurement) | |
249 { | |
250 TRACE_STRUCT (cm3->measurement); | |
251 } | |
252 if (cm3->v_pos_method) | |
253 { | |
254 TRACE_STRUCT (cm3->pos_method); | |
255 } | |
256 if (cm3->v_edge_ms_class) | |
257 { | |
258 TRACE_STRUCT (cm3->edge_ms_class); | |
259 } | |
260 if (cm3->v_egde_struct) | |
261 { | |
262 TRACE_STRUCT (cm3->egde_struct.mod); | |
263 if (cm3->egde_struct.v_egde_pow1) | |
264 { | |
265 TRACE_STRUCT (cm3->egde_struct.egde_pow1); | |
266 } | |
267 if (cm3->egde_struct.v_egde_pow2) | |
268 { | |
269 TRACE_STRUCT (cm3->egde_struct.egde_pow2); | |
270 } | |
271 } | |
272 #ifdef REL99 | |
273 if (cm3->v_gsm400_struct) | |
274 { | |
275 TRACE_STRUCT (cm3->gsm400_struct.gsm400_supp); | |
276 TRACE_STRUCT (cm3->gsm400_struct.gsm400_cap); | |
277 } | |
278 #endif | |
279 if (cm3->v_gsm850_cap) | |
280 { | |
281 TRACE_STRUCT (cm3->gsm850_cap); | |
282 } | |
283 if (cm3->v_pcs1900_cap) | |
284 { | |
285 TRACE_STRUCT (cm3->pcs1900_cap); | |
286 } | |
287 #ifdef REL99 | |
288 TRACE_STRUCT (cm3->umts_fdd); | |
289 TRACE_STRUCT (cm3->umts_tdd); | |
290 TRACE_STRUCT (cm3->cdma2000); | |
291 #endif | |
292 if (cm3->v_dtm_ms) | |
293 { | |
294 TRACE_STRUCT (cm3->dtm_ms.dtm_g_ms_class); | |
295 TRACE_STRUCT (cm3->dtm_ms.mac_support); | |
296 if (cm3->dtm_ms.v_dtm_e_ms_class) | |
297 { | |
298 TRACE_STRUCT (cm3->dtm_ms.dtm_e_ms_class); | |
299 } | |
300 } | |
301 if (cm3->v_single_band) | |
302 { | |
303 TRACE_STRUCT (cm3->single_band); | |
304 } | |
305 } | |
306 #endif /* _SIMULATION_ && !NTRACE */ | |
307 | |
308 /* | |
309 +--------------------------------------------------------------------+ | |
310 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
311 | STATE : code ROUTINE : rr_csf_ms_cap | | |
312 +--------------------------------------------------------------------+ | |
313 | |
314 PURPOSE : Read the mobile station capabilities from a non-volantile | |
315 memory into an internal data structure. | |
316 | |
317 */ | |
318 #if !defined(NTRACE) | |
319 #define RFCAP_TEST | |
320 #endif /* !NTRACE */ | |
321 | |
322 GLOBAL void rr_csf_ms_cap (void) | |
323 { | |
324 GET_INSTANCE_DATA; | |
325 drv_Return_Type pcm_ret; | |
326 UBYTE version; | |
327 | |
328 TRACE_FUNCTION ("rr_csf_ms_cap()"); | |
329 | |
330 pcm_ret = pcm_ReadFile ((UBYTE *)EF_MSCAP_ID, SIZE_EF_MSCAP, | |
331 (UBYTE *)&rr_data->mscap, &version); | |
332 if(pcm_ret NEQ PCM_OK ) | |
333 { | |
334 TRACE_ERROR( "MS RF capability (EF_MSCAP_ID) -> PCM read error" ); | |
335 } | |
336 #if defined(RFCAP_TEST) | |
337 else | |
338 { | |
339 TRACE_ARRAY ((UBYTE*)&rr_data->mscap, SIZE_EF_MSCAP, "EF_MSCAP_ID"); | |
340 } | |
341 #endif /* RFCAP_TEST */ | |
342 } | |
343 | |
344 | |
345 /* | |
346 +--------------------------------------------------------------------+ | |
347 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
348 | STATE : code ROUTINE : rr_csf_read_rf_cap | | |
349 +--------------------------------------------------------------------+ | |
350 | |
351 PURPOSE : Read the mobile station capabilities from a non-volantile | |
352 memory into an internal data structure. | |
353 | |
354 */ | |
355 GLOBAL void rr_csf_read_rfcap (void) | |
356 { | |
357 GET_INSTANCE_DATA; | |
358 #define FldSetEx(f,n,v) (f|=((((ULONG)f)&(~((ULONG)n##m)))|(((ULONG)v)<<n##s))) | |
359 | |
360 EF_RFCAP rfcap_stream; | |
361 BYTE ccd_ret; | |
362 UBYTE version; | |
363 #if !defined(_SIMULATION_) | |
364 unsigned int ffs_ret; | |
365 #else | |
366 drv_Return_Type pcm_ret; | |
367 #endif /* _TMS470 */ | |
368 UBYTE gprs_ms, cmsp; | |
369 | |
370 TRACE_FUNCTION ("rr_csf_read_rfcap()"); | |
371 | |
372 /* save configured GPRS multislot class */ | |
373 gprs_ms = rr_data->ms_data.rf_cap.rf_ms.gprs_ms_class; | |
374 /* save configured CMSP bit */ | |
375 cmsp = rr_data->ms_data.rf_cap.cmsp; | |
376 | |
377 #if !defined(_SIMULATION_) | |
378 ffs_ret = FFS_fread("/gsm/com/rfcap", (UBYTE *)&rfcap_stream, sizeof(EF_RFCAP)); | |
379 if (ffs_ret EQ sizeof(EF_RFCAP)) | |
380 version = TRUE; | |
381 else | |
382 version = FALSE; | |
383 #else | |
384 pcm_ret = pcm_ReadFile ((UBYTE *)EF_RFCAP_ID, SIZE_EF_RFCAP, | |
385 (UBYTE *)&rfcap_stream, &version); | |
386 if(pcm_ret EQ PCM_OK ) | |
387 version = TRUE; | |
388 else | |
389 version = FALSE; | |
390 #endif | |
391 #define RFCAP_DEFAULT /* G23M/RR-ENH-9401 */ | |
392 #if !defined(RFCAP_DEFAULT) | |
393 if (!version) | |
394 { | |
395 TRACE_ERROR ("MS RF capability (rfcap) -> FFS read error. Reset will follow ..."); | |
396 /* | |
397 * the following delay is made on the target for reasons highlighted with | |
398 * issue 7510: some customers do during their production the download of the | |
399 * configuration to the flash whilst the target ist running; another reason is | |
400 * that the target is not accessable (e.g. via PTCM) during resets; thus | |
401 * the delay is present to allow that writing of config data is not disturbed | |
402 * by the reset | |
403 */ | |
404 #if !defined(_SIMULATION_) | |
405 TRACE_ERROR ("... in some seconds; download config data to flash please!"); | |
406 vsi_t_sleep(VSI_CALLER DELAY_RESET_NO_CONFIG_DATA); | |
407 #endif | |
408 assert (FALSE); | |
409 } | |
410 #else /* !RFCAP_DEFAULT */ | |
411 if (!version) | |
412 { | |
413 /* Implements Measure#32: Row 150 */ | |
414 | |
415 /* error output via trace interface */ | |
416 TRACE_ERROR( "MS RF capability (RFCAP) -> FFS/PCM read error: use default values instead"); | |
417 | |
418 #ifdef TI_PS_CUSTOM_RFCAP_DEFAULT | |
419 /* Update with the Custom defined default RF capabilities */ | |
420 memcpy(&rfcap_stream, custom_rfcap_default, SIZE_EF_RFCAP); | |
421 TRACE_EVENT_P2("Using Custom RFCAP values: Set_bands=%d, Freq_bands=%d", rfcap_stream.setbands, rfcap_stream.bands); | |
422 #ifndef FF_L23_A5_3 | |
423 FldSetEx (rfcap_stream.encryption, rfCap_A5_3, NO); | |
424 #endif | |
425 #else | |
426 | |
427 memset (&rfcap_stream, 0, SIZE_EF_RFCAP); | |
428 | |
429 /* default frequency bands */ | |
430 rfcap_stream.setbands = BAND_AUTO; | |
431 rfcap_stream.bands = BAND_GSM_900|BAND_E_GSM|BAND_DCS_1800|BAND_PCS_1900|BAND_GSM_850; | |
432 | |
433 /* power classes */ | |
434 FldSetEx (rfcap_stream.power1, rfCap_900, POWER_CLASS_4); | |
435 FldSetEx (rfcap_stream.power1, rfCap_1800, POWER_CLASS_1); | |
436 FldSetEx (rfcap_stream.power2, rfCap_1900, POWER_CLASS_1); | |
437 FldSetEx (rfcap_stream.power2, rfCap_850, POWER_CLASS_4); | |
438 | |
439 /* multi slot classes */ | |
440 FldSetEx (rfcap_stream.msGPRS, rfCap_MSC, MSLOT_CLASS_10); | |
441 | |
442 /* classmark 2 capabilities */ | |
443 FldSetEx (rfcap_stream.capability1, rfCap_esind, YES); | |
444 FldSetEx (rfcap_stream.capability2, rfCap_vgcs, NOT_SUPPORTED); | |
445 FldSetEx (rfcap_stream.capability2, rfCap_vbs, NOT_SUPPORTED); | |
446 FldSetEx (rfcap_stream.capability1, rfCap_ppsms, SUPPORTED); | |
447 FldSetEx (rfcap_stream.capability2, rfCap_ssc, SS_SCREEN_PHASE_2); | |
448 FldSetEx (rfcap_stream.capability1, rfCap_ps, NOT_SUPPORTED); | |
449 FldSetEx (rfcap_stream.capability1, rfCap_cmsp, SUPPORTED); | |
450 FldSetEx (rfcap_stream.capability1, rfCap_solsa, NOT_SUPPORTED); | |
451 FldSetEx (rfcap_stream.capability2, rfCap_usc2, SUPPORTED); | |
452 FldSetEx (rfcap_stream.capability1, rfCap_lcsva, NOT_SUPPORTED); | |
453 | |
454 /* classmark 3 capabilities */ | |
455 FldSetEx (rfcap_stream.capability2, rfCap_extmeas, NOT_SUPPORTED); | |
456 FldSetEx (rfcap_stream.capability2, rfCap_meas, NO); | |
457 FldSetEx (rfcap_stream.switchmeasure, rfCap_smst, SM_1); | |
458 FldSetEx (rfcap_stream.switchmeasure, rfCap_smt, SM_1); | |
459 | |
460 /* encryption algorithm */ | |
461 /* | |
462 * note inverse logic for the A5/1 encryption algorithm between | |
463 * classmark 1 and 2 on the one hand and radio access capability | |
464 * on the other hand | |
465 */ | |
466 FldSetEx (rfcap_stream.encryption, rfCap_A5_1, YES); | |
467 FldSetEx (rfcap_stream.encryption, rfCap_A5_2, NO); | |
468 #ifdef FF_L23_A5_3 | |
469 FldSetEx (rfcap_stream.encryption, rfCap_A5_3, YES); | |
470 #else | |
471 FldSetEx (rfcap_stream.encryption, rfCap_A5_3, NO); | |
472 #endif | |
473 FldSetEx (rfcap_stream.encryption, rfCap_A5_4, NO); | |
474 FldSetEx (rfcap_stream.encryption, rfCap_A5_5, NO); | |
475 FldSetEx (rfcap_stream.encryption, rfCap_A5_6, NO); | |
476 FldSetEx (rfcap_stream.encryption, rfCap_A5_7, NO); | |
477 #endif /* TI_PS_CUSTOM_RFCAP_DEFAULT */ | |
478 } | |
479 #endif /* !RFCAP_DEFAULT */ | |
480 | |
481 /* E-GSM includes P-GSM */ | |
482 if (FldGet (rfcap_stream.bands, rf_EGSM)) | |
483 { | |
484 FldSetEx (rfcap_stream.bands, rf_900, SUPPORTED); | |
485 } | |
486 | |
487 #if defined(RFCAP_TEST) | |
488 TRACE_ARRAY ((UBYTE*)&rfcap_stream, SIZE_EF_RFCAP, "rfcap_stream"); | |
489 #endif /* RFCAP_TEST */ | |
490 | |
491 {/* decode stream into c struct */ | |
492 #define DECODE_TMP MS_RF_CAPABILITY | |
493 typedef struct | |
494 { | |
495 U32 dummy; /*< 0: 4> */ | |
496 T_sdu sdu; /*< 4: ? > Service Data Unit */ | |
497 } T_DECODE_TMP; | |
498 T_MS_RF_CAPABILITY *ms_rf_cap; | |
499 USHORT off; | |
500 PALLOC_SDU (encode, DECODE_TMP, (SIZE_EF_RFCAP + 1 ) * BITS_PER_BYTE); | |
501 MALLOC (ms_rf_cap, sizeof (T_MS_RF_CAPABILITY)); | |
502 | |
503 /* The dummy field is needed to make the structure compatible for * | |
504 * the CCD. We need to initialise it to keep LINT happy */ | |
505 encode->dummy = 0x00; | |
506 | |
507 off = (USHORT)(encode->sdu.o_buf / BITS_PER_BYTE); | |
508 memcpy ( &encode->sdu.buf[off+1], &rfcap_stream, SIZE_EF_RFCAP); | |
509 encode->sdu.buf[off] = MS_RF_CAPABILITY; | |
510 | |
511 memset (ms_rf_cap, 0, sizeof (T_MS_RF_CAPABILITY)); | |
512 ccd_ret = ccd_decodeMsg(CCDENT_RR_COM, DOWNLINK, | |
513 (T_MSGBUF *)&encode->sdu, (UBYTE *)ms_rf_cap, | |
514 0xFF); | |
515 rr_data->ms_data.rf_cap = ms_rf_cap->rf_cap; /* Struct copy */ | |
516 MFREE (ms_rf_cap); | |
517 PFREE (encode); | |
518 } | |
519 | |
520 /* restore configured GPRS multislot class */ | |
521 if (rr_data->ms_data.multislot_class_configured) | |
522 { | |
523 rr_data->ms_data.rf_cap.rf_ms.gprs_ms_class = gprs_ms; | |
524 TRACE_EVENT_P1 ("'gprs_ms_class' configured to a value of %d (overwrite of rfcap)", gprs_ms); | |
525 } | |
526 | |
527 /* restore configured CMSP bit */ | |
528 if (rr_data->ms_data.cmsp_configured) | |
529 { | |
530 rr_data->ms_data.rf_cap.cmsp = cmsp; | |
531 TRACE_EVENT_P1 ("'cmsp' configured to a value of %d (overwrite of rfcap)", cmsp); | |
532 } | |
533 | |
534 | |
535 | |
536 #if defined(RFCAP_TEST) | |
537 if (ccd_ret NEQ ccdOK) | |
538 { | |
539 /* | |
540 * CCD has detected an error | |
541 */ | |
542 UBYTE first_err; | |
543 USHORT parlist [6]; | |
544 /* Implements Measure#32: Row 152...165 */ | |
545 | |
546 TRACE_EVENT_P1 ("ccd_decodeMsg(): %02x", ccd_ret); | |
547 /* | |
548 * get the first error | |
549 */ | |
550 first_err = ccd_getFirstError (CCDENT_RR, parlist); | |
551 | |
552 /* | |
553 * Error Handling | |
554 */ | |
555 do | |
556 { | |
557 /* Implements Measure#32: Row 152...165 */ | |
558 switch (first_err) | |
559 { | |
560 case ERR_NO_MORE_ERROR: | |
561 TRACE_EVENT_P1("%u the end of the error list is reached", first_err); | |
562 break; | |
563 case ERR_INVALID_CALC: | |
564 TRACE_EVENT_P1("%u calculation of the element repeat value failed", first_err); | |
565 break; | |
566 case ERR_PATTERN_MISMATCH: | |
567 TRACE_EVENT_P1("%u a bit pattern was not expected", first_err); | |
568 break; | |
569 case ERR_COMPREH_REQUIRED: | |
570 TRACE_EVENT_P1("%u check for comprehension required failed", first_err); | |
571 break; | |
572 case ERR_IE_NOT_EXPECTED: | |
573 TRACE_EVENT_P1("%u an information element was not expected", first_err); | |
574 break; | |
575 case ERR_IE_SEQUENCE: | |
576 TRACE_EVENT_P1("%u wrong sequence of information elements", first_err); | |
577 break; | |
578 case ERR_MAX_IE_EXCEED: | |
579 TRACE_EVENT_P1("%u maximum amount of repeatable information elements has exceeded", first_err); | |
580 break; | |
581 case ERR_MAX_REPEAT: | |
582 TRACE_EVENT_P1("%u a repeatable element occurs too often in the message", first_err); | |
583 break; | |
584 case ERR_MAND_ELEM_MISS: | |
585 TRACE_EVENT_P1("%u a mandatory information element is missing", first_err); | |
586 break; | |
587 case ERR_INVALID_MID: | |
588 TRACE_EVENT_P1("%u the message ID is not correct", first_err); | |
589 break; | |
590 case ERR_INVALID_TYPE: | |
591 TRACE_EVENT_P1("%u the information element is not a spare padding", first_err); | |
592 break; | |
593 case ERR_EOC_TAG_MISSING: | |
594 TRACE_EVENT_P1("%u indefinite length is specified for the ASN.1-BER but the end tag is missing", first_err); | |
595 break; | |
596 case ERR_INTERNAL_ERROR: | |
597 TRACE_EVENT_P1("%u an internal CCD error occured ", first_err); | |
598 break; | |
599 default: | |
600 TRACE_EVENT_P1("%u unknown error", first_err); | |
601 break; | |
602 } | |
603 first_err = ccd_getNextError (CCDENT_RR, parlist); | |
604 }while (first_err); | |
605 | |
606 } | |
607 | |
608 #if 0 | |
609 if (ccd_ret < ccdError) | |
610 { | |
611 rr_csf_trace_power (); | |
612 } | |
613 #endif /* 0|1 */ | |
614 #endif /* RFCAP_TEST */ | |
615 } | |
616 | |
617 GLOBAL void rr_csf_get_freq_bands (UBYTE *pfreq_bands) | |
618 { | |
619 GET_INSTANCE_DATA; | |
620 T_rf_cap *rfc = &rr_data->ms_data.rf_cap; | |
621 | |
622 #if defined(_SIMULATION_) | |
623 rr_csf_check_rfcap (FALSE); | |
624 #endif /* _SIMULATION_ */ | |
625 | |
626 if (rfc->setbands EQ BAND_AUTO) | |
627 *pfreq_bands = rfc->bands; | |
628 else | |
629 *pfreq_bands = rfc->setbands & rfc->bands; | |
630 #if !defined(NTRACE) | |
631 rr_csf_trace_power (); | |
632 #endif /* !NTRACE */ | |
633 } | |
634 | |
635 /* | |
636 +--------------------------------------------------------------------+ | |
637 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
638 | STATE : code ROUTINE : rr_csf_get_classmark1 | | |
639 +--------------------------------------------------------------------+ | |
640 | |
641 PURPOSE : fills c structure of the mobile station classmark 1 | |
642 information element; returns 0 if OK. | |
643 | |
644 */ | |
645 /*lint -esym(765,rr_csf_get_classmark1) | used by MM*/ | |
646 /*lint -esym(714,rr_csf_get_classmark1) | used by MM */ | |
647 GLOBAL UBYTE rr_csf_get_classmark1 (T_mob_class_1 *mob_class_1) | |
648 { | |
649 GET_INSTANCE_DATA; | |
650 TRACE_FUNCTION ("rr_csf_get_classmark1()"); | |
651 | |
652 #if defined(_SIMULATION_) | |
653 rr_csf_check_rfcap (FALSE); | |
654 #endif /* _SIMULATION_ */ | |
655 | |
656 *mob_class_1 = rr_data->ms_data.classmark1; | |
657 | |
658 #if defined(_SIMULATION_) && !defined(NTRACE) | |
659 rr_csf_trace_class1 (mob_class_1); | |
660 #endif /* _SIMULATION_ && !NTRACE */ | |
661 return 0;/* no error */ | |
662 } | |
663 | |
664 /* | |
665 +--------------------------------------------------------------------+ | |
666 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
667 | STATE : code ROUTINE : rr_csf_get_classmark2 | | |
668 +--------------------------------------------------------------------+ | |
669 | |
670 PURPOSE : fills c structure of the mobile station classmark 2 | |
671 information element; returns 0 if OK. | |
672 | |
673 */ | |
674 /*lint -esym(765,rr_csf_get_classmark2) | used by CC,MM */ | |
675 /*lint -esym(714,rr_csf_get_classmark2) | used by CC,MM */ | |
676 GLOBAL UBYTE rr_csf_get_classmark2 (T_mob_class_2 *mob_class_2) | |
677 { | |
678 GET_INSTANCE_DATA; | |
679 TRACE_FUNCTION ("rr_csf_get_classmark2()"); | |
680 | |
681 #if defined(_SIMULATION_) | |
682 rr_csf_check_rfcap (FALSE); | |
683 #endif /* _SIMULATION_ */ | |
684 | |
685 *mob_class_2 = rr_data->ms_data.classmark2; | |
686 | |
687 #if defined(_SIMULATION_) && !defined(NTRACE) | |
688 rr_csf_trace_class2 (mob_class_2); | |
689 #endif /* _SIMULATION_ && !NTRACE */ | |
690 return 0;/* no error */ | |
691 } | |
692 | |
693 /* | |
694 +--------------------------------------------------------------------+ | |
695 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
696 | STATE : code ROUTINE : rr_csf_get_classmark3 | | |
697 +--------------------------------------------------------------------+ | |
698 | |
699 PURPOSE : fills c structure of the mobile station classmark 3 | |
700 information element; returns 0 if OK. | |
701 | |
702 */ | |
703 #if 0 | |
704 GLOBAL UBYTE rr_csf_get_classmark3 (T_mob_class_3 *mob_class_3) | |
705 { | |
706 TRACE_FUNCTION ("rr_csf_get_classmark3()"); | |
707 | |
708 #if defined(_SIMULATION_) | |
709 rr_csf_check_rfcap (FALSE); | |
710 #endif /* _SIMULATION_ */ | |
711 | |
712 *mob_class_3 = rr_data->ms_data.classmark3; | |
713 | |
714 #if defined(_SIMULATION_) && !defined(NTRACE) | |
715 rr_csf_trace_class3 (mob_class_3); | |
716 #endif /* _SIMULATION_ && !NTRACE */ | |
717 return 0;/* no error */ | |
718 } | |
719 #endif | |
720 | |
721 #ifdef GPRS | |
722 /* fills c structure of the mobile station radio access capability information element; returns 0 if OK */ | |
723 /*lint -esym(765,rr_csf_get_radio_access_capability) | used by GMM,GRR */ | |
724 /*lint -esym(714,rr_csf_get_radio_access_capability) | used by GMM,GRR */ | |
725 GLOBAL UBYTE rr_csf_get_radio_access_capability (T_ra_cap *ra_cap) | |
726 { | |
727 GET_INSTANCE_DATA; | |
728 TRACE_FUNCTION ("rr_csf_get_radio_access_capability()"); | |
729 | |
730 #if defined(_SIMULATION_) | |
731 rr_csf_check_rfcap (FALSE); | |
732 #endif /* _SIMULATION_ */ | |
733 | |
734 *ra_cap = rr_data->ms_data.ra_cap; | |
735 return 0; | |
736 } | |
737 #endif | |
738 | |
739 /* get pointer to mobile station RF capability c structure; returns NULL on error */ | |
740 /*lint -esym(765,rr_csf_get_rf_capability) | used by GRR */ | |
741 /*lint -esym(714,rr_csf_get_rf_capability) | used by GRR */ | |
742 GLOBAL T_rf_cap* rr_csf_get_rf_capability (void) | |
743 { | |
744 GET_INSTANCE_DATA; | |
745 #if defined(_SIMULATION_) | |
746 rr_csf_check_rfcap (FALSE); | |
747 #endif /* _SIMULATION_ */ | |
748 | |
749 return &rr_data->ms_data.rf_cap; | |
750 } | |
751 | |
752 GLOBAL void rr_csf_check_rfcap (UBYTE init) | |
753 { | |
754 GET_INSTANCE_DATA; | |
755 TRACE_FUNCTION ("rr_csf_check_rfcap()"); | |
756 | |
757 if (init OR (rr_data->ms_data.rf_cap.bands EQ 0)) | |
758 { | |
759 rr_csf_read_rfcap (); | |
760 rr_csf_fit_capability (); | |
761 } | |
762 } | |
763 | |
764 | |
765 #ifndef REL99 | |
766 | |
767 #define RAC_RELEASE97 | |
768 /* | |
769 +--------------------------------------------------------------------+ | |
770 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
771 | STATE : code ROUTINE : rr_csf_fit_capability | | |
772 +--------------------------------------------------------------------+ | |
773 | |
774 PURPOSE : fit classmark 2 and 3 and radio access capabilities | |
775 depend on the value of 'std' and the readed values of | |
776 /gsm/com/rfcap file according to R99 specifications | |
777 */ | |
778 | |
779 GLOBAL UBYTE rr_csf_fit_capability (void) | |
780 { | |
781 GET_INSTANCE_DATA; | |
782 USHORT serving_cell; | |
783 T_rf_cap *rfc = &rr_data->ms_data.rf_cap; | |
784 #ifdef GPRS | |
785 T_ra_cap *rac = &rr_data->ms_data.ra_cap; | |
786 #endif | |
787 T_mob_class_1 *cm1 = &rr_data->ms_data.classmark1; | |
788 T_mob_class_2 *cm2 = &rr_data->ms_data.classmark2; | |
789 T_mob_class_3 *cm3 = &rr_data->ms_data.classmark3; | |
790 | |
791 TRACE_FUNCTION ("rr_csf_fit_capability()"); | |
792 | |
793 if (rr_data->nc_data[SC_INDEX].bcch_status NEQ EMPTY) | |
794 serving_cell = rr_data->nc_data[SC_INDEX].arfcn; | |
795 else | |
796 serving_cell = (USHORT)-1; | |
797 | |
798 memset (cm2, 0, sizeof(T_mob_class_2)); | |
799 memset (cm3, 0, sizeof(T_mob_class_3)); | |
800 #ifdef GPRS | |
801 memset (rac, 0, sizeof(T_ra_cap)); | |
802 #endif | |
803 | |
804 cm1->rev_lev = cm2->rev_lev = REV_LEV_PHASE_2; /* PHASE_1 | PHASE_2 | R99_SUPPORT */ | |
805 #ifdef GPRS | |
806 #if !defined(RAC_RELEASE97) | |
807 rac->acc_cap.rev99 = REV_LEV_PHASE_1; /* PHASE_1 | RELEASE99 */ | |
808 #endif /* !RAC_RELEASE97 */ | |
809 #endif | |
810 cm1->es_ind = cm2->es_ind = rfc->es_ind; | |
811 cm2->ps = rfc->ps; | |
812 cm2->ss_screen = rfc->ss_screen; | |
813 cm2->mt_pp_sms = rfc->mt_pp_sms; | |
814 cm2->vbs = rfc->vbs; | |
815 cm2->vgcs = rfc->vgcs; | |
816 cm2->class3 = SUPPORTED; /* options indicated in classmark 3 */ | |
817 cm2->lcsva = rfc->lcsva; | |
818 cm2->ucs2_treat = cm3->ucs2_treat = rfc->ucs2_treat; | |
819 cm2->solsa = rfc->solsa; | |
820 cm2->cmsp = rfc->cmsp; | |
821 | |
822 /* | |
823 * note inverse logic for the A5/1 encryption algorithm between | |
824 * classmark 1 and 2 on the one hand and radio access capability | |
825 * on the other hand | |
826 */ | |
827 cm1->a5_1 = cm2->a5_1 = !rfc->a5_bits.a5_1; | |
828 cm2->a5_2 = rfc->a5_bits.a5_2; | |
829 cm2->a5_3 = rfc->a5_bits.a5_3; | |
830 | |
831 cm3->a5_4 = rfc->a5_bits.a5_4; | |
832 cm3->a5_5 = rfc->a5_bits.a5_5; | |
833 cm3->a5_6 = rfc->a5_bits.a5_6; | |
834 cm3->a5_7 = rfc->a5_bits.a5_7; | |
835 | |
836 #ifdef GPRS | |
837 rac->acc_cap.es_ind = rfc->es_ind; | |
838 rac->acc_cap.ps = rfc->ps; | |
839 rac->acc_cap.vbs = rfc->vbs; | |
840 rac->acc_cap.vgcs = rfc->vgcs; | |
841 rac->acc_cap.v_a5_bits = SUPPORTED; | |
842 rac->acc_cap.a5_bits = rfc->a5_bits; | |
843 #if !defined(RAC_RELEASE97) | |
844 rac->acc_cap.compact = rfc->compact; | |
845 #endif /* !RAC_RELEASE97 */ | |
846 | |
847 /* single- or multiband */ | |
848 rac->flag_ra_cap2 = rac->v_ra_cap2 = NO; | |
849 | |
850 #endif | |
851 | |
852 switch (std) | |
853 { | |
854 case STD_900: | |
855 cm3->mb_value = MB_GSM900; | |
856 #ifdef GPRS | |
857 rac->acc_tech_typ = ACC_GSM_P; | |
858 #endif | |
859 break; | |
860 case STD_EGSM: | |
861 cm2->egsm = SUPPORTED; | |
862 cm3->mb_value = MB_EGSM; | |
863 #ifdef GPRS | |
864 rac->acc_tech_typ = ACC_GSM_E; | |
865 #endif | |
866 break; | |
867 case STD_1800: | |
868 cm3->mb_value = MB_DCS1800; | |
869 #ifdef GPRS | |
870 rac->acc_tech_typ = ACC_GSM_1800; | |
871 #endif | |
872 break; | |
873 case STD_DUAL: | |
874 cm3->mb_value = MB_DUAL; | |
875 #ifdef GPRS | |
876 rac->acc_tech_typ = ACC_GSM_P; | |
877 rac->flag_ra_cap2 = rac->v_ra_cap2 = YES; | |
878 rac->ra_cap2.acc_tech_typ = ACC_GSM_1800; | |
879 rac->ra_cap2.acc_cap = rac->acc_cap; | |
880 rac->ra_cap2.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
881 rac->ra_cap2.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
882 #if !defined(RAC_RELEASE97) | |
883 rac->ra_cap2.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
884 #endif /* !RAC_RELEASE97 */ | |
885 #endif | |
886 break; | |
887 case STD_DUAL_EGSM: | |
888 /* note: incase of 1800 band, the FC bit shall be set to 0 */ | |
889 if((rr_data->ms_data.rr_service EQ FULL_SERVICE) AND | |
890 (!INRANGE(LOW_CHANNEL_1800,rr_data->nc_data[SC_INDEX].arfcn,HIGH_CHANNEL_1800))) | |
891 cm2->egsm = SUPPORTED; | |
892 cm3->mb_value = MB_DUAL_EXT; | |
893 #ifdef GPRS | |
894 rac->acc_tech_typ = ACC_GSM_E; | |
895 rac->flag_ra_cap2 = rac->v_ra_cap2 = YES; | |
896 rac->ra_cap2.acc_tech_typ = ACC_GSM_1800; | |
897 rac->ra_cap2.acc_cap = rac->acc_cap; | |
898 rac->ra_cap2.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
899 rac->ra_cap2.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
900 #if !defined(RAC_RELEASE97) | |
901 rac->ra_cap2.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
902 #endif /* !RAC_RELEASE97 */ | |
903 #endif | |
904 break; | |
905 | |
906 case STD_1900: | |
907 case STD_850: | |
908 case STD_DUAL_US: | |
909 /* no break; go through */ | |
910 default: | |
911 cm3->mb_value = MB_NO_EUROPEAN_BAND; | |
912 break; | |
913 } | |
914 | |
915 /* power classes */ | |
916 if (rfc->bands & 0x80) | |
917 { | |
918 TRACE_ERROR("R-GSM not supported by PS software"); | |
919 /* note: cm3->v_rgsm_class (and cm3->rgsm_class) are hard coded to 0 */ | |
920 } | |
921 if (rfc->bands & 0x60) | |
922 { | |
923 TRACE_ERROR("GSM 400 not supported by PS software"); | |
924 /* note: cm3->v_gsm400_struct (and cm3->gsm400_struct) are hard coded to 0 */ | |
925 } | |
926 switch (std) | |
927 { | |
928 case STD_900: | |
929 case STD_EGSM: | |
930 cm3->v_radio_cap_1 = TRUE; | |
931 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_900].pow_class; | |
932 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
933 #ifdef GPRS | |
934 rac->acc_cap.pow_class = cm3->radio_cap_1; | |
935 #endif | |
936 break; | |
937 | |
938 case STD_1800: | |
939 /* single band => only radio_cap_1 */ | |
940 cm3->v_radio_cap_1 = TRUE; | |
941 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class; | |
942 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
943 #ifdef GPRS | |
944 rac->acc_cap.pow_class = cm3->radio_cap_1; | |
945 #endif | |
946 break; | |
947 | |
948 case STD_DUAL: | |
949 case STD_DUAL_EGSM: | |
950 cm3->v_radio_cap_1 = TRUE; | |
951 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_900].pow_class; | |
952 cm3->v_radio_cap_2 = TRUE; | |
953 cm3->radio_cap_2 = rfc->rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class; | |
954 /* note: in case the sc is´nt set, it is out of range */ | |
955 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
956 cm2->rf_pow_cap = cm3->radio_cap_2 - 1; | |
957 else | |
958 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
959 #ifdef GPRS | |
960 rac->acc_cap.pow_class = cm3->radio_cap_1; | |
961 rac->ra_cap2.acc_cap.pow_class = cm3->radio_cap_2; | |
962 #endif | |
963 break; | |
964 | |
965 case STD_1900: | |
966 cm3->v_pcs1900_cap = SUPPORTED; | |
967 cm3->pcs1900_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_1900].pow_class; | |
968 cm2->rf_pow_cap = cm3->pcs1900_cap - 1; | |
969 #ifdef GPRS | |
970 rac->acc_tech_typ = ACC_GSM_1900; | |
971 rac->acc_cap.pow_class = cm3->pcs1900_cap; | |
972 #endif | |
973 break; | |
974 | |
975 case STD_850: | |
976 cm3->v_gsm850_cap = SUPPORTED; | |
977 cm3->gsm850_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_850].pow_class; | |
978 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
979 #ifdef GPRS | |
980 rac->acc_tech_typ = ACC_GSM_850; | |
981 rac->acc_cap.pow_class = cm3->gsm850_cap; | |
982 #endif | |
983 break; | |
984 | |
985 case STD_DUAL_US: | |
986 cm3->v_gsm850_cap = SUPPORTED; | |
987 cm3->gsm850_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_850].pow_class; | |
988 cm3->v_pcs1900_cap = SUPPORTED; | |
989 cm3->pcs1900_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_1900].pow_class; | |
990 /* note: in case the sc is´nt set, it is out of range */ | |
991 if (INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
992 cm2->rf_pow_cap = cm3->pcs1900_cap - 1; | |
993 else | |
994 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
995 #ifdef GPRS | |
996 rac->acc_tech_typ = ACC_GSM_850; | |
997 rac->acc_cap.pow_class = cm3->gsm850_cap; | |
998 rac->flag_ra_cap2 = rac->v_ra_cap2 = YES; | |
999 rac->ra_cap2.acc_tech_typ = ACC_GSM_1900; | |
1000 rac->ra_cap2.acc_cap = rac->acc_cap; | |
1001 rac->ra_cap2.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1002 rac->ra_cap2.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1003 #if !defined(RAC_RELEASE97) | |
1004 rac->ra_cap2.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1005 #endif /* !RAC_RELEASE97 */ | |
1006 rac->ra_cap2.acc_cap.pow_class = cm3->pcs1900_cap; | |
1007 #endif | |
1008 break; | |
1009 | |
1010 default: | |
1011 break; | |
1012 } | |
1013 cm1->rf_pow_cap = cm2->rf_pow_cap; | |
1014 | |
1015 #if defined(_SIMULATION_) && defined(RFCAP_TEST) | |
1016 rr_csf_trace_power (); | |
1017 #endif /* RFCAP_TEST*/ | |
1018 | |
1019 #if defined(FF_EGDE) | |
1020 if (rfc->mod OR rfc->rf_power.egde_pow1 OR rfc->rf_power.egde_pow2) | |
1021 { | |
1022 cm3->v_egde_struct = SUPPORTED; | |
1023 cm3->egde_struct.mod = rfc->mod; | |
1024 } | |
1025 switch (std) | |
1026 { | |
1027 case STD_900: | |
1028 case STD_EGSM: | |
1029 case STD_850: | |
1030 if (rfc->rf_power.egde_pow1) | |
1031 { | |
1032 if (rfc->mod) | |
1033 { | |
1034 cm3->egde_struct.v_egde_pow1 = SUPPORTED; | |
1035 cm3->egde_struct.egde_pow1 = rfc->rf_power.egde_pow1; | |
1036 } | |
1037 #ifdef GPRS | |
1038 rac->acc_cap.v_pow_8psk_cap = SUPPORTED; | |
1039 rac->acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow1; | |
1040 #endif | |
1041 } | |
1042 break; | |
1043 case STD_1800: | |
1044 case STD_1900: | |
1045 if (rfc->rf_power.egde_pow2) | |
1046 { | |
1047 if (rfc->mod) | |
1048 { | |
1049 cm3->egde_struct.v_egde_pow2 = SUPPORTED; | |
1050 cm3->egde_struct.egde_pow2 = rfc->rf_power.egde_pow2; | |
1051 } | |
1052 #ifdef GPRS | |
1053 rac->acc_cap.v_pow_8psk_cap = SUPPORTED; | |
1054 rac->acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow2; | |
1055 #endif | |
1056 } | |
1057 break; | |
1058 case STD_DUAL: | |
1059 case STD_DUAL_EGSM: | |
1060 case STD_DUAL_US: | |
1061 if (rfc->rf_power.egde_pow1) | |
1062 { | |
1063 if (rfc->mod) | |
1064 { | |
1065 cm3->egde_struct.v_egde_pow1 = SUPPORTED; | |
1066 cm3->egde_struct.egde_pow1 = rfc->rf_power.egde_pow1; | |
1067 } | |
1068 #ifdef GPRS | |
1069 rac->acc_cap.v_pow_8psk_cap = SUPPORTED; | |
1070 rac->acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow1; | |
1071 #endif | |
1072 } | |
1073 if (rfc->rf_power.egde_pow2) | |
1074 { | |
1075 if (rfc->mod) | |
1076 { | |
1077 cm3->egde_struct.v_egde_pow2 = SUPPORTED; | |
1078 cm3->egde_struct.egde_pow2 = rfc->rf_power.egde_pow2; | |
1079 } | |
1080 #ifdef GPRS | |
1081 rac->ra_cap2.acc_cap.v_pow_8psk_cap = SUPPORTED; | |
1082 rac->ra_cap2.acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow2; | |
1083 #endif | |
1084 } | |
1085 break; | |
1086 default: | |
1087 break; | |
1088 } | |
1089 #endif /* FF_EGDE */ | |
1090 | |
1091 /* multi slot capabilities */ | |
1092 if (rfc->rf_ms.gsm_ms_class) | |
1093 { | |
1094 cm3->v_ms_class = SUPPORTED; | |
1095 cm3->ms_class = rfc->rf_ms.gsm_ms_class; | |
1096 } | |
1097 #if defined(FF_EGDE) | |
1098 if (rfc->rf_ms.edge_ms_class) | |
1099 { | |
1100 cm3->v_edge_ms_class = SUPPORTED; | |
1101 cm3->edge_ms_class = rfc->rf_ms.edge_ms_class; | |
1102 } | |
1103 #endif /* FF_EGDE */ | |
1104 if (rfc->rf_ms.dtm_g) | |
1105 { | |
1106 #ifdef GPRS | |
1107 rac->acc_cap.v_ms_struct = SUPPORTED; | |
1108 #endif | |
1109 cm3->v_dtm_ms = SUPPORTED; | |
1110 cm3->dtm_ms.mac_support = rfc->mac_support; | |
1111 cm3->dtm_ms.dtm_g_ms_class = rfc->rf_ms.dtm_g_ms_class; | |
1112 #ifdef GPRS | |
1113 #if !defined(RAC_RELEASE97) | |
1114 rac->acc_cap.ms_struct.v_dtm_struct = SUPPORTED; | |
1115 rac->acc_cap.ms_struct.dtm_struct.dtm_g_ms_class = rfc->rf_ms.dtm_g_ms_class; | |
1116 rac->acc_cap.ms_struct.dtm_struct.mac_support = rfc->mac_support; | |
1117 #endif /* !RAC_RELEASE97 */ | |
1118 #endif | |
1119 | |
1120 #if defined(FF_EGDE) | |
1121 if (rfc->rf_ms.dtm_e) | |
1122 { | |
1123 cm3->dtm_ms.v_dtm_e_ms_class = SUPPORTED; | |
1124 cm3->dtm_ms.dtm_e_ms_class = rfc->rf_ms.dtm_e_ms_class; | |
1125 #ifdef GPRS | |
1126 #if !defined(RAC_RELEASE97) | |
1127 rac->acc_cap.ms_struct.v_dtm_struct = SUPPORTED; | |
1128 rac->acc_cap.ms_struct.dtm_struct.v_dtm_e_ms_class = SUPPORTED; | |
1129 rac->acc_cap.ms_struct.dtm_struct.dtm_e_ms_class = rfc->rf_ms.dtm_e_ms_class; | |
1130 #endif /* !RAC_RELEASE97 */ | |
1131 #endif | |
1132 } | |
1133 #endif /* FF_EGDE */ | |
1134 } | |
1135 | |
1136 #ifdef GPRS | |
1137 if (rfc->rf_ms.hscsd_ms_class) | |
1138 { | |
1139 rac->acc_cap.v_ms_struct = SUPPORTED; | |
1140 rac->acc_cap.ms_struct.v_hscsd_ms_class = SUPPORTED; | |
1141 rac->acc_cap.ms_struct.hscsd_ms_class = rfc->rf_ms.hscsd_ms_class; | |
1142 } | |
1143 | |
1144 | |
1145 if (rfc->rf_ms.gprs_ms_class) | |
1146 { | |
1147 rac->acc_cap.v_ms_struct = SUPPORTED; | |
1148 rac->acc_cap.ms_struct.v_gprs_struct = SUPPORTED; | |
1149 rac->acc_cap.ms_struct.gprs_struct.gprs_ms_class = rfc->rf_ms.gprs_ms_class; | |
1150 rac->acc_cap.ms_struct.gprs_struct.gprs_eda = rfc->gprs_eda; | |
1151 } | |
1152 | |
1153 #endif | |
1154 | |
1155 cm3->ext_meas = rfc->ext_meas; | |
1156 | |
1157 if (rfc->meas) | |
1158 { | |
1159 #ifdef GPRS | |
1160 rac->acc_cap.v_ms_struct = SUPPORTED; | |
1161 rac->acc_cap.ms_struct.v_sms_sm_value = SUPPORTED; | |
1162 rac->acc_cap.ms_struct.sms_sm_value.sms_val = rfc->sms_val; | |
1163 rac->acc_cap.ms_struct.sms_sm_value.sm_val = rfc->sm_val; | |
1164 #endif | |
1165 | |
1166 cm3->v_measurement = SUPPORTED; | |
1167 cm3->measurement.sms_val = rfc->sms_val; | |
1168 cm3->measurement.sm_val = rfc->sm_val; | |
1169 } | |
1170 | |
1171 #ifdef GPRS | |
1172 if (rfc->rf_ms.ecsd_ms_class) | |
1173 { | |
1174 rac->acc_cap.v_ms_struct = SUPPORTED; | |
1175 #if !defined(RAC_RELEASE97) | |
1176 rac->acc_cap.ms_struct.v_ecsd_ms_class = SUPPORTED; | |
1177 rac->acc_cap.ms_struct.ecsd_ms_class = rfc->rf_ms.ecsd_ms_class; | |
1178 #endif /* !RAC_RELEASE97 */ | |
1179 } | |
1180 #endif | |
1181 | |
1182 #ifdef GPRS | |
1183 if (rfc->rf_ms.egprs_ms_class) | |
1184 { | |
1185 rac->acc_cap.v_ms_struct = SUPPORTED; | |
1186 #if !defined(RAC_RELEASE97) | |
1187 rac->acc_cap.ms_struct.v_egprs_struct = SUPPORTED; | |
1188 rac->acc_cap.ms_struct.egprs_struct.egprs_ms_class = rfc->rf_ms.egprs_ms_class; | |
1189 rac->acc_cap.ms_struct.egprs_struct.egprs_eda = rfc->egprs_eda; | |
1190 #endif /* !RAC_RELEASE97 */ | |
1191 } | |
1192 | |
1193 if (rac->v_ra_cap2 AND rac->acc_cap.v_ms_struct) | |
1194 { | |
1195 #if !defined(RAC_RELEASE97) | |
1196 rac->ra_cap2.acc_cap.rev99 = PHASE_1; /* PHASE_1 | RELEASE99 */ | |
1197 rac->ra_cap2.acc_cap.compact = rfc->compact; | |
1198 #endif /* !RAC_RELEASE97 */ | |
1199 rac->ra_cap2.acc_cap.es_ind = rfc->es_ind; | |
1200 rac->ra_cap2.acc_cap.ps = rfc->ps; | |
1201 rac->ra_cap2.acc_cap.vbs = rfc->vbs; | |
1202 rac->ra_cap2.acc_cap.vgcs = rfc->vgcs; | |
1203 /* | |
1204 * zero means that the same value for multislot parameters as given | |
1205 * in an earlier access capabilities field within this IE apply | |
1206 * also here. | |
1207 */ | |
1208 rac->ra_cap2.acc_cap.v_ms_struct = FALSE; | |
1209 } | |
1210 #endif | |
1211 | |
1212 #if defined FF_EOTD | |
1213 if (rfc->assist_eotd OR rfc->based_eotd OR rfc->assist_gps OR rfc->based_gps OR rfc->conv_gps) | |
1214 #else | |
1215 if (rfc->assist_gps OR rfc->based_gps OR rfc->conv_gps) | |
1216 #endif /* FF_EOTD */ | |
1217 { | |
1218 cm3->v_pos_method = SUPPORTED; | |
1219 #if defined FF_EOTD | |
1220 cm3->pos_method.assist_eotd = rfc->assist_eotd; | |
1221 cm3->pos_method.based_eotd = rfc->based_eotd; | |
1222 #endif /* FF_EOTD */ | |
1223 cm3->pos_method.assist_gps = rfc->assist_gps; | |
1224 cm3->pos_method.based_gps = rfc->based_gps; | |
1225 cm3->pos_method.conv_gps = rfc->conv_gps; | |
1226 } | |
1227 | |
1228 #if defined TI_PS_FF_REL99_AND_ABOVE | |
1229 cm3->v_gsm700_cap = NOT_SUPPORTED; | |
1230 cm3->umts_tdd_128 = NOT_SUPPORTED; | |
1231 cm3->geran_feat_pack_1 = NOT_SUPPORTED; | |
1232 cm3->v_ext_dtm_ms = NOT_SUPPORTED; | |
1233 cm3->v_high_ms_cap = NOT_SUPPORTED; | |
1234 cm3->geran_iu_mod_cap = NOT_SUPPORTED; | |
1235 cm3->geran_feat_pack_2 = NOT_SUPPORTED; | |
1236 cm3->gmsk_ms_pwr_prof = MS_PWR_PROF0; | |
1237 cm3->psk8_ms_pwr_prof = MS_PWR_PROF0; | |
1238 cm3->v_t_gsm400_struct = NOT_SUPPORTED; | |
1239 cm3->v_t_gsm900_cap = NOT_SUPPORTED; | |
1240 #ifdef L1_SAIC | |
1241 /* To support SAIC release 6 feature */ | |
1242 cm3->dl_adv_rx_per = DL_ADVANC_RX_PERF_PHASE1_SUPPORT; | |
1243 #else | |
1244 cm3->dl_adv_rx_per = DL_ADVANC_RX_PERF_NOT_SUPPORT; | |
1245 #endif /* L1_SAIC */ | |
1246 cm3->dtm_enhance_cap = NOT_SUPPORTED; | |
1247 cm3->v_dtm_high_ms = NOT_SUPPORTED; | |
1248 #ifdef FF_REPEATED_SACCH | |
1249 cm3->rep_acch_cap = REP_SACCH_DL_FACCH; | |
1250 #else | |
1251 cm3->rep_acch_cap = REP_DL_FACCH; | |
1252 #endif /* FF_REPEATED_SACCH */ | |
1253 #endif /* TI_PS_FF_REL99_AND_ABOVE */ | |
1254 | |
1255 #if defined(_SIMULATION_) && !defined(NTRACE) | |
1256 rr_csf_trace_class1 (cm1); | |
1257 rr_csf_trace_class2 (cm2); | |
1258 rr_csf_trace_class3 (cm3); | |
1259 #endif /* _SIMULATION_ && !NTRACE */ | |
1260 /* | |
1261 * note: cm3->umts_fdd, cm3->umts_tdd, cm3->cdma2000, cm3->v_single_band and | |
1262 * cm3->single_band are hard coded to 0 due to the lack of information about | |
1263 * these features inside the T_rf_cap structure | |
1264 */ | |
1265 return 0; | |
1266 } | |
1267 | |
1268 #else /* Release 99 */ | |
1269 | |
1270 /* | |
1271 +--------------------------------------------------------------------+ | |
1272 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
1273 | STATE : code ROUTINE : rr_csf_fit_capability | | |
1274 +--------------------------------------------------------------------+ | |
1275 | |
1276 PURPOSE : fit classmark 2 and 3 and radio access capabilities | |
1277 depend on the value of 'std' and the readed values of | |
1278 /gsm/com/rfcap file according to R99 specifications | |
1279 | |
1280 */ | |
1281 | |
1282 GLOBAL UBYTE rr_csf_fit_capability (void) | |
1283 { | |
1284 GET_INSTANCE_DATA; | |
1285 USHORT serving_cell; | |
1286 T_rf_cap *rfc = &rr_data->ms_data.rf_cap; | |
1287 #ifdef GPRS | |
1288 T_ra_cap *rac = &rr_data->ms_data.ra_cap; | |
1289 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
1290 int i; | |
1291 #endif | |
1292 #endif | |
1293 T_mob_class_1 *cm1 = &rr_data->ms_data.classmark1; | |
1294 T_mob_class_2 *cm2 = &rr_data->ms_data.classmark2; | |
1295 T_mob_class_3 *cm3 = &rr_data->ms_data.classmark3; | |
1296 | |
1297 TRACE_FUNCTION ("rr_csf_fit_capability()"); | |
1298 | |
1299 if (rr_data->nc_data[SC_INDEX].bcch_status NEQ EMPTY) | |
1300 serving_cell = rr_data->nc_data[SC_INDEX].arfcn; | |
1301 else | |
1302 serving_cell = (USHORT)-1; | |
1303 | |
1304 memset (cm2, 0, sizeof(T_mob_class_2)); | |
1305 memset (cm3, 0, sizeof(T_mob_class_3)); | |
1306 #ifdef GPRS | |
1307 memset (rac, 0, sizeof(T_ra_cap)); | |
1308 #endif | |
1309 | |
1310 | |
1311 /* Set clasmark 1 fields */ | |
1312 cm1->rev_lev = REV_LEV_R99_SUPPORT; /* R99 mobile */ | |
1313 cm1->es_ind = rfc->es_ind; | |
1314 cm1->a5_1 = !rfc->a5_bits.a5_1; | |
1315 | |
1316 | |
1317 /* Set classmark 2 fields */ | |
1318 cm2->rev_lev = REV_LEV_R99_SUPPORT; | |
1319 cm2->es_ind = rfc->es_ind; | |
1320 cm2->ps = rfc->ps; | |
1321 cm2->ss_screen = rfc->ss_screen; | |
1322 cm2->mt_pp_sms = rfc->mt_pp_sms; | |
1323 cm2->vbs = rfc->vbs; | |
1324 cm2->vgcs = rfc->vgcs; | |
1325 cm2->class3 = SUPPORTED; | |
1326 cm2->lcsva = rfc->lcsva; | |
1327 cm2->ucs2_treat = rfc->ucs2_treat; | |
1328 cm2->solsa = rfc->solsa; | |
1329 cm2->cmsp = rfc->cmsp; | |
1330 cm2->a5_1 = !rfc->a5_bits.a5_1; | |
1331 cm2->a5_2 = rfc->a5_bits.a5_2; | |
1332 cm2->a5_3 = rfc->a5_bits.a5_3; | |
1333 | |
1334 | |
1335 /* Set classmark 3 fields */ | |
1336 cm3->a5_4 = rfc->a5_bits.a5_4; | |
1337 cm3->a5_5 = rfc->a5_bits.a5_5; | |
1338 cm3->a5_6 = rfc->a5_bits.a5_6; | |
1339 cm3->a5_7 = rfc->a5_bits.a5_7; | |
1340 cm3->ucs2_treat = rfc->ucs2_treat; | |
1341 cm3->ext_meas = rfc->ext_meas; | |
1342 | |
1343 /* Set multi slot capabilities */ | |
1344 if (rfc->rf_ms.gsm_ms_class) | |
1345 { | |
1346 cm3->v_ms_class = SUPPORTED; | |
1347 cm3->ms_class = rfc->rf_ms.gsm_ms_class; | |
1348 } | |
1349 | |
1350 /* Set MS measurement capability */ | |
1351 if (rfc->meas) | |
1352 { | |
1353 cm3->v_measurement = SUPPORTED; | |
1354 cm3->measurement.sms_val = rfc->sms_val; | |
1355 cm3->measurement.sm_val = rfc->sm_val; | |
1356 } | |
1357 | |
1358 /* Set MS positioning method */ | |
1359 #if defined FF_EOTD | |
1360 if (rfc->assist_eotd OR rfc->based_eotd OR rfc->assist_gps OR rfc->based_gps OR rfc->conv_gps) | |
1361 #else | |
1362 if (rfc->assist_gps OR rfc->based_gps OR rfc->conv_gps) | |
1363 #endif /* FF_EOTD */ | |
1364 { | |
1365 cm3->v_pos_method = SUPPORTED; | |
1366 #if defined FF_EOTD | |
1367 cm3->pos_method.assist_eotd = rfc->assist_eotd; | |
1368 cm3->pos_method.based_eotd = rfc->based_eotd; | |
1369 #endif /* FF_EOTD */ | |
1370 cm3->pos_method.assist_gps = rfc->assist_gps; | |
1371 cm3->pos_method.based_gps = rfc->based_gps; | |
1372 cm3->pos_method.conv_gps = rfc->conv_gps; | |
1373 } | |
1374 | |
1375 | |
1376 #ifdef GPRS | |
1377 /* Set Radio Access Capability info */ | |
1378 rac->ra_cap_values.v_acc_cap = YES; | |
1379 rac->ra_cap_values.acc_cap.v_a5_bits = SUPPORTED; | |
1380 | |
1381 rac->ra_cap_values.acc_cap.rev99 = RELEASE99; | |
1382 rac->ra_cap_values.acc_cap.es_ind = rfc->es_ind; | |
1383 rac->ra_cap_values.acc_cap.ps = rfc->ps; | |
1384 rac->ra_cap_values.acc_cap.vbs = rfc->vbs; | |
1385 rac->ra_cap_values.acc_cap.vgcs = rfc->vgcs; | |
1386 rac->ra_cap_values.acc_cap.a5_bits = rfc->a5_bits; | |
1387 rac->ra_cap_values.acc_cap.compact = rfc->compact; | |
1388 | |
1389 rac->ra_cap_values.acc_cap.v_ms_struct = SUPPORTED; | |
1390 rac->ra_cap_values.acc_cap.ms_struct.v_ecsd_ms_class = NOT_SUPPORTED;/*CR 637 */ | |
1391 rac->ra_cap_values.acc_cap.ms_struct.v_hscsd_ms_class = NOT_SUPPORTED;/*CR 637 */ | |
1392 rac->ra_cap_values.acc_cap.ms_struct.v_sms_sm_value = NOT_SUPPORTED;/*CR 637 */ | |
1393 | |
1394 rac->c_ra_cap_r = NO; | |
1395 rac->v_ra_cap_r = NO; | |
1396 | |
1397 #endif | |
1398 | |
1399 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
1400 /* Set the MS multiband capabilities */ | |
1401 switch (std) | |
1402 { | |
1403 case STD_900: | |
1404 cm3->mb_value = MB_GSM900; | |
1405 #ifdef GPRS | |
1406 rac->ra_cap_values.acc_tech_typ = ACC_GSM_P; | |
1407 #endif | |
1408 break; | |
1409 case STD_EGSM: | |
1410 cm2->egsm = SUPPORTED; | |
1411 #ifdef GPRS | |
1412 rac->ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1413 #endif | |
1414 /* No break */ | |
1415 case STD_900_1900: | |
1416 case STD_850_900_1900: | |
1417 cm3->mb_value = MB_EGSM; | |
1418 if ((!INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
1419 AND (!INRANGE(LOW_CHANNEL_850,serving_cell,HIGH_CHANNEL_850))) | |
1420 { | |
1421 cm2->egsm = SUPPORTED; | |
1422 } | |
1423 break; | |
1424 case STD_1800: | |
1425 #ifdef GPRS | |
1426 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1427 #endif | |
1428 /* NO break */ | |
1429 case STD_850_1800: | |
1430 cm3->mb_value = MB_DCS1800; | |
1431 break; | |
1432 case STD_DUAL: | |
1433 cm3->mb_value = MB_DUAL; | |
1434 #ifdef GPRS | |
1435 rac->v_ra_cap_r = YES; | |
1436 rac->c_ra_cap_r++; | |
1437 rac->ra_cap_r[0].ra_cap_values.v_acc_cap = YES; | |
1438 | |
1439 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1440 { | |
1441 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1442 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_P; | |
1443 } | |
1444 else | |
1445 { | |
1446 rac->ra_cap_values.acc_tech_typ = ACC_GSM_P; | |
1447 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1448 } | |
1449 | |
1450 rac->ra_cap_r[0].ra_cap_values.acc_cap = rac->ra_cap_values.acc_cap; | |
1451 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1452 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1453 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1454 #endif | |
1455 break; | |
1456 case STD_DUAL_EGSM: | |
1457 case STD_850_900_1800: | |
1458 /* note: incase of 1800 band, the FC bit shall be set to 0 */ | |
1459 if((!INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1460 AND (!INRANGE(LOW_CHANNEL_850,serving_cell,HIGH_CHANNEL_850))) | |
1461 cm2->egsm = SUPPORTED; | |
1462 cm3->mb_value = MB_DUAL_EXT; | |
1463 | |
1464 #ifdef GPRS | |
1465 rac->v_ra_cap_r = YES; | |
1466 rac->c_ra_cap_r++; | |
1467 rac->ra_cap_r[0].ra_cap_values.v_acc_cap = YES; | |
1468 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1469 { | |
1470 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1471 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1472 } | |
1473 else | |
1474 { | |
1475 if(INRANGE(LOW_CHANNEL_850,serving_cell,HIGH_CHANNEL_850)) | |
1476 { | |
1477 rac->ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1478 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1479 } | |
1480 else | |
1481 { | |
1482 rac->ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1483 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1484 } | |
1485 } | |
1486 | |
1487 rac->ra_cap_r[0].ra_cap_values.acc_cap = rac->ra_cap_values.acc_cap; | |
1488 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1489 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1490 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1491 #endif | |
1492 break; | |
1493 | |
1494 case STD_1900: | |
1495 case STD_850: | |
1496 case STD_DUAL_US: | |
1497 /* no break; go through */ | |
1498 default: | |
1499 cm3->mb_value = MB_NO_EUROPEAN_BAND; | |
1500 break; | |
1501 } | |
1502 #else | |
1503 /* Set the MS multiband capabilities */ | |
1504 switch (std) | |
1505 { | |
1506 case STD_900: | |
1507 cm3->mb_value = MB_GSM900; | |
1508 #ifdef GPRS | |
1509 rac->ra_cap_values.acc_tech_typ = ACC_GSM_P; | |
1510 #endif | |
1511 break; | |
1512 case STD_EGSM: | |
1513 cm2->egsm = SUPPORTED; | |
1514 cm3->mb_value = MB_EGSM; | |
1515 #ifdef GPRS | |
1516 rac->ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1517 #endif | |
1518 break; | |
1519 case STD_1800: | |
1520 cm3->mb_value = MB_DCS1800; | |
1521 #ifdef GPRS | |
1522 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1523 #endif | |
1524 break; | |
1525 case STD_DUAL: | |
1526 cm3->mb_value = MB_DUAL; | |
1527 #ifdef GPRS | |
1528 rac->v_ra_cap_r = YES; | |
1529 rac->c_ra_cap_r++; | |
1530 rac->ra_cap_r[0].ra_cap_values.v_acc_cap = YES; | |
1531 | |
1532 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1533 { | |
1534 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1535 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_P; | |
1536 } | |
1537 else | |
1538 { | |
1539 rac->ra_cap_values.acc_tech_typ = ACC_GSM_P; | |
1540 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1541 } | |
1542 | |
1543 rac->ra_cap_r[0].ra_cap_values.acc_cap = rac->ra_cap_values.acc_cap; | |
1544 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1545 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1546 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1547 #endif | |
1548 break; | |
1549 case STD_DUAL_EGSM: | |
1550 /* note: incase of 1800 band, the FC bit shall be set to 0 */ | |
1551 if(!INRANGE(LOW_CHANNEL_1800,rr_data->nc_data[SC_INDEX].arfcn,HIGH_CHANNEL_1800)) | |
1552 cm2->egsm = SUPPORTED; | |
1553 cm3->mb_value = MB_DUAL_EXT; | |
1554 | |
1555 #ifdef GPRS | |
1556 rac->v_ra_cap_r = YES; | |
1557 rac->c_ra_cap_r++; | |
1558 rac->ra_cap_r[0].ra_cap_values.v_acc_cap = YES; | |
1559 | |
1560 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1561 { | |
1562 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1563 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1564 } | |
1565 else | |
1566 { | |
1567 rac->ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1568 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1569 } | |
1570 | |
1571 rac->ra_cap_r[0].ra_cap_values.acc_cap = rac->ra_cap_values.acc_cap; | |
1572 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1573 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1574 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1575 #endif | |
1576 break; | |
1577 | |
1578 case STD_1900: | |
1579 case STD_850: | |
1580 case STD_DUAL_US: | |
1581 /* no break; go through */ | |
1582 default: | |
1583 cm3->mb_value = MB_NO_EUROPEAN_BAND; | |
1584 break; | |
1585 } | |
1586 #endif | |
1587 | |
1588 /* Set MS power classes info */ | |
1589 if (rfc->bands & 0x80) | |
1590 { | |
1591 TRACE_ERROR("R-GSM not supported by PS software"); | |
1592 /* note: cm3->v_rgsm_class (and cm3->rgsm_class) are hard coded to 0 */ | |
1593 } | |
1594 if (rfc->bands & 0x60) | |
1595 { | |
1596 TRACE_ERROR("GSM 400 not supported by PS software"); | |
1597 /* note: cm3->v_gsm400_struct (and cm3->gsm400_struct) are hard coded to 0 */ | |
1598 } | |
1599 | |
1600 switch (std) | |
1601 { | |
1602 case STD_900: | |
1603 case STD_EGSM: | |
1604 cm3->v_radio_cap_1 = TRUE; | |
1605 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_900].pow_class; | |
1606 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
1607 #ifdef GPRS | |
1608 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1609 #endif | |
1610 break; | |
1611 | |
1612 case STD_1800: | |
1613 /* single band => only radio_cap_1 */ | |
1614 cm3->v_radio_cap_1 = TRUE; | |
1615 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class; | |
1616 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
1617 #ifdef GPRS | |
1618 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1619 #endif | |
1620 break; | |
1621 | |
1622 case STD_DUAL: | |
1623 case STD_DUAL_EGSM: | |
1624 cm3->v_radio_cap_1 = TRUE; | |
1625 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_900].pow_class; | |
1626 cm3->v_radio_cap_2 = TRUE; | |
1627 cm3->radio_cap_2 = rfc->rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class; | |
1628 /* note: in case the sc is´nt set, it is out of range */ | |
1629 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1630 cm2->rf_pow_cap = cm3->radio_cap_2 - 1; | |
1631 else | |
1632 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
1633 #ifdef GPRS | |
1634 if (rac->ra_cap_values.acc_tech_typ EQ ACC_GSM_1800) | |
1635 { | |
1636 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_2; | |
1637 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1638 } | |
1639 else | |
1640 { | |
1641 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1642 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->radio_cap_2; | |
1643 } | |
1644 #endif | |
1645 break; | |
1646 | |
1647 case STD_1900: | |
1648 cm3->v_pcs1900_cap = SUPPORTED; | |
1649 cm3->pcs1900_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_1900].pow_class; | |
1650 cm2->rf_pow_cap = cm3->pcs1900_cap - 1; | |
1651 #ifdef GPRS | |
1652 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1653 rac->ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1654 #endif | |
1655 break; | |
1656 | |
1657 case STD_850: | |
1658 cm3->v_gsm850_cap = SUPPORTED; | |
1659 cm3->gsm850_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_850].pow_class; | |
1660 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
1661 #ifdef GPRS | |
1662 rac->ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1663 rac->ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1664 #endif | |
1665 break; | |
1666 | |
1667 case STD_DUAL_US: | |
1668 cm3->v_gsm850_cap = SUPPORTED; | |
1669 cm3->gsm850_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_850].pow_class; | |
1670 cm3->v_pcs1900_cap = SUPPORTED; | |
1671 cm3->pcs1900_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_1900].pow_class; | |
1672 | |
1673 /* note: in case the sc is´nt set, it is out of range */ | |
1674 if (INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
1675 cm2->rf_pow_cap = cm3->pcs1900_cap - 1; | |
1676 else | |
1677 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
1678 | |
1679 #ifdef GPRS | |
1680 if (INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
1681 { | |
1682 cm2->rf_pow_cap = cm3->pcs1900_cap - 1; | |
1683 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1684 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1685 rac->ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1686 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1687 } | |
1688 else | |
1689 { | |
1690 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
1691 rac->ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1692 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1693 rac->ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1694 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1695 } | |
1696 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1697 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1698 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1699 #endif | |
1700 break; | |
1701 | |
1702 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
1703 case STD_900_1900: | |
1704 cm3->v_radio_cap_1 = TRUE; | |
1705 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_900].pow_class; | |
1706 cm3->v_pcs1900_cap = SUPPORTED; | |
1707 cm3->pcs1900_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_1900].pow_class; | |
1708 if (INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
1709 cm2->rf_pow_cap = cm3->pcs1900_cap - 1; | |
1710 else | |
1711 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
1712 #ifdef GPRS | |
1713 if (INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
1714 { | |
1715 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1716 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1717 rac->ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1718 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1719 } | |
1720 else | |
1721 { | |
1722 rac->ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1723 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1724 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1725 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1726 } | |
1727 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1728 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1729 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1730 #endif | |
1731 break; | |
1732 | |
1733 case STD_850_1800: | |
1734 cm3->v_radio_cap_1 = TRUE; | |
1735 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class; | |
1736 cm3->v_gsm850_cap = SUPPORTED; | |
1737 cm3->gsm850_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_850].pow_class; | |
1738 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1739 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
1740 else | |
1741 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
1742 #ifdef GPRS | |
1743 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1744 { | |
1745 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1746 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1747 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1748 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1749 } | |
1750 else | |
1751 { | |
1752 rac->ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1753 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1754 rac->ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1755 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1756 } | |
1757 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1758 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1759 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1760 #endif | |
1761 break; | |
1762 | |
1763 case STD_850_900_1900: | |
1764 cm3->v_gsm850_cap = SUPPORTED; | |
1765 cm3->gsm850_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_850].pow_class; | |
1766 cm3->v_pcs1900_cap = SUPPORTED; | |
1767 cm3->pcs1900_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_1900].pow_class; | |
1768 cm3->v_radio_cap_1 = TRUE; | |
1769 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_900].pow_class; | |
1770 /* note: in case the sc is´nt set, it is out of range */ | |
1771 if (INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
1772 cm2->rf_pow_cap = cm3->pcs1900_cap - 1; | |
1773 else if (INRANGE(LOW_CHANNEL_850,serving_cell,HIGH_CHANNEL_850)) | |
1774 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
1775 else | |
1776 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
1777 | |
1778 #ifdef GPRS | |
1779 if (INRANGE(LOW_CHANNEL_1900,serving_cell,HIGH_CHANNEL_1900)) | |
1780 { | |
1781 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1782 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1783 rac->ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1784 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1785 } | |
1786 else | |
1787 { | |
1788 if (INRANGE(LOW_CHANNEL_850,serving_cell,HIGH_CHANNEL_850)) | |
1789 { | |
1790 rac->ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1791 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1792 rac->ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1793 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1794 } | |
1795 else | |
1796 { | |
1797 rac->ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1798 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1900; | |
1799 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1800 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->pcs1900_cap; | |
1801 } | |
1802 } | |
1803 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1804 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1805 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1806 #endif | |
1807 break; | |
1808 case STD_850_900_1800: | |
1809 cm3->v_radio_cap_1 = TRUE; | |
1810 cm3->radio_cap_1 = rfc->rf_power.pow_class4[IDX_PWRCLASS_900].pow_class; | |
1811 cm3->v_radio_cap_2 = TRUE; | |
1812 cm3->radio_cap_2 = rfc->rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class; | |
1813 cm3->v_gsm850_cap = SUPPORTED; | |
1814 cm3->gsm850_cap = rfc->rf_power.pow_class4[IDX_PWRCLASS_850].pow_class; | |
1815 /* note: in case the sc is´nt set, it is out of range */ | |
1816 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1817 cm2->rf_pow_cap = cm3->radio_cap_2 - 1; | |
1818 else if (INRANGE(LOW_CHANNEL_850,serving_cell,HIGH_CHANNEL_850)) | |
1819 cm2->rf_pow_cap = cm3->gsm850_cap - 1; | |
1820 else | |
1821 cm2->rf_pow_cap = cm3->radio_cap_1 - 1; | |
1822 #ifdef GPRS | |
1823 if (INRANGE(LOW_CHANNEL_1800,serving_cell,HIGH_CHANNEL_1800)) | |
1824 { | |
1825 rac->ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1826 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1827 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_2; | |
1828 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1829 } | |
1830 else | |
1831 { | |
1832 if (INRANGE(LOW_CHANNEL_850,serving_cell,HIGH_CHANNEL_850)) | |
1833 { | |
1834 rac->ra_cap_values.acc_tech_typ = ACC_GSM_850; | |
1835 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1836 rac->ra_cap_values.acc_cap.pow_class = cm3->gsm850_cap; | |
1837 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->radio_cap_2; | |
1838 } | |
1839 else | |
1840 { | |
1841 rac->ra_cap_values.acc_tech_typ = ACC_GSM_E; | |
1842 rac->ra_cap_r[0].ra_cap_values.acc_tech_typ = ACC_GSM_1800; | |
1843 rac->ra_cap_values.acc_cap.pow_class = cm3->radio_cap_1; | |
1844 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_class = cm3->radio_cap_2; | |
1845 } | |
1846 } | |
1847 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_a5_bits = NOT_SUPPORTED; | |
1848 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = NOT_SUPPORTED; | |
1849 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1850 #endif | |
1851 break; | |
1852 #endif | |
1853 | |
1854 default: | |
1855 break; | |
1856 } | |
1857 | |
1858 cm1->rf_pow_cap = cm2->rf_pow_cap; | |
1859 | |
1860 #if defined(_SIMULATION_) && defined(RFCAP_TEST) | |
1861 rr_csf_trace_power (); | |
1862 #endif /* RFCAP_TEST*/ | |
1863 | |
1864 | |
1865 /*Set 8psk capability in uplink for EGPRS*/ | |
1866 #if defined(FF_EGPRS) | |
1867 | |
1868 /*Initialize with 8psk is not supported in uplink*/ | |
1869 cm3->v_egde_struct = NOT_SUPPORTED; | |
1870 rac->ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1871 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = NOT_SUPPORTED; | |
1872 | |
1873 switch (std) | |
1874 { | |
1875 case STD_900: | |
1876 case STD_EGSM: | |
1877 case STD_850: | |
1878 if (rfc->mod) | |
1879 { | |
1880 if (rfc->rf_power.egde_pow1) | |
1881 { | |
1882 cm3->v_egde_struct = TRUE; | |
1883 cm3->egde_struct.mod = SUPPORTED; | |
1884 cm3->egde_struct.v_egde_pow1 = TRUE; | |
1885 cm3->egde_struct.egde_pow1 = rfc->rf_power.egde_pow1; | |
1886 rac->ra_cap_values.acc_cap.v_pow_8psk_cap = TRUE; | |
1887 rac->ra_cap_values.acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow1; | |
1888 TRACE_EVENT_P1 ("1: 8PSK SUPPORTED (EGPRS) POWER CLASS E1 = %d",rac->ra_cap_values.acc_cap.pow_8psk_cap); | |
1889 } | |
1890 } | |
1891 break; | |
1892 case STD_1800: | |
1893 case STD_1900: | |
1894 if (rfc->mod) | |
1895 { | |
1896 if (rfc->rf_power.egde_pow2) | |
1897 { | |
1898 cm3->v_egde_struct = TRUE; | |
1899 cm3->egde_struct.mod = SUPPORTED; | |
1900 cm3->egde_struct.v_egde_pow2 = TRUE; | |
1901 cm3->egde_struct.egde_pow2 = rfc->rf_power.egde_pow2; | |
1902 rac->ra_cap_values.acc_cap.v_pow_8psk_cap = TRUE; | |
1903 rac->ra_cap_values.acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow2; | |
1904 TRACE_EVENT_P1 ("2: 8PSK SUPPORTED (EGPRS) POWER CLASS E2 = %d",rac->ra_cap_values.acc_cap.pow_8psk_cap); | |
1905 } | |
1906 } | |
1907 break; | |
1908 case STD_DUAL: | |
1909 case STD_DUAL_EGSM: | |
1910 case STD_DUAL_US: | |
1911 if ((rac->ra_cap_values.acc_tech_typ EQ ACC_GSM_1800) OR (rac->ra_cap_values.acc_tech_typ EQ ACC_GSM_1900)) | |
1912 { | |
1913 if (rfc->mod) | |
1914 { | |
1915 if (rfc->rf_power.egde_pow2) | |
1916 { | |
1917 /*8psk is supported in uplink in 1800/1900 BAND*/ | |
1918 cm3->v_egde_struct = TRUE; | |
1919 cm3->egde_struct.mod = SUPPORTED; | |
1920 cm3->egde_struct.v_egde_pow2 = TRUE; | |
1921 cm3->egde_struct.egde_pow2 = rfc->rf_power.egde_pow2; | |
1922 rac->ra_cap_values.acc_cap.v_pow_8psk_cap = TRUE; | |
1923 rac->ra_cap_values.acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow2; | |
1924 TRACE_EVENT_P1 ("3: 8PSK SUPPORTED (EGPRS) POWER CLASS E2 = %d",rac->ra_cap_values.acc_cap.pow_8psk_cap); | |
1925 } | |
1926 if (rfc->rf_power.egde_pow1) | |
1927 { | |
1928 /*Set 8psk capability for 850/900 BAND*/ | |
1929 cm3->v_egde_struct = TRUE; | |
1930 cm3->egde_struct.mod = SUPPORTED; | |
1931 cm3->egde_struct.v_egde_pow1 = TRUE; | |
1932 cm3->egde_struct.egde_pow1 = rfc->rf_power.egde_pow1; | |
1933 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = TRUE; | |
1934 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow1; | |
1935 TRACE_EVENT_P1 ("4: 8PSK SUPPORTED (EGPRS) POWER CLASS E1 = %d",rac->ra_cap_values.acc_cap.pow_8psk_cap); | |
1936 } | |
1937 } | |
1938 } | |
1939 else | |
1940 { | |
1941 if (rfc->mod) | |
1942 { | |
1943 if (rfc->rf_power.egde_pow1) | |
1944 { | |
1945 /*8psk is supported in uplink in 1800/1900*/ | |
1946 cm3->v_egde_struct = TRUE; | |
1947 cm3->egde_struct.mod = SUPPORTED; | |
1948 cm3->egde_struct.v_egde_pow1 = TRUE; | |
1949 cm3->egde_struct.egde_pow1 = rfc->rf_power.egde_pow1; | |
1950 rac->ra_cap_values.acc_cap.v_pow_8psk_cap = TRUE; | |
1951 rac->ra_cap_values.acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow1; | |
1952 TRACE_EVENT_P1 ("5: 8PSK SUPPORTED (EGPRS) POWER CLASS E1 = %d",rac->ra_cap_values.acc_cap.pow_8psk_cap); | |
1953 } | |
1954 if (rfc->rf_power.egde_pow2) | |
1955 { | |
1956 /*Set 8psk capability for 850/900*/ | |
1957 cm3->v_egde_struct = TRUE; | |
1958 cm3->egde_struct.mod = SUPPORTED; | |
1959 cm3->egde_struct.v_egde_pow2 = TRUE; | |
1960 cm3->egde_struct.egde_pow2 = rfc->rf_power.egde_pow2; | |
1961 rac->ra_cap_r[0].ra_cap_values.acc_cap.v_pow_8psk_cap = TRUE; | |
1962 rac->ra_cap_r[0].ra_cap_values.acc_cap.pow_8psk_cap = rfc->rf_power.egde_pow2; | |
1963 TRACE_EVENT_P1 ("6: 8PSK SUPPORTED (EGPRS) POWER CLASS E2 = %d",rac->ra_cap_values.acc_cap.pow_8psk_cap); | |
1964 } | |
1965 } | |
1966 } | |
1967 break; | |
1968 default: | |
1969 break; | |
1970 } | |
1971 #endif /* FF_EGPRS */ | |
1972 | |
1973 if (rfc->rf_ms.dtm_g) | |
1974 { | |
1975 cm3->v_dtm_ms = SUPPORTED; | |
1976 cm3->dtm_ms.mac_support = rfc->mac_support; | |
1977 cm3->dtm_ms.dtm_g_ms_class = rfc->rf_ms.dtm_g_ms_class; | |
1978 #ifdef GPRS | |
1979 rac->ra_cap_values.acc_cap.ms_struct.v_dtm_struct = SUPPORTED; | |
1980 rac->ra_cap_values.acc_cap.ms_struct.dtm_struct.dtm_g_ms_class = rfc->rf_ms.dtm_g_ms_class; | |
1981 rac->ra_cap_values.acc_cap.ms_struct.dtm_struct.mac_support = rfc->mac_support; | |
1982 #endif | |
1983 | |
1984 #if defined(FF_EGPRS) | |
1985 if (rfc->rf_ms.dtm_e) | |
1986 { | |
1987 cm3->dtm_ms.v_dtm_e_ms_class = SUPPORTED; | |
1988 cm3->dtm_ms.dtm_e_ms_class = rfc->rf_ms.dtm_e_ms_class; | |
1989 #ifdef GPRS | |
1990 rac->ra_cap_values.acc_cap.ms_struct.v_dtm_struct = SUPPORTED; | |
1991 rac->ra_cap_values.acc_cap.ms_struct.dtm_struct.v_dtm_e_ms_class = SUPPORTED; | |
1992 rac->ra_cap_values.acc_cap.ms_struct.dtm_struct.dtm_e_ms_class = rfc->rf_ms.dtm_e_ms_class; | |
1993 #endif | |
1994 } | |
1995 #endif /* FF_EGDE */ | |
1996 } | |
1997 | |
1998 #ifdef GPRS | |
1999 | |
2000 #if 0 /* CR 637 */ | |
2001 if (rfc->rf_ms.hscsd_ms_class) | |
2002 { | |
2003 rac->ra_cap_values.acc_cap.v_ms_struct = SUPPORTED; | |
2004 rac->ra_cap_values.acc_cap.ms_struct.v_hscsd_ms_class = SUPPORTED; | |
2005 rac->ra_cap_values.acc_cap.ms_struct.hscsd_ms_class = rfc->rf_ms.hscsd_ms_class; | |
2006 } | |
2007 #endif | |
2008 | |
2009 if (rfc->rf_ms.gprs_ms_class) | |
2010 { | |
2011 rac->ra_cap_values.acc_cap.ms_struct.v_gprs_struct = SUPPORTED; | |
2012 rac->ra_cap_values.acc_cap.ms_struct.gprs_struct.gprs_ms_class = rfc->rf_ms.gprs_ms_class; | |
2013 rac->ra_cap_values.acc_cap.ms_struct.gprs_struct.gprs_eda = rfc->gprs_eda; | |
2014 } | |
2015 | |
2016 | |
2017 if (rfc->meas) | |
2018 { | |
2019 rac->ra_cap_values.acc_cap.ms_struct.v_sms_sm_value = SUPPORTED; | |
2020 rac->ra_cap_values.acc_cap.ms_struct.sms_sm_value.sms_val = rfc->sms_val; | |
2021 rac->ra_cap_values.acc_cap.ms_struct.sms_sm_value.sm_val = rfc->sm_val; | |
2022 } | |
2023 | |
2024 #if 0 /* CR 637 */ | |
2025 if (rfc->rf_ms.ecsd_ms_class) | |
2026 { | |
2027 rac->ra_cap_values.acc_cap.v_ms_struct = SUPPORTED; | |
2028 rac->ra_cap_values.acc_cap.ms_struct.v_ecsd_ms_class = SUPPORTED; | |
2029 rac->ra_cap_values.acc_cap.ms_struct.ecsd_ms_class = rfc->rf_ms.ecsd_ms_class; | |
2030 } | |
2031 #endif | |
2032 | |
2033 #if defined(FF_EGPRS) | |
2034 if (rfc->rf_ms.egprs_ms_class) | |
2035 { | |
2036 cm3->v_edge_ms_class = TRUE; | |
2037 cm3->edge_ms_class = rfc->rf_ms.egprs_ms_class; | |
2038 rac->ra_cap_values.acc_cap.ms_struct.v_egprs_struct = TRUE; | |
2039 rac->ra_cap_values.acc_cap.ms_struct.egprs_struct.egprs_ms_class = rfc->rf_ms.egprs_ms_class; | |
2040 rac->ra_cap_values.acc_cap.ms_struct.egprs_struct.egprs_eda = rfc->egprs_eda; | |
2041 } | |
2042 #endif | |
2043 | |
2044 if ((rac->c_ra_cap_r > 0) AND rac->ra_cap_values.acc_cap.v_ms_struct) | |
2045 { | |
2046 rac->v_ra_cap_r = TRUE; | |
2047 rac->ra_cap_r[0].ra_cap_values.acc_cap.rev99 = RELEASE99; | |
2048 | |
2049 | |
2050 rac->ra_cap_r[0].ra_cap_values.acc_cap.compact = rfc->compact; | |
2051 rac->ra_cap_r[0].ra_cap_values.acc_cap.es_ind = rfc->es_ind; | |
2052 rac->ra_cap_r[0].ra_cap_values.acc_cap.ps = rfc->ps; | |
2053 rac->ra_cap_r[0].ra_cap_values.acc_cap.vbs = rfc->vbs; | |
2054 rac->ra_cap_r[0].ra_cap_values.acc_cap.vgcs = rfc->vgcs; | |
2055 | |
2056 #if defined(FF_EGPRS) | |
2057 if (rfc->rf_ms.egprs_ms_class) | |
2058 { | |
2059 rac->ra_cap_r[0].ra_cap_values.acc_cap.ms_struct.v_egprs_struct = TRUE; | |
2060 rac->ra_cap_r[0].ra_cap_values.acc_cap.ms_struct.egprs_struct.egprs_ms_class = rfc->rf_ms.egprs_ms_class; | |
2061 rac->ra_cap_r[0].ra_cap_values.acc_cap.ms_struct.egprs_struct.egprs_eda = rfc->egprs_eda; | |
2062 } | |
2063 #endif | |
2064 | |
2065 } | |
2066 #endif | |
2067 | |
2068 #if defined TI_PS_FF_REL99_AND_ABOVE | |
2069 /* To support SAIC release 6 feature */ | |
2070 cm3->v_gsm700_cap = NOT_SUPPORTED; | |
2071 cm3->umts_tdd_128 = NOT_SUPPORTED; | |
2072 cm3->geran_feat_pack_1 = NOT_SUPPORTED; | |
2073 cm3->v_ext_dtm_ms = NOT_SUPPORTED; | |
2074 cm3->v_high_ms_cap = NOT_SUPPORTED; | |
2075 cm3->geran_iu_mod_cap = NOT_SUPPORTED; | |
2076 cm3->geran_feat_pack_2 = NOT_SUPPORTED; | |
2077 cm3->gmsk_ms_pwr_prof = MS_PWR_PROF0; | |
2078 cm3->psk8_ms_pwr_prof = MS_PWR_PROF0; | |
2079 cm3->v_t_gsm400_struct = NOT_SUPPORTED; | |
2080 cm3->v_t_gsm900_cap = NOT_SUPPORTED; | |
2081 cm3->dtm_enhance_cap = NOT_SUPPORTED; | |
2082 cm3->v_dtm_high_ms = NOT_SUPPORTED; | |
2083 #ifdef L1_SAIC | |
2084 /* To support SAIC release 6 feature */ | |
2085 cm3->dl_adv_rx_per = DL_ADVANC_RX_PERF_PHASE1_SUPPORT; | |
2086 #else | |
2087 cm3->dl_adv_rx_per = DL_ADVANC_RX_PERF_NOT_SUPPORT; | |
2088 #endif /* L1_SAIC */ | |
2089 #ifdef FF_REPEATED_SACCH | |
2090 cm3->rep_acch_cap = REP_SACCH_DL_FACCH; | |
2091 #else | |
2092 cm3->rep_acch_cap = REP_DL_FACCH; | |
2093 #endif /* FF_REPEATED_SACCH */ | |
2094 #endif /* TI_PS_FF_REL99_AND_ABOVE */ | |
2095 | |
2096 #if defined(_SIMULATION_) && !defined(NTRACE) | |
2097 rr_csf_trace_class1 (cm1); | |
2098 rr_csf_trace_class2 (cm2); | |
2099 rr_csf_trace_class3 (cm3); | |
2100 #endif /* _SIMULATION_ && !NTRACE */ | |
2101 /* | |
2102 * note: cm3->umts_fdd, cm3->umts_tdd, cm3->cdma2000, cm3->v_single_band and | |
2103 * cm3->single_band are hard coded to 0 due to the lack of information about | |
2104 * these features inside the T_rf_cap structure | |
2105 */ | |
2106 return 0; | |
2107 } | |
2108 #endif | |
2109 | |
2110 /* | |
2111 +--------------------------------------------------------------------+ | |
2112 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2113 | STATE : code ROUTINE : RX_Enable | | |
2114 +--------------------------------------------------------------------+ | |
2115 | |
2116 PURPOSE : This function enables reporting of RX level. | |
2117 | |
2118 */ | |
2119 static T_VOID_FUNC rx_driver_entry = NULL; | |
2120 static UBYTE rx_act_value = 0; | |
2121 static UBYTE rx_act_qual = RX_QUAL_UNAVAILABLE; | |
2122 #ifdef FF_PS_RSSI | |
2123 static UBYTE rx_act_rxlev_access_min = RX_ACCE_UNAVAILABLE; | |
2124 #endif | |
2125 | |
2126 /*lint -esym(765,RX_Enable) | used by RX driver */ | |
2127 /*lint -esym(714,RX_Enable) | used by RX driver */ | |
2128 GLOBAL void RX_Enable (T_VOID_FUNC rx_indication) | |
2129 { | |
2130 /* | |
2131 * store callback function | |
2132 */ | |
2133 rx_driver_entry = rx_indication; | |
2134 } | |
2135 | |
2136 /* | |
2137 +--------------------------------------------------------------------+ | |
2138 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2139 | STATE : code ROUTINE : RX_SetValue | | |
2140 +--------------------------------------------------------------------+ | |
2141 | |
2142 PURPOSE : This function stores a new fieldstrength value and | |
2143 informs the RX driver if possible about a change. | |
2144 | |
2145 */ | |
2146 | |
2147 /* | |
2148 * for reduce number of indications during dedicated mode | |
2149 */ | |
2150 static UBYTE rssi_dedi_counter = 0; | |
2151 | |
2152 /* | |
2153 * Minimum RSSI difference for indication to MMI | |
2154 */ | |
2155 #define RSSI_MIN_DIFFERENCE 5 | |
2156 #define RSSI_MIN_LEVEL 10 | |
2157 | |
2158 | |
2159 #ifdef FF_PS_RSSI | |
2160 GLOBAL void RX_SetValue (UBYTE new_value, UBYTE new_qual, UBYTE new_access) | |
2161 #else | |
2162 GLOBAL void RX_SetValue (UBYTE new_value) | |
2163 #endif | |
2164 { | |
2165 GET_INSTANCE_DATA; | |
2166 UBYTE rssi_delta; | |
2167 | |
2168 #ifdef FF_PS_RSSI | |
2169 rx_act_rxlev_access_min = new_access; | |
2170 #endif | |
2171 | |
2172 if (rx_driver_entry EQ NULL) | |
2173 { | |
2174 rx_act_value = new_value; | |
2175 #ifdef FF_PS_RSSI | |
2176 rx_act_qual = new_qual; | |
2177 #endif | |
2178 } | |
2179 else /*if a callback is installed*/ | |
2180 { | |
2181 | |
2182 /* | |
2183 * Compute delta compared to last MMI value | |
2184 */ | |
2185 rssi_delta = ( new_value >= rx_act_value ? | |
2186 ( new_value - rx_act_value ) : | |
2187 ( rx_act_value - new_value ) | |
2188 ); | |
2189 /* | |
2190 * if difference greather than defined threshold | |
2191 * rx_qual is available in dedicated state only | |
2192 * Change in RX_QUAL | |
2193 */ | |
2194 if ((rssi_delta >= RSSI_MIN_DIFFERENCE) OR (new_value < RSSI_MIN_LEVEL) | |
2195 #ifdef FF_PS_RSSI | |
2196 OR (new_qual NEQ rx_act_qual) | |
2197 #endif | |
2198 ) | |
2199 { | |
2200 | |
2201 if ( GET_STATE (STATE_ATT) NEQ ATT_DEDICATED ) | |
2202 { | |
2203 rx_act_value = new_value; | |
2204 #ifdef FF_PS_RSSI | |
2205 rx_act_qual = new_qual; | |
2206 #endif | |
2207 (*rx_driver_entry)(); | |
2208 } | |
2209 else | |
2210 { | |
2211 /* | |
2212 * in dedicated mode take only each 16 the attempt | |
2213 * equal 8 seconds | |
2214 */ | |
2215 if (!((rssi_dedi_counter ++ ) & 0x0F )) | |
2216 { | |
2217 /* | |
2218 * New RSSI to be forwarded | |
2219 */ | |
2220 rx_act_value = new_value; | |
2221 #ifdef FF_PS_RSSI | |
2222 rx_act_qual = new_qual; | |
2223 #endif | |
2224 (*rx_driver_entry)(); | |
2225 } | |
2226 } | |
2227 } | |
2228 } | |
2229 } | |
2230 | |
2231 /* | |
2232 +--------------------------------------------------------------------+ | |
2233 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2234 | STATE : code ROUTINE : RX_GetValue | | |
2235 +--------------------------------------------------------------------+ | |
2236 | |
2237 PURPOSE : This function simulates a low level driver call to get | |
2238 the actual fieldstrength. | |
2239 | |
2240 */ | |
2241 /*lint -esym(765,RX_GetValue) | used by RX driver */ | |
2242 /*lint -esym(714,RX_GetValue) | used by RX driver */ | |
2243 GLOBAL USHORT RX_GetValue (void) | |
2244 { | |
2245 USHORT rx_level; | |
2246 | |
2247 rx_level = (USHORT)rx_act_value; | |
2248 | |
2249 return rx_level; | |
2250 } | |
2251 | |
2252 #ifdef FF_PS_RSSI | |
2253 /* | |
2254 +--------------------------------------------------------------------+ | |
2255 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2256 | STATE : code ROUTINE : RX_GetRxLevAccessMin | | |
2257 +--------------------------------------------------------------------+ | |
2258 | |
2259 PURPOSE : This function simulates a low level driver call to get | |
2260 the minimum access level. | |
2261 | |
2262 */ | |
2263 GLOBAL UBYTE RX_GetRxLevAccessMin (void) | |
2264 { | |
2265 return rx_act_rxlev_access_min; | |
2266 } | |
2267 #endif | |
2268 | |
2269 /* | |
2270 +--------------------------------------------------------------------+ | |
2271 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2272 | STATE : code ROUTINE : RX_SetRxQual | | |
2273 +--------------------------------------------------------------------+ | |
2274 | |
2275 PURPOSE : This function simulates a low level driver call to set | |
2276 the actual RXQUAL value. | |
2277 | |
2278 */ | |
2279 /*lint -esym(765,RX_SetRxQual) | used by GRR */ | |
2280 /*lint -esym(714,RX_SetRxQual) | used by GRR */ | |
2281 GLOBAL void RX_SetRxQual (UBYTE new_rx_qual) | |
2282 { | |
2283 rx_act_qual = new_rx_qual; | |
2284 } | |
2285 | |
2286 /* | |
2287 +--------------------------------------------------------------------+ | |
2288 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2289 | STATE : code ROUTINE : RX_GetRxQual | | |
2290 +--------------------------------------------------------------------+ | |
2291 | |
2292 PURPOSE : This function simulates a low level driver call to get | |
2293 the actual RXQUAL value. | |
2294 | |
2295 */ | |
2296 /*lint -esym(765,RX_GetRxQual) | used by RX driver */ | |
2297 /*lint -esym(714,RX_GetRxQual) | used by RX driver */ | |
2298 GLOBAL UBYTE RX_GetRxQual (void) | |
2299 { | |
2300 return rx_act_qual; | |
2301 } | |
2302 | |
2303 /* | |
2304 +--------------------------------------------------------------------+ | |
2305 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2306 | STATE : code ROUTINE : rr_get_found_channels | | |
2307 +--------------------------------------------------------------------+ | |
2308 | |
2309 PURPOSE : This function is a little bit dirty solution to get | |
2310 the BCCH channel numbers of a PLMN available list. | |
2311 | |
2312 */ | |
2313 #if 0 | |
2314 GLOBAL USHORT * rr_get_found_channels (void) | |
2315 { | |
2316 static USHORT found_channels[MAX_PLMN]; | |
2317 int i; | |
2318 for (i=0; i<MAX_PLMN; i++) | |
2319 found_channels[i] = rr_data->sc_data.found[i].arfcn; | |
2320 return found_channels; | |
2321 } | |
2322 #endif | |
2323 /* | |
2324 +--------------------------------------------------------------------+ | |
2325 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2326 | STATE : code ROUTINE : rr_get_bcch_channel | | |
2327 +--------------------------------------------------------------------+ | |
2328 | |
2329 PURPOSE : This function is a little bit dirty solution to get | |
2330 the BCCH channel numbers of the current PLMN. | |
2331 | |
2332 */ | |
2333 #if 0 | |
2334 GLOBAL USHORT rr_get_bcch_channel (void) | |
2335 { | |
2336 return rr_data->nc_data[SC_INDEX].arfcn; | |
2337 } | |
2338 #endif | |
2339 | |
2340 /* | |
2341 * These functions (get_network_meas() & get_bcch_chan_list()) should only | |
2342 * temporary defined here. | |
2343 */ | |
2344 /*lint -esym(765,get_network_meas) | used by SIM */ | |
2345 /*lint -esym(714,get_network_meas) | used by SIM */ | |
2346 GLOBAL UBYTE get_network_meas (UBYTE * chan_list) | |
2347 { | |
2348 GET_INSTANCE_DATA; | |
2349 #if defined (_SIMULATION_) | |
2350 /* | |
2351 * fixed values for the windows simulation | |
2352 */ | |
2353 memset (chan_list, 0, 16); | |
2354 chan_list [0] = 0x32; | |
2355 chan_list [1] = 0x16; | |
2356 chan_list [2] = 0x7E; | |
2357 chan_list [3] = 0x52; | |
2358 chan_list [4] = 0x37; | |
2359 return 1; | |
2360 #else /* _SIMULATION_ */ | |
2361 switch (GET_STATE (STATE_ATT)) | |
2362 { | |
2363 case ATT_IDLE: | |
2364 memset (chan_list, 0, 16); | |
2365 chan_list [0] = rr_data->nc_data[SC_INDEX].rxlev; | |
2366 return 1; | |
2367 case ATT_DEDICATED: | |
2368 memcpy (chan_list, dl_get_sacch_buffer(), 16); | |
2369 return 1; | |
2370 default: | |
2371 return 0; | |
2372 } | |
2373 #endif /* _SIMULATION_ */ | |
2374 } | |
2375 | |
2376 #ifdef REL99 | |
2377 /* | |
2378 +--------------------------------------------------------------------+ | |
2379 | PROJECT : GPRS EDGE MODULE : RR_CSF | | |
2380 | STATE : code ROUTINE : get_msc_release_version | | |
2381 +--------------------------------------------------------------------+ | |
2382 | |
2383 PURPOSE : use to get the MSC release version of the serving cell. | |
2384 */ | |
2385 | |
2386 GLOBAL void get_msc_release_version(UBYTE* mscr) | |
2387 { | |
2388 GET_INSTANCE_DATA; | |
2389 T_NC_DATA * rrd; | |
2390 rrd = &rr_data->nc_data[SC_INDEX]; | |
2391 *mscr = rrd->mscr_flag; | |
2392 } | |
2393 #endif | |
2394 | |
2395 | |
2396 /* | |
2397 +--------------------------------------------------------------------+ | |
2398 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2399 | STATE : code ROUTINE : get_bcch_chan_list | | |
2400 +--------------------------------------------------------------------+ | |
2401 | |
2402 PURPOSE : This function returns the network measurement results | |
2403 in the SIM TOOLKIT Format. | |
2404 | |
2405 */ | |
2406 #if defined (_SIMULATION_) | |
2407 /* | |
2408 * predefined values for windows simulation | |
2409 */ | |
2410 static USHORT win_list[MAX_NEIGHBOURCELLS] = { 124, 512, 17, 0xFFFF, | |
2411 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
2412 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
2413 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
2414 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
2415 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
2416 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
2417 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, | |
2418 0xFFFF } ; | |
2419 #endif /* _SIMULATION_ */ | |
2420 /*lint -esym(765,get_bcch_chan_list) | used by SIM */ | |
2421 /*lint -esym(714,get_bcch_chan_list) | used by SIM */ | |
2422 GLOBAL UBYTE get_bcch_chan_list (stk_data_type * out_stk_data) | |
2423 { | |
2424 GET_INSTANCE_DATA; | |
2425 UBYTE i; | |
2426 UBYTE value; | |
2427 #if defined (_SIMULATION_) | |
2428 USHORT * ncell_list = win_list; | |
2429 #else /* _SIMULATION_ */ | |
2430 USHORT * ncell_list = rr_data->act_ncell_list; | |
2431 #endif /* _SIMULATION_ */ | |
2432 | |
2433 #if !defined (_SIMULATION_) | |
2434 switch (GET_STATE (STATE_ATT)) | |
2435 { | |
2436 case ATT_IDLE: | |
2437 case ATT_DEDICATED: | |
2438 #endif /* !_SIMULATION_ */ | |
2439 | |
2440 /* | |
2441 * clear output parameter | |
2442 */ | |
2443 memset (out_stk_data->stk_parameter, 0, sizeof (out_stk_data->stk_parameter)); | |
2444 for (i=0;i<MAX_NEIGHBOURCELLS;i++) | |
2445 { | |
2446 if (ncell_list[i] EQ NOT_PRESENT_16BIT) | |
2447 { | |
2448 /* | |
2449 * if no further channel is available | |
2450 * calculate length in bytes | |
2451 * number of channels a 10 bit | |
2452 */ | |
2453 out_stk_data->stk_length = (i*10+7)/8; | |
2454 return 1; | |
2455 } | |
2456 /* | |
2457 * channel is available | |
2458 * then use basic CCD function to add to bitstream | |
2459 */ | |
2460 value = ncell_list[i] >> 8; | |
2461 ccd_codeByte (out_stk_data->stk_parameter, (USHORT)(i*10), 2, value); | |
2462 value = ncell_list[i] & 0xFF; | |
2463 ccd_codeByte (out_stk_data->stk_parameter, (USHORT)(i*10+2), 8, value); | |
2464 } | |
2465 /* | |
2466 * if no end indicator has been found | |
2467 * and all parameters are channels | |
2468 * calculate length in bytes | |
2469 * number of channels a 10 bit. | |
2470 */ | |
2471 out_stk_data->stk_length = (i*10+7)/8; | |
2472 return 1; | |
2473 #if !defined (_SIMULATION_) | |
2474 default: | |
2475 return 0; | |
2476 } | |
2477 #endif /* _SIMULATION_ */ | |
2478 } | |
2479 | |
2480 | |
2481 #if defined(_SIMULATION_FFS_) | |
2482 | |
2483 /* | |
2484 +--------------------------------------------------------------------+ | |
2485 | PROJECT : GSM-PS (6103) MODULE : RR_CSF | | |
2486 | STATE : code ROUTINE : rr_csf_ffs_init | | |
2487 +--------------------------------------------------------------------+ | |
2488 | |
2489 PURPOSE : | |
2490 | |
2491 */ | |
2492 | |
2493 LOCAL const char rr_white_list_name[] = "/gsm/l3/rr_white_list"; | |
2494 LOCAL const char rr_black_list_name[] = "/gsm/l3/rr_black_list"; | |
2495 LOCAL const char rr_lower_rxlev_thr_name[] = "/gsm/l3/rr_lower_rxlev_thr"; | |
2496 LOCAL const char rr_medium_rxlev_thr_name[] = "/gsm/l3/rr_medium_rxlev_thr"; | |
2497 LOCAL const char rr_upper_rxlev_thr_name[] = "/gsm/l3/rr_upper_rxlev_thr"; | |
2498 LOCAL const char rr_shield_mcc_name[] = "/gsm/l3/shield"; | |
2499 | |
2500 GLOBAL void rr_csf_ffs_init(void) | |
2501 { | |
2502 TRACE_FUNCTION ("rr_csf_ffs_init()"); | |
2503 | |
2504 /* If MM has to create the directories for FFS, there is no point | |
2505 * in carry on with the initialisation | |
2506 */ | |
2507 rr_csf_check_ffs_dirs(); | |
2508 | |
2509 /* Read white list from FFS */ | |
2510 rr_csf_read_white_list(); | |
2511 | |
2512 /* Read Black List from FFS */ | |
2513 rr_csf_read_black_list(); | |
2514 | |
2515 /* Read RXlevel thresholds from FFS */ | |
2516 rr_csf_read_rxlev_thr(); | |
2517 } | |
2518 | |
2519 | |
2520 /* | |
2521 +------------------------------------------------------------------+ | |
2522 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2523 | STATE : code ROUTINE : rr_csf_write_white_list | | |
2524 +------------------------------------------------------------------+ | |
2525 | |
2526 PURPOSE : This function writes the White list information to FFS. | |
2527 CSI-LLD - 4.1.2.2.4 | |
2528 */ | |
2529 | |
2530 GLOBAL void rr_csf_write_white_list(T_CS_WHITE_LIST *white_list) | |
2531 { | |
2532 TRACE_FUNCTION ("rr_csf_write_white_list()"); | |
2533 | |
2534 #if defined(_SIMULATION_) | |
2535 memcpy(&win_white_list,white_list,sizeof(T_CS_WHITE_LIST)); | |
2536 #else | |
2537 rr_csf_check_ffs_dirs(); | |
2538 rr_csf_handle_ffs_write_result(ffs_file_write(rr_white_list_name, | |
2539 white_list, | |
2540 sizeof(T_CS_WHITE_LIST), | |
2541 FFS_O_CREATE | FFS_O_RDWR)); | |
2542 #endif | |
2543 | |
2544 TRACE_EVENT("White List written to FFS"); | |
2545 } | |
2546 | |
2547 /* | |
2548 +-----------------------------------------------------------------+ | |
2549 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2550 | STATE : code ROUTINE : rr_csf_read_white_list | | |
2551 +-----------------------------------------------------------------+ | |
2552 | |
2553 PURPOSE : This function read the White list information from FFS. | |
2554 CSI-LLD - 4.1.2.2.5 | |
2555 */ | |
2556 | |
2557 GLOBAL void rr_csf_read_white_list(void) | |
2558 { | |
2559 GET_INSTANCE_DATA; | |
2560 TRACE_FUNCTION ("rr_csf_read_white_list()"); | |
2561 | |
2562 TRACE_EVENT("Read White List from FFS"); | |
2563 | |
2564 #if defined(_SIMULATION_) | |
2565 memcpy(&rr_data->cs_data.white_list,&win_white_list,sizeof(T_CS_WHITE_LIST)); | |
2566 #else | |
2567 rr_csf_check_ffs_dirs(); | |
2568 if(!rr_csf_handle_ffs_read_result(ffs_file_read(rr_white_list_name, | |
2569 &rr_data->cs_data.white_list, | |
2570 sizeof(T_CS_WHITE_LIST)))) | |
2571 { | |
2572 /* In case of read error, reset the White List */ | |
2573 cs_clear_white_list(CLR_WHITE_LIST_RAM); | |
2574 } | |
2575 #endif | |
2576 } | |
2577 | |
2578 /* | |
2579 +-----------------------------------------------------------------------+ | |
2580 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2581 | STATE : code ROUTINE : rr_csf_write_black_list | | |
2582 +-----------------------------------------------------------------------+ | |
2583 | |
2584 PURPOSE : This function wirtes "Black List" information to FFS. | |
2585 In case of windows simulation environment, "Black List" is | |
2586 stored to simulated FFS area. | |
2587 This function is called during switch off. | |
2588 CSI-LLD section:4.1.1.5.3 | |
2589 */ | |
2590 | |
2591 GLOBAL void rr_csf_write_black_list(T_LIST *black_list) | |
2592 { | |
2593 TRACE_FUNCTION ("rr_csf_write_black_list()"); | |
2594 | |
2595 #if defined(_SIMULATION_) | |
2596 memcpy(&win_black_list[0],black_list,MAX_REGIONS*sizeof(T_LIST)); | |
2597 #else | |
2598 rr_csf_check_ffs_dirs(); | |
2599 rr_csf_handle_ffs_write_result(ffs_file_write (rr_black_list_name, | |
2600 black_list, | |
2601 MAX_REGIONS*sizeof(T_LIST), | |
2602 FFS_O_CREATE | FFS_O_RDWR)); | |
2603 #endif | |
2604 | |
2605 TRACE_EVENT("Black List written to FFS"); | |
2606 } | |
2607 | |
2608 | |
2609 /* | |
2610 +------------------------------------------------------------------------+ | |
2611 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2612 | STATE : code ROUTINE : rr_csf_read_black_list | | |
2613 +------------------------------------------------------------------------+ | |
2614 | |
2615 PURPOSE : This function copies "Black List" information from FFS to RR | |
2616 internal "Black List" data structures. In case of windows | |
2617 simulation environment, "Black List" is read from simulated FFS | |
2618 area. This function is called after power on | |
2619 Cell Selection Improvements-LLD section:4.1.1.5.4 | |
2620 */ | |
2621 | |
2622 GLOBAL void rr_csf_read_black_list(void) | |
2623 { | |
2624 GET_INSTANCE_DATA; | |
2625 TRACE_FUNCTION ("rr_csf_read_black_list()"); | |
2626 | |
2627 TRACE_EVENT("Read Black List from FFS"); | |
2628 | |
2629 #if defined(_SIMULATION_) | |
2630 memcpy(&rr_data->cs_data.black_list.list[0],&win_black_list[0], | |
2631 MAX_REGIONS*sizeof(T_LIST)); | |
2632 #else | |
2633 rr_csf_check_ffs_dirs(); | |
2634 if(!rr_csf_handle_ffs_read_result(ffs_file_read (rr_black_list_name, | |
2635 &rr_data->cs_data.black_list.list[0], | |
2636 MAX_REGIONS*sizeof(T_LIST)))) | |
2637 { | |
2638 /* In case of read error, reset the Black List */ | |
2639 cs_clear_black_list(CLR_BLACK_LIST_RAM); | |
2640 } | |
2641 #endif | |
2642 } | |
2643 | |
2644 /* | |
2645 +-----------------------------------------------------------------------+ | |
2646 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2647 | STATE : code ROUTINE : rr_csf_write_rxlev_thr | | |
2648 +-----------------------------------------------------------------------+ | |
2649 | |
2650 PURPOSE : This function wirtes "RXLevel Threshold" information to FFS. | |
2651 In case of windows simulation environment, "RXLevel Threshold" is | |
2652 stored to simulated FFS area. | |
2653 This function is called during dynamic configuration. | |
2654 */ | |
2655 | |
2656 GLOBAL void rr_csf_write_rxlev_thr(UBYTE rxt, SHORT valno, char* val[MAX_NUM_BANDS]) | |
2657 { | |
2658 GET_INSTANCE_DATA; | |
2659 UBYTE i, rxlev_thr_val; | |
2660 UBYTE *rxlev_thr = NULL; | |
2661 #if defined(_SIMULATION_) | |
2662 UBYTE *win_rxlev_thr = NULL; | |
2663 #endif | |
2664 const char *rxlev_thr_name, *rxlev_thr_string; | |
2665 rxlev_thr_name = NULL; | |
2666 rxlev_thr_string = NULL; | |
2667 TRACE_FUNCTION ("rr_csf_write_rxlev_thr()"); | |
2668 | |
2669 switch(rxt) | |
2670 { | |
2671 case U_RXT: rxlev_thr_string = "Upper"; | |
2672 rxlev_thr = &rr_data->dyn_config.upper_rxlev_thr[0]; | |
2673 rxlev_thr_name = &rr_upper_rxlev_thr_name[0]; | |
2674 #if defined(_SIMULATION_) | |
2675 win_rxlev_thr = &win_upper_rxlev_thr[0]; | |
2676 #endif | |
2677 break; | |
2678 case M_RXT: rxlev_thr_string = "Medium"; | |
2679 rxlev_thr = &rr_data->dyn_config.medium_rxlev_thr[0]; | |
2680 rxlev_thr_name = &rr_medium_rxlev_thr_name[0]; | |
2681 #if defined(_SIMULATION_) | |
2682 win_rxlev_thr = &win_medium_rxlev_thr[0]; | |
2683 #endif | |
2684 break; | |
2685 case L_RXT: rxlev_thr_string = "Lower"; | |
2686 rxlev_thr = &rr_data->dyn_config.lower_rxlev_thr[0]; | |
2687 rxlev_thr_name = &rr_lower_rxlev_thr_name[0]; | |
2688 #if defined(_SIMULATION_) | |
2689 win_rxlev_thr = &win_lower_rxlev_thr[0]; | |
2690 #endif | |
2691 break; | |
2692 default: | |
2693 return; | |
2694 } | |
2695 | |
2696 for( i=0 ; i<valno ; i++ ) | |
2697 { | |
2698 rxlev_thr_val = atoi(val[i]); | |
2699 if( rxlev_thr_val > 0 AND rxlev_thr_val <= 63 ) | |
2700 { | |
2701 rxlev_thr[i] = rxlev_thr_val; | |
2702 } | |
2703 else | |
2704 { | |
2705 TRACE_ERROR ("[PEI_CONFIG]: RxLev Threshold(0-63)-Incorrect Range"); | |
2706 } | |
2707 } | |
2708 #if defined(_SIMULATION_) | |
2709 memcpy(win_rxlev_thr,rxlev_thr,MAX_NUM_BANDS*sizeof(UBYTE)); | |
2710 #else | |
2711 rr_csf_check_ffs_dirs(); | |
2712 rr_csf_handle_ffs_write_result(ffs_file_write(rxlev_thr_name, | |
2713 rxlev_thr, | |
2714 MAX_NUM_BANDS*sizeof(UBYTE), | |
2715 FFS_O_CREATE | FFS_O_RDWR)); | |
2716 #endif | |
2717 TRACE_EVENT_P6("%s RxLev Threshold written to FFS: GSM 850=%d, PGSM 900=%d, DCS 1800=%d, PCS 1900=%d, EGSM=%d", | |
2718 rxlev_thr_string, rxlev_thr[B_GSM_850], rxlev_thr[B_GSM_900], | |
2719 rxlev_thr[B_DCS_1800], rxlev_thr[B_PCS_1900], rxlev_thr[B_E_GSM] ); | |
2720 | |
2721 } | |
2722 | |
2723 /* | |
2724 +------------------------------------------------------------------------+ | |
2725 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2726 | STATE : code ROUTINE : rr_csf_read_rxlev_thr | | |
2727 +------------------------------------------------------------------------+ | |
2728 | |
2729 PURPOSE : This function copies "RXLevel Threshold" information from FFS to RR | |
2730 internal "RXLevel Threshold" arrays. In case of windows | |
2731 simulation environment, "RXLevel Threshold" is read from simulated FFS | |
2732 area. This function is called after power on | |
2733 */ | |
2734 | |
2735 GLOBAL void rr_csf_read_rxlev_thr(void) | |
2736 { | |
2737 | |
2738 UBYTE x; | |
2739 GET_INSTANCE_DATA; | |
2740 TRACE_FUNCTION ("rr_csf_read_rxlev_thr()"); | |
2741 | |
2742 TRACE_EVENT("Read RXLevel thresholds from FFS"); | |
2743 | |
2744 #if defined(_SIMULATION_) | |
2745 memcpy(rr_data->dyn_config.lower_rxlev_thr,win_lower_rxlev_thr, | |
2746 MAX_NUM_BANDS*sizeof(UBYTE)); | |
2747 memcpy(rr_data->dyn_config.medium_rxlev_thr,win_medium_rxlev_thr, | |
2748 MAX_NUM_BANDS*sizeof(UBYTE)); | |
2749 memcpy(rr_data->dyn_config.upper_rxlev_thr,win_upper_rxlev_thr, | |
2750 MAX_NUM_BANDS*sizeof(UBYTE)); | |
2751 #else | |
2752 rr_csf_check_ffs_dirs(); | |
2753 if(!rr_csf_handle_ffs_read_result(ffs_file_read (rr_lower_rxlev_thr_name, | |
2754 rr_data->dyn_config.lower_rxlev_thr, | |
2755 MAX_NUM_BANDS*sizeof(UBYTE)))) | |
2756 { | |
2757 for( x=0 ; x<MAX_NUM_BANDS ; x++ ) | |
2758 { | |
2759 rr_data->dyn_config.lower_rxlev_thr[x] = LOWER_RXLEV_THRESHOLD; | |
2760 } | |
2761 rr_data->dyn_config.lower_rxlev_thr[B_GSM_850] = LOWER_RXLEV_THRESHOLD_850; | |
2762 } | |
2763 if(!rr_csf_handle_ffs_read_result(ffs_file_read (rr_medium_rxlev_thr_name, | |
2764 rr_data->dyn_config.medium_rxlev_thr, | |
2765 MAX_NUM_BANDS*sizeof(UBYTE)))) | |
2766 { | |
2767 for( x=0 ; x<MAX_NUM_BANDS ; x++ ) | |
2768 { | |
2769 rr_data->dyn_config.medium_rxlev_thr[x] = MEDIUM_RXLEV_THRESHOLD; | |
2770 } | |
2771 } | |
2772 if(!rr_csf_handle_ffs_read_result(ffs_file_read (rr_upper_rxlev_thr_name, | |
2773 rr_data->dyn_config.upper_rxlev_thr, | |
2774 MAX_NUM_BANDS*sizeof(UBYTE)))) | |
2775 { | |
2776 for( x=0 ; x<MAX_NUM_BANDS ; x++ ) | |
2777 { | |
2778 rr_data->dyn_config.upper_rxlev_thr[x] = UPPER_RXLEV_THRESHOLD; | |
2779 } | |
2780 } | |
2781 #endif | |
2782 } | |
2783 | |
2784 /* | |
2785 +-----------------------------------------------------------------------+ | |
2786 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2787 | STATE : code ROUTINE : rr_csf_write_mcc_shield_to_ffs| | |
2788 +-----------------------------------------------------------------------+ | |
2789 | |
2790 PURPOSE : This function writes the mcc shield values to FFS | |
2791 */ | |
2792 | |
2793 GLOBAL void rr_csf_write_mcc_shield_to_ffs(void) | |
2794 { | |
2795 GET_INSTANCE_DATA; | |
2796 UBYTE count; | |
2797 TRACE_FUNCTION ("rr_csf_write_mcc_shield_to_ffs()"); | |
2798 | |
2799 rr_csf_check_ffs_dirs(); | |
2800 rr_csf_handle_ffs_write_result(ffs_file_write (rr_shield_mcc_name, | |
2801 &rr_data->dyn_config.mcc_shield, | |
2802 sizeof(T_shield_mcc), | |
2803 FFS_O_CREATE | FFS_O_RDWR)); | |
2804 for(count=0;count<MAX_MCC_SHIELD;count++) | |
2805 { | |
2806 TRACE_EVENT_P5 ( "Shield MCC=%d%d%d enabled=[%d]index=[%d]", | |
2807 rr_data->dyn_config.mcc_shield.mcc[count][0], | |
2808 rr_data->dyn_config.mcc_shield.mcc[count][1], | |
2809 rr_data->dyn_config.mcc_shield.mcc[count][2], | |
2810 rr_data->dyn_config.mcc_shield.enabled, | |
2811 rr_data->dyn_config.mcc_shield.index); | |
2812 } | |
2813 } | |
2814 /* | |
2815 +--------------------------------------------------------------------+ | |
2816 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2817 | STATE : code ROUTINE : rr_csf_mcc_present | | |
2818 +--------------------------------------------------------------------+ | |
2819 | |
2820 PURPOSE : This function is used to find mcc already present or not | |
2821 */ | |
2822 | |
2823 GLOBAL UBYTE rr_csf_mcc_present(UBYTE* mcc_value) | |
2824 { | |
2825 GET_INSTANCE_DATA; | |
2826 U8 count = 0; | |
2827 for(count = 0;count<MAX_MCC_SHIELD;count++) | |
2828 { | |
2829 if((memcmp(rr_data->dyn_config.mcc_shield.mcc[count],mcc_value,SIZE_MCC)EQ 0)) | |
2830 { | |
2831 return TRUE; | |
2832 } | |
2833 } | |
2834 return FALSE; | |
2835 } | |
2836 | |
2837 | |
2838 /* | |
2839 +-----------------------------------------------------------------------+ | |
2840 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2841 | STATE : code ROUTINE : rr_csf_handle_ffs_read_result | | |
2842 +-----------------------------------------------------------------------+ | |
2843 | |
2844 PURPOSE : This function checks the status from FFS and returns | |
2845 TRUE if there is no error and FALSE if there is | |
2846 */ | |
2847 LOCAL BOOL rr_csf_handle_ffs_read_result(T_FFS_SIZE status_read) | |
2848 { | |
2849 if(status_read>0) | |
2850 { | |
2851 TRACE_EVENT ("FFS Read OK"); | |
2852 return TRUE; | |
2853 } | |
2854 else | |
2855 { | |
2856 TRACE_EVENT_P1("FFS Read ERROR - %x", status_read); | |
2857 return FALSE; | |
2858 } | |
2859 } | |
2860 | |
2861 /* | |
2862 +------------------------------------------------------------------------+ | |
2863 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2864 | STATE : code ROUTINE : rr_csf_handle_ffs_write_result | | |
2865 +------------------------------------------------------------------------+ | |
2866 | |
2867 PURPOSE : This function checks the status from FFS and returns | |
2868 TRUE if there is no error and FALSE if there is | |
2869 */ | |
2870 LOCAL BOOL rr_csf_handle_ffs_write_result(T_FFS_RET status_write) | |
2871 { | |
2872 if(status_write >= EFFS_OK) | |
2873 { | |
2874 TRACE_EVENT("FFS Write OK"); | |
2875 if(status_write) | |
2876 TRACE_EVENT_P1 ("Bytes written: %d",status_write); | |
2877 | |
2878 return(TRUE); | |
2879 } | |
2880 else | |
2881 { | |
2882 TRACE_EVENT_P1 ("FFS Write Error - Status: %x",status_write); | |
2883 return(FALSE); | |
2884 } | |
2885 } | |
2886 | |
2887 /* | |
2888 +--------------------------------------------------------------------+ | |
2889 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2890 | STATE : code ROUTINE : rr_csf_check_ffs_dirs | | |
2891 +--------------------------------------------------------------------+ | |
2892 | |
2893 PURPOSE : This routine creates the /gsm/l3 directory for the last used | |
2894 sc arfcn in the FFS. The return result indicates whether either | |
2895 directories existed or not. There is no error handling. | |
2896 */ | |
2897 | |
2898 LOCAL void rr_csf_check_ffs_dirs( void ) | |
2899 { | |
2900 const char gsm_name[] = "/gsm"; | |
2901 const char gsm_l3_name[] = "/gsm/l3"; | |
2902 | |
2903 rr_csf_create_ffs_dirs(gsm_name); | |
2904 rr_csf_create_ffs_dirs(gsm_l3_name); | |
2905 } | |
2906 | |
2907 /* | |
2908 +--------------------------------------------------------------------+ | |
2909 | PROJECT : GSM-PS (6147) MODULE : RR_CSF | | |
2910 | STATE : code ROUTINE : rr_csf_create_ffs_dirs | | |
2911 +--------------------------------------------------------------------+ | |
2912 | |
2913 PURPOSE : This routine calls the ffs_mkdir() routine to create a | |
2914 specified directory. It returns whether the directory | |
2915 existed or not prior to creation. | |
2916 */ | |
2917 LOCAL void rr_csf_create_ffs_dirs(const char *dir_name) | |
2918 { | |
2919 T_FFS_RET status; | |
2920 | |
2921 status=ffs_mkdir(dir_name); | |
2922 switch(status) | |
2923 { | |
2924 case EFFS_EXISTS: | |
2925 case EFFS_OK: | |
2926 break; | |
2927 | |
2928 default: /*Error*/ | |
2929 TRACE_EVENT_P1("Create Dir error - %x",status); | |
2930 break; | |
2931 } | |
2932 } | |
2933 #endif /* _SIMULATION_FFS_ */ | |
2934 | |
2935 #endif |