Chip Card

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 _chipcardchipcard_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.

Detailed Description

Represents a slot in a chip card device and chip card (if one is inserted).


Define Documentation

#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 Documentation

typedef struct _chipcard* chipcard_t

Chip Card.

Definition at line 60 of file ccid.h.


Function Documentation

cci_t chipcard_cci ( chipcard_t  cc  ) 

Return pointer to CCID to which a chip card slot belongs.

Parameters:
cc chipcard_t to query.
Returns:
cci_t representing the CCID which contains the slot cc.

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.

Parameters:
cc chipcard_t to power off.
Returns:
zero on failure.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

const uint8_t* chipcard_slot_on ( chipcard_t  cc,
unsigned int  voltage,
size_t *  atr_len 
)

Power on a chip card slot.

Parameters:
cc chipcard_t to power on.
voltage Voltage selector.
atr_len Pointer to size_t to retrieve length of ATR message.
Returns:
NULL for failure, pointer to ATR message otherwise.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int chipcard_slot_status ( chipcard_t  cc  ) 

Retrieve chip card status.

Parameters:
cc chipcard_t to query.

Query CCID for status of clock in relevant chip card slot.

Returns:
one of CHIPCARD_CLOCK_(START|STOP|STOP_L|STOP_H).

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().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int chipcard_status ( chipcard_t  cc  ) 

Retrieve cached chip card status.

Parameters:
cc chipcard_t to query.

Retrieve chip card status as of last transaction. Generates no traffic accross physical bus to CCID.

Returns:
one of CHIPCARD_(ACTIVE|PRESENT|NOT_PRESENT).

Definition at line 23 of file chipcard.c.

References _chipcard::cc_status.

Referenced by cp_chipcard_status(), and emv_init().

Here is the caller graph for this function:

int chipcard_transact ( chipcard_t  cc,
xfr_t  xfr 
)

Perform a chip card transaction.

Parameters:
cc chipcard_t for this transaction.
xfr xfr_t representing the transfer buffer.

Transactions consist of a transmit followed by a recieve.

Returns:
zero on failure.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

int chipcard_wait_for_card ( chipcard_t  cc  ) 

Wait for insertion of a chip card in to the slot.

Parameters:
cc chipcard_t to wait on.
Returns:
Always succeeds and returns 1.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

Generated on Sun Jan 2 08:36:10 2011 for ccid-utils by  doxygen 1.6.3