sc-hsm-embedded
src/ctccid/usb_device.h File Reference
#include <stdint.h>
#include "ccidT1.h"

Data Structures

struct  usb_device

Defines

#define SCM_VENDOR_ID   0x04e6
#define SCM_SCR_35XX_DEVICE_ID   0x5410
#define SCM_SCR_3310_DEVICE_ID   0x5116
#define USB_WRITE_TIMEOUT   (5 * 1000)
#define USB_READ_TIMEOUT   (3 * 1000)
#define USB_OK   0 /* Successful completion */
#define ERR_NO_READER   -1 /* Invalid parameter or value */
#define ERR_USB   -2 /* USB error */

Typedefs

typedef struct usb_device usb_device_t

Functions

int USB_Open (unsigned short pn, usb_device_t **device)
int USB_Close (usb_device_t **device)
int USB_Write (usb_device_t *device, unsigned int length, unsigned char *buffer)
int USB_Read (usb_device_t *device, unsigned int *length, unsigned char *buffer)

Define Documentation

#define ERR_NO_READER   -1 /* Invalid parameter or value */
#define ERR_USB   -2 /* USB error */
#define SCM_SCR_3310_DEVICE_ID   0x5116

Device ID for SCR 3310

#define SCM_SCR_35XX_DEVICE_ID   0x5410

Device ID for SCR 355

#define SCM_VENDOR_ID   0x04e6

Vendor ID for SCM Microsystems

#define USB_OK   0 /* Successful completion */
#define USB_READ_TIMEOUT   (3 * 1000)

Timeout value for reading data

#define USB_WRITE_TIMEOUT   (5 * 1000)

Timeout value for writing data


Typedef Documentation

typedef struct usb_device usb_device_t

Data structure encapsulating all information necessary to perform USB communication with a device, e.g. device handles, descriptors, bulk pipe ids.


Function Documentation

int USB_Close ( usb_device_t **  device)

Close USB device and free allocated resources

Parameters:
deviceStructure with device specific data
Returns:
Status code USB_OK, ERR_USB
int USB_Open ( unsigned short  pn,
usb_device_t **  device 
)

Open USB device at the specified port and allocate necessary resources

Parameters:
pnPort number
deviceStructure holding device specific data
Returns:
Status code USB_OK, ERR_NO_READER, ERR_USB
int USB_Read ( usb_device_t device,
unsigned int *  length,
unsigned char *  buffer 
)

Read data block from specified USB device using bulk transfer

Parameters:
deviceDevice specific data
lengthLength of data buffer
bufferData buffer
Returns:
Status code USB_OK, ERR_USB
int USB_Write ( usb_device_t device,
unsigned int  length,
unsigned char *  buffer 
)

Write data block to specified USB device using bulk transfer

Parameters:
deviceDevice specific data
lengthLength of data to write
bufferData buffer
Returns:
Status code USB_OK, ERR_USB