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 |
Referenced by main().
|
static |
Configure UART for debug message output.
References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
Initializes the DBGU and ISO7816 driver, and starts some tests.
References board_init(), configure_console(), iso7816_data_block_atr(), iso7816_decode_atr(), iso7816_init(), iso7816_warm_reset(), MAX_ATR_SIZE, send_receive_cmd(), STRING_HEADER, sysclk_enable_peripheral_clock(), sysclk_get_peripheral_hz(), and sysclk_init().
|
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 |
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().