FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/psa_sims.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : PSA_SIMS | |
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 signalling functions of the | |
18 | protocol stack adapter for the subscriber identity | |
19 | module. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef PSA_SIMS_C | |
24 #define PSA_SIMS_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 | |
29 /*==== INCLUDES ===================================================*/ | |
30 #include "aci_cmh.h" | |
31 #include "ati_cmd.h" | |
32 #include "aci_cmd.h" | |
33 #include "aci.h" | |
34 #include "psa.h" | |
35 #include "psa_sim.h" | |
36 | |
37 #include "aci_mem.h" | |
38 #ifdef SIM_TOOLKIT | |
39 #include "psa_cc.h" | |
40 #include "psa_sat.h" | |
41 #include "ati_src_sat.h" | |
42 #include "psa_tcpip.h" | |
43 #endif/* SIM_TOOLKIT */ | |
44 | |
45 #ifdef DTI | |
46 #include "dti.h" | |
47 #include "dti_conn_mng.h" | |
48 #include "dti_cntrl_mng.h" | |
49 #endif | |
50 | |
51 #if defined GPRS AND defined (DTI) | |
52 #include "gprs.h" | |
53 #include "gaci.h" | |
54 #include "gaci_cmh.h" | |
55 #include "gaci_srcc.h" | |
56 #include "psa_sm.h" | |
57 | |
58 #ifdef FAX_AND_DATA | |
59 #include "aci_fd.h" | |
60 #endif /* FAX_AND_DATA */ | |
61 | |
62 #endif /* GPRS */ | |
63 | |
64 #include "cmh.h" | |
65 | |
66 #if defined (GPRS) AND defined (DTI) | |
67 #include "cmh_sm.h" | |
68 #endif /* GPRS */ | |
69 | |
70 #include "cmh_sim.h" | |
71 #include "cmh_sat.h" | |
72 | |
73 #include "psa_util.h" | |
74 | |
75 #ifndef _SIMULATION_ | |
76 | |
77 /* temporary solution to get ffs.h included without GPRS to be set ! */ | |
78 #ifdef GPRS | |
79 #include "ffs/ffs.h" | |
80 #else | |
81 #include "ffs/ffs.h" | |
82 #undef GPRS | |
83 #endif /* GPRS */ | |
84 #include "ffs_coat.h" | |
85 | |
86 #endif /* !_SIMULATION_ */ | |
87 | |
88 | |
89 /*==== CONSTANTS ==================================================*/ | |
90 | |
91 | |
92 /*==== TYPES ======================================================*/ | |
93 | |
94 | |
95 /*==== EXPORT =====================================================*/ | |
96 | |
97 | |
98 /*==== VARIABLES ==================================================*/ | |
99 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
100 LOCAL BOOL Cust_Mode_Set = FALSE; | |
101 | |
102 /*==== FUNCTIONS ==================================================*/ | |
103 | |
104 GLOBAL BOOL psaSIM_hasCustModeBeenSet(void) | |
105 { | |
106 return Cust_Mode_Set; | |
107 } | |
108 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
109 /* | |
110 +-------------------------------------------------------------------+ | |
111 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
112 | ROUTINE : psaSIM_AccessSIMData | | |
113 +-------------------------------------------------------------------+ | |
114 | |
115 PURPOSE : access SIM data | |
116 | |
117 */ | |
118 | |
119 GLOBAL SHORT psaSIM_AccessSIMData ( void ) | |
120 { | |
121 SHORT aId; /* holds access id */ | |
122 | |
123 TRACE_FUNCTION ("psaSIM_AccessSIMData()"); | |
124 | |
125 /* | |
126 *------------------------------------------------------------------- | |
127 * determine access type | |
128 *------------------------------------------------------------------- | |
129 */ | |
130 aId = simShrdPrm.aId; | |
131 | |
132 switch( simShrdPrm.atb[aId].accType ) | |
133 { | |
134 /* | |
135 *--------------------------------------------------------------- | |
136 * read datafield | |
137 *--------------------------------------------------------------- | |
138 */ | |
139 case( ACT_RD_DAT ): | |
140 { | |
141 PALLOC (sim_read_req, SIM_READ_REQ); | |
142 | |
143 /* fill in primitive parameter: read data request */ | |
144 sim_read_req -> source = SRC_MMI; | |
145 sim_read_req -> req_id = (UBYTE)aId; | |
146 sim_read_req -> v_path_info = simShrdPrm.atb[aId].v_path_info; | |
147 if(sim_read_req -> v_path_info) | |
148 { | |
149 sim_read_req -> path_info = simShrdPrm.atb[aId].path_info; | |
150 } | |
151 sim_read_req -> datafield = simShrdPrm.atb[aId].reqDataFld; | |
152 sim_read_req -> offset = simShrdPrm.atb[aId].dataOff; | |
153 sim_read_req -> length = simShrdPrm.atb[aId].dataLen; | |
154 sim_read_req -> max_length = simShrdPrm.atb[aId].recMax; | |
155 PSENDX (SIM, sim_read_req); | |
156 } | |
157 break; | |
158 | |
159 /* | |
160 *--------------------------------------------------------------- | |
161 * write datafield | |
162 *--------------------------------------------------------------- | |
163 */ | |
164 case( ACT_WR_DAT ): | |
165 { | |
166 PALLOC (sim_update_req, SIM_UPDATE_REQ); | |
167 | |
168 /* fill in primitive parameter: update data request */ | |
169 sim_update_req -> source = SRC_MMI; | |
170 sim_update_req -> req_id = (UBYTE)aId; | |
171 sim_update_req -> v_path_info = simShrdPrm.atb[aId].v_path_info; | |
172 if(sim_update_req -> v_path_info) | |
173 { | |
174 sim_update_req -> path_info = simShrdPrm.atb[aId].path_info; | |
175 } | |
176 sim_update_req -> datafield = simShrdPrm.atb[aId].reqDataFld; | |
177 sim_update_req -> offset = simShrdPrm.atb[aId].dataOff; | |
178 sim_update_req -> length = simShrdPrm.atb[aId].dataLen; | |
179 memcpy (sim_update_req -> trans_data, simShrdPrm.atb[aId].exchData, | |
180 simShrdPrm.atb[aId].dataLen); | |
181 | |
182 PSENDX (SIM, sim_update_req); | |
183 } | |
184 break; | |
185 | |
186 /* | |
187 *--------------------------------------------------------------- | |
188 * read record | |
189 *--------------------------------------------------------------- | |
190 */ | |
191 case( ACT_RD_REC ): | |
192 { | |
193 PALLOC (sim_read_record_req, SIM_READ_RECORD_REQ); | |
194 | |
195 /* fill in primitive parameter: read absolute record request */ | |
196 sim_read_record_req -> source = SRC_MMI; | |
197 sim_read_record_req -> req_id = (UBYTE)aId; | |
198 sim_read_record_req -> v_path_info = simShrdPrm.atb[aId].v_path_info; | |
199 if(sim_read_record_req -> v_path_info) | |
200 { | |
201 sim_read_record_req -> path_info = simShrdPrm.atb[aId].path_info; | |
202 } | |
203 sim_read_record_req -> datafield = simShrdPrm.atb[aId].reqDataFld; | |
204 sim_read_record_req -> record = simShrdPrm.atb[aId].recNr; | |
205 if(simShrdPrm.atb[aId].check_dataLen) | |
206 { | |
207 sim_read_record_req -> length = NOT_PRESENT_8BIT; | |
208 } | |
209 else | |
210 { | |
211 sim_read_record_req -> length = simShrdPrm.atb[aId].dataLen; | |
212 } | |
213 PSENDX (SIM, sim_read_record_req); | |
214 } | |
215 break; | |
216 | |
217 /* | |
218 *--------------------------------------------------------------- | |
219 * write record | |
220 *--------------------------------------------------------------- | |
221 */ | |
222 case( ACT_WR_REC ): | |
223 { | |
224 PALLOC (sim_update_record_req, SIM_UPDATE_RECORD_REQ); | |
225 | |
226 /* fill in primitive parameter: update absolute record request */ | |
227 sim_update_record_req -> source = SRC_MMI; | |
228 sim_update_record_req -> req_id = (U8)aId; | |
229 sim_update_record_req -> v_path_info = simShrdPrm.atb[aId].v_path_info; | |
230 if(sim_update_record_req -> v_path_info) | |
231 { | |
232 sim_update_record_req -> path_info = simShrdPrm.atb[aId].path_info; | |
233 } | |
234 sim_update_record_req -> datafield = simShrdPrm.atb[aId].reqDataFld; | |
235 sim_update_record_req -> record = simShrdPrm.atb[aId].recNr; | |
236 sim_update_record_req -> length = simShrdPrm.atb[aId].dataLen; | |
237 memcpy (sim_update_record_req -> linear_data, | |
238 simShrdPrm.atb[aId].exchData, sim_update_record_req->length); | |
239 | |
240 PSENDX (SIM, sim_update_record_req); | |
241 } | |
242 break; | |
243 | |
244 /* | |
245 *--------------------------------------------------------------- | |
246 * increment datafield | |
247 *--------------------------------------------------------------- | |
248 */ | |
249 case( ACT_INC_DAT ): | |
250 { | |
251 PALLOC (sim_increment_req, SIM_INCREMENT_REQ); | |
252 | |
253 /* fill in primitive parameter: increment data request */ | |
254 sim_increment_req -> source = SRC_MMI; | |
255 sim_increment_req -> req_id = (U8)aId; | |
256 sim_increment_req -> v_path_info = simShrdPrm.atb[aId].v_path_info; | |
257 if(sim_increment_req -> v_path_info) | |
258 { | |
259 sim_increment_req -> path_info = simShrdPrm.atb[aId].path_info; | |
260 } | |
261 sim_increment_req -> datafield = simShrdPrm.atb[aId].reqDataFld; | |
262 sim_increment_req -> length = simShrdPrm.atb[aId].dataLen; | |
263 memcpy (sim_increment_req -> linear_data, simShrdPrm.atb[aId].exchData, | |
264 sim_increment_req->length); | |
265 | |
266 PSENDX (SIM, sim_increment_req); | |
267 } | |
268 break; | |
269 | |
270 /* | |
271 *--------------------------------------------------------------- | |
272 * illegal access type | |
273 *--------------------------------------------------------------- | |
274 */ | |
275 default: | |
276 | |
277 TRACE_EVENT("UNEXP ACCESS TYPE IN ATB"); | |
278 return( -1 ); | |
279 } | |
280 /* | |
281 *------------------------------------------------------------------- | |
282 * create and send primitive | |
283 *------------------------------------------------------------------- | |
284 */ | |
285 | |
286 return 0; | |
287 } | |
288 | |
289 /* | |
290 +-------------------------------------------------------------------+ | |
291 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
292 | ROUTINE : psaSIM_VerifyPIN | | |
293 +-------------------------------------------------------------------+ | |
294 | |
295 PURPOSE : verify a PIN | |
296 | |
297 */ | |
298 | |
299 GLOBAL SHORT psaSIM_VerifyPIN ( void ) | |
300 { | |
301 T_SIM_SET_PRM * pPrmSet; /* points to used parameter set */ | |
302 | |
303 TRACE_FUNCTION ("psaSIM_VerifyPIN()"); | |
304 | |
305 /* | |
306 *------------------------------------------------------------------- | |
307 * check owner id | |
308 *------------------------------------------------------------------- | |
309 */ | |
310 if(!psa_IsVldOwnId(simShrdPrm.owner)) | |
311 | |
312 return( -1 ); | |
313 | |
314 pPrmSet = &simShrdPrm.setPrm[simShrdPrm.owner]; | |
315 | |
316 /* | |
317 *------------------------------------------------------------------- | |
318 * create and send primitive | |
319 *------------------------------------------------------------------- | |
320 */ | |
321 { | |
322 PALLOC (sim_verify_pin_req, SIM_VERIFY_PIN_REQ); | |
323 | |
324 /* fill in primitive parameter: verify PIN request */ | |
325 sim_verify_pin_req -> source = SRC_MMI; | |
326 sim_verify_pin_req -> pin_id = pPrmSet -> PINType; | |
327 memcpy( sim_verify_pin_req -> pin, pPrmSet -> curPIN, PIN_LEN ); | |
328 | |
329 PSENDX (SIM, sim_verify_pin_req); | |
330 } | |
331 | |
332 return 0; | |
333 } | |
334 | |
335 /* | |
336 +-------------------------------------------------------------------+ | |
337 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
338 | ROUTINE : psaSIM_ChangePIN | | |
339 +-------------------------------------------------------------------+ | |
340 | |
341 PURPOSE : change a PIN | |
342 | |
343 */ | |
344 | |
345 GLOBAL SHORT psaSIM_ChangePIN ( void ) | |
346 { | |
347 T_SIM_SET_PRM * pPrmSet; /* points to used parameter set */ | |
348 | |
349 TRACE_FUNCTION ("psaSIM_ChangePIN()"); | |
350 | |
351 /* | |
352 *------------------------------------------------------------------- | |
353 * check owner id | |
354 *------------------------------------------------------------------- | |
355 */ | |
356 if(!psa_IsVldOwnId(simShrdPrm.owner)) | |
357 | |
358 return( -1 ); | |
359 | |
360 pPrmSet = &simShrdPrm.setPrm[simShrdPrm.owner]; | |
361 | |
362 /* | |
363 *------------------------------------------------------------------- | |
364 * create and send primitive | |
365 *------------------------------------------------------------------- | |
366 */ | |
367 { | |
368 PALLOC (sim_change_pin_req, SIM_CHANGE_PIN_REQ); | |
369 | |
370 /* fill in primitive parameter: change PIN request */ | |
371 sim_change_pin_req -> source = SRC_MMI; | |
372 sim_change_pin_req -> pin_id = pPrmSet -> PINType; | |
373 memcpy( sim_change_pin_req -> old_pin, pPrmSet -> curPIN, PIN_LEN ); | |
374 memcpy( sim_change_pin_req -> new_pin, pPrmSet -> newPIN, PIN_LEN ); | |
375 | |
376 PSENDX (SIM, sim_change_pin_req); | |
377 } | |
378 | |
379 return 0; | |
380 } | |
381 | |
382 | |
383 /* | |
384 +-------------------------------------------------------------------+ | |
385 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
386 | ROUTINE : psaSIM_DisablePIN | | |
387 +-------------------------------------------------------------------+ | |
388 | |
389 PURPOSE : disable a PIN | |
390 | |
391 */ | |
392 | |
393 GLOBAL SHORT psaSIM_DisablePIN ( void ) | |
394 { | |
395 T_SIM_SET_PRM * pPrmSet; /* points to used parameter set */ | |
396 | |
397 TRACE_FUNCTION ("psaSIM_DisablePIN()"); | |
398 | |
399 /* | |
400 *------------------------------------------------------------------- | |
401 * check owner id | |
402 *------------------------------------------------------------------- | |
403 */ | |
404 if(!psa_IsVldOwnId(simShrdPrm.owner)) | |
405 | |
406 return( -1 ); | |
407 | |
408 pPrmSet = &simShrdPrm.setPrm[simShrdPrm.owner]; | |
409 | |
410 /* | |
411 *------------------------------------------------------------------- | |
412 * create and send primitive | |
413 *------------------------------------------------------------------- | |
414 */ | |
415 { | |
416 PALLOC (sim_disable_pin_req, SIM_DISABLE_PIN_REQ); | |
417 | |
418 /* fill in primitive parameter: disable PIN request */ | |
419 sim_disable_pin_req -> source = SRC_MMI; | |
420 memcpy( sim_disable_pin_req -> pin, pPrmSet -> curPIN, PIN_LEN ); | |
421 | |
422 PSENDX (SIM, sim_disable_pin_req); | |
423 } | |
424 | |
425 return 0; | |
426 } | |
427 | |
428 /* | |
429 +-------------------------------------------------------------------+ | |
430 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
431 | ROUTINE : psaSIM_EnablePIN | | |
432 +-------------------------------------------------------------------+ | |
433 | |
434 PURPOSE : enable a PIN | |
435 | |
436 */ | |
437 | |
438 GLOBAL SHORT psaSIM_EnablePIN ( void ) | |
439 { | |
440 T_SIM_SET_PRM * pPrmSet; /* points to used parameter set */ | |
441 | |
442 TRACE_FUNCTION ("psaSIM_EnablePIN()"); | |
443 | |
444 /* | |
445 *------------------------------------------------------------------- | |
446 * check owner id | |
447 *------------------------------------------------------------------- | |
448 */ | |
449 if(!psa_IsVldOwnId(simShrdPrm.owner)) | |
450 | |
451 return( -1 ); | |
452 | |
453 pPrmSet = &simShrdPrm.setPrm[simShrdPrm.owner]; | |
454 | |
455 /* | |
456 *------------------------------------------------------------------- | |
457 * create and send primitive | |
458 *------------------------------------------------------------------- | |
459 */ | |
460 { | |
461 PALLOC (sim_enable_pin_req, SIM_ENABLE_PIN_REQ); | |
462 | |
463 /* fill in primitive parameter: enable PIN request */ | |
464 sim_enable_pin_req -> source = SRC_MMI; | |
465 memcpy( sim_enable_pin_req -> pin, pPrmSet -> curPIN, PIN_LEN ); | |
466 | |
467 PSENDX (SIM, sim_enable_pin_req); | |
468 } | |
469 | |
470 return 0; | |
471 } | |
472 | |
473 /* | |
474 +-------------------------------------------------------------------+ | |
475 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
476 | ROUTINE : psaSIM_UnblockCard | | |
477 +-------------------------------------------------------------------+ | |
478 | |
479 PURPOSE : unblock the card | |
480 | |
481 */ | |
482 | |
483 GLOBAL SHORT psaSIM_UnblockCard ( void ) | |
484 { | |
485 T_SIM_SET_PRM * pPrmSet; /* points to used parameter set */ | |
486 | |
487 TRACE_FUNCTION ("psaSIM_UnblockCard()"); | |
488 | |
489 /* | |
490 *------------------------------------------------------------------- | |
491 * check owner id | |
492 *------------------------------------------------------------------- | |
493 */ | |
494 if(!psa_IsVldOwnId(simShrdPrm.owner)) | |
495 | |
496 return( -1 ); | |
497 | |
498 pPrmSet = &simShrdPrm.setPrm[simShrdPrm.owner]; | |
499 | |
500 /* | |
501 *------------------------------------------------------------------- | |
502 * create and send primitive | |
503 *------------------------------------------------------------------- | |
504 */ | |
505 { | |
506 PALLOC (sim_unblock_req, SIM_UNBLOCK_REQ); | |
507 | |
508 /* fill in primitive parameter: unblock card request */ | |
509 sim_unblock_req -> source = SRC_MMI; | |
510 sim_unblock_req -> pin_id = pPrmSet -> PINType; | |
511 memcpy( sim_unblock_req -> pin, pPrmSet -> curPIN, PIN_LEN ); | |
512 memcpy( sim_unblock_req -> unblock_key, pPrmSet -> unblkKey, PUK_LEN ); | |
513 | |
514 PSENDX (SIM, sim_unblock_req); | |
515 } | |
516 | |
517 return 0; | |
518 } | |
519 | |
520 /* | |
521 +-------------------------------------------------------------------+ | |
522 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
523 | ROUTINE : psaSIM_SyncSIM | | |
524 +-------------------------------------------------------------------+ | |
525 | |
526 PURPOSE : synchronize SIM data | |
527 | |
528 */ | |
529 | |
530 GLOBAL void psaSIM_SyncSIM ( void ) | |
531 { | |
532 TRACE_FUNCTION ("psaSIM_SyncSIM()"); | |
533 | |
534 /* create and send primitive */ | |
535 { | |
536 PALLOC (sim_sync_req, SIM_SYNC_REQ); | |
537 | |
538 /* fill in primitive parameter: synchronize request */ | |
539 | |
540 sim_sync_req -> synccs = simShrdPrm.synCs; | |
541 | |
542 PSENDX (SIM, sim_sync_req); | |
543 } | |
544 } | |
545 | |
546 /* | |
547 +-------------------------------------------------------------------+ | |
548 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
549 | ROUTINE : psaSIM_ActivateSIM | | |
550 +-------------------------------------------------------------------+ | |
551 | |
552 PURPOSE : synchronize SIM data | |
553 | |
554 */ | |
555 | |
556 GLOBAL SHORT psaSIM_ActivateSIM ( void ) | |
557 { | |
558 T_SIM_SET_PRM * pPrmSet; /* points to used parameter set */ | |
559 | |
560 TRACE_FUNCTION ("psaSIM_ActivateSIM()"); | |
561 | |
562 /* | |
563 *------------------------------------------------------------------- | |
564 * check owner id | |
565 *------------------------------------------------------------------- | |
566 */ | |
567 if(!psa_IsVldOwnId(simShrdPrm.owner)) | |
568 { | |
569 TRACE_EVENT("not a valid owner !!"); | |
570 return( -1 ); | |
571 } | |
572 | |
573 pPrmSet = &simShrdPrm.setPrm[simShrdPrm.owner]; | |
574 | |
575 /* | |
576 *------------------------------------------------------------------- | |
577 * create and send primitive | |
578 *------------------------------------------------------------------- | |
579 */ | |
580 { | |
581 PALLOC (sim_activate_req, SIM_ACTIVATE_REQ); | |
582 | |
583 /* fill in primitive parameter: activate request */ | |
584 sim_activate_req->proc = pPrmSet -> actProc; | |
585 | |
586 /* sim toolkit profile */ | |
587 memcpy( sim_activate_req->stk_pro_file, pPrmSet -> STKprof, | |
588 MAX_STK_PRF ); | |
589 sim_activate_req->mmi_pro_file = 0xE0; /*enable all*/ | |
590 | |
591 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
592 if (pPrmSet -> actProc EQ SIM_INITIALISATION) | |
593 { | |
594 if (psaSIM_hasCustModeBeenSet() == FALSE) | |
595 { | |
596 /* | |
597 ** Customisation Mode is to be global, applying to ALL ACI channels | |
598 */ | |
599 simShrdPrm.overall_cust_mode = pPrmSet->cust_mode; | |
600 Cust_Mode_Set = TRUE; | |
601 } | |
602 | |
603 sim_activate_req->cust_mode = simShrdPrm.overall_cust_mode; | |
604 } | |
605 else | |
606 { | |
607 /* | |
608 ** If this isn't SIM_INITIALISATION then the cust_mode will have no relevance, but it should | |
609 ** still not be left uninitialised. | |
610 */ | |
611 sim_activate_req->cust_mode = (psaSIM_hasCustModeBeenSet() == FALSE) ? | |
612 (UBYTE)CUST_NORMAL_BEHAVIOUR: simShrdPrm.overall_cust_mode; | |
613 } | |
614 #else | |
615 sim_activate_req->cust_mode = (UBYTE)CUST_NORMAL_BEHAVIOUR; | |
616 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
617 | |
618 if(sim_activate_req->proc EQ SIM_INITIALISATION) | |
619 { | |
620 sim_activate_req->v_trmst_file = 0x01; | |
621 TRACE_EVENT("Read Terminal Support table from FFS"); | |
622 #ifndef _SIMULATION_ | |
623 if(FFS_fread("/gsm/osf/ftrsprt", &sim_activate_req->trmst_file, MAX_TRMST) NEQ MAX_TRMST) | |
624 #endif /* _SIMULATION_ */ | |
625 { | |
626 memset(&sim_activate_req->trmst_file, 0, MAX_TRMST); | |
627 } | |
628 } | |
629 | |
630 PSENDX (SIM, sim_activate_req); | |
631 } | |
632 | |
633 return 0; | |
634 } | |
635 | |
636 /* | |
637 +-------------------------------------------------------------------+ | |
638 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
639 | ROUTINE : psaSIM_TrnsSIMAccess | | |
640 +-------------------------------------------------------------------+ | |
641 | |
642 PURPOSE : transparent access to SIM data | |
643 | |
644 */ | |
645 | |
646 GLOBAL SHORT psaSIM_TrnsSIMAccess ( T_SIM_TRNS_ACC_PRM * prm ) | |
647 { | |
648 | |
649 TRACE_FUNCTION ("psaSIM_TrnsSIMAccess()"); | |
650 | |
651 /* | |
652 *------------------------------------------------------------------- | |
653 * create and send primitive | |
654 *------------------------------------------------------------------- | |
655 */ | |
656 { | |
657 PALLOC (sim_access_req, SIM_ACCESS_REQ); | |
658 | |
659 /* fill in primitive parameter: SIM access request */ | |
660 sim_access_req -> source = SRC_MMI; | |
661 sim_access_req -> sim_command = prm -> cmd; | |
662 | |
663 if (prm->cmd NEQ SIM_TRANSP_CMD) | |
664 { | |
665 sim_access_req -> datafield = prm -> reqDataFld; | |
666 sim_access_req -> p1 = prm -> p1; | |
667 sim_access_req -> p2 = prm -> p2; | |
668 sim_access_req -> p3 = prm -> p3; | |
669 } | |
670 | |
671 sim_access_req->c_trans_data = prm -> dataLen; | |
672 memcpy( sim_access_req -> trans_data, prm -> transData, | |
673 prm -> dataLen ); | |
674 | |
675 PSENDX (SIM, sim_access_req); | |
676 } | |
677 | |
678 return 0; | |
679 } | |
680 | |
681 /* | |
682 +-------------------------------------------------------------------+ | |
683 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
684 | ROUTINE : psaSIM_Bpi_Req | | |
685 +-------------------------------------------------------------------+ | |
686 | |
687 PURPOSE : resume/suspend/connect/disconnect SAT BIP connection. | |
688 */ | |
689 #if defined (FF_SAT_E) AND defined (DTI) | |
690 GLOBAL void psaSIM_Bip_Req ( void ) | |
691 { | |
692 T_SAT_CSD_PRM * csd_prm_ptr; | |
693 | |
694 TRACE_EVENT("psaSIM_Bip_Req()"); | |
695 | |
696 if (simShrdPrm.sim_dti_chPrm EQ NULL) | |
697 { | |
698 TRACE_ERROR ("ERROR: simShrdPrm.sim_dti_chPrm uninitalized, aborting!"); | |
699 } | |
700 else | |
701 { | |
702 PALLOC(sim_bip_req,SIM_BIP_REQ); | |
703 memset(sim_bip_req,0,sizeof(sim_bip_req)); | |
704 | |
705 /* copy connection qualifier */ | |
706 sim_bip_req->bip_conn = simShrdPrm.sim_dti_chPrm->sat_chn_prm.bipConn; | |
707 /* copy channel id */ | |
708 sim_bip_req->bip_ch_id = simShrdPrm.sim_dti_chPrm->sat_chn_prm.chnId; | |
709 /* copy general result */ | |
710 sim_bip_req->general_result = simShrdPrm.sim_dti_chPrm->sat_chn_prm.genRes; | |
711 /* copy additional result info */ | |
712 sim_bip_req->add_info_result = simShrdPrm.sim_dti_chPrm->sat_chn_prm.addRes; | |
713 | |
714 /* copy release timer to primitive, if CSD and if duration defined */ | |
715 /* SAT_E_PATCH: Should be ported to SIM_BIP_CONFIG_REQ? */ | |
716 if(satShrdPrm.opchType EQ B_CSD) | |
717 { | |
718 csd_prm_ptr = (T_SAT_CSD_PRM *)(satShrdPrm.opchPrm); | |
719 if(csd_prm_ptr NEQ NULL) | |
720 { | |
721 if(csd_prm_ptr->v_dur2) | |
722 { | |
723 switch(csd_prm_ptr->dur2.time_unit) | |
724 { | |
725 case TU_100_MSEC: | |
726 sim_bip_req->release_time = (U32)csd_prm_ptr->dur2.time_ivl; | |
727 break; | |
728 case TU_MIN: | |
729 sim_bip_req->release_time = (U32)(csd_prm_ptr->dur2.time_ivl * 600); | |
730 break; | |
731 case TU_SEC: | |
732 sim_bip_req->release_time = (U32)(csd_prm_ptr->dur2.time_ivl * 10); | |
733 break; | |
734 } /* end switch */ | |
735 } /* end if */ | |
736 } /* end if csd_prm_ptr NEQ NULL */ | |
737 } /* end if */ | |
738 | |
739 /* SEND SIM_BIP_REQ */ | |
740 PSENDX(SIM,sim_bip_req); | |
741 } /* end else*/ | |
742 | |
743 } | |
744 | |
745 /* | |
746 +-------------------------------------------------------------------+ | |
747 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
748 | ROUTINE : psaSIM_Bip_Config_Req | | |
749 +-------------------------------------------------------------------+ | |
750 | |
751 PURPOSE : sends the BIP channel parameters to SIM. The type of | |
752 parameters depends on the transport unit. | |
753 */ | |
754 | |
755 GLOBAL void psaSIM_Bip_Config_Req ( ) | |
756 { | |
757 T_SAT_CSD_PRM * csd_prm_ptr; /* holds pointer to CSD open channel prms */ | |
758 T_SAT_GPRS_PRM * gprs_prm_ptr; /* holds pointer to GPRS open channel prms */ | |
759 | |
760 /* allocate SIM_BIP_CONFIG_REQ primitive */ | |
761 PALLOC(sim_bip_config_req,SIM_BIP_CONFIG_REQ); | |
762 | |
763 TRACE_EVENT("psaSIM_Bip_Config_Req()"); | |
764 | |
765 /* reset values of primitive */ | |
766 memset(sim_bip_config_req,0,sizeof(sim_bip_config_req)); | |
767 /* check kind of bearer */ | |
768 if(satShrdPrm.opchType EQ B_CSD) | |
769 { | |
770 /* BEARER: CSD */ | |
771 | |
772 /* get connection type */ | |
773 switch(simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiUnit) | |
774 { | |
775 case DTI_ENTITY_UDP: | |
776 sim_bip_config_req->con_type = SIM_CON_TYPE_UDP; | |
777 break; | |
778 #ifdef UART | |
779 case DTI_ENTITY_TRA: | |
780 sim_bip_config_req->con_type = SIM_CON_TYPE_SERIAL; | |
781 break; | |
782 case DTI_ENTITY_L2R: | |
783 sim_bip_config_req->con_type = SIM_CON_TYPE_SERIAL; | |
784 break; | |
785 #endif | |
786 } | |
787 | |
788 /* get addresses */ | |
789 /* local_ip,destination_ip, destination port are only valid for UDP */ | |
790 if(simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiUnit EQ DTI_ENTITY_UDP) | |
791 { | |
792 csd_prm_ptr = (T_SAT_CSD_PRM *)(satShrdPrm.opchPrm); | |
793 if(csd_prm_ptr->v_other_addr) | |
794 { | |
795 if(csd_prm_ptr->other_addr.oth_addr_type EQ IPv4) | |
796 { | |
797 if(csd_prm_ptr->other_addr.v_ipv4_addr)/* local IP address */ | |
798 { | |
799 memcpy(&sim_bip_config_req->local_ip, | |
800 &csd_prm_ptr->other_addr.ipv4_addr, | |
801 sizeof(csd_prm_ptr->other_addr.ipv4_addr)); | |
802 } | |
803 else /* not valid */ | |
804 { | |
805 sim_bip_config_req->local_ip = SIM_IP_LOCAL_DYNAMIC; | |
806 } | |
807 } | |
808 else /* not supported IPv6*/ | |
809 { | |
810 sim_bip_config_req->local_ip = SIM_IP_LOCAL_DYNAMIC; | |
811 } | |
812 } | |
813 else | |
814 { | |
815 sim_bip_config_req->local_ip = SIM_IP_LOCAL_DYNAMIC; | |
816 } | |
817 | |
818 /* data destination address */ | |
819 if(csd_prm_ptr->v_dda) | |
820 { | |
821 if(csd_prm_ptr->dda.oth_addr_type EQ IPv4) | |
822 { | |
823 if(csd_prm_ptr->dda.v_ipv4_addr)/* local IP address */ | |
824 { | |
825 memcpy(&sim_bip_config_req->destination_ip, | |
826 &csd_prm_ptr->dda.ipv4_addr, | |
827 sizeof(csd_prm_ptr->dda.ipv4_addr)); | |
828 } | |
829 } | |
830 | |
831 /* SIM/ME interface transport level:destination port number for UDP */ | |
832 if(csd_prm_ptr->v_itl) | |
833 { | |
834 sim_bip_config_req->destination_port = csd_prm_ptr->itl.port_number; | |
835 } | |
836 } | |
837 } | |
838 } | |
839 else if (satShrdPrm.opchType EQ B_GPRS) | |
840 { | |
841 /* BEARER: GPRS */ | |
842 #ifdef GPRS | |
843 /* get connecton type */ | |
844 switch(simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiUnit) | |
845 { | |
846 case DTI_ENTITY_UDP: | |
847 sim_bip_config_req->con_type = SIM_CON_TYPE_UDP; | |
848 break; | |
849 case DTI_ENTITY_SNDCP: | |
850 sim_bip_config_req->con_type = SIM_CON_TYPE_IP; | |
851 break; | |
852 } | |
853 | |
854 /* get port and addresses */ | |
855 gprs_prm_ptr = (T_SAT_GPRS_PRM *)(satShrdPrm.opchPrm); | |
856 if(gprs_prm_ptr NEQ NULL) | |
857 { | |
858 /* local_ip,destination_ip, destination port are only valid for UDP */ | |
859 if(simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiUnit EQ DTI_ENTITY_UDP) | |
860 { | |
861 /* get local ip address */ | |
862 if(gprs_prm_ptr->v_other_addr) | |
863 { | |
864 if(gprs_prm_ptr->other_addr.oth_addr_type EQ IPv4) | |
865 { | |
866 if(gprs_prm_ptr->other_addr.v_ipv4_addr)/* local IP address */ | |
867 { | |
868 memcpy(&sim_bip_config_req->local_ip, | |
869 &gprs_prm_ptr->other_addr.ipv4_addr, | |
870 sizeof(gprs_prm_ptr->other_addr.ipv4_addr)); | |
871 } | |
872 else /* not valid */ | |
873 { | |
874 sim_bip_config_req->local_ip = SIM_IP_LOCAL_DYNAMIC; | |
875 } | |
876 } | |
877 else /* not supported IPv6*/ | |
878 { | |
879 sim_bip_config_req->local_ip = SIM_IP_LOCAL_DYNAMIC; | |
880 } | |
881 } | |
882 else /* not valid flag for other address */ | |
883 { | |
884 /* | |
885 * local IP4 address has been provided by Session Management; it was not provided by the OPEN CHANNEL command | |
886 */ | |
887 if(tcpipShrdPrm.ipaddr) | |
888 { | |
889 sim_bip_config_req->local_ip = psaTCPIP_bytes2ipv4addr(tcpipShrdPrm.ipaddr); | |
890 } | |
891 else | |
892 { | |
893 sim_bip_config_req->local_ip = SIM_IP_LOCAL_DYNAMIC; | |
894 } | |
895 } | |
896 | |
897 /* get data destination address */ | |
898 if(gprs_prm_ptr->v_dda) | |
899 { | |
900 if(gprs_prm_ptr->dda.oth_addr_type EQ IPv4) | |
901 { | |
902 if(gprs_prm_ptr->dda.v_ipv4_addr)/* local IP address */ | |
903 { | |
904 memcpy(&sim_bip_config_req->destination_ip, | |
905 &gprs_prm_ptr->dda.ipv4_addr, | |
906 sizeof(gprs_prm_ptr->dda.ipv4_addr)); | |
907 } | |
908 } | |
909 } | |
910 | |
911 /* get SIM/ME interface transport level:destination port number for UDP */ | |
912 if(gprs_prm_ptr->v_itl) | |
913 { | |
914 sim_bip_config_req->destination_port = gprs_prm_ptr->itl.port_number; | |
915 } | |
916 } | |
917 } | |
918 | |
919 #else /* GPRS */ | |
920 PFREE(sim_bip_config_req); | |
921 TRACE_ERROR("psaSIM_Bip_Config_Req(): ERROR stack does not support GPRS"); | |
922 #endif /* GPRS */ | |
923 } | |
924 else /* BEARER: unknown */ | |
925 { | |
926 TRACE_ERROR("psaSIM_Bip_Config_Req(): ERROR unkown bearer"); | |
927 } | |
928 /* send primitive to SIM */ | |
929 PSENDX(SIM,sim_bip_config_req); | |
930 } | |
931 | |
932 /* | |
933 +-------------------------------------------------------------------+ | |
934 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
935 | ROUTINE : psaSIM_Dti_Req | | |
936 +-------------------------------------------------------------------+ | |
937 | |
938 PURPOSE : connection SIM with UDP,TRA or L2R in context CSD | |
939 connection SIM with UDP or SNDCP in context GPRS | |
940 request by proactive SIM CARD, set feature SAT CLASS e | |
941 sent parameter depends on kind of connection (dtiConn) | |
942 | |
943 This function sends the primitive SIM_DTI_REQ which is | |
944 only responsible for the establishment of the SIM DTI | |
945 channel! | |
946 */ | |
947 GLOBAL void psaSIM_Dti_Req ( ULONG link_id ) | |
948 { | |
949 #ifdef DTI | |
950 CHAR *p_ent_name=NULL; /* hold peer name */ | |
951 | |
952 TRACE_EVENT("psaSIM_Dti_Req"); | |
953 | |
954 if (simShrdPrm.sim_dti_chPrm EQ NULL) | |
955 { | |
956 /* when disconnecting if previos state connecting; | |
957 * will otherwise crash the stack in ACISAT473H */ | |
958 TRACE_ERROR ("simShrdPrm.sim_dti_chPrm uninitalized, aborting!"); | |
959 } | |
960 else | |
961 { | |
962 /* alloc primitive */ | |
963 PALLOC(sim_dti_req,SIM_DTI_REQ); | |
964 /* reset values */ | |
965 memset(sim_dti_req,0,sizeof(sim_dti_req)); | |
966 /* copy dti connection qualifier */ | |
967 sim_dti_req->dti_conn = simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiConn; | |
968 /* set dti direction */ | |
969 sim_dti_req->dti_direction = SIM_DTI_INVERTED; | |
970 | |
971 if( simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiConn EQ SIM_DTI_CONNECT ) | |
972 { | |
973 /* CASE: CONNECT IMMEDIATELY */ | |
974 /* copy link id */ | |
975 sim_dti_req->link_id = link_id; | |
976 | |
977 if(satShrdPrm.opchType EQ B_CSD) | |
978 { | |
979 /* BEARER: CSD */ | |
980 /* copy entity_name | |
981 * handle different transport protocols: L2R, RA and UDP */ | |
982 switch(simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiUnit) | |
983 { | |
984 case DTI_ENTITY_UDP: | |
985 p_ent_name = &UDP_NAME[0]; | |
986 break; | |
987 case DTI_ENTITY_TRA: | |
988 p_ent_name = &TRA_NAME[0]; | |
989 break; | |
990 case DTI_ENTITY_L2R: | |
991 p_ent_name = &L2R_NAME[0]; | |
992 break; | |
993 } | |
994 sim_dti_req->entity_name = (ULONG)p_ent_name; | |
995 } | |
996 #ifdef GPRS | |
997 else if(satShrdPrm.opchType EQ B_GPRS) | |
998 { | |
999 /* BEARER: GPRS */ | |
1000 /* copy entity_name | |
1001 * handle different transport protocols: L2R, RA and UDP */ | |
1002 switch(simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiUnit) | |
1003 { | |
1004 case DTI_ENTITY_UDP: | |
1005 p_ent_name = &UDP_NAME[0]; | |
1006 break; | |
1007 case DTI_ENTITY_SNDCP: | |
1008 p_ent_name = &SNDCP_NAME[0]; | |
1009 break; | |
1010 } | |
1011 sim_dti_req->entity_name = (ULONG)p_ent_name; | |
1012 } | |
1013 #endif /* GPRS */ | |
1014 else | |
1015 { | |
1016 TRACE_EVENT("psaSIM_Dti_Req:error"); | |
1017 } | |
1018 | |
1019 PSENDX(SIM,sim_dti_req); | |
1020 } /* end DTI open channel */ | |
1021 | |
1022 else if ( simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiConn EQ SIM_DTI_DISCONNECT ) | |
1023 { | |
1024 /* CASE: CLOSE DTI CHANNEL */ | |
1025 /* copy link id */ | |
1026 sim_dti_req->link_id = link_id; | |
1027 | |
1028 PSENDX(SIM,sim_dti_req); | |
1029 } | |
1030 | |
1031 else if ( simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiConn EQ SIM_DTI_UNKNOWN) | |
1032 { | |
1033 /* no primitive has to be send, free mem */ | |
1034 PFREE(sim_dti_req); | |
1035 | |
1036 /* check whether a BIP channel has to be closed */ | |
1037 if( simShrdPrm.sim_dti_chPrm->sat_chn_prm.bipConn | |
1038 EQ SIM_BIP_CLOSE_CHANNEL ) | |
1039 { | |
1040 /* No action has to be performed, DTI channel already disconnected by | |
1041 * SIM */ | |
1042 TRACE_EVENT("psaSIM_Dti_Req: SIM-DTI channel already disconnected"); | |
1043 | |
1044 /* inform dti manager about successfull disconnection */ | |
1045 | |
1046 TRACE_EVENT("psaSIM_Dti_Req: close open BIP channel"); | |
1047 /* send SIM_BIP_REQ to close BIP channel */ | |
1048 psaSIM_Bip_Req(); | |
1049 } | |
1050 else | |
1051 { | |
1052 TRACE_ERROR("psaSIM_Dti_Req: ERROR: Unkown parameter combination"); | |
1053 } | |
1054 } | |
1055 else | |
1056 { | |
1057 /* no primitive has to be send, free mem */ | |
1058 PFREE(sim_dti_req); | |
1059 | |
1060 TRACE_ERROR("psaSIM_Dti_Req: ERROR: Unkown parameter"); | |
1061 } | |
1062 } | |
1063 #endif | |
1064 } | |
1065 | |
1066 /* | |
1067 +-------------------------------------------------------------------+ | |
1068 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
1069 | ROUTINE : psaSIM_SATBIPChn | | |
1070 +-------------------------------------------------------------------+ | |
1071 | |
1072 PURPOSE : connect/disconnect/suspend/resume of BIP | |
1073 (Bearer Independent Protocol) connection for SAT | |
1074 (new for SAT_E_PATCH) | |
1075 */ | |
1076 | |
1077 GLOBAL void psaSIM_SATBIPChn ( T_SIM_SAT_CHN chnInf, | |
1078 void (*cb)(UBYTE bipConn, UBYTE chnId)) | |
1079 { | |
1080 TRACE_EVENT("psaSIM_SATBIPChn()"); | |
1081 | |
1082 #ifdef UART | |
1083 | |
1084 /* ALLOC shared paramenters for BIP if not yet done */ | |
1085 if(!simShrdPrm.sim_dti_chPrm) | |
1086 { | |
1087 ACI_MALLOC(simShrdPrm.sim_dti_chPrm,sizeof(T_SIM_DTI_CH_PRM)); | |
1088 /* reset parameters */ | |
1089 memset(simShrdPrm.sim_dti_chPrm,0,sizeof(T_SIM_DTI_CH_PRM)); | |
1090 TRACE_EVENT("ALLOC sim_dti_chPrm"); | |
1091 } | |
1092 | |
1093 /* copy bip related parameters */ | |
1094 simShrdPrm.sim_dti_chPrm->sat_chn_prm.bipConn = chnInf.bipConn; | |
1095 simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiConn = chnInf.dtiConn; | |
1096 simShrdPrm.sim_dti_chPrm->sat_chn_prm.chnId = chnInf.chnId; | |
1097 simShrdPrm.sim_dti_chPrm->sat_chn_prm.genRes = chnInf.genRes; | |
1098 simShrdPrm.sim_dti_chPrm->sat_chn_prm.addRes = chnInf.addRes; | |
1099 /* callback to process after of BIP connection request */ | |
1100 simShrdPrm.sim_dti_chPrm->bip_cb = cb; | |
1101 | |
1102 switch( chnInf.bipConn ) | |
1103 { | |
1104 case SIM_BIP_CLOSE_CHANNEL: | |
1105 | |
1106 if(chnInf.dtiConn EQ SIM_DTI_DISCONNECT) | |
1107 { | |
1108 cmhSAT_OpChnClose( chnInf.bipConn, 1 ); | |
1109 } | |
1110 else | |
1111 { | |
1112 if (dti_cntrl_is_dti_channel_connected (DTI_ENTITY_SIM, simShrdPrm.sat_class_e_dti_id) EQ TRUE) | |
1113 { | |
1114 /* SIM entity has disconnected the dti connection via SIM_DTI_BIP_IND */ | |
1115 if (dti_cntrl_is_dti_channel_connected (DTI_ENTITY_UDP, simShrdPrm.sat_class_e_dti_id) EQ TRUE) | |
1116 cmhSAT_OpChnClose( chnInf.bipConn, 1 ); | |
1117 else | |
1118 dti_cntrl_close_dpath_from_dti_id(simShrdPrm.sat_class_e_dti_id); | |
1119 } | |
1120 else | |
1121 { | |
1122 /* up to now there was not a dti connection with SIM entity */ | |
1123 psaSIM_Bip_Req(); | |
1124 } | |
1125 } | |
1126 break; | |
1127 case SIM_BIP_OPEN_CHANNEL: | |
1128 case SIM_BIP_CHANNEL_SUSPENDED: | |
1129 case SIM_BIP_CHANNEL_RESUMED: | |
1130 psaSIM_Bip_Req(); | |
1131 break; | |
1132 default: | |
1133 TRACE_ERROR("ERROR: psaSIM_SATBIPChn() unknown BIP status"); | |
1134 } /* end of switch */ | |
1135 | |
1136 /* old behavior: test */ | |
1137 #endif /* UART */ | |
1138 } | |
1139 | |
1140 /* | |
1141 +-------------------------------------------------------------------+ | |
1142 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
1143 | ROUTINE : psaSIM_SATChn | | |
1144 +-------------------------------------------------------------------+ | |
1145 | |
1146 PURPOSE : start of DTI connection SIM - UDP,L2R,SNDCP,TRA for CSD | |
1147 /GPRS | |
1148 | |
1149 SAT E Design: Now only used for SIM DTI connections to SNDCP, L2R and TRA | |
1150 | |
1151 */ | |
1152 #ifdef DTI | |
1153 GLOBAL void psaSIM_SATChn ( T_SIM_SAT_CHN chnInf, | |
1154 void (*cb)(UBYTE dtiConn, UBYTE chnId)) | |
1155 { | |
1156 #ifdef GPRS | |
1157 U8 cid_array[2] = { 0,PDP_CONTEXT_CID_INVALID }; | |
1158 cid_array[0] = satShrdPrm.chnTb.chnRefId; | |
1159 #endif | |
1160 | |
1161 TRACE_EVENT("psaSIM_SATChn"); | |
1162 | |
1163 if(!simShrdPrm.sim_dti_chPrm) | |
1164 { | |
1165 ACI_MALLOC(simShrdPrm.sim_dti_chPrm,sizeof(T_SIM_DTI_CH_PRM)); | |
1166 TRACE_EVENT("ALLOC sim_dti_chPrm"); | |
1167 } | |
1168 memcpy(&simShrdPrm.sim_dti_chPrm->sat_chn_prm,&chnInf,sizeof(T_SIM_SAT_CHN)); | |
1169 simShrdPrm.sim_dti_chPrm->dti_cb = cb;/* callback for results of DTI connection -> SatSource */ | |
1170 | |
1171 if( chnInf.dtiConn EQ SIM_DTI_CONNECT ) | |
1172 { | |
1173 if(psa_search_SATSrcId() >= 0) | |
1174 { | |
1175 T_DTI_ENTITY_ID entity_list[2]; | |
1176 entity_list[0]= DTI_ENTITY_SIM; | |
1177 entity_list[1]= (T_DTI_ENTITY_ID)chnInf.dtiUnit; | |
1178 | |
1179 if(satShrdPrm.opchType EQ B_CSD) | |
1180 {/* case immediately connection of SIM entity with L2R or TRA */ | |
1181 /* case on demand connection of SIM entity with L2R or TRA */ | |
1182 | |
1183 /* create a SAT class E DTI ID if not present */ | |
1184 if ( simShrdPrm.sat_class_e_dti_id EQ DTI_DTI_ID_NOTPRESENT ) | |
1185 { | |
1186 simShrdPrm.sat_class_e_dti_id = dti_cntrl_new_dti(DTI_DTI_ID_NOTPRESENT); | |
1187 TRACE_EVENT_P1("sat_class_e_dti_id = %d", simShrdPrm.sat_class_e_dti_id); | |
1188 } | |
1189 | |
1190 /* establish SIM-L2R or SIM-TRA DTI connection */ | |
1191 dti_cntrl_est_dpath( simShrdPrm.sat_class_e_dti_id, | |
1192 entity_list, | |
1193 2, | |
1194 APPEND, | |
1195 SIM_ENT_CSDconnect_dti_cb); | |
1196 } | |
1197 #ifdef GPRS | |
1198 else if(satShrdPrm.opchType EQ B_GPRS) | |
1199 {/* case immediately: open and connect bip channel with help of DTI connection between SIM entity and UDP or SNDCP */ | |
1200 /* case on demand: connect bip channel with help of DTI connection between SIM entity and UDP or SNDCP */ | |
1201 | |
1202 /* create a SAT class E DTI ID if not present */ | |
1203 if ( simShrdPrm.sat_class_e_dti_id EQ DTI_DTI_ID_NOTPRESENT ) | |
1204 { | |
1205 simShrdPrm.sat_class_e_dti_id = dti_cntrl_new_dti(DTI_DTI_ID_NOTPRESENT); | |
1206 TRACE_EVENT_P1("sat_class_e_dti_id = %d", simShrdPrm.sat_class_e_dti_id); | |
1207 } | |
1208 | |
1209 if(chnInf.dtiUnit NEQ DTI_ENTITY_SNDCP) | |
1210 { | |
1211 dti_cntrl_est_dpath( simShrdPrm.sat_class_e_dti_id, | |
1212 entity_list, | |
1213 2, | |
1214 APPEND, | |
1215 SIM_ENT_GPRSconnect_dti_cb); | |
1216 } | |
1217 else | |
1218 { | |
1219 if(!srcc_reserve_sources( SRCC_SIM_SNDCP_LINK, satShrdPrm.chnTb.chnRefId) OR | |
1220 !cmhSM_make_active_cid_list((T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, cid_array) ) | |
1221 { | |
1222 TRACE_FUNCTION("psaSIM_SATChn: Error cid list "); | |
1223 } | |
1224 else | |
1225 { | |
1226 set_conn_param_on_working_cid( (UBYTE)smEntStat.entOwn, DTI_ENTITY_SIM ); | |
1227 cmhSM_connect_working_cid(); | |
1228 } | |
1229 } | |
1230 } | |
1231 #endif | |
1232 } | |
1233 else | |
1234 { | |
1235 TRACE_ERROR("psaSIM_SATChn: fatal ERROR: SAT source id invalid!"); | |
1236 } | |
1237 } | |
1238 } | |
1239 #endif /* DTI */ | |
1240 | |
1241 /* | |
1242 +-------------------------------------------------------------------+ | |
1243 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
1244 | ROUTINE : psaSIM_EvDatAvail | | |
1245 +-------------------------------------------------------------------+ | |
1246 | |
1247 PURPOSE : processes the SIM_EVENTLIST_REQ primitive to SIM. | |
1248 MMI informs about a change of the status of the | |
1249 Data available event (because it is part of the SAT event list) | |
1250 */ | |
1251 | |
1252 GLOBAL void psaSIM_EvDatAvail ( BOOL evStat ) | |
1253 { | |
1254 TRACE_EVENT("psaSIM_EvDatAvail"); | |
1255 { | |
1256 PALLOC(sim_eventlist_req,SIM_EVENTLIST_REQ); | |
1257 switch(evStat) | |
1258 { | |
1259 case SIM_EVENT_DISABLE: | |
1260 case SIM_EVENT_ENABLE: | |
1261 sim_eventlist_req->event_data_avail = evStat; | |
1262 break; | |
1263 default: | |
1264 TRACE_EVENT("psaSIM_EvDatAvail:not valid evStat"); | |
1265 break; | |
1266 } | |
1267 PSENDX(SIM,sim_eventlist_req); | |
1268 } | |
1269 } | |
1270 | |
1271 #endif /* #ifdef FF_SAT_E */ | |
1272 | |
1273 #ifdef FF_DUAL_SIM | |
1274 /* | |
1275 +-------------------------------------------------------------------+ | |
1276 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMS | | |
1277 | ROUTINE : psaSIM_SelectSIM | | |
1278 +-------------------------------------------------------------------+ | |
1279 | |
1280 PURPOSE : processes the SIM_ACTIVATE_REQ primitive to SIM to Select the required SIM | |
1281 */ | |
1282 GLOBAL SHORT psaSIM_SelectSIM ( void ) | |
1283 { | |
1284 T_SIM_SET_PRM * pPrmSet; /* points to used parameter set */ | |
1285 | |
1286 TRACE_FUNCTION ("psaSIM_SelectSIM()"); | |
1287 | |
1288 /* | |
1289 *------------------------------------------------------------------- | |
1290 * check owner id | |
1291 *------------------------------------------------------------------- | |
1292 */ | |
1293 if(!psa_IsVldOwnId(simShrdPrm.owner)) | |
1294 { | |
1295 TRACE_EVENT("not a valid owner !!"); | |
1296 return( -1 ); | |
1297 } | |
1298 | |
1299 pPrmSet = &simShrdPrm.setPrm[simShrdPrm.owner]; | |
1300 simShrdPrm.SIM_Selection = TRUE; | |
1301 | |
1302 /* | |
1303 *------------------------------------------------------------------- | |
1304 * create and send primitive | |
1305 *------------------------------------------------------------------- | |
1306 */ | |
1307 { | |
1308 PALLOC (sim_activate_req, SIM_ACTIVATE_REQ); | |
1309 | |
1310 sim_activate_req->proc = SIM_SELECT; | |
1311 sim_activate_req->sim_num = pPrmSet->SIM_Selected; | |
1312 | |
1313 PSENDX (SIM, sim_activate_req); | |
1314 } | |
1315 return 0; | |
1316 } | |
1317 #endif /*FF_DUAL_SIM*/ | |
1318 | |
1319 | |
1320 /*==== EOF ========================================================*/ | |
1321 |