AN1527 STMICROELECTRONICS [STMicroelectronics], AN1527 Datasheet - Page 2

no-image

AN1527

Manufacturer Part Number
AN1527
Description
DEVELOPING A USB SMARTCARD READER WITH ST7SCR
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
DEVELOPING A USB SMARTCARD READER WITH ST7SCR
1 CCID IMPLEMENTATION
1.1 GENERALITIES
The Chip Card Interface Device (CCID) firmware implementation conforms to the “Universal
Serial Bus Device Class Specification for USB Chip/Smart Card Interface Devices” revision
1.0. It contains two files:
– Ccid_usb.c: This file contains the USB - CCID interface functions used to manage the state
– Ifd_ccid.c: This file contains the PC_to_RDR_xxx() and RDR_to_PC_xxx() message func-
The following commands are not supported but can be added easily:
– PC_To_RDR_Secure,
– PC_To_RDR_SetDataRateAndClockFrequency,
– PC_To_RDR_ToAPDU,
– PC_To_RDR_Mechanical.
This CCID part uses a 271-byte buffer for all messages. Messages are composed of two
parts:
– header (10 bytes: fixed size)
– data (up to 261 bytes).
The size is based on the largest message managed at the short APDU transaction level. Due
to this large size, the ST7SCR can have only 1 buffer and cannot store more than one mes-
sage at a given time.
The CCID_BulkOutMessage() function uses several Bulk-out USB transactions to verify the
message header and store the entire message in the buffer.
When the message reception is completed, the CCID_DispatchMessage() function identifies
the message type and calls the corresponding function (PC_to_RDR_xxx()) for processing.
Then, the IFD part of the firmware executes a command on the ICC if necessary. This com-
mand is included in the data field of the buffer. The PC_to_RDR_xxx() function receives from
the IFD the answer to the message in the buffer data field and returns an error code to be in-
cluded in the Bulk-in response.
The RDR_to_PC_xxx() function, which corresponds to the PC_to_RDR_xxx() previously exe-
cuted, is launched and enters the correct values for error and status codes in the header.
At this time, the Bulk-in message is ready to be sent. But before the sending, the
CCID_IntMessage() function is executed to detect any hardware problems or if a slot change
has occurred. In this case, the corresponding interrupt message is sent to the host.
2/14
2
machine that generates Bulk-in/Bulk-out messages.
tions for the CCID.

Related parts for AN1527