SAMV71 Xplained Ultra Software Package 1.5

Usbd_ccid
[USB Stack Device]

Collaboration diagram for Usbd_ccid:

Data Structures

struct  _CCIDDriverConfigurationDescriptors
struct  _S_ccid_bulk_in_header
struct  _S_ccid_bulk_out_header
struct  _S_ccid_PIN_Verification
struct  _S_ccid_PIN_Modification
struct  _S_ccid_protocol_t0
struct  _S_ccid_protocol_t1
struct  _CCIDDescriptor

Defines

#define CCIDDriverDescriptors_PRODUCTID   0x6129
#define CCIDDriverDescriptors_VENDORID   0x03EB
#define CCIDDriverDescriptors_RELEASE   0x0100
#define MIN(a, b)   ((a < b) ? a : b)
#define ABDATA_SIZE   260
#define PROTOCOL_TO   0
#define PROTOCOL_T1   1
#define CCID_FEATURES_NADA   0x00000000
#define CCID_FEATURES_AUTO_PCONF   0x00000002
#define CCID_FEATURES_AUTO_ACTIV   0x00000004
#define CCID_FEATURES_AUTO_VOLT   0x00000008
#define CCID_FEATURES_AUTO_CLOCK   0x00000010
#define CCID_FEATURES_AUTO_BAUD   0x00000020
#define CCID_FEATURES_AUTO_PNEGO   0x00000040
#define CCID_FEATURES_AUTO_PPS   0x00000080
#define CCID_FEATURES_ICCSTOP   0x00000100
#define CCID_FEATURES_NAD   0x00000200
#define CCID_FEATURES_AUTO_IFSD   0x00000400
#define CCID_FEATURES_EXC_TPDU   0x00010000
#define CCID_FEATURES_EXC_SAPDU   0x00020000
#define CCID_FEATURES_EXC_APDU   0x00040000
#define CCID_FEATURES_WAKEUP   0x00100000
#define CCID_EPT_DATA_OUT   1
#define CCID_EPT_DATA_IN   2
#define CCID_EPT_NOTIFICATION   3
#define CCID1_10   0x0110
#define SMART_CARD_DEVICE_CLASS   0x0B
#define CCID_DECRIPTOR_TYPE   0x21
#define CCIDGenericRequest_ABORT   0x01
#define CCIDGenericRequest_GET_CLOCK_FREQUENCIES   0x02
#define CCIDGenericRequest_GET_DATA_RATES   0x03
#define PC_TO_RDR_ICCPOWERON   0x62
#define PC_TO_RDR_ICCPOWEROFF   0x63
#define PC_TO_RDR_GETSLOTSTATUS   0x65
#define PC_TO_RDR_XFRBLOCK   0x6F
#define PC_TO_RDR_GETPARAMETERS   0x6C
#define PC_TO_RDR_RESETPARAMETERS   0x6D
#define PC_TO_RDR_SETPARAMETERS   0x61
#define PC_TO_RDR_ESCAPE   0x6B
#define PC_TO_RDR_ICCCLOCK   0x6E
#define PC_TO_RDR_T0APDU   0x6A
#define PC_TO_RDR_SECURE   0x69
#define PC_TO_RDR_MECHANICAL   0x71
#define PC_TO_RDR_ABORT   0x72
#define PC_TO_RDR_SETDATARATEANDCLOCKFREQUENCY   0x73
#define RDR_TO_PC_DATABLOCK   0x80
#define RDR_TO_PC_SLOTSTATUS   0x81
#define RDR_TO_PC_PARAMETERS   0x82
#define RDR_TO_PC_ESCAPE   0x83
#define RDR_TO_PC_DATARATEANDCLOCKFREQUENCY   0x84
#define RDR_TO_PC_NOTIFYSLOTCHANGE   0x50
#define RDR_TO_PC_HARDWAREERROR   0x51
#define CMD_ABORTED   0xFF
#define ICC_MUTE   0xFE
#define XFR_PARITY_ERROR   0xFD
#define XFR_OVERRUN   0xFC
#define HW_ERROR   0xFB
#define BAD_ATR_TS   0xF8
#define BAD_ATR_TCK   0xF7
#define ICC_PROTOCOL_NOT_SUPPORTED   0xF6
#define ICC_CLASS_NOT_SUPPORTED   0xF5
#define PROCEDURE_BYTE_CONFLICT   0xF4
#define DEACTIVATED_PROTOCOL   0xF3
#define BUSY_WITH_AUTO_SEQUENCE   0xF2
#define PIN_TIMEOUT   0xF0
#define PIN_CANCELLED   0xEF
#define CMD_SLOT_BUSY   0xE0
#define VOLTS_AUTO   0x00
#define VOLTS_5_0   0x01
#define VOLTS_3_0   0x02
#define VOLTS_1_8   0x03
#define ICC_NOT_PRESENT   0x00
#define ICC_PRESENT   0x01
#define ICC_CHANGE   0x02
#define ICC_INSERTED_EVENT   ICC_PRESENT+ICC_CHANGE
#define ICC_BS_PRESENT_ACTIVATED   0x00
#define ICC_BS_PRESENT_NOTACTIVATED   0x01
#define ICC_BS_NOTPRESENT   0x02
#define ICC_BS_RFU   0x03
#define ICC_CS_NO_ERROR   (0x00<<6)
#define ICC_CS_FAILED   (0x01<<6)
#define ICC_CS_TIME_EXT   (0x02<<6)
#define ICC_CS_RFU   (0x03<<6)

Functions

struct
_CCIDDriverConfigurationDescriptors 
__attribute__ ((packed))
 Driver structure for an CCID device.
void USBDCallbacks_RequestReceived (const USBGenericRequest *request)
void CCID_SmartCardRequest (void)
void CCIDDriver_Initialize (void)
unsigned char CCID_Read (void *pBuffer, unsigned int dLength, TransferCallback fCallback, void *pArgument)
unsigned char CCID_Write (void *pBuffer, unsigned int dLength, TransferCallback fCallback, void *pArgument)
unsigned char CCID_Insertion (void)
unsigned char CCID_Removal (void)
unsigned char RDRtoPCHardwareError (unsigned char bSlot, unsigned char bSeq, unsigned char bHardwareErrorCode)

Variables

 CCIDDriver
const USBDDriverDescriptors ccidDriverDescriptors

Define Documentation

#define ABDATA_SIZE   260

For reference, the absolute maximum block size for a TPDU T=0 block is 260 bytes (5 bytes command; 255 bytes data), or for a TPDU T=1 block is 259 bytes, or for a short APDU T=1 block is 261 bytes, or for an extended APDU T=1 block is 65544 bytes.

Definition at line 59 of file cciddriver.h.

#define CCID_FEATURES_AUTO_ACTIV   0x00000004

Automatic activation of ICC on inserting

Definition at line 72 of file cciddriver.h.

#define CCID_FEATURES_AUTO_BAUD   0x00000020

Automatic baud rate change according to active parameters provided by the Host or self determined

Definition at line 80 of file cciddriver.h.

#define CCID_FEATURES_AUTO_CLOCK   0x00000010

Automatic ICC clock frequency change according to active parameters provided by the Host or self determined

Definition at line 77 of file cciddriver.h.

#define CCID_FEATURES_AUTO_IFSD   0x00000400

Automatic IFSD exchange as first exchange (T=1 protocol in use)

Definition at line 92 of file cciddriver.h.

#define CCID_FEATURES_AUTO_PCONF   0x00000002

Automatic parameter configuration based on ATR data

Definition at line 70 of file cciddriver.h.

#define CCID_FEATURES_AUTO_PNEGO   0x00000040

Automatic parameters negotiation made by the CCID (use of warm or cold resets or PPS according to a manufacturer proprietary algorithm to select the communication parameters with the ICC)

Definition at line 84 of file cciddriver.h.

#define CCID_FEATURES_AUTO_PPS   0x00000080

Automatic PPS made by the CCID according to the active parameters

Definition at line 86 of file cciddriver.h.

#define CCID_FEATURES_AUTO_VOLT   0x00000008

Automatic ICC voltage selection

Definition at line 74 of file cciddriver.h.

#define CCID_FEATURES_EXC_APDU   0x00040000

Short and Extended APDU level exchange with CCID

Definition at line 98 of file cciddriver.h.

#define CCID_FEATURES_EXC_SAPDU   0x00020000

Short APDU level exchange with CCID

Definition at line 96 of file cciddriver.h.

#define CCID_FEATURES_EXC_TPDU   0x00010000

TPDU level exchanges with CCID

Definition at line 94 of file cciddriver.h.

#define CCID_FEATURES_ICCSTOP   0x00000100

CCID can set ICC in clock stop mode

Definition at line 88 of file cciddriver.h.

#define CCID_FEATURES_NAD   0x00000200

NAD value other than 00 accepted (T=1 protocol in use)

Definition at line 90 of file cciddriver.h.

#define CCID_FEATURES_NADA   0x00000000

define for dwFeatures see Table 5.1-1 Smart Card Device Class Descriptors No special characteristics

Definition at line 68 of file cciddriver.h.

#define CCID_FEATURES_WAKEUP   0x00100000

USB Wake up signaling supported on card insertion and removal

Definition at line 100 of file cciddriver.h.

#define CCIDDriverDescriptors_PRODUCTID   0x6129

Constants: IDs: Device product ID.

Definition at line 66 of file cciddriver.c.

#define CCIDDriverDescriptors_RELEASE   0x0100

Constants: IDs: Device release number.

Definition at line 72 of file cciddriver.c.

#define CCIDDriverDescriptors_VENDORID   0x03EB

Constants: IDs: Device vendor ID.

Definition at line 69 of file cciddriver.c.

#define MIN (   a,
  b 
)    ((a < b) ? a : b)

Returns the minimum between two values.

Definition at line 76 of file cciddriver.c.

#define PROTOCOL_T1   1

define protocol T=1

Definition at line 64 of file cciddriver.h.

#define PROTOCOL_TO   0

define protocol T=0

Definition at line 62 of file cciddriver.h.


Function Documentation

Driver structure for an CCID device.

Standard USB device driver instance

CCID message

CCID command

Interrupt message answer

Buffer data of message

Protocol used

SlotStatus

Bit 0 = Slot 0 current state

Bit 1 = Slot 0 changed status

Bit 2 = Slot 1 current state

Bit 3 = Slot 1 changed status

Bit 4 = Slot 2 current state

Bit 5 = Slot 2 changed status

unsigned char CCID_Insertion ( void   ) 

Sends data through the interrupt endpoint, ICC insertion event RDR_to_PC_NotifySlotChange

Returns:
USBD_STATUS_LOCKED or USBD_STATUS_SUCCESS
unsigned char CCID_Read ( void *  pBuffer,
unsigned int  dLength,
TransferCallback  fCallback,
void *  pArgument 
)

Reads data from the Data OUT endpoint

Parameters:
pBuffer Buffer to store the received data
dLength data buffer length
fCallback Optional callback function
pArgument Optional parameter for the callback function
Returns:
USBD_STATUS_LOCKED or USBD_STATUS_SUCCESS
unsigned char CCID_Removal ( void   ) 

Sends data through the interrupt endpoint, ICC removal event RDR_to_PC_NotifySlotChange

Returns:
USBD_STATUS_LOCKED or USBD_STATUS_SUCCESS
void CCID_SmartCardRequest ( void   ) 

Handles SmartCart request

unsigned char CCID_Write ( void *  pBuffer,
unsigned int  dLength,
TransferCallback  fCallback,
void *  pArgument 
)

Sends data through the Data IN endpoint

Parameters:
pBuffer Buffer holding the data to transmit
dLength Length of data buffer
fCallback Optional callback function
pArgument Optional parameter for the callback function
Returns:
USBD_STATUS_LOCKED or USBD_STATUS_SUCCESS
void CCIDDriver_Initialize ( void   ) 

Initializes the CCID device driver.

unsigned char RDRtoPCHardwareError ( unsigned char  bSlot,
unsigned char  bSeq,
unsigned char  bHardwareErrorCode 
)

Interrupt-IN Messages This message is sent when any bit in the bHardwareErrorCode field is set. If this message is sent when there is no outstanding command, the bSeq field will be undefined.

Parameters:
bSlot ICC slot number
bSeq Sequence number of the bulk OUT command when the hardware error occured
bHardwareErrorCode Hardware error code
Returns:
USBD_STATUS_LOCKED or USBD_STATUS_SUCCESS
void USBDCallbacks_RequestReceived ( const USBGenericRequest request  ) 

Optional callback re-implementation

Definition at line 226 of file main.c.


Variable Documentation

Initial value:
 {

    &deviceDescriptor, 

    (USBConfigurationDescriptor *) &configurationDescriptorsFS,









    0, 
    0, 
    0, 
    0, 
    0, 
    0, 

    stringDescriptors,
    4 

}

List of standard descriptors for the serial driver.

Definition at line 632 of file cciddriver.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines