FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/aci/psa_sim.h @ 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 | |
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 : Definitions for the protocol stack adapter | |
18 | Subscriber Identity Module ( SIM ) | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef PSA_SIM_H | |
23 #define PSA_SIM_H | |
24 | |
25 /*==== CONSTANTS ==================================================*/ | |
26 #define PIN_LEN (8) /* PIN length in bytes */ | |
27 #define MIN_PIN_LEN (4) /* Marcus: Issue 1589: 28/01/2003: Minimum PIN length in bytes */ | |
28 #define PUK_LEN (8) /* PUK length in bytes */ | |
29 #define ICC_LEN (10) /* chip card identifier length in bytes */ | |
30 #define SRV_TAB_LEN MAX_SRV_TBL /* service table length in bytes */ | |
31 #define CBM_ID_LEN (10) /* CBM id length in bytes */ | |
32 #define DPER_KEY_LEN (16) /* de-pers. key length in bytes */ | |
33 #define ACC_MAX (8) /* maximum number of simultanious | |
34 SIM access */ | |
35 #define SRV_ALLOC_ACTIV (0x03) /* SIM service allocated and activated */ | |
36 | |
37 #define NO_ENTRY (-1) /* not a valid entry */ | |
38 | |
39 /* Masking for SIM service table: */ | |
40 #define NO_ALLOCATED 0 | |
41 #define ALLOCATED_AND_DEACTIVATED 2 | |
42 #define ALLOCATED_AND_ACTIVATED 3 | |
43 | |
44 /* CPHS_CSP PLMN mode bit*/ | |
45 #define CPHS_CSP_PLMN_MODE_BIT_OFF 0x00 | |
46 #define CPHS_CSP_PLMN_MODE_BIT_ON 0X01 | |
47 | |
48 #define UBYTES_PER_PLMN 3 | |
49 | |
50 typedef enum | |
51 { | |
52 SRV_CHV1_Disable = 1, /* #1 CHV1 disable function */ | |
53 SRV_ADN, /* #2 Abbreviated Dialling Numbers (ADN) */ | |
54 SRV_FDN, /* #3 Fixed Dialling Numbers (FDN) */ | |
55 SRV_SMS_Storage, /* #4 Short Message Storage (SMS) */ | |
56 SRV_AOC, /* #5 Advice of Charge (AoC) */ | |
57 SRV_CCP, /* #6 Capability Configuration Parameters (CCP) */ | |
58 SRV_PLMN_Select, /* #7 PLMN selector */ | |
59 SRV_RFU1, /* #8 RFU */ | |
60 SRV_MSISDN, /* #9 MSISDN */ | |
61 SRV_EXT1, /* #10 Extension1 */ | |
62 SRV_EXT2, /* #11 Extension2 */ | |
63 SRV_SMS_Parms, /* #12 SMS Parameters */ | |
64 SRV_LDN, /* #13 Last Number Dialled (LND) */ | |
65 SRV_CBM_Ident, /* #14 Cell Broadcast Message Identifier */ | |
66 SRV_GrpLvl1, /* #15 Group Identifier Level 1 */ | |
67 SRV_GrpLvl2, /* #16 Group Identifier Level 2 */ | |
68 SRV_SrvProvName, /* #17 Service Provider Name */ | |
69 SRV_SDN, /* #18 Service Dialling Numbers (SDN) */ | |
70 SRV_EXT3, /* #19 Extension3 */ | |
71 SRV_RFU2, /* #20 RFU */ | |
72 SRV_VCGS, /* #21 VGCS Group Identifier List (EFVGCS and EFVGCSS) */ | |
73 SRV_VBS, /* #22 VBS Group Identifier List (EFVBS and EFVBSS) */ | |
74 SRV_EMLPP, /* #23 enhanced Multi Level Precedence and Pre emption Service */ | |
75 SRV_AutoEMLPP, /* #24 Automatic Answer for eMLPP */ | |
76 SRV_DtaDownlCB, /* #25 Data download via SMS CB */ | |
77 SRV_DtaDownlPP, /* #26 Data download via SMS PP */ | |
78 SRV_MnuSel, /* #27 Menu selection */ | |
79 SRV_CalCntrl, /* #28 Call control */ | |
80 SRV_ProActSIM, /* #29 Proactive SIM */ | |
81 SRV_CBMIdRnge, /* #30 Cell Broadcast Message Identifier Ranges */ | |
82 SRV_BDN, /* #31 Barred Dialling Numbers (BDN) */ | |
83 SRV_EXT4, /* #32 Extension4 */ | |
84 SRV_DePersCK, /* #33 De personalization Control Keys */ | |
85 SRV_CoOpNwL, /* #34 Co operative Network List */ | |
86 SRV_SMS_StatRep, /* #35 Short Message Status Reports */ | |
87 SRV_NwIndAlMS, /* #36 Network's indication of alerting in the MS */ | |
88 SRV_MOSMCtrlSIM, /* #37 Mobile Originated Short Message control by SIM */ | |
89 SRV_GPRS, /* #38 GPRS */ | |
90 SRV_RFU3, /* #39 Image (IMG) */ | |
91 SRV_RFU4, /* #40 SoLSA (Support of Local Service Area) */ | |
92 SRV_USSDsupportInCC, /* #41 USSD string data object supported in Call Control */ | |
93 SRV_No_42, /* #42 RUN AT COMMAND command */ | |
94 SRV_No_43, /* #43 User controlled PLMN Selector with Access Technology */ | |
95 SRV_No_44, /* #44 Operator controlled PLMN Selector with Access Technology */ | |
96 SRV_No_45, /* #45 HPLMN Selector with Access Technology */ | |
97 SRV_No_46, /* #46 CPBCCH Information */ | |
98 SRV_No_47, /* #47 Investigation Scan */ | |
99 SRV_No_48, /* #48 Extended Capability Configuration Parameters */ | |
100 SRV_No_49, /* #49 MExE */ | |
101 SRV_No_50, /* #50 RPLMN last used Access Technology */ | |
102 SRV_PNN, /* #51 PLMN Network Name */ | |
103 SRV_OPL, /* #52 Operator PLMN List */ | |
104 SRV_No_53, /* #53 Mailbox Dialling Numbers */ | |
105 SRV_No_54, /* #54 Message Waiting Indication Status */ | |
106 SRV_No_55, /* #55 Call Forwarding Indication Status */ | |
107 SRV_No_56, /* #56 Service Provider Display Information */ | |
108 SRV_No_57, /* #57 Multimedia Messaging Service (MMS) */ | |
109 SRV_No_58, /* #58 Extension 8 */ | |
110 SRV_No_59 /* #59 MMS User Connectivity Parameters */ | |
111 } T_SIM_SRV; | |
112 | |
113 typedef enum /* SIM status */ | |
114 { | |
115 NO_VLD_SS = 0, /* not a valid SIM status */ | |
116 SS_OK, /* SIM is OK */ | |
117 SS_INV, /* SIM is invalid */ | |
118 SS_BLKD, /* SIM is blocked */ | |
119 SS_URCHB /* SIM is unreachable */ | |
120 } T_SIM_SIMST; | |
121 | |
122 typedef enum /* PIN status */ | |
123 { | |
124 NO_VLD_PS = 0, /* not a valid PIN status */ | |
125 PS_RDY, /* ready, no PIN is requested */ | |
126 PS_PIN1, /* PIN 1 is requested */ | |
127 PS_PIN2, /* PIN 2 is requested */ | |
128 PS_PUK1, /* PUK 1 is requested */ | |
129 PS_PUK2 /* PUK 2 is requested */ | |
130 | |
131 } T_SIM_PINST; | |
132 | |
133 typedef enum /* PIN1 enable/disable status */ | |
134 { | |
135 NO_VLD_PEDS = 0, /* not a valid PED status */ | |
136 PEDS_ENA, /* PIN 1 enabled */ | |
137 PEDS_DIS /* PIN 1 disabled */ | |
138 | |
139 } T_SIM_PEDST; | |
140 | |
141 typedef enum /* SIM access type */ | |
142 { | |
143 NO_VLD_ACT = 0, /* not a valid access type */ | |
144 ACT_RD_DAT, /* read a datafield */ | |
145 ACT_WR_DAT, /* write a datafield */ | |
146 ACT_RD_REC, /* read a record */ | |
147 ACT_WR_REC, /* write a record */ | |
148 ACT_INC_DAT /* increment a datafield */ | |
149 | |
150 } T_SIM_ACTP; | |
151 | |
152 /*==== TYPES ======================================================*/ | |
153 typedef struct SIMSetPrm | |
154 { | |
155 UBYTE actProc; /* activation procedure */ | |
156 UBYTE STKprof[MAX_STK_PRF]; /* SIM toolkit profile */ | |
157 UBYTE PINType; /* type of PIN */ | |
158 CHAR curPIN[PIN_LEN]; /* current PIN */ | |
159 CHAR newPIN[PIN_LEN]; /* new PIN */ | |
160 CHAR unblkKey[PUK_LEN]; /* unblocking key */ | |
161 /* | |
162 ** This flag is the customisation flag, introuduced for the Cust1 MMI. It is defaulted to 0, and is | |
163 ** changed by the AT%CUST=n command. If the %CUST command is not received, the ACI and | |
164 ** other afffected entities will continue to behave as normal | |
165 */ | |
166 UBYTE cust_mode; | |
167 /* | |
168 ** This flag is the STK Call or Short Message Control flag, introuduced for the Cust1 MMI. | |
169 ** It is defaulted to 1, and is changed by the AT%SATCC=n command. If the %SATCC command is not received, | |
170 ** the ACI entity will continue to behave as normal. If CC or SM Control By SIM is disabled it will be re-enabled | |
171 ** automatically, on receipt of a Terminal Response from the MMI. | |
172 */ | |
173 UBYTE sat_cc_mode; | |
174 #ifdef FF_DUAL_SIM | |
175 UBYTE SIM_Selected; /* stores the currently selected SIM number*/ | |
176 #endif /*FF_DUAL_SIM*/ | |
177 } T_SIM_SET_PRM; | |
178 | |
179 typedef struct SIMAccPrm | |
180 { | |
181 UBYTE ntryUsdFlg; /* flags entry usage */ | |
182 UBYTE accType; /* type of access */ | |
183 USHORT reqDataFld; /* requested datafield identifier */ | |
184 USHORT dataOff; /* datafield offset */ | |
185 UBYTE recNr; /* record number */ | |
186 BOOL check_dataLen; /* has size of data to be checked against size of exch buffer ? */ | |
187 UBYTE dataLen; /* data length */ | |
188 UBYTE * exchData; /* points to exchange data buffer */ | |
189 UBYTE recMax; /* maximum records */ | |
190 USHORT errCode; /* error code */ | |
191 void (*rplyCB)(SHORT aId); /* points to reply call-back */ | |
192 } T_SIM_ACC_PRM; | |
193 | |
194 typedef struct SIMTrnsAccPrm | |
195 { | |
196 UBYTE cmd; /* access command */ | |
197 USHORT reqDataFld; /* requested datafield identifier */ | |
198 UBYTE p1; /* parameter 1 */ | |
199 UBYTE p2; /* parameter 2 */ | |
200 UBYTE p3; /* parameter 3 */ | |
201 USHORT dataLen; /* data length in bytes */ | |
202 UBYTE * transData; /* points to data buffer */ | |
203 } T_SIM_TRNS_ACC_PRM; | |
204 | |
205 typedef struct | |
206 { | |
207 UBYTE sw1; /* SIM result code 1 */ | |
208 UBYTE sw2; /* SIM result code 2 */ | |
209 USHORT rspLen; /* length of response data */ | |
210 UBYTE * rsp; /* ponter to response data */ | |
211 } T_SIM_TRNS_RSP_PRM; | |
212 | |
213 #ifdef FF_SAT_E | |
214 typedef struct | |
215 { | |
216 UBYTE dtiConn; /* dti connection qualifier */ | |
217 UBYTE dtiUnit; /* dti connection unit */ | |
218 UBYTE chnId; /* move to sat_bip_chn channel id */ | |
219 UBYTE bipConn; /* bip connection qualifier */ | |
220 UBYTE genRes; /* general result */ | |
221 UBYTE addRes; /* additional result */ | |
222 } T_SIM_SAT_CHN; | |
223 | |
224 #endif /* FF_SAT_E */ | |
225 | |
226 #ifdef FF_SAT_E | |
227 typedef struct | |
228 { | |
229 T_SIM_SAT_CHN sat_chn_prm; | |
230 void (*dti_cb)(UBYTE dtiConn, UBYTE chnId); /* holds callback for DTI estb */ | |
231 void (*bip_cb)(UBYTE bipConn, UBYTE chnId);/* holds callback for BIP estb */ | |
232 } T_SIM_DTI_CH_PRM; | |
233 | |
234 #endif /* F_SAT_E */ | |
235 | |
236 | |
237 typedef struct | |
238 { | |
239 UBYTE plmn[UBYTES_PER_PLMN]; /* Packed PLMN as stored on the SIM */ | |
240 UBYTE pnn_rec_num; | |
241 USHORT lac1; | |
242 USHORT lac2; | |
243 } T_opl; | |
244 | |
245 typedef struct | |
246 { | |
247 UBYTE num_rcd; /* Number of records in EFopl */ | |
248 UBYTE opl_status; /* Status of OPL records retrieval */ | |
249 T_opl opl_rcd[OPL_MAX_RECORDS]; | |
250 } T_opl_field;//EONS | |
251 | |
252 /* | |
253 * Compare this with the similiar struct T_pnn_name in psa_mm.h | |
254 */ | |
255 typedef struct | |
256 { | |
257 UBYTE v_plmn; /* valid flag */ | |
258 UBYTE long_len; /* length of operator long name */ | |
259 UBYTE long_ext_dcs; /* octet 3 of IEI */ | |
260 UBYTE long_name [MAX_LONG_OPER_LEN-1];/* long name for operator, no '\0' */ | |
261 UBYTE shrt_len; /* length of operator short name */ | |
262 UBYTE shrt_ext_dcs; /* octet 3 of IEI */ | |
263 UBYTE shrt_name [MAX_SHRT_OPER_LEN-1];/* short name for operator, no '\0' */ | |
264 } T_pnn; | |
265 | |
266 typedef struct | |
267 { | |
268 UBYTE num_rcd; | |
269 UBYTE pnn_status; | |
270 T_pnn pnn_rcd[PNN_MAX_RECORDS]; | |
271 } T_pnn_field; | |
272 | |
273 typedef struct | |
274 { | |
275 UBYTE len; /* length of atr */ | |
276 UBYTE data[MAX_SIM_ATR]; /* atr data */ | |
277 } T_SIM_ATR; | |
278 | |
279 typedef struct SIMShrdParm | |
280 { | |
281 UBYTE owner; /* identifies the used set */ | |
282 SHORT aId; /* access identifier */ | |
283 T_SIM_SET_PRM setPrm[OWN_MAX]; /* possible sets */ | |
284 T_SIM_ACC_PRM atb[ACC_MAX]; /* table of access parameter */ | |
285 #ifdef FF_DUAL_SIM | |
286 UBYTE SIM_Powered_on; /* stores the currently powered SIM number*/ | |
287 UBYTE SIM_Selection; /* flag to indicate if SIM selection is taking place*/ | |
288 #endif /*FF_DUAL_SIM*/ | |
289 UBYTE PINStat; /* status of PIN requirement */ | |
290 UBYTE pn1Cnt; /* PIN 1 counter */ | |
291 UBYTE pn2Cnt; /* PIN 2 counter */ | |
292 UBYTE pk1Cnt; /* PUK 1 counter */ | |
293 UBYTE pk2Cnt; /* PUK 2 counter */ | |
294 UBYTE pn1Stat; /* PIN 1 status */ | |
295 UBYTE pn2Stat; /* PIN 2 status */ | |
296 UBYTE PINQuery; /* CPIN? when CFUN=0 */ | |
297 UBYTE crdPhs; /* phase of card */ | |
298 UBYTE SIMStat; /* status of SIM card */ | |
299 UBYTE PEDStat; /* PIN1 enable/disable status */ | |
300 UBYTE crdFun; /* SIM card functionality */ | |
301 UBYTE srvTab[SRV_TAB_LEN]; /* SIM service table */ | |
302 T_imsi_field imsi; /* IMSI */ | |
303 UBYTE PLMN_Mode_Bit; /* PLMN mode bit in EF_CSP */ | |
304 UBYTE mnc_len; /* length of MNC in IMSI (2 or 3 digits)*/ | |
305 USHORT rslt; /* result of SIM operation */ | |
306 UBYTE synCs; /* SIM synchronisation cause */ | |
307 BOOL ciSIMEnabled; /* current ciphering indicator state */ | |
308 int fuRef; /* Reference for File Update */ | |
309 BOOL imei_blocked; | |
310 #ifdef FF_SAT_E | |
311 T_SIM_DTI_CH_PRM *sim_dti_chPrm; /* points to sim dti channel parameters */ | |
312 #endif /* FF_SAT_E */ | |
313 T_opl_field opl_list; /* Operator PLMN list (for EONS) */ | |
314 T_pnn_field pnn_list; /* Operator PNN list (for EONS) */ | |
315 UBYTE sat_class_e_dti_id; /* DTI ID for SAT class E */ | |
316 T_SIM_ATR atr; /* Answer to Reset */ | |
317 UBYTE overall_cust_mode; /* Overall Cust Mode, this is set when the SIM is initially activated, | |
318 it is incumbent on the system that once set, every ACI channel | |
319 will use the same customisation mode */ | |
320 T_ACI_SIMEF_MODE SIMEFMode[CMD_SRC_MAX]; /* SIMEF mode for each command source */ | |
321 T_ACI_CLASS classFDN; /* FDN classtype during SIM_ACTIVATE_REQ / SIM_ACTIVATE_CNF */ | |
322 T_ACI_PB_STAT pb_stat; /* SIM phonebook status */ | |
323 } T_SIM_SHRD_PRM; | |
324 | |
325 | |
326 | |
327 typedef enum | |
328 { | |
329 ACI_INIT_TYPE_ALL = 0, /* init all parameters */ | |
330 ACI_INIT_TYPE_SOFT_OFF /* init only parameters for soft power off */ | |
331 } T_ACI_INIT_TYPE; | |
332 | |
333 | |
334 /*==== PROTOTYPES =================================================*/ | |
335 | |
336 EXTERN BOOL psaSIM_hasCustModeBeenSet(void); | |
337 | |
338 EXTERN SHORT psaSIM_VerifyPIN ( void ); | |
339 EXTERN SHORT psaSIM_ChangePIN ( void ); | |
340 EXTERN SHORT psaSIM_DisablePIN ( void ); | |
341 EXTERN SHORT psaSIM_EnablePIN ( void ); | |
342 EXTERN SHORT psaSIM_UnblockCard ( void ); | |
343 EXTERN void psaSIM_SyncSIM ( void ); | |
344 EXTERN SHORT psaSIM_AccessSIMData ( void ); | |
345 #ifdef FF_DUAL_SIM | |
346 EXTERN SHORT psaSIM_SelectSIM ( void ); | |
347 #endif /*FF_DUAL_SIM*/ | |
348 EXTERN SHORT psaSIM_ActivateSIM ( void ); | |
349 EXTERN void psaSIM_Init ( T_ACI_INIT_TYPE init_type ); | |
350 EXTERN void psaSIM_InitAtbNtry ( SHORT idx ); | |
351 EXTERN void psaSIM_CloseAtb ( USHORT error ); | |
352 EXTERN SHORT psaSIM_atbNewEntry ( void ); | |
353 EXTERN SHORT psaSIM_atbFindDatFld ( USHORT datFld2Find, | |
354 UBYTE accType2Find, | |
355 UBYTE recNr2Find ); | |
356 EXTERN CHAR* psaSIM_cnvrtIMSI2ASCII ( CHAR * imsiBuf ); | |
357 EXTERN void psaSIM_decodeIMSI (UBYTE* imsi_field, UBYTE imsi_c_field, CHAR* imsi_asciiz); | |
358 EXTERN void psaSIM_encodeIMSI (CHAR* imsi_asciiz, UBYTE* imsi_c_field, UBYTE* imsi_field); | |
359 #ifdef SIM_PERS_OTA | |
360 EXTERN void aci_slock_ota_init(); | |
361 #endif | |
362 | |
363 | |
364 #ifdef TRACING | |
365 EXTERN void psaSIM_shrPrmDump ( void ); | |
366 #endif /* TRACING */ | |
367 | |
368 EXTERN BOOL psaSIM_ChkSIMSrvSup ( UBYTE srvNr ); | |
369 | |
370 EXTERN SHORT psaSIM_TrnsSIMAccess ( T_SIM_TRNS_ACC_PRM * prm ); | |
371 | |
372 #ifdef FF_SAT_E | |
373 EXTERN void psaSIM_SATBIPChn ( T_SIM_SAT_CHN chnInf, | |
374 void (*cb)(UBYTE bipConn, UBYTE chnId)); | |
375 EXTERN void psaSIM_SATChn ( T_SIM_SAT_CHN chnInf, | |
376 void (*cb)(UBYTE dtiConn, UBYTE chnId)); | |
377 EXTERN void psaSIM_EvDatAvail ( BOOL evStat ); | |
378 EXTERN void psaSIM_Bip_Req ( void ); | |
379 EXTERN void psaSIM_Bip_Config_Req ( ); | |
380 EXTERN void psaSIM_Dti_Req ( ULONG link_id ); | |
381 #endif /* #ifdef FF_SAT_E */ | |
382 | |
383 /*==== EXPORT =====================================================*/ | |
384 | |
385 #ifdef PSA_SIMF_C | |
386 | |
387 GLOBAL T_SIM_SHRD_PRM simShrdPrm; | |
388 | |
389 #else | |
390 | |
391 EXTERN T_SIM_SHRD_PRM simShrdPrm; | |
392 | |
393 #endif /* PSA_SIMF_C */ | |
394 | |
395 | |
396 | |
397 #endif /* PSA_SIM_H */ | |
398 | |
399 /*==== EOF =======================================================*/ |