FreeCalypso > hg > fc-selenite
comparison src/g23m-gsm/rr/rr_pei.c @ 1:d393cd9bb723
src/g23m-*: initial import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 15 Jul 2018 04:40:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b6a5e36de839 | 1:d393cd9bb723 |
---|---|
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 process body interface | |
18 | for the component RR of the mobile station | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef RR_PEI_C | |
23 #define RR_PEI_C | |
24 | |
25 #define ENTITY_RR | |
26 | |
27 /*==== INCLUDES ===================================================*/ | |
28 | |
29 #include <string.h> | |
30 #include <stdlib.h> | |
31 #include <stddef.h> /* offsetof */ | |
32 #include <stdio.h> /* sprintf */ | |
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 "rr_em.h" | |
47 #include "cl_shrd.h" | |
48 | |
49 #if !defined(_SIMULATION_) | |
50 #include "ffs/ffs.h" | |
51 #include "ffs_coat.h" | |
52 #endif /* !_SIMULATION_ */ | |
53 | |
54 /*==== EXPORT =====================================================*/ | |
55 /* | |
56 * several handles for communication with other entities | |
57 */ | |
58 #ifdef TI_PS_HCOMM_CHANGE | |
59 GLOBAL T_HANDLE rr_handle = VSI_ERROR; | |
60 #ifdef GPRS | |
61 GLOBAL T_HANDLE hCommGRR = VSI_ERROR; /* GRR Communication */ | |
62 #endif | |
63 #else /* for hCommHandles backward compatibility */ | |
64 GLOBAL T_HANDLE hCommDL = VSI_ERROR; | |
65 #if defined FF_EOTD | |
66 GLOBAL T_HANDLE hCommLC = VSI_ERROR; | |
67 GLOBAL T_HANDLE hCommRRLP = VSI_ERROR; | |
68 #endif /* FF_EOTD */ | |
69 GLOBAL T_HANDLE hCommMM = VSI_ERROR; | |
70 GLOBAL T_HANDLE hCommPL = VSI_ERROR; | |
71 GLOBAL T_HANDLE rr_handle = VSI_ERROR; | |
72 #ifdef GPRS | |
73 GLOBAL T_HANDLE hCommGRR = VSI_ERROR; /* GRR Communication */ | |
74 #endif | |
75 GLOBAL T_HANDLE hCommMMI = VSI_ERROR; /* EM Communication */ | |
76 #ifdef FF_WAP | |
77 GLOBAL T_HANDLE hCommWAP = VSI_ERROR; /* FMM-WAP Communication */ | |
78 #endif | |
79 | |
80 #endif /* TI_PS_HCOMM_CHANGE */ | |
81 | |
82 | |
83 | |
84 static UBYTE stop_reg = FALSE; | |
85 | |
86 GLOBAL T_RR_DATA rr_data_base; | |
87 | |
88 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
89 const UBYTE std_bands[12] = | |
90 #else | |
91 const UBYTE std_bands[8] = | |
92 #endif | |
93 { | |
94 BAND_GSM_900, /* std = 1 */ | |
95 BAND_GSM_900 | BAND_E_GSM, /* std = 2 */ | |
96 BAND_PCS_1900, /* std = 3 */ | |
97 BAND_DCS_1800, /* std = 4 */ | |
98 BAND_DUAL, /* std = 5 */ | |
99 BAND_DUAL_EXT, /* std = 6 */ | |
100 BAND_GSM_850, /* std = 7 */ | |
101 BAND_DUAL_US /* std = 8 */ | |
102 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
103 ,BAND_GSM_850 | BAND_DCS_1800, /* std = 9 */ | |
104 BAND_GSM_900 | BAND_E_GSM | BAND_PCS_1900, /* std = 10 */ | |
105 BAND_GSM_850 | BAND_GSM_900 | BAND_E_GSM | BAND_DCS_1800, /* std = 11 */ | |
106 BAND_GSM_850 | BAND_GSM_900 | BAND_E_GSM | BAND_PCS_1900 /* std = 12 */ | |
107 #endif | |
108 }; | |
109 | |
110 /*==== PRIVATE ====================================================*/ | |
111 | |
112 LOCAL void pei_not_supported (void *data); | |
113 | |
114 /*==== VARIABLES ==================================================*/ | |
115 #ifdef _SIMULATION_ | |
116 LOCAL BOOL first_access = TRUE; | |
117 #endif /* _SIMULATION_ */ | |
118 | |
119 /*==== FUNCTIONS ==================================================*/ | |
120 | |
121 LOCAL const T_FUNC dl_table[] = { | |
122 MAK_FUNC_0( dat_dl_establish_ind, DL_ESTABLISH_IND ), /* 0x80004003 */ | |
123 MAK_FUNC_0( dat_dl_establish_cnf, DL_ESTABLISH_CNF ), /* 0x80014003 */ | |
124 MAK_FUNC_0( dat_dl_release_ind, DL_RELEASE_IND ), /* 0x80024003 */ | |
125 MAK_FUNC_0( dat_dl_release_cnf, DL_RELEASE_CNF ), /* 0x80034003 */ | |
126 MAK_FUNC_S( for_dl_data_ind, DL_DATA_IND ), /* 0x80044003 */ | |
127 #if defined (REL99) && defined (TI_PS_FF_EMR) | |
128 MAK_FUNC_S( for_dl_short_unitdata_ind, DL_SHORT_UNITDATA_IND ), /* 0x80054003 */ | |
129 #else | |
130 MAK_FUNC_0( pei_not_supported, DL_DATA_CNF ), /* 0x80054003 */ | |
131 #endif | |
132 }; | |
133 | |
134 LOCAL const T_FUNC rr_table[] = { | |
135 MAK_FUNC_0( dat_rr_abort_req, RR_ABORT_REQ ), | |
136 MAK_FUNC_0( att_rr_activate_req, RR_ACTIVATE_REQ ), | |
137 MAK_FUNC_S( dat_rr_data_req, RR_DATA_REQ ), | |
138 MAK_FUNC_0( att_rr_deactivate_req, RR_DEACTIVATE_REQ ), | |
139 MAK_FUNC_S( dat_rr_establish_req, RR_ESTABLISH_REQ ), | |
140 MAK_FUNC_0( att_rr_sync_req, RR_SYNC_REQ ), | |
141 MAK_FUNC_0( att_rr_sync_hplmn_req, RR_SYNC_HPLMN_REQ ) | |
142 }; | |
143 | |
144 LOCAL const T_FUNC mph_table[] = { | |
145 MAK_FUNC_N( pei_not_supported, MPH_BCCH_IND ), | |
146 MAK_FUNC_0( att_mph_measurement_ind, MPH_MEASUREMENT_IND ), | |
147 MAK_FUNC_0( dat_mph_dedicated_cnf, MPH_DEDICATED_CNF ), | |
148 MAK_FUNC_0( dat_mph_dedicated_fail_cnf, MPH_DEDICATED_FAIL_CNF ), | |
149 MAK_FUNC_0( att_mph_error_ind, MPH_ERROR_IND ), | |
150 MAK_FUNC_0( dat_mph_emo_meas_ind, MPH_EMO_MEAS_IND ), | |
151 MAK_FUNC_0( dat_mph_paging_ind, MPH_PAGING_IND ), | |
152 MAK_FUNC_0( cs_mph_power_cnf, MPH_POWER_CNF ), | |
153 MAK_FUNC_0( cs_mph_bsic_cnf, MPH_BSIC_CNF ), | |
154 MAK_FUNC_S( for_mph_unitdata_ind, MPH_UNITDATA_IND ), | |
155 MAK_FUNC_0( dat_mph_random_access_cnf, MPH_RANDOM_ACCESS_CNF ), | |
156 MAK_FUNC_0( att_mph_sync_ind, MPH_SYNC_IND ), | |
157 MAK_FUNC_0( att_mph_meas_order_cnf, MPH_MEAS_ORDER_CNF ), | |
158 #ifdef GPRS | |
159 MAK_FUNC_0( att_mph_ext_meas_cnf, MPH_EXT_MEAS_CNF ), | |
160 #else | |
161 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x0D */ | |
162 #endif | |
163 #if defined FF_EOTD | |
164 MAK_FUNC_0( att_mph_ncell_pos_ind, MPH_NCELL_POS_IND ), | |
165 #else | |
166 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x0E */ | |
167 #endif /* FF_EOTD */ | |
168 MAK_FUNC_0( att_mph_stop_dedicated_cnf, MPH_STOP_DEDICATED_CNF), /* 0x0f */ | |
169 #ifdef GPRS | |
170 MAK_FUNC_0( att_mph_meas_rep_cnf, MPH_MEAS_REP_CNF ) | |
171 #else | |
172 MAK_FUNC_N( pei_not_supported, 0 ) /* 0x10 */ | |
173 #endif | |
174 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
175 , | |
176 MAK_FUNC_N( att_mph_init_rr_ind, MPH_INIT_RR_IND ) /* 0x11 */ | |
177 #endif | |
178 | |
179 }; | |
180 | |
181 #ifdef FF_EM_MODE | |
182 LOCAL const T_FUNC em_ul_table[] = { | |
183 MAK_FUNC_0( dat_em_sc_info_req, EM_SC_INFO_REQ ), /* 0x00*/ | |
184 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x01*/ | |
185 MAK_FUNC_0( dat_em_nc_info_req, EM_NC_INFO_REQ ), /* 0x02*/ | |
186 MAK_FUNC_0( dat_em_loc_pag_info_req, EM_LOC_PAG_INFO_REQ ), /* 0x03*/ | |
187 MAK_FUNC_0( dat_em_plmn_info_req, EM_PLMN_INFO_REQ ), /* 0x04*/ | |
188 MAK_FUNC_0( dat_em_cip_hop_dtx_info_req, EM_CIP_HOP_DTX_INFO_REQ ), /* 0x05*/ | |
189 MAK_FUNC_0( dat_em_mobdata_power_info_req, EM_POWER_INFO_REQ ), /* 0x06*/ | |
190 MAK_FUNC_0( dat_em_mobdata_id_info_req, EM_IDENTITY_INFO_REQ ), /* 0x07*/ | |
191 MAK_FUNC_0( dat_em_mobdata_version_info_req,EM_SW_VERSION_INFO_REQ ), /* 0x08*/ | |
192 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x09*/ | |
193 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x0A*/ | |
194 MAK_FUNC_N( rr_em_rr_event_req, EM_RR_EVENT_REQ ), /* 0x0B*/ | |
195 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x0C */ | |
196 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x0D */ | |
197 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x0E */ | |
198 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x0F */ | |
199 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x10 */ /*SIM - event*/ | |
200 MAK_FUNC_0( rr_em_pco_trace_req, EM_PCO_TRACE_REQ ), /* 0x11*/ /*PCO output*/ | |
201 #ifdef GPRS | |
202 MAK_FUNC_0 (dat_em_fmm_sc_info_req, EM_FMM_SC_INFO_REQ ), /* 0x12 */ | |
203 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x13 */ | |
204 MAK_FUNC_0 (dat_em_fmm_nc_info_req, EM_FMM_NC_INFO_REQ ), /* 0x14 */ | |
205 #else /*GPRS*/ | |
206 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x12 */ | |
207 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x13 */ | |
208 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x14 */ | |
209 #endif /*GPRS*/ | |
210 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x15 */ | |
211 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x16 */ | |
212 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x17 */ | |
213 MAK_FUNC_N (pei_not_supported, 0 ), /* 0x18 */ | |
214 MAK_FUNC_0 (dat_em_amr_info_req, EM_AMR_INFO_REQ ) /* 0x19 */ | |
215 }; | |
216 #endif /* FF_EM_MODE */ | |
217 | |
218 | |
219 #if defined FF_EOTD | |
220 LOCAL const T_FUNC rrlc_table[] = { | |
221 MAK_FUNC_0( dat_rrlc_meas_req, RRLC_MEAS_REQ ) | |
222 }; | |
223 | |
224 LOCAL const T_FUNC rrrrlp_table[] = { | |
225 MAK_FUNC_S( dat_rrrrlp_data_req, RRRRLP_DATA_REQ ) | |
226 }; | |
227 #endif /* FF_EOTD */ | |
228 | |
229 /* | |
230 +--------------------------------------------------------------------+ | |
231 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
232 | STATE : code ROUTINE : pei_primitive | | |
233 +--------------------------------------------------------------------+ | |
234 | |
235 PURPOSE : Process protocol specific primitive. | |
236 | |
237 */ | |
238 | |
239 LOCAL SHORT pei_primitive (void * ptr) | |
240 { | |
241 T_PRIM *prim = ptr; | |
242 | |
243 /* | |
244 * | | | | | |
245 * RR EM RRLC RRRRLP UPLINK | |
246 * | | | | | |
247 * +-------v-------v-------v-------v------+ | |
248 * | | | |
249 * | RR | | |
250 * | | | |
251 * +----------^------------------^--------+ | |
252 * | | | |
253 * MPH DL DOWNLINK | |
254 * | | | |
255 * | |
256 */ | |
257 | |
258 TRACE_FUNCTION ("pei_primitive()"); | |
259 | |
260 /* | |
261 * On keypress may stop the registration timer | |
262 */ | |
263 if (stop_reg) | |
264 { | |
265 stop_reg = FALSE; | |
266 tim_reset_registration_timer (); | |
267 } | |
268 | |
269 if (prim NEQ NULL) | |
270 { | |
271 ULONG opc = prim->custom.opc; | |
272 USHORT n; | |
273 const T_FUNC *table; | |
274 GET_INSTANCE_DATA; | |
275 | |
276 VSI_PPM_REC ((T_PRIM_HEADER*)prim, __FILE__, __LINE__); | |
277 | |
278 PTRACE_IN (opc); | |
279 | |
280 switch (SAP_NR(opc)) | |
281 { | |
282 case SAP_NR(RR_UL) : table = rr_table; n = TAB_SIZE ( rr_table); break; | |
283 case SAP_NR(DL_DL) : table = dl_table; n = TAB_SIZE ( dl_table); break; | |
284 case SAP_NR(MPH_UL) : table = mph_table; n = TAB_SIZE ( mph_table); break; | |
285 #if defined FF_EOTD | |
286 case SAP_NR(RRLC_UL) : table = rrlc_table; n = TAB_SIZE ( rrlc_table); break; | |
287 case SAP_NR(RRRRLP_UL): table = rrrrlp_table; n = TAB_SIZE (rrrrlp_table); break; | |
288 #endif /* FF_EOTD */ | |
289 | |
290 #ifdef GPRS | |
291 case RRGRR_UL: gprs_get_table_n (&table, &n); break; | |
292 #endif /* GPRS */ | |
293 | |
294 #ifdef FF_EM_MODE | |
295 case EM_Ul: table = em_ul_table; n = TAB_SIZE (em_ul_table); break; | |
296 #endif /* FF_EM_MODE*/ | |
297 | |
298 default : table = NULL; n = 0; break; | |
299 } | |
300 | |
301 if (table NEQ NULL) | |
302 { | |
303 if (PRIM_NR(opc) < n) | |
304 { | |
305 table += PRIM_NR(opc); | |
306 #ifdef PALLOC_TRANSITION | |
307 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0; | |
308 #ifndef NO_COPY_ROUTING | |
309 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER); | |
310 #endif /* NO_COPY_ROUTING */ | |
311 #endif /* PALLOC_TRANSITION */ | |
312 JUMP (table->func) (P2D(prim)); | |
313 | |
314 while (ENTITY_DATA->use_stored_entries) | |
315 { | |
316 ENTITY_DATA->use_stored_entries = FALSE; | |
317 srv_use_stored_prim (); | |
318 } | |
319 } | |
320 #if defined (REL99) && defined (TI_PS_FF_EMR) | |
321 else if (PRIM_NR(opc) EQ DL_SPD_PID ) | |
322 { | |
323 for_dl_short_unitdata_ind((T_DL_SHORT_UNITDATA_IND*) P2D(prim)); | |
324 } | |
325 #endif | |
326 else | |
327 { | |
328 pei_not_supported (P2D(prim)); | |
329 } | |
330 return PEI_OK; | |
331 } | |
332 | |
333 /* | |
334 * Primitive is no GSM Primitive | |
335 * then forward to the environment | |
336 */ | |
337 | |
338 #ifdef GSM_ONLY | |
339 PFREE (P2D(prim)) | |
340 | |
341 return PEI_ERROR; | |
342 #else | |
343 if (opc & SYS_MASK) | |
344 vsi_c_primitive (VSI_CALLER prim); | |
345 else | |
346 { | |
347 PFREE (P2D(prim)); | |
348 return PEI_ERROR; | |
349 } | |
350 #endif | |
351 } | |
352 return PEI_OK; | |
353 } | |
354 | |
355 /* | |
356 +--------------------------------------------------------------------+ | |
357 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
358 | STATE : code ROUTINE : rr_pei_primitive | | |
359 +--------------------------------------------------------------------+ | |
360 | |
361 PURPOSE : used to restart a stored primitive. | |
362 | |
363 */ | |
364 GLOBAL void rr_pei_primitive (T_PRIM * prim) | |
365 { | |
366 pei_primitive (prim); | |
367 } | |
368 | |
369 /* | |
370 +--------------------------------------------------------------------+ | |
371 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
372 | STATE : code ROUTINE : wake_up_rr | | |
373 +--------------------------------------------------------------------+ | |
374 | |
375 PURPOSE : This function can be called from the MMI or keypad driver | |
376 to restart registration if in limited / no service condition. | |
377 | |
378 */ | |
379 /*lint -esym(714,wake_up_rr) | Symbol not referenced */ | |
380 /*lint -esym(765,wake_up_rr) | external could be made static */ | |
381 GLOBAL void wake_up_rr (void) | |
382 { | |
383 GET_INSTANCE_DATA; | |
384 T_TIME status = 0L; | |
385 | |
386 TRACE_FUNCTION ("wake_up_rr()"); | |
387 | |
388 switch (rr_data->ms_data.rr_service) | |
389 { | |
390 case NO_SERVICE: | |
391 case LIMITED_SERVICE: | |
392 if (rr_data->ms_data.reg_counter >= 12) | |
393 { | |
394 TIMER_STATUS (rr_handle, TREG, &status); | |
395 if (status) | |
396 { | |
397 stop_reg = TRUE; | |
398 vsi_c_awake (VSI_CALLER_SINGLE); | |
399 } | |
400 } | |
401 break; | |
402 } | |
403 } | |
404 | |
405 /* | |
406 +--------------------------------------------------------------------+ | |
407 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
408 | STATE : code ROUTINE : pei_not_supported | | |
409 +--------------------------------------------------------------------+ | |
410 | |
411 PURPOSE : An unsupported primitive is received. | |
412 | |
413 */ | |
414 | |
415 static void pei_not_supported (void * data) | |
416 { | |
417 TRACE_FUNCTION ("pei_not_supported()"); | |
418 | |
419 PFREE (data) | |
420 } | |
421 | |
422 /* | |
423 +--------------------------------------------------------------------+ | |
424 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
425 | STATE : code ROUTINE : pei_init | | |
426 +--------------------------------------------------------------------+ | |
427 | |
428 PURPOSE : Initialize Protocol Stack Entity | |
429 | |
430 */ | |
431 LOCAL SHORT pei_init (T_HANDLE handle) | |
432 { | |
433 GET_INSTANCE_DATA; | |
434 rr_handle = handle; | |
435 | |
436 TRACE_FUNCTION ("pei_init()"); | |
437 | |
438 #ifdef TI_PS_HCOMM_CHANGE | |
439 if (!cl_hcom_all_handles_open()) | |
440 { | |
441 return PEI_ERROR; | |
442 } | |
443 | |
444 #ifdef GPRS | |
445 if (hCommGRR < VSI_OK) | |
446 { | |
447 if ((hCommGRR = vsi_c_open (VSI_CALLER GRR_NAME)) < VSI_OK) | |
448 return PEI_ERROR; | |
449 } | |
450 #endif | |
451 #else /* for hCommHandles backward compatibility */ | |
452 if (hCommDL < VSI_OK) | |
453 { | |
454 if ((hCommDL = vsi_c_open (VSI_CALLER DL_NAME)) < VSI_OK) | |
455 return PEI_ERROR; | |
456 } | |
457 #if defined FF_EOTD | |
458 if (hCommLC < VSI_OK) | |
459 { | |
460 if ((hCommLC = vsi_c_open (VSI_CALLER LC_NAME)) < VSI_OK) | |
461 return PEI_ERROR; | |
462 } | |
463 if (hCommRRLP < VSI_OK) | |
464 { | |
465 if ((hCommRRLP = vsi_c_open (VSI_CALLER RRLP_NAME)) < VSI_OK) | |
466 return PEI_ERROR; | |
467 } | |
468 #endif /* FF_EOTD */ | |
469 | |
470 if (hCommMM < VSI_OK) | |
471 { | |
472 if ((hCommMM = vsi_c_open (VSI_CALLER MM_NAME)) < VSI_OK) | |
473 return PEI_ERROR; | |
474 } | |
475 | |
476 if (hCommPL < VSI_OK) | |
477 { | |
478 if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK) | |
479 return PEI_ERROR; | |
480 } | |
481 | |
482 #ifdef GPRS | |
483 if (hCommGRR < VSI_OK) | |
484 { | |
485 if ((hCommGRR = vsi_c_open (VSI_CALLER GRR_NAME)) < VSI_OK) | |
486 return PEI_ERROR; | |
487 } | |
488 #endif | |
489 | |
490 #ifdef FF_WAP /*FMM*/ | |
491 | |
492 if (hCommWAP < VSI_OK) | |
493 { | |
494 if ((hCommWAP = vsi_c_open (VSI_CALLER WAP_NAME)) < VSI_OK) | |
495 return PEI_ERROR; | |
496 } | |
497 #endif | |
498 | |
499 | |
500 if (hCommMMI < VSI_OK) | |
501 { | |
502 /* | |
503 * Open MMI (Layer 4) | |
504 */ | |
505 | |
506 if ((hCommMMI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK) | |
507 return PEI_ERROR; | |
508 } | |
509 #endif /* TI_PS_HCOMM_CHANGE */ | |
510 rr_data->ms_data.multislot_class_configured = FALSE; | |
511 rr_data->ms_data.cmsp_configured = FALSE; | |
512 /* | |
513 * Initialize Condat Coder Decoder and | |
514 * processes | |
515 */ | |
516 | |
517 #if !defined(_SIMULATION_) | |
518 // TRACE_EVENT (rr_version()); | |
519 // SYST_TRACE (rr_version()); | |
520 #endif /* !_SIMULATION_ */ | |
521 | |
522 ccd_init (); | |
523 att_init_gsm_data (); | |
524 dat_init_rr_data (); | |
525 cs_init_process (); | |
526 pcm_Init (); | |
527 cl_shrd_init(rr_handle); | |
528 | |
529 #if defined(_SIMULATION_) | |
530 rr_csf_ms_cap (); | |
531 rr_csf_check_rfcap (TRUE); | |
532 #endif | |
533 | |
534 #ifdef GPRS | |
535 gprs_init_gprs_data (); | |
536 #endif | |
537 | |
538 #ifdef FF_EM_MODE | |
539 em_init_rr_event_trace(); | |
540 em_rr_sem_init(); | |
541 em_init_get_hchn (); | |
542 #endif /* FF_EM_MODE */ | |
543 | |
544 return PEI_OK; | |
545 } | |
546 | |
547 /* | |
548 +--------------------------------------------------------------------+ | |
549 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
550 | STATE : code ROUTINE : pei_timeout | | |
551 +--------------------------------------------------------------------+ | |
552 | |
553 PURPOSE : Process timeout | |
554 | |
555 */ | |
556 | |
557 LOCAL SHORT pei_timeout (USHORT index) | |
558 { | |
559 GET_INSTANCE_DATA; | |
560 | |
561 TRACE_FUNCTION ("pei_timeout ()"); | |
562 | |
563 /* | |
564 * Handle Timeouts | |
565 */ | |
566 tim_exec_timeout (index); | |
567 | |
568 while (ENTITY_DATA->use_stored_entries) | |
569 { | |
570 ENTITY_DATA->use_stored_entries = FALSE; | |
571 srv_use_stored_prim (); | |
572 } | |
573 | |
574 return PEI_OK; | |
575 } | |
576 | |
577 #ifdef _SIMULATION_ | |
578 /* | |
579 +--------------------------------------------------------------------+ | |
580 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
581 | STATE : code ROUTINE : pei_exit | | |
582 +--------------------------------------------------------------------+ | |
583 | |
584 PURPOSE : Close Resources and terminate | |
585 | |
586 */ | |
587 | |
588 LOCAL SHORT pei_exit (void) | |
589 { | |
590 TRACE_FUNCTION ("pei_exit()"); | |
591 | |
592 /* | |
593 * clean up communication | |
594 */ | |
595 #ifdef TI_PS_HCOMM_CHANGE | |
596 #else /* for hCommHandles backward compatibility */ | |
597 vsi_c_close (VSI_CALLER hCommDL); | |
598 hCommDL = VSI_ERROR; | |
599 | |
600 #if defined FF_EOTD | |
601 vsi_c_close (VSI_CALLER hCommLC); | |
602 hCommLC = VSI_ERROR; | |
603 | |
604 vsi_c_close (VSI_CALLER hCommRRLP); | |
605 hCommRRLP = VSI_ERROR; | |
606 #endif /* FF_EOTD */ | |
607 | |
608 vsi_c_close (VSI_CALLER hCommMM); | |
609 hCommMM = VSI_ERROR; | |
610 | |
611 vsi_c_close (VSI_CALLER hCommPL); | |
612 hCommPL = VSI_ERROR; | |
613 | |
614 vsi_c_close (VSI_CALLER hCommMMI); | |
615 hCommMMI = VSI_ERROR; | |
616 | |
617 #ifdef FF_WAP /*FFM*/ | |
618 vsi_c_close (VSI_CALLER hCommWAP); | |
619 hCommWAP = VSI_ERROR; | |
620 #endif | |
621 #endif /* TI_PS_HCOMM_CHANGE */ | |
622 | |
623 #ifdef FF_EM_MODE | |
624 em_rr_sem_exit(); | |
625 #endif /* FF_EM_MODE */ | |
626 | |
627 ccd_exit(); | |
628 cl_shrd_exit(); | |
629 | |
630 return PEI_OK; | |
631 } | |
632 #endif /* _SIMULATION_ */ | |
633 | |
634 /* | |
635 +--------------------------------------------------------------------+ | |
636 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
637 | STATE : code ROUTINE : pei_config | | |
638 +--------------------------------------------------------------------+ | |
639 | |
640 PURPOSE : Dynamic Configuration | |
641 | |
642 */ | |
643 | |
644 #if !defined (NCONFIG) | |
645 LOCAL const KW_DATA kwtab[] = { | |
646 #ifdef OPTION_TIMER | |
647 RR_TIMER_SET, TIMER_SET, | |
648 RR_TIMER_RESET, TIMER_RESET, | |
649 RR_TIMER_SPEED_UP, TIMER_SPEED_UP, | |
650 RR_TIMER_SLOW_DOWN, TIMER_SLOW_DOWN, | |
651 RR_TIMER_SUPPRESS, TIMER_SUPPRESS, | |
652 #endif /* OPTION_TIMER */ | |
653 RR_TFAST_CS, TIM_FAST, | |
654 RR_TNORMAL_CS, TIM_NORMAL, | |
655 RR_FCR, FCR, | |
656 RR_SCR, SCR, | |
657 RR_DLE, DLE, | |
658 RR_FCA, FCA, | |
659 RR_FRL, FRL, | |
660 RR_FHO, FHO, | |
661 RR_IHO, IHO, | |
662 RR_NO_SYS_TIME, NO_SYS_TIME, | |
663 RR_GSM_OFFSET, GSM_OFFSET, | |
664 RR_DCS_OFFSET, DCS_OFFSET, | |
665 RR_CTO, CTO, | |
666 RR_NKC, NKC, | |
667 RR_RESTRICTED_BAND, ID_RESTRICTED_BAND, | |
668 RR_BL_CS, BL_CS, | |
669 RR_U_RXT, U_RXT, | |
670 RR_M_RXT, M_RXT, | |
671 RR_L_RXT, L_RXT, | |
672 RR_FBLS, FBLS, | |
673 RR_SHOW_BL, SHOW_BL, | |
674 RR_SHOW_WL, SHOW_WL, | |
675 RR_SET_NPS_DELAY, SET_NPS_DELAY, | |
676 #if defined (_SIMULATION_) | |
677 RR_MT_CALL_NAME, RR_MT_CALL, | |
678 RR_MT_SMS_0_NAME, RR_MT_SMS_0, | |
679 RR_MT_SMS_2_NAME, RR_MT_SMS_2, | |
680 RR_SRV_FULL_NAME, RR_SERVICE_FULL, | |
681 RR_SRV_LIM_NAME, RR_SERVICE_LIMITED, | |
682 RR_SRV_NO, RR_SERVICE_NO, | |
683 RR_PSEUDO_SYNC_HO, ID_PSEUDO_SYNC_HO, | |
684 RR_PCM, ID_PCM, | |
685 RR_DCS_PCLASS_3, DCS_PCLASS_3, | |
686 #endif /* _SIMULATION_ */ | |
687 RR_MULTISLOT_CLASS, ID_MULTISLOT_CLASS, | |
688 RR_CMSP, ID_CMSP, | |
689 #if !defined(_SIMULATION_) | |
690 RR_FFS_CHECK, ID_FFS_CHECK, | |
691 #endif | |
692 #if defined (_SIMULATION_FFS_) | |
693 RR_ERASE_WL, ERASE_WL, | |
694 RR_ERASE_BL, ERASE_BL, | |
695 RR_SHIELD, SHIELD, | |
696 RR_INIT_FFS, INIT_FFS, | |
697 RR_WRITE_FFS, WRITE_FFS, | |
698 #endif /* (_SIMULATION_FFS_)*/ | |
699 RR_SET_WL, SET_WL, | |
700 RR_SET_BL, SET_BL, | |
701 RR_SET_WL_REGION, SET_WL_REGION, | |
702 RR_SET_LAST_USED_SC, SET_LAST_USED_SC, | |
703 RR_SCS, SCS, | |
704 RR_SET_WL_PLMN, SET_WL_PLMN, | |
705 "", 0 | |
706 }; | |
707 | |
708 static const KW_DATA partab[] = { | |
709 #ifdef OPTION_TIMER | |
710 T3110_NAME, T3110, | |
711 T3122_NAME, T3122, | |
712 T3126_NAME, T3126, | |
713 TRESELECT_NAME, T_RESELECT, | |
714 TREG_NAME, TREG, | |
715 TABORT_NAME, TABORT, | |
716 #endif | |
717 "", 0 | |
718 }; | |
719 #endif /*!defined (NCONFIG)*/ | |
720 /* Implements Measure#36 */ | |
721 #if defined(NCONFIG) | |
722 #else /* NCONFIG */ | |
723 LOCAL SHORT pei_config (T_PEI_CONFIG inString) | |
724 { | |
725 GET_INSTANCE_DATA; | |
726 #if !defined (NCONFIG) | |
727 #define NMAX_VAL 20 | |
728 { | |
729 char * s = inString; | |
730 SHORT valno; | |
731 char * keyw; | |
732 char * val [NMAX_VAL]; | |
733 #ifdef OPTION_TIMER | |
734 BOOL t_man = FALSE; | |
735 SHORT t_num = 0; | |
736 LONG t_val = 0; | |
737 | |
738 #endif | |
739 #if defined(_SIMULATION_FFS_) | |
740 UBYTE count = 0,index = 0,mcc[SIZE_MCC]; | |
741 SHORT mcc_val = 0; | |
742 #endif /* _SIMULATION_FFS */ | |
743 | |
744 TRACE_FUNCTION ("pei_config()"); | |
745 | |
746 TRACE_EVENT (s); | |
747 | |
748 tok_init(s); | |
749 | |
750 /* | |
751 * Parse next keyword and number of variables | |
752 */ | |
753 while ((valno = tok_next(&keyw,val)) NEQ TOK_EOCS) | |
754 { | |
755 switch ( tok_key((KW_DATA *)kwtab,keyw)) | |
756 { | |
757 case TOK_NOT_FOUND: | |
758 TRACE_ERROR ("[PEI_CONFIG]: Illegal Keyword"); | |
759 break; | |
760 | |
761 case FCR: /* fast cell reselection */ | |
762 TRACE_EVENT ("[PEI_CONFIG]: FAST CELL RESELECTION"); | |
763 rr_data->dyn_config.fcr = 1; | |
764 break; | |
765 | |
766 case SCS: | |
767 { | |
768 SHORT i = 0; | |
769 PALLOC (error_ind, MPH_ERROR_IND); | |
770 | |
771 TRACE_EVENT(" [PEI_CONFIG]: START CELL SELECTION"); | |
772 | |
773 for( i=0; i < 6; i++) | |
774 rr_data->nc_data[i].bcch_status = NON_DECODED; | |
775 /* | |
776 * Simulating Downlink Failure | |
777 */ | |
778 error_ind->cs = CS_DOWN_LINK_FAIL; | |
779 error_ind->arfcn = rr_data->nc_data[SC_INDEX].arfcn; | |
780 pei_primitive ((T_PRIM *)D2P(error_ind)); | |
781 } | |
782 break; | |
783 | |
784 case SCR: /* slow cell reselection */ | |
785 TRACE_EVENT ("[PEI_CONFIG]: SLOW CELL RESELECTION"); | |
786 rr_data->dyn_config.scr = 1; | |
787 break; | |
788 | |
789 | |
790 case DLE: /* downlink error */ | |
791 { | |
792 PALLOC (error_ind, MPH_ERROR_IND); | |
793 | |
794 TRACE_EVENT ("[PEI_CONFIG]: DOWNLINK ERROR"); | |
795 error_ind->cs = CS_DOWN_LINK_FAIL; | |
796 pei_primitive ((T_PRIM *)D2P(error_ind)); | |
797 } | |
798 break; | |
799 | |
800 case FRL: /* force radio link timeout */ | |
801 { | |
802 PALLOC (error_ind, MPH_ERROR_IND); | |
803 | |
804 TRACE_EVENT ("[PEI_CONFIG]: RADIO LINK ERROR"); | |
805 error_ind->cs = CS_RADIO_LINK_FAIL; | |
806 pei_primitive ((T_PRIM *)D2P(error_ind)); | |
807 } | |
808 break; | |
809 case FCA: /* failed channel assign */ | |
810 TRACE_EVENT ("[PEI_CONFIG]: FAILED CHANNEL ASSIGN"); | |
811 rr_data->dyn_config.fca = 1; | |
812 break; | |
813 | |
814 case FHO: /* forced handover */ | |
815 TRACE_EVENT ("[PEI_CONFIG]: FORCED HANDOVER"); | |
816 rr_data->dyn_config.fho = 1; | |
817 break; | |
818 | |
819 case IHO : /* Lock/Unlock the DUT to the cell it is already camping */ | |
820 TRACE_EVENT_P1("[PEI_CONFIG]: Lock/Unlock the DUT to the cell it is already camping : %s", val[0]); | |
821 rr_data->dyn_config.iho = atoi (val[0]); | |
822 break; | |
823 | |
824 case GSM_OFFSET: /* Offset for GSM channels */ | |
825 rr_data->dyn_config.gsm_offset = atoi (val[0]); | |
826 break; | |
827 | |
828 case DCS_OFFSET: /* Offset for DCS channels */ | |
829 rr_data->dyn_config.dcs_offset = atoi (val[0]); | |
830 break; | |
831 | |
832 case CTO: /* enable cell test operation mode */ | |
833 rr_data->cell_test_operation = TRUE; | |
834 break; | |
835 | |
836 case NKC: /* request to cipher when no ciphering key available */ | |
837 rr_data->dyn_config.nkc = TRUE; | |
838 break; | |
839 case BL_CS: /* Controls Black List search */ | |
840 if(valno) | |
841 { | |
842 valno = atoi (val[0]); | |
843 rr_data->dyn_config.bl_cs_en = valno ? 1 : 0; | |
844 TRACE_EVENT_P1("[PEI_CONFIG]: BL_CS : Black List search : %s", val[0]); | |
845 } | |
846 else | |
847 { | |
848 TRACE_ERROR ("[PEI_CONFIG]: BL_CS-Wrong Number of Parameters"); | |
849 } | |
850 break; | |
851 case U_RXT: /* Upper RxLev threshold Level*/ | |
852 if(valno>0 AND valno<=MAX_NUM_BANDS) | |
853 { | |
854 rr_csf_write_rxlev_thr( U_RXT, valno, val ); | |
855 } | |
856 else | |
857 { | |
858 TRACE_ERROR ("[PEI_CONFIG]: U_RXT-Wrong Number of Parameters"); | |
859 } | |
860 break; | |
861 case M_RXT: /* Medium threshold level*/ | |
862 if(valno>0 AND valno<=MAX_NUM_BANDS) | |
863 { | |
864 rr_csf_write_rxlev_thr( M_RXT, valno, val ); | |
865 } | |
866 else | |
867 { | |
868 TRACE_ERROR ("[PEI_CONFIG]: M_RXT-Wrong Number of Parameters"); | |
869 } | |
870 break; | |
871 case L_RXT: /* Lower threshold level*/ | |
872 if(valno>0 AND valno<=MAX_NUM_BANDS) | |
873 { | |
874 rr_csf_write_rxlev_thr( L_RXT, valno, val ); | |
875 } | |
876 else | |
877 { | |
878 TRACE_ERROR ("[PEI_CONFIG]: L_RXT-Wrong Number of Parameters"); | |
879 } | |
880 break; | |
881 case FBLS: /* Force Black List Search */ | |
882 if((GET_STATE(STATE_ATT) EQ ATT_IDLE) AND | |
883 (rr_data->ms_data.rr_service EQ FULL_SERVICE)) | |
884 { | |
885 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
886 if (rr_data->cs_data.region EQ BOTH_REGIONS) | |
887 { | |
888 if(srv_is_list_set(&rr_data->cs_data.black_list.list[EUROPEAN_REGION]) OR | |
889 srv_is_list_set(&rr_data->cs_data.black_list.list[AMERICAN_REGION])) | |
890 { | |
891 att_start_cell_selection(RR_ORIGINATED,CS_PARALLEL,BLACK_LIST_SEARCH_MODE); | |
892 } | |
893 else | |
894 TRACE_EVENT("Black List empty"); | |
895 } | |
896 else | |
897 { | |
898 #endif | |
899 if(srv_is_list_set( | |
900 &rr_data->cs_data.black_list.list[rr_data->cs_data.region])) | |
901 { | |
902 att_start_cell_selection(RR_ORIGINATED,CS_PARALLEL,BLACK_LIST_SEARCH_MODE); | |
903 } | |
904 else | |
905 TRACE_EVENT("Black List empty"); | |
906 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT | |
907 } | |
908 #endif | |
909 } | |
910 break; | |
911 case ID_RESTRICTED_BAND: | |
912 rr_data->dyn_config.set_band = atoi (val[0]); | |
913 | |
914 switch (GET_STATE (STATE_ATT)) | |
915 { | |
916 case ATT_NULL: | |
917 case ATT_NO_SERVICE: | |
918 case ATT_CS1: | |
919 case ATT_CS2: | |
920 case ATT_CS3: | |
921 case ATT_IDLE: | |
922 rr_data->ms_data.rr_service = NO_SERVICE; | |
923 att_code_rr_abort_ind (RRCS_ABORT_CEL_SEL_FAIL); | |
924 SET_STATE (STATE_ATT, ATT_NO_SERVICE); | |
925 | |
926 rr_data->cs_data.scan_mode = CS_FIRST_SCAN_FIRST_ATTEMPT; | |
927 | |
928 att_reset_old_lai_rac(); | |
929 | |
930 cs_set_null (); | |
931 cs_set_all (); | |
932 cs_start_scan (); | |
933 /* | |
934 * initialise cell selection parameter | |
935 */ | |
936 rr_data->sc_data.selection_type = CELL_SELECTION; | |
937 rr_data->sc_data.mm_started = FALSE; | |
938 rr_data->sc_data.found_entries = 0; | |
939 att_init_cr_data(); | |
940 | |
941 SET_STATE (STATE_ATT, ATT_CS1); | |
942 | |
943 switch (rr_data->dyn_config.set_band) | |
944 { | |
945 case 0: | |
946 TRACE_EVENT ("[PEI_CONFIG]: Set band to default"); | |
947 break; | |
948 case 1: | |
949 TRACE_EVENT ("[PEI_CONFIG]: Set band to GSM 900"); | |
950 break; | |
951 case 2: | |
952 TRACE_EVENT ("[PEI_CONFIG]: Set band to DCS 1800"); | |
953 break; | |
954 } /* switch (rr_data->set_band) */ | |
955 } /* switch (GET_STATE (STATE_ATT)) */ | |
956 break; | |
957 | |
958 case NO_SYS_TIME: | |
959 rr_data->dyn_config.no_sys_time = TRUE; | |
960 break; | |
961 | |
962 case SET_LAST_USED_SC: | |
963 if(valno) | |
964 { | |
965 rr_data->cs_data.white_list.last_sc_arfcn = atoi (val[0]); | |
966 TRACE_EVENT_P1("LAST SC ARFCN = %x",rr_data->cs_data.white_list.last_sc_arfcn); | |
967 } | |
968 else | |
969 { | |
970 TRACE_ERROR ("[PEI_CONFIG]: LAST_USED_SC-Wrong Number of Parameters"); | |
971 } | |
972 break; | |
973 | |
974 #if defined (_SIMULATION_FFS_) | |
975 case INIT_FFS: | |
976 rr_csf_ffs_init(); | |
977 TRACE_EVENT_P1("LAST SC ARFCN = %x",rr_data->cs_data.white_list.last_sc_arfcn); | |
978 break; | |
979 | |
980 case WRITE_FFS: | |
981 { | |
982 rr_csf_write_black_list(&rr_data->cs_data.black_list.list[0]); | |
983 rr_csf_write_white_list(&rr_data->cs_data.white_list); | |
984 } | |
985 break; | |
986 #endif /* _SIMULATION_FFS_ */ | |
987 | |
988 | |
989 #ifdef OPTION_TIMER | |
990 case TIMER_SET: | |
991 if (valno EQ 2) | |
992 { | |
993 t_man = TRUE; | |
994 t_num = tok_key((KW_DATA *)partab,val[0]); | |
995 t_val = atoi(val[1]); | |
996 if (t_val < 0L) | |
997 t_val = 0L; | |
998 } | |
999 else | |
1000 { | |
1001 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters"); | |
1002 } | |
1003 break; | |
1004 case TIMER_RESET: | |
1005 case TIMER_SUPPRESS: | |
1006 if (valno EQ 1) | |
1007 { | |
1008 t_man = TRUE; /* Timermanipulation */ | |
1009 t_num = tok_key((KW_DATA *)partab,val[0]); | |
1010 t_val = 0L; | |
1011 } | |
1012 else | |
1013 { | |
1014 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters"); | |
1015 } | |
1016 break; | |
1017 case TIMER_SPEED_UP: | |
1018 case TIMER_SLOW_DOWN: | |
1019 if (valno EQ 2) | |
1020 { | |
1021 t_man = TRUE; | |
1022 t_num = tok_key((KW_DATA *)partab,val[0]); | |
1023 t_val = atoi(val[1]); | |
1024 if (t_val <= 0L) | |
1025 t_val = 1L; | |
1026 } | |
1027 else | |
1028 { | |
1029 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters"); | |
1030 } | |
1031 break; | |
1032 case TIM_FAST: | |
1033 if(valno) | |
1034 { | |
1035 rr_data->dyn_config.tfast_cs_val = atoi(val[0])*60000; | |
1036 TRACE_EVENT_P1("[PEI_CONFIG]TFAST_CS : %dms",rr_data->dyn_config.tfast_cs_val); | |
1037 if(!rr_data->dyn_config.tfast_cs_val) | |
1038 { | |
1039 if(IS_TIMER_ACTIVE(T_FAST_CS)) | |
1040 TIMERSTOP(T_FAST_CS); | |
1041 } | |
1042 } | |
1043 else | |
1044 { | |
1045 TRACE_ERROR ("[PEI_CONFIG]: TFAST_CS-Wrong Number of Parameters"); | |
1046 } | |
1047 break; | |
1048 case TIM_NORMAL: | |
1049 if(valno) | |
1050 { | |
1051 rr_data->dyn_config.tnormal_cs_val = atoi(val[0])*60000; | |
1052 TRACE_EVENT_P1("[PEI_CONFIG]TNORMAL_CS : %dms",rr_data->dyn_config.tnormal_cs_val); | |
1053 if(!rr_data->dyn_config.tnormal_cs_val) | |
1054 { | |
1055 if(IS_TIMER_ACTIVE(T_NORMAL_CS)) | |
1056 TIMERSTOP(T_NORMAL_CS); | |
1057 } | |
1058 } | |
1059 else | |
1060 { | |
1061 TRACE_ERROR ("[PEI_CONFIG]: TNORMAL_CS-Wrong Number of Parameters"); | |
1062 } | |
1063 break; | |
1064 | |
1065 | |
1066 #endif | |
1067 | |
1068 #if defined (_SIMULATION_) | |
1069 case RR_MT_CALL: | |
1070 /* | |
1071 * Start mobile terminated call | |
1072 * if simulation is enabled | |
1073 */ | |
1074 break; | |
1075 case RR_MT_SMS_0: | |
1076 /* | |
1077 * Start mobile terminated SMS class 0 | |
1078 * if simulation is enabled | |
1079 */ | |
1080 break; | |
1081 case RR_MT_SMS_2: | |
1082 /* | |
1083 * Start mobile terminated SMS class 0 | |
1084 * if simulation is enabled | |
1085 */ | |
1086 break; | |
1087 case RR_SERVICE_FULL: | |
1088 /* | |
1089 * Set full service | |
1090 * if simulation is enabled | |
1091 */ | |
1092 break; | |
1093 case RR_SERVICE_LIMITED: | |
1094 /* | |
1095 * Set limited service | |
1096 * if simulation is enabled | |
1097 */ | |
1098 break; | |
1099 case RR_SERVICE_NO: | |
1100 /* | |
1101 * Set no service | |
1102 * if simulation is enabled | |
1103 */ | |
1104 break; | |
1105 case RR_MO_CONNECT: | |
1106 break; | |
1107 | |
1108 case ID_PSEUDO_SYNC_HO: | |
1109 if (valno) | |
1110 { | |
1111 if (atoi (val[0])) | |
1112 rr_data->ms_data.rf_cap.ps = TRUE; | |
1113 else | |
1114 rr_data->ms_data.rf_cap.ps = FALSE; | |
1115 TRACE_EVENT_P1 ("PSEUDO_SYNC_HO capability changed (%u)", | |
1116 rr_data->ms_data.rf_cap.ps); | |
1117 rr_csf_fit_capability (); | |
1118 } | |
1119 else | |
1120 { | |
1121 TRACE_ERROR("[PEI_CONFIG]: use CONFIG PSEUDO_SYNC_HO=<value>"); | |
1122 } | |
1123 break; | |
1124 case DCS_PCLASS_3 : | |
1125 TRACE_EVENT_P1("DCS_PCLASS_3 old [%d] -> new[3]", | |
1126 rr_data->ms_data.rf_cap.rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class); | |
1127 rr_data->ms_data.rf_cap.rf_power.pow_class4[IDX_PWRCLASS_1800].pow_class = POWER_CLASS_3; | |
1128 break; | |
1129 case ID_PCM: /* sample: COMMAND ("RR CONFIG PCM=<MSCAP,0x0F,0xb7,0b10001010,0,0,0>") */ | |
1130 if (valno) | |
1131 { | |
1132 UBYTE b[NMAX_VAL-1]; | |
1133 UBYTE version,ok=1; | |
1134 USHORT i,n=valno-1; | |
1135 | |
1136 if ( pcm_ReadFile ( val[0], n, b, &version) EQ PCM_OK) | |
1137 { | |
1138 for ( i = 0; i < n; ++i ) | |
1139 { | |
1140 UBYTE c,*p = val[i+1]; | |
1141 int dig,z = 0; | |
1142 UBYTE base; | |
1143 | |
1144 if ( p[0] EQ '0' ) | |
1145 { | |
1146 if ( p[1] EQ 'x' OR p[1] EQ 'X' ) { p += 2; base = 16; } else | |
1147 if ( p[1] EQ 'b' OR p[1] EQ 'B' ) { p += 2; base = 2; } else | |
1148 base = 8; | |
1149 } | |
1150 else | |
1151 base = 10; | |
1152 | |
1153 while ( ok AND (c = *p++) != '\0' ) | |
1154 { | |
1155 if ( c >= '0' AND c <= '9' ) dig = c - '0'; else | |
1156 if ( c >= 'A' AND c <= 'F' ) dig = c - 'A' + 10; else | |
1157 if ( c >= 'a' AND c <= 'f' ) dig = c - 'a' + 10; else | |
1158 { | |
1159 ok = 0; | |
1160 break; | |
1161 } | |
1162 | |
1163 if ( base EQ 2 ) ok = dig >= 0 AND dig <= 1; else | |
1164 if ( base EQ 8 ) ok = dig >= 0 AND dig <= 7; else | |
1165 if ( base EQ 10 ) ok = dig >= 0 AND dig <= 9; else | |
1166 if ( base EQ 16 ) ok = dig >= 0 AND dig <= 15; | |
1167 | |
1168 if ( ok ) | |
1169 z = z * base + dig; | |
1170 }; | |
1171 | |
1172 if ( ok ) | |
1173 { | |
1174 TRACE_EVENT_P4 ( "%s[%d]: 0x%02x -> 0x%02x", val[0], i, b[i], z ); | |
1175 b[i] = z; | |
1176 } | |
1177 else | |
1178 { | |
1179 TRACE_EVENT_P1 ( "invalid number:%s", val[i+1] ); | |
1180 break; | |
1181 } | |
1182 } | |
1183 | |
1184 if ( ok ) | |
1185 { | |
1186 if ( pcm_WriteFile ( val[0], n, b) EQ PCM_OK) | |
1187 { | |
1188 rr_csf_read_rfcap (); | |
1189 rr_csf_fit_capability (); | |
1190 rr_csf_read_imei (&rr_data->ms_data.imei); | |
1191 rr_csf_ms_cap (); | |
1192 | |
1193 } | |
1194 else | |
1195 { | |
1196 TRACE_EVENT ( "cannot perform PCM write action" ); | |
1197 } | |
1198 } | |
1199 } | |
1200 else | |
1201 { | |
1202 TRACE_EVENT ( "cannot perform PCM read action" ); | |
1203 } | |
1204 | |
1205 TRACE_EVENT_P1 ( "PCM '%s' " , val[0] ); | |
1206 } | |
1207 else | |
1208 { | |
1209 TRACE_ERROR("[PEI_CONFIG]: use PCM=<value>"); | |
1210 } | |
1211 break; | |
1212 | |
1213 #endif /* _SIMULATION_ */ | |
1214 #if defined(_SIMULATION_FFS_) | |
1215 case SHIELD: | |
1216 if(!valno) | |
1217 { | |
1218 memset(&rr_data->dyn_config.mcc_shield,0,sizeof(T_shield_mcc)); | |
1219 } | |
1220 else | |
1221 { | |
1222 rr_data->dyn_config.mcc_shield.enabled = TRUE; | |
1223 if(valno > MAX_MCC_SHIELD) | |
1224 { | |
1225 TRACE_ERROR("max configurable mcc shield values are four"); | |
1226 valno = MAX_MCC_SHIELD; | |
1227 } | |
1228 index = rr_data->dyn_config.mcc_shield.index; | |
1229 for(count=0;count< valno;count++) | |
1230 { | |
1231 if(index >= MAX_MCC_SHIELD) | |
1232 { | |
1233 index = 0; | |
1234 } | |
1235 mcc_val = atoi(val[count]); | |
1236 if(!mcc_val) | |
1237 { | |
1238 TRACE_ERROR("mcc value cannot be zero"); | |
1239 } | |
1240 else | |
1241 { | |
1242 mcc[0] = (mcc_val/100); | |
1243 mcc[1] = (mcc_val/10)%10; | |
1244 mcc[2] = (mcc_val % 10); | |
1245 if(!rr_csf_mcc_present(mcc)) | |
1246 { | |
1247 memcpy(rr_data->dyn_config.mcc_shield.mcc[index],mcc,SIZE_MCC); | |
1248 index++; | |
1249 } | |
1250 } | |
1251 } | |
1252 rr_data->dyn_config.mcc_shield.index = index; | |
1253 | |
1254 } | |
1255 rr_csf_write_mcc_shield_to_ffs(); | |
1256 break; | |
1257 #endif /* defined(_SIMULATION_FFS_)*/ | |
1258 case ID_MULTISLOT_CLASS: | |
1259 if (valno EQ 1) | |
1260 { | |
1261 UBYTE ms = atoi (val[0]); | |
1262 TRACE_EVENT_P1 ("MULTISLOT_CLASS changed (%u)", ms); | |
1263 rr_data->ms_data.multislot_class_configured = TRUE; | |
1264 rr_data->ms_data.rf_cap.rf_ms.gprs_ms_class = ms; | |
1265 #ifdef GPRS | |
1266 #ifdef REL99 | |
1267 rr_data->ms_data.ra_cap.ra_cap_values.acc_cap.v_ms_struct = SUPPORTED; | |
1268 rr_data->ms_data.ra_cap.ra_cap_values.acc_cap.ms_struct.gprs_struct.gprs_ms_class = ms; | |
1269 if (rr_data->ms_data.ra_cap.c_ra_cap_r EQ MAX_ADD_RA_CAP) | |
1270 #else | |
1271 rr_data->ms_data.ra_cap.acc_cap.v_ms_struct = SUPPORTED; | |
1272 rr_data->ms_data.ra_cap.acc_cap.ms_struct.gprs_struct.gprs_ms_class = ms; | |
1273 if (rr_data->ms_data.ra_cap.v_ra_cap2) | |
1274 #endif | |
1275 { | |
1276 /* | |
1277 * zero means that the same value for multislot parameters as given | |
1278 * in an earlier access capabilities field within this IE apply | |
1279 * also here. | |
1280 */ | |
1281 #ifdef REL99 | |
1282 rr_data->ms_data.ra_cap.ra_cap_r[0].ra_cap_values.acc_cap.v_ms_struct = FALSE; | |
1283 #else | |
1284 rr_data->ms_data.ra_cap.ra_cap2.acc_cap.v_ms_struct = FALSE; | |
1285 #endif | |
1286 } | |
1287 #endif | |
1288 } | |
1289 else | |
1290 { | |
1291 TRACE_ERROR("[PEI_CONFIG]: use CONFIG MULTISLOT_CLASS=<value>"); | |
1292 } | |
1293 break; | |
1294 case ID_CMSP: | |
1295 if (valno EQ 1) | |
1296 { | |
1297 BOOL cmsp = atoi (val[0]); | |
1298 if (cmsp) | |
1299 cmsp = 1; /* boolean */ | |
1300 TRACE_EVENT_P2 ("CMSP changed (%u->%u)", rr_data->ms_data.rf_cap.cmsp, cmsp); | |
1301 rr_data->ms_data.cmsp_configured = TRUE; | |
1302 rr_data->ms_data.rf_cap.cmsp = cmsp; | |
1303 } | |
1304 else | |
1305 { | |
1306 TRACE_ERROR("[PEI_CONFIG]: use CONFIG CMSP=<0|1>"); | |
1307 } | |
1308 break; | |
1309 #if defined(_TARGET_) | |
1310 #endif /* _TARGET_ */ | |
1311 #if defined (_SIMULATION_FFS_) | |
1312 case ERASE_WL: | |
1313 /*lint -e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1314 cs_clear_white_list (CLR_WHITE_LIST_RAM | CLR_WHITE_LIST_SIM | CLR_WHITE_LIST_FFS); | |
1315 /*lint +e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1316 break; | |
1317 case ERASE_BL: | |
1318 /*lint -e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1319 cs_clear_black_list (CLR_BLACK_LIST_RAM | CLR_BLACK_LIST_FFS); | |
1320 /*lint +e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1321 break; | |
1322 #endif /* _SIMULATION_FFS_ */ | |
1323 case SHOW_BL: | |
1324 /*lint -e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1325 srv_trace_black_list (); | |
1326 /*lint +e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1327 break; | |
1328 case SHOW_WL: | |
1329 /*lint -e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1330 srv_trace_white_list (); | |
1331 /*lint +e655 (Warning -- bit-wise operation uses (compatible) enum's)*/ | |
1332 break; | |
1333 case SET_WL: | |
1334 if(valno < 2) | |
1335 { | |
1336 TRACE_ERROR("[PEI_CONFIG]: wrong Number of Parameters"); | |
1337 } | |
1338 else | |
1339 { | |
1340 UBYTE c_region; | |
1341 USHORT c_arfcn; | |
1342 UBYTE i; | |
1343 | |
1344 if(valno > 6) | |
1345 valno = 6; /* 1 to 5 ARFCNs can be configured at a time */ | |
1346 | |
1347 c_region = atoi(val[0]); | |
1348 if(cs_check_region(c_region)) | |
1349 { | |
1350 rr_data->cs_data.white_list.region = c_region; | |
1351 | |
1352 for(i=1;i<valno;i++) | |
1353 { | |
1354 c_arfcn = atoi(val[i]); | |
1355 if(cs_check_arfcn_range(c_arfcn)) | |
1356 { | |
1357 srv_set_channel(&rr_data->cs_data.white_list.list,c_arfcn); | |
1358 TRACE_EVENT_P1("Arfcn:%d -> WL", c_arfcn); | |
1359 } /* arfcn */ | |
1360 } /* for */ | |
1361 } /* region */ | |
1362 } /* valno */ | |
1363 break; | |
1364 | |
1365 case SET_BL: | |
1366 if(valno < 2) | |
1367 { | |
1368 TRACE_ERROR("[PEI_CONFIG]: wrong Number of Parameters"); | |
1369 } | |
1370 else | |
1371 { | |
1372 UBYTE c_region; | |
1373 USHORT c_arfcn; | |
1374 UBYTE i; | |
1375 | |
1376 if(valno > 6) | |
1377 valno = 6; /* 1 to 5 ARFCNs can be configured at a time */ | |
1378 | |
1379 c_region = atoi(val[0]); | |
1380 if(cs_check_region(c_region)) | |
1381 { | |
1382 for(i=1;i<valno;i++) | |
1383 { | |
1384 c_arfcn = atoi(val[i]); | |
1385 if(cs_check_arfcn_range(c_arfcn)) | |
1386 { | |
1387 srv_set_channel(&rr_data->cs_data.black_list.list[c_region],c_arfcn); | |
1388 TRACE_EVENT_P1("Arfcn:%d -> BL", c_arfcn); | |
1389 } /* arfcn */ | |
1390 } /* for */ | |
1391 } /* region */ | |
1392 } /* valno */ | |
1393 break; | |
1394 case SET_WL_REGION: | |
1395 if(valno) | |
1396 { | |
1397 if(cs_check_region((U8)atoi (val[0]))) | |
1398 rr_data->cs_data.white_list.region = atoi (val[0]); | |
1399 } | |
1400 else | |
1401 { | |
1402 TRACE_ERROR ("[PEI_CONFIG]: wrong Number of Parameters"); | |
1403 } | |
1404 break; | |
1405 case SET_WL_PLMN: | |
1406 if(valno < 2) | |
1407 { | |
1408 TRACE_ERROR("[PEI_CONFIG]: wrong Number of Parameters"); | |
1409 } | |
1410 else | |
1411 { | |
1412 SHORT plmn = atoi (val[0]); | |
1413 /* copy MCC */ | |
1414 rr_data->cs_data.white_list.last_sc_lac.mcc[0] = (plmn/100); | |
1415 rr_data->cs_data.white_list.last_sc_lac.mcc[1] = (plmn/10)%10; | |
1416 rr_data->cs_data.white_list.last_sc_lac.mcc[2] = (plmn % 10); | |
1417 | |
1418 /* Copy MNC */ | |
1419 plmn = atoi (val[1]); | |
1420 rr_data->cs_data.white_list.last_sc_lac.mnc[0] = (plmn/100); | |
1421 rr_data->cs_data.white_list.last_sc_lac.mnc[1] = (plmn/10)%10; | |
1422 rr_data->cs_data.white_list.last_sc_lac.mnc[2] = (plmn % 10); | |
1423 | |
1424 if(!rr_data->cs_data.white_list.last_sc_lac.mnc[2]) | |
1425 rr_data->cs_data.white_list.last_sc_lac.mnc[2] = 0x0f; | |
1426 | |
1427 TRACE_EVENT_P6( "[PEI_CONFIG]SET_WL_PLMN MCC/MNC r=%x%x%x/%x%x%x", | |
1428 rr_data->cs_data.white_list.last_sc_lac.mcc[0], | |
1429 rr_data->cs_data.white_list.last_sc_lac.mcc[1], | |
1430 rr_data->cs_data.white_list.last_sc_lac.mcc[2], | |
1431 rr_data->cs_data.white_list.last_sc_lac.mnc[0], | |
1432 rr_data->cs_data.white_list.last_sc_lac.mnc[1], | |
1433 rr_data->cs_data.white_list.last_sc_lac.mnc[2]); | |
1434 | |
1435 } | |
1436 break; | |
1437 case SET_NPS_DELAY: | |
1438 if(valno) | |
1439 { | |
1440 rr_data->dyn_config.lim_ser_nps_delay = atoi (val[0]); | |
1441 } | |
1442 else | |
1443 { | |
1444 TRACE_ERROR ("[PEI_CONFIG]: wrong Number of Parameters"); | |
1445 } | |
1446 break; | |
1447 default: | |
1448 break; | |
1449 } | |
1450 | |
1451 #ifdef OPTION_TIMER | |
1452 /* | |
1453 * If timer manipulation | |
1454 */ | |
1455 | |
1456 if (t_man) | |
1457 { | |
1458 t_man = FALSE; | |
1459 if (t_num >= 0 AND t_num < MAX_RR_TIMER) | |
1460 ; /* vsi_t_config is removed in latest GPF */ | |
1461 else | |
1462 { | |
1463 TRACE_ERROR ("[PEI_CONFIG]: Parameter out of Range"); | |
1464 } | |
1465 } | |
1466 #endif | |
1467 } | |
1468 } /*!defined (NCONFIG)*/ | |
1469 #endif /*!defined (NCONFIG)*/ | |
1470 | |
1471 return PEI_OK; | |
1472 } | |
1473 #endif /* NCONFIG */ | |
1474 /* | |
1475 +--------------------------------------------------------------------+ | |
1476 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
1477 | STATE : code ROUTINE : rr_pei_config | | |
1478 +--------------------------------------------------------------------+ | |
1479 | |
1480 PURPOSE : Dynamic Configuration | |
1481 | |
1482 */ | |
1483 /*lint -esym(714,rr_pei_config) | Symbol not referenced | used by Frame */ | |
1484 /*lint -esym(765,rr_pei_config) | external could be made static | used by Frame */ | |
1485 /* Implements Measure#36 */ | |
1486 #if defined(NCONFIG) | |
1487 #else /* NCONFIG */ | |
1488 GLOBAL SHORT rr_pei_config ( char * inString, char * dummy ) | |
1489 { | |
1490 pei_config ( inString ); | |
1491 | |
1492 return PEI_OK; | |
1493 } | |
1494 #endif /* NCONFIG */ | |
1495 | |
1496 | |
1497 /* | |
1498 +--------------------------------------------------------------------+ | |
1499 | PROJECT : GSM-PS (6147) MODULE : RR_PEI | | |
1500 | STATE : code ROUTINE : pei_create | | |
1501 +--------------------------------------------------------------------+ | |
1502 | |
1503 PURPOSE : Create the Protocol Stack Entity | |
1504 | |
1505 */ | |
1506 /*lint -esym(714,rr_pei_create) | Symbol not referenced | used by Frame */ | |
1507 /*lint -esym(765,rr_pei_create) | external could be made static | used by Frame */ | |
1508 GLOBAL SHORT rr_pei_create (T_PEI_INFO **info) | |
1509 { | |
1510 static const T_PEI_INFO pei_info = | |
1511 { | |
1512 "RR", | |
1513 { | |
1514 pei_init, | |
1515 #ifdef _SIMULATION_ | |
1516 pei_exit, | |
1517 #else | |
1518 NULL, | |
1519 #endif | |
1520 pei_primitive, | |
1521 pei_timeout, | |
1522 NULL, /* no signal function */ | |
1523 NULL, /* no run function */ | |
1524 /* Implements Measure#36 */ | |
1525 #if defined(NCONFIG) | |
1526 NULL, /* no pei_config function */ | |
1527 #else /* NCONFIG */ | |
1528 pei_config, | |
1529 #endif /* NCONFIG */ | |
1530 NULL, | |
1531 }, | |
1532 #ifdef GPRS | |
1533 1736, /* Stack Size */ | |
1534 #else | |
1535 1936, /* Stack Size increase from 1436 to 1936 2007/5/31 */ | |
1536 #endif | |
1537 10, /* Queue Entries */ | |
1538 205, /* Priority */ | |
1539 NUM_OF_RR_TIMERS, /* number of timer */ | |
1540 /* flags */ | |
1541 #ifdef _TARGET_ | |
1542 #ifdef GPRS | |
1543 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND|INT_DATA_TASK | |
1544 #else | |
1545 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND | |
1546 #endif | |
1547 #else | |
1548 PASSIVE_BODY|COPY_BY_REF | |
1549 #endif | |
1550 }; | |
1551 | |
1552 TRACE_FUNCTION ("pei_create()"); | |
1553 | |
1554 /* | |
1555 * Close Resources if open | |
1556 */ | |
1557 | |
1558 #ifdef _SIMULATION_ | |
1559 if (first_access) | |
1560 first_access = FALSE; | |
1561 else | |
1562 pei_exit (); | |
1563 #endif | |
1564 | |
1565 /* | |
1566 * Export startup configuration data | |
1567 */ | |
1568 | |
1569 *info = (T_PEI_INFO *)&pei_info; | |
1570 | |
1571 return PEI_OK; | |
1572 } | |
1573 #endif |