|
sc-hsm-embedded
|
#include "scr.h"| #define ERR_HW_ERROR 0xFB |
| #define ERR_ICC_MUTE 0xFE |
| #define ERR_XFR_OVERRUN 0xFC |
| #define ICC_PRESENT_AND_ACTIVE 0x00 |
| #define ICC_PRESENT_AND_INACTIVE 0x01 |
| #define ICC_STATUS_MASK 0x03 |
| #define MATCH | ( | x, | |
| y | |||
| ) | ((x >= (y - y / 20)) && (x <= (y + y / 20))) |
| #define MSG_TYPE_PC_to_RDR_GetSlotStatus 0x65 |
| #define MSG_TYPE_PC_to_RDR_IccPowerOff 0x63 |
| #define MSG_TYPE_PC_to_RDR_IccPowerOn 0x62 |
| #define MSG_TYPE_PC_to_RDR_SetParameters 0x61 |
| #define MSG_TYPE_PC_to_RDR_XfrBlock 0x6F |
| #define MSG_TYPE_RDR_to_PC_DataBlock 0x80 |
| #define MSG_TYPE_RDR_to_PC_Parameters 0x82 |
| #define MSG_TYPE_RDR_to_PC_SlotStatus 0x81 |
| #define NO_ICC_PRESENT 0x02 |
| int DecodeATRValues | ( | scr_t * | ctx | ) |
Decode protocol specified ATR values and store them in the reader context
| ctx | Reader context |
| int DetermineBaudrate | ( | int | F, |
| int | D | ||
| ) |
Calculate the current baudrate depending on the values of F and D
| F | Clock rate conversion integer |
| D | Baud rate adjustment integer |
| int PC_to_RDR_GetSlotStatus | ( | scr_t * | ctx | ) |
Get the current state of the reader slot
| ctx | Reader context |
| int PC_to_RDR_IccPowerOff | ( | scr_t * | ctx | ) |
Power off the ICC in the reader
| ctx | Reader context |
| int PC_to_RDR_IccPowerOn | ( | scr_t * | ctx | ) |
Power on the ICC in the reader and set the ATR and the communication parameters as specified
| ctx | Reader context |
| int PC_to_RDR_SetParameters | ( | scr_t * | ctx | ) |
Set communication protocol parameters (guard time, FI, DI, IFSC)
| ctx | Reader context |
| int PC_to_RDR_XfrBlock | ( | scr_t * | ctx, |
| unsigned int | outlen, | ||
| unsigned char * | outbuf | ||
| ) |
Exchange data block between PC and reader
| ctx | Reader context |
| outlen | Length of outgoing data |
| outbuf | Outgoing data buffer |
| int RDR_to_PC_DataBlock | ( | scr_t * | ctx, |
| unsigned int * | inlen, | ||
| unsigned char * | inbuf | ||
| ) |
Exchange data block between reader and PC
| ctx | Reader context |
| inlen | Length of data buffer/actual length of incoming data |
| inbuf | Incoming data buffer |