#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "compiler.h"
Go to the source code of this file.
Defines | |
#define | CHIPCARD_ACTIVE 0x0 |
Chip card is present in the slot, powered and clocked. | |
#define | CHIPCARD_PRESENT 0x1 |
Chip card is present in the slot but not powered or clocked. | |
#define | CHIPCARD_NOT_PRESENT 0x2 |
Chip card is not present in the slot. | |
#define | CHIPCARD_CLOCK_ERR 0x0 |
There was an error while retrieving clock status. | |
#define | CHIPCARD_CLOCK_START 0x1 |
Clock is started. | |
#define | CHIPCARD_CLOCK_STOP_L 0x2 |
Clock signal is stopped low. | |
#define | CHIPCARD_CLOCK_STOP_H 0x3 |
Clock is stopped high. | |
#define | CHIPCARD_CLOCK_STOP 0x4 |
Clock is stopped in unknown state. | |
#define | CHIPCARD_AUTO_VOLTAGE 0x0 |
Automatically select chip card voltage. | |
#define | CHIPCARD_5V 0x1 |
5 Volts. | |
#define | CHIPCARD_3V 0x2 |
3 Volts. | |
#define | CHIPCARD_1_8V 0x3 |
1.8 Volts. | |
Typedefs | |
typedef struct _cci * | cci_t |
Chip Card Interface Device. | |
typedef struct _chipcard * | chipcard_t |
Chip Card. | |
typedef struct _xfr * | xfr_t |
Transaction Buffer. | |
typedef struct libusb_device * | ccidev_t |
Physical Chip Card Interface Device. | |
Functions | |
_public ccidev_t * | ccid_get_device_list (size_t *nmemb) |
Find first physical CCI device on the system. | |
_public void | ccid_free_device_list (ccidev_t *list) |
_public ccidev_t | ccid_device (uint8_t bus, uint8_t addr) |
_public uint8_t | ccid_device_bus (ccidev_t dev) |
_public uint8_t | ccid_device_addr (ccidev_t dev) |
_public cci_t | cci_probe (ccidev_t dev, const char *tracefile) |
Connect to a physical chipcard device. | |
_public unsigned int | cci_slots (cci_t cci) |
Retrieve the number of slots in the CCID. | |
_public chipcard_t | cci_get_slot (cci_t cci, unsigned int i) |
Retrieve a handle to a CCID slot. | |
_public void | cci_close (cci_t cci) |
Close connection to a chip card device. | |
_public void | cci_log (cci_t cci, const char *fmt,...) _printf(2 |
_public void _public xfr_t | xfr_alloc (size_t txbuf, size_t rxbuf) |
Allocate a transaction buffer. | |
_public void | xfr_reset (xfr_t xfr) |
Reset a transaction buffer buffer. | |
_public int | xfr_tx_byte (xfr_t xfr, uint8_t byte) |
Append a byte of data to the transmit buffer. | |
_public int | xfr_tx_buf (xfr_t xfr, const uint8_t *ptr, size_t len) |
Append a string of bytes to the transmit buffer. | |
_public uint8_t | xfr_rx_sw1 (xfr_t xfr) |
Retrieve status word 1 from the receive buffer. | |
_public uint8_t | xfr_rx_sw2 (xfr_t xfr) |
Retrieve status word 2 from the receive buffer. | |
_public const uint8_t * | xfr_rx_data (xfr_t xfr, size_t *len) |
Retrieve data portion of the receive buffer. | |
_public void | xfr_free (xfr_t xfr) |
Free a transaction buffer. | |
_public cci_t | chipcard_cci (chipcard_t cc) |
Return pointer to CCID to which a chip card slot belongs. | |
_public int | chipcard_wait_for_card (chipcard_t cc) |
Wait for insertion of a chip card in to the slot. | |
_public unsigned int | chipcard_status (chipcard_t cc) |
Retrieve cached chip card status. | |
_public unsigned int | chipcard_slot_status (chipcard_t cc) |
Retrieve chip card status. | |
_public const uint8_t * | chipcard_slot_on (chipcard_t cc, unsigned int voltage, size_t *atr_len) |
Power on a chip card slot. | |
_public int | chipcard_slot_off (chipcard_t cc) |
Power off a chip card slot. | |
_public int | chipcard_transact (chipcard_t cc, xfr_t xfr) |
Perform a chip card transaction. | |
_public void | hex_dump (const uint8_t *ptr, size_t len, size_t llen) |
_public void | hex_dumpf (FILE *f, const uint8_t *ptr, size_t len, size_t llen) |
_public void | ber_dump (const uint8_t *ptr, size_t len, unsigned int depth) |
_public void ber_dump | ( | const uint8_t * | ptr, | |
size_t | len, | |||
unsigned int | depth | |||
) |
Definition at line 70 of file ber.c.
References ber_dump(), ber_id_octet_constructed(), ber_id_octet_tag(), ber_len_form_short(), ber_len_short(), and hex_dump().
Referenced by ber_dump(), and cp_ber_dump().
_public void cci_log | ( | cci_t | cci, | |
const char * | fmt, | |||
... | ||||
) |
_public ccidev_t ccid_device | ( | uint8_t | bus, | |
uint8_t | addr | |||
) |
Definition at line 343 of file ccidev.c.
References _probe_descriptors(), ctx, and do_init().
Referenced by cp_dev_init().
_public uint8_t ccid_device_addr | ( | ccidev_t | dev | ) |
Definition at line 377 of file ccidev.c.
Referenced by cp_dev_addr().
_public uint8_t ccid_device_bus | ( | ccidev_t | dev | ) |
Definition at line 372 of file ccidev.c.
Referenced by cp_dev_bus().
_public void ccid_free_device_list | ( | ccidev_t * | list | ) |
Definition at line 333 of file ccidev.c.
Referenced by cp_devlist_dealloc(), and main().
_public void hex_dump | ( | const uint8_t * | ptr, | |
size_t | len, | |||
size_t | llen | |||
) |
Definition at line 52 of file util.c.
References _hex_dumpf().
_public void hex_dumpf | ( | FILE * | f, | |
const uint8_t * | ptr, | |||
size_t | len, | |||
size_t | llen | |||
) |
Definition at line 47 of file util.c.
References _hex_dumpf().