src/cci.c File Reference

#include <ccid.h>
#include <stdarg.h>
#include "ccid-internal.h"
#include <libusb.h>
#include <ccid-spec.h>
Include dependency graph for cci.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define _SWAP(field, func)   desc->field = func (desc->field)

Functions

static size_t x_rbuflen (struct _xfr *xfr)
static size_t x_tbuflen (struct _xfr *xfr)
int _cci_wait_for_interrupt (struct _cci *cci)
unsigned int _RDR_to_PC_DataBlock (struct _cci *cci, struct _xfr *xfr)
unsigned int _RDR_to_PC_SlotStatus (struct _cci *cci, struct _xfr *xfr)
static int _cmd_result (struct _cci *cci, const struct ccid_msg *msg)
static int do_recv (struct _cci *cci, struct _xfr *xfr)
static void _chipcard_set_status (struct _chipcard *cc, unsigned int status)
int _RDR_to_PC (struct _cci *cci, unsigned int slot, struct _xfr *xfr)
static int _PC_to_RDR (struct _cci *cci, unsigned int slot, struct _xfr *xfr)
int _PC_to_RDR_XfrBlock (struct _cci *cci, unsigned int slot, struct _xfr *xfr)
int _PC_to_RDR_GetSlotStatus (struct _cci *cci, unsigned int slot, struct _xfr *xfr)
int _PC_to_RDR_IccPowerOn (struct _cci *cci, unsigned int slot, struct _xfr *xfr, unsigned int voltage)
int _PC_to_RDR_IccPowerOff (struct _cci *cci, unsigned int slot, struct _xfr *xfr)
static void byteswap_desc (struct ccid_desc *desc)
static unsigned int bcd_hi (uint16_t word)
static unsigned int bcd_lo (uint16_t word)
static int get_endpoint (struct _cci *cci, const uint8_t *ptr, size_t len)
static int fill_ccid_desc (struct _cci *cci, const uint8_t *ptr, size_t len)
static int probe_descriptors (struct _cci *cci)
cci_t cci_probe (ccidev_t dev, const char *tracefile)
 Connect to a physical chipcard device.
void cci_close (cci_t cci)
 Close connection to a chip card device.
unsigned int cci_slots (cci_t cci)
 Retrieve the number of slots in the CCID.
chipcard_t cci_get_slot (cci_t cci, unsigned int num)
 Retrieve a handle to a CCID slot.
void cci_log (cci_t cci, const char *fmt,...)
 Print a message in the trace log.

Define Documentation

#define _SWAP ( field,
func   )     desc->field = func (desc->field)

Referenced by byteswap_desc().


Function Documentation

int _cci_wait_for_interrupt ( struct _cci cci  ) 

Definition at line 24 of file cci.c.

References _chipcard::cc_status, _cci::cci_dev, _cci::cci_intrp, _cci::cci_slot, _cci::cci_xfr, CHIPCARD_NOT_PRESENT, CHIPCARD_PRESENT, RDR_to_PC_HardwareError, RDR_to_PC_NotifySlotChange, trace, x_rbuflen(), and _xfr::x_rxhdr.

Referenced by chipcard_wait_for_card().

Here is the call graph for this function:

Here is the caller graph for this function:

static void _chipcard_set_status ( struct _chipcard cc,
unsigned int  status 
) [static]
static int _cmd_result ( struct _cci cci,
const struct ccid_msg msg 
) [static]
static int _PC_to_RDR ( struct _cci cci,
unsigned int  slot,
struct _xfr xfr 
) [static]

Definition at line 258 of file cci.c.

References ccid_msg::bSeq, ccid_msg::bSlot, _cci::cci_dev, _cci::cci_outp, _cci::cci_seq, ccid_msg::dwLength, sys_le32, x_tbuflen(), _xfr::x_txhdr, and _xfr::x_txlen.

Referenced by _PC_to_RDR_GetSlotStatus(), _PC_to_RDR_IccPowerOff(), _PC_to_RDR_IccPowerOn(), and _PC_to_RDR_XfrBlock().

Here is the call graph for this function:

Here is the caller graph for this function:

int _PC_to_RDR_GetSlotStatus ( struct _cci cci,
unsigned int  slot,
struct _xfr xfr 
)

Definition at line 301 of file cci.c.

References _PC_to_RDR(), ccid_msg::bMessageType, PC_to_RDR_GetSlotStatus, trace, and _xfr::x_txhdr.

Referenced by cci_probe(), chipcard_slot_status(), and chipcard_wait_for_card().

Here is the call graph for this function:

Here is the caller graph for this function:

int _PC_to_RDR_IccPowerOff ( struct _cci cci,
unsigned int  slot,
struct _xfr xfr 
)

Definition at line 348 of file cci.c.

References _PC_to_RDR(), ccid_msg::bMessageType, PC_to_RDR_IccPowerOff, trace, and _xfr::x_txhdr.

Referenced by chipcard_slot_off().

Here is the call graph for this function:

Here is the caller graph for this function:

int _PC_to_RDR_IccPowerOn ( struct _cci cci,
unsigned int  slot,
struct _xfr xfr,
unsigned int  voltage 
)

Definition at line 315 of file cci.c.

References _PC_to_RDR(), ccid_msg::bMessageType, CHIPCARD_1_8V, CHIPCARD_3V, CHIPCARD_5V, CHIPCARD_AUTO_VOLTAGE, ccid_msg::out, PC_to_RDR_IccPowerOn, trace, and _xfr::x_txhdr.

Referenced by chipcard_slot_on().

Here is the call graph for this function:

Here is the caller graph for this function:

int _PC_to_RDR_XfrBlock ( struct _cci cci,
unsigned int  slot,
struct _xfr xfr 
)

Definition at line 287 of file cci.c.

References _hex_dumpf(), _PC_to_RDR(), ccid_msg::bMessageType, _cci::cci_tf, PC_to_RDR_XfrBlock, trace, _xfr::x_txbuf, _xfr::x_txhdr, and _xfr::x_txlen.

Referenced by chipcard_transact().

Here is the call graph for this function:

Here is the caller graph for this function:

int _RDR_to_PC ( struct _cci cci,
unsigned int  slot,
struct _xfr xfr 
)
unsigned int _RDR_to_PC_DataBlock ( struct _cci cci,
struct _xfr xfr 
)

Definition at line 69 of file cci.c.

References _hex_dumpf(), ccid_msg::bMessageType, _cci::cci_tf, ccid_msg::in, RDR_to_PC_DataBlock, trace, _xfr::x_rxbuf, _xfr::x_rxhdr, and _xfr::x_rxlen.

Referenced by chipcard_slot_on(), and chipcard_transact().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int _RDR_to_PC_SlotStatus ( struct _cci cci,
struct _xfr xfr 
)
static unsigned int bcd_hi ( uint16_t  word  )  [static]

Definition at line 381 of file cci.c.

Referenced by fill_ccid_desc().

Here is the caller graph for this function:

static unsigned int bcd_lo ( uint16_t  word  )  [static]

Definition at line 386 of file cci.c.

Referenced by fill_ccid_desc().

Here is the caller graph for this function:

static void byteswap_desc ( struct ccid_desc desc  )  [static]

Definition at line 363 of file cci.c.

References _SWAP, sys_le16, and sys_le32.

Referenced by fill_ccid_desc().

Here is the caller graph for this function:

static int do_recv ( struct _cci cci,
struct _xfr xfr 
) [static]

Definition at line 174 of file cci.c.

References _cci::cci_dev, _cci::cci_inp, ccid_msg::dwLength, sys_le32, x_rbuflen(), _xfr::x_rxhdr, and _xfr::x_rxlen.

Referenced by _RDR_to_PC().

Here is the call graph for this function:

Here is the caller graph for this function:

static int fill_ccid_desc ( struct _cci cci,
const uint8_t *  ptr,
size_t  len 
) [static]
static int get_endpoint ( struct _cci cci,
const uint8_t *  ptr,
size_t  len 
) [static]

Definition at line 392 of file cci.c.

References _cci::cci_inp, _cci::cci_intrp, _cci::cci_max_in, _cci::cci_max_intr, _cci::cci_max_out, _cci::cci_outp, sys_le16, and trace.

Referenced by probe_descriptors().

Here is the caller graph for this function:

static int probe_descriptors ( struct _cci cci  )  [static]

Definition at line 560 of file cci.c.

References _cci::cci_dev, CCID_DT, fill_ccid_desc(), get_endpoint(), and trace.

Referenced by cci_probe().

Here is the call graph for this function:

Here is the caller graph for this function:

static size_t x_rbuflen ( struct _xfr xfr  )  [static]

Definition at line 15 of file cci.c.

References _xfr::x_rxmax.

Referenced by _cci_wait_for_interrupt(), and do_recv().

Here is the caller graph for this function:

static size_t x_tbuflen ( struct _xfr xfr  )  [static]

Definition at line 19 of file cci.c.

References _xfr::x_txlen.

Referenced by _PC_to_RDR().

Here is the caller graph for this function:

Generated on Sun Jan 2 08:34:59 2011 for ccid-utils by  doxygen 1.6.3