/*************************************************************************** * Copyright (c) 2014 Amlogic, Inc. All rights reserved. * * This source code is subject to the terms and conditions defined in the * file 'LICENSE' which is part of this source code package. * * Description: */ /**\file * \brief smart card communication module * * \author Gong Ke * \date 2010-06-29: create the document ***************************************************************************/ #ifndef _AM_SMC_H #define _AM_SMC_H #ifdef __cplusplus extern "C" { #endif /**************************************************************************** * Macro definitions ***************************************************************************/ #define AM_SMC_MAX_ATR_LEN (33) /**************************************************************************** * Error code definitions ****************************************************************************/ /**\brief Error code of the Smart card module*/ enum AM_SMC_ErrorCode { AM_SMC_ERROR_BASE = 1, AM_SMC_ERR_INVALID_DEV_NO, /**< Invalid device number*/ AM_SMC_ERR_BUSY, /**< The device has already been openned*/ AM_SMC_ERR_NOT_OPENNED, /**< The device is not yet open*/ AM_SMC_ERR_CANNOT_OPEN_DEV, /**< Failed to open device*/ AM_SMC_ERR_CANNOT_CREATE_THREAD, /**< Creating device failure*/ AM_SMC_ERR_TIMEOUT, /**< Timeout*/ AM_SMC_ERR_NOT_SUPPORTED, /**< The device does not support this function*/ AM_SMC_ERR_IO, /**< Device input or output errors*/ AM_SMC_ERR_BUF_TOO_SMALL, /**< Buffer too small*/ AM_SMC_ERR_NO_CARD, /**< Smart card not inserted*/ AM_SMC_ERR_END }; /**************************************************************************** * Event type definitions ****************************************************************************/ /**\brief Event type of Smart card module*/ enum AM_SMC_EventType { AM_SMC_EVT_BASE=0, AM_SMC_EVT_CARD_IN, /**< Smart card insert*/ AM_SMC_EVT_CARD_OUT, /**< Smart card pull out*/ AM_SMC_EVT_END }; /**************************************************************************** * Type definitions ***************************************************************************/ /**\brief Smart card device enable parameter*/ typedef struct { int enable_thread; /**< check the thread of check smart card status is enable*/ } AM_SMC_OpenPara_t; /**\brief Insert Status type of smart card */ typedef enum { AM_SMC_CARD_OUT, /**< Smart card pull out*/ AM_SMC_CARD_IN /**< Smart card insert*/ } AM_SMC_CardStatus_t; /**\brief Smart card status callback*/ typedef void (*AM_SMC_StatusCb_t) (int dev_no, AM_SMC_CardStatus_t status, void *data); /** brief Smart card device parameter*/ typedef struct { int f; /**