Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Smart Card driver

Overview

This section describes the programming interface of the Smart Card driver.

The driver provides synchronous and also asynchronous functions to communicate with the Integrated Circuit Card (ICC). The driver uses a semaphores as synchronization objects of synchronous transfers. The driver is implemented single threaded and additional protection for multithreading is not supported.
Smart Card driver also provides DMA transfers, which is useful for bigger transfer sizes. This feature can be activated in the Smart Card user configuration.

SmartCard Driver Initialization

Smart Card Driver is initialized by calling the SMARTCARD_DRV_Init() function. If DMA features are required, initialize eDMA driver first. The Smart Card Driver initialization configuration structure requires these settings:

The driver also supports user callback installation for assertion/de-assertion Smart Card events. This feature is useful to detect the card presence following a card reset. The user should initialize the Smart Card driver, which then initializes IP and PHY drivers. In other words, the user should use only the Smart Card driver which covers all functionality.

SmartCard Call diagram

Because the call diagram is complex, the detailed use of the Smart Card driver is not described in this section. For details how to use the Smart Card driver, see the Smart Card driver example which demonstrates a simple use case.

Modules

 Smart Card EMVSIM Driver
 
 Smart Card Interface Driver
 
 Smart Card UART Driver
 

Data Structures

struct  smartcard_card_params_t
 Defines card-specific parameters for Smart card driver. More...
 
struct  smartcard_timers_state_t
 Defines the state of the EMV timers in the Smart card driver. More...
 
struct  smartcard_ext_timer_config_t
 Defines state of user specified configuration of Smart card interface. More...
 
struct  smartcard_interface_config_t
 Defines state of user specified configuration of Smart card interface. More...
 
struct  smartcard_interface_state_t
 Defines state of Smart card interface slots. More...
 
struct  smartcard_state_t
 Runtime state of the Smart card driver. More...
 
struct  smartcard_user_config_t
 User configuration structure for the Smart card driver. More...
 
struct  smartcard_driver_interface_t
 Smart card driver interface, which holds function pointers for implementation-specific functions. More...
 
struct  smartcard_interface_slot_t
 SMARTCARD interface slot parameters, specific to interface IC. More...
 

Typedefs

typedef void(* smartcard_interface_callback_t )(uint32_t instance, void *smartcardState)
 Smart card interface interrupt callback function type.
 

Enumerations

enum  smartcard_status_t
 Error codes for the Smart card driver. More...
 
enum  smartcard_control_t
 Control codes for the Smart card protocol timers and misc. More...
 
enum  smartcard_card_voltage_class_t
 Defines Smart card interface voltage class values.
 
enum  smartcard_transfer_state_t
 Defines Smart card I/O transfer states.
 
enum  smartcard_reset_type_t
 Defines Smart card reset types.
 
enum  smartcard_transport_type_t
 Defines Smart card transport protocol types.
 
enum  smartcard_parity_type_t
 Defines Smart card data parity types.
 
enum  smartcard_xfer_mode_t
 Defines data transfer mode: CPU or DMA.
 
enum  smartcard_card_convention_t
 Defines data convention format.
 
enum  smartcard_interface_control_t
 Defines interface IC control types.
 
enum  smartcard_interface_control_t
 Defines interface IC control types.
 

Functions

void SMARTCARD_DRV_InstallDriverFunctions (smartcard_driver_interface_t *smartcardDrvInterfacePtr)
 Installs the Smart card peripheral driver functions. More...
 
void SMARTCARD_DRV_InstallInterfaceFunctions (smartcard_driver_interface_t *smartcardDrvInterfacePtr)
 Installs the Smart card PHY/interface driver functions. More...
 
smartcard_status_t SMARTCARD_DRV_Init (uint32_t instance, smartcard_state_t *smartcardStatePtr, const smartcard_user_config_t *smartcardUserConfig)
 Initializes a Smart card instance for operation. More...
 
void SMARTCARD_DRV_Deinit (uint32_t instance)
 Shuts down the Smart card by disabling interrupts and the transmitter/receiver. More...
 
smartcard_status_t SMARTCARD_DRV_SendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the Smart card module using a blocking method. More...
 
smartcard_status_t SMARTCARD_DRV_SendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the Smart card module using a non-blocking method. More...
 
smartcard_status_t SMARTCARD_DRV_GetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous Smart card transmit has finished. More...
 
smartcard_status_t SMARTCARD_DRV_AbortSendingData (uint32_t instance)
 Terminates an asynchronous Smart card transmission early. More...
 
smartcard_status_t SMARTCARD_DRV_ReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t *rcvdSize, uint32_t timeout)
 Gets (receives) data from the Smart card module using a blocking method. More...
 
smartcard_status_t SMARTCARD_DRV_ReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the Smart card module using a non-blocking method. More...
 
smartcard_status_t SMARTCARD_DRV_GetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous Smart card receive is complete. More...
 
smartcard_status_t SMARTCARD_DRV_AbortReceivingData (uint32_t instance)
 Terminates an asynchronous Smart card receive early. More...
 
smartcard_status_t SMARTCARD_DRV_Control (uint32_t instance, smartcard_control_t control, void *controlBuff)
 Controls the Smart card modules per different user requests. More...
 
smartcard_interface_callback_t SMARTCARD_DRV_InstallInterfaceCallback (uint32_t instance, smartcard_interface_callback_t function, void *callbackParam)
 Installs a user callback function to be called after any interface interrupt is serviced. More...
 
void SMARTCARD_DRV_Reset (uint32_t instance, smartcard_reset_type_t resetType)
 Resets the Smart card interface/card slot for the given reset type. More...
 
void SMARTCARD_DRV_Deactivate (uint32_t instance)
 Deactivates the Smart card interface/card slot. More...
 
void SMARTCARD_DRV_InterfaceControl (uint32_t instance, void *interfaceControl, void *param)
 Reads the status of card presence from the Smart card interface/card slot. More...
 
smartcard_status_t SMARTCARD_DRV_DirectInit (uint32_t interfaceInstance, smartcard_state_t *smartcardStatePtr, const smartcard_interface_config_t *interfaceUserConfig)
 Initializes an SMARTCARD interface instance for operation. More...
 
void SMARTCARD_DRV_DirectDeInit (uint32_t instance)
 De-initializes an SMARTCARD interface instance for operation. More...
 
smartcard_interface_callback_t SMARTCARD_DRV_DirectInstallCallback (uint32_t instance, smartcard_interface_callback_t function, void *callbackParam)
 Installs a callback function for an SMARTCARD interface instance. More...
 
void SMARTCARD_DRV_DirectActivate (uint32_t instance, smartcard_reset_type_t resetType)
 Activates the SMARTCARD interface. More...
 
void SMARTCARD_DRV_DirectDeactivate (uint32_t instance)
 De-activates the SMARTCARD interface. More...
 
void SMARTCARD_DRV_DirectControl (uint32_t instance, void *interfaceControl, void *param)
 Controls SMARTCARD interface IC. More...
 
smartcard_status_t SMARTCARD_DRV_NCN8025Init (uint32_t interfaceInstance, smartcard_state_t *smartcardStatePtr, const smartcard_interface_config_t *interfaceUserConfig)
 Initializes an SMARTCARD interface instance for operation. More...
 
void SMARTCARD_DRV_NCN8025DeInit (uint32_t instance)
 De-initializes an SMARTCARD interface instance for operation. More...
 
smartcard_interface_callback_t SMARTCARD_DRV_NCN8025InstallCallback (uint32_t instance, smartcard_interface_callback_t function, void *callbackParam)
 Installs a callback function for an SMARTCARD interface instance. More...
 
void SMARTCARD_DRV_NCN8025Activate (uint32_t instance, smartcard_reset_type_t resetType)
 Activates the SMARTCARD interface. More...
 
void SMARTCARD_DRV_NCN8025Deactivate (uint32_t instance)
 De-activates the SMARTCARD interface. More...
 
void SMARTCARD_DRV_NCN8025Control (uint32_t instance, void *interfaceControl, void *param)
 Controls SMARTCARD interface IC. More...
 
void SMARTCARD_DRV_NCN8025IRQHandler (uint32_t instance)
 SMARTCARD interface IC IRQ ISR. More...
 

Variables

EMVSIM_Type *const g_emvsimBase [EMVSIM_INSTANCE_COUNT]
 Table of base addresses for EMVSIM instances. More...
 
UART_Type *const g_uartBase [UART_INSTANCE_COUNT]
 Table of base addresses for UART instances. More...
 

Smart card Interrupt Driver

smartcard_status_t SMARTCARD_EMVSIM_DRV_Init (uint32_t instance, smartcard_state_t *smartcardStatePtr, const smartcard_user_config_t *smartcardUserConfig)
 Initializes an EMVSIM instance for Smart card/EMV operation. More...
 
void SMARTCARD_EMVSIM_DRV_Deinit (uint32_t instance)
 This function disables the EMVSIM interrupts, disables the transmitter and receiver, and flushes the FIFOs (for modules that support FIFOs). More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_SendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the EMVSIM module using a blocking method. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_SendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the EMVSIM module using a non-blocking method. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_GetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous EMVSIM transmit has finished. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_AbortSendingData (uint32_t instance)
 Terminates an asynchronous EMVSIM transmission early. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_ReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t *rcvdSize, uint32_t timeout)
 Gets (receives) data from the EMVSIM module using a blocking method. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_ReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the EMVSIM module using a non-blocking method. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_GetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous EMVSIM receive is complete. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_AbortReceivingData (uint32_t instance)
 Terminates an asynchronous EMVSIM receive early. More...
 
smartcard_status_t SMARTCARD_EMVSIM_DRV_Control (uint32_t instance, smartcard_control_t control, void *controlBuff)
 Controls EMVSIM module as per different user request. More...
 

Smart card Interrupt Driver

smartcard_status_t SMARTCARD_UART_DRV_Init (uint32_t instance, smartcard_state_t *smartcardStatePtr, const smartcard_user_config_t *smartcardUserConfig)
 Initializes an UART instance for Smart card/ISO-7816 operation. More...
 
void SMARTCARD_UART_DRV_Deinit (uint32_t instance)
 This function disables the UART interrupts, the transmitter and receiver, and flushes the FIFOs (for modules that support FIFOs). More...
 
smartcard_status_t SMARTCARD_UART_DRV_SendDataBlocking (uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the UART module using a blocking method. More...
 
smartcard_status_t SMARTCARD_UART_DRV_SendData (uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the UART module using a non-blocking method. More...
 
smartcard_status_t SMARTCARD_UART_DRV_GetTransmitStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous UART transmit has finished. More...
 
smartcard_status_t SMARTCARD_UART_DRV_AbortSendingData (uint32_t instance)
 Terminates an asynchronous UART transmission early. More...
 
smartcard_status_t SMARTCARD_UART_DRV_ReceiveDataBlocking (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t *rcvdSize, uint32_t timeout)
 Gets (receives) data from the UART module using a blocking method. More...
 
smartcard_status_t SMARTCARD_UART_DRV_ReceiveData (uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the UART module using a non-blocking method. More...
 
smartcard_status_t SMARTCARD_UART_DRV_GetReceiveStatus (uint32_t instance, uint32_t *bytesRemaining)
 Returns whether the previous UART receive is complete. More...
 
smartcard_status_t SMARTCARD_UART_DRV_AbortReceivingData (uint32_t instance)
 Terminates an asynchronous UART receive early. More...
 
smartcard_status_t SMARTCARD_UART_DRV_Control (uint32_t instance, smartcard_control_t control, void *controlBuff)
 Controls UART module as per different user request. More...
 

Data Structure Documentation

struct smartcard_card_params_t

Data Fields

smartcard_card_voltage_class_t vcc
 Indicates current voltage class of the operation.
 
bool atrComplete
 Indicates whether the ATR received from the card was complete or not.
 
bool atrValid
 Indicates whether the ATR received from the card was valid or not.
 
uint16_t Fi
 4 bits Fi
 
uint8_t fMax
 Maximum Smart card frequency in MHz.
 
uint8_t WI
 8 bits WI - work wait time integer
 
uint8_t Di
 4 bits DI - baud rate divisor
 
uint8_t BWI
 4 bits BWI - block wait time integer
 
uint8_t CWI
 4 bits CWI - character wait time integer
 
uint8_t BGI
 4 bits BGI - block guard time integer
 
uint8_t GTN
 8 bits GTN - extended guard time integer
 
bool t0Indicated
 Indicates ff T=0 indicated in TD1 byte.
 
bool t1Indicated
 Indicates if T=1 indicated in TD2 byte.
 
uint8_t IFSC
 Indicates IFSC value of the card.
 
uint8_t modeNegotiable
 Indicates if the card acts in a negotiable or specific mode. More...
 
uint8_t currentD
 4 bits DI - current baud rate divisor
 
smartcard_card_convention_t convention
 Card convention, kSmartcardDirectConvention for direct convention, kSmartcardInverseConvention for inverse convention.
 

Field Documentation

uint8_t smartcard_card_params_t::modeNegotiable
struct smartcard_timers_state_t

Data Fields

volatile bool adtExpired
 Indicates whether ADT timer expired.
 
volatile bool wwtExpired
 Indicates whether WWT timer expired.
 
volatile bool cwtExpired
 Indicates whether CWT timer expired.
 
volatile bool bwtExpired
 Indicates whether BWT timer expired.
 
volatile bool initCharTimerExpired
 Indicates whether reception timer for initialization character (TS) after the RST has expired.
 
struct smartcard_ext_timer_config_t

Data Fields

uint32_t tsTimerId
 Numerical identifier of the hardware timer for initial character detection.
 
struct smartcard_interface_config_t

Data Fields

uint32_t interfaceInstance
 Smart card interface IC no w.r.t. More...
 
uint32_t cardSoltNo
 Smart card slot number w.r.t. More...
 
uint32_t sCClock
 Smart card interface clock.
 
uint8_t clockModuleInstance
 Smart card clock module instance number.
 
uint8_t clockModuleChannel
 Smart card clock module channel number.
 
uint8_t controlPort
 Smart card PHY control port instance.
 
uint8_t controlPin
 Smart card PHY control pin instance.
 
uint8_t irqPort
 Smart card PHY Interrupt port instance.
 
uint8_t irqPin
 Smart card PHY Interrupt pin instance.
 
uint8_t resetPort
 Smart card reset port instance.
 
uint8_t resetPin
 Smart card reset pin instance.
 
uint8_t vsel0Port
 Smart card PHY Vsel0 control port instance.
 
uint8_t vsel0Pin
 Smart card PHY Vsel0 control pin instance.
 
uint8_t vsel1Port
 Smart card PHY Vsel1 control port instance.
 
uint8_t vsel1Pin
 Smart card PHY Vsel1 control pin instance.
 

Field Documentation

uint32_t smartcard_interface_config_t::interfaceInstance

the board

uint32_t smartcard_interface_config_t::cardSoltNo

the interface IC

struct smartcard_interface_state_t

Data Fields

void * state
 Smart card interface state pointer.
 
void * slot [HW_SMARTCARD_INTERFACE_SLOT_COUNT]
 Smart card interface card slots state pointers.
 
struct smartcard_state_t

Data Fields

uint8_t txFifoEntryCount
 Number of data word entries in transmit FIFO. More...
 
const uint8_t * txBuff
 The buffer of data being sent. More...
 
uint8_t * rxBuff
 The buffer of received data. More...
 
volatile size_t txSize
 The remaining number of bytes to be transmitted. More...
 
volatile size_t rxSize
 The remaining number of bytes to be received. More...
 
volatile bool isTxBusy
 True if there is an active transmit. More...
 
volatile bool isRxBusy
 True if there is an active receive. More...
 
volatile bool isTxBlocking
 True if transmit is blocking transaction. More...
 
volatile bool isRxBlocking
 True if receive is blocking transaction. More...
 
volatile bool bwtActive
 True if Global Counter 1 is set to wait for min. More...
 
semaphore_t txIrqSync
 Used to wait for ISR to complete its transmit. More...
 
semaphore_t rxIrqSync
 Used to wait for ISR to complete its receive. More...
 
smartcard_interface_callback_t interfaceCallback
 Callback to invoke after interface IC raised interrupt. More...
 
void * interfaceCallbackParam
 Interface callback parameter pointer. More...
 
uint32_t sCClock
 Smart card clock set in Hz.
 
smartcard_transport_type_t tType
 Transfer type.
 
bool useDMA
 Indicates whether to use DMA mode.
 
smartcard_reset_type_t resetType
 Indicates whether a Cold reset or Warm reset was requested. More...
 
smartcard_transfer_state_t transState
 Indicates the current transfer state.
 
uint8_t IFSD
 Indicates IFSD value of the terminal.
 
smartcard_parity_type_t parity
 Indicates current parity even/odd.
 
volatile bool rxtCrossed
 Indicates whether RXT thresholds has been crossed.
 
volatile bool txtCrossed
 Indicates whether TXT thresholds has been crossed.
 
volatile bool wtxRequested
 Indicates whether WTX has been requested or not.
 
volatile bool parityError
 Indicates whether a parity error has been detected.
 
uint8_t statusBytes [2]
 Used to store Status bytes SW1, SW2 of the last executed card command response.
 
smartcard_interface_state_tinterfaceState
 Holds a pointer to the working state of the Interface IC.
 
smartcard_interface_config_t interfaceConfig
 Indicates the card slot number of the interface IC.
 
smartcard_ext_timer_config_t extTimerConfig
 Indicates the id of TS detection and ATR timers.
 
smartcard_timers_state_t timersState
 Indicates the state of different protocol timers used in driver.
 
smartcard_card_params_t cardParams
 Indicates the card parameters (ATR and current)
 

Field Documentation

uint8_t smartcard_state_t::txFifoEntryCount
const uint8_t* smartcard_state_t::txBuff
uint8_t* smartcard_state_t::rxBuff
volatile size_t smartcard_state_t::txSize
volatile size_t smartcard_state_t::rxSize
volatile bool smartcard_state_t::isTxBusy
volatile bool smartcard_state_t::isRxBusy
volatile bool smartcard_state_t::isTxBlocking
volatile bool smartcard_state_t::isRxBlocking
volatile bool smartcard_state_t::bwtActive

time before sending data (BWT)

semaphore_t smartcard_state_t::txIrqSync
semaphore_t smartcard_state_t::rxIrqSync
smartcard_interface_callback_t smartcard_state_t::interfaceCallback
void* smartcard_state_t::interfaceCallbackParam
smartcard_reset_type_t smartcard_state_t::resetType
struct smartcard_user_config_t

Use an instance of this structure with the SMARTCARD_DRV_Init()function. This enables configuration of the most common settings of the UART peripheral with a single function call. Settings include: Smart card clock, Smart card interface configuration: interface instance no, slot no; Smart card operating voltage request: 1.8V, 3.3V, 5V.

Data Fields

uint32_t sCClock
 Smart card Clock set in Hz.
 
smartcard_xfer_mode_t xferMode
 Smart card driver transfer mode.
 
smartcard_interface_config_t interfaceConfig
 Smart card interface configuration.
 
smartcard_ext_timer_config_t extTimerConfig
 Indicates the id of TS detection and ATR timers.
 
smartcard_card_voltage_class_t vcc
 Smart card requested operating voltage.
 
struct smartcard_driver_interface_t

Use an instance of this structure initialized with implementation specific driver functions.

Data Fields

smartcard_status_t(* smartcardDrvInit )(uint32_t instance, smartcard_state_t *smartcardStatePtr, const smartcard_user_config_t *smartcardUserConfig)
 Function pointer to Smart card implementation-specific initialization function.
 
void(* smartcardDrvDeinit )(uint32_t instance)
 Function pointer to Smart card implementation-specific de-initialization function.
 
smartcard_status_t(* smartcardDrvSendDataBlocking )(uint32_t instance, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Function pointer to Smart card implementation-specific function to send data bytes in a blocking operation.
 
smartcard_status_t(* smartcardDrvSendData )(uint32_t instance, const uint8_t *txBuff, uint32_t txSize)
 Function pointer to Smart card implementation-specific function to send data bytes in a non-blocking operation.
 
smartcard_status_t(* smartcardDrvGetTransmitStatus )(uint32_t instance, uint32_t *bytesRemaining)
 Function pointer to Smart card implementation-specific function to get transmission status.
 
smartcard_status_t(* smartcardDrvAbortSendingData )(uint32_t instance)
 Function pointer to Smart card implementation-specific function to abort current transmission.
 
smartcard_status_t(* smartcardDrvReceiveDataBlocking )(uint32_t instance, uint8_t *rxBuff, uint32_t rxSize, uint32_t *rcvdSize, uint32_t timeout)
 Function pointer to Smart card implementation-specific function to receive data in blocking operation.
 
smartcard_status_t(* smartcardDrvReceiveData )(uint32_t instance, uint8_t *rxBuff, uint32_t rxSize)
 Function pointer to Smart card implementation-specific function to receive data in non-blocking operation.
 
smartcard_status_t(* smartcardDrvGetReceiveStatus )(uint32_t instance, uint32_t *bytesRemaining)
 Function pointer to Smart card implementation specific function to get status of ongoing reception.
 
smartcard_status_t(* smartcardDrvAbortReceivingData )(uint32_t instance)
 Function pointer to Smart card implementation specific function to abort ongoing reception.
 
smartcard_status_t(* smartcardDrvControl )(uint32_t instance, smartcard_control_t control, void *controlBuff)
 Function pointer to Smart card implementation-specific function to control different protocol parameters, and so on.
 
smartcard_status_t(* smartcardDrvInterfaceInit )(uint32_t interfaceInstance, smartcard_state_t *smartcardStatePtr, const smartcard_interface_config_t *interfaceUserConfig)
 Function pointer to Smart card implementation-specific physical interface initialization function.
 
void(* smartcardDrvInterfaceDeInit )(uint32_t cardSoltNo)
 Function pointer to Smart card implementation-specific physical interface de-initialization function.
 
smartcard_interface_callback_t(* smartcardDrvInstallInterfaceCallback )(uint32_t interfaceInstance, smartcard_interface_callback_t function, void *callbackParam)
 Function pointer to Smart card implementation-specific function to register a callback function to be called after physical interface device ISR is invoked.
 
void(* smartcardDrvInterfaceActivate )(uint32_t interfaceInstance, smartcard_reset_type_t resetType)
 Function pointer to Smart card implementation-specific physical interface activation function.
 
void(* smartcardDrvInterfaceDeactivate )(uint32_t interfaceInstance)
 Function pointer to Smart card implementation-specific physical interface deactivation function.
 
void(* smartcardDrvInterfaceControl )(uint32_t interfaceInstance, void *interfaceControlPtr, void *param)
 Function pointer to Smart card implementation-specific function to read status information.
 
struct smartcard_interface_slot_t

Data Fields

uint32_t clockToResetDelay
 Indicates clock to RST apply delay.
 
smartcard_card_voltage_class_t vcc
 Indicates smart card voltage classes.
 
bool present
 Indicates if a smart card is present.
 
bool active
 Indicates if the smart card is activated.
 
uint8_t status
 Indicates smart card status.
 
bool faulty
 Indicates whether smart card/interface is faulty.
 

Enumeration Type Documentation

Function Documentation

void SMARTCARD_DRV_InstallDriverFunctions ( smartcard_driver_interface_t smartcardDrvInterfacePtr)
Parameters
smartcardDrvInterfacePtrPointer to the Smart card composite driver structure of function pointers
void SMARTCARD_DRV_InstallInterfaceFunctions ( smartcard_driver_interface_t smartcardDrvInterfacePtr)
Parameters
smartcardDrvInterfacePtrPointer to the Smart card composite driver structure of function pointers
smartcard_status_t SMARTCARD_DRV_Init ( uint32_t  instance,
smartcard_state_t smartcardStatePtr,
const smartcard_user_config_t smartcardUserConfig 
)

This function initializes the run-time state structure to keep track of the on-going transfers, un-gates the clock to the Smart card module, initializes the module to user-defined settings and default settings, configures the IRQ state structure, and enables the module-level interrupt to the core, and the Smart card module transmitter and receiver.

Parameters
instanceThe Smart card instance number.
smartcardStatePtrA pointer to the Smart card driver state structure memory. The user is only responsible to pass in the memory for this run-time state structure and the Smart card driver fills out the members. This run-time state structure keeps track of the current transfer in progress.
smartcardUserConfigThe user configuration structure of type smartcard_user_config_t. The user is responsible to fill out the members of this structure and to pass the pointer of this structure into this function.
Returns
An error code or kStatus_SMARTCARD_Success.
void SMARTCARD_DRV_Deinit ( uint32_t  instance)

This function disables the Smart card interrupts, the transmitter and receiver, and flushes the FIFOs (for modules that support FIFOs).

Parameters
instanceThe Smart card instance number.
smartcard_status_t SMARTCARD_DRV_SendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function means that the function does not return until the transmit is complete. This blocking function is used to send data through the Smart card port.

Parameters
instanceThe Smart card instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_DRV_SendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)

A non-blocking (also known as synchronous) function means that the function returns immediately after initiating the transmit function. The application has to get the transmit status to see when the transmit is complete. In other words, after calling non-blocking (asynchronous) send function, the application must get the transmit status to check if transmit is complete. The asynchronous method of transmitting and receiving allows the Smart card to perform a full duplex operation (simultaneously transmit and receive).

Parameters
instanceThe Smart card module instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_DRV_GetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an a-sync transmit, call this function to ascertain the state of the current transmission: in progress (or busy) or complete (success). If the transmission is still in progress, the user can obtain the number of words that have been transferred.

Parameters
instanceThe Smart card module instance number.
bytesRemainingA pointer to a value that is filled in with the number of bytes that are remaining in the active transfer.
Return values
kStatus_SMARTCARD_SuccessThe transmit has completed successfully.
kStatus_SMARTCARD_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
smartcard_status_t SMARTCARD_DRV_AbortSendingData ( uint32_t  instance)

During an a-sync Smart card transmission, the user can terminate the transmission early if the transmission is still in progress.

Parameters
instanceThe Smart card module instance number.
Return values
kStatus_SMARTCARD_SuccessThe transmit was successful.
kStatus_SMARTCARD_NoTransmitInProgressNo transmission is currently in progress.
smartcard_status_t SMARTCARD_DRV_ReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t *  rcvdSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function means that the function does not return until the receive is complete. This blocking function sends data through the UART port.

Parameters
instanceThe Smart card module instance number.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
rcvdSizeThe number of bytes actually received.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_DRV_ReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)

A non-blocking (also known as synchronous) function means that the function returns immediately after initiating the receive function. The application has to get the receive status to see when the receive is complete. In other words, after calling non-blocking (asynchronous) get function, the application must get the receive status to check if receive is completed or not. The asynchronous method of transmitting and receiving allows the UART to perform a full duplex operation (simultaneously transmit and receive).

Parameters
instanceThe Smart card module instance number.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_DRV_GetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an a-sync receive, the user can call this function to ascertain the state of the current receive progress: in progress (or busy) or complete (success). In addition, if the receive is still in progress, the user can obtain the number of words that have been currently received.

Parameters
instanceThe Smart card module instance number.
bytesRemainingA pointer to a value that is filled in with the number of bytes which still need to be received in the active transfer.
Return values
kStatus_SMARTCARD_SuccessThe receive has completed successfully.
kStatus_SMARTCARD_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
smartcard_status_t SMARTCARD_DRV_AbortReceivingData ( uint32_t  instance)

During an a-sync UART receive, the user can terminate the receive early if the receive is still in progress.

Parameters
instanceThe Smart card module instance number.
Return values
kStatus_SMARTCARD_SuccessAborting the receive process was successful.
kStatus_SMARTCARD_NoTransmitInProgressNo receive is currently in progress.
smartcard_status_t SMARTCARD_DRV_Control ( uint32_t  instance,
smartcard_control_t  control,
void *  controlBuff 
)
Parameters
instanceThe Smart card module instance number.
controlcontrol parameter. controlBuff A buffer pointer to be used along with control parameter
Return values
Anerror code as per operation execution.
smartcard_interface_callback_t SMARTCARD_DRV_InstallInterfaceCallback ( uint32_t  instance,
smartcard_interface_callback_t  function,
void *  callbackParam 
)
Parameters
instanceThe Smart card module instance number.
functionPointer to interface callback function.
callbackParamPointer to interface callback function parameter.
Return values
Functionpointer of the last installed callback function.
void SMARTCARD_DRV_Reset ( uint32_t  instance,
smartcard_reset_type_t  resetType 
)
Parameters
instanceThe Smart card module instance number.
resetTypetype of reset to be performed, possible values = kSmartcardColdReset, kSmartcardWarmReset
void SMARTCARD_DRV_Deactivate ( uint32_t  instance)
Parameters
instanceThe Smart card module instance number.
void SMARTCARD_DRV_InterfaceControl ( uint32_t  instance,
void *  interfaceControl,
void *  param 
)
Parameters
instanceThe Smart card module instance number.
interfaceControlinterface control type
paraminterface control parameter if any
smartcard_status_t SMARTCARD_EMVSIM_DRV_Init ( uint32_t  instance,
smartcard_state_t smartcardStatePtr,
const smartcard_user_config_t smartcardUserConfig 
)

This function initializes the run-time state structure to keep track of the on-going transfers, un-gates the clock to the Smart card module, initializes the module to user-defined settings and default settings, configures the IRQ state structure, and enables the module-level interrupt to the core, initializes the DMA, and enables the Smart card module transmitter and receiver.

Parameters
instanceThe EMVSIM instance number.
smartcardStatePtrA pointer to the Smart card driver state structure memory. The user is only responsible to pass in the memory for this run-time state structure and the Smart card driver fills out the members. This run-time state structure keeps track of the current transfer in progress.
smartcardUserConfigThe user configuration structure of type smartcard_user_config_t. The user is responsible to fill out the members of this structure and to pass the pointer of this structure into this function.
Returns
An error code or kStatus_SMARTCARD_Success.
void SMARTCARD_EMVSIM_DRV_Deinit ( uint32_t  instance)
Parameters
instanceThe EMVSIM instance number.
smartcard_status_t SMARTCARD_EMVSIM_DRV_SendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function means that the function does not return until the transmit is complete. This blocking function is used to send data through the EMVSIM port.

Parameters
instanceThe EMVSIM instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_EMVSIM_DRV_SendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)

A non-blocking (also known as asynchronous) function means that the function returns immediately after initiating the transmit function. The application has to get the transmit status to see when the transmit is complete. In other words, after calling non-blocking (asynchronous) send function, the application must get the transmit status to check if transmit is complete.

Parameters
instanceThe EMVSIM module instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_EMVSIM_DRV_GetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an async transmit, call this function to ascertain the state of the current transmission: in progress (or busy) or complete (success). If the transmission is still in progress, the user can obtain the number of words that have been transferred.

Parameters
instanceThe EMVSIM module instance number.
bytesRemainingA pointer to a value that is filled in with the number of bytes that are remaining in the active transfer.
Return values
kStatus_SMARTCARD_SuccessThe transmit has completed successfully.
kStatus_SMARTCARD_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
smartcard_status_t SMARTCARD_EMVSIM_DRV_AbortSendingData ( uint32_t  instance)

During an async EMVSIM transmission, the user can terminate the transmission early if the transmission is still in progress.

Parameters
instanceThe EMVSIM module instance number.
Return values
kStatus_SMARTCARD_SuccessThe transmit abort was successful.
kStatus_SMARTCARD_NoTransmitInProgressNo transmission is currently in progress.
smartcard_status_t SMARTCARD_EMVSIM_DRV_ReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t *  rcvdSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function means that the function does not return until the reception is complete. This blocking function receives data through the EMVSIM port.

Parameters
instanceThe EMVSIM module instance number.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
rcvdSizeThe number of bytes actually received.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_EMVSIM_DRV_ReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)

A non-blocking (also known as asynchronous) function means that the function returns immediately after initiating the receive function. The application has to get the receive status to see when the receive is complete. In other words, after calling non-blocking (asynchronous) get function, the application must get the receive status to check if receive is completed or not.

Parameters
instanceThe EMVSIM module instance number.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_EMVSIM_DRV_GetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an a-sync receive, the user can call this function to ascertain the state of the current receive progress: in progress (or busy) or complete (success). In addition, if the reception is still in progress, the user can obtain the number of words that have been currently received.

Parameters
instanceThe EMVSIM module instance number.
bytesRemainingA pointer to a value that is filled in with the number of bytes which still need to be received in the active transfer.
Return values
kStatus_SMARTCARD_SuccessThe receive has completed successfully.
kStatus_SMARTCARD_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
smartcard_status_t SMARTCARD_EMVSIM_DRV_AbortReceivingData ( uint32_t  instance)

During an a-sync EMVSIM receive, the user can terminate the receive early if the receive is still in progress.

Parameters
instanceThe EMVSIM module instance number.
Return values
kStatus_SMARTCARD_SuccessThe abort in reception was successful.
kStatus_SMARTCARD_NoReceiveInProgressNo receive is currently in progress.
smartcard_status_t SMARTCARD_EMVSIM_DRV_Control ( uint32_t  instance,
smartcard_control_t  control,
void *  controlBuff 
)
Parameters
instanceThe EMVSIM module instance number.
controlControl type
controlBuffA pointer to parameter specific to control type
Return values
kStatus_SMARTCARD_SuccessThe control operation was successful.
smartcard_status_t SMARTCARD_UART_DRV_Init ( uint32_t  instance,
smartcard_state_t smartcardStatePtr,
const smartcard_user_config_t smartcardUserConfig 
)

This function initializes the run-time state structure to keep track of the on-going transfers, un-gates the clock to the Smart card module, initializes the module to user-defined settings and default settings, configures the IRQ state structure, and enables the module-level interrupt to the core, initializes the DMA, and enables the Smart card module transmitter and receiver.

Parameters
instanceThe UART instance number.
smartcardStatePtrA pointer to the Smart card driver state structure memory. The user is only responsible to pass in the memory for this run-time state structure and the Smart card driver fills out the members. This run-time state structure keeps track of the current transfer in progress.
smartcardUserConfigThe user configuration structure of type smartcard_user_config_t. The user is responsible to fill out the members of this structure and to pass the pointer of this structure into this function.
Returns
An error code or kStatus_SMARTCARD_Success.
void SMARTCARD_UART_DRV_Deinit ( uint32_t  instance)
Parameters
instanceThe UART instance number.
smartcard_status_t SMARTCARD_UART_DRV_SendDataBlocking ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function means that the function does not return until the transmit is complete. This blocking function is used to send data through the UART port.

Parameters
instanceThe UART instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_UART_DRV_SendData ( uint32_t  instance,
const uint8_t *  txBuff,
uint32_t  txSize 
)

A non-blocking (also known as synchronous) function means that the function returns immediately after initiating the transmit function. The application has to get the transmit status to see when the transmit is complete. In other words, after calling non-blocking (asynchronous) send function, the application must get the transmit status to check if transmit is complete.

Parameters
instanceThe UART module instance number.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_UART_DRV_GetTransmitStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an a-sync transmit, call this function to ascertain the state of the current transmission: in progress (or busy) or complete (success). If the transmission is still in progress, the user can obtain the number of words that have been transferred.

Parameters
instanceThe UART module instance number.
bytesRemainingA pointer to a value that is filled in with the number of bytes that are remaining in the active transfer.
Return values
kStatus_UART_SuccessThe transmit has completed successfully.
kStatus_SMARTCARD_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
smartcard_status_t SMARTCARD_UART_DRV_AbortSendingData ( uint32_t  instance)

During an a-sync UART transmission, the user can terminate the transmission early if the transmission is still in progress.

Parameters
instanceThe UART module instance number.
Return values
kStatus_SMARTCARD_SuccessThe transmit was successful.
kStatus_SMARTCARD_NoTransmitInProgressNo transmission is currently in progress.
smartcard_status_t SMARTCARD_UART_DRV_ReceiveDataBlocking ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t *  rcvdSize,
uint32_t  timeout 
)

A blocking (also known as synchronous) function means that the function does not return until the receive is complete. This blocking function receives data through the UART port.

Parameters
instanceThe UART module instance number.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
rcvdSizeThe number of bytes actually received.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_UART_DRV_ReceiveData ( uint32_t  instance,
uint8_t *  rxBuff,
uint32_t  rxSize 
)

A non-blocking (also known as synchronous) function means that the function returns immediately after initiating the receive function. The application has to get the receive status to see when the receive is complete. In other words, after calling non-blocking (asynchronous) get function, the application must get the receive status to check if receive is completed or not.

Parameters
instanceThe UART module instance number.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_SMARTCARD_Success.
smartcard_status_t SMARTCARD_UART_DRV_GetReceiveStatus ( uint32_t  instance,
uint32_t *  bytesRemaining 
)

When performing an a-sync receive, the user can call this function to ascertain the state of the current receive progress: in progress (or busy) or complete (success). In addition, if the receive is still in progress, the user can obtain the number of words that have been currently received.

Parameters
instanceThe UART module instance number.
bytesRemainingA pointer to a value that is filled in with the number of bytes which still need to be received in the active transfer.
Return values
kStatus_SMARTCARD_SuccessThe receive has completed successfully.
kStatus_SMARTCARD_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
smartcard_status_t SMARTCARD_UART_DRV_AbortReceivingData ( uint32_t  instance)

During an a-sync UART receive, the user can terminate the receive early if the receive is still in progress.

Parameters
instanceThe UART module instance number.
Return values
kStatus_SMARTCARD_SuccessThe receive was successful.
kStatus_SMARTCARD_NoReceiveInProgressNo receive is currently in progress.
smartcard_status_t SMARTCARD_UART_DRV_Control ( uint32_t  instance,
smartcard_control_t  control,
void *  controlBuff 
)
Parameters
instanceThe UART module instance number.
controlcontrol type
controlBuffA pointer to parameter specific to control type
Return values
kStatus_SMARTCARD_SuccessThe control operation was successful.
smartcard_status_t SMARTCARD_DRV_DirectInit ( uint32_t  interfaceInstance,
smartcard_state_t smartcardStatePtr,
const smartcard_interface_config_t interfaceUserConfig 
)
Parameters
interfaceInstanceThe SMARTCARD interface instance number.
smartcardStatePtrA pointer to the SMARTCARD driver state structure memory. The user is only responsible to pass in the memory for this run-time state structure where the SMARTCARD driver will take care of filling out the members.
interfaceUserConfigThe user configuration structure of type smartcard_interface_config_t. The user is responsible to fill out the members of this structure and to pass the pointer of this structure into this function.
void SMARTCARD_DRV_DirectDeInit ( uint32_t  instance)
Parameters
instancesmart card device instance number
smartcard_interface_callback_t SMARTCARD_DRV_DirectInstallCallback ( uint32_t  instance,
smartcard_interface_callback_t  function,
void *  callbackParam 
)

The installed callback function should be called from the interrupt serive routine context of the interface device.

Parameters
instanceThe SMARTCARD module instance number.
functionPointer to the interface callback function.
callbackParamPointer to the interface callback function parameter.
Return values
Functionpointer of the last installed callback function.
void SMARTCARD_DRV_DirectActivate ( uint32_t  instance,
smartcard_reset_type_t  resetType 
)
Parameters
instanceThe SMARTCARD module instance number.
resetTypetype of reset to be performed, possible values = kSmartcardColdReset, kSmartcardWarmReset
void SMARTCARD_DRV_DirectDeactivate ( uint32_t  instance)
Parameters
instanceThe SMARTCARD module instance number.
slotslot number.
void SMARTCARD_DRV_DirectControl ( uint32_t  instance,
void *  interfaceControl,
void *  param 
)
Parameters
instanceThe SMARTCARD module instance number.
slotcard slot numner.
smartcard_status_t SMARTCARD_DRV_NCN8025Init ( uint32_t  interfaceInstance,
smartcard_state_t smartcardStatePtr,
const smartcard_interface_config_t interfaceUserConfig 
)
Parameters
interfaceInstanceThe SMARTCARD interface instance number.
smartcardStatePtrA pointer to the SMARTCARD driver state structure memory. The user is only responsible to pass in the memory for this run-time state structure where the SMARTCARD driver will take care of filling out the members.
interfaceUserConfigThe user configuration structure of type smartcard_interface_config_t. The user is responsible to fill out the members of this structure and to pass the pointer of this structure into this function.
void SMARTCARD_DRV_NCN8025DeInit ( uint32_t  instance)
Parameters
instancesmart card device instance number
smartcard_interface_callback_t SMARTCARD_DRV_NCN8025InstallCallback ( uint32_t  instance,
smartcard_interface_callback_t  function,
void *  callbackParam 
)

The installed callback function should be called from the interrupt serive routine context of the interface device.

Parameters
instanceThe SMARTCARD module instance number.
functionPointer to the interface callback function.
callbackParamPointer to the interface callback function parameter.
Return values
Functionpointer of the last installed callback function.
void SMARTCARD_DRV_NCN8025Activate ( uint32_t  instance,
smartcard_reset_type_t  resetType 
)
Parameters
instanceThe SMARTCARD module instance number.
resetTypetype of reset to be performed, possible values = kSmartcardColdReset, kSmartcardWarmReset
void SMARTCARD_DRV_NCN8025Deactivate ( uint32_t  instance)
Parameters
instanceThe SMARTCARD module instance number.
slotslot number.
void SMARTCARD_DRV_NCN8025Control ( uint32_t  instance,
void *  interfaceControl,
void *  param 
)
Parameters
instanceThe SMARTCARD module instance number.
slotcard slot numner.
void SMARTCARD_DRV_NCN8025IRQHandler ( uint32_t  instance)
Parameters
instanceThe SMARTCARD module instance number.

Variable Documentation

EMVSIM_Type* const g_emvsimBase[EMVSIM_INSTANCE_COUNT]
UART_Type* const g_uartBase[UART_INSTANCE_COUNT]