blob: 657755759ac71042e618c543351a0844e65f0555 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2005
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35
36/*****************************************************************************
37 *
38 * Filename:
39 * ---------
40 * dcl_sim.h
41 *
42 * Project:
43 * --------
44 * Maui_Software
45 *
46 * Description:
47 * ------------
48 * This file defines structures and functions for SIM DCL interface.
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *============================================================================
55 * HISTORY
56 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57 *------------------------------------------------------------------------------
58 *
59 *
60 *------------------------------------------------------------------------------
61 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
62 *============================================================================
63 ****************************************************************************/
64#ifdef DCL_DEFINITION_STRUCT
65
66#ifndef __DCL_SIM_H_STRUCT__
67#define __DCL_SIM_H_STRUCT__
68
69/*RHR*/
70//#include "kal_non_specific_general_types.h"
71#include "dcl.h"
72/*RHR*/
73
74#define DCL_SIM_MAX_INTERFACE 5
75
76/*********************************************************************************************************
77*followings we defines the structure used by DCL user, this is prevent DCL user from include invividual moudles' header file.
78**********************************************************************************************************/
79typedef DCL_UINT16 DCL_SIM_STATUS_WORD;
80
81typedef enum
82{
83 DCL_ME_UNKNOW =0,
84 DCL_ME_18V_30V,
85 DCL_ME_30V_ONLY,
86 DCL_ME_18V_ONLY
87} DCL_SIM_ENV;
88
89typedef enum{
90 DCL_USIM_NO_ERROR = 0,
91
92 /*expected status*/
93 DCL_USIM_WAITING_EVENT = 1, /* initial wait event status */
94 DCL_USIM_BLOCK_REC = 2, /* successfully received a complete block */
95 DCL_USIM_POWER_OFF = 3, /* successfully powered off */
96 DCL_USIM_ATR_REC = 4, /* successfully reveived all ATR */
97 DCL_USIM_S_BLOCK_REC = 5, /* successfully reveived S RESP */
98
99 DCL_SIM_INIPTSERR = 6,
100 DCL_SIM_CMDTOUT = 9,
101 DCL_SIM_NULLTIMEOUT = 11,
102 DCL_SIM_PTS_RX_INVALID = 18,
103 DCL_SIM_CMDRECERR = 8,
104 DCL_SIM_OVERRUN = 19,
105
106 /* error status */
107 DCL_USIM_NO_INSERT = -1,
108 DCL_USIM_VOLT_NOT_SUPPORT = -2,
109 DCL_USIM_NO_ATR = -3,
110 DCL_USIM_TS_INVALID = -4,
111 DCL_USIM_ATR_ERR = -5,
112 DCL_USIM_INVALID_ATR = -6,
113 DCL_USIM_PTS_FAIL = -7,
114 DCL_USIM_RX_INVALID = -8, /* EDC error or parity error */
115 DCL_USIM_BWT_TIMEOUT = -9,
116 DCL_USIM_DATA_ABORT = -10,
117 DCL_USIM_DEACTIVATED = -11,
118 DCL_USIM_S_BLOCK_FAIL = -12,
119 DCL_USIM_INVALID_WRST = -13,
120 DCL_USIM_GPT_TIMEOUT = -14,
121 DCL_USIM_PTS_TIMEOUT = -15,
122 DCL_USIM_PTS_RX_INVALID = -16
123}DCL_SIM_STATUS;
124
125/*All possible volatege support values. This enum to duplicate the same definition as internal SIM driver definition, so that protocol does not need to include driver internal header files*/
126typedef enum{
127 DCL_UNKNOWN_POWER_CLASS = 0,
128 DCL_CLASS_A_50V = 1, /*this card support 5V only, from ATR*/
129 DCL_CLASS_B_30V = 2, /*this card support 3V only, from ATR*/
130 DCL_CLASS_AB = 3, /*this card support 5V and 3V, from ATR*/
131 DCL_CLASS_C_18V = 4, /*this card support 1.8V only, from ATR*/
132 DCL_ClASS_BC = 6, /*this card support 3V and 1.8V, from ATR*/
133 DCL_CLASS_ABC = 7 /*this card support 5V, 3V, and 1.8V, from ATR*/
134}DCL_SIM_POWER;
135
136typedef DCL_UINT32 DCL_SIM_HW_CB;
137
138/*The application protocol support information. This enum to duplicate the same definition as internal SIM driver definition, so that protocol does not need to include driver internal header files*/
139typedef enum
140{
141 DCL_SIM_PROTOCOL, /*support SIM protocol, or to be more precisely, this should be a ICC card*/
142 DCL_USIM_PROTOCOL /*support USIM protocol, or to be more precisely, this should be a UICC card*/
143}DCL_SIM_APP_PROTOCOL;
144
145
146
147/*defines the possible choice of physical protocol. This enum to duplicate the same definition as internal SIM driver definition, so that protocol does not need to include driver internal header files*/
148typedef enum
149{
150 DCL_T0_PROTOCOL, /*prefer to use the T0 protocol*/
151 DCL_T1_PROTOCOL, /*prefer to use the T1 protocol*/
152 DCL_UNKNOWN_PROTOCOL /*no preferred physical protocol*/
153}DCL_SIM_PHY_PROTOCOL;
154
155/*defines the all of the clock stop related information. This enum to duplicate the same definition as internal SIM driver definition, so that protocol does not need to include driver internal header files*/
156typedef enum{
157 DCL_CLOCK_STOP_NOT_SUPPORT = 0x0, /*not support clock stop*/
158 DCL_CLOCK_STOP_LOW = 0x40, /*support clock stop in low level*/
159 DCL_CLOCK_STOP_HIGH = 0x80, /*support clock stop in high level*/
160 DCL_CLOCK_STOP_ANY = 0xc0, /*support clock stop in any voltage level*/
161 DCL_CLOCK_STOP_MSK = 0xc0, /*define the clock stop mask, used to parse the information received from cards*/
162 DCL_CLOCK_STOP_UNKONW = 0x0f /*the default value*/
163}DCL_SIM_CLK_STOP;
164
165/*defines the possible card speed values. This enum is to duplicate the same definition as internal SIM driver definition, so that protocol does not need to include driver internal header files*/
166typedef enum{
167 DCL_SPEED_372, /*for speed372*/
168 DCL_SPEED_64, /*for speed64*/
169 DCL_SPEED_32, /*for speed32*/
170 DCL_SPEED_16 /*for speed16*/
171}DCL_SIM_CARD_SPEED;
172
173/*the structure to define the values exchanged when doing get card information*/
174typedef struct{
175 DCL_SIM_POWER power; /*the voltage we choose*/
176 DCL_SIM_CARD_SPEED speed; /*the speed we choose*/
177 DCL_SIM_CLK_STOP clock_stop; /*clock stop information in ATR*/
178 DCL_SIM_APP_PROTOCOL app_proto; /*whether it is a ICC card or UICC card*/
179 DCL_SIM_PHY_PROTOCOL phy_proto; /*the physical protocol we used*/
180 kal_bool T0_support; /* if T0 is supported*/
181 kal_bool T1_support; /* if T1 is supported*/
182 kal_uint8 hist_index; /* index to the historical char of ATR*/
183 kal_uint8 *ATR; /*the pointer to store the ATR received*/
184 kal_bool TAiExist; /*if the first TA for T=15 is existed*/
185 kal_uint8 ATR_length; /* length to the ATR_data*/
186 kal_bool isSW6263; /* query if status word 0x62xx 0x63xx happen*/
187 kal_uint8 TB15; // query if support ic usb
188 kal_bool hasPowerClass;
189 kal_uint8 PowerClass;
190 kal_bool SupportExtendedLength;
191 kal_uint8 sim_tray_status;
192 kal_uint8 sim_result;
193}DCL_SIM_INFO;
194
195/*******************************************************************************
196 * driver function tables exposed to DCL
197 *******************************************************************************/
198/*here are type definition for functions*/
199/*dcl add new api : 2. define function type*/
200
201/*the prototype definition for RST function pointer*/
202typedef DCL_SIM_STATUS (* DCL_SIM_RST)(DCL_SIM_POWER ExpectVolt, DCL_SIM_POWER *ResultVolt, kal_bool warm, DCL_SIM_HW_CB handle);
203/*the prototype definition for CMD function pointer*/
204typedef DCL_SIM_STATUS_WORD (* DCL_SIM_CMD)(kal_uint8 *txData,kal_uint32 *txSize,kal_uint8 *rxData, kal_uint32 *rxSize, DCL_SIM_HW_CB handle,kal_uint8 *bypass6263);
205/*the prototype definition for power off function pointer*/
206typedef void (* DCL_SIM_PWOFF)(DCL_SIM_HW_CB handle);
207/*the prototype definition for get card info function pointer*/
208typedef void (* DCL_SIM_GET_CARD_INFO)(DCL_SIM_INFO *info, DCL_SIM_HW_CB handle);
209/*the prototype definition for get card info function pointer*/
210typedef void (* DCL_SIM_GET_CARD_ERROR_TYPES_INFO)(DCL_SIM_INFO *info, DCL_SIM_HW_CB handle);
211/*the prototype definition for set maximum speed function pointer*/
212typedef void (* DCL_SIM_SET_MAX_SPEED)(DCL_SIM_CARD_SPEED speed, DCL_SIM_HW_CB handle);
213/*the prototype definition for set prefer physical protocol function pointer*/
214typedef void (* DCL_SIM_SET_PREFER_PROTOCOL)(DCL_SIM_PHY_PROTOCOL T, DCL_SIM_HW_CB handle);
215/*the prototype definition for set clock stop mode function pointer*/
216typedef kal_bool (* DCL_SIM_SET_CLK_STOP_MODE)(DCL_SIM_CLK_STOP mode, DCL_SIM_HW_CB handle);
217/*the prototype definition for TOUT test function pointer*/
218typedef void (* DCL_SIM_TOUT_TEST)(kal_uint32 toutValue, DCL_SIM_HW_CB handle);
219/*the prototype definition for assign logical number function pointer*/
220typedef kal_uint32 (* DCL_SIM_ASSIGN_LOGICAL)(kal_uint32 logicalNumber);
221/*the prototype definition for get card speed function pointer*/
222typedef DCL_SIM_CARD_SPEED (*DCL_SIM_GAT_CARD_SPEED)(DCL_SIM_HW_CB handle);
223/*the prototype definition for query 9000 function pointer*/
224typedef DCL_BOOL (*DCL_SIM_QUERY_GET_9000_WHEN_SELECT)(DCL_SIM_HW_CB handle);
225/*the prototype definition for set owner task pointer*/
226typedef void (* DCL_SIM_SET_OWNER_TASK)(DCL_SIM_HW_CB handle);
227/* For sim hot plug callback function */
228/*the prototype definition for SIM hot plug out call back function*/
229typedef void (*DCL_SIM_PLUG_OUT_CALLBACK)(kal_uint32 simIf);
230/*the prototype definition for SIM hot plug in call back function*/
231typedef void (*DCL_SIM_PLUG_IN_CALLBACK)(kal_uint32 simIf);
232/*the prototype definition for get card detect status pointer*/
233typedef void (* DCL_SIM_GET_CARD_DETECT_STATUS)(DCL_SIM_INFO *info, DCL_SIM_HW_CB handle);
234
235/*dcl add new api : 3. add to funtion table type*/
236
237/*the declaration of SIM driver table, expeorted from SIM driver to DCL SIM interface. This table implies we accept any SIM driver function tables with the same format.*/
238typedef struct
239{
240 DCL_SIM_RST rst; /*The RST function to detect card's existence*/
241 DCL_SIM_CMD cmd; /*The CMD function to send the APDU command to the card*/
242 DCL_SIM_PWOFF pwOff; /*The power off function to deactivate the card*/
243 DCL_SIM_GET_CARD_INFO getCardInfo; /*To report the card information, known by SIM driver, to the protocol layer*/
244 DCL_SIM_GET_CARD_ERROR_TYPES_INFO getCardErrorTypesInfo; /*To report the card error tpyes information, known by SIM driver, to the protocol layer*/
245 DCL_SIM_SET_MAX_SPEED setSpeed; /*To set the maximum allowed speed to driver*/
246 DCL_SIM_SET_PREFER_PROTOCOL setPreferT; /*To set the preferred physical layer protocol to driver*/
247 DCL_SIM_SET_CLK_STOP_MODE setClockStopMode; /*To set the CLK stop information, known by protocol, to driver*/
248 DCL_SIM_TOUT_TEST toutTest; /*To ask the driver to start TOUT test*/
249 DCL_SIM_ASSIGN_LOGICAL assignLogical; /*To Assign the logical number to specific card*/
250 DCL_SIM_GAT_CARD_SPEED getCardSpeed; /*to get the card speed information*/
251 DCL_SIM_QUERY_GET_9000_WHEN_SELECT query9000WhenSelect; /*To query whether a status word 0x9000 happened after SELECT command*/
252 DCL_SIM_SET_OWNER_TASK setOwnerTask; /*to update current owner task */
253 DCL_SIM_GET_CARD_DETECT_STATUS getCardDetectStatus; /*to get card detect pin status */
254}DCL_SIMDriver_t;
255
256/* defines the possible application value*/
257typedef enum
258{
259 SIM_CONFIG_AP_TYPE_PHONE1, /*the card will be used for phone application SIM card 1*/
260 SIM_CONFIG_AP_TYPE_PHONE2, /*the card will be used for phone application SIM card 2*/
261 SIM_CONFIG_AP_TYPE_CMMB_SMD, /*the card will be used for CMMB SMD card*/
262 SIM_CONFIG_AP_TYPE_PHONE3, /*the card will be used for phone application SIM card 3*/
263 SIM_CONFIG_AP_TYPE_PHONE4 /*the card will be used for phone application SIM card 4*/
264} DCL_SIM_CONFIG_AP_TYPE;
265
266/* defines the SIM configure structure */
267typedef struct
268{
269 DCL_SIM_CONFIG_AP_TYPE apType; /* define the application type protocol want to use*/
270 DCL_SIM_PLUG_IN_CALLBACK hotPlugInCb; /* specify the hot plug in callback function pointer*/
271 DCL_SIM_PLUG_OUT_CALLBACK hotPlugOutCb; /* specify the hot plug out callback function pointer*/
272} SIM_CONFIG_T;
273
274#define SIM_CONFIGS \
275 SIM_CONFIG_T rSimConfig;
276
277/*******************************************************************************
278 * DCL_CTRL_CMD for SIM
279 *******************************************************************************/
280 /*dcl add new api : 4. add to DCL_CTRL_CMD enum*/
281
282#ifdef __BUILD_DOM__
283/*The SIM Command values in DCL_CTRL_CMD_T Enum of dcl.h*/
284typedef enum
285{
286 SIM_CTRL_CMD_RST, /*try to reset the card and tell its existence*/
287 SIM_CTRL_CMD_CMD, /*send APDU command to ICC/UICC*/
288 SIM_CTRL_CMD_PWOFF, /*to power off the card*/
289 SIM_CTRL_CMD_GET_CARD_INFO, /*to get the card information stored in driver layer*/
290 SIM_CTRL_CMD_GET_CARD_ERROR_TYPES_INFO, /*to get the card error types information stored in driver layer*/
291 SIM_CTRL_CMD_SET_SPEED, /*set the maximum allowed speed*/
292 SIM_CTRL_CMD_SET_PREFER_PROTOCOL, /*to set the preferred physical protocl*/
293 SIM_CTRL_CMD_SET_CLK_STOP_MODE, /*to set the clock stop related setting*/
294 SIM_CTRL_CMD_TOUT_TEST, /*to start TOUT test, used by MEUT SIM test task*/
295 SIM_CTRL_CMD_GET_SPEED, /*to get the card speed information*/
296 SIM_CTRL_CMD_QUERY_9000_ON_SELECT, /*to querry whether 0x9000 after SELECT command happens*/
297 SIM_CTRL_CMD_SET_OWNER_TASK, /*to update sim driver owner task*/
298 SIM_CTRL_CMD_GET_CARD_DETECT_STATUS, /*to get sim card detect pin status*/
299 SIM_CTRL_CMD_SET_SLT_RLT, /*to set SLT result*/
300}DCL_CTRL_CMD_T;
301#else
302#define SIM_CMDS \
303 SIM_CTRL_CMD_BASE, \
304 SIM_CTRL_CMD_RST = 0, \
305 SIM_CTRL_CMD_CMD, \
306 SIM_CTRL_CMD_PWOFF, \
307 SIM_CTRL_CMD_GET_CARD_INFO, \
308 SIM_CTRL_CMD_GET_CARD_ERROR_TYPES_INFO, \
309 SIM_CTRL_CMD_SET_SPEED, \
310 SIM_CTRL_CMD_SET_PREFER_PROTOCOL, \
311 SIM_CTRL_CMD_SET_CLK_STOP_MODE, \
312 SIM_CTRL_CMD_TOUT_TEST, \
313 SIM_CTRL_CMD_GET_SPEED, \
314 SIM_CTRL_CMD_QUERY_9000_ON_SELECT, \
315 SIM_CTRL_CMD_SET_OWNER_TASK, \
316 SIM_CTRL_CMD_GET_CARD_DETECT_STATUS, \
317 SIM_CTRL_CMD_SET_SLT_RLT, \
318 SIM_CTRL_CMD_MAX_VALUE, \
319 SIM_CTRL_CMD_DUMMY_END = SIM_CTRL_CMD_BASE + SIM_CTRL_CMD_MAX_VALUE,
320#endif /*__BUILD_DOM__*/
321
322
323/*******************************************************************************
324 * DCL_CTRL_DATA_T: Define the Control data structure for each module's command
325 *******************************************************************************/
326
327/* FOR SIM_CTRL_CMD_RST control command. */
328typedef struct
329{
330 DCL_SIM_POWER ExpectVolt; /*the expected voltage from caller*/
331 DCL_SIM_POWER *ResultVolt; /*the pointer to report the eventual reset voltage from driver*/
332 kal_bool warm; /*to indicate whether this is cold reset or warm reset*/
333 DCL_SIM_STATUS rstResult; /*the result*/
334} SIM_CTRL_RST_T;
335
336/* FOR SIM_CTRL_CMD_CMD control command. */
337typedef struct
338{
339 kal_uint8 *txData; /*the pointer to the tx data buffer*/
340 kal_uint32 *txSize; /*the pointer to the tx buffer size*/
341 kal_uint8 *rxData; /*the pointer to the tx data buffer*/
342 kal_uint32 *rxSize; /*the pointer to the rx buffer size, driver will then feedback actual receive size here*/
343 kal_uint16 *statusWord; /*the pointer to contains the status word from card*/
344 kal_uint8 *bypass6263; /*the flag to control whether return 6263 direcltly*/
345} SIM_CTRL_CMD_T;
346
347/*dcl add new api : 4. new ctrl data type*/
348
349/* FOR SIM_CTRL_CMD_GET_CARD_INFO control command. */
350typedef struct
351{
352 DCL_SIM_INFO *info; /*the pointer to DCL_SIM_INFO structure, SIM driver will filled the values of the structure*/
353} SIM_CTRL_GET_CARD_INFO_T;
354typedef struct
355{
356 DCL_SIM_INFO *info; /*the pointer to DCL_SIM_INFO structure, SIM driver will filled the values of the structure*/
357} SIM_CTRL_GET_CARD_DETECT_STATUS_T;
358
359/* FOR SIM_CTRL_CMD_GET_CARD_ERROR_TYPES_INFO control command. */
360typedef struct
361{
362 DCL_SIM_INFO *info; /*the pointer to DCL_SIM_INFO structure, SIM driver will filled the values of the structure*/
363} SIM_CTRL_GET_CARD_ERROR_TYPES_INFO_T;
364
365/* FOR SIM_CTRL_CMD_SET_SPEED control command. */
366typedef struct
367{
368 DCL_SIM_CARD_SPEED speed; /*the DCL_SIM_CARD_SPEED structure, the structure is to tell the driver the maximum allowed speed value*/
369} SIM_CTRL_SET_MAX_SPEED_T;
370
371/* FOR SIM_CTRL_CMD_SET_PREFER_PROTOCOL control command. */
372typedef struct
373{
374 DCL_SIM_PHY_PROTOCOL T; /*the DCL_SIM_PHY_PROTOCOL structure, the structure is to tell the driver the preferred physical protocol*/
375} SIM_CTRL_SET_PREFER_PROTOCOL_T;
376
377/* FOR SIM_CTRL_CMD_SET_CLK_STOP_MODE control command. */
378typedef struct
379{
380 DCL_SIM_CLK_STOP mode; /*the DCL_SIM_CLK_STOP structure, the structure is to tell the driver clock stop related information*/
381} SIM_CTRL_SET_CLK_STOP_MODE_T;
382
383/* FOR SIM_CTRL_CMD_TOUT_TEST control command. */
384typedef struct
385{
386 DCL_UINT32 toutValue; /*the tout value that we want to apply to TOUT test*/
387} SIM_CTRL_TOUT_TEST_T;
388
389/* FOR SIM_CTRL_CMD_GET_SPEED control command. */
390typedef struct
391{
392 DCL_SIM_CARD_SPEED *speed; //return the card's speed to SIM task
393} SIM_CTRL_GET_SPEED_T;
394
395/* FOR SIM_CTRL_CMD_QUERY_9000_ON_SELECT control command. */
396typedef struct
397{
398 DCL_BOOL *got9000; //return the information whether we encounter 9000 in select command
399} SIM_CTRL_QUERY_9000_T;
400
401/* FOR SIM_SLT_SET_RLT control command. */
402typedef struct
403{
404 DCL_BOOL rlt; /*the SLT checking result set from protocol*/
405} SIM_CTRL_SET_SLT_RLT_T;
406
407/*dcl add new api : 5. add to DCL_CTRL_DATA enum*/
408
409#ifdef __BUILD_DOM__
410/*data structure union for all of SIM control commands*/
411typedef union
412{
413 SIM_CTRL_RST_T rSIMRst; /*data structure for SIM_CTRL_CMD_RST control command*/
414 SIM_CTRL_CMD_T rSIMCmd; /*data structure for SIM_CTRL_CMD_CMD control command*/
415 SIM_CTRL_GET_CARD_INFO_T rSIMGetCardInfo; /*data structure for SIM_CTRL_CMD_GET_CARD_INFO control command*/
416 SIM_CTRL_GET_CARD_ERROR_TYPES_INFO_T rSIMGetCardErrorTypesInfo; /*data structure for SIM_CTRL_CMD_GET_CARD_ERROR_TYPES_INFO control command*/
417 SIM_CTRL_GET_CARD_DETECT_STATUS_T rSIMGetCardDetectStatus; /*data structure for SIM_CTRL_GET_CARD_DETECT_STATUS control command*/
418 SIM_CTRL_SET_MAX_SPEED_T rSIMSetMaxSpeed; /*data structure for SIM_CTRL_CMD_SET_SPEED control command*/
419 SIM_CTRL_SET_PREFER_PROTOCOL_T rSIMSetPreferProtocol; /*data structure for SIM_CTRL_CMD_SET_PREFER_PROTOCOL control command*/
420 SIM_CTRL_SET_CLK_STOP_MODE_T rSIMSetClkStopMode; /*data structure for SIM_CTRL_CMD_SET_CLK_STOP_MODE control command*/
421 SIM_CTRL_TOUT_TEST_T rSIMToutTest; /*data structure for SIM_CTRL_CMD_TOUT_TEST control command*/
422 SIM_CTRL_GET_SPEED_T rSIMGetSpeed; /*data structure for SIM_CTRL_CMD_GET_SPEED control command*/
423 SIM_CTRL_QUERY_9000_T rSIMQuery9000; /*data structure for SIM_CTRL_CMD_QUERY_9000_ON_SELECT control command*/
424 SIM_CTRL_SET_SLT_RLT_T rSIMSetSltRlt; /*data structure for SIM_CTRL_CMD_SET_SLT_RLT control command*/
425}DCL_CTRL_DATA_T;
426#else
427#define SIM_CTRLS \
428 SIM_CTRL_RST_T rSIMRst; \
429 SIM_CTRL_CMD_T rSIMCmd; \
430 SIM_CTRL_GET_CARD_INFO_T rSIMGetCardInfo;\
431 SIM_CTRL_GET_CARD_ERROR_TYPES_INFO_T rSIMGetCardErrorTypesInfo;\
432 SIM_CTRL_GET_CARD_DETECT_STATUS_T rSIMGetCardDetectStatus; \
433 SIM_CTRL_SET_MAX_SPEED_T rSIMSetMaxSpeed; \
434 SIM_CTRL_SET_PREFER_PROTOCOL_T rSIMSetPreferProtocol; \
435 SIM_CTRL_SET_CLK_STOP_MODE_T rSIMSetClkStopMode; \
436 SIM_CTRL_TOUT_TEST_T rSIMToutTest; \
437 SIM_CTRL_GET_SPEED_T rSIMGetSpeed; \
438 SIM_CTRL_QUERY_9000_T rSIMQuery9000; \
439 SIM_CTRL_SET_SLT_RLT_T rSIMSetSltRlt;
440#endif /*__BUILD_DOM__*/
441
442#endif /*__DCL_SIM_H_STRUCT__*/
443
444#endif /*DCL_DEFINITION_STRUCT*/
445
446#ifdef DCL_DEFINITION_PROTOTYPE
447#ifndef __DCL_SIM_H_PROTOTYPE__
448#define __DCL_SIM_H_PROTOTYPE__
449
450/*************************************************************************
451* FUNCTION
452* DclSIM_Open
453* DESCRIPTION
454* This function is to open the SIM module and get a handle.
455*
456* PARAMETERS
457* dev: - only valid for DCL_SIM.
458* flags: - no sepcial flags is needed.
459*
460* RETURN VALUES
461* DCL_HANDLE_INVALID: - dev is an invalid value.
462* DCL_HANDLE_NONE: - no handler left, open failed.
463* other value: - a valid handle
464*
465*************************************************************************/
466DCL_HANDLE DclSIM_Open(DCL_DEV dev, DCL_FLAGS flags);
467
468/*************************************************************************
469* FUNCTION
470* DclSIM_Configure
471*
472* DESCRIPTION
473* This function is to configure the application usage of given handler.
474*
475* PARAMETERS
476* handle: - the handle to be configured, the value cannot be zero
477* configure: - to configure the application usage of this card, possible value can be found in DCL_SIM_CONFIG_AP_TYPE
478*
479* RETURN VALUES
480* STATUS_INVALID_DCL_HANDLE: - the handle is illegal
481* STATUS_OK: - the configuration is done successfully
482* STATUS_INVALID_CONFIGURATION: - the value of configure is not the one in DCL_SIM_CONFIG_AP_TYPE
483*
484*************************************************************************/
485DCL_STATUS DclSIM_Configure(DCL_HANDLE handle, DCL_CONFIGURE_T *configure);
486
487/*************************************************************************
488* FUNCTION
489* DclSIM_Control
490*
491* DESCRIPTION
492* This function is the control command of SIM driver, this provides most of the SIM driver services to protocol.
493*
494* PARAMETERS
495* handle: - a valid handle return by DclSIM_Open()
496* cmd: - a control command to SIM driver, possible values are as following
497* 1. SIM_CTRL_CMD_RST: try to reset the card and tell its existence
498* 2. SIM_CTRL_CMD_CMD: send APDU command to ICC/UICC
499* 3. SIM_CTRL_CMD_PWOFF: to power off the card
500* 4. SIM_CTRL_CMD_GET_CARD_INFO: to get the card information stored in driver layer
501* 5. SIM_CTRL_CMD_SET_SPEED: set the maximum allowed speed
502* 6. SIM_CTRL_CMD_SET_PREFER_PROTOCOL: to set the preferred physical protocl
503* 7. SIM_CTRL_CMD_SET_CLK_STOP_MODE: to set the clock stop related setting
504* 8. SIM_CTRL_CMD_TOUT_TEST: to start TOUT test, used by MEUT SIM test task
505* 9. SIM_CTRL_CMD_GET_SPEED: to get the card speed information
506* 10. SIM_CTRL_CMD_QUERY_9000_ON_SELECT: to querry whether 0x9000 after SELECT command happens
507* data: - control data for SIM control command, possible values are as following
508* 1. SIM_CTRL_CMD_RST: pointer to a SIM_CTRL_RST_T structure
509* 1. SIM_CTRL_CMD_CMD: pointer to a SIM_CTRL_CMD_T structure
510* 2. SIM_CTRL_CMD_PWOFF: NULL
511* 3. SIM_CTRL_CMD_GET_CARD_INFO: pointer to a SIM_CTRL_GET_CARD_INFO_T structure
512* 4. SIM_CTRL_CMD_SET_SPEED: pointer to a SIM_CTRL_SET_MAX_SPEED_T structure
513* 5. SIM_CTRL_CMD_SET_PREFER_PROTOCOL: pointer to a SIM_CTRL_SET_PREFER_PROTOCOL_T structure
514* 6. SIM_CTRL_CMD_SET_CLK_STOP_MODE: pointer to a SIM_CTRL_SET_CLK_STOP_MODE_T structure
515* 7. SIM_CTRL_CMD_TOUT_TEST: pointer to a SIM_CTRL_TOUT_TEST_T structure
516* 8. SIM_CTRL_CMD_GET_SPEED: pointer to a SIM_CTRL_GET_SPEED_T structure
517* 9. SIM_CTRL_CMD_QUERY_9000_ON_SELECT: pointer to a SIM_CTRL_QUERY_9000_T structure
518* RETURN VALUES
519* STATUS_OK: - command is executed successfully.
520* STATUS_INVALID_CMD: - The command is invalid.
521*************************************************************************/
522DCL_STATUS DclSIM_Control(DCL_HANDLE handle, DCL_CTRL_CMD cmd, DCL_CTRL_DATA_T *data);
523
524/*************************************************************************
525* FUNCTION
526* DclSIM_Close
527*
528* DESCRIPTION
529* This function to close the further functionality of specified SIM handle.
530*
531* PARAMETERS
532* handle: the handle that return by DclSIM_Open.
533*
534* RETURN VALUES:
535* STATUS_OK: - the handle is closed successfully
536* STATUS_INVALID_DCL_HANDLE: - the handle is invalid
537* STATUS_UNSUPPORTED:
538*
539*************************************************************************/
540DCL_STATUS DclSIM_Close(DCL_HANDLE handle);
541DCL_STATUS DclSIM_Initialize(void);
542#endif /*__DCL_SIM_H_PROTOTYPE__*/
543#endif //DCL_DEFINITION_PROTOTYPE
544