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