Microchip® Advanced Software Framework

usart_iso7816_example.c File Reference

USART ISO7816 example for SAM.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include "asf.h"

Macros

#define ISO7816_BAUDRATE   9600
 Define the baudrate of ISO7816 mode. More...
 
#define ISO7816_FI_DI   372
 Define the FI_DI_RATIO filed value. More...
 
#define MAX_ANSWER_SIZE   10
 Maximum uc_size in bytes of the smartcard answer to a uc_command. More...
 
#define MAX_ATR_SIZE   55
 Maximum ATR uc_size in bytes. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 

Functions

static void configure_console (void)
 Configure UART for debug message output. More...
 
int main (void)
 Initializes the DBGU and ISO7816 driver, and starts some tests. More...
 
static void send_receive_cmd (void)
 Displays a menu which enables the user to send several commands to the smartcard and check its answers. More...
 

Variables

const usart_iso7816_opt_t conf_iso7816_t
 
const uint8_t test_cmd1 [] = {0x00, 0x10, 0x00, 0x00}
 Test command #1. More...
 
const uint8_t test_cmd2 [] = {0x00, 0x20, 0x00, 0x00, 0x02}
 Test command #2. More...
 
const uint8_t test_cmd3 [] = {0x00, 0x30, 0x00, 0x00, 0x02, 0x0A, 0x0B}
 Test command #3. More...
 

#define ISO7816_BAUDRATE   9600

Define the baudrate of ISO7816 mode.

#define ISO7816_FI_DI   372

Define the FI_DI_RATIO filed value.

#define MAX_ANSWER_SIZE   10

Maximum uc_size in bytes of the smartcard answer to a uc_command.

Referenced by send_receive_cmd().

#define MAX_ATR_SIZE   55

Maximum ATR uc_size in bytes.

Referenced by main().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- USART ISO7816 Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: inc/app_init.h:140
#define STRING_EOL
Definition: usart_iso7816_example.c:107

Referenced by main().

static void configure_console ( void  )
static
int main ( void  )
static void send_receive_cmd ( void  )
static

Displays a menu which enables the user to send several commands to the smartcard and check its answers.

References iso7816_xfr_block_tpdu_t0(), MAX_ANSWER_SIZE, test_cmd1, test_cmd2, test_cmd3, and uart_read().

Referenced by main().

const usart_iso7816_opt_t conf_iso7816_t
Initial value:
= {
US_MR_PAR_EVEN,
0,
0,
3,
0,
0
}
#define ISO7816_BAUDRATE
Define the baudrate of ISO7816 mode.
Definition: usart_iso7816_example.c:95
#define ISO7816_FI_DI
Define the FI_DI_RATIO filed value.
Definition: usart_iso7816_example.c:98
const uint8_t test_cmd1[] = {0x00, 0x10, 0x00, 0x00}

Test command #1.

Referenced by send_receive_cmd().

const uint8_t test_cmd2[] = {0x00, 0x20, 0x00, 0x00, 0x02}

Test command #2.

Referenced by send_receive_cmd().

const uint8_t test_cmd3[] = {0x00, 0x30, 0x00, 0x00, 0x02, 0x0A, 0x0B}

Test command #3.

Referenced by send_receive_cmd().