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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2974 - (show annotations) (download)
Wed May 28 18:32:52 2008 UTC (4 years, 11 months ago) by rousseau
File MIME type: text/plain
File size: 5516 byte(s)
update Free Software Foundation mail address
1 /*
2 ccid.h: CCID structures
3 Copyright (C) 2003 Ludovic Rousseau
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 /*
21 * $Id$
22 */
23
24 typedef struct
25 {
26 /*
27 * CCID Sequence number
28 */
29 unsigned char *pbSeq;
30 unsigned char real_bSeq;
31
32 /*
33 * VendorID << 16 + ProductID
34 */
35 int readerID;
36
37 /*
38 * Maximum message length
39 */
40 unsigned int dwMaxCCIDMessageLength;
41
42 /*
43 * Maximum IFSD
44 */
45 int dwMaxIFSD;
46
47 /*
48 * Features supported by the reader (directly from Class Descriptor)
49 */
50 int dwFeatures;
51
52 /*
53 * PIN support of the reader (directly from Class Descriptor)
54 */
55 char bPINSupport;
56
57 /*
58 * Default Clock
59 */
60 int dwDefaultClock;
61
62 /*
63 * Max Data Rate
64 */
65 unsigned int dwMaxDataRate;
66
67 /*
68 * Number of available slots
69 */
70 char bMaxSlotIndex;
71
72 /*
73 * Slot in use
74 */
75 char bCurrentSlotIndex;
76
77 /*
78 * The array of data rates supported by the reader
79 */
80 unsigned int *arrayOfSupportedDataRates;
81
82 /*
83 * Read communication port timeout
84 * value is seconds
85 * this value can evolve dynamically if card request it (time processing).
86 */
87 unsigned int readTimeout;
88
89 /*
90 * Card protocol
91 */
92 int cardProtocol;
93
94 /*
95 * bInterfaceProtocol (CCID, ICCD-A, ICCD-B)
96 */
97 int bInterfaceProtocol;
98
99 /*
100 * bNumEndpoints
101 */
102 int bNumEndpoints;
103
104 /*
105 * GemCore SIM PRO slot status management
106 * The reader always reports a card present even if no card is inserted.
107 * If the Power Up fails the driver will report IFD_ICC_NOT_PRESENT instead
108 * of IFD_ICC_PRESENT
109 */
110 int dwSlotStatus;
111 } _ccid_descriptor;
112
113 /* Features from dwFeatures */
114 #define CCID_CLASS_AUTO_CONF_ATR 0x00000002
115 #define CCID_CLASS_AUTO_VOLTAGE 0x00000008
116 #define CCID_CLASS_AUTO_BAUD 0x00000020
117 #define CCID_CLASS_AUTO_PPS_PROP 0x00000040
118 #define CCID_CLASS_AUTO_PPS_CUR 0x00000080
119 #define CCID_CLASS_AUTO_IFSD 0x00000400
120 #define CCID_CLASS_CHARACTER 0x00000000
121 #define CCID_CLASS_TPDU 0x00010000
122 #define CCID_CLASS_SHORT_APDU 0x00020000
123 #define CCID_CLASS_EXTENDED_APDU 0x00040000
124 #define CCID_CLASS_EXCHANGE_MASK 0x00070000
125
126 /* Features from bPINSupport */
127 #define CCID_CLASS_PIN_VERIFY 0x01
128 #define CCID_CLASS_PIN_MODIFY 0x02
129
130 /* See CCID specs ch. 4.2.1 */
131 #define CCID_ICC_PRESENT_ACTIVE 0x00 /* 00 0000 00 */
132 #define CCID_ICC_PRESENT_INACTIVE 0x01 /* 00 0000 01 */
133 #define CCID_ICC_ABSENT 0x02 /* 00 0000 10 */
134 #define CCID_ICC_STATUS_MASK 0x03 /* 00 0000 11 */
135
136 #define CCID_COMMAND_FAILED 0x40 /* 01 0000 00 */
137 #define CCID_TIME_EXTENSION 0x80 /* 10 0000 00 */
138
139 /* bInterfaceProtocol for ICCD */
140 #define ICCD_A 1 /* ICCD Version A */
141 #define ICCD_B 2 /* ICCD Version B */
142
143 /* Product identification for special treatments */
144 #define GEMPC433 0x08E64433
145 #define GEMPCKEY 0x08E63438
146 #define GEMPCTWIN 0x08E63437
147 #define GEMPCPINPAD 0x08E63478
148 #define GEMCORESIMPRO 0x08E63480
149 #define GEMCOREPOSPRO 0x08E63479
150 #define CARDMAN3121 0x076B3021
151 #define LTC31 0x07830003
152 #define SCR331DI 0x04E65111
153 #define SCR331DINTTCOM 0x04E65120
154 #define SDI010 0x04E65121
155 #define CHERRYXX33 0x046A0005
156 #define CHERRYST2000 0x046A003E
157 #define OZ776 0x0B977762
158 #define OZ776_7772 0x0B977772
159 #define SPR532 0x04E6E003
160 #define MYSMARTPAD 0x09BE0002
161 #define CHERRYXX44 0x046a0010
162 #define CL1356D 0x0B810200
163 #define REINER_SCT 0x0C4B0300
164 #define SEG 0x08E68000
165 #define BLUDRIVEII_CCID 0x1B0E1078
166
167 /*
168 * The O2Micro OZ776S reader has a wrong USB descriptor
169 * The extra[] field is associated with the last endpoint instead of the
170 * main USB descriptor
171 */
172 #define O2MICRO_OZ776_PATCH
173
174 /* Escape sequence codes */
175 #define ESC_GEMPC_SET_ISO_MODE 1
176 #define ESC_GEMPC_SET_APDU_MODE 2
177
178 /*
179 * Possible values :
180 * 3 -> 1.8V, 3V, 5V
181 * 2 -> 3V, 5V
182 * 1 -> 5V only
183 * 0 -> automatic (selection made by the reader)
184 */
185 /*
186 * To be safe we default to 5V
187 * otherwise we would have to parse the ATR and get the value of TAi (i>2) when
188 * in T=15
189 */
190 #define VOLTAGE_AUTO 0
191 #define VOLTAGE_5V 1
192 #define VOLTAGE_3V 2
193 #define VOLTAGE_1_8V 3
194
195 int ccid_open_hack(unsigned int reader_index);
196 void ccid_error(int error, const char *file, int line, const char *function);
197 _ccid_descriptor *get_ccid_descriptor(unsigned int reader_index);
198
199 /* convert a 4 byte integer in USB format into an int */
200 #define dw2i(a, x) ((((((a[x+3] << 8) + a[x+2]) << 8) + a[x+1]) << 8) + a[x])
201
202 /* all the data rates specified by ISO 7816-3 Fi/Di tables */
203 #define ISO_DATA_RATES 10753, 14337, 15625, 17204, \
204 20833, 21505, 23438, 25806, 28674, \
205 31250, 32258, 34409, 39063, 41667, \
206 43011, 46875, 52083, 53763, 57348, \
207 62500, 64516, 68817, 71685, 78125, \
208 83333, 86022, 93750, 104167, 107527, \
209 114695, 125000, 129032, 143369, 156250, \
210 166667, 172043, 215054, 229391, 250000, \
211 344086
212
213 /* data rates supported by the secondary slots on the GemCore Pos Pro & SIM Pro */
214 #define GEMPLUS_CUSTOM_DATA_RATES 10753, 21505, 43011, 125000
215

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5