MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Smart Card UART Driver

Overview

The Smart Card UART driver uses a standard UART peripheral which supports the ISO-7816 standard. The driver supports transmission functionality in the CPU mode. The driver also supports non-blocking (asynchronous) type of data transfers. The blocking (synchronous) transfer is supported only by the RTOS adaptation layer.

Macros

#define SMARTCARD_EMV_RX_NACK_THRESHOLD   (5u)
 EMV RX NACK interrupt generation threshold.
 
#define SMARTCARD_EMV_TX_NACK_THRESHOLD   (4u)
 EMV TX NACK interrupt generation threshold.
 
#define SMARTCARD_EMV_RX_TO_TX_GUARD_TIME_T0   (0x0u)
 EMV TX & RX GUART TIME default value.
 

Functions

void SMARTCARD_UART_GetDefaultConfig (smartcard_card_params_t *cardParams)
 Fills in the smartcard_card_params structure with default values according to the EMV 4.3 specification. More...
 
status_t SMARTCARD_UART_Init (UART_Type *base, smartcard_context_t *context, uint32_t srcClock_Hz)
 Initializes a UART peripheral for the Smart card/ISO-7816 operation. More...
 
void SMARTCARD_UART_Deinit (UART_Type *base)
 This function disables the UART interrupts, disables the transmitter and receiver, and flushes the FIFOs (for modules that support FIFOs) and gates UART clock in SIM. More...
 
int32_t SMARTCARD_UART_GetTransferRemainingBytes (UART_Type *base, smartcard_context_t *context)
 Returns whether the previous UART transfer has finished. More...
 
status_t SMARTCARD_UART_AbortTransfer (UART_Type *base, smartcard_context_t *context)
 Terminates an asynchronous UART transfer early. More...
 
status_t SMARTCARD_UART_TransferNonBlocking (UART_Type *base, smartcard_context_t *context, smartcard_xfer_t *xfer)
 Transfers data using interrupts. More...
 
status_t SMARTCARD_UART_Control (UART_Type *base, smartcard_context_t *context, smartcard_control_t control, uint32_t param)
 Controls the UART module per different user requests. More...
 
void SMARTCARD_UART_IRQHandler (UART_Type *base, smartcard_context_t *context)
 Interrupt handler for UART. More...
 
void SMARTCARD_UART_ErrIRQHandler (UART_Type *base, smartcard_context_t *context)
 Error interrupt handler for UART. More...
 
void SMARTCARD_UART_TSExpiryCallback (UART_Type *base, smartcard_context_t *context)
 Handles initial TS character timer time-out event. More...
 

Function Documentation

void SMARTCARD_UART_GetDefaultConfig ( smartcard_card_params_t cardParams)
Parameters
cardParamsThe configuration structure of type smartcard_interface_config_t. Function fill in members: Fi = 372; Di = 1; currentD = 1; WI = 0x0A; GTN = 0x00; with default values.
status_t SMARTCARD_UART_Init ( UART_Type *  base,
smartcard_context_t context,
uint32_t  srcClock_Hz 
)

This function un-gates the UART clock, initializes the module to EMV default settings, configures the IRQ, enables the module-level interrupt to the core, and initializes the driver context.

Parameters
baseThe UART peripheral base address.
contextA pointer to a smart card driver context structure.
srcClock_HzSmart card clock generation module source clock.
Returns
An error code or kStatus_SMARTCARD_Success.
void SMARTCARD_UART_Deinit ( UART_Type *  base)
Parameters
baseThe UART peripheral base address.
int32_t SMARTCARD_UART_GetTransferRemainingBytes ( UART_Type *  base,
smartcard_context_t context 
)

When performing an async transfer, call this function to ascertain the context of the current transfer: in progress (or busy) or complete (success). If the transfer is still in progress, the user can obtain the number of words that have not been transferred by reading xSize of smart card context structure.

Parameters
baseThe UART peripheral base address.
contextA pointer to a Smart card driver context structure.
Returns
The number of bytes not transferred.
status_t SMARTCARD_UART_AbortTransfer ( UART_Type *  base,
smartcard_context_t context 
)

During an async UART transfer, the user can terminate the transfer early if the transfer is still in progress.

Parameters
baseThe UART peripheral base address.
contextA pointer to a Smart card driver context structure.
Return values
kStatus_SMARTCARD_SuccessThe transfer abort was successful.
kStatus_SMARTCARD_NoTransmitInProgressNo transmission is currently in progress.
status_t SMARTCARD_UART_TransferNonBlocking ( UART_Type *  base,
smartcard_context_t context,
smartcard_xfer_t xfer 
)

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

Parameters
baseThe UART peripheral base address.
contextA pointer to a Smart card driver context structure.
xferA pointer to Smart card transfer structure where the linked buffers and sizes are stored.
Returns
An error code or kStatus_SMARTCARD_Success.
status_t SMARTCARD_UART_Control ( UART_Type *  base,
smartcard_context_t context,
smartcard_control_t  control,
uint32_t  param 
)
Parameters
baseThe UART peripheral base address.
contextA pointer to a smart card driver context structure.
controlSmart card command type.
paramInteger value specific to a control command.

return An kStatus_SMARTCARD_OtherError in case of error return kStatus_SMARTCARD_Success in success

void SMARTCARD_UART_IRQHandler ( UART_Type *  base,
smartcard_context_t context 
)

This handler uses the buffers stored in the smartcard_context_t structures to transfer data. The Smart card driver requires this function to call when the UART interrupt occurs.

Parameters
baseThe UART peripheral base address.
contextA pointer to a Smart card driver context structure.
void SMARTCARD_UART_ErrIRQHandler ( UART_Type *  base,
smartcard_context_t context 
)

This function handles error conditions during a transfer.

Parameters
baseThe UART peripheral base address.
contextA pointer to a Smart card driver context structure.
void SMARTCARD_UART_TSExpiryCallback ( UART_Type *  base,
smartcard_context_t context 
)
Parameters
baseThe UART peripheral base address.
contextA pointer to a Smart card driver context structure.