FreeCalypso > hg > freecalypso-citrine
comparison g23m-gsm/sim/sim.h @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 09 Jun 2016 00:02:41 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:75a11d740a02 |
|---|---|
| 1 /* | |
| 2 +----------------------------------------------------------------------------- | |
| 3 | Project : GSM-PS (6302) | |
| 4 | Modul : SIM | |
| 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 Entity | |
| 18 | SIM Application. | |
| 19 +----------------------------------------------------------------------------- | |
| 20 */ | |
| 21 | |
| 22 #ifndef SIM_H | |
| 23 #define SIM_H | |
| 24 | |
| 25 #include <stdlib.h> | |
| 26 #include <stdio.h> | |
| 27 #ifdef TI_PS_HCOMM_CHANGE | |
| 28 #include "cl_hComm_handle.h" | |
| 29 #endif | |
| 30 | |
| 31 /*==== CONSTANTS ==================================================*/ | |
| 32 #if defined (_SIMULATION_) | |
| 33 #define SIM_TOOLKIT | |
| 34 #endif | |
| 35 | |
| 36 #ifdef SIM_TOOLKIT | |
| 37 #if defined (FF_WAP) OR defined (_SIMULATION_) | |
| 38 #define FF_SAT_C | |
| 39 #endif /* FF_WAP */ | |
| 40 #endif /* SIM_TOOLKIT */ | |
| 41 | |
| 42 #ifdef FF_SAT_E | |
| 43 #include "dti.h" | |
| 44 #endif | |
| 45 | |
| 46 | |
| 47 #ifdef TI_PS_OP_VSI_NO_CALL_ID | |
| 48 #define TIMER_START(C,I,T) vsi_t_start_nc(I,T) | |
| 49 #define TIMER_PSTART(C,I,T,R) vsi_t_pstart_nc(I,T,R) | |
| 50 #define TIMER_STOP(C,I) vsi_t_stop_nc(I) | |
| 51 #define TIMER_STATUS(C,I,T) vsi_t_status_nc(I,T) | |
| 52 #define SUSPEND_SELF(C,T) vsi_t_sleep_nc(T) | |
| 53 #define SYSTEM_TIME(C,T) vsi_t_time_nc(T) | |
| 54 #else /* TI_PS_OP_VSI_NO_CALL_ID */ | |
| 55 #define TIMER_START(C,I,T) vsi_t_start(C,I,T) | |
| 56 #define TIMER_PSTART(C,I,T,R) vsi_t_pstart(C,I,T,R) | |
| 57 #define TIMER_STOP(C,I) vsi_t_stop(C,I) | |
| 58 #define TIMER_STATUS(C,I,T) vsi_t_status(C,I,T) | |
| 59 #define SUSPEND_SELF(C,T) vsi_t_sleep(C,T) | |
| 60 #define SYSTEM_TIME(C,T) vsi_t_time(C,T) | |
| 61 #endif /* TI_PS_OP_VSI_NO_CALL_ID */ | |
| 62 | |
| 63 | |
| 64 /* | |
| 65 * To read 255 bytes the SIM driver shall not append SW1, SW2 | |
| 66 * to the end of the data. To be backward compatible, the | |
| 67 * following define is used. One of both definitions must be used | |
| 68 * depending on the SIM driver capabilities. | |
| 69 */ | |
| 70 //#define SIM_TI_DRV_X_BYTES 2 // SIM driver adds SW1, SW2 to response! | |
| 71 #define SIM_TI_DRV_X_BYTES 0 // SIM driver does not add SW1, SW2 to response! | |
| 72 | |
| 73 #define NO_ALLOCATED 0 | |
| 74 #define ALLOCATED 1 | |
| 75 #define ALLOCATED_AND_DEACTIVATED 2 | |
| 76 #define ALLOCATED_AND_ACTIVATED 3 | |
| 77 | |
| 78 #define NO_BDN_SIM 0 | |
| 79 #define BDN_ENABLED 1 | |
| 80 #define BDN_DISABLED 2 | |
| 81 | |
| 82 #define NO_FDN_SIM 0 | |
| 83 #define FDN_ENABLED 1 | |
| 84 #define FDN_DISABLED 2 | |
| 85 | |
| 86 #define ABSOLUT_READING 0 | |
| 87 #define SIM_TPDU_HEADER_LEN 5 | |
| 88 | |
| 89 /* parameterblocks */ | |
| 90 | |
| 91 /* #define MAX_IMSI 9 moved to SAP SIM */ | |
| 92 #define MAX_KC_N (MAX_KC+1) /* = 9 (SAP SIM) */ | |
| 93 /* #define MAX_PREF_PLMN 96 moved to SAP SIM */ | |
| 94 #define MAX_BCCH_INFO 16 | |
| 95 #define MAX_ACCESS_CONTROL 2 | |
| 96 #define MAX_FORB_PLMN 12 | |
| 97 #define MAX_LOC_INFO 11 | |
| 98 #define MAX_SIM_CHARGE 2 | |
| 99 #define MAX_OP_MODE 1 | |
| 100 | |
| 101 #define MAX_PIN 8 | |
| 102 #define MAX_UNBLOCKING_KEY 8 | |
| 103 #define MAX_ICC_IDENTIF 10 | |
| 104 | |
| 105 #define VFY_CHV1 1 // verify PIN 1 | |
| 106 #define VFY_CHV2 2 // verify PIN 2 | |
| 107 #define UNBL_CHV1 0 // unblock PIN 1 | |
| 108 #define UNBL_CHV2 2 // unblock PIN 2 | |
| 109 | |
| 110 /* | |
| 111 * Access conditions | |
| 112 */ | |
| 113 #define LRP_NONE 0 | |
| 114 #define LRP_PIN_1 (PHASE_2_PIN_1) // 1 | |
| 115 #define LRP_PIN_2 (PHASE_2_PIN_2) // 2 | |
| 116 #define LRP_PUK_1 (PHASE_2_PUK_1) // 3 | |
| 117 #define LRP_PUK_2 (PHASE_2_PUK_2) // 4 | |
| 118 #define LRP_NEVER 5 | |
| 119 | |
| 120 #define PIN_1 LRP_PIN_1 | |
| 121 #define PIN_2 LRP_PIN_2 | |
| 122 #define ALWAYS LRP_NONE | |
| 123 #define NEVER 0xF | |
| 124 #define PIN_1_OR_2 10 | |
| 125 | |
| 126 #define ACCESS_READ 0 | |
| 127 #define ACCESS_UPDATE 1 | |
| 128 #define ACCESS_INCREASE 2 | |
| 129 #define ACCESS_REHABILITATE 3 | |
| 130 #define ACCESS_INVALIDATE 4 | |
| 131 | |
| 132 #define LINEAR_FIXED 1 | |
| 133 | |
| 134 #define SIM_TIMER 0 | |
| 135 | |
| 136 /* | |
| 137 #ifdef SIM_TOOLKIT | |
| 138 #define MAX_SAT_TIMER 8 | |
| 139 #define NUM_OF_SIM_TIMERS (MAX_SAT_TIMER + 1) | |
| 140 #else | |
| 141 #define NUM_OF_SIM_TIMERS 1 | |
| 142 #endif | |
| 143 */ | |
| 144 | |
| 145 #ifdef FF_SAT_E | |
| 146 /* | |
| 147 * timer definitions | |
| 148 * index 0 app_sim_timeout() | |
| 149 * index 1..8 SAT timer | |
| 150 * index 9 BIP timer | |
| 151 */ | |
| 152 #define MAX_SAT_TIMER 8 | |
| 153 #define NUM_OF_SIM_TIMERS (MAX_SAT_TIMER + 2) | |
| 154 #define SIM_BIP_TIMER (MAX_SAT_TIMER + 1) | |
| 155 /* | |
| 156 * states of DTI connection | |
| 157 */ | |
| 158 #define SIM_DTI_CONNECTION_CLOSED 1 | |
| 159 #define SIM_DTI_CONNECTION_BIND 2 | |
| 160 #define SIM_DTI_CONNECTION_SETUP 3 | |
| 161 #define SIM_DTI_CONNECTION_OPEN 4 | |
| 162 /* | |
| 163 * states of DTI RX direction | |
| 164 */ | |
| 165 #define SIM_DTI_RX_IDLE 5 | |
| 166 #define SIM_DTI_RX_READY 6 | |
| 167 /* | |
| 168 * states of DTI TX direction | |
| 169 */ | |
| 170 #define SIM_DTI_TX_IDLE 7 | |
| 171 #define SIM_DTI_TX_READY 8 | |
| 172 /* | |
| 173 * states of BIP channel | |
| 174 */ | |
| 175 #define SIM_BIP_CLOSED 9 | |
| 176 #define SIM_BIP_OPEN 10 | |
| 177 #define SIM_BIP_CONNECTED 11 | |
| 178 /* | |
| 179 * states of BIP RX direction | |
| 180 */ | |
| 181 #define SIM_BIP_RX_IDLE 12 | |
| 182 #define SIM_BIP_RX_DATA 13 | |
| 183 /* | |
| 184 * states of BIP TX direction | |
| 185 */ | |
| 186 #define SIM_BIP_TX_IDLE 14 | |
| 187 #define SIM_BIP_TX_STORE 15 | |
| 188 #define SIM_BIP_TX_SEND 16 | |
| 189 /* | |
| 190 * states of BIP release timer | |
| 191 */ | |
| 192 #define SIM_BIP_TIMER_DISCONNECTED 18 | |
| 193 #define SIM_BIP_TIMER_NOT_USED 19 | |
| 194 #define SIM_BIP_TIMER_SUSPENDED 20 | |
| 195 #define SIM_BIP_TIMER_STOPPED 21 | |
| 196 #define SIM_BIP_TIMER_START 22 | |
| 197 /* | |
| 198 * CCD analysis states | |
| 199 */ | |
| 200 #define SIM_CCD_OK 23 | |
| 201 #define SIM_CCD_RETURN 24 | |
| 202 #define SIM_CCD_DISCARD 25 | |
| 203 /* | |
| 204 * initial state for connection qualifier (no status change requested) | |
| 205 */ | |
| 206 #define SIM_DTI_CONN_OFF 0 | |
| 207 /* | |
| 208 * maximum nuber of bytes in Channel Data element in Termina Response message | |
| 209 * message structure: | |
| 210 * Command Details: 5 bytes | |
| 211 * Device Identities: 4 bytes | |
| 212 * Result: 3 bytes (without additional result) | |
| 213 * Channel Data: 3 bytes overhead | |
| 214 * Channel Data Length: 3 bytes | |
| 215 * --------- | |
| 216 * 18 bytes | |
| 217 * maximum length for any data sent to SIM is 255! | |
| 218 */ | |
| 219 #define SIM_TERM_RESP_MAX_CHANNEL_DATA (255 - 18) | |
| 220 /* | |
| 221 * transmit descriptor size | |
| 222 */ | |
| 223 #define SIM_BIP_TX_DESC_SIZE (100 - sizeof(T_desc2)) | |
| 224 /* | |
| 225 * qualifier bits of SEND DATA message | |
| 226 */ | |
| 227 #define SIM_QLF_SEND_DATA_1 0x01 | |
| 228 /* | |
| 229 * Definition whether a shared CCD buffer shall be used | |
| 230 */ | |
| 231 #define SHARED_CCD_BUF | |
| 232 | |
| 233 #elif defined (SIM_TOOLKIT) /* else if FF_SAT_E */ | |
| 234 #define MAX_SAT_TIMER 8 | |
| 235 #define NUM_OF_SIM_TIMERS (MAX_SAT_TIMER + 2) | |
| 236 #else /* SIM_TOOLKIT */ | |
| 237 #define NUM_OF_SIM_TIMERS 2 | |
| 238 #endif | |
| 239 | |
| 240 #define SLEEP_TIMER (NUM_OF_SIM_TIMERS - 1) | |
| 241 | |
| 242 #define MAX_STK_LENGTH 80 | |
| 243 | |
| 244 #ifdef TI_PS_UICC_CHIPSET_15 | |
| 245 #define UICC_READER_ID 0x01 | |
| 246 #endif | |
| 247 | |
| 248 /* These are the only two peer second level standard defined DF's supported now. | |
| 249 When more second level DF's are getting handled, this macro needs to be | |
| 250 adapted */ | |
| 251 #define SIM_IS_PEER_LEVEL2_DF(df1,df2) \ | |
| 252 ((df1 EQ SIM_DF_MEXE AND df2 EQ SIM_DF_SOLSA) || \ | |
| 253 (df1 EQ SIM_DF_SOLSA AND df2 EQ SIM_DF_MEXE) ) | |
| 254 | |
| 255 /* These are the only three second level standard defined DF's supported now. | |
| 256 When more second level DF's are getting handled, this macro needs to be | |
| 257 adapted */ | |
| 258 #define SIM_IS_DF_LEVEL2_UNDER_DF_LEVEL1(df_level2, df_level1) \ | |
| 259 ((df_level2 EQ SIM_DF_MEXE AND \ | |
| 260 (df_level1 EQ SIM_DF_GSM || df_level1 EQ SIM_DF_1800)) || \ | |
| 261 (df_level2 EQ SIM_DF_SOLSA AND \ | |
| 262 (df_level1 EQ SIM_DF_GSM || df_level1 EQ SIM_DF_1800)) || \ | |
| 263 (df_level2 EQ SIM_DF_GRAPHICS AND df_level1 EQ SIM_DF_TELECOM) ) | |
| 264 | |
| 265 #define SIM_SYNC_AWAIT_MM_READ 1 | |
| 266 #define SIM_SYNC_AWAIT_MMI_READ 2 | |
| 267 | |
| 268 /* | |
| 269 +********************************************************************+ | |
| 270 | Moved from sim_stk.c - for CQ 34109 under feature flag SIM_TOOLKIT | | |
| 271 +********************************************************************+ | |
| 272 */ | |
| 273 | |
| 274 #ifdef SIM_TOOLKIT | |
| 275 | |
| 276 #define STK_REFRESH 0x01 | |
| 277 #define STK_MORE_TIME 0x02 | |
| 278 #define STK_POLL_INTERVALL 0x03 | |
| 279 #define STK_POLLING_OFF 0x04 | |
| 280 #define STK_SETUP_EVENT_LIST 0x05 | |
| 281 | |
| 282 #define STK_SET_UP_CALL 0x10 | |
| 283 #define STK_SEND_SS 0x11 | |
| 284 #define STK_SEND_USSD 0x12 | |
| 285 #define STK_SEND_SMS 0x13 | |
| 286 #define STK_SEND_DTMF 0x14 | |
| 287 #define STK_LAUNCH_BROWSER 0x15 | |
| 288 | |
| 289 #define STK_PLAY_TONE 0x20 | |
| 290 #define STK_DISPLAY_TEXT 0x21 | |
| 291 #define STK_GET_INKEY 0x22 | |
| 292 #define STK_GET_INPUT 0x23 | |
| 293 #define STK_SELECT_ITEM 0x24 | |
| 294 #define STK_SET_UP_MENU 0x25 | |
| 295 #define STK_PROVIDE_LOCAL_INFO 0x26 | |
| 296 #define STK_TIMER_MANAGEMENT 0x27 | |
| 297 #define STK_SETUP_IDLE_TEXT 0x28 | |
| 298 | |
| 299 #define STK_RUN_AT_CMD 0x34 | |
| 300 #define STK_LANGUAGE_NOTIFICATION 0x35 | |
| 301 | |
| 302 #ifdef FF_SAT_E | |
| 303 #define STK_OPEN_CHANNEL 0x40 | |
| 304 #define STK_CLOSE_CHANNEL 0x41 | |
| 305 #define STK_RECEIVE_DATA 0x42 | |
| 306 #define STK_SEND_DATA 0x43 | |
| 307 #define STK_GET_CHANNEL_STAT 0x44 | |
| 308 #endif /* FF_SAT_E */ | |
| 309 | |
| 310 #define STK_COMPREHENSION_REQUIRED 0x80 | |
| 311 | |
| 312 #define STK_COMMAND_DETAILS_TAG 0x01 | |
| 313 #define STK_COMMAND_DETAILS_LEN 3 | |
| 314 | |
| 315 #define STK_DEVICE_IDENTITY_TAG 0x02 | |
| 316 #define STK_DEVICE_IDENTITY_LEN 2 | |
| 317 | |
| 318 #define STK_RESULT_TAG 0x03 | |
| 319 | |
| 320 #define STK_DURATION_TAG 0x04 | |
| 321 #define STK_DURATION_LEN 2 | |
| 322 | |
| 323 #define STK_ALPHA_IDENTITY_TAG 0x05 | |
| 324 #define STK_ALPHA_IDENTITY_LEN 1 | |
| 325 | |
| 326 #define STK_FILE_LIST_TAG 0x12 | |
| 327 #define STK_FILE_LIST_LEN 1 | |
| 328 | |
| 329 #define STK_EVENT_LIST_TAG 0x19 | |
| 330 #define STK_EVENT_LIST_LEN 1 | |
| 331 | |
| 332 #define STK_ICON_IDENTITY_TAG 0x1E | |
| 333 #define STK_ICON_IDENTITY_LEN 2 | |
| 334 | |
| 335 #define STK_TIMER_ID_TAG 0x24 | |
| 336 #define STK_TIMER_ID_LEN 1 | |
| 337 | |
| 338 #define STK_TIMER_VALUE_TAG 0x25 | |
| 339 #define STK_TIMER_VALUE_LEN 3 | |
| 340 | |
| 341 #define STK_CHANNEL_DATA_TAG 0x36 | |
| 342 #define STK_CHANNEL_DATA_LEN 1 | |
| 343 | |
| 344 #define STK_CHANNEL_DATA_LGTH_TAG 0x37 | |
| 345 #define STK_CHANNEL_DATA_LGTH_LEN 1 | |
| 346 | |
| 347 #define STK_PROACTIVE_SIM_COMMAND_TAG 0xD0 | |
| 348 #define STK_TIMER_EXPIRATION_TAG 0xD7 | |
| 349 | |
| 350 #define STK_RES_SUCCESS 0x00 | |
| 351 #define STK_RES_SUCC_PART_COMPR 0x01 | |
| 352 #define STK_RES_SUCC_MISS_INFO 0x02 | |
| 353 #define STK_RES_SUCC_ADD_EF_READ 0x03 | |
| 354 #define STK_RES_SUCC_SESSION_END 0x10 | |
| 355 | |
| 356 #define STK_RES_BUSY_ME 0x20 | |
| 357 #define STK_RES_BUSY_NW 0x21 | |
| 358 #define STK_RES_BUSY_TIMER_STATE 0x24 | |
| 359 | |
| 360 #define STK_RES_ERR_NO_SUPPORT 0x30 | |
| 361 #define STK_RES_ERR_CMD_TYPE 0x31 | |
| 362 #define STK_RES_ERR_CMD_DATA 0x32 | |
| 363 #define STK_RES_ERR_CMD_NR 0x33 | |
| 364 #define STK_RES_ERR_MISS_VALUE 0x36 | |
| 365 | |
| 366 #define STK_RES_EXT_DEF 0x00 | |
| 367 #define STK_RES_EXT_BUSY_CALL 0x02 | |
| 368 #define STK_RES_EXT_NO_SERVICE 0x04 | |
| 369 #define STK_RES_SUCC_LIMITED_SERVICE 0x06 | |
| 370 | |
| 371 #define STK_MAX_EXP_TAG 12 /* >= any max_tag entry */ | |
| 372 | |
| 373 #define item_of(_x_) (sizeof(_x_)/sizeof(_x_[0])) | |
| 374 #define BCD2INT(_x_) ((_x_&0xF)*10+(_x_>>4)) | |
| 375 #define INT2BCD(_x_) (((_x_%10)<<4)|((_x_/10)&0xF)) | |
| 376 | |
| 377 #define STK_TP12_CLASS_E (SAT_TP12_OPEN_CHANNEL | SAT_TP12_CLOSE_CHANNEL\ | |
| 378 | SAT_TP12_RECEIVE_DATA | SAT_TP12_SEND_DATA\ | |
| 379 | SAT_TP12_GET_CHANNEL_STAT) | |
| 380 | |
| 381 /* | |
| 382 * Added for the purpose of checking service mode got from Common Library | |
| 383 */ | |
| 384 #define NO_SERVICE (0x0) /* no service available */ | |
| 385 #define LIMITED_SERVICE (0x1) /* Limited service available */ | |
| 386 #define FULL_SERVICE (0x2) /* Full service available */ | |
| 387 | |
| 388 #endif /* SIM_TOOLKIT */ | |
| 389 | |
| 390 #ifdef GPRS | |
| 391 /* | |
| 392 * provision of PCM definition as long as they are missing in L1 | |
| 393 */ | |
| 394 #ifndef EF_LOCGPRS_ID | |
| 395 #define EF_LOCGPRS_ID "LOCGPRS" /* Location Inf. (GPRS) */ | |
| 396 typedef struct EFlocgprs /* GPRS Location information */ | |
| 397 { | |
| 398 UBYTE ptmsi[4]; | |
| 399 UBYTE ptmsi_signature[3]; | |
| 400 UBYTE rai[6]; | |
| 401 UBYTE ra_status; | |
| 402 } EF_LOCGPRS; | |
| 403 | |
| 404 #define SIZE_EF_LOCGPRS sizeof (EF_LOCGPRS) | |
| 405 #define NR_EF_LOCGPRS 1 | |
| 406 #endif | |
| 407 | |
| 408 #ifndef EF_KCGPRS_ID | |
| 409 #define EF_KCGPRS_ID "KCGPRS" /* Ciphering Key (GPRS) */ | |
| 410 typedef struct EFkcgprs /* GPRS Ciphering key */ | |
| 411 { | |
| 412 UBYTE kc[8]; | |
| 413 UBYTE cksn; | |
| 414 } EF_KCGPRS; | |
| 415 | |
| 416 #define SIZE_EF_KCGPRS sizeof (EF_KCGPRS) | |
| 417 #define NR_EF_KCGPRS 1 | |
| 418 #endif | |
| 419 | |
| 420 #ifndef EF_IMSIGPRS_ID | |
| 421 #define EF_IMSIGPRS_ID "IMSIGPRS" /* IMSI check for GPRS */ | |
| 422 typedef struct EFimsigprs /* International Subscriber Id */ | |
| 423 { | |
| 424 UBYTE len; | |
| 425 UBYTE IMSI[8]; | |
| 426 } EF_IMSIGPRS; | |
| 427 | |
| 428 #define SIZE_EF_IMSIGPRS sizeof (EF_IMSIGPRS) | |
| 429 #define NR_EF_IMSIGPRS 1 | |
| 430 #endif | |
| 431 #endif | |
| 432 | |
| 433 /*==== TYPES ======================================================*/ | |
| 434 | |
| 435 /* CHIPCARD RESPONSES */ | |
| 436 | |
| 437 typedef struct { | |
| 438 UBYTE filler1[4]; | |
| 439 UBYTE fileid[2]; | |
| 440 UBYTE filler1a[6]; | |
| 441 UBYTE length; | |
| 442 UBYTE characteristics; | |
| 443 UBYTE filler2[4]; | |
| 444 UBYTE pinstatus; | |
| 445 UBYTE unbstatus; | |
| 446 UBYTE pin2status; | |
| 447 UBYTE unb2status; | |
| 448 UBYTE sw1, sw2; // needed by SIM_GetResponse() | |
| 449 } T_DIR_STATUS; | |
| 450 #define SIM_MIN_DMF_ST_LEN 22 // Mimimum length for response of SELECT MF/DF | |
| 451 | |
| 452 typedef struct { | |
| 453 UBYTE filler1[2]; | |
| 454 UBYTE field_size [2]; | |
| 455 UBYTE filler2[4]; | |
| 456 UBYTE access_1; | |
| 457 UBYTE access_2; | |
| 458 UBYTE access_3; | |
| 459 UBYTE file_status; | |
| 460 UBYTE filler4; | |
| 461 UBYTE field_type; | |
| 462 UBYTE record_length; | |
| 463 UBYTE sw1, sw2; // needed by SIM_GetResponse() | |
| 464 } T_FIELD_STATUS; | |
| 465 #define SIM_MIN_EF_ST_LEN 15 // Minimum length for response of SELECT EF | |
| 466 | |
| 467 typedef struct { | |
| 468 UBYTE sres[4]; | |
| 469 UBYTE kc[8]; | |
| 470 UBYTE sw1, sw2; // needed by SIM_GetResponse() | |
| 471 } T_SRES_KC; | |
| 472 #define SIM_GSM_ALG_LEN 12 // Minimum length for response of RUN GSM ALG | |
| 473 | |
| 474 typedef struct { | |
| 475 BYTE res_incr[3]; | |
| 476 } T_RES_INCR; | |
| 477 | |
| 478 typedef struct { // format of SAT timer value, given in | |
| 479 UBYTE hour; // hours, | |
| 480 UBYTE minute; // minutes and | |
| 481 UBYTE second; // seconds. Coding as for SCTS (GSM 03.40) | |
| 482 UBYTE active; // TRUE, if timer is running | |
| 483 } T_SAT_TIMER; | |
| 484 | |
| 485 #ifdef FF_SAT_E | |
| 486 /* | |
| 487 * struct to transfer IP addresses and UDP ports between UDP and SIM | |
| 488 */ | |
| 489 typedef struct { | |
| 490 UBYTE src_ip[4]; /* source IP address in network byte order */ | |
| 491 UBYTE des_ip[4]; /* destination IP address in network byte order */ | |
| 492 UBYTE src_port[2]; /* source UDP port in network byte order */ | |
| 493 UBYTE des_port[2]; /* destination UDP port in network byte order */ | |
| 494 } T_SRC_DES; | |
| 495 #endif /* FF_SAT_E */ | |
| 496 | |
| 497 /* | |
| 498 * Used for requesting location information from RR | |
| 499 */ | |
| 500 typedef struct | |
| 501 { | |
| 502 UBYTE stk_class; | |
| 503 UBYTE stk_subclass; | |
| 504 UBYTE stk_type; | |
| 505 UBYTE stk_length; | |
| 506 UBYTE stk_parameter [MAX_STK_LENGTH]; | |
| 507 } stk_data_type; | |
| 508 | |
| 509 #if defined (SIM_TOOLKIT) | |
| 510 typedef struct | |
| 511 { | |
| 512 UBYTE response[256]; | |
| 513 stk_data_type stk_data; | |
| 514 } | |
| 515 T_STK_POLL_DATA; | |
| 516 | |
| 517 /* | |
| 518 * Used for the processing of SIM Refresh in stk_proactive_polling() and | |
| 519 * stk_sim_refresh_user_res() | |
| 520 */ | |
| 521 typedef struct | |
| 522 { | |
| 523 UBYTE *tag2; /* File List. 3rd Tag in STK command */ | |
| 524 SHORT fl_len; /* File List Length */ | |
| 525 UBYTE *p_cmd; /* STK command */ | |
| 526 SHORT cmd_len; /* STK command length */ | |
| 527 UBYTE res_code [2] ; | |
| 528 T_SIM_TOOLKIT_IND *sig_ptr; | |
| 529 }T_CONTEXT_SWITCH; | |
| 530 #endif | |
| 531 | |
| 532 | |
| 533 typedef struct | |
| 534 { | |
| 535 // General SIM Variables | |
| 536 ULONG flags; // contains several flags for internal handling | |
| 537 USHORT act_directory; // last selected directory | |
| 538 USHORT act_field; // last selected elementary field | |
| 539 T_TIME status_time; // status poll time | |
| 540 USHORT act_length; // actual file or record length | |
| 541 USHORT sim_data_len; // response data len | |
| 542 USHORT dir_status_len; // size of directory status information | |
| 543 USHORT remove_error; // provides error code for SIM Remove | |
| 544 UBYTE sim_phase; // sim card phase | |
| 545 UBYTE last_requested_pin_no; // last requested pin number | |
| 546 UBYTE act_access; // actual access condition | |
| 547 UBYTE max_record; // records of actual file | |
| 548 UBYTE field_type; // of the last selected record | |
| 549 UBYTE sw1; // last status code SW1 from SIM | |
| 550 UBYTE sw2; // last status code SW2 from SIM | |
| 551 // SIM Toolkit Variables | |
| 552 #ifdef SIM_TOOLKIT | |
| 553 UBYTE sync_awaited; /* Stores entities from which SYNC_REQ is awaited */ | |
| 554 UBYTE file_change_resp; // tracks response to FILE CHANGE | |
| 555 T_CONTEXT_SWITCH *context_switch_ptr; // Allows handling of SIM Refresh from different threads | |
| 556 SHORT proactive_sim_data_len; | |
| 557 USHORT stk_resp_len; | |
| 558 UBYTE stk_response[16]; // save TERMINAL RESPONSE | |
| 559 UBYTE stk_profile[MAX_STK_PRF]; | |
| 560 UBYTE trmst[MAX_TRMST]; // Terminal Support Table | |
| 561 USHORT cell_identity; | |
| 562 T_loc_info location_info; | |
| 563 T_SAT_TIMER timer[MAX_SAT_TIMER]; | |
| 564 UBYTE sat_session; /* SAT session started */ | |
| 565 UBYTE ext_sat_cmd; /* indicator for external SAT commands */ | |
| 566 UBYTE term_resp_sent; /* indicator if Terminal Response was sent */ | |
| 567 UBYTE idle_polling; /* poll SIM in idle mode */ | |
| 568 UBYTE chk_sat_avail; /* check SAT command to be fetched */ | |
| 569 #ifdef FF_SAT_E | |
| 570 UBYTE dti_connection_state; /* state of DTI connection */ | |
| 571 UBYTE dti_rx_state; /* state of DTI reception */ | |
| 572 UBYTE dti_tx_state; /* state of DTI transmission */ | |
| 573 UBYTE event_data_avail; /* Data available event */ | |
| 574 UBYTE bip_ch_id; /* BIP channel identifier */ | |
| 575 UBYTE bip_suspend; /* BIP suspension state */ | |
| 576 UBYTE bip_state; /* state of BIP channel */ | |
| 577 UBYTE bip_rx_state; /* state of BIP reception */ | |
| 578 UBYTE bip_tx_state; /* state of BIP transmission */ | |
| 579 UBYTE bip_timer_state; /* state of BIP release timer */ | |
| 580 UBYTE bip_general_result; /* general result code for on demand link */ | |
| 581 UBYTE bip_add_info_result; /* additional information for on demand link */ | |
| 582 UBYTE con_type; /* connection type */ | |
| 583 USHORT received_data_pos; /* start of not yet delivered data */ | |
| 584 DTI_HANDLE hDTI; /* DTILIB handle */ | |
| 585 T_TIME bip_release_time; /* BIP release time */ | |
| 586 ULONG link_id; /* DTI link identifer */ | |
| 587 T_desc_list2 data_to_send; /* DTI data to send */ | |
| 588 T_desc_list2 prev_data_to_send; /* last values of DTI data to send */ | |
| 589 T_desc_list2 received_data; /* received DTI data */ | |
| 590 T_SRC_DES udp_parameters; /* ports and IP addresses for UDP */ | |
| 591 T_SIM_DTI_REQ* sim_dti_req; /* storage of SIM_DTI_REQ primitive */ | |
| 592 T_SIM_BIP_REQ* sim_bip_req; /* storage of SIM_BIP_REQ primitive */ | |
| 593 T_SIM_BIP_CONFIG_REQ* sim_bip_config_req; /* storage of SIM_BIP_CONFIG_REQ primitive */ | |
| 594 T_cmd_details bip_rx_cmd_details; /* command details for RX */ | |
| 595 T_cmd_details bip_tx_cmd_details; /* command details for TX */ | |
| 596 BUF_cmd_prms bip_cmd_prms; /* parameter buffer for RX and TX */ | |
| 597 #endif /* FF_SAT_E */ | |
| 598 UBYTE cust_mode; /* Customer mode, rcvd in SIM_ACTIVATE_REQ */ | |
| 599 UBYTE user_confirmation_expected; /* confirmation for SIM REFRESH expected */ | |
| 600 #endif /* SIM_TOOLKIT */ | |
| 601 // Windows Simulation Variables | |
| 602 #if defined (_SIMULATION_) | |
| 603 USHORT mode; | |
| 604 #ifdef FF_DUAL_SIM | |
| 605 UBYTE simu_sim_num; | |
| 606 #endif /*FF_DUAL_SIM*/ | |
| 607 #endif /* _SIMULATION_ */ | |
| 608 #ifdef FF_DUAL_SIM | |
| 609 UBYTE SIM_Selection; | |
| 610 USHORT sim_num; | |
| 611 #endif /*FF_DUAL_SIM*/ | |
| 612 } T_SIM_DATA; | |
| 613 | |
| 614 typedef struct | |
| 615 { | |
| 616 UBYTE invers; | |
| 617 UBYTE atr_size; | |
| 618 UBYTE atr_data[MAX_SIM_ATR]; | |
| 619 } | |
| 620 T_SIM_CARD; | |
| 621 | |
| 622 #if defined (SIM_TOOLKIT) | |
| 623 typedef struct // simple TERMINAL RESPONSE without parameters | |
| 624 { | |
| 625 UBYTE cmd_tag; // command details tag | |
| 626 UBYTE cmd_len; // command details length = 3 | |
| 627 UBYTE cmd_nr; // command reference number | |
| 628 UBYTE cmd_type; // command type | |
| 629 UBYTE cmd_qulf; // command qualifier | |
| 630 UBYTE dev_tag; // device identities tag | |
| 631 UBYTE dev_len; // device identities length = 2 | |
| 632 UBYTE dev_src; // source device identity | |
| 633 UBYTE dev_dest; // destination device identity | |
| 634 UBYTE res_tag; // result length tag | |
| 635 UBYTE res_len; // result length | |
| 636 UBYTE res_gnrl; // general result | |
| 637 UBYTE res_add_info[1]; // additional information on result | |
| 638 } T_SIM_TRSP_SIMPLE; | |
| 639 #define SAT_TRSP_HEADER 9 | |
| 640 #define SAT_TRSP_MIN_RES 12 | |
| 641 #endif | |
| 642 | |
| 643 | |
| 644 /* | |
| 645 * FLAGS | |
| 646 * | |
| 647 * The SIM entity contains several flags. To save RAM all flags | |
| 648 * are handled in a bit array. | |
| 649 * | |
| 650 * The following Macros are used | |
| 651 * | |
| 652 * SIM_SET_FLAG (bit) sets the corresponding bit | |
| 653 * SIM_CLEAR_FLAG (bit) clears the corresponding bit | |
| 654 * SIM_IS_FLAG_SET (bit) checks whether the corresponding bit is set | |
| 655 * SIM_IS_FLAG_CLEARED (bit) checks whether the corresponding bit is cleared | |
| 656 * | |
| 657 */ | |
| 658 #define SIM_SET_FLAG(bit) (sim_data.flags |= (1UL<<bit)) | |
| 659 #define SIM_CLEAR_FLAG(bit) (sim_data.flags &= ~(1UL<<bit)) | |
| 660 #define SIM_IS_FLAG_SET(bit) (sim_data.flags & (1UL<<bit)) | |
| 661 #define SIM_IS_FLAG_CLEARED(bit) ((sim_data.flags & (1UL<<bit)) EQ 0) | |
| 662 /* | |
| 663 * The following flags are defined: | |
| 664 * | |
| 665 * ADN_SUPPORT_BY_SIM (bit 0) | |
| 666 * 1 The current SIM supports ADN | |
| 667 * 0 The current SIM doesn't support ADN | |
| 668 */ | |
| 669 #define ADN_SUPPORT_BY_SIM 0 | |
| 670 /* | |
| 671 * FDN_SUPPORT_BY_SIM (bit 1) | |
| 672 * 1 The current SIM supports FDN | |
| 673 * 0 The current SIM doesn't support FDN | |
| 674 */ | |
| 675 #define FDN_SUPPORT_BY_SIM 1 | |
| 676 /* | |
| 677 * BDN_SUPPORT_BY_SIM (bit 2) | |
| 678 * 1 The current SIM supports BDN | |
| 679 * 0 The current SIM doesn't support BDN | |
| 680 */ | |
| 681 #define BDN_SUPPORT_BY_SIM 2 | |
| 682 /* | |
| 683 * FDN_SUPPORT_BY_MMI (bit 3) | |
| 684 * 1 The current MMI supports FDN | |
| 685 * 0 The current MMI doesn't support FDN | |
| 686 */ | |
| 687 #define FDN_SUPPORT_BY_MMI 3 | |
| 688 /* | |
| 689 * BDN_SUPPORT_BY_SIM (bit 4) | |
| 690 * 1 The current MMI supports BDN | |
| 691 * 0 The current MMI doesn't support BDN | |
| 692 */ | |
| 693 #define BDN_SUPPORT_BY_MMI 4 | |
| 694 /* | |
| 695 * CC_WITH_STK (bit 5) | |
| 696 * 1 The current MMI supports Call Control with SIM Toolkit | |
| 697 * 0 The current MMI supports Call Control with SIM Toolkit | |
| 698 */ | |
| 699 #define CC_WITH_STK 5 | |
| 700 /* | |
| 701 * SERVICE_2_SUPPORT (bit 6) | |
| 702 * 1 The current SIM supports service 2 (FDN) | |
| 703 * 0 The current SIM supports service 2 (FDN) | |
| 704 */ | |
| 705 #define SERVICE_2_SUPPORT 6 | |
| 706 /* | |
| 707 * SERVICE_3_SUPPORT (bit 7) | |
| 708 * 1 The current SIM supports service 3 (ADN) | |
| 709 * 0 The current SIM supports service 3 (ADN) | |
| 710 */ | |
| 711 #define SERVICE_3_SUPPORT 7 | |
| 712 /* | |
| 713 * SERVICE_4_SUPPORT (bit 8) | |
| 714 * 1 The current SIM supports service 4 (SMS Status) | |
| 715 * 0 The current SIM supports service 4 (SMS Status) | |
| 716 */ | |
| 717 #define SERVICE_4_SUPPORT 8 | |
| 718 /* | |
| 719 * SERVICE_7_SUPPORT (bit 9) | |
| 720 * 1 The current SIM supports service 7 (Preferred PLMN) | |
| 721 * 0 The current SIM supports service 7 (Preferred PLMN) | |
| 722 */ | |
| 723 #define SERVICE_7_SUPPORT 9 | |
| 724 /* | |
| 725 * SERVICE_26_SUPPORT (bit 10) | |
| 726 * 1 The current SIM supports service 26 (Data Download via SMS) | |
| 727 * 0 The current SIM supports service 26 (Data Download via SMS) | |
| 728 */ | |
| 729 #define SERVICE_26_SUPPORT 10 | |
| 730 /* | |
| 731 * SERVICE_31_SUPPORT (bit 11) | |
| 732 * 1 The current SIM supports service 31 (BDN) | |
| 733 * 0 The current SIM supports service 31 (BDN) | |
| 734 */ | |
| 735 #define SERVICE_31_SUPPORT 11 | |
| 736 /* | |
| 737 * GSM_DATAFIELD (bit 12) | |
| 738 * 1 The initial directory is DF 900 | |
| 739 * 0 The initial directory is DF 1800 | |
| 740 */ | |
| 741 #define GSM_DATAFIELD 12 | |
| 742 /* | |
| 743 * SIM_INSERT (bit 13) | |
| 744 * 1 SIM is inserted | |
| 745 * 0 SIM is not inserted | |
| 746 */ | |
| 747 #define SIM_INSERT 13 | |
| 748 /* | |
| 749 * MM_KNOWS_FROM_SIM (bit 14) | |
| 750 * 1 MM knows from the SIM card content | |
| 751 * 0 MM doesn't know from the SIM card content | |
| 752 */ | |
| 753 #define MM_KNOWS_FROM_SIM 14 | |
| 754 /* | |
| 755 * SIM_PIN_FLAG (bit 15) | |
| 756 * 1 PIN entering is needed | |
| 757 * 0 PIN entering is not needed | |
| 758 */ | |
| 759 #define SIM_PIN_FLAG 15 | |
| 760 /* | |
| 761 * PRO_ACTIVE_SIM (bit 16) | |
| 762 * 1 The current SIM supports SIM Toolkit | |
| 763 * 0 The current SIM doesn't support SIM Toolkit | |
| 764 */ | |
| 765 #define PRO_ACTIVE_SIM 16 | |
| 766 /* | |
| 767 * ACTIVATION_STARTED (bit 17) | |
| 768 * 1 Activation started by MMI | |
| 769 * 0 Activation started by SIM driver | |
| 770 */ | |
| 771 #define ACTIVATION_STARTED 17 | |
| 772 /* | |
| 773 * CALL_ACTIVE (bit 18) | |
| 774 * 1 A call is active | |
| 775 * 0 No call is active | |
| 776 */ | |
| 777 #define CALL_ACTIVE 18 | |
| 778 /* | |
| 779 * SERVICE_1_SUPPORT (bit 19) | |
| 780 * 1 The current SIM supports service 1 (CHV1 disabling) | |
| 781 * 0 The current SIM doesn't support service 1 | |
| 782 */ | |
| 783 #define SERVICE_1_SUPPORT 19 | |
| 784 /* | |
| 785 * SERVICE_35_SUPPORT (bit 20) | |
| 786 * 1 The current SIM supports service 35 (SM Status Report Storage) | |
| 787 * 0 The current SIM doesn't support service 35 | |
| 788 */ | |
| 789 #define SERVICE_35_SUPPORT 20 | |
| 790 /* | |
| 791 * SERVICE_39_SUPPORT (bit 21) | |
| 792 * 1 Image files (icons) may exist on the SIM | |
| 793 * 0 no Image files exist on the SIM | |
| 794 */ | |
| 795 #define DF_GRAPHICS_EXISTENT 21 | |
| 796 /* | |
| 797 * SERVICE_40_SUPPORT (bit 21) | |
| 798 * 1 SOLSA files may exist on the SIM | |
| 799 * 0 no SOLSA files exist on the SIM | |
| 800 */ | |
| 801 #define DF_SOLSA_EXISTENT 22 | |
| 802 /* | |
| 803 * SERVICE_38_SUPPORT (bit 23) | |
| 804 * 1 The current SIM supports service 38 (GPRS Storage) | |
| 805 * 0 The current SIM doesn't support service X | |
| 806 */ | |
| 807 #define SERVICE_38_SUPPORT 23 | |
| 808 | |
| 809 #ifdef REL99 | |
| 810 /* | |
| 811 * SERVICE_43_SUPPORT (bit 26) | |
| 812 * 1 The current SIM supports service 43 (user controlled PLMN Selector with Access Technology) | |
| 813 * 0 The current SIM supports service 43 (user controlled PLMN Selector with Access Technology) | |
| 814 */ | |
| 815 #define SERVICE_43_SUPPORT 26 | |
| 816 /* | |
| 817 * SERVICE_44_SUPPORT (bit 27) | |
| 818 * 1 The current SIM supports service 44 (Operator controlled PLMN Selector with Access Technology) | |
| 819 * 0 The current SIM supports service 44 (Operator controlled PLMN Selector with Access Technology) | |
| 820 */ | |
| 821 #define SERVICE_44_SUPPORT 27 | |
| 822 #endif /* REL99 */ | |
| 823 | |
| 824 /* | |
| 825 * SERVICE_41_SUPPORT (bit 22) | |
| 826 * 1 ORANGE files may exist on the SIM | |
| 827 * 0 no ORANGE files exist on the SIM | |
| 828 */ | |
| 829 #define DF_ORANGE_EXISTENT 25 | |
| 830 /* | |
| 831 * Handling of SIM retry failure | |
| 832 * 1 SIM driver cannot recover from a communication problem even | |
| 833 * after several retries of the last SIM command; SIM reset is | |
| 834 * required | |
| 835 * 0 normal | |
| 836 */ | |
| 837 #define DRV_FAILED_RETRY 29 | |
| 838 /* | |
| 839 * Handling of Poll Interval | |
| 840 * 1 MS uses Test SIM or Test Network, Polling not restarted | |
| 841 * 0 normal, the last SIM access of any prcedure restarts Polling | |
| 842 * Setting 1 is compliant with test case 27.22.4.6 of GSM 11.10-4, | |
| 843 * Setting 0 is compliant with clause 11.2.1/11.2.8 in GSM 11.11 | |
| 844 */ | |
| 845 #define TEST_MODE_POLLING 30 | |
| 846 /* | |
| 847 * Recognition of Test SIM | |
| 848 * 1 Bit 8 of Byte 1 of EF(AD) indicates a Test SIM | |
| 849 * 0 Bit 8 of Byte 1 of EF(AD) does not indicate a Test SIM | |
| 850 * This can be used to control the behaviour of the SIM Entity | |
| 851 */ | |
| 852 #define TEST_SIM_INSERTED 31 | |
| 853 | |
| 854 /*==== EXPORT =====================================================*/ | |
| 855 | |
| 856 #ifdef FF_SAT_E | |
| 857 /* | |
| 858 * CCD decode buffer | |
| 859 */ | |
| 860 #ifdef OPTION_MULTITHREAD | |
| 861 #define _decodedMsg _ENTITY_PREFIXED(_decodedMsg) | |
| 862 #endif /* OPTION_MULTITHREAD */ | |
| 863 #ifdef SHARED_CCD_BUF | |
| 864 #define CCD_START _decodedMsg = ccd_begin(); | |
| 865 #define CCD_END ccd_end(); | |
| 866 #else /* SHARED_CCD_BUF */ | |
| 867 #define CCD_START | |
| 868 #define CCD_END | |
| 869 #endif /* else SHARED_CCD_BUF */ | |
| 870 | |
| 871 #ifdef SIM_PEI_C | |
| 872 #ifdef SHARED_CCD_BUF | |
| 873 GLOBAL UBYTE* _decodedMsg; | |
| 874 #else /* SHARED_CCD_BUF */ | |
| 875 GLOBAL UBYTE _decodedMsg[MAX_MSTRUCT_LEN_SAT]; | |
| 876 #endif /* else SHARED_CCD_BUF */ | |
| 877 #else /* SIM_PEI_C */ | |
| 878 #ifdef SHARED_CCD_BUF | |
| 879 EXTERN UBYTE* _decodedMsg; | |
| 880 #else /* SHARED_CCD_BUF */ | |
| 881 EXTERN UBYTE _decodedMsg[MAX_MSTRUCT_LEN_SAT]; | |
| 882 #endif /* else SHARED_CCD_BUF */ | |
| 883 #endif /* else SIM_PEI_C */ | |
| 884 #endif /* FF_SAT_E */ | |
| 885 | |
| 886 /* | |
| 887 * Prototypes SIM Driver | |
| 888 */ | |
| 889 GLOBAL void SIM_Init (void (*insert)(T_SIM_CARD * p_atr), | |
| 890 void (*remove)(void)); | |
| 891 GLOBAL void SIM_Initialize (void); | |
| 892 GLOBAL USHORT SIM_Register (void (*insert)(T_SIM_CARD * p_atr), | |
| 893 void (*remove)(void)); | |
| 894 GLOBAL USHORT SIM_Reset (T_SIM_CARD * p_atr); | |
| 895 #ifdef _SIMULATION_ | |
| 896 #define SIM_Restart SIM_Reset | |
| 897 #else | |
| 898 GLOBAL USHORT SIM_Restart (T_SIM_CARD * p_atr); | |
| 899 #endif | |
| 900 GLOBAL void SIM_PowerOff (void); | |
| 901 #ifdef FF_DUAL_SIM | |
| 902 GLOBAL USHORT SIM_SwitchDualSIM (UBYTE sim_num); | |
| 903 GLOBAL USHORT SIM_GetSIM (void); | |
| 904 #endif /*FF_DUAL_SIM*/ | |
| 905 GLOBAL USHORT SIM_ChangeCHV (UBYTE * result, | |
| 906 UBYTE * oldCHV, | |
| 907 UBYTE * newCHV, | |
| 908 UBYTE chvType, | |
| 909 USHORT * size); | |
| 910 GLOBAL USHORT SIM_DisableCHV (UBYTE * result, | |
| 911 UBYTE * CHV, | |
| 912 USHORT * size); | |
| 913 GLOBAL USHORT SIM_EnableCHV (UBYTE * result, | |
| 914 UBYTE * CHV, | |
| 915 USHORT * size); | |
| 916 GLOBAL USHORT SIM_GetResponse (UBYTE * result, | |
| 917 USHORT len, | |
| 918 USHORT * size); | |
| 919 GLOBAL USHORT SIM_Increase (UBYTE * result, | |
| 920 UBYTE * dat, | |
| 921 USHORT * size); | |
| 922 GLOBAL USHORT SIM_Invalidate (UBYTE * result, | |
| 923 USHORT * size); | |
| 924 GLOBAL USHORT SIM_ReadBinary (UBYTE * result, | |
| 925 USHORT offset, | |
| 926 USHORT len, | |
| 927 USHORT * size); | |
| 928 GLOBAL USHORT SIM_ReadRecord (UBYTE * result, | |
| 929 UBYTE mode, | |
| 930 UBYTE recNum, | |
| 931 USHORT len, | |
| 932 USHORT * size); | |
| 933 GLOBAL USHORT SIM_Rehabilitate (UBYTE * result, | |
| 934 USHORT * size); | |
| 935 GLOBAL USHORT SIM_RunGSMAlgo (UBYTE * result, | |
| 936 UBYTE * rand, | |
| 937 USHORT * size); | |
| 938 GLOBAL USHORT SIM_Select (USHORT id, | |
| 939 UBYTE * dat, | |
| 940 USHORT * size); | |
| 941 GLOBAL USHORT SIM_Status (UBYTE * result, | |
| 942 USHORT * size); | |
| 943 GLOBAL USHORT SIM_Status_Extended (UBYTE * result, | |
| 944 USHORT len, | |
| 945 USHORT * size); | |
| 946 GLOBAL USHORT SIM_UnblockCHV (UBYTE * result, | |
| 947 UBYTE * unblockCHV, | |
| 948 UBYTE * newCHV, | |
| 949 UBYTE chvType, | |
| 950 USHORT * size); | |
| 951 GLOBAL USHORT SIM_UpdateBinary (UBYTE * result, | |
| 952 UBYTE * dat, | |
| 953 USHORT offset, | |
| 954 USHORT len, | |
| 955 USHORT * size); | |
| 956 GLOBAL USHORT SIM_UpdateRecord (UBYTE * result, | |
| 957 UBYTE * dat, | |
| 958 UBYTE mode, | |
| 959 UBYTE recNum, | |
| 960 USHORT len, | |
| 961 USHORT * size); | |
| 962 GLOBAL USHORT SIM_VerifyCHV (UBYTE * result, | |
| 963 UBYTE * chv, | |
| 964 UBYTE chvType, | |
| 965 USHORT * size); | |
| 966 GLOBAL USHORT SIM_TerminalResponse (UBYTE * result, | |
| 967 UBYTE * dat, | |
| 968 USHORT len, | |
| 969 USHORT * size); | |
| 970 GLOBAL USHORT SIM_TerminalProfile (UBYTE * result, | |
| 971 UBYTE * data, | |
| 972 USHORT length, | |
| 973 USHORT * size); | |
| 974 GLOBAL USHORT SIM_Fetch (UBYTE * result, | |
| 975 USHORT length, | |
| 976 USHORT * size); | |
| 977 GLOBAL USHORT SIM_Envelope (UBYTE * result, | |
| 978 UBYTE * dat, | |
| 979 USHORT len, | |
| 980 USHORT * size); | |
| 981 GLOBAL USHORT SIM_XchTPDU (UBYTE * dat, | |
| 982 USHORT trxLen, | |
| 983 UBYTE * result, | |
| 984 USHORT rcvLen, | |
| 985 USHORT * rcvSize); | |
| 986 GLOBAL void SIM_lock_cr17689(void); /* force driver version supporting ATR provision */ | |
| 987 /* | |
| 988 * Prototypes Wrapping Functions | |
| 989 */ | |
| 990 GLOBAL UBYTE FKT_check_pin_count (UBYTE count); | |
| 991 GLOBAL USHORT FKT_convert_error (USHORT sw1sw2, USHORT size); | |
| 992 GLOBAL USHORT FKT_ChangeCHV (UBYTE * old_pin, | |
| 993 UBYTE * new_pin, | |
| 994 UBYTE pin_id); | |
| 995 GLOBAL USHORT FKT_DisableCHV (UBYTE * pin); | |
| 996 GLOBAL USHORT FKT_EnableCHV (UBYTE * pin); | |
| 997 #ifndef TI_PS_UICC_CHIPSET_15 | |
| 998 GLOBAL USHORT FKT_GetResponse (UBYTE * data, | |
| 999 USHORT len); | |
| 1000 #endif | |
| 1001 GLOBAL USHORT FKT_Increase (UBYTE * data); | |
| 1002 GLOBAL USHORT FKT_Invalidate (void); | |
| 1003 GLOBAL USHORT FKT_ReadBinary (UBYTE * data, | |
| 1004 USHORT offset, | |
| 1005 USHORT len); | |
| 1006 GLOBAL USHORT FKT_ReadRecord (UBYTE * data, | |
| 1007 UBYTE mode, | |
| 1008 USHORT record, | |
| 1009 USHORT length); | |
| 1010 GLOBAL USHORT FKT_Rehabilitate (void); | |
| 1011 GLOBAL USHORT FKT_RunGSMAlgo (UBYTE * rand, UBYTE * data, USHORT len); | |
| 1012 GLOBAL USHORT FKT_Select (USHORT id, | |
| 1013 BOOL path_info_present, T_path_info * path_info_ptr, | |
| 1014 UBYTE * data, USHORT len); | |
| 1015 GLOBAL USHORT FKT_UnblockCHV (UBYTE * unblockCHV, | |
| 1016 UBYTE * new_CHV, | |
| 1017 UBYTE chvType); | |
| 1018 GLOBAL USHORT FKT_UpdateBinary (UBYTE * data, | |
| 1019 USHORT length, | |
| 1020 USHORT offset); | |
| 1021 GLOBAL USHORT FKT_UpdateRecord (UBYTE * data, | |
| 1022 USHORT length, | |
| 1023 UBYTE mode, | |
| 1024 USHORT record); | |
| 1025 GLOBAL USHORT FKT_VerifyCHV (UBYTE * pin, | |
| 1026 UBYTE pin_id); | |
| 1027 | |
| 1028 GLOBAL USHORT FKT_Status (UBYTE * pin_cnt, | |
| 1029 UBYTE * pin2_cnt, | |
| 1030 UBYTE * puk_cnt, | |
| 1031 UBYTE * puk2_cnt); | |
| 1032 GLOBAL USHORT FKT_TerminalResponse (UBYTE * data, | |
| 1033 USHORT length); | |
| 1034 GLOBAL USHORT FKT_TerminalProfile (UBYTE * data, | |
| 1035 USHORT length); | |
| 1036 GLOBAL USHORT FKT_Fetch (UBYTE * cmd, | |
| 1037 USHORT length); | |
| 1038 GLOBAL USHORT FKT_Envelope (UBYTE * data_out, UBYTE * data_in, | |
| 1039 USHORT in_length, USHORT out_length); | |
| 1040 /* | |
| 1041 * Prototypes Application | |
| 1042 */ | |
| 1043 | |
| 1044 GLOBAL void app_init_sim_data (void); | |
| 1045 GLOBAL void app_sim_read_req (T_SIM_READ_REQ * sim_read_req); | |
| 1046 GLOBAL void app_sim_read_record_req (T_SIM_READ_RECORD_REQ * sim_read_record_req); | |
| 1047 GLOBAL void app_sim_update_req (T_SIM_UPDATE_REQ * sim_update_req); | |
| 1048 GLOBAL void app_sim_update_record_req(T_SIM_UPDATE_RECORD_REQ * sim_update_record_req); | |
| 1049 GLOBAL void app_sim_increment_req (T_SIM_INCREMENT_REQ * sim_increment_req); | |
| 1050 GLOBAL void app_sim_verify_pin_req (T_SIM_VERIFY_PIN_REQ * sim_verify_pin_req); | |
| 1051 GLOBAL UBYTE app_sim_mm_insert_ind (T_SIM_MMI_INSERT_IND * sim_mmi_insert_ind); | |
| 1052 GLOBAL void app_sim_mmi_insert_ind (T_SIM_MMI_INSERT_IND * sim_mmi_insert_ind, | |
| 1053 UBYTE func); | |
| 1054 GLOBAL void app_sim_sms_insert_ind (void); | |
| 1055 GLOBAL void app_sim_change_pin_req (T_SIM_CHANGE_PIN_REQ * sim_change_pin_req); | |
| 1056 GLOBAL void app_sim_disable_pin_req (T_SIM_DISABLE_PIN_REQ * sim_disable_pin_req); | |
| 1057 GLOBAL void app_sim_enable_pin_req (T_SIM_ENABLE_PIN_REQ * sim_enable_pin_req); | |
| 1058 GLOBAL void app_sim_unblock_req (T_SIM_UNBLOCK_REQ * sim_unblock_req); | |
| 1059 GLOBAL void app_sim_auth_req (T_SIM_AUTHENTICATION_REQ * sim_authentication_req); | |
| 1060 #ifndef TI_PS_UICC_CHIPSET_15 | |
| 1061 GLOBAL void app_sim_insert (T_SIM_CARD *p_atr); | |
| 1062 #endif /*!TI_PS_UICC_CHIPSET_15*/ | |
| 1063 GLOBAL void app_sim_remove (void); | |
| 1064 GLOBAL void app_sim_timeout (U16 timer); | |
| 1065 GLOBAL void app_sim_mm_update_req (T_SIM_MM_UPDATE_REQ * sim_mm_update_req); | |
| 1066 GLOBAL void app_sim_sync_req (T_SIM_SYNC_REQ * sim_sync_req); | |
| 1067 GLOBAL void app_sim_activate_req (T_SIM_ACTIVATE_REQ * sim_activate_req); | |
| 1068 GLOBAL void app_sim_access_req (T_SIM_ACCESS_REQ * sim_access_req); | |
| 1069 GLOBAL void app_sim_read_parameters (void); | |
| 1070 GLOBAL void app_sim_phase (void); | |
| 1071 GLOBAL void app_sim_card_error (USHORT error); | |
| 1072 GLOBAL UBYTE app_sim_check_service (UBYTE nr, | |
| 1073 UBYTE * serv_table); | |
| 1074 GLOBAL void app_perform_profile_download (void); | |
| 1075 GLOBAL UBYTE app_fdn_bdn_procedures (T_SIM_MMI_INSERT_IND * sim_mmi_insert_ind); | |
| 1076 GLOBAL UBYTE app_check_imsi_loci_validation (void); | |
| 1077 GLOBAL UBYTE app_bdn_capability_request (void); | |
| 1078 GLOBAL UBYTE app_fdn_capability_request (void); | |
| 1079 GLOBAL UBYTE app_rehabilitate_imsi_loci (void); | |
| 1080 GLOBAL UBYTE app_get_fdn_status (void); | |
| 1081 GLOBAL void app_start_status_timer (BOOL condx); | |
| 1082 GLOBAL BOOL app_check_access_conditions (UBYTE proc, | |
| 1083 T_FIELD_STATUS *field_status); | |
| 1084 | |
| 1085 #define SERVICE(n,p) app_sim_check_service(n,p) | |
| 1086 | |
| 1087 EXTERN T_SIM_DATA sim_data; | |
| 1088 | |
| 1089 /* | |
| 1090 * These Functions are only temporary valid and should replaced as soon as possible | |
| 1091 */ | |
| 1092 EXTERN UBYTE get_network_meas (UBYTE * chan_list); | |
| 1093 EXTERN UBYTE get_bcch_chan_list (stk_data_type * out_stk_data); | |
| 1094 | |
| 1095 | |
| 1096 #ifdef SIM_TOOLKIT | |
| 1097 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
| 1098 GLOBAL void stk_sim_refresh_user_res (T_SIM_REFRESH_USER_RES * sim_refresh_user_res); | |
| 1099 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
| 1100 GLOBAL void stk_check_tp (UBYTE *out_prf, | |
| 1101 UBYTE *in_prf, | |
| 1102 USHORT len); | |
| 1103 GLOBAL void stk_perform_profile_download (void); | |
| 1104 GLOBAL void stk_proactive_polling (void); | |
| 1105 GLOBAL void stk_stop_all_sat_timers (void); | |
| 1106 GLOBAL void stk_init_sim_data (void); | |
| 1107 #ifdef FF_SAT_E | |
| 1108 GLOBAL void stk_dti_connection_opened (void); | |
| 1109 GLOBAL void stk_dti_connection_closed (void); | |
| 1110 GLOBAL void stk_dti_data_received (T_DTI2_DATA_IND* dti_data_ind); | |
| 1111 GLOBAL void stk_dti_tx_buffer_full (void); | |
| 1112 GLOBAL void stk_dti_tx_buffer_ready (void); | |
| 1113 GLOBAL UBYTE stk_dti_bip_send_data (T_sdu* message); | |
| 1114 | |
| 1115 GLOBAL void stk_udp_bind_cnf (T_UDP_BIND_CNF* udp_bind_cnf); | |
| 1116 GLOBAL void stk_udp_closeport_cnf (T_UDP_CLOSEPORT_CNF* udp_closeport_cnf); | |
| 1117 GLOBAL void stk_udp_error_ind (T_UDP_ERROR_IND* udp_error_ind); | |
| 1118 GLOBAL void stk_udp_shutdown_ind (T_UDP_SHUTDOWN_IND* udp_shutdown_ind); | |
| 1119 | |
| 1120 GLOBAL void stk_sim_dti_req (T_SIM_DTI_REQ* sim_dti_req); | |
| 1121 GLOBAL void stk_sim_bip_req (T_SIM_BIP_REQ* sim_bip_req); | |
| 1122 GLOBAL void stk_sim_bip_config_req (T_SIM_BIP_CONFIG_REQ* sim_bip_config_req); | |
| 1123 GLOBAL void stk_sim_eventlist_req (T_SIM_EVENTLIST_REQ* sim_eventlist_req); | |
| 1124 #endif /* FF_SAT_E */ | |
| 1125 GLOBAL void stk_sim_toolkit_res (T_SIM_TOOLKIT_RES * sim_toolkit_res); | |
| 1126 GLOBAL void stk_sim_toolkit_req (T_SIM_TOOLKIT_REQ * sim_toolkit_req); | |
| 1127 GLOBAL void stk_file_update_res (T_SIM_FILE_UPDATE_RES * file_update_res); | |
| 1128 GLOBAL void stk_timeout (USHORT index); | |
| 1129 #endif /* SIM_TOOLKIT */ | |
| 1130 | |
| 1131 #if defined (GPRS) | |
| 1132 GLOBAL void gprs_gmm_insert_ind (T_SIM_MM_INSERT_IND *sim_mm_insert_ind); | |
| 1133 GLOBAL void gprs_sim_gmm_update_req (T_SIM_GMM_UPDATE_REQ *sim_gmm_update_req); | |
| 1134 GLOBAL BOOL gprs_check_pcm_data (T_imsi_field *sim_imsi); | |
| 1135 #endif | |
| 1136 | |
| 1137 /* | |
| 1138 * for test cases only | |
| 1139 */ | |
| 1140 #if defined _SIMULATION_ && defined FF_SAT_E | |
| 1141 EXTERN USHORT csf_sim_pei_timeout (USHORT index); | |
| 1142 #endif /* _SIMULATION &&_FF_SAT_E */ | |
| 1143 | |
| 1144 | |
| 1145 /* | |
| 1146 * If all entities are linked into one module this definitions | |
| 1147 * prefixes the global data with the enity name | |
| 1148 */ | |
| 1149 | |
| 1150 | |
| 1151 #ifdef TI_PS_HCOMM_CHANGE | |
| 1152 #ifdef OPTION_MULTITHREAD | |
| 1153 #ifdef FF_SAT_E | |
| 1154 #define hCommUDP _ENTITY_PREFIXED(hCommUDP) | |
| 1155 #endif /* FF_SAT_E */ | |
| 1156 #if defined (GPRS) | |
| 1157 #define hCommGMM _ENTITY_PREFIXED(hCommGMM) | |
| 1158 #endif /* GPRS */ | |
| 1159 #endif /* OPTION_MULTITHREAD */ | |
| 1160 | |
| 1161 #ifdef FF_SAT_E | |
| 1162 EXTERN T_HANDLE hCommUDP; /* UDP Communication */ | |
| 1163 #endif /* FF_SAT_E */ | |
| 1164 #if defined (GPRS) | |
| 1165 #define GMM hCommGMM | |
| 1166 EXTERN T_HANDLE hCommGMM; /* SMS Communication */ | |
| 1167 #endif /* GPRS */ | |
| 1168 EXTERN T_HANDLE sim_handle; | |
| 1169 | |
| 1170 #else | |
| 1171 #ifdef OPTION_MULTITHREAD | |
| 1172 #define hCommSMS _ENTITY_PREFIXED(hCommSMS) | |
| 1173 #define hCommMM _ENTITY_PREFIXED(hCommMM) | |
| 1174 #define hCommMMI _ENTITY_PREFIXED(hCommMMI) | |
| 1175 #ifdef FF_SAT_E | |
| 1176 #define hCommUDP _ENTITY_PREFIXED(hCommUDP) | |
| 1177 #endif /* FF_SAT_E */ | |
| 1178 #ifdef _SIMULATION_ | |
| 1179 #define hCommSIM _ENTITY_PREFIXED(hCommSIM) | |
| 1180 #endif | |
| 1181 #if defined (GPRS) | |
| 1182 #define hCommGMM _ENTITY_PREFIXED(hCommGMM) | |
| 1183 #endif /* GPRS */ | |
| 1184 #endif /* OPTION_MULTITHREAD */ | |
| 1185 EXTERN T_HANDLE hCommMM; /* MM Communication */ | |
| 1186 EXTERN T_HANDLE hCommMMI; /* MMI Communication */ | |
| 1187 EXTERN T_HANDLE hCommSMS; /* SMS Communication */ | |
| 1188 #ifdef FF_SAT_E | |
| 1189 EXTERN T_HANDLE hCommUDP; /* UDP Communication */ | |
| 1190 #endif /* FF_SAT_E */ | |
| 1191 #ifdef _SIMULATION_ | |
| 1192 EXTERN T_HANDLE hCommSIM; /* TEST CASES: TAP Communication */ | |
| 1193 #endif | |
| 1194 #if defined (GPRS) | |
| 1195 #define GMM hCommGMM | |
| 1196 EXTERN T_HANDLE hCommGMM; /* SMS Communication */ | |
| 1197 #endif /* GPRS */ | |
| 1198 EXTERN T_HANDLE sim_handle; | |
| 1199 #endif /* TI_PS_HCOMM_CHANGE */ | |
| 1200 | |
| 1201 #endif /* !SIM_H */ |
