comparison g23m-aci/aci/psa_simp.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : PSA_SIMP
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 processing functions for the
18 | primitives send to the protocol stack adapter by the
19 | subscriber identity module.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef PSA_SIMP_C
24 #define PSA_SIMP_C
25 #endif
26
27 #include "config.h"
28 #include "fixedconf.h"
29 #include "condat-features.h"
30 #include "aci_conf.h"
31
32 #include "aci_all.h"
33
34 /*==== INCLUDES ===================================================*/
35 #include "aci_cmh.h"
36 #include "ati_cmd.h"
37 #include "aci_cmd.h"
38
39 #ifdef FAX_AND_DATA
40 #include "aci_fd.h"
41 #endif /* of #ifdef FAX_AND_DATA */
42
43 #ifdef DTI
44 #include "dti.h"
45 #include "dti_conn_mng.h"
46 #include "dti_cntrl_mng.h"
47 #endif
48
49 #include "aci.h"
50 #include "psa.h"
51 #include "psa_sim.h"
52 #include "psa_sms.h"
53 #include "psa_mmi.h"
54 #include "psa_mm.h"
55 #include "cmh.h"
56 #include "cmh_mm.h"
57 #include "cmh_sim.h"
58 #include "phb.h"
59 #include "aoc.h"
60
61 #ifdef SIM_TOOLKIT
62 #include "psa_cc.h"
63 #include "aci_mem.h"
64 #include "psa_sat.h"
65 #include "cmh_sat.h"
66 #endif /* SIM_TOOLKIT */
67
68 #include "aci_ext_pers.h" /* for SIM locking constants and prototypes. */
69 #include "aci_slock.h" /* for SIM locking constants and prototypes. */
70
71 #ifdef SIM_PERS
72 #include "general.h" // included for compilation error UINT8 in sec_drv.h
73 #include "sec_drv.h"
74 #endif
75 /*==== CONSTANTS ==================================================*/
76
77
78 /*==== TYPES ======================================================*/
79
80
81 /*==== EXPORT =====================================================*/
82
83
84 /*==== VARIABLES ==================================================*/
85
86 /* Remember the last catched T_SIM_MMI_INSERT_IND, null if the last one as not remembered or freed */
87 T_SIM_MMI_INSERT_IND *last_sim_mmi_insert_ind = NULL;
88 #ifdef SIM_PERS
89 EXTERN T_SEC_DRV_CONFIGURATION *cfg_data ;
90 EXTERN T_ACI_SIM_CONFIG aci_slock_sim_config;
91 #endif
92 EXTERN void psaSIM_Insert_Continued(T_SIM_MMI_INSERT_IND *sim_mmi_insert_ind);
93
94
95 LOCAL void psaSIM_process_sim_upd_rec_cnf ( U8 req_id, U16 cause,
96 UBYTE type );
97 LOCAL void psaSIM_update_simShrdPrm ( U16 cause, U8 pin_id);
98
99 /*==== FUNCTIONS ==================================================*/
100
101
102 /*
103 +-------------------------------------------------------------------+
104 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
105 | ROUTINE : psa_sim_read_cnf |
106 +-------------------------------------------------------------------+
107
108 PURPOSE : processes the SIM_READ_CNF primitive send by SIM.
109 this is the confirmation to the SIM read data operation.
110
111 */
112 GLOBAL void psa_sim_read_cnf ( T_SIM_READ_CNF *sim_read_cnf )
113 {
114 SHORT aId; /* holds access id */
115
116 TRACE_FUNCTION ("psa_sim_read_cnf()");
117
118 aId = sim_read_cnf -> req_id;
119
120 if( simShrdPrm.atb[aId].ntryUsdFlg AND
121 simShrdPrm.atb[aId].accType EQ ACT_RD_DAT )
122 {
123 /*
124 *---------------------------------------------------------------
125 * update access parameter and notify caller
126 *---------------------------------------------------------------
127 */
128 simShrdPrm.atb[aId].errCode = sim_read_cnf -> cause;
129 simShrdPrm.atb[aId].dataLen = sim_read_cnf -> length;
130
131 if( simShrdPrm.atb[aId].exchData )
132 memcpy (simShrdPrm.atb[aId].exchData, sim_read_cnf -> trans_data,
133 sim_read_cnf->length);
134 else
135 simShrdPrm.atb[aId].exchData = sim_read_cnf -> trans_data;
136
137 if( simShrdPrm.atb[aId].rplyCB )
138 simShrdPrm.atb[aId].rplyCB( aId );
139 else
140 simShrdPrm.atb[aId].ntryUsdFlg = FALSE;
141 }
142
143 /*
144 *-------------------------------------------------------------------
145 * free the primitive buffer
146 *-------------------------------------------------------------------
147 */
148 PFREE (sim_read_cnf);
149 }
150
151 /*
152 +-------------------------------------------------------------------+
153 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
154 | ROUTINE : psa_sim_update_cnf |
155 +-------------------------------------------------------------------+
156
157 PURPOSE : processes the SIM_READ_CNF primitive send by SIM.
158 this is the confirmation to the SIM update data operation.
159
160 */
161
162 GLOBAL void psa_sim_update_cnf ( T_SIM_UPDATE_CNF *sim_update_cnf )
163 {
164
165
166 TRACE_FUNCTION ("psa_sim_update_cnf()");
167
168 /* Implements Measure # 48 */
169 psaSIM_process_sim_upd_rec_cnf ( sim_update_cnf -> req_id,
170 sim_update_cnf -> cause,
171 ACT_WR_DAT);
172 /*
173 *-------------------------------------------------------------------
174 * free the primitive buffer
175 *-------------------------------------------------------------------
176 */
177 PFREE (sim_update_cnf);
178
179 }
180
181 /*
182 +-------------------------------------------------------------------+
183 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
184 | ROUTINE : psa_sim_read_record_cnf |
185 +-------------------------------------------------------------------+
186
187 PURPOSE : processes the SIM_READ_RECORD_CNF primitive send by SIM.
188 this is the confirmation to the SIM read absolute record
189 operation.
190
191 */
192
193 GLOBAL void psa_sim_read_record_cnf
194 ( T_SIM_READ_RECORD_CNF *sim_read_record_cnf )
195 {
196 SHORT aId; /* holds access id */
197
198 TRACE_FUNCTION ("psa_sim_read_record_cnf()");
199
200 aId = sim_read_record_cnf -> req_id;
201
202 if( simShrdPrm.atb[aId].ntryUsdFlg AND
203 simShrdPrm.atb[aId].accType EQ ACT_RD_REC )
204 {
205 /*
206 *---------------------------------------------------------------
207 * update access parameter and notify caller
208 *---------------------------------------------------------------
209 */
210 simShrdPrm.atb[aId].errCode = sim_read_record_cnf -> cause;
211 simShrdPrm.atb[aId].recMax = sim_read_record_cnf -> max_record;
212 if(simShrdPrm.atb[aId].check_dataLen AND
213 simShrdPrm.atb[aId].dataLen < sim_read_record_cnf->length)
214 {
215 TRACE_EVENT_P1("Read record is too big for buffer !!! size: %d", sim_read_record_cnf->length);
216 }
217 else
218 {
219 simShrdPrm.atb[aId].dataLen = sim_read_record_cnf -> length;
220 }
221
222 if( simShrdPrm.atb[aId].exchData )
223
224 memcpy (simShrdPrm.atb[aId].exchData, sim_read_record_cnf -> linear_data,
225 sim_read_record_cnf->length);
226 else
227
228 simShrdPrm.atb[aId].exchData = sim_read_record_cnf -> linear_data;
229
230 if( simShrdPrm.atb[aId].rplyCB )
231 simShrdPrm.atb[aId].rplyCB( aId );
232 else
233 simShrdPrm.atb[aId].ntryUsdFlg = FALSE;
234 }
235 /*
236 *-------------------------------------------------------------------
237 * free the primitive buffer
238 *-------------------------------------------------------------------
239 */
240 PFREE (sim_read_record_cnf);
241
242 }
243
244
245 /*
246 +-------------------------------------------------------------------+
247 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
248 | ROUTINE : psa_sim_update_record_cnf|
249 +-------------------------------------------------------------------+
250
251 PURPOSE : processes the SIM_READ_CNF primitive send by SIM.
252 this is the confirmation to the SIM update absolute
253 record operation.
254
255 */
256
257 GLOBAL void psa_sim_update_record_cnf
258 ( T_SIM_UPDATE_RECORD_CNF *sim_update_record_cnf )
259 {
260
261 TRACE_FUNCTION ("psa_sim_update_record_cnf()");
262
263 /* Implements Measure # 48 */
264 psaSIM_process_sim_upd_rec_cnf ( sim_update_record_cnf -> req_id,
265 sim_update_record_cnf -> cause,
266 ACT_WR_REC);
267 /*
268 *-------------------------------------------------------------------
269 * free the primitive buffer
270 *-------------------------------------------------------------------
271 */
272 PFREE (sim_update_record_cnf);
273
274 }
275
276 /*
277 +-------------------------------------------------------------------+
278 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
279 | ROUTINE : psa_sim_increment_cnf |
280 +-------------------------------------------------------------------+
281
282 PURPOSE : processes the SIM_READ_CNF primitive send by SIM.
283 this is the confirmation to the SIM increment data
284 operation.
285
286 */
287
288 GLOBAL void psa_sim_increment_cnf
289 ( T_SIM_INCREMENT_CNF *sim_increment_cnf )
290 {
291 SHORT aId; /* holds access id */
292
293 TRACE_FUNCTION ("psa_sim_increment_cnf()");
294
295 aId = sim_increment_cnf -> req_id;
296
297 if( simShrdPrm.atb[aId].ntryUsdFlg AND
298 simShrdPrm.atb[aId].accType EQ ACT_INC_DAT )
299 {
300 /*
301 *---------------------------------------------------------------
302 * update access parameter and notify caller
303 *---------------------------------------------------------------
304 */
305 simShrdPrm.atb[aId].errCode = sim_increment_cnf -> cause;
306 simShrdPrm.atb[aId].dataLen = sim_increment_cnf -> length;
307
308 if( simShrdPrm.atb[aId].exchData )
309
310 memcpy( simShrdPrm.atb[aId].exchData,
311 sim_increment_cnf -> linear_data,
312 sim_increment_cnf -> length );
313 else
314
315 simShrdPrm.atb[aId].exchData = sim_increment_cnf -> linear_data;
316
317 if( simShrdPrm.atb[aId].rplyCB )
318 simShrdPrm.atb[aId].rplyCB( aId );
319 else
320 simShrdPrm.atb[aId].ntryUsdFlg = FALSE;
321 }
322 /*
323 *-------------------------------------------------------------------
324 * free the primitive buffer
325 *-------------------------------------------------------------------
326 */
327 PFREE (sim_increment_cnf);
328
329 }
330
331 /*
332 +-------------------------------------------------------------------+
333 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
334 | ROUTINE : psa_sim_verify_pin_cnf |
335 +-------------------------------------------------------------------+
336
337 PURPOSE : processes the SIM_VERIFY_PIN_CNF primitive send by SIM.
338 this is the confirmation to the PIN verify operation.
339
340 */
341
342 GLOBAL void psa_sim_verify_pin_cnf
343 ( T_SIM_VERIFY_PIN_CNF *sim_verify_pin_cnf )
344 {
345
346 TRACE_FUNCTION ("psa_sim_verify_pin_cnf()");
347
348 /*
349 *-------------------------------------------------------------------
350 * update shared parameter and notify ACI
351 *-------------------------------------------------------------------
352 */
353 simShrdPrm.rslt = sim_verify_pin_cnf -> cause;
354 simShrdPrm.pn1Cnt = sim_verify_pin_cnf -> pin_cnt;
355 simShrdPrm.pn2Cnt = sim_verify_pin_cnf -> pin2_cnt;
356 simShrdPrm.pk1Cnt = sim_verify_pin_cnf -> puk_cnt;
357 simShrdPrm.pk2Cnt = sim_verify_pin_cnf -> puk2_cnt;
358
359 TRACE_EVENT_P1("SIM answered with 0x%4.4X", sim_verify_pin_cnf -> cause);
360
361 /* Implements Measure # 179 */
362 psaSIM_update_simShrdPrm ( sim_verify_pin_cnf -> cause,
363 sim_verify_pin_cnf -> pin_id);
364
365 cmhSIM_PINVerified();
366
367 /*
368 *-------------------------------------------------------------------
369 * free the primitive buffer
370 *-------------------------------------------------------------------
371 */
372 PFREE (sim_verify_pin_cnf);
373
374 }
375
376 /*
377 +-------------------------------------------------------------------+
378 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
379 | ROUTINE : psa_sim_change_pin_cnf |
380 +-------------------------------------------------------------------+
381
382 PURPOSE : processes the SIM_CHANGE_PIN_CNF primitive send by SIM.
383 this is the confirmation to the PIN change operation.
384
385 */
386
387 GLOBAL void psa_sim_change_pin_cnf
388 ( T_SIM_CHANGE_PIN_CNF *sim_change_pin_cnf )
389 {
390
391 TRACE_FUNCTION ("psa_sim_change_pin_cnf()");
392
393 /*
394 *-------------------------------------------------------------------
395 * update shared parameter and notify ACI
396 *-------------------------------------------------------------------
397 */
398 simShrdPrm.rslt = sim_change_pin_cnf -> cause;
399 simShrdPrm.pn1Cnt = sim_change_pin_cnf -> pin_cnt;
400 simShrdPrm.pn2Cnt = sim_change_pin_cnf -> pin2_cnt;
401 simShrdPrm.pk1Cnt = sim_change_pin_cnf -> puk_cnt;
402 simShrdPrm.pk2Cnt = sim_change_pin_cnf -> puk2_cnt;
403
404 /* Implements Measure # 179 */
405 psaSIM_update_simShrdPrm ( sim_change_pin_cnf -> cause,
406 sim_change_pin_cnf -> pin_id);
407 /* Implements Measure 97 */
408 cmhSIM_CardUnblocked_PINChanged( TRUE );
409
410 /*
411 *-------------------------------------------------------------------
412 * free the primitive buffer
413 *-------------------------------------------------------------------
414 */
415 PFREE (sim_change_pin_cnf);
416
417 }
418
419 /*
420 +-------------------------------------------------------------------+
421 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
422 | ROUTINE : psa_sim_disable_pin_cnf |
423 +-------------------------------------------------------------------+
424
425 PURPOSE : processes the SIM_DISABLE_PIN_CNF primitive send by SIM.
426 this is the confirmation to the PIN disable operation.
427
428 */
429
430 GLOBAL void psa_sim_disable_pin_cnf
431 ( T_SIM_DISABLE_PIN_CNF *sim_disable_pin_cnf )
432 {
433
434 TRACE_FUNCTION ("psa_sim_disable_pin_cnf()");
435
436 /*
437 *-------------------------------------------------------------------
438 * update shared parameter and notify ACI
439 *-------------------------------------------------------------------
440 */
441 simShrdPrm.rslt = sim_disable_pin_cnf -> cause;
442 simShrdPrm.pn1Cnt = sim_disable_pin_cnf -> pin_cnt;
443 simShrdPrm.pn2Cnt = sim_disable_pin_cnf -> pin2_cnt;
444 simShrdPrm.pk1Cnt = sim_disable_pin_cnf -> puk_cnt;
445 simShrdPrm.pk2Cnt = sim_disable_pin_cnf -> puk2_cnt;
446
447 switch( sim_disable_pin_cnf -> cause )
448 {
449 case( SIM_CAUSE_PUK1_EXPECT ):
450 case( SIM_CAUSE_PIN1_BLOCKED):
451 simShrdPrm.PINStat = PS_PUK1;
452 break;
453 /* Implements Measure # 101 */
454 case( SIM_NO_ERROR):
455 simShrdPrm.PEDStat = PEDS_DIS;
456 break;
457 }
458
459 /* Implements Measure 183 */
460 cmhSIM_PINEnabledDisabled();
461
462 /*
463 *-------------------------------------------------------------------
464 * free the primitive buffer
465 *-------------------------------------------------------------------
466 */
467 PFREE (sim_disable_pin_cnf);
468
469 }
470
471 /*
472 +-------------------------------------------------------------------+
473 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
474 | ROUTINE : psa_sim_enable_pin_cnf |
475 +-------------------------------------------------------------------+
476
477 PURPOSE : processes the SIM_ENABLE_PIN_CNF primitive send by SIM.
478 this is the confirmation to the PIN enable operation.
479
480 */
481
482 GLOBAL void psa_sim_enable_pin_cnf
483 ( T_SIM_ENABLE_PIN_CNF *sim_enable_pin_cnf )
484 {
485
486 TRACE_FUNCTION ("psa_sim_enable_pin_cnf()");
487
488 /*
489 *-------------------------------------------------------------------
490 * update shared parameter and notify ACI
491 *-------------------------------------------------------------------
492 */
493 simShrdPrm.rslt = sim_enable_pin_cnf -> cause;
494 simShrdPrm.pn1Cnt = sim_enable_pin_cnf -> pin_cnt;
495 simShrdPrm.pn2Cnt = sim_enable_pin_cnf -> pin2_cnt;
496 simShrdPrm.pk1Cnt = sim_enable_pin_cnf -> puk_cnt;
497 simShrdPrm.pk2Cnt = sim_enable_pin_cnf -> puk2_cnt;
498
499 switch( sim_enable_pin_cnf -> cause )
500 {
501 case( SIM_CAUSE_PUK1_EXPECT ):
502 case( SIM_CAUSE_PIN1_BLOCKED):
503 simShrdPrm.PINStat = PS_PUK1;
504 break;
505 /* Implements Measure # 101 */
506 case( SIM_NO_ERROR):
507 simShrdPrm.PEDStat = PEDS_ENA;
508 break;
509 }
510
511 /* Implements Measure 183 */
512 cmhSIM_PINEnabledDisabled();
513 /*
514 *-------------------------------------------------------------------
515 * free the primitive buffer
516 *-------------------------------------------------------------------
517 */
518 PFREE (sim_enable_pin_cnf);
519
520 }
521
522 /*
523 +-------------------------------------------------------------------+
524 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
525 | ROUTINE : psa_sim_unblock_cnf |
526 +-------------------------------------------------------------------+
527
528 PURPOSE : processes the SIM_UNBLOCK_CNF primitive send by SIM.
529 this is the confirmation to the card unblock operation.
530
531 */
532
533 GLOBAL void psa_sim_unblock_cnf
534 ( T_SIM_UNBLOCK_CNF *sim_unblock_cnf )
535 {
536
537 TRACE_FUNCTION ("psa_sim_unblock_cnf()");
538
539 /*
540 *-------------------------------------------------------------------
541 * update shared parameter and notify ACI
542 *-------------------------------------------------------------------
543 */
544 simShrdPrm.rslt = sim_unblock_cnf -> cause;
545 simShrdPrm.pn1Cnt = sim_unblock_cnf -> pin_cnt;
546 simShrdPrm.pn2Cnt = sim_unblock_cnf -> pin2_cnt;
547 simShrdPrm.pk1Cnt = sim_unblock_cnf -> puk_cnt;
548 simShrdPrm.pk2Cnt = sim_unblock_cnf -> puk2_cnt;
549
550 TRACE_EVENT_P1("SIM answered with 0x%4.4X", sim_unblock_cnf -> cause);
551
552 switch( sim_unblock_cnf -> cause )
553 {
554 case( SIM_NO_ERROR ):
555 simShrdPrm.PINStat = PS_RDY;
556
557 if( sim_unblock_cnf -> pin_id EQ PHASE_2_PUK_1 )
558 {
559 simShrdPrm.pn1Stat = PS_RDY;
560 /* 11.11/8.13 "After a successful unblocking attempt the CHV is enabled..." */
561 simShrdPrm.PEDStat = PEDS_ENA;
562 }
563 else if( sim_unblock_cnf -> pin_id EQ PHASE_2_PUK_2 )
564 simShrdPrm.pn2Stat = PS_RDY;
565 break;
566
567 case( SIM_CAUSE_PUK1_EXPECT ):
568 simShrdPrm.PINStat = PS_PUK1;
569 break;
570
571 case( SIM_CAUSE_PUK2_EXPECT ):
572 simShrdPrm.PINStat = PS_PUK2;
573 break;
574 }
575 /* Implements Measure 97 */
576 cmhSIM_CardUnblocked_PINChanged( FALSE );
577
578 /*
579 *-------------------------------------------------------------------
580 * free the primitive buffer
581 *-------------------------------------------------------------------
582 */
583 PFREE (sim_unblock_cnf);
584
585 }
586
587 /*
588 +-------------------------------------------------------------------+
589 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
590 | ROUTINE : psa_sim_sync_cnf |
591 +-------------------------------------------------------------------+
592
593 PURPOSE : processes the SIM_SYNC_CNF primitive send by SIM.
594 this is the confirmation to the data synchronization
595 operation.
596
597 */
598
599 GLOBAL void psa_sim_sync_cnf ( T_SIM_SYNC_CNF *sim_sync_cnf )
600 {
601
602 TRACE_FUNCTION ("psa_sim_sync_cnf()");
603
604 /* disable SMS */
605 if (simShrdPrm.synCs EQ SYNC_DEACTIVATE)
606 {
607 cmhSMS_disableAccess();
608 psaSIM_Init (ACI_INIT_TYPE_SOFT_OFF);
609 percentCSTAT_indication(STATE_MSG_PBOOK, ENTITY_STATUS_NotReady);
610 }
611
612 /* notify ACI */
613 cmhSIM_SIMSync();
614
615 /* free the primitive buffer */
616 PFREE (sim_sync_cnf);
617
618 }
619
620 /*
621 +-------------------------------------------------------------------+
622 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
623 | ROUTINE : psa_sim_activate_cnf |
624 +-------------------------------------------------------------------+
625
626 PURPOSE : processes the SIM_ACTIVATE_CNF primitive send by SIM.
627 this is the confirmation to the SIM activate operation.
628
629 */
630
631 GLOBAL void psa_sim_activate_cnf
632 ( T_SIM_ACTIVATE_CNF *sim_activate_cnf )
633 {
634 TRACE_FUNCTION ("psa_sim_activate_cnf()");
635
636 #ifdef FF_DUAL_SIM
637 if(simShrdPrm.SIM_Selection)
638 {
639 simShrdPrm.rslt = sim_activate_cnf -> cause;
640 simShrdPrm.SIM_Powered_on = sim_activate_cnf->sim_num;
641
642 cmhSIM_SIMSelected();
643 simShrdPrm.SIM_Selection = FALSE;
644
645 PFREE (sim_activate_cnf);
646
647 return;
648
649 }
650 #endif /*FF_DUAL_SIM*/
651 /*
652 *-------------------------------------------------------------------
653 * update shared parameter and notify ACI
654 *-------------------------------------------------------------------
655 */
656
657 if (simShrdPrm.setPrm[simEntStat.entOwn].actProc EQ SIM_INITIALISATION)
658 {
659 simShrdPrm.pn1Cnt = sim_activate_cnf -> pin_cnt;
660 simShrdPrm.pn2Cnt = sim_activate_cnf -> pin2_cnt;
661 simShrdPrm.pk1Cnt = sim_activate_cnf -> puk_cnt;
662 simShrdPrm.pk2Cnt = sim_activate_cnf -> puk2_cnt;
663 }
664
665 /*
666 * Build emergency call phonebook
667 */
668 #ifdef TI_PS_FFS_PHB
669 pb_set_sim_ecc (sim_activate_cnf->cause,
670 MAX_ECC,
671 sim_activate_cnf->ec_code);
672 #else
673 pb_init();
674 pb_read_ecc(sim_activate_cnf -> cause, MAX_ECC,
675 sim_activate_cnf->ec_code);
676 #endif
677
678 simShrdPrm.rslt = sim_activate_cnf -> cause;
679 TRACE_EVENT_P1("SIM answered with 0x%4.4X", sim_activate_cnf -> cause);
680
681 #ifdef TI_PS_FF_AT_P_CMD_ATR
682 simShrdPrm.atr.len = MINIMUM(sim_activate_cnf->c_atr, MAX_SIM_ATR);
683 memcpy (simShrdPrm.atr.data, sim_activate_cnf -> atr, MINIMUM(sim_activate_cnf->c_atr, MAX_SIM_ATR));
684 #endif /* TI_PS_FF_AT_P_CMD_ATR */
685
686 switch( simShrdPrm.rslt )
687 {
688 case( SIM_NO_ERROR ):
689 simShrdPrm.SIMStat = SS_OK;
690 simShrdPrm.PINStat = simShrdPrm.pn1Stat = PS_RDY;
691 if (simShrdPrm.setPrm[simEntStat.entOwn].actProc EQ SIM_INITIALISATION)
692 simShrdPrm.PEDStat = PEDS_DIS;
693 break;
694
695 case( SIM_CAUSE_PIN1_EXPECT ):
696
697 simShrdPrm.SIMStat = SS_OK;
698 simShrdPrm.PINStat = simShrdPrm.pn1Stat = PS_PIN1;
699 simShrdPrm.PEDStat = PEDS_ENA;
700 break;
701
702 case( SIM_CAUSE_PIN2_EXPECT ):
703
704 simShrdPrm.SIMStat = SS_OK;
705 simShrdPrm.PINStat = simShrdPrm.pn2Stat = PS_PIN2;
706 break;
707
708 case( SIM_CAUSE_PIN1_BLOCKED ):
709 case( SIM_CAUSE_PUK1_EXPECT ):
710
711 simShrdPrm.SIMStat = SS_BLKD;
712 simShrdPrm.PINStat = PS_PUK1;
713 simShrdPrm.PEDStat = PEDS_ENA;
714 break;
715
716 case( SIM_CAUSE_PIN2_BLOCKED ):
717 case( SIM_CAUSE_PUK2_EXPECT ):
718
719 simShrdPrm.SIMStat = SS_BLKD;
720 simShrdPrm.PINStat = PS_PUK2;
721 break;
722
723 case( SIM_CAUSE_PUK1_BLOCKED ):
724 simShrdPrm.SIMStat = SS_INV;
725 simShrdPrm.pn1Stat = NO_VLD_PS;
726 break;
727
728 case( SIM_CAUSE_PUK2_BLOCKED ):
729 simShrdPrm.SIMStat = SS_INV;
730 simShrdPrm.pn2Stat = NO_VLD_PS;
731 break;
732
733 default:
734 if (GET_CAUSE_DEFBY(simShrdPrm.rslt) NEQ DEFBY_CONDAT AND
735 GET_CAUSE_ORIGSIDE(simShrdPrm.rslt) NEQ ORIGSIDE_MS)
736 {
737 /* unexpected result */
738 simShrdPrm.SIMStat = NO_VLD_SS;
739 TRACE_ERROR("psa_sim_activate_cnf: NO_VLD_SS");
740 break;
741 } /* no break: SIM driver error */
742 /*lint -fallthrough*/
743 case( SIM_CAUSE_CARD_REMOVED ):
744 simShrdPrm.SIMStat = SS_URCHB;
745 simShrdPrm.pn1Stat = simShrdPrm.pn2Stat = NO_VLD_PS;
746 break;
747 }
748
749 cmhSIM_SIMActivated();
750
751 /*
752 *-------------------------------------------------------------------
753 * free the primitive buffer
754 *-------------------------------------------------------------------
755 */
756 PFREE (sim_activate_cnf);
757 }
758
759 /*
760 +-------------------------------------------------------------------+
761 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
762 | ROUTINE : psa_sim_activate_ind |
763 +-------------------------------------------------------------------+
764
765 PURPOSE : processes the SIM_ACTIVATE_IND primitive send by SIM.
766 This is the indication about the recognition of a SIM
767 card after a previous SIM_REMOVE_IND or failed
768 SIM_ACTIVATE_REQ
769 */
770
771 GLOBAL void psa_sim_activate_ind
772 ( T_SIM_ACTIVATE_IND *sim_activate_ind )
773 {
774
775 T_ACI_CMD_SRC idx;
776
777 TRACE_FUNCTION ("psa_sim_activate_ind()");
778
779 /* Check for the cause value and inform MMI accordingly with %SIMINS */
780 if (sim_activate_ind->cause EQ SIM_CAUSE_SIM_REINSERTED)
781 {
782 for( idx = CMD_SRC_LCL; idx < CMD_SRC_MAX; idx++ )
783 {
784 R_AT( RAT_SIMINS, idx )(CME_ERR_SimResetNeeded);
785 }
786 }
787 else
788 {
789 simShrdPrm.pn1Cnt = sim_activate_ind -> pin_cnt;
790 simShrdPrm.pn2Cnt = sim_activate_ind -> pin2_cnt;
791 simShrdPrm.pk1Cnt = sim_activate_ind -> puk_cnt;
792 simShrdPrm.pk2Cnt = sim_activate_ind -> puk2_cnt;
793
794 /*
795 * Build emergency call phonebook
796 */
797 #ifdef TI_PS_FFS_PHB
798 pb_set_sim_ecc (sim_activate_ind->cause,
799 MAX_ECC,
800 sim_activate_ind->ec_code);
801 #else
802 pb_read_ecc(sim_activate_ind->cause, MAX_ECC,
803 sim_activate_ind->ec_code);
804 #endif
805
806 simShrdPrm.rslt = sim_activate_ind -> cause;
807
808 #ifdef TI_PS_FF_AT_P_CMD_ATR
809 simShrdPrm.atr.len = MINIMUM(sim_activate_ind->c_atr, MAX_SIM_ATR);
810 memcpy (simShrdPrm.atr.data, sim_activate_ind -> atr, MINIMUM(sim_activate_ind->c_atr, MAX_SIM_ATR));
811 #endif /* TI_PS_FF_AT_P_CMD_ATR */
812
813 switch( simShrdPrm.rslt )
814 {
815 case( SIM_NO_ERROR ):
816 simShrdPrm.rslt = SIM_NO_ERROR;
817 simShrdPrm.SIMStat = SS_OK;
818 simShrdPrm.PINStat = simShrdPrm.pn1Stat = PS_RDY;
819 simShrdPrm.PEDStat = PEDS_DIS;
820 break;
821
822 case( SIM_CAUSE_PIN1_EXPECT ):
823 simShrdPrm.SIMStat = SS_OK;
824 simShrdPrm.PINStat = simShrdPrm.pn1Stat = PS_PIN1;
825 simShrdPrm.PEDStat = PEDS_ENA;
826 break;
827
828 case( SIM_CAUSE_PIN2_EXPECT ):
829 simShrdPrm.SIMStat = SS_OK;
830 simShrdPrm.PINStat = simShrdPrm.pn2Stat = PS_PIN2;
831 break;
832
833 case( SIM_CAUSE_PIN1_BLOCKED ):
834 case( SIM_CAUSE_PUK1_EXPECT ):
835 simShrdPrm.SIMStat = SS_BLKD;
836 simShrdPrm.PINStat = PS_PUK1;
837 simShrdPrm.PEDStat = PEDS_ENA;
838 break;
839
840 case( SIM_CAUSE_PIN2_BLOCKED ):
841 case( SIM_CAUSE_PUK2_EXPECT ):
842 simShrdPrm.SIMStat = SS_BLKD;
843 simShrdPrm.PINStat = PS_PUK2;
844 break;
845
846 default: /* unexpected error */
847 simShrdPrm.SIMStat = NO_VLD_SS;
848 simShrdPrm.pn1Stat = simShrdPrm.pn2Stat = NO_VLD_PS;
849 }
850
851 cmhSIM_SIMActivated();
852 }
853
854 /*
855 *-------------------------------------------------------------------
856 * free the primitive buffer
857 *-------------------------------------------------------------------
858 */
859 PFREE (sim_activate_ind);
860 }
861
862
863 /*
864 +-------------------------------------------------------------------+
865 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
866 | ROUTINE : psa_sim_mmi_insert_ind |
867 +-------------------------------------------------------------------+
868
869 PURPOSE : processes the SIM_MMI_INSERT_IND primitive send by SIM.
870 This is an indication that the SIM card was inserted
871 and verified.
872 */
873
874 GLOBAL void psa_sim_mmi_insert_ind
875 ( T_SIM_MMI_INSERT_IND *sim_mmi_insert_ind )
876 {
877
878 TRACE_FUNCTION ("psa_sim_mmi_insert_ind()");
879
880 /*
881 *-------------------------------------------------------------------
882 * update shared parameter and notify ACI
883 *-------------------------------------------------------------------
884 */
885
886 if(simShrdPrm.PINStat EQ PS_PUK1)
887 {
888 TRACE_ERROR("Simcard is blocked !!! sim_mmi_insert_ind should no come before PUK");
889 PFREE (sim_mmi_insert_ind);
890 return;
891 }
892
893 simShrdPrm.SIMStat = SS_OK; /* moved here */ /* ACI-SPR-10214 */
894 simShrdPrm.crdPhs = sim_mmi_insert_ind -> phase;
895 simShrdPrm.crdFun = sim_mmi_insert_ind -> func;
896 simShrdPrm.imsi = sim_mmi_insert_ind -> imsi_field;
897
898 memcpy( simShrdPrm.srvTab, sim_mmi_insert_ind -> sim_serv,SRV_TAB_LEN );
899
900 /* disable SMS access (can be SIM Re-Initialosation) */
901 cmhSMS_disableAccess();
902
903 psaSMS_InitParams(); /* Reset SIM Parameters */
904 #ifdef SIM_PERS_OTA
905 aci_slock_ota_init();
906 #endif
907
908 /* Initialize Advice of Charge */
909 aoc_init (sim_mmi_insert_ind->phase,
910 sim_mmi_insert_ind->sim_serv);
911
912 /*
913 * Start to build phonebook
914 */
915 pb_reset();
916
917 #ifndef TI_PS_FFS_PHB
918 pb_init();
919 pb_update_ecc();
920 #endif
921
922 last_sim_mmi_insert_ind = sim_mmi_insert_ind ;
923
924 /* Access the AD from sim_mmi_insert_ind and inform MMI */
925 cmhSIM_AD_Updated(last_sim_mmi_insert_ind->c_ad, last_sim_mmi_insert_ind->ad);
926
927 if(last_sim_mmi_insert_ind NEQ NULL)
928 {
929 #ifdef SIM_PERS
930 aci_slock_sim_config.sim_read_ad_first_byte = last_sim_mmi_insert_ind->ad[0] ;
931 aci_slock_sim_init(last_sim_mmi_insert_ind);
932 if(aci_slock_is_timer_support() EQ TRUE)
933 {
934 if(aci_slock_check_timer() EQ TIMER_RUNNING)
935 {
936 aci_slock_start_timer();
937 }
938
939 }
940 /* To set the global variable config data */
941
942 if(!aci_slock_set_CFG())
943 {
944 AciSLockShrd.blocked = TRUE;
945 cmhSIM_SIMInserted();
946 PFREE (last_sim_mmi_insert_ind); /* 11_Apr_05 */
947 last_sim_mmi_insert_ind= NULL;
948 return;
949 }
950 aci_slock_init();
951 AciSLockShrd.pb_load = FALSE;
952 AciSLockShrd.check_lock = SIMLOCK_CHECK_PERS;
953 aci_slock_checkpersonalisation(SIMLOCK_NETWORK);
954
955 #else
956 /*
957 * Start to build phonebook
958 */
959 pb_reset();
960
961 #ifdef TI_PS_FFS_PHB
962 pb_inserted_sim (MAX_SRV_TBL,
963 last_sim_mmi_insert_ind->sim_serv,
964 &last_sim_mmi_insert_ind->imsi_field,
965 last_sim_mmi_insert_ind->func,
966 last_sim_mmi_insert_ind->phase);
967 #else
968 pb_build_req(last_sim_mmi_insert_ind);
969 #endif
970 /* Request the Customer Service Profile from the SIM (EF_CPHS_CSP) */
971 cmhSIM_Get_CSP();
972
973 #ifdef SIM_TOOLKIT
974 cmhSMS_ReadCbDtaDwnl (last_sim_mmi_insert_ind);
975 #endif
976
977 #ifdef FF_MMI_RIV
978 rAT_PlusCFUNP (last_sim_mmi_insert_ind);
979 #endif /* FF_MMI_RIV */
980 PFREE (last_sim_mmi_insert_ind); /* 11_Apr_05 */
981 last_sim_mmi_insert_ind= NULL;
982
983 cmhSIM_SIMInserted();
984 #endif
985 }
986 }
987
988 /*
989 +-------------------------------------------------------------------+
990 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
991 | ROUTINE : psa_sim_remove_ind |
992 +-------------------------------------------------------------------+
993
994 PURPOSE : processes the SIM_REMOVE_IND primitive send by SIM.
995 this is an indication that the SIM card was removed.
996
997 */
998
999 GLOBAL void psa_sim_remove_ind
1000 ( T_SIM_REMOVE_IND *sim_remove_ind )
1001 {
1002
1003 TRACE_FUNCTION ("psa_sim_remove_ind()");
1004
1005 /*
1006 *-------------------------------------------------------------------
1007 * disable SMS access
1008 *-------------------------------------------------------------------
1009 */
1010 cmhSMS_disableAccess();
1011
1012 smsShrdPrm.cbmPrm.cbmHndl = BM0; /* switch off CBCH */
1013 smsShrdPrm.cbmPrm.cbchOwner = OWN_SRC_SAT;
1014 psaMMI_Cbch();
1015 smsShrdPrm.cbmPrm.cbchOwner = (T_OWN)CMD_SRC_NONE;
1016 /*
1017 * reset phonebook, AOC, ...
1018 */
1019 pb_reset();
1020 aoc_reset();
1021
1022 #ifdef SIM_PERS
1023 /*
1024 * reset aci_slock
1025 */
1026 aci_slock_reset();
1027
1028 #endif
1029
1030 /* reset the MM shared parameters */
1031 psaMM_Init();
1032
1033 /*
1034 * erase event list for SAT event download
1035 */
1036 #ifdef SIM_TOOLKIT
1037 satShrdPrm.event.list = 0L;
1038 satShrdPrm.event.temp_list = 0L; /* in case a setup list was in process */
1039 #endif /* SIM_TOOLKIT */
1040
1041 /*
1042 * close all open SIM accesses
1043 */
1044 psaSIM_CloseAtb ((USHORT)((sim_remove_ind->cause EQ SIM_NO_ERROR)?
1045 SIM_CAUSE_SAT_BUSY: sim_remove_ind->cause));
1046
1047 /* Issue OMAPS00058768: Reset ONSDesc */
1048 cmhMM_Reset_ONSDesc();
1049
1050 /*
1051 *-------------------------------------------------------------------
1052 * Notification is sent for reason of SIM remove ind and SIM shared
1053 * parameters are reset
1054 *-------------------------------------------------------------------
1055 */
1056 simShrdPrm.rslt = sim_remove_ind->cause;
1057 cmhSIM_SIMRemoved();
1058 psaSIM_Init(ACI_INIT_TYPE_SOFT_OFF);
1059
1060 /*
1061 *-------------------------------------------------------------------
1062 * free the primitive buffer
1063 *-------------------------------------------------------------------
1064 */
1065 PFREE (sim_remove_ind);
1066
1067 }
1068
1069 /*
1070 +-------------------------------------------------------------------+
1071 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
1072 | ROUTINE : psa_access_cnf |
1073 +-------------------------------------------------------------------+
1074
1075 PURPOSE : processes the SIM_ACCESS_IND primitive send by SIM.
1076 this is a confirmation to a previous SIM access request.
1077
1078 */
1079
1080 GLOBAL void psa_sim_access_cnf
1081 ( T_SIM_ACCESS_CNF *sim_access_cnf )
1082 {
1083 T_SIM_TRNS_RSP_PRM rsp;
1084
1085 TRACE_FUNCTION ("psa_sim_access_cnf()");
1086
1087 /*
1088 *-------------------------------------------------------------------
1089 * update shared parameter and notify ACI
1090 *-------------------------------------------------------------------
1091 */
1092 simShrdPrm.rslt = sim_access_cnf -> cause;
1093
1094 rsp.sw1 = sim_access_cnf -> sw1;
1095 rsp.sw2 = sim_access_cnf -> sw2;
1096 rsp.rspLen = MINIMUM(sim_access_cnf -> c_trans_data, MAX_SIM_CMD);
1097 rsp.rsp = sim_access_cnf -> trans_data;
1098
1099 switch( simShrdPrm.rslt )
1100 {
1101 case( SIM_CAUSE_PIN1_EXPECT ):
1102 simShrdPrm.SIMStat = SS_OK;
1103 simShrdPrm.PINStat = simShrdPrm.pn1Stat = PS_PIN1;
1104 simShrdPrm.PEDStat = PEDS_ENA;
1105 break;
1106
1107 case( SIM_CAUSE_PIN2_EXPECT ):
1108 simShrdPrm.SIMStat = SS_OK;
1109 simShrdPrm.PINStat = simShrdPrm.pn2Stat = PS_PIN2;
1110 break;
1111
1112 case( SIM_CAUSE_PIN1_BLOCKED ):
1113 case( SIM_CAUSE_PUK1_EXPECT ):
1114 simShrdPrm.SIMStat = SS_BLKD;
1115 simShrdPrm.PINStat = PS_PUK1;
1116 simShrdPrm.PEDStat = PEDS_ENA;
1117 break;
1118
1119 case( SIM_CAUSE_PIN2_BLOCKED ):
1120 case( SIM_CAUSE_PUK2_EXPECT ):
1121 simShrdPrm.SIMStat = SS_BLKD;
1122 simShrdPrm.PINStat = PS_PUK2;
1123 break;
1124 }
1125
1126 cmhSIM_SIMResponseData( &rsp );
1127
1128 /*
1129 *-------------------------------------------------------------------
1130 * free the primitive buffer
1131 *-------------------------------------------------------------------
1132 */
1133
1134 PFREE (sim_access_cnf);
1135
1136 }
1137
1138 /*
1139 +-------------------------------------------------------------------+
1140 | PROJECT : GSM-PS () MODULE : PSA_SIMP |
1141 | ROUTINE : psa_sim_bip_config_cnf |
1142 +-------------------------------------------------------------------+
1143
1144 PURPOSE : processes the SIM_BIP_CONFIG_CNF primitive sent by SIM.
1145 Signal application about (un-)successful processing of AT_A
1146 command. Clean-up the temporal parameters.
1147 The primitive has no content!
1148 */
1149
1150 #ifdef FF_SAT_E
1151 #ifdef DTI
1152 GLOBAL void psa_sim_bip_config_cnf(T_SIM_BIP_CONFIG_CNF *sim_bip_config_cnf)
1153 {
1154
1155 T_ACI_SAT_TERM_RESP resp_data; /* holds terminal response parms */
1156 UBYTE res;
1157
1158 TRACE_FUNCTION("psa_sim_bip_config_cnf()");
1159
1160 /* Since there is no content within this primitive, free it */
1161 PFREE(sim_bip_config_cnf);
1162
1163 /* check for OPEN CHANNEL command context, immediate channel */
1164 if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND
1165 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_OPEN_CHANNEL )
1166 {
1167 /* command: OPEN CHANNEL IMMEDIATELY */
1168
1169 /* init terminal response */
1170 psaSAT_InitTrmResp( &resp_data );
1171 resp_data.chnStat = TRUE;
1172 resp_data.bufSize = TRUE;
1173 resp_data.bearDesc = TRUE;
1174
1175 /* check for modification of bearer parameters */
1176 res = (satShrdPrm.opchPrmMdf)?RSLT_PERF_MDFIED:
1177 (satShrdPrm.opchCCMdfy)?RSLT_PERF_MDFY_SIM:RSLT_PERF_SUCCESS;
1178
1179 /* send terminal response to SAT */
1180 psaSAT_SendTrmResp( res, &resp_data );
1181
1182 /* finish command AT_A command */
1183 R_AT( RAT_OK, (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc ) ( AT_CMD_A );
1184
1185 /* log result */
1186 cmh_logRslt ( (T_ACI_CMD_SRC)satShrdPrm.opchAcptSrc, RAT_OK, AT_CMD_A,
1187 -1,BS_SPEED_NotPresent,CME_ERR_NotPresent );
1188
1189 /* reset/free satShrdPrm.opch* parameters */
1190 cmhSAT_cleanupOpChnPrms();
1191 }
1192 /* check for SEND DATA command context, on-demand channel */
1193 else if( satShrdPrm.opchStat EQ OPCH_EST_REQ AND
1194 satShrdPrm.cmdDet.cmdType EQ SAT_CMD_SEND_DATA )
1195 {
1196 /* command: SEND DATA immediately */
1197
1198 /* NO terminal response and no response to Application needed */
1199
1200 /* reset/free satShrdPrm.opch* parameters */
1201 cmhSAT_cleanupOpChnPrms();
1202 }
1203
1204 /* FREE channel parameter */
1205 if (simShrdPrm.sim_dti_chPrm NEQ NULL)
1206 {
1207 ACI_MFREE(simShrdPrm.sim_dti_chPrm);
1208 simShrdPrm.sim_dti_chPrm = NULL;
1209 TRACE_EVENT("FREE sim_dti_chPrm");
1210 }
1211 }
1212
1213 /*
1214 +-------------------------------------------------------------------+
1215 | PROJECT : GSM-PS () MODULE : PSA_SIMP |
1216 | ROUTINE : psa_sim_bip_cnf |
1217 +-------------------------------------------------------------------+
1218
1219 PURPOSE : processes the SIM_BIP_CNF primitive sent by SIM.
1220
1221 */
1222
1223 GLOBAL void psa_sim_bip_cnf(T_SIM_BIP_CNF *sim_bip_cnf)
1224 {
1225 /* The callback function is used to proceed the action that has been triggered,
1226 * for instance, OPEN BIP channel. The result given by the bip connection
1227 * qualifier may differ from the intended action, because this is actually
1228 * the indicator whether SIM has processed it correctly! */
1229
1230 TRACE_FUNCTION ("psa_sim_bip_cnf()");
1231
1232 if((sim_bip_cnf->bip_conn & simShrdPrm.sim_dti_chPrm->sat_chn_prm.bipConn) > 0)
1233 {
1234 TRACE_EVENT("psa_sim_bip_cnf: BIP operation successful");
1235 }
1236 else
1237 {
1238 TRACE_EVENT("psa_sim_bip_cnf: BIP operation not successful");
1239 }
1240
1241 /*
1242 * go on with requested action
1243 */
1244 if( simShrdPrm.sim_dti_chPrm->bip_cb )
1245 {
1246 /* FREE BIP channel parameter */
1247 simShrdPrm.sim_dti_chPrm->bip_cb(sim_bip_cnf->bip_conn,
1248 sim_bip_cnf->bip_ch_id);
1249 }
1250
1251 }
1252
1253 /*
1254 +-------------------------------------------------------------------+
1255 | PROJECT : GSM-PS () MODULE : PSA_SIMP |
1256 | ROUTINE : psa_sim_dti_cnf |
1257 +-------------------------------------------------------------------+
1258
1259 PURPOSE : processes the SIM_DTI_CNF primitive sent by SIM.
1260
1261 */
1262
1263 GLOBAL void psa_sim_dti_cnf (T_SIM_DTI_CNF *sim_dti_cnf)
1264 {
1265
1266 TRACE_FUNCTION ("psa_sim_dti_cnf()");
1267
1268 if(sim_dti_cnf->dti_conn EQ simShrdPrm.sim_dti_chPrm->sat_chn_prm.dtiConn)
1269 {
1270 /* REQUEST SUCCESSFUL */
1271 if( sim_dti_cnf->dti_conn EQ (SIM_DTI_CONNECT) )
1272 {
1273 /* SUCCESSFUL DTI CONNECTION */
1274 /*
1275 * inform dti manager about successfull connection,
1276 * call cb of DTI initiator
1277 */
1278 dti_cntrl_entity_connected (sim_dti_cnf->link_id, DTI_ENTITY_SIM, DTI_OK);
1279 }
1280 else if( sim_dti_cnf->dti_conn EQ SIM_DTI_DISCONNECT )
1281 {
1282 /* SUCCESSFUL DTI DISCONNECTON */
1283 /* check whether the BIP channel has to be dropped */
1284 if( simShrdPrm.sim_dti_chPrm->sat_chn_prm.bipConn
1285 EQ SIM_BIP_CLOSE_CHANNEL )
1286 {
1287 /* resetting stored SIM DTI ID */
1288 psaSIM_Bip_Req();
1289 }
1290 /*
1291 *inform dti manager about successfull disconnection,
1292 * call cb of DTI function
1293 */
1294
1295 dti_cntrl_entity_disconnected (sim_dti_cnf->link_id, DTI_ENTITY_SIM);
1296
1297 }
1298 /* callback to SAT Source */
1299 if( simShrdPrm.sim_dti_chPrm->dti_cb )
1300 {
1301 simShrdPrm.sim_dti_chPrm->dti_cb(sim_dti_cnf->dti_conn,
1302 sim_dti_cnf->link_id);
1303 }
1304 }
1305 else
1306 {
1307 /* UNSUCCESSFUL DTI CONNECTION OR DISCONNECTION*/
1308 if(sim_dti_cnf->dti_conn EQ SIM_DTI_DISCONNECT)
1309 {
1310 /* UNSUCCESSFUL CONNECTION */
1311 /* inform dti manager that connection request failed */
1312 dti_cntrl_entity_connected (sim_dti_cnf->link_id, DTI_ENTITY_SIM, DTI_ERROR);
1313 }
1314 /*
1315 * error --> callback to SAT Source but not ACI_FREE of
1316 * simShrdPrm.sim_dti_chPrm
1317 */
1318 if( simShrdPrm.sim_dti_chPrm->dti_cb )
1319 {
1320 simShrdPrm.sim_dti_chPrm->dti_cb(sim_dti_cnf->dti_conn,
1321 sim_dti_cnf->link_id);
1322 }
1323 }
1324
1325 PFREE(sim_dti_cnf);
1326 }
1327
1328 #endif /* DTI */
1329 #endif /* #ifdef FF_SAT_E */
1330 /*
1331 +-------------------------------------------------------------------+
1332 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
1333 | ROUTINE : psa_sim_eventlist_cnf |
1334 +-------------------------------------------------------------------+
1335
1336 PURPOSE : processes the SIM_EVENTLIST_CNF primitive sent by SIM.
1337 This is the confirmation of the changed
1338 data available event status(send in SIM_EVENTLIST_REQ)
1339 */
1340
1341 GLOBAL void psa_sim_eventlist_cnf ( T_SIM_EVENTLIST_CNF *sim_eventlist_cnf )
1342 {
1343
1344 TRACE_FUNCTION ("psa_sim_eventlist_cnf()");
1345
1346 switch(sim_eventlist_cnf->event_data_avail)
1347 {
1348 case SIM_EVENT_DISABLE:
1349 case SIM_EVENT_ENABLE:
1350 break;
1351 default:
1352 TRACE_EVENT("psa_sim_eventlist_cnf:not valid event_data_avail");
1353 }
1354 /*
1355 *-------------------------------------------------------------------
1356 * free the primitive buffer
1357 *-------------------------------------------------------------------
1358 */
1359 PFREE (sim_eventlist_cnf);
1360
1361 }
1362
1363 /*
1364 +-------------------------------------------------------------------+
1365 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
1366 | ROUTINE : psa_sim_dti_ind |
1367 +-------------------------------------------------------------------+
1368
1369 PURPOSE : processes the SIM_DTI_IND primitive sent by SIM
1370 indicating closing of BIP channel and dti connection
1371 (because the release timer is expired)
1372 */
1373 #ifdef FF_SAT_E
1374 #ifdef DTI
1375 GLOBAL void psa_sim_dti_bip_ind ( T_SIM_DTI_BIP_IND *sim_dti_bip_ind )
1376 {
1377
1378 TRACE_FUNCTION ("psa_sim_dti_bip_ind()");
1379
1380 /* inform SAT Source about bip_ch_id and dti_conn*/
1381
1382 if((sim_dti_bip_ind->dti_conn NEQ SIM_DTI_DISCONNECT) OR
1383 (sim_dti_bip_ind->dti_conn NEQ SIM_BIP_CLOSE_CHANNEL))
1384 {
1385 TRACE_FUNCTION ("psa_sim_dti_bip_ind: bip/dti parameter combination received!");
1386 }
1387
1388 cmhSAT_OpChnSIMFail( sim_dti_bip_ind->dti_conn,
1389 sim_dti_bip_ind->bip_conn,
1390 sim_dti_bip_ind->bip_ch_id );
1391
1392 /*
1393 *-------------------------------------------------------------------
1394 * free the primitive buffer
1395 *-------------------------------------------------------------------
1396 */
1397 PFREE (sim_dti_bip_ind);
1398
1399 }
1400 #endif /* DTI */
1401 #endif /* #ifdef FF_SAT_E */
1402
1403 /*
1404 +------------------------------------------------------------------------------
1405 | Function : psaSIM_Insert_Continued
1406 +------------------------------------------------------------------------------
1407 | Description : For loading phone book
1408 |
1409 | Parameters :sim_mmi_insert_ind - Primitive
1410 |
1411 | Return : Void
1412 |
1413 +------------------------------------------------------------------------------
1414 */
1415
1416
1417 void psaSIM_Insert_Continued(T_SIM_MMI_INSERT_IND *sim_mmi_insert_ind )
1418 {
1419 #ifdef TI_PS_FFS_PHB
1420 /* Inform the phonebook module about all SIM parameters except ECC */
1421 pb_inserted_sim (MAX_SRV_TBL,
1422 sim_mmi_insert_ind->sim_serv,
1423 &sim_mmi_insert_ind->imsi_field,
1424 sim_mmi_insert_ind->func,
1425 sim_mmi_insert_ind->phase);
1426 #else
1427 pb_build_req(sim_mmi_insert_ind);
1428 #endif
1429 cmhSIM_SIMInserted();
1430 }
1431
1432 /* Implements Measure # 48 */
1433 /*
1434 +-------------------------------------------------------------------+
1435 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
1436 | ROUTINE : psa_sim_update_cnf |
1437 +-------------------------------------------------------------------+
1438
1439 PURPOSE : processes the SIM_READ_CNF primitive send by SIM.
1440 this is the confirmation to the SIM update data operation.
1441 or SIM update absolute record operation.
1442 */
1443
1444 LOCAL void psaSIM_process_sim_upd_rec_cnf ( U8 req_id, U16 cause, UBYTE type )
1445 {
1446 SHORT aId; /* holds access id */
1447
1448 TRACE_FUNCTION ("psaSIM_process_sim_upd_rec_cnf()");
1449
1450 /*
1451 *-----------------------------------------------------------------
1452 * find entry in access parameter table
1453 *-----------------------------------------------------------------
1454 */
1455 aId = req_id;
1456
1457 if( simShrdPrm.atb[aId].ntryUsdFlg AND
1458 simShrdPrm.atb[aId].accType EQ type )
1459 {
1460 /*
1461 *---------------------------------------------------------------
1462 * update access parameter and notify caller
1463 *---------------------------------------------------------------
1464 */
1465 simShrdPrm.atb[aId].errCode = cause;
1466
1467 if( simShrdPrm.atb[aId].rplyCB )
1468 simShrdPrm.atb[aId].rplyCB( aId );
1469 else
1470 simShrdPrm.atb[aId].ntryUsdFlg = FALSE;
1471 }
1472
1473 }
1474
1475 /* Implements Measure # 179 */
1476 /*
1477 +-------------------------------------------------------------------+
1478 | PROJECT : GSM-PS (6147) MODULE : PSA_SIMP |
1479 | ROUTINE : psaSIM_update_simShrdPrm |
1480 +-------------------------------------------------------------------+
1481
1482 PURPOSE : The function updates simShrdPrm when SIM_VERIFY_PIN_CNF
1483 or SIM_CHANGE_PIN_CNF is received.
1484 */
1485
1486 LOCAL void psaSIM_update_simShrdPrm ( U16 cause, U8 pin_id)
1487 {
1488 TRACE_FUNCTION ("psaSIM_update_simShrdPrm()");
1489
1490 switch( cause )
1491 {
1492 case( SIM_NO_ERROR ):
1493 simShrdPrm.PINStat = PS_RDY;
1494 if( pin_id EQ PHASE_2_PIN_1 )
1495 {
1496 simShrdPrm.pn1Stat = PS_RDY;
1497 }
1498 else if( pin_id EQ PHASE_2_PIN_2 )
1499 {
1500 simShrdPrm.pn2Stat = PS_RDY;
1501 }
1502 break;
1503
1504 case( SIM_CAUSE_PIN1_EXPECT ):
1505 simShrdPrm.PINStat = simShrdPrm.pn1Stat = PS_PIN1;
1506 break;
1507
1508 case( SIM_CAUSE_PIN2_EXPECT ):
1509 simShrdPrm.PINStat = simShrdPrm.pn2Stat = PS_PIN2;
1510 break;
1511
1512 case( SIM_CAUSE_PUK1_EXPECT ):
1513 case( SIM_CAUSE_PIN1_BLOCKED):
1514 simShrdPrm.PINStat = PS_PUK1;
1515 break;
1516
1517 case( SIM_CAUSE_PUK2_EXPECT ):
1518 case( SIM_CAUSE_PIN2_BLOCKED):
1519 simShrdPrm.PINStat = PS_PUK2;
1520 break;
1521 default:
1522 break;
1523 }
1524 }
1525
1526
1527 /*==== EOF =========================================================*/
1528
1529