Represents a slot in a chip card device and chip card (if one is inserted). More...
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 _chipcard * | chipcard_t |
Chip Card. | |
Functions | |
unsigned int | chipcard_status (chipcard_t cc) |
Retrieve cached chip card status. | |
unsigned int | chipcard_slot_status (chipcard_t cc) |
Retrieve chip card status. | |
const uint8_t * | chipcard_slot_on (chipcard_t cc, unsigned int voltage, size_t *atr_len) |
Power on a chip card slot. | |
int | chipcard_transact (chipcard_t cc, xfr_t xfr) |
Perform a chip card transaction. | |
int | chipcard_slot_off (chipcard_t cc) |
Power off a chip card slot. | |
int | chipcard_wait_for_card (chipcard_t cc) |
Wait for insertion of a chip card in to the slot. | |
cci_t | chipcard_cci (chipcard_t cc) |
Return pointer to CCID to which a chip card slot belongs. |
Represents a slot in a chip card device and chip card (if one is inserted).
#define CHIPCARD_1_8V 0x3 |
1.8 Volts.
Definition at line 151 of file ccid.h.
Referenced by _PC_to_RDR_IccPowerOn(), cp_chipcard_on(), and initccid().
#define CHIPCARD_3V 0x2 |
3 Volts.
Definition at line 147 of file ccid.h.
Referenced by _PC_to_RDR_IccPowerOn(), and initccid().
#define CHIPCARD_5V 0x1 |
5 Volts.
Definition at line 143 of file ccid.h.
Referenced by _PC_to_RDR_IccPowerOn(), and initccid().
#define CHIPCARD_ACTIVE 0x0 |
Chip card is present in the slot, powered and clocked.
Definition at line 103 of file ccid.h.
Referenced by _chipcard_set_status(), emv_init(), and initccid().
#define CHIPCARD_AUTO_VOLTAGE 0x0 |
Automatically select chip card voltage.
Definition at line 139 of file ccid.h.
Referenced by _PC_to_RDR_IccPowerOn(), cp_chipcard_on(), found_cci(), initccid(), and sim_new().
#define CHIPCARD_CLOCK_ERR 0x0 |
There was an error while retrieving clock status.
Definition at line 117 of file ccid.h.
Referenced by _RDR_to_PC_SlotStatus(), chipcard_slot_status(), and cp_chipcard_clock().
#define CHIPCARD_CLOCK_START 0x1 |
Clock is started.
Definition at line 121 of file ccid.h.
Referenced by _RDR_to_PC_SlotStatus(), and initccid().
#define CHIPCARD_CLOCK_STOP 0x4 |
Clock is stopped in unknown state.
Definition at line 133 of file ccid.h.
Referenced by _RDR_to_PC_SlotStatus().
#define CHIPCARD_CLOCK_STOP_H 0x3 |
Clock is stopped high.
Definition at line 129 of file ccid.h.
Referenced by _RDR_to_PC_SlotStatus(), and initccid().
#define CHIPCARD_CLOCK_STOP_L 0x2 |
Clock signal is stopped low.
Definition at line 125 of file ccid.h.
Referenced by _RDR_to_PC_SlotStatus(), and initccid().
#define CHIPCARD_NOT_PRESENT 0x2 |
Chip card is not present in the slot.
Definition at line 111 of file ccid.h.
Referenced by _cci_wait_for_interrupt(), _chipcard_set_status(), chipcard_wait_for_card(), and initccid().
#define CHIPCARD_PRESENT 0x1 |
Chip card is present in the slot but not powered or clocked.
Definition at line 107 of file ccid.h.
Referenced by _cci_wait_for_interrupt(), _chipcard_set_status(), and initccid().
typedef struct _chipcard* chipcard_t |
cci_t chipcard_cci | ( | chipcard_t | cc | ) |
Return pointer to CCID to which a chip card slot belongs.
cc | chipcard_t to query. |
Definition at line 148 of file chipcard.c.
References _chipcard::cc_parent.
int chipcard_slot_off | ( | chipcard_t | cc | ) |
Power off a chip card slot.
cc | chipcard_t to power off. |
Definition at line 107 of file chipcard.c.
References _PC_to_RDR_IccPowerOff(), _RDR_to_PC(), _RDR_to_PC_SlotStatus(), _chipcard::cc_idx, _chipcard::cc_parent, and _cci::cci_xfr.
Referenced by cp_chipcard_off(), found_cci(), and sim_free().
const uint8_t* chipcard_slot_on | ( | chipcard_t | cc, | |
unsigned int | voltage, | |||
size_t * | atr_len | |||
) |
Power on a chip card slot.
cc | chipcard_t to power on. | |
voltage | Voltage selector. | |
atr_len | Pointer to size_t to retrieve length of ATR message. |
Definition at line 59 of file chipcard.c.
References _PC_to_RDR_IccPowerOn(), _RDR_to_PC(), _RDR_to_PC_DataBlock(), _chipcard::cc_idx, _chipcard::cc_parent, _cci::cci_xfr, _xfr::x_rxbuf, and _xfr::x_rxlen.
Referenced by cp_chipcard_on(), found_cci(), and sim_new().
unsigned int chipcard_slot_status | ( | chipcard_t | cc | ) |
Retrieve chip card status.
cc | chipcard_t to query. |
Query CCID for status of clock in relevant chip card slot.
Definition at line 37 of file chipcard.c.
References _PC_to_RDR_GetSlotStatus(), _RDR_to_PC(), _RDR_to_PC_SlotStatus(), _chipcard::cc_idx, _chipcard::cc_parent, _cci::cci_xfr, and CHIPCARD_CLOCK_ERR.
Referenced by cp_chipcard_clock().
unsigned int chipcard_status | ( | chipcard_t | cc | ) |
Retrieve cached chip card status.
cc | chipcard_t to query. |
Retrieve chip card status as of last transaction. Generates no traffic accross physical bus to CCID.
Definition at line 23 of file chipcard.c.
References _chipcard::cc_status.
Referenced by cp_chipcard_status(), and emv_init().
int chipcard_transact | ( | chipcard_t | cc, | |
xfr_t | xfr | |||
) |
Perform a chip card transaction.
cc | chipcard_t for this transaction. | |
xfr | xfr_t representing the transfer buffer. |
Transactions consist of a transmit followed by a recieve.
Definition at line 86 of file chipcard.c.
References _PC_to_RDR_XfrBlock(), _RDR_to_PC(), _RDR_to_PC_DataBlock(), _chipcard::cc_idx, and _chipcard::cc_parent.
Referenced by _apdu_read_binary(), _apdu_read_record(), _emv_generate_ac(), _emv_get_data(), _emv_get_proc_opts(), _emv_int_authenticate(), _emv_read_record(), _emv_verify(), cp_chipcard_transact(), do_get_response(), do_sel(), and do_select().
int chipcard_wait_for_card | ( | chipcard_t | cc | ) |
Wait for insertion of a chip card in to the slot.
cc | chipcard_t to wait on. |
Definition at line 127 of file chipcard.c.
References _cci_wait_for_interrupt(), _PC_to_RDR_GetSlotStatus(), _RDR_to_PC(), _chipcard::cc_idx, _chipcard::cc_parent, _chipcard::cc_status, _cci::cci_xfr, and CHIPCARD_NOT_PRESENT.
Referenced by cp_chipcard_wait(), and found_cci().