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