/[pcsclite]/trunk/Drivers/ccid/src/defs.h
ViewVC logotype

Contents of /trunk/Drivers/ccid/src/defs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 996 - (show annotations) (download)
Wed Jun 30 13:30:04 2004 UTC (8 years, 11 months ago) by rousseau
File MIME type: text/plain
File size: 2473 byte(s)
the t1 field in struct CCID_DESC changed from Protocol_T1 (towitiko) to
t1_state_t (openct)
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 <PCSC/pcsclite.h>
25
26 #include "openct/proto-t1.h"
27
28 typedef struct CCID_DESC
29 {
30 /*
31 * ATR
32 */
33 DWORD nATRLength;
34 UCHAR pcATRBuffer[MAX_ATR_SIZE];
35
36 /*
37 * Card state
38 */
39 UCHAR bPowerFlags;
40
41 /*
42 * T=1 Protocol context
43 */
44 t1_state_t t1;
45 } CcidDesc;
46
47 typedef enum {
48 STATUS_SUCCESS = 0xFA,
49 STATUS_UNSUCCESSFUL = 0xFB,
50 STATUS_COMM_ERROR = 0xFC,
51 STATUS_DEVICE_PROTOCOL_ERROR = 0xFD
52 } status_t;
53
54 /* Powerflag (used to detect quick insertion removals unnoticed by the
55 * resource manager)Initial value */
56 #define POWERFLAGS_RAZ 0x00
57 /* Flag set when a power up has been requested */
58 #define MASK_POWERFLAGS_PUP 0x01
59 /* Flag set when a power down is requested */
60 #define MASK_POWERFLAGS_PDWN 0x02
61
62 /* Communication buffer size (max=cmd+adpu+Lc+data+Le) */
63 #define CMD_BUF_SIZE (1+4+1+256+1)
64 /* Larger communication buffer size (max=reader status+data+sw) */
65 #define RESP_BUF_SIZE (1+256+2)
66
67 /* Protocols */
68 #define T_0 0
69 #define T_1 1
70
71 /* Size of an ISO command (CLA+INS+P1+P2) */
72 #define ISO_CMD_SIZE 4
73 /* Offset of the length byte in an TPDU */
74 #define ISO_OFFSET_LENGTH 4
75 /* Offset of the data in a TPDU */
76 #define ISO_OFFSET_TPDU_DATA 5
77 /* ISO length size (1 in general) */
78 #define ISO_LENGTH_SIZE 1
79
80
81 /*
82 * communication ports abstraction
83 */
84 #ifdef TWIN_SERIAL
85
86 #define OpenPortByName OpenSerialByName
87 #define OpenPort OpenSerial
88 #define ClosePort CloseSerial
89 #define ReadPort ReadSerial
90 #define WritePort WriteSerial
91 #include "ccid_serial.h"
92
93 #else
94
95 #define OpenPortByName OpenUSBByName
96 #define OpenPort OpenUSB
97 #define ClosePort CloseUSB
98 #define ReadPort ReadUSB
99 #define WritePort WriteUSB
100 #include "ccid_usb.h"
101
102 #endif
103

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5