| Kinetis SDK v.2.0 API Reference Manual Rev. 0 Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- API Reference

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Functions
Smart Card FreeRTOS Driver
Smart Card

## Overview

## Data Structures
struct | rtos_smartcard_context_t
| Runtime RTOS smart card driver context. More...

## Macros
#define | RTOS_SMARTCARD_COMPLETE 0x1u
| smart card RTOS transfer complete flag
#define | RTOS_SMARTCARD_TIMEOUT 0x2u
| smart card RTOS transfer time-out flag
#define | SMARTCARD_Control(base, context, control, param) SMARTCARD_UART_Control(base, context, control, 0)
| Common smart card driver API defines. More...
#define | SMARTCARD_Transfer(base, context, xfer) SMARTCARD_UART_TransferNonBlocking(base, context, xfer)
| Common smart card API macro.
#define | SMARTCARD_Init(base, context, sourceClockHz) SMARTCARD_UART_Init(base, context, sourceClockHz)
| Common smart card API macro.
#define | SMARTCARD_Deinit(base) SMARTCARD_UART_Deinit(base)
| Common smart card API macro.
#define | SMARTCARD_GetTransferRemainingBytes(base, context) SMARTCARD_UART_GetTransferRemainingBytes(base, context)
| Common smart card API macro.
#define | SMARTCARD_GetDefaultConfig(cardParams) SMARTCARD_UART_GetDefaultConfig(cardParams)
| Common smart card API macro.

## Functions
int | SMARTCARD_RTOS_Init (void *base, rtos_smartcard_context_t *ctx, uint32_t sourceClockHz)
| Initializes a smart card (EMVSIM/UART) peripheral for smart card/ISO-7816 operation. More...
int | SMARTCARD_RTOS_Deinit (rtos_smartcard_context_t *ctx)
| This function disables the smart card (EMVSIM/UART) interrupts, disables the transmitter and receiver, and flushes the FIFOs (for modules that support FIFOs) and gates smart card clock in SIM. More...
int | SMARTCARD_RTOS_Transfer (rtos_smartcard_context_t *ctx, smartcard_xfer_t *xfer)
| Transfers data using interrupts. More...
int | SMARTCARD_RTOS_WaitForXevent (rtos_smartcard_context_t *ctx)
| Waits until the transfer is finished. More...
int | SMARTCARD_RTOS_Control (rtos_smartcard_context_t *ctx, smartcard_control_t control, uint32_t param)
| Controls the smart card module as per different user request. More...
int | SMARTCARD_RTOS_PHY_Control (rtos_smartcard_context_t *ctx, smartcard_interface_control_t control, uint32_t param)
| Controls the smart card module as per different user request. More...
int | SMARTCARD_RTOS_PHY_Activate (rtos_smartcard_context_t *ctx, smartcard_reset_type_t resetType)
| Activates the smart card interface. More...
int | SMARTCARD_RTOS_PHY_Deactivate (rtos_smartcard_context_t *ctx)
| Deactivates the smart card interface. More...

## Data Structure Documentation

struct rtos_smartcard_context_t

Runtime RTOS Smart card driver context.

### Data Fields
SemaphoreHandle_t | x_sem
| RTOS unique access assurance object.
EventGroupHandle_t | x_event
| RTOS synchronization object.
smartcard_context_t | x_context
| transactional layer state More...
OS_EVENT * | x_sem
| RTOS unique access assurance object.
OS_FLAG_GRP * | x_event
| RTOS synchronization object.
OS_SEM | x_sem
| RTOS unique access assurance object.
OS_FLAG_GRP | x_event
| RTOS synchronization object.

#### Field Documentation

smartcard_context_t rtos_smartcard_context_t::x_context

Transactional layer state.

## Macro Definition Documentation

#define SMARTCARD_Control | ( |  | base,
|  |  | context,
|  |  | control,
|  |  | param
| ) |  | SMARTCARD_UART_Control(base, context, control, 0)

Common smart card API macro

## Function Documentation

int SMARTCARD_RTOS_Init | ( | void * | base,
|  | rtos_smartcard_context_t * | ctx,
|  | uint32_t | sourceClockHz
| ) |  |

Also initialize smart card PHY interface .

This function ungates the smart card clock, initializes the module to EMV default settings, configures the IRQ state structure, and enables the module-level interrupt to the core. Initialize RTOS synchronization objects and context.

Parameters

  base | The smart card peripheral base address.
  ctx | The smart card RTOS structure.
  sourceClockHz | smart card clock generation module source clock.

Returns
  An zero in Success or error code.

int SMARTCARD_RTOS_Deinit | ( | rtos_smartcard_context_t * | ctx | ) |

Deactivates also smart card PHY interface, stops smart card clocks. Free all synchronization objects allocated in RTOS smart card context.

Parameters

  ctx | The smart card RTOS state.

Returns
  An zero in Success or error code.

int SMARTCARD_RTOS_Transfer | ( | rtos_smartcard_context_t * | ctx,
|  | smartcard_xfer_t * | xfer
| ) |  |

A blocking (also known as synchronous) function means that the function returns after the transfer is done. User can cancel this transfer by calling function AbortTransfer.

Parameters

  ctx | A pointer to the RTOS smart card driver context.
  xfer | smart card transfer structure.

Returns
  An zero in Success or error code.

int SMARTCARD_RTOS_WaitForXevent | ( | rtos_smartcard_context_t * | ctx | ) |

Task waits on a transfer finish event. Don't initialize the transfer. Instead, wait for transfer callback. Can be used while waiting on initial TS character.

Parameters

  ctx | A pointer to the RTOS smart card driver context.

Returns
  A zero in Success or error code.

int SMARTCARD_RTOS_Control | ( | rtos_smartcard_context_t * | ctx,
|  | smartcard_control_t | control,
|  | uint32_t | param
| ) |  |

Parameters

  ctx | The smart card RTOS context pointer.
  control | Control type
  param | Integer value of specific to control command.

Returns
  An zero in Success or error code.

int SMARTCARD_RTOS_PHY_Control | ( | rtos_smartcard_context_t * | ctx,
|  | smartcard_interface_control_t | control,
|  | uint32_t | param
| ) |  |

Parameters

  ctx | The smart card RTOS context pointer.
  control | Control type
  param | Integer value of specific to control command.

Returns
  An zero in Success or error code.

int SMARTCARD_RTOS_PHY_Activate | ( | rtos_smartcard_context_t * | ctx,
|  | smartcard_reset_type_t | resetType
| ) |  |

Parameters

  ctx | The smart card RTOS driver context structure.
  resetType | type of reset to be performed, possible values = kSmartcardColdReset, kSmartcardWarmReset

Returns
  An zero in Success or error code.

int SMARTCARD_RTOS_PHY_Deactivate | ( | rtos_smartcard_context_t * | ctx | ) |

Parameters

  ctx | The smart card RTOS driver context structure.

Returns
  An zero in Success or error code.