RTEMS 6.1-rc1
Data Structures | Enumerator | Variables
Smartcard

Data Structures

struct  _smartcard_card_params
 Defines card-specific parameters for Smart card driver. More...
 
struct  _smartcard_timers_state
 Smart card defines the state of the EMV timers in the Smart card driver. More...
 
struct  _smartcard_interface_config
 Defines user specified configuration of Smart card interface. More...
 
struct  _smartcard_xfer
 Defines user transfer structure used to initialize transfer. More...
 
struct  _smartcard_context
 Runtime state of the Smart card driver. More...
 

Variables

uint16_t _smartcard_card_params::Fi
 
uint8_t _smartcard_card_params::fMax
 
uint8_t _smartcard_card_params::WI
 
uint8_t _smartcard_card_params::Di
 
uint8_t _smartcard_card_params::BWI
 
uint8_t _smartcard_card_params::CWI
 
uint8_t _smartcard_card_params::BGI
 
uint8_t _smartcard_card_params::GTN
 
uint8_t _smartcard_card_params::IFSC
 
uint8_t _smartcard_card_params::modeNegotiable
 
uint8_t _smartcard_card_params::currentD
 
uint8_t _smartcard_card_params::status
 
bool _smartcard_card_params::t0Indicated
 
bool _smartcard_card_params::t1Indicated
 
bool _smartcard_card_params::atrComplete
 
bool _smartcard_card_params::atrValid
 
bool _smartcard_card_params::present
 
bool _smartcard_card_params::active
 
bool _smartcard_card_params::faulty
 
smartcard_card_convention_t _smartcard_card_params::convention
 
volatile bool _smartcard_timers_state::adtExpired
 
volatile bool _smartcard_timers_state::wwtExpired
 
volatile bool _smartcard_timers_state::cwtExpired
 
volatile bool _smartcard_timers_state::bwtExpired
 
volatile bool _smartcard_timers_state::initCharTimerExpired
 
uint32_t _smartcard_interface_config::smartCardClock
 
uint32_t _smartcard_interface_config::clockToResetDelay
 
uint8_t _smartcard_interface_config::clockModule
 
uint8_t _smartcard_interface_config::clockModuleChannel
 
uint8_t _smartcard_interface_config::clockModuleSourceClock
 
smartcard_card_voltage_class_t _smartcard_interface_config::vcc
 
uint8_t _smartcard_interface_config::controlPort
 
uint8_t _smartcard_interface_config::controlPin
 
uint8_t _smartcard_interface_config::irqPort
 
uint8_t _smartcard_interface_config::irqPin
 
uint8_t _smartcard_interface_config::resetPort
 
uint8_t _smartcard_interface_config::resetPin
 
uint8_t _smartcard_interface_config::vsel0Port
 
uint8_t _smartcard_interface_config::vsel0Pin
 
uint8_t _smartcard_interface_config::vsel1Port
 
uint8_t _smartcard_interface_config::vsel1Pin
 
uint8_t _smartcard_interface_config::dataPort
 
uint8_t _smartcard_interface_config::dataPin
 
uint8_t _smartcard_interface_config::dataPinMux
 
uint8_t _smartcard_interface_config::tsTimerId
 
smartcard_direction_t _smartcard_xfer::direction
 
uint8_t * _smartcard_xfer::buff
 
size_t _smartcard_xfer::size
 
void * _smartcard_context::base
 
smartcard_direction_t _smartcard_context::direction
 
uint8_t * _smartcard_context::xBuff
 
volatile size_t _smartcard_context::xSize
 
volatile bool _smartcard_context::xIsBusy
 
uint8_t _smartcard_context::txFifoEntryCount
 
uint8_t _smartcard_context::rxFifoThreshold
 
smartcard_interface_callback_t _smartcard_context::interfaceCallback
 
smartcard_transfer_callback_t _smartcard_context::transferCallback
 
void * _smartcard_context::interfaceCallbackParam
 
void * _smartcard_context::transferCallbackParam
 
smartcard_time_delay_t _smartcard_context::timeDelay
 
smartcard_reset_type_t _smartcard_context::resetType
 
smartcard_transport_type_t _smartcard_context::tType
 
volatile smartcard_transfer_state_t _smartcard_context::transferState
 
smartcard_timers_state_t _smartcard_context::timersState
 
smartcard_card_params_t _smartcard_context::cardParams
 
uint8_t _smartcard_context::IFSD
 
smartcard_parity_type_t _smartcard_context::parity
 
volatile bool _smartcard_context::rxtCrossed
 
volatile bool _smartcard_context::txtCrossed
 
volatile bool _smartcard_context::wtxRequested
 
volatile bool _smartcard_context::parityError
 
uint8_t _smartcard_context::statusBytes [2]
 
smartcard_interface_config_t _smartcard_context::interfaceConfig
 
bool _smartcard_context::abortTransfer
 

Driver version

enum  {
  kStatus_SMARTCARD_Success = MAKE_STATUS(kStatusGroup_SMARTCARD, 0) , kStatus_SMARTCARD_TxBusy = MAKE_STATUS(kStatusGroup_SMARTCARD, 1) , kStatus_SMARTCARD_RxBusy = MAKE_STATUS(kStatusGroup_SMARTCARD, 2) , kStatus_SMARTCARD_NoTransferInProgress = MAKE_STATUS(kStatusGroup_SMARTCARD, 3) ,
  kStatus_SMARTCARD_Timeout = MAKE_STATUS(kStatusGroup_SMARTCARD, 4) , kStatus_SMARTCARD_Initialized , kStatus_SMARTCARD_PhyInitialized , kStatus_SMARTCARD_CardNotActivated = MAKE_STATUS(kStatusGroup_SMARTCARD, 7) ,
  kStatus_SMARTCARD_InvalidInput , kStatus_SMARTCARD_OtherError = MAKE_STATUS(kStatusGroup_SMARTCARD, 9)
}
 Smart card Error codes. More...
 
enum  _smartcard_control {
  kSMARTCARD_EnableADT = 0x0u , kSMARTCARD_DisableADT = 0x1u , kSMARTCARD_EnableGTV = 0x2u , kSMARTCARD_DisableGTV = 0x3u ,
  kSMARTCARD_ResetWWT = 0x4u , kSMARTCARD_EnableWWT = 0x5u , kSMARTCARD_DisableWWT = 0x6u , kSMARTCARD_ResetCWT = 0x7u ,
  kSMARTCARD_EnableCWT = 0x8u , kSMARTCARD_DisableCWT = 0x9u , kSMARTCARD_ResetBWT = 0xAu , kSMARTCARD_EnableBWT = 0xBu ,
  kSMARTCARD_DisableBWT = 0xCu , kSMARTCARD_EnableInitDetect = 0xDu , kSMARTCARD_EnableAnack = 0xEu , kSMARTCARD_DisableAnack = 0xFu ,
  kSMARTCARD_ConfigureBaudrate = 0x10u , kSMARTCARD_SetupATRMode = 0x11u , kSMARTCARD_SetupT0Mode = 0x12u , kSMARTCARD_SetupT1Mode = 0x13u ,
  kSMARTCARD_EnableReceiverMode = 0x14u , kSMARTCARD_DisableReceiverMode = 0x15u , kSMARTCARD_EnableTransmitterMode = 0x16u , kSMARTCARD_DisableTransmitterMode = 0x17u ,
  kSMARTCARD_ResetWaitTimeMultiplier = 0x18u
}
 Control codes for the Smart card protocol timers and misc.
 
enum  _smartcard_card_voltage_class { kSMARTCARD_VoltageClassUnknown = 0x0u , kSMARTCARD_VoltageClassA5_0V = 0x1u , kSMARTCARD_VoltageClassB3_3V = 0x2u , kSMARTCARD_VoltageClassC1_8V = 0x3u }
 Defines Smart card interface voltage class values.
 
enum  _smartcard_transfer_state {
  kSMARTCARD_IdleState = 0x0u , kSMARTCARD_WaitingForTSState = 0x1u , kSMARTCARD_InvalidTSDetecetedState = 0x2u , kSMARTCARD_ReceivingState = 0x3u ,
  kSMARTCARD_TransmittingState = 0x4u
}
 Defines Smart card I/O transfer states.
 
enum  _smartcard_reset_type { kSMARTCARD_ColdReset = 0x0u , kSMARTCARD_WarmReset = 0x1u , kSMARTCARD_NoColdReset = 0x2u , kSMARTCARD_NoWarmReset = 0x3u }
 Defines Smart card reset types.
 
enum  _smartcard_transport_type { kSMARTCARD_T0Transport = 0x0u , kSMARTCARD_T1Transport = 0x1u }
 Defines Smart card transport protocol types.
 
enum  _smartcard_parity_type { kSMARTCARD_EvenParity = 0x0u , kSMARTCARD_OddParity = 0x1u }
 Defines Smart card data parity types.
 
enum  _smartcard_card_convention { kSMARTCARD_DirectConvention = 0x0u , kSMARTCARD_InverseConvention = 0x1u }
 Defines data Convention format.
 
enum  _smartcard_interface_control { kSMARTCARD_InterfaceSetVcc = 0x00u , kSMARTCARD_InterfaceSetClockToResetDelay = 0x01u , kSMARTCARD_InterfaceReadStatus = 0x02u }
 Defines Smart card interface IC control types.
 
enum  _smartcard_direction { kSMARTCARD_Receive = 0u , kSMARTCARD_Transmit = 1u }
 Defines transfer direction.
 
typedef enum _smartcard_control smartcard_control_t
 Control codes for the Smart card protocol timers and misc.
 
typedef enum _smartcard_card_voltage_class smartcard_card_voltage_class_t
 Defines Smart card interface voltage class values.
 
typedef enum _smartcard_transfer_state smartcard_transfer_state_t
 Defines Smart card I/O transfer states.
 
typedef enum _smartcard_reset_type smartcard_reset_type_t
 Defines Smart card reset types.
 
typedef enum _smartcard_transport_type smartcard_transport_type_t
 Defines Smart card transport protocol types.
 
typedef enum _smartcard_parity_type smartcard_parity_type_t
 Defines Smart card data parity types.
 
typedef enum _smartcard_card_convention smartcard_card_convention_t
 Defines data Convention format.
 
typedef enum _smartcard_interface_control smartcard_interface_control_t
 Defines Smart card interface IC control types.
 
typedef enum _smartcard_direction smartcard_direction_t
 Defines transfer direction.
 
typedef void(* smartcard_interface_callback_t) (void *smartcardContext, void *param)
 Smart card interface interrupt callback function type.
 
typedef void(* smartcard_transfer_callback_t) (void *smartcardContext, void *param)
 Smart card transfer interrupt callback function type.
 
typedef void(* smartcard_time_delay_t) (uint32_t us)
 Time Delay function used to passive waiting using RTOS [us].
 
typedef struct _smartcard_card_params smartcard_card_params_t
 Defines card-specific parameters for Smart card driver.
 
typedef struct _smartcard_timers_state smartcard_timers_state_t
 Smart card defines the state of the EMV timers in the Smart card driver.
 
typedef struct _smartcard_interface_config smartcard_interface_config_t
 Defines user specified configuration of Smart card interface.
 
typedef struct _smartcard_xfer smartcard_xfer_t
 Defines user transfer structure used to initialize transfer.
 
typedef struct _smartcard_context smartcard_context_t
 Runtime state of the Smart card driver.
 
#define FSL_SMARTCARD_DRIVER_VERSION   (MAKE_VERSION(2, 2, 2))
 Smart card driver version 2.2.2.
 
#define SMARTCARD_INIT_DELAY_CLOCK_CYCLES   (42000u)
 Smart card global define which specify number of clock cycles until initial 'TS' character has to be received.
 
#define SMARTCARD_EMV_ATR_DURATION_ETU   (20150u)
 Smart card global define which specify number of clock cycles during which ATR string has to be received.
 
#define SMARTCARD_TS_DIRECT_CONVENTION   (0x3Bu)
 Smart card specification initial TS character definition of direct convention.
 
#define SMARTCARD_TS_INVERSE_CONVENTION   (0x3Fu)
 Smart card specification initial TS character definition of inverse convention.
 

Detailed Description

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Smart card Error codes.

Enumerator
kStatus_SMARTCARD_Success 

Transfer ends successfully

kStatus_SMARTCARD_TxBusy 

Transmit in progress

kStatus_SMARTCARD_RxBusy 

Receiving in progress

kStatus_SMARTCARD_NoTransferInProgress 

No transfer in progress

kStatus_SMARTCARD_Timeout 

Transfer ends with time-out

kStatus_SMARTCARD_Initialized 

Smart card driver is already initialized

kStatus_SMARTCARD_PhyInitialized 

Smart card PHY drive is already initialized

kStatus_SMARTCARD_CardNotActivated 

Smart card is not activated

kStatus_SMARTCARD_InvalidInput 

Function called with invalid input arguments

kStatus_SMARTCARD_OtherError 

Some other error occur

Variable Documentation

◆ abortTransfer

bool _smartcard_context::abortTransfer

Used to abort transfer.

◆ active

bool _smartcard_card_params::active

Indicates if the smart card is activated

◆ adtExpired

volatile bool _smartcard_timers_state::adtExpired

Indicates whether ADT timer expired

◆ atrComplete

bool _smartcard_card_params::atrComplete

Indicates whether the ATR received from the card was complete or not

◆ atrValid

bool _smartcard_card_params::atrValid

Indicates whether the ATR received from the card was valid or not

◆ base

void* _smartcard_context::base

Smart card module base address

◆ BGI

uint8_t _smartcard_card_params::BGI

4 bits BGI - block guard time integer

◆ buff

uint8_t* _smartcard_xfer::buff

The buffer of data.

◆ BWI

uint8_t _smartcard_card_params::BWI

4 bits BWI - block wait time integer

◆ bwtExpired

volatile bool _smartcard_timers_state::bwtExpired

Indicates whether BWT timer expired

◆ cardParams

smartcard_card_params_t _smartcard_context::cardParams

Smart card parameters(ATR and current) and interface slots states(ATR and current)

◆ clockModule

uint8_t _smartcard_interface_config::clockModule

Smart card clock module number

◆ clockModuleChannel

uint8_t _smartcard_interface_config::clockModuleChannel

Smart card clock module channel number

◆ clockModuleSourceClock

uint8_t _smartcard_interface_config::clockModuleSourceClock

Smart card clock module source clock [e.g., BusClk]

◆ clockToResetDelay

uint32_t _smartcard_interface_config::clockToResetDelay

Indicates clock to RST apply delay [smart card clock cycles]

◆ controlPin

uint8_t _smartcard_interface_config::controlPin

Smart card PHY control pin instance

◆ controlPort

uint8_t _smartcard_interface_config::controlPort

Smart card PHY control port instance

◆ convention

smartcard_card_convention_t _smartcard_card_params::convention

Card convention, kSMARTCARD_DirectConvention for direct convention, kSMARTCARD_InverseConvention for inverse convention

◆ currentD

uint8_t _smartcard_card_params::currentD

4 bits DI - current baud rate divisor

◆ CWI

uint8_t _smartcard_card_params::CWI

4 bits CWI - character wait time integer

◆ cwtExpired

volatile bool _smartcard_timers_state::cwtExpired

Indicates whether CWT timer expired

◆ dataPin

uint8_t _smartcard_interface_config::dataPin

Smart card PHY data pin instance

◆ dataPinMux

uint8_t _smartcard_interface_config::dataPinMux

Smart card PHY data pin mux option

◆ dataPort

uint8_t _smartcard_interface_config::dataPort

Smart card PHY data port instance

◆ Di

uint8_t _smartcard_card_params::Di

4 bits DI - baud rate divisor

◆ direction [1/2]

smartcard_direction_t _smartcard_xfer::direction

Direction of communication. (RX/TX)

◆ direction [2/2]

smartcard_direction_t _smartcard_context::direction

Direction of communication. (RX/TX)

◆ faulty

bool _smartcard_card_params::faulty

Indicates whether smart card/interface is faulty

◆ Fi

uint16_t _smartcard_card_params::Fi

4 bits Fi - clock rate conversion integer

◆ fMax

uint8_t _smartcard_card_params::fMax

Maximum Smart card frequency in MHz

◆ GTN

uint8_t _smartcard_card_params::GTN

8 bits GTN - extended guard time integer

◆ IFSC

uint8_t _smartcard_card_params::IFSC

Indicates IFSC value of the card

◆ IFSD

uint8_t _smartcard_context::IFSD

Indicates the terminal IFSD

◆ initCharTimerExpired

volatile bool _smartcard_timers_state::initCharTimerExpired

Indicates whether reception timer for initialization character (TS) after the RST has expired

◆ interfaceCallback

smartcard_interface_callback_t _smartcard_context::interfaceCallback

Callback to invoke after interface IC raised interrupt.

◆ interfaceCallbackParam

void* _smartcard_context::interfaceCallbackParam

Interface callback parameter pointer.

◆ interfaceConfig

smartcard_interface_config_t _smartcard_context::interfaceConfig

Smart card interface configuration structure

◆ irqPin

uint8_t _smartcard_interface_config::irqPin

Smart card PHY Interrupt pin instance

◆ irqPort

uint8_t _smartcard_interface_config::irqPort

Smart card PHY Interrupt port instance

◆ modeNegotiable

uint8_t _smartcard_card_params::modeNegotiable

Indicates if the card acts in negotiable or a specific mode.

◆ parity

smartcard_parity_type_t _smartcard_context::parity

Indicates current parity even/odd

◆ parityError

volatile bool _smartcard_context::parityError

Indicates whether a parity error has been detected

◆ present

bool _smartcard_card_params::present

Indicates if a smart card is present

◆ resetPin

uint8_t _smartcard_interface_config::resetPin

Smart card reset pin instance

◆ resetPort

uint8_t _smartcard_interface_config::resetPort

Smart card reset port instance

◆ resetType

smartcard_reset_type_t _smartcard_context::resetType

Indicates whether a Cold reset or Warm reset was requested.

◆ rxFifoThreshold

uint8_t _smartcard_context::rxFifoThreshold

The max value of the receiver FIFO threshold.

◆ rxtCrossed

volatile bool _smartcard_context::rxtCrossed

Indicates whether RXT thresholds has been crossed

◆ size

size_t _smartcard_xfer::size

The number of transferred units.

◆ smartCardClock

uint32_t _smartcard_interface_config::smartCardClock

Smart card interface clock [Hz]

◆ status

uint8_t _smartcard_card_params::status

Indicates smart card status

◆ statusBytes

uint8_t _smartcard_context::statusBytes[2]

Used to store Status bytes SW1, SW2 of the last executed card command response

◆ t0Indicated

bool _smartcard_card_params::t0Indicated

Indicates ff T=0 indicated in TD1 byte

◆ t1Indicated

bool _smartcard_card_params::t1Indicated

Indicates if T=1 indicated in TD2 byte

◆ timeDelay

smartcard_time_delay_t _smartcard_context::timeDelay

Function which handles time delay defined by user or RTOS.

◆ timersState

smartcard_timers_state_t _smartcard_context::timersState

Indicates the state of different protocol timers used in driver

◆ transferCallback

smartcard_transfer_callback_t _smartcard_context::transferCallback

Callback to invoke after transfer event occur.

◆ transferCallbackParam

void* _smartcard_context::transferCallbackParam

Transfer callback parameter pointer.

◆ transferState

volatile smartcard_transfer_state_t _smartcard_context::transferState

Indicates the current transfer state

◆ tsTimerId

uint8_t _smartcard_interface_config::tsTimerId

Numerical identifier of the External HW timer for Initial character detection

◆ tType

smartcard_transport_type_t _smartcard_context::tType

Indicates current transfer protocol (T0 or T1)

◆ txFifoEntryCount

uint8_t _smartcard_context::txFifoEntryCount

Number of data word entries in transmit FIFO.

◆ txtCrossed

volatile bool _smartcard_context::txtCrossed

Indicates whether TXT thresholds has been crossed

◆ vcc

smartcard_card_voltage_class_t _smartcard_interface_config::vcc

Smart card voltage class

◆ vsel0Pin

uint8_t _smartcard_interface_config::vsel0Pin

Smart card PHY Vsel0 control pin instance

◆ vsel0Port

uint8_t _smartcard_interface_config::vsel0Port

Smart card PHY Vsel0 control port instance

◆ vsel1Pin

uint8_t _smartcard_interface_config::vsel1Pin

Smart card PHY Vsel1 control pin instance

◆ vsel1Port

uint8_t _smartcard_interface_config::vsel1Port

Smart card PHY Vsel1 control port instance

◆ WI

uint8_t _smartcard_card_params::WI

8 bits WI - work wait time integer

◆ wtxRequested

volatile bool _smartcard_context::wtxRequested

Indicates whether WTX has been requested or not

◆ wwtExpired

volatile bool _smartcard_timers_state::wwtExpired

Indicates whether WWT timer expired

◆ xBuff

uint8_t* _smartcard_context::xBuff

The buffer of data being transferred.

◆ xIsBusy

volatile bool _smartcard_context::xIsBusy

True if there is an active transfer.

◆ xSize

volatile size_t _smartcard_context::xSize

The number of bytes to be transferred.