| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2004-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_smartcard.h $ |
|---|
| 39 | * $brcm_Revision: 18 $ |
|---|
| 40 | * $brcm_Date: 5/26/11 3:10p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Smartcard |
|---|
| 44 | * Specific APIs related to SMARTCARD Control. |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/modules/smartcard/7400/include/nexus_smartcard.h $ |
|---|
| 49 | * |
|---|
| 50 | * 18 5/26/11 3:10p erickson |
|---|
| 51 | * SW7346-228: add NEXUS_SmartcardSettings.resetCycles |
|---|
| 52 | * |
|---|
| 53 | * 17 4/11/11 4:38p erickson |
|---|
| 54 | * SW7346-138: add NEXUS_SmartcardSettings.atrReceiveTime |
|---|
| 55 | * |
|---|
| 56 | * 16 4/8/11 12:39p erickson |
|---|
| 57 | * SW7405-5210: add NEXUS_SmartcardStatus.iccClockFrequency |
|---|
| 58 | * |
|---|
| 59 | * 15 2/16/11 1:04p erickson |
|---|
| 60 | * SW7420-1491: add nelem required with nelem_out |
|---|
| 61 | * |
|---|
| 62 | * 14 2/15/11 2:12p erickson |
|---|
| 63 | * SW7420-1491: change to nelem and nelem_out attributes |
|---|
| 64 | * |
|---|
| 65 | * 13 2/7/11 11:13a erickson |
|---|
| 66 | * SW7346-25: added NEXUS_SmartcardSettings.sourceClockFreq |
|---|
| 67 | * |
|---|
| 68 | * 12 2/7/11 9:51a erickson |
|---|
| 69 | * SW7400-2841: add NEXUS_SmartcardVcc to fix nexus/magnum mismatch |
|---|
| 70 | * |
|---|
| 71 | * 11 9/28/10 2:02p erickson |
|---|
| 72 | * SW7420-1123: fix attr hints for variable size param |
|---|
| 73 | * |
|---|
| 74 | * 10 8/24/10 3:37p mphillip |
|---|
| 75 | * SW7125-598: Add IFSD as a parameter to the settings structure |
|---|
| 76 | * |
|---|
| 77 | * 9 8/16/10 4:41p mphillip |
|---|
| 78 | * SW7405-4023: Add NEXUS_Smartcard_Deactivate |
|---|
| 79 | * |
|---|
| 80 | * 8 8/2/10 8:56p bandrews |
|---|
| 81 | * SW7125-478: Currently the ATR(answer to reset) is passed through to the |
|---|
| 82 | * application. Its the resposibility of the application to decode the |
|---|
| 83 | * atr. But, once decoded, the application can use |
|---|
| 84 | * NEXUS_Smartcard_SetSettings() to set the desired parameters. So, |
|---|
| 85 | * deleting the api NEXUS_Smartcard_SetParamsFromAtr() as it is |
|---|
| 86 | * redundant. Please refer to the smartcard.c and smartcard_t1.c in |
|---|
| 87 | * nexus/examples/io for further details as to how to decode the ATR. |
|---|
| 88 | * |
|---|
| 89 | * 7 1/27/10 3:24p mphillip |
|---|
| 90 | * SW7405-3841: Expose connect directly PI variable in Nexus |
|---|
| 91 | * |
|---|
| 92 | * 6 1/26/10 1:23p mphillip |
|---|
| 93 | * SW7400-2551: Add pinmux and vcc settings |
|---|
| 94 | * |
|---|
| 95 | * 5 9/30/09 2:01p erickson |
|---|
| 96 | * SW7400-2551: add NEXUS_Smartcard_PowerIcc |
|---|
| 97 | * |
|---|
| 98 | * 4 4/29/09 12:29p erickson |
|---|
| 99 | * PR54618: added NEXUS_SmartcardSettings.baudDiv |
|---|
| 100 | * |
|---|
| 101 | * 3 8/19/08 2:19p erickson |
|---|
| 102 | * PR45615: add smartcard settings |
|---|
| 103 | * |
|---|
| 104 | * 2 5/28/08 11:01a erickson |
|---|
| 105 | * PR40034: fix attr hint for kernel mode |
|---|
| 106 | * |
|---|
| 107 | * 1 5/19/08 12:02p vishk |
|---|
| 108 | * PR 40034: Develop Nexus Smartcard Interface/Module. |
|---|
| 109 | * |
|---|
| 110 | ***************************************************************************/ |
|---|
| 111 | #ifndef NEXUS_SMARTCARD_H__ |
|---|
| 112 | #define NEXUS_SMARTCARD_H__ |
|---|
| 113 | |
|---|
| 114 | #ifdef __cplusplus |
|---|
| 115 | extern "C" { |
|---|
| 116 | #endif |
|---|
| 117 | |
|---|
| 118 | /*************************************************************************** |
|---|
| 119 | Summary: |
|---|
| 120 | Handle for the Smartcard Interface. |
|---|
| 121 | |
|---|
| 122 | Description: |
|---|
| 123 | |
|---|
| 124 | See Also: |
|---|
| 125 | NEXUS_Smartcard_Open |
|---|
| 126 | ***************************************************************************/ |
|---|
| 127 | typedef struct NEXUS_Smartcard *NEXUS_SmartcardHandle; |
|---|
| 128 | |
|---|
| 129 | /*************************************************************************** |
|---|
| 130 | Summary: |
|---|
| 131 | Smartcard error status enum. |
|---|
| 132 | |
|---|
| 133 | Description: |
|---|
| 134 | |
|---|
| 135 | See Also: |
|---|
| 136 | NEXUS_Smartcard_Open |
|---|
| 137 | ***************************************************************************/ |
|---|
| 138 | typedef enum NEXUS_SmartcardError |
|---|
| 139 | { |
|---|
| 140 | NEXUS_SmartcardError_eNoError, |
|---|
| 141 | NEXUS_SmartcardError_eRxParity, |
|---|
| 142 | NEXUS_SmartcardError_eTxParity, |
|---|
| 143 | NEXUS_SmartcardError_eRxTimeout, |
|---|
| 144 | NEXUS_SmartcardError_eTxTimeout, |
|---|
| 145 | NEXUS_SmartcardError_eHardwareFailure, |
|---|
| 146 | NEXUS_SmartcardError_eResetTerminal, /* requires a call to NEXUS_SmartCard_Reset() */ |
|---|
| 147 | NEXUS_SmartcardError_eMax |
|---|
| 148 | } NEXUS_SmartcardError; |
|---|
| 149 | |
|---|
| 150 | /*************************************************************************** |
|---|
| 151 | Summary: |
|---|
| 152 | Smartcard state enum. |
|---|
| 153 | |
|---|
| 154 | Description: |
|---|
| 155 | This represents the current state of the given slot and card. |
|---|
| 156 | |
|---|
| 157 | See Also: |
|---|
| 158 | NEXUS_Smartcard_Open |
|---|
| 159 | ***************************************************************************/ |
|---|
| 160 | typedef enum NEXUS_SmartcardState |
|---|
| 161 | { |
|---|
| 162 | NEXUS_SmartcardState_eUnknown = 0, /* Unknown state (perhaps not yet initialized). Persistent. */ |
|---|
| 163 | NEXUS_SmartcardState_eColdResetting, /* A cold reset has been requested but is not yet complete. Transient. */ |
|---|
| 164 | NEXUS_SmartcardState_eWarmResetting, /* A warm reset has been requested but is not yet complete. Transient. */ |
|---|
| 165 | NEXUS_SmartcardState_eResetDone, /* The slot/card reset has completed. Persistent. */ |
|---|
| 166 | NEXUS_SmartcardState_eActivating, /* The slot/card is currently being activated, but activation is not yet complete. Transient. */ |
|---|
| 167 | NEXUS_SmartcardState_eReceiveDecodeAtr, /* The ATR is being received or decoded. Transient. */ |
|---|
| 168 | NEXUS_SmartcardState_eReady, /* The slot/card is initialized and is awaiting sends/receives. Persistent. */ |
|---|
| 169 | NEXUS_SmartcardState_eTransmitting, /* The slot/card is currently transmitting. Transient. */ |
|---|
| 170 | NEXUS_SmartcardState_eTransmitted, /* The slot/card has completed its transmission. Persistent. */ |
|---|
| 171 | NEXUS_SmartcardState_eReceiving, /* The slot/card is currently receiving. Transient. */ |
|---|
| 172 | NEXUS_SmartcardState_eIgnore, /* The slot/card is ignoring events/commands. Persistent. */ |
|---|
| 173 | NEXUS_SmartcardState_eInitialized, /* The slot/card has been initialized, but the ATR has not yet been received. Persistent. */ |
|---|
| 174 | NEXUS_SmartcardState_eMax /* A value indicating the total number of possible states. The state returned from NEXUS_SmartCard_GetStatus should never exceed this value. */ |
|---|
| 175 | } NEXUS_SmartcardState; |
|---|
| 176 | |
|---|
| 177 | /*************************************************************************** |
|---|
| 178 | Summary: |
|---|
| 179 | Status information returned by NEXUS_Smartcard_GetStatus. |
|---|
| 180 | |
|---|
| 181 | Description: |
|---|
| 182 | |
|---|
| 183 | See Also: |
|---|
| 184 | NEXUS_Smartcard_Open |
|---|
| 185 | ***************************************************************************/ |
|---|
| 186 | typedef struct NEXUS_SmartcardStatus |
|---|
| 187 | { |
|---|
| 188 | bool cardPresent; |
|---|
| 189 | NEXUS_SmartcardError err; |
|---|
| 190 | NEXUS_SmartcardState state; |
|---|
| 191 | unsigned iccClockFrequency; /* units of Hz */ |
|---|
| 192 | } NEXUS_SmartcardStatus; |
|---|
| 193 | |
|---|
| 194 | /*************************************************************************** |
|---|
| 195 | Summary: |
|---|
| 196 | Smartcard protocol enum definition. |
|---|
| 197 | |
|---|
| 198 | Description: |
|---|
| 199 | |
|---|
| 200 | See Also: |
|---|
| 201 | NEXUS_Smartcard_Open |
|---|
| 202 | ***************************************************************************/ |
|---|
| 203 | typedef enum NEXUS_SmartcardProtocol |
|---|
| 204 | { |
|---|
| 205 | NEXUS_SmartcardProtocol_eUnknown, |
|---|
| 206 | NEXUS_SmartcardProtocol_eT0, |
|---|
| 207 | NEXUS_SmartcardProtocol_eT1, |
|---|
| 208 | NEXUS_SmartcardProtocol_eT14, |
|---|
| 209 | NEXUS_SmartcardProtocol_eMax |
|---|
| 210 | } NEXUS_SmartcardProtocol; |
|---|
| 211 | |
|---|
| 212 | /*************************************************************************** |
|---|
| 213 | Summary: |
|---|
| 214 | Smartcard standard enum definition. |
|---|
| 215 | |
|---|
| 216 | Description: |
|---|
| 217 | Used in NEXUS_SmartcardSettings |
|---|
| 218 | ***************************************************************************/ |
|---|
| 219 | typedef enum NEXUS_SmartcardStandard |
|---|
| 220 | { |
|---|
| 221 | NEXUS_SmartcardStandard_eUnknown, |
|---|
| 222 | NEXUS_SmartcardStandard_eNds, |
|---|
| 223 | NEXUS_SmartcardStandard_eIso, |
|---|
| 224 | NEXUS_SmartcardStandard_eEmv1996, |
|---|
| 225 | NEXUS_SmartcardStandard_eEmv2000, |
|---|
| 226 | NEXUS_SmartcardStandard_eIrdeto, |
|---|
| 227 | NEXUS_SmartcardStandard_eArib, |
|---|
| 228 | NEXUS_SmartcardStandard_eMt, |
|---|
| 229 | NEXUS_SmartcardStandard_eConax, |
|---|
| 230 | NEXUS_SmartcardStandard_eEs, |
|---|
| 231 | NEXUS_SmartcardStandard_eNdsNoFlowControl, |
|---|
| 232 | NEXUS_SmartcardStandard_eMax |
|---|
| 233 | } NEXUS_SmartcardStandard; |
|---|
| 234 | |
|---|
| 235 | /*************************************************************************** |
|---|
| 236 | Summary: |
|---|
| 237 | This enum is to identify the unit of timer value. |
|---|
| 238 | |
|---|
| 239 | Description: |
|---|
| 240 | See Also: |
|---|
| 241 | |
|---|
| 242 | ****************************************************************************/ |
|---|
| 243 | typedef enum NEXUS_TimerUnit { |
|---|
| 244 | NEXUS_TimerUnit_eEtu, /* in Elementary Time Units */ |
|---|
| 245 | NEXUS_TimerUnit_eClk, /* in raw clock cycles that smart card receives */ |
|---|
| 246 | NEXUS_TimerUnit_eMilliSec, /* in milliseconds */ |
|---|
| 247 | NEXUS_TimerUnit_eMax |
|---|
| 248 | } NEXUS_TimerUnit; |
|---|
| 249 | |
|---|
| 250 | /*************************************************************************** |
|---|
| 251 | Summary: |
|---|
| 252 | The timer value that application set to or get from the smartcard. |
|---|
| 253 | |
|---|
| 254 | Description: |
|---|
| 255 | |
|---|
| 256 | See Also: |
|---|
| 257 | |
|---|
| 258 | ****************************************************************************/ |
|---|
| 259 | typedef struct NEXUS_TimerValue |
|---|
| 260 | { |
|---|
| 261 | uint32_t value; /* timer value */ |
|---|
| 262 | NEXUS_TimerUnit unit; /* units */ |
|---|
| 263 | } NEXUS_TimerValue; |
|---|
| 264 | |
|---|
| 265 | /*************************************************************************** |
|---|
| 266 | Summary: |
|---|
| 267 | This enum is to identify error detect code (EDC) encoding. |
|---|
| 268 | |
|---|
| 269 | Description: |
|---|
| 270 | This enumeration defines the supported error detect code (EDC) encoding . |
|---|
| 271 | |
|---|
| 272 | See Also: |
|---|
| 273 | |
|---|
| 274 | |
|---|
| 275 | ****************************************************************************/ |
|---|
| 276 | typedef enum NEXUS_EdcEncode { |
|---|
| 277 | NEXUS_EdcEncode_eLrd, |
|---|
| 278 | NEXUS_EdcEncode_eCrc, |
|---|
| 279 | NEXUS_EdcEncode_eMax |
|---|
| 280 | } NEXUS_EdcEncode; |
|---|
| 281 | |
|---|
| 282 | /*************************************************************************** |
|---|
| 283 | Summary: |
|---|
| 284 | The configuration of EDC setting for T=1 protocol only. |
|---|
| 285 | |
|---|
| 286 | Description: |
|---|
| 287 | |
|---|
| 288 | See Also: |
|---|
| 289 | |
|---|
| 290 | |
|---|
| 291 | ****************************************************************************/ |
|---|
| 292 | typedef struct NEXUS_EdcSetting |
|---|
| 293 | { |
|---|
| 294 | NEXUS_EdcEncode edcEncode; /* EDC encoding */ |
|---|
| 295 | bool isEnabled; |
|---|
| 296 | } NEXUS_EdcSetting; |
|---|
| 297 | |
|---|
| 298 | /*************************************************************************** |
|---|
| 299 | Summary: |
|---|
| 300 | This enum is to identify read or write a specific register. |
|---|
| 301 | |
|---|
| 302 | Description: |
|---|
| 303 | This enumeration defines read or write of a smart card register. |
|---|
| 304 | |
|---|
| 305 | See Also: |
|---|
| 306 | |
|---|
| 307 | |
|---|
| 308 | ****************************************************************************/ |
|---|
| 309 | typedef enum NEXUS_ScPresMode { |
|---|
| 310 | NEXUS_ScPresMode_eDebounce = 0, |
|---|
| 311 | NEXUS_ScPresMode_eMask, |
|---|
| 312 | NEXUS_ScPresMode_eMax |
|---|
| 313 | } NEXUS_ScPresMode; |
|---|
| 314 | |
|---|
| 315 | /*************************************************************************** |
|---|
| 316 | Summary: |
|---|
| 317 | The configuration of Smartcard Pres Debounce. |
|---|
| 318 | |
|---|
| 319 | Description: |
|---|
| 320 | |
|---|
| 321 | See Also: |
|---|
| 322 | |
|---|
| 323 | ****************************************************************************/ |
|---|
| 324 | typedef struct NEXUS_ScPresDbInfo |
|---|
| 325 | { |
|---|
| 326 | NEXUS_ScPresMode scPresMode; |
|---|
| 327 | bool isEnabled; |
|---|
| 328 | uint8_t dbWidth; |
|---|
| 329 | } NEXUS_ScPresDbInfo; |
|---|
| 330 | |
|---|
| 331 | /*************************************************************************** |
|---|
| 332 | Summary: |
|---|
| 333 | This enum is to identify action for NEXUS_Smartcard_ResetCard function. |
|---|
| 334 | |
|---|
| 335 | Description: |
|---|
| 336 | This enumeration defines the supported action for NEXUS_Smartcard_ResetCard function. |
|---|
| 337 | |
|---|
| 338 | See Also: |
|---|
| 339 | NEXUS_Smartcard_ResetCard |
|---|
| 340 | ****************************************************************************/ |
|---|
| 341 | typedef enum NEXUS_ResetCardAction |
|---|
| 342 | { |
|---|
| 343 | NEXUS_ResetCardAction_eNoAction = 0, |
|---|
| 344 | NEXUS_ResetCardAction_eReceiveAndDecode, |
|---|
| 345 | NEXUS_ResetCardAction_eMax |
|---|
| 346 | } NEXUS_ResetCardAction; |
|---|
| 347 | |
|---|
| 348 | /*************************************************************************** |
|---|
| 349 | Summary: |
|---|
| 350 | This enum is to identify action for NEXUS_Smartcard_PowerIcc function. |
|---|
| 351 | |
|---|
| 352 | Description: |
|---|
| 353 | |
|---|
| 354 | See Also: |
|---|
| 355 | |
|---|
| 356 | ****************************************************************************/ |
|---|
| 357 | typedef enum NEXUS_SmartcardPowerIcc { |
|---|
| 358 | NEXUS_SmartcardPowerIcc_ePowerDown = 0, /* power down the ICC and request deactivation of the contact */ |
|---|
| 359 | NEXUS_SmartcardPowerIcc_ePowerUp = 1, /* power up the ICC and request activation of the contact */ |
|---|
| 360 | NEXUS_SmartcardPowerIcc_eMax |
|---|
| 361 | } NEXUS_SmartcardPowerIcc; |
|---|
| 362 | |
|---|
| 363 | /*************************************************************************** |
|---|
| 364 | Summary: |
|---|
| 365 | Voltage level for the smartcard interface |
|---|
| 366 | ****************************************************************************/ |
|---|
| 367 | typedef enum NEXUS_SmartcardVcc { |
|---|
| 368 | NEXUS_SmartcardVcc_e5V = 0, /* 5v is default value */ |
|---|
| 369 | NEXUS_SmartcardVcc_e3V = 1, /* 3v */ |
|---|
| 370 | NEXUS_SmartcardVcc_eMax |
|---|
| 371 | } NEXUS_SmartcardVcc; |
|---|
| 372 | |
|---|
| 373 | /*************************************************************************** |
|---|
| 374 | Summary: |
|---|
| 375 | Smartcard settings structure. |
|---|
| 376 | |
|---|
| 377 | Description: |
|---|
| 378 | Smartcard settings structure, used by NEXUS_Smartcard_Open. |
|---|
| 379 | This allows protocol (T=0, T=1, T=14) and standard (NDS, ISO, EMV2000, IRDETO) to be selected. |
|---|
| 380 | ***************************************************************************/ |
|---|
| 381 | typedef struct NEXUS_SmartcardSettings |
|---|
| 382 | { |
|---|
| 383 | NEXUS_SmartcardProtocol protocol; |
|---|
| 384 | NEXUS_SmartcardStandard standard; |
|---|
| 385 | uint8_t fFactor; |
|---|
| 386 | uint8_t dFactor; |
|---|
| 387 | uint8_t extClockDivisor; |
|---|
| 388 | uint8_t txRetries; |
|---|
| 389 | uint8_t rxRetries; |
|---|
| 390 | uint8_t baudDiv; |
|---|
| 391 | NEXUS_TimerValue workWaitTime; |
|---|
| 392 | NEXUS_TimerValue blockWaitTime; |
|---|
| 393 | NEXUS_TimerValue extraGuardTime; |
|---|
| 394 | NEXUS_TimerValue blockGuardTime; |
|---|
| 395 | uint32_t characterWaitTime; |
|---|
| 396 | NEXUS_EdcSetting edcSetting; |
|---|
| 397 | NEXUS_TimerValue timeOut; |
|---|
| 398 | bool autoDeactiveReq; |
|---|
| 399 | bool nullFilter; |
|---|
| 400 | NEXUS_ScPresDbInfo scPresDbInfo; |
|---|
| 401 | NEXUS_ResetCardAction resetCardAction; |
|---|
| 402 | NEXUS_TimerValue blockWaitTimeExt; |
|---|
| 403 | bool isPresHigh; |
|---|
| 404 | NEXUS_CallbackDesc insertCard; /* Called when a card is inserted */ |
|---|
| 405 | NEXUS_CallbackDesc removeCard; /* Called when a card is removed */ |
|---|
| 406 | bool setPinmux; /* Only applies during NEXUS_Smartcard_Open. */ |
|---|
| 407 | bool setVcc; /* If true, Sets Vcc to vcc volts */ |
|---|
| 408 | NEXUS_SmartcardVcc vcc; |
|---|
| 409 | bool connectDirectly; /* If true, smartcard is directly connected to the backend chip. |
|---|
| 410 | If false, smartcard connected to the coupling chip TDA8024. */ |
|---|
| 411 | uint32_t currentIFSD; /* This attribute indicates the current IFSD */ |
|---|
| 412 | unsigned sourceClockFreq; /* Configures the Smartcard CLK freq for each smartcard channel (slot). In units of Hz. */ |
|---|
| 413 | NEXUS_TimerValue atrReceiveTime; /* Defines the time to wait for the first byte of ATR. */ |
|---|
| 414 | unsigned resetCycles; /* Defines the reset cycles for the coupling chips. */ |
|---|
| 415 | } NEXUS_SmartcardSettings; |
|---|
| 416 | |
|---|
| 417 | /*************************************************************************** |
|---|
| 418 | Summary: |
|---|
| 419 | Get default settings for the structure. |
|---|
| 420 | |
|---|
| 421 | Description: |
|---|
| 422 | This is required in order to make application code resilient to the addition of new strucutre members in the future. |
|---|
| 423 | |
|---|
| 424 | See Also: |
|---|
| 425 | NEXUS_Smartcard_Open |
|---|
| 426 | ***************************************************************************/ |
|---|
| 427 | void NEXUS_Smartcard_GetDefaultSettings( |
|---|
| 428 | NEXUS_SmartcardSettings *pSettings /* [out] */ |
|---|
| 429 | ); |
|---|
| 430 | |
|---|
| 431 | /*************************************************************************** |
|---|
| 432 | Summary: |
|---|
| 433 | Open a Smartcard handle. |
|---|
| 434 | |
|---|
| 435 | Description: |
|---|
| 436 | |
|---|
| 437 | See Also: |
|---|
| 438 | NEXUS_Smartcard_Close |
|---|
| 439 | ***************************************************************************/ |
|---|
| 440 | NEXUS_SmartcardHandle NEXUS_Smartcard_Open( /* attr{destructor=NEXUS_Smartcard_Close} */ |
|---|
| 441 | unsigned index, |
|---|
| 442 | const NEXUS_SmartcardSettings *pSettings |
|---|
| 443 | ); |
|---|
| 444 | |
|---|
| 445 | /*************************************************************************** |
|---|
| 446 | Summary: |
|---|
| 447 | Close a Smartcard handle. |
|---|
| 448 | |
|---|
| 449 | Description: |
|---|
| 450 | |
|---|
| 451 | See Also: |
|---|
| 452 | NEXUS_Smartcard_Open |
|---|
| 453 | ***************************************************************************/ |
|---|
| 454 | void NEXUS_Smartcard_Close( |
|---|
| 455 | NEXUS_SmartcardHandle handle |
|---|
| 456 | ); |
|---|
| 457 | |
|---|
| 458 | /*************************************************************************** |
|---|
| 459 | Summary: |
|---|
| 460 | Get the settings for a SMARTCARD |
|---|
| 461 | |
|---|
| 462 | Description: |
|---|
| 463 | |
|---|
| 464 | See Also: |
|---|
| 465 | NEXUS_Smartcard_SetSettings |
|---|
| 466 | ***************************************************************************/ |
|---|
| 467 | void NEXUS_Smartcard_GetSettings( |
|---|
| 468 | NEXUS_SmartcardHandle handle, |
|---|
| 469 | NEXUS_SmartcardSettings *pSettings /* [out] */ |
|---|
| 470 | ); |
|---|
| 471 | |
|---|
| 472 | /*************************************************************************** |
|---|
| 473 | Summary: |
|---|
| 474 | Set the settings for a SMARTCARD |
|---|
| 475 | |
|---|
| 476 | Description: |
|---|
| 477 | |
|---|
| 478 | See Also: |
|---|
| 479 | NEXUS_Smartcard_GetSettings |
|---|
| 480 | ***************************************************************************/ |
|---|
| 481 | NEXUS_Error NEXUS_Smartcard_SetSettings( |
|---|
| 482 | NEXUS_SmartcardHandle handle, |
|---|
| 483 | const NEXUS_SmartcardSettings *pSettings |
|---|
| 484 | ); |
|---|
| 485 | |
|---|
| 486 | /*************************************************************************** |
|---|
| 487 | Summary: |
|---|
| 488 | Read data from the smartcard. |
|---|
| 489 | |
|---|
| 490 | Description: |
|---|
| 491 | If read fails, you should call NEXUS_Smartcard_GetStatus in order to determine |
|---|
| 492 | the state of the smartcard interface. |
|---|
| 493 | |
|---|
| 494 | See Also: |
|---|
| 495 | NEXUS_Smartcard_Write |
|---|
| 496 | ***************************************************************************/ |
|---|
| 497 | NEXUS_Error NEXUS_Smartcard_Read( |
|---|
| 498 | NEXUS_SmartcardHandle smartcard, /* handle returned by NEXUS_SmartCard_Open */ |
|---|
| 499 | void *pdata, /* [out] attr{nelem=numBytes;nelem_out=pBytesRead;reserved=64} memory to read into */ |
|---|
| 500 | size_t numBytes, /* maximum number of bytes to read */ |
|---|
| 501 | size_t *pBytesRead /* [out] amount of data read into memory */ |
|---|
| 502 | ); |
|---|
| 503 | |
|---|
| 504 | /*************************************************************************** |
|---|
| 505 | Summary: |
|---|
| 506 | Write data to a smartcard. |
|---|
| 507 | |
|---|
| 508 | Description: |
|---|
| 509 | If write fails, you should call NEXUS_Smartcard_GetStatus in order to determine |
|---|
| 510 | the state of the smartcard interface. |
|---|
| 511 | |
|---|
| 512 | |
|---|
| 513 | See Also: |
|---|
| 514 | NEXUS_Smartcard_Read |
|---|
| 515 | ***************************************************************************/ |
|---|
| 516 | NEXUS_Error NEXUS_Smartcard_Write( |
|---|
| 517 | NEXUS_SmartcardHandle smartcard, |
|---|
| 518 | const void *pData, /* attr{nelem=numBytes;reserved=64} */ |
|---|
| 519 | size_t numBytes, |
|---|
| 520 | size_t *pBytesWritten /* [out] */ |
|---|
| 521 | ); |
|---|
| 522 | |
|---|
| 523 | /*************************************************************************** |
|---|
| 524 | Summary: |
|---|
| 525 | Get the current status of a smartcard. |
|---|
| 526 | ***************************************************************************/ |
|---|
| 527 | NEXUS_Error NEXUS_Smartcard_GetStatus( |
|---|
| 528 | NEXUS_SmartcardHandle smartcard, |
|---|
| 529 | NEXUS_SmartcardStatus *pStatus /* [out] */ |
|---|
| 530 | ); |
|---|
| 531 | |
|---|
| 532 | /*************************************************************************** |
|---|
| 533 | Summary: |
|---|
| 534 | Reset a smartcard. |
|---|
| 535 | |
|---|
| 536 | Description: |
|---|
| 537 | Reset the smartcard itself. |
|---|
| 538 | |
|---|
| 539 | See Also: |
|---|
| 540 | NEXUS_Smartcard_Read |
|---|
| 541 | ***************************************************************************/ |
|---|
| 542 | NEXUS_Error NEXUS_Smartcard_ResetCard( |
|---|
| 543 | NEXUS_SmartcardHandle smartcard, /* handle returned by NEXUS_SmartCard_Open */ |
|---|
| 544 | void *pdata, /* [out] attr{nelem=numBytes;nelem_out=pBytesRead;reserved=64} pointer to memory that can be read into */ |
|---|
| 545 | size_t numBytes, /* maximum number of bytes pointed to by data */ |
|---|
| 546 | size_t *pBytesRead /* [out] length of data read into the data field. */ |
|---|
| 547 | ); |
|---|
| 548 | |
|---|
| 549 | /*************************************************************************** |
|---|
| 550 | Summary: |
|---|
| 551 | Reset the smartcard interface. |
|---|
| 552 | |
|---|
| 553 | Description: |
|---|
| 554 | Reprogram all the Broadcom smartcard interface, not the card. |
|---|
| 555 | If you want to reset the card, use NEXUS_Smartcard_ResetCard. |
|---|
| 556 | |
|---|
| 557 | The interface must be reset whenever a card is inserted. |
|---|
| 558 | |
|---|
| 559 | See Also: |
|---|
| 560 | NEXUS_Smartcard_Read |
|---|
| 561 | ***************************************************************************/ |
|---|
| 562 | NEXUS_Error NEXUS_Smartcard_Reset( |
|---|
| 563 | NEXUS_SmartcardHandle smartcard, /* handle returned by NEXUS_SmartCard_Open */ |
|---|
| 564 | bool warmReset /* true for a warm reset, false for a cold reset */ |
|---|
| 565 | ); |
|---|
| 566 | |
|---|
| 567 | /*************************************************************************** |
|---|
| 568 | Summary: |
|---|
| 569 | Detect the card insertion. |
|---|
| 570 | |
|---|
| 571 | Description: |
|---|
| 572 | The function will be blocked until the card is inserted. |
|---|
| 573 | |
|---|
| 574 | See Also: |
|---|
| 575 | NEXUS_Smartcard_Read |
|---|
| 576 | ***************************************************************************/ |
|---|
| 577 | NEXUS_Error NEXUS_Smartcard_DetectCard( |
|---|
| 578 | NEXUS_SmartcardHandle smartcard |
|---|
| 579 | ); |
|---|
| 580 | |
|---|
| 581 | /*************************************************************************** |
|---|
| 582 | Summary: |
|---|
| 583 | Power ICC |
|---|
| 584 | |
|---|
| 585 | Description: |
|---|
| 586 | If iccAction is NEXUS_SmartcardPowerIcc_ePowerUp, this function shall set SC_VCC |
|---|
| 587 | high. System should call this function so that the next NEXUS_Smartcard_GetStatus |
|---|
| 588 | will show the correct presence of the card or next NEXUS_Smartcard_DetectCard |
|---|
| 589 | will response correctly after TDA8004 emergency deactivation. |
|---|
| 590 | |
|---|
| 591 | If iccAction is NEXUS_SmartcardPowerIcc_ePowerDown, this function shall set SC_VCC |
|---|
| 592 | low. The next NEXUS_Smartcard_GetStatus may not show the correct presence of the |
|---|
| 593 | card or next NEXUS_Smartcard_DetectCard may not response correctly after |
|---|
| 594 | TDA8004 emergency deactivation. |
|---|
| 595 | **************************************************************************/ |
|---|
| 596 | NEXUS_Error NEXUS_Smartcard_PowerIcc( |
|---|
| 597 | NEXUS_SmartcardHandle smartcard, |
|---|
| 598 | NEXUS_SmartcardPowerIcc iccAction |
|---|
| 599 | ); |
|---|
| 600 | |
|---|
| 601 | /*************************************************************************** |
|---|
| 602 | Summary: |
|---|
| 603 | Deactivate the smartcard. |
|---|
| 604 | |
|---|
| 605 | Description: |
|---|
| 606 | This function is used to deactivate the smartcard. After deactivation, the smartcard |
|---|
| 607 | needs to be reset in order to communicate with it again. |
|---|
| 608 | |
|---|
| 609 | See Also: |
|---|
| 610 | NEXUS_Smartcard_Read |
|---|
| 611 | ***************************************************************************/ |
|---|
| 612 | NEXUS_Error NEXUS_Smartcard_Deactivate ( |
|---|
| 613 | NEXUS_SmartcardHandle smartcard |
|---|
| 614 | ); |
|---|
| 615 | |
|---|
| 616 | #ifdef __cplusplus |
|---|
| 617 | } |
|---|
| 618 | #endif |
|---|
| 619 | |
|---|
| 620 | #endif /* #ifndef NEXUS_SMARTCARD_H__ */ |
|---|
| 621 | |
|---|