| 1 |
/*
|
| 2 |
defs.h:
|
| 3 |
Copyright (C) 2003 Ludovic Rousseau
|
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or modify
|
| 6 |
it under the terms of the GNU General Public License as published by
|
| 7 |
the Free Software Foundation; either version 2 of the License, or
|
| 8 |
(at your option) any later version.
|
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful,
|
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
GNU General Public License for more details.
|
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License
|
| 16 |
along with this program; if not, write to the Free Software
|
| 17 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 18 |
*/
|
| 19 |
|
| 20 |
/*
|
| 21 |
* $Id$
|
| 22 |
*/
|
| 23 |
|
| 24 |
#include "pcscdefines.h"
|
| 25 |
#include "protocol_t1/protocol_t1.h"
|
| 26 |
|
| 27 |
typedef struct CCID_DESC
|
| 28 |
{
|
| 29 |
/*
|
| 30 |
* ATR
|
| 31 |
*/
|
| 32 |
DWORD nATRLength;
|
| 33 |
UCHAR pcATRBuffer[MAX_ATR_SIZE];
|
| 34 |
|
| 35 |
/*
|
| 36 |
* Card state
|
| 37 |
*/
|
| 38 |
UCHAR bPowerFlags;
|
| 39 |
|
| 40 |
/*
|
| 41 |
* T=1 Protocol context
|
| 42 |
*/
|
| 43 |
Protocol_T1 t1;
|
| 44 |
} CcidDesc;
|
| 45 |
|
| 46 |
/* Powerflag (used to detect quick insertion removals unnoticed by the
|
| 47 |
* resource manager)Initial value */
|
| 48 |
#define POWERFLAGS_RAZ 0x00
|
| 49 |
/* Flag set when a power up has been requested */
|
| 50 |
#define MASK_POWERFLAGS_PUP 0x01
|
| 51 |
/* Flag set when a power down is requestedA */
|
| 52 |
#define MASK_POWERFLAGS_PDWN 0x02
|
| 53 |
|
| 54 |
/* Communication buffer size (max=cmd+adpu+Lc+data+Le) */
|
| 55 |
#define CMD_BUF_SIZE (1+4+1+256+1)
|
| 56 |
/* Larger communication buffer size (max=reader status+data+sw) */
|
| 57 |
#define RESP_BUF_SIZE (1+256+2)
|
| 58 |
|
| 59 |
/* Protocols */
|
| 60 |
#define T_0 0
|
| 61 |
#define T_1 1
|
| 62 |
|
| 63 |
/* Size of an ISO command (CLA+INS+P1+P2) */
|
| 64 |
#define ISO_CMD_SIZE 4
|
| 65 |
/* Offset of the length byte in an TPDU */
|
| 66 |
#define ISO_OFFSET_LENGTH 4
|
| 67 |
/* Offset of the data in a TPDU */
|
| 68 |
#define ISO_OFFSET_TPDU_DATA 5
|
| 69 |
/* ISO length size (1 in general) */
|
| 70 |
#define ISO_LENGTH_SIZE 1
|
| 71 |
|
| 72 |
|
| 73 |
/*
|
| 74 |
* communication ports abstraction
|
| 75 |
*/
|
| 76 |
#ifdef TWIN_SERIAL
|
| 77 |
|
| 78 |
#define OpenPort OpenSerial
|
| 79 |
#define ClosePort CloseSerial
|
| 80 |
#define ReadPort ReadSerial
|
| 81 |
#define WritePort WriteSerial
|
| 82 |
#include "ccid_serial.h"
|
| 83 |
|
| 84 |
#else
|
| 85 |
|
| 86 |
#define OpenPort OpenUSB
|
| 87 |
#define ClosePort CloseUSB
|
| 88 |
#define ReadPort ReadUSB
|
| 89 |
#define WritePort WriteUSB
|
| 90 |
#include "ccid_usb.h"
|
| 91 |
|
| 92 |
#endif
|
| 93 |
|