1 //<MStar Software> 2 //****************************************************************************** 3 // MStar Software 4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved. 5 // All software, firmware and related documentation herein ("MStar Software") are 6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by 7 // law, including, but not limited to, copyright law and international treaties. 8 // Any use, modification, reproduction, retransmission, or republication of all 9 // or part of MStar Software is expressly prohibited, unless prior written 10 // permission has been granted by MStar. 11 // 12 // By accessing, browsing and/or using MStar Software, you acknowledge that you 13 // have read, understood, and agree, to be bound by below terms ("Terms") and to 14 // comply with all applicable laws and regulations: 15 // 16 // 1. MStar shall retain any and all right, ownership and interest to MStar 17 // Software and any modification/derivatives thereof. 18 // No right, ownership, or interest to MStar Software and any 19 // modification/derivatives thereof is transferred to you under Terms. 20 // 21 // 2. You understand that MStar Software might include, incorporate or be 22 // supplied together with third party`s software and the use of MStar 23 // Software may require additional licenses from third parties. 24 // Therefore, you hereby agree it is your sole responsibility to separately 25 // obtain any and all third party right and license necessary for your use of 26 // such third party`s software. 27 // 28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as 29 // MStar`s confidential information and you agree to keep MStar`s 30 // confidential information in strictest confidence and not disclose to any 31 // third party. 32 // 33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any 34 // kind. Any warranties are hereby expressly disclaimed by MStar, including 35 // without limitation, any warranties of merchantability, non-infringement of 36 // intellectual property rights, fitness for a particular purpose, error free 37 // and in conformity with any international standard. You agree to waive any 38 // claim against MStar for any loss, damage, cost or expense that you may 39 // incur related to your use of MStar Software. 40 // In no event shall MStar be liable for any direct, indirect, incidental or 41 // consequential damages, including without limitation, lost of profit or 42 // revenues, lost or damage of data, and unauthorized system use. 43 // You agree that this Section 4 shall still apply without being affected 44 // even if MStar Software has been modified by MStar in accordance with your 45 // request or instruction for your use, except otherwise agreed by both 46 // parties in writing. 47 // 48 // 5. If requested, MStar may from time to time provide technical supports or 49 // services in relation with MStar Software to you for your use of 50 // MStar Software in conjunction with your or your customer`s product 51 // ("Services"). 52 // You understand and agree that, except otherwise agreed by both parties in 53 // writing, Services are provided on an "AS IS" basis and the warranty 54 // disclaimer set forth in Section 4 above shall apply. 55 // 56 // 6. Nothing contained herein shall be construed as by implication, estoppels 57 // or otherwise: 58 // (a) conferring any license or right to use MStar name, trademark, service 59 // mark, symbol or any other identification; 60 // (b) obligating MStar or any of its affiliates to furnish any person, 61 // including without limitation, you and your customers, any assistance 62 // of any kind whatsoever, or any information; or 63 // (c) conferring any license or right under any intellectual property right. 64 // 65 // 7. These terms shall be governed by and construed in accordance with the laws 66 // of Taiwan, R.O.C., excluding its conflict of law rules. 67 // Any and all dispute arising out hereof or related hereto shall be finally 68 // settled by arbitration referred to the Chinese Arbitration Association, 69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration 70 // Rules of the Association by three (3) arbitrators appointed in accordance 71 // with the said Rules. 72 // The place of arbitration shall be in Taipei, Taiwan and the language shall 73 // be English. 74 // The arbitration award shall be final and binding to both parties. 75 // 76 //****************************************************************************** 77 //<MStar Software> 78 //////////////////////////////////////////////////////////////////////////////// 79 // 80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc. 81 // All rights reserved. 82 // 83 // Unless otherwise stipulated in writing, any and all information contained 84 // herein regardless in any format shall remain the sole proprietary of 85 // MStar Semiconductor Inc. and be kept in strict confidence 86 // ("MStar Confidential Information") by the recipient. 87 // Any unauthorized act including without limitation unauthorized disclosure, 88 // copying, use, reproduction, sale, distribution, modification, disassembling, 89 // reverse engineering and compiling of the contents of MStar Confidential 90 // Information is unlawful and strictly prohibited. MStar hereby reserves the 91 // rights to any and all damages, losses, costs and expenses resulting therefrom. 92 // 93 //////////////////////////////////////////////////////////////////////////////// 94 95 /////////////////////////////////////////////////////////////////////////////////////////////////// 96 /// 97 /// @file drvSC.h 98 /// @brief SmartCard Driver Interface 99 /// @author MStar Semiconductor Inc. 100 /////////////////////////////////////////////////////////////////////////////////////////////////// 101 102 /*! \defgroup G_SC SC interface (drvSC.h) 103 \ingroup G_PERIPHERAL 104 <b>Features</b> 105 - SC driver init 106 - SC driver open 107 - Reset the smart card and get the ATR response data 108 - Send data to smart card 109 - Recv the data from smart card 110 - Send and recv data by T0 protocol 111 - Send and recv data by T1 protocol 112 - SC driver close 113 - SC driver exit 114 115 <b> SC Block Diagram: </b> \n 116 The SC drver block diagram, all driver API are in user space, INT and data transfer are in kernel driver 117 118 <b> Operation Code Flow: </b> \n 119 -# Call sc init 120 -# Call sc open 121 -# Reset sc and get atr 122 -# Call T0 send/recv if inserted card is T0 protocol 123 -# Call T1 send/recv if inserted card is T1protocol 124 -# Call sc close and then exit if want to exit the SC driver 125 126 \defgroup G_SC_INIT Initialization Task relative 127 \ingroup G_SC 128 \defgroup G_SC_COMMON Common Task relative 129 \ingroup G_SC 130 \defgroup G_SC_CONTROL Control relative 131 \ingroup G_SC 132 \defgroup G_SC_OTHER other relative 133 \ingroup G_SC 134 \defgroup G_SC_ToBeModified SC api to be modified 135 \ingroup G_SC 136 \defgroup G_SC_ToBeRemove SC api to be removed 137 \ingroup G_SC 138 */ 139 140 #ifndef __DRV_SC_H__ 141 #define __DRV_SC_H__ 142 143 144 #ifdef __cplusplus 145 extern "C" 146 { 147 #endif 148 149 #include "MsDevice.h" 150 151 //------------------------------------------------------------------------------------------------- 152 // Driver Capability 153 //------------------------------------------------------------------------------------------------- 154 155 156 //------------------------------------------------------------------------------------------------- 157 // Macro and Define 158 //------------------------------------------------------------------------------------------------- 159 #define MSIF_SC_LIB_CODE {'S','C'} //Lib code 160 #define MSIF_SC_LIBVER {'0','1'} //LIB version 161 #define MSIF_SC_BUILDNUM {'0','1'} //Build Number 162 #define MSIF_SC_CHANGELIST {'0','0','0','0','0','0','0','0'} //P4 ChangeList Number 163 164 #define SC_DRV_VERSION /* Character String for DRV/API version */ \ 165 MSIF_TAG, /* 'MSIF' */ \ 166 MSIF_CLASS, /* '00' */ \ 167 MSIF_CUS, /* 0x0000 */ \ 168 MSIF_MOD, /* 0x0000 */ \ 169 MSIF_CHIP, \ 170 MSIF_CPU, \ 171 MSIF_SC_LIB_CODE, /* IP__ */ \ 172 MSIF_SC_LIBVER, /* 0.0 ~ Z.Z */ \ 173 MSIF_SC_BUILDNUM, /* 00 ~ 99 */ \ 174 MSIF_SC_CHANGELIST, /* CL# */ \ 175 MSIF_OS 176 177 #define SC_ATR_LEN_MAX 33 ///< Maximum length of ATR 178 #define SC_ATR_LEN_MIN 2 ///< Minimum length of ATR 179 #define SC_HIST_LEN_MAX 15 ///< Maximum length of ATR history 180 #define SC_PPS_LEN_MAX 6 ///< Maximum length of PPS 181 #define SC_FIFO_SIZE 512 // Rx fifo size 182 183 ///SC_Param.u8UartMode 184 #define SC_UART_CHAR_7 (0x02) 185 #define SC_UART_CHAR_8 (0x03) 186 #define SC_UART_STOP_1 (0x00) 187 #define SC_UART_STOP_2 (0x04) 188 #define SC_UART_PARITY_NO (0x00) 189 #define SC_UART_PARITY_ODD (0x08) 190 #define SC_UART_PARITY_EVEN (0x08|0x10) 191 192 #define SC_PROC_LOCK (0xFE66) 193 #define SC_PROC_UNLOCK (0x0) 194 195 //------------------------------------------------------------------------------------------------- 196 // Type and Structure 197 //------------------------------------------------------------------------------------------------- 198 199 typedef struct _SC_Status 200 { 201 MS_BOOL bCardIn; ///< Card status 202 203 } SC_Status; 204 205 typedef enum _SC_DbgLv 206 { 207 E_SC_DBGLV_NONE, //no debug message 208 E_SC_DBGLV_ERR_ONLY, //show error only 209 E_SC_DBGLV_REG_DUMP, //show error & reg dump 210 E_SC_DBGLV_INFO, //show error & informaiton 211 E_SC_DBGLV_ALL, //show error, information & funciton name 212 } SC_DbgLv; 213 214 /// SmartCard DDI error code 215 typedef enum 216 { 217 E_SC_FAIL, ///< Function fail 218 E_SC_OK, ///< No Error 219 E_SC_PPSFAIL, ///< Do PPS fail 220 E_SC_INVCONV, ///< Inverse convention 221 E_SC_CARDIN, ///< Card in 222 E_SC_CARDOUT, ///< Card out 223 E_SC_NODATA, ///< No data 224 E_SC_TIMEOUT, ///< Timeout 225 E_SC_OVERFLOW, ///< Rx data fifo overflow 226 E_SC_CRCERROR, ///< ATR checksum error 227 E_SC_DATAERROR, ///< Data error 228 E_SC_PARMERROR, ///< Parameter error 229 } SC_Result; 230 231 /// SmartCard event 232 typedef enum 233 { 234 E_SC_EVENT_DATA, ///< Rx data valid 235 E_SC_EVENT_IN, ///< Card in 236 E_SC_EVENT_OUT, ///< Card out 237 238 } SC_Event; 239 240 /// SmartCard CLK setting 241 typedef enum 242 { 243 E_SC_CLK_3M, ///< 3 MHz 244 E_SC_CLK_4P5M, ///< 4.5 MHz 245 E_SC_CLK_6M, ///< 6 MHz 246 E_SC_CLK_13M, ///< 6 MHz 247 E_SC_CLK_4M, ///< 4 MHz 248 } SC_ClkCtrl; 249 250 /// SmartCard VCC control mode 251 typedef enum 252 { 253 E_SC_VCC_CTRL_8024_ON, ///< by external 8024 on 254 E_SC_VCC_CTRL_LOW, ///< by direct Vcc (low active) 255 E_SC_VCC_CTRL_HIGH, ///< by direct Vcc (high active) 256 E_SC_OCP_VCC_HIGH, 257 E_SC_VCC_VCC_ONCHIP_8024, 258 } SC_VccCtrl; 259 260 // smart card 3V/5V control 261 typedef enum 262 { 263 E_SC_VOLTAGE_3_POINT_3V, ///<3.3V 264 E_SC_VOLTAGE_5V, ///< 5V 265 E_SC_VOLTAGE_MAX 266 } SC_VoltageCtrl; 267 268 typedef void(*P_SC_En5V_Callback)(MS_BOOL bEnable); 269 270 271 typedef enum 272 { 273 E_SC_HIGH_ACTIVE = 0x0, 274 E_SC_LOW_ACTIVE = 0xff3 275 } SC_CardDetType; 276 277 /// SmartCard configuration 278 typedef struct 279 { 280 MS_U8 u8Protocal; ///< T= 281 SC_ClkCtrl eCardClk; ///< Clock 282 MS_U8 u8UartMode; ///< Uart Mode 283 MS_U16 u16ClkDiv; ///< Div 284 SC_VccCtrl eVccCtrl; 285 MS_U16 u16Bonding; ///Chip Bonding type 286 P_SC_En5V_Callback pfOCPControl; 287 MS_U8 u8Convention; ///< Convention 288 SC_VoltageCtrl eVoltage; 289 SC_CardDetType u8CardDetInvert; 290 } SC_Param; 291 292 /// SmartCard event callback 293 typedef void (*P_SC_Callback)(MS_U8 u8SCID, SC_Event eEvent); 294 295 typedef struct _Smart_Dev 296 { 297 298 } SC_Dev; 299 300 301 /// SmartCard Info 302 typedef struct 303 { 304 // SmsartCard Protocol 305 MS_U8 u8Protocol; ///T= Protocol 306 MS_BOOL bSpecMode; ///Special mode 307 MS_U8 pu8Atr[SC_ATR_LEN_MAX]; ///Atr buffer 308 MS_U16 u16AtrLen; ///Atr length 309 MS_U8 pu8Hist[SC_HIST_LEN_MAX]; ///History buffer 310 MS_U16 u16HistLen; ///History length 311 MS_U8 u8Fi; ///Fi 312 MS_U8 u8Di; ///Di 313 314 // Device Setting 315 MS_BOOL bInited; 316 MS_BOOL bOpened; ///Open 317 MS_BOOL bCardIn; ///Status care in 318 MS_BOOL blast_cardin; 319 SC_ClkCtrl eCardClk; ///< Clock 320 MS_U8 u8UartMode; ///< Uart Mode 321 SC_VccCtrl eVccCtrl; 322 MS_U16 u16ClkDiv; ///< Div 323 MS_U16 u16Bonding; //@TODO: how to take care of bonding????? 324 P_SC_En5V_Callback pfEn5V; 325 MS_U8 u8Convention; 326 327 MS_U8 u8FifoRx[SC_FIFO_SIZE]; 328 MS_U16 u16FifoRxRead; 329 MS_U16 u16FifoRxWrite; 330 331 MS_U8 u8FifoTx[SC_FIFO_SIZE]; 332 MS_U16 u16FifoTxRead; 333 MS_U16 u16FifoTxWrite; 334 P_SC_Callback pfNotify; ///Call back funtcion 335 336 MS_BOOL bLastCardIn; 337 MS_S32 s32DevFd; 338 339 } SC_Info; 340 341 342 /// SmartCard Caps 343 typedef struct 344 { 345 MS_U8 u8DevNum; ///SmartCard Device Number 346 347 } SC_Caps; 348 349 ///Define SC Command Index 350 typedef enum 351 { 352 //MIPS-->51 Command Index 353 SC_CMDIDX_RAW_EXCHANGE = 0x01, /// SC Command Index is Raw Data Exchange 354 SC_CMDIDX_GET_ATR = 0x02, /// SC Command Index is Get ATR 355 SC_CMDIDX_SEND = 0x03, /// SC Command Index is Send Data 356 SC_CMDIDX_RECV = 0x04, /// SC Command Index is Receive Data 357 358 SC_CMDIDX_ACK_51ToMIPS = 0x30, /// SC Command Index is ACK 51 To MIPS 359 360 //51->MIPS Command Index 361 SC_CMDIDX_ACK_MIPSTo51 = 0xA0, /// SC Command Index is ACK MIPS To 51 362 363 } SC_CmdIndex; 364 365 366 ///Define SC Acknowledge Flags 367 typedef enum 368 { 369 E_SC_ACKFLG_NULL = 0, /// Ack flag for NULL 370 E_SC_ACKFLG_WAIT_RAW_EXCHANGE = (1<<0), /// Ack flag for Raw Exchange 371 E_SC_ACKFLG_WAIT_GET_ATR = (1<<1), /// Ack flag for ATR 372 E_SC_ACKFLG_WAIT_SEND = (1<<2), /// Ack flag for Sending 373 E_SC_ACKFLG_WAIT_RECV = (1<<3), /// Ack flag for Receiving 374 375 } SC_AckFlags; 376 377 typedef struct __attribute__ ((packed, aligned (4096))) 378 { 379 MS_U8 u8SCID; 380 MS_U16 u16DataLen; /* Send and reply data length*/ 381 MS_U16 u16ReplyMaxLen; /* Maximum length of reply data */ 382 MS_U8 u8Data[259]; /* T=0, 256 data bytes plus the two status words SW1 and SW2 383 T=1, 254 INF bytes plus NAD, PCB, LEN, and two EDC bytes 384 Send and reply data buffer*/ 385 } SC_DataCfg; 386 387 /// SmartCard Caps 388 typedef struct 389 { 390 MS_PHY u32DataBuffAddr; ///SmartCard Data Buffer Address, 4K alignment 391 MS_PHY u32FwBuffAddr; ///SmartCard Firmware Buffer Address, 64K alignment 392 } SC_BuffAddr; 393 394 //------------------------------------------------------------------------------------------------- 395 // Function and Variable 396 //------------------------------------------------------------------------------------------------- 397 //------------------------------------------------------------------------------------------------- 398 /// MOBF Encrypt 399 /// @ingroup G_SC_INIT 400 /// @param u32Key \b IN: Key 401 /// @param bEnable \b IN: TRUE/FLASE 402 /// @return DRVAESDMA_OK : Success 403 /// @return Others : Fail 404 //------------------------------------------------------------------------------------------------- 405 SC_Result MDrv_SC_Init(MS_U8 u8SCID); 406 //------------------------------------------------------------------------------------------------- 407 /// MOBF Encrypt 408 /// @ingroup G_SC_CONTROL 409 /// @param u32Key \b IN: Key 410 /// @param bEnable \b IN: TRUE/FLASE 411 /// @return DRVAESDMA_OK : Success 412 /// @return Others : Fail 413 //------------------------------------------------------------------------------------------------- 414 SC_Result MDrv_SC_Open(MS_U8 u8SCID, MS_U8 u8Protocol, SC_Param* pParam, P_SC_Callback pfSmartNotify); 415 //------------------------------------------------------------------------------------------------- 416 /// MOBF Encrypt 417 /// @ingroup G_SC_CONTROL 418 /// @param u32Key \b IN: Key 419 /// @param bEnable \b IN: TRUE/FLASE 420 /// @return DRVAESDMA_OK : Success 421 /// @return Others : Fail 422 //------------------------------------------------------------------------------------------------- 423 SC_Result MDrv_SC_Config(MS_U8 u8SCID, SC_Param* pParam); 424 //------------------------------------------------------------------------------------------------- 425 /// MOBF Encrypt 426 /// @ingroup G_SC_CONTROL 427 /// @param u32Key \b IN: Key 428 /// @param bEnable \b IN: TRUE/FLASE 429 /// @return DRVAESDMA_OK : Success 430 /// @return Others : Fail 431 //------------------------------------------------------------------------------------------------- 432 SC_Result MDrv_SC_Close(MS_U8 u8SCID); 433 //------------------------------------------------------------------------------------------------- 434 /// MOBF Encrypt 435 /// @ingroup G_SC_CONTROL 436 /// @param u32Key \b IN: Key 437 /// @param bEnable \b IN: TRUE/FLASE 438 /// @return DRVAESDMA_OK : Success 439 /// @return Others : Fail 440 //------------------------------------------------------------------------------------------------- 441 SC_Result MDrv_SC_Reset(MS_U8 u8SCID, SC_Param* pParam); 442 //------------------------------------------------------------------------------------------------- 443 /// MOBF Encrypt 444 /// @ingroup G_SC_CONTROL 445 /// @param u32Key \b IN: Key 446 /// @param bEnable \b IN: TRUE/FLASE 447 /// @return DRVAESDMA_OK : Success 448 /// @return Others : Fail 449 //------------------------------------------------------------------------------------------------- 450 SC_Result MDrv_SC_Activate(MS_U8 u8SCID); 451 //------------------------------------------------------------------------------------------------- 452 /// MOBF Encrypt 453 /// @ingroup G_SC_CONTROL 454 /// @param u32Key \b IN: Key 455 /// @param bEnable \b IN: TRUE/FLASE 456 /// @return DRVAESDMA_OK : Success 457 /// @return Others : Fail 458 //------------------------------------------------------------------------------------------------- 459 SC_Result MDrv_SC_Deactivate(MS_U8 u8SCID); 460 //------------------------------------------------------------------------------------------------- 461 /// MOBF Encrypt 462 /// @ingroup G_SC_CONTROL 463 /// @param u32Key \b IN: Key 464 /// @param bEnable \b IN: TRUE/FLASE 465 /// @return DRVAESDMA_OK : Success 466 /// @return Others : Fail 467 //------------------------------------------------------------------------------------------------- 468 SC_Result MDrv_SC_Reset_ATR(MS_U8 u8SCID, SC_Param* pParam, MS_U8 *pu8Atr, MS_U16 *pu16AtrLen, MS_U8 *pu8His, MS_U16 *pu16HisLen); 469 //------------------------------------------------------------------------------------------------- 470 /// MOBF Encrypt 471 /// @ingroup G_SC_CONTROL 472 /// @param u32Key \b IN: Key 473 /// @param bEnable \b IN: TRUE/FLASE 474 /// @return DRVAESDMA_OK : Success 475 /// @return Others : Fail 476 //------------------------------------------------------------------------------------------------- 477 SC_Result MDrv_SC_PPS(MS_U8 u8SCID); 478 //------------------------------------------------------------------------------------------------- 479 /// MOBF Encrypt 480 /// @ingroup G_SC_CONTROL 481 /// @param u32Key \b IN: Key 482 /// @param bEnable \b IN: TRUE/FLASE 483 /// @return DRVAESDMA_OK : Success 484 /// @return Others : Fail 485 //------------------------------------------------------------------------------------------------- 486 SC_Result MDrv_SC_Send(MS_U8 u8SCID, MS_U8 *pu8SendData, MS_U16 u16SendDataLen, MS_U32 u32TimeoutMs); 487 //------------------------------------------------------------------------------------------------- 488 /// MOBF Encrypt 489 /// @ingroup G_SC_CONTROL 490 /// @param u32Key \b IN: Key 491 /// @param bEnable \b IN: TRUE/FLASE 492 /// @return DRVAESDMA_OK : Success 493 /// @return Others : Fail 494 //------------------------------------------------------------------------------------------------- 495 SC_Result MDrv_SC_Recv(MS_U8 u8SCID, MS_U8 *pu8ReadData, MS_U16 *u16ReadDataLen, MS_U32 u32TimeoutMs); 496 //------------------------------------------------------------------------------------------------- 497 /// MOBF Encrypt 498 /// @ingroup G_SC_ToBeRemove 499 /// @param u32Key \b IN: Key 500 /// @param bEnable \b IN: TRUE/FLASE 501 /// @return DRVAESDMA_OK : Success 502 /// @return Others : Fail 503 //------------------------------------------------------------------------------------------------- 504 SC_Result MDrv_SC_T0_SendRecv(MS_U8 u8SCID, MS_U8 *pu8SendData, MS_U16 u16SendLen, MS_U8 *pu8RecvData, MS_U16 *pu16RecvLen); 505 //------------------------------------------------------------------------------------------------- 506 /// MOBF Encrypt 507 /// @ingroup G_SC_ToBeRemove 508 /// @param u32Key \b IN: Key 509 /// @param bEnable \b IN: TRUE/FLASE 510 /// @return DRVAESDMA_OK : Success 511 /// @return Others : Fail 512 //------------------------------------------------------------------------------------------------- 513 SC_Result MDrv_SC_T1_SendRecv(MS_U8 u8SCID, MS_U8 *pu8SendData, MS_U16 *u16SendDataLen, MS_U8 *pu8ReadData, MS_U16 *u16ReadDataLen); 514 //------------------------------------------------------------------------------------------------- 515 /// MOBF Encrypt 516 /// @ingroup G_SC_ToBeRemove 517 /// @param u32Key \b IN: Key 518 /// @param bEnable \b IN: TRUE/FLASE 519 /// @return DRVAESDMA_OK : Success 520 /// @return Others : Fail 521 //------------------------------------------------------------------------------------------------- 522 SC_Result MDrv_SC_T14_SendRecv(MS_U8 u8SCID, MS_U8 *pu8SendData, MS_U16 u16SendLen, MS_U8 *pu8RecvData, MS_U16 *pu16RecvLen); 523 //------------------------------------------------------------------------------------------------- 524 /// MOBF Encrypt 525 /// @ingroup G_SC_CONTROL 526 /// @param u32Key \b IN: Key 527 /// @param bEnable \b IN: TRUE/FLASE 528 /// @return DRVAESDMA_OK : Success 529 /// @return Others : Fail 530 //------------------------------------------------------------------------------------------------- 531 SC_Result MDrv_SC_Exit(MS_U8 u8SCID); 532 //------------------------------------------------------------------------------------------------- 533 /// MOBF Encrypt 534 /// @ingroup G_SC_CONTROL 535 /// @param u32Key \b IN: Key 536 /// @param bEnable \b IN: TRUE/FLASE 537 /// @return DRVAESDMA_OK : Success 538 /// @return Others : Fail 539 //------------------------------------------------------------------------------------------------- 540 SC_Result MDrv_SC_GetATR(MS_U8 u8SCID, MS_U32 u32TimeOut,MS_U8 *pu8Atr, MS_U16 *pu16AtrLen, MS_U8 *pu8His, MS_U16 *pu16HisLen); 541 //------------------------------------------------------------------------------------------------- 542 /// MOBF Encrypt 543 /// @ingroup G_SC_COMMON 544 /// @param u32Key \b IN: Key 545 /// @param bEnable \b IN: TRUE/FLASE 546 /// @return DRVAESDMA_OK : Success 547 /// @return Others : Fail 548 //------------------------------------------------------------------------------------------------- 549 const SC_Info* MDrv_SC_GetInfo(MS_U8 u8SCID); 550 //------------------------------------------------------------------------------------------------- 551 /// MOBF Encrypt 552 /// @ingroup G_SC_COMMON 553 /// @param u32Key \b IN: Key 554 /// @param bEnable \b IN: TRUE/FLASE 555 /// @return DRVAESDMA_OK : Success 556 /// @return Others : Fail 557 //------------------------------------------------------------------------------------------------- 558 // SC_Result MDrv_SC_GetLibVer(const MSIF_Version **ppVersion); 559 //------------------------------------------------------------------------------------------------- 560 /// MOBF Encrypt 561 /// @ingroup G_SC_COMMON 562 /// @param u32Key \b IN: Key 563 /// @param bEnable \b IN: TRUE/FLASE 564 /// @return DRVAESDMA_OK : Success 565 /// @return Others : Fail 566 //------------------------------------------------------------------------------------------------- 567 SC_Result MDrv_SC_GetStatus(MS_U8 u8SCID, SC_Status *pStatus); 568 //------------------------------------------------------------------------------------------------- 569 /// MOBF Encrypt 570 /// @ingroup G_SC_COMMON 571 /// @param u32Key \b IN: Key 572 /// @param bEnable \b IN: TRUE/FLASE 573 /// @return DRVAESDMA_OK : Success 574 /// @return Others : Fail 575 //------------------------------------------------------------------------------------------------- 576 void MDrv_SC_SetDbgLevel(SC_DbgLv eLevel); 577 //------------------------------------------------------------------------------------------------- 578 /// MOBF Encrypt 579 /// @ingroup G_SC_CONTROL 580 /// @param u32Key \b IN: Key 581 /// @param bEnable \b IN: TRUE/FLASE 582 /// @return DRVAESDMA_OK : Success 583 /// @return Others : Fail 584 //------------------------------------------------------------------------------------------------- 585 SC_Result MDrv_SC_SetPPS(MS_U8 u8SCID, MS_U8 u8SCProtocol, MS_U8 u8Di,MS_U8 u8Fi); 586 //------------------------------------------------------------------------------------------------- 587 /// MOBF Encrypt 588 /// @ingroup G_SC_COMMON 589 /// @param u32Key \b IN: Key 590 /// @param bEnable \b IN: TRUE/FLASE 591 /// @return DRVAESDMA_OK : Success 592 /// @return Others : Fail 593 //------------------------------------------------------------------------------------------------- 594 SC_Result MDrv_SC_ClearState(MS_U8 u8SCID); 595 //------------------------------------------------------------------------------------------------- 596 /// MOBF Encrypt 597 /// @ingroup G_SC_CONTROL 598 /// @param u32Key \b IN: Key 599 /// @param bEnable \b IN: TRUE/FLASE 600 /// @return DRVAESDMA_OK : Success 601 /// @return Others : Fail 602 //------------------------------------------------------------------------------------------------- 603 SC_Result MDrv_SC_PowerOff(void); 604 //------------------------------------------------------------------------------------------------- 605 /// MOBF Encrypt 606 /// @ingroup G_SC_CONTROL 607 /// @param u32Key \b IN: Key 608 /// @param bEnable \b IN: TRUE/FLASE 609 /// @return DRVAESDMA_OK : Success 610 /// @return Others : Fail 611 //------------------------------------------------------------------------------------------------- 612 SC_Result MDrv_SC_SetGuardTime(MS_U8 u8SCID, MS_U8 u8GuardTime); 613 614 //------------------------------------------------------------------------------------------------- 615 /// MOBF Encrypt 616 /// @ingroup G_SC_ToBeRemove 617 /// @param u32Key \b IN: Key 618 /// @param bEnable \b IN: TRUE/FLASE 619 /// @return DRVAESDMA_OK : Success 620 /// @return Others : Fail 621 //------------------------------------------------------------------------------------------------- 622 SC_Result MDrv_SC_Task_Proc(void); 623 //------------------------------------------------------------------------------------------------- 624 /// MOBF Encrypt 625 /// @ingroup G_SC_ToBeRemove 626 /// @param u32Key \b IN: Key 627 /// @param bEnable \b IN: TRUE/FLASE 628 /// @return DRVAESDMA_OK : Success 629 /// @return Others : Fail 630 //------------------------------------------------------------------------------------------------- 631 // MS_BOOL MDrv_SC_ISR_Proc(MS_U8 u8SCID); 632 //------------------------------------------------------------------------------------------------- 633 /// MOBF Encrypt 634 /// @ingroup G_SC_ToBeRemove 635 /// @param u32Key \b IN: Key 636 /// @param bEnable \b IN: TRUE/FLASE 637 /// @return DRVAESDMA_OK : Success 638 /// @return Others : Fail 639 //------------------------------------------------------------------------------------------------- 640 // SC_Result MDrv_SC_RawExchange(MS_U8 u8SCID, MS_U8 *pu8SendData, MS_U16 *u16SendDataLen, MS_U8 *pu8ReadData, MS_U16 *u16ReadDataLen); 641 //------------------------------------------------------------------------------------------------- 642 /// MOBF Encrypt 643 /// @ingroup G_SC_ToBeRemove 644 /// @param u32Key \b IN: Key 645 /// @param bEnable \b IN: TRUE/FLASE 646 /// @return DRVAESDMA_OK : Success 647 /// @return Others : Fail 648 //------------------------------------------------------------------------------------------------- 649 // SC_Result MDrv_SC_RawExchangeTimeout(MS_U8 u8SCID, MS_U8 *pu8SendData, MS_U16 *u16SendDataLen, MS_U8 *pu8ReadData, MS_U16 *u16ReadDataLen, MS_U32 u32TimeoutMs); 650 //------------------------------------------------------------------------------------------------- 651 /// MOBF Encrypt 652 /// @ingroup G_SC_ToBeRemove 653 /// @param u32Key \b IN: Key 654 /// @param bEnable \b IN: TRUE/FLASE 655 /// @return DRVAESDMA_OK : Success 656 /// @return Others : Fail 657 //------------------------------------------------------------------------------------------------- 658 SC_Result MDrv_SC_SetBuffAddr(SC_BuffAddr *pScBuffAddr); 659 //------------------------------------------------------------------------------------------------- 660 /// MOBF Encrypt 661 /// @ingroup G_SC_ToBeRemove 662 /// @param u32Key \b IN: Key 663 /// @param bEnable \b IN: TRUE/FLASE 664 /// @return DRVAESDMA_OK : Success 665 /// @return Others : Fail 666 //------------------------------------------------------------------------------------------------- 667 MS_BOOL MDrv_SC_CardVoltage_Config(MS_U8 u8SCID, SC_VoltageCtrl eVoltage); 668 //------------------------------------------------------------------------------------------------- 669 /// MOBF Encrypt 670 /// @ingroup G_SC_ToBeRemove 671 /// @param u32Key \b IN: Key 672 /// @param bEnable \b IN: TRUE/FLASE 673 /// @return DRVAESDMA_OK : Success 674 /// @return Others : Fail 675 //------------------------------------------------------------------------------------------------- 676 // void MDrv_SC_EnableTimeout(MS_BOOL bTimeout); 677 //------------------------------------------------------------------------------------------------- 678 /// MOBF Encrypt 679 /// @ingroup G_SC_COMMON 680 /// @param u32Key \b IN: Key 681 /// @param bEnable \b IN: TRUE/FLASE 682 /// @return DRVAESDMA_OK : Success 683 /// @return Others : Fail 684 //------------------------------------------------------------------------------------------------- 685 MS_U32 MDrv_SC_SetPowerState(EN_POWER_MODE u16PowerState); 686 687 #ifdef __cplusplus 688 } 689 #endif 690 691 #endif // __DRV_SC_H__ 692