![]() |
|
|||
File indexing completed on 2025-05-11 08:23:01
0001 /* 0002 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc. 0003 * Copyright 2016-2017 NXP 0004 * All rights reserved. 0005 * 0006 * SPDX-License-Identifier: BSD-3-Clause 0007 */ 0008 0009 #ifndef _FSL_SMARTCARD_EMVSIM_H_ 0010 #define _FSL_SMARTCARD_EMVSIM_H_ 0011 0012 #include "fsl_smartcard.h" 0013 0014 /*! 0015 * @addtogroup smartcard_emvsim_driver 0016 * @{ 0017 */ 0018 0019 /******************************************************************************* 0020 * Definitions 0021 ******************************************************************************/ 0022 0023 /*! @brief EMV RX NACK interrupt generation threshold */ 0024 #define SMARTCARD_EMV_RX_NACK_THRESHOLD (5u) 0025 0026 /*! @brief EMV TX NACK interrupt generation threshold */ 0027 #define SMARTCARD_EMV_TX_NACK_THRESHOLD (5u) 0028 0029 /*! @brief Smart card Word Wait Timer adjustment value */ 0030 #define SMARTCARD_WWT_ADJUSTMENT (160u) 0031 0032 /*! @brief Smart card Character Wait Timer adjustment value */ 0033 #define SMARTCARD_CWT_ADJUSTMENT (3u) 0034 0035 /*! @brief General Purpose Counter clock selections */ 0036 typedef enum _emvsim_gpc_clock_select 0037 { 0038 kEMVSIM_GPCClockDisable = 0u, /*!< Disabled */ 0039 kEMVSIM_GPCCardClock = 1u, /*!< Card clock */ 0040 kEMVSIM_GPCRxClock = 2u, /*!< Receive clock */ 0041 kEMVSIM_GPCTxClock = 3u, /*!< Transmit ETU clock */ 0042 } emvsim_gpc_clock_select_t; 0043 0044 /*! @brief EMVSIM card presence detection edge control */ 0045 typedef enum _presence_detect_edge 0046 { 0047 kEMVSIM_DetectOnFallingEdge = 0u, /*!< Presence detected on the falling edge */ 0048 kEMVSIM_DetectOnRisingEdge = 1u, /*!< Presence detected on the rising edge */ 0049 } emvsim_presence_detect_edge_t; 0050 0051 /*! @brief EMVSIM card presence detection status */ 0052 typedef enum _presence_detect_status 0053 { 0054 kEMVSIM_DetectPinIsLow = 0u, /*!< Presence detected pin is logic low */ 0055 kEMVSIM_DetectPinIsHigh = 1u, /*!< Presence detected pin is logic high */ 0056 } emvsim_presence_detect_status_t; 0057 0058 /******************************************************************************* 0059 * API 0060 ******************************************************************************/ 0061 #if defined(__cplusplus) 0062 extern "C" { 0063 #endif 0064 0065 /*! 0066 * @name Smart card EMVSIM Driver 0067 * @{ 0068 */ 0069 0070 /*! 0071 * @brief Fills in the smartcard_card_params structure with default values according to the EMV 4.3 specification. 0072 * 0073 * @param cardParams The configuration structure of type smartcard_interface_config_t. 0074 * Function fill in members: 0075 * Fi = 372; 0076 * Di = 1; 0077 * currentD = 1; 0078 * WI = 0x0A; 0079 * GTN = 0x00; 0080 * with default values. 0081 */ 0082 void SMARTCARD_EMVSIM_GetDefaultConfig(smartcard_card_params_t *cardParams); 0083 0084 /*! 0085 * @brief Initializes an EMVSIM peripheral for the Smart card/ISO-7816 operation. 0086 * 0087 * This function un-gates the EMVSIM clock, initializes the module to EMV default settings, 0088 * configures the IRQ, enables the module-level interrupt to the core and, initializes the driver context. 0089 * 0090 * @param base The EMVSIM peripheral base address. 0091 * @param context A pointer to the smart card driver context structure. 0092 * @param srcClock_Hz Smart card clock generation module source clock. 0093 * 0094 * @return An error code or kStatus_SMARTCARD_Success. 0095 */ 0096 status_t SMARTCARD_EMVSIM_Init(EMVSIM_Type *base, smartcard_context_t *context, uint32_t srcClock_Hz); 0097 0098 /*! 0099 * @brief This function disables the EMVSIM interrupts, disables the transmitter and receiver, 0100 * flushes the FIFOs, and gates EMVSIM clock in SIM. 0101 * 0102 * @param base The EMVSIM module base address. 0103 */ 0104 void SMARTCARD_EMVSIM_Deinit(EMVSIM_Type *base); 0105 0106 /*! 0107 * @brief Returns whether the previous EMVSIM transfer has finished. 0108 * 0109 * When performing an async transfer, call this function to ascertain the context of the 0110 * current transfer: in progress (or busy) or complete (success). If the 0111 * transfer is still in progress, the user can obtain the number of words that have not been 0112 * transferred. 0113 * 0114 * @param base The EMVSIM module base address. 0115 * @param context A pointer to a smart card driver context structure. 0116 * 0117 * @return The number of bytes not transferred. 0118 */ 0119 int32_t SMARTCARD_EMVSIM_GetTransferRemainingBytes(EMVSIM_Type *base, smartcard_context_t *context); 0120 0121 /*! 0122 * @brief Terminates an asynchronous EMVSIM transfer early. 0123 * 0124 * During an async EMVSIM transfer, the user can terminate the transfer early 0125 * if the transfer is still in progress. 0126 * 0127 * @param base The EMVSIM peripheral address. 0128 * @param context A pointer to a smart card driver context structure. 0129 * @retval kStatus_SMARTCARD_Success The transmit abort was successful. 0130 * @retval kStatus_SMARTCARD_NoTransmitInProgress No transmission is currently in progress. 0131 */ 0132 status_t SMARTCARD_EMVSIM_AbortTransfer(EMVSIM_Type *base, smartcard_context_t *context); 0133 0134 /*! 0135 * @brief Transfer data using interrupts. 0136 * 0137 * A non-blocking (also known as asynchronous) function means that the function returns 0138 * immediately after initiating the transfer function. The application has to get the 0139 * transfer status to see when the transfer is complete. In other words, after calling the non-blocking 0140 * (asynchronous) transfer function, the application must get the transfer status to check if the transmit 0141 * is completed or not. 0142 * 0143 * @param base The EMVSIM peripheral base address. 0144 * @param context A pointer to a smart card driver context structure. 0145 * @param xfer A pointer to the smart card transfer structure where the linked buffers and sizes are stored. 0146 * 0147 * @return An error code or kStatus_SMARTCARD_Success. 0148 */ 0149 status_t SMARTCARD_EMVSIM_TransferNonBlocking(EMVSIM_Type *base, smartcard_context_t *context, smartcard_xfer_t *xfer); 0150 0151 /*! 0152 * @brief Controls the EMVSIM module per different user request. 0153 * 0154 * @param base The EMVSIM peripheral base address. 0155 * @param context A pointer to a smart card driver context structure. 0156 * @param control Control type. 0157 * @param param Integer value of specific to control command. 0158 * 0159 * return kStatus_SMARTCARD_Success in success. 0160 * return kStatus_SMARTCARD_OtherError in case of error. 0161 */ 0162 status_t SMARTCARD_EMVSIM_Control(EMVSIM_Type *base, 0163 smartcard_context_t *context, 0164 smartcard_control_t control, 0165 uint32_t param); 0166 0167 /*! 0168 * @brief Handles EMVSIM module interrupts. 0169 * 0170 * @param base The EMVSIM peripheral base address. 0171 * @param context A pointer to a smart card driver context structure. 0172 */ 0173 void SMARTCARD_EMVSIM_IRQHandler(EMVSIM_Type *base, smartcard_context_t *context); 0174 /*@}*/ 0175 0176 #if defined(__cplusplus) 0177 } 0178 #endif 0179 0180 /*! @}*/ 0181 0182 #endif /* _FSL_SMARTCARD_EMVSIM_H_*/
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |