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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 413 by rousseau, Wed Sep 10 09:15:51 2003 UTC revision 6021 by rousseau, Mon Oct 10 13:00:23 2011 UTC
# Line 1  Line 1 
1  /*  /*
2      ccid.h: CCID structures      ccid.h: CCID structures
3      Copyright (C) 2003   Ludovic Rousseau      Copyright (C) 2003-2010   Ludovic Rousseau
4    
5      This program is free software; you can redistribute it and/or modify      This library is free software; you can redistribute it and/or
6      it under the terms of the GNU General Public License as published by      modify it under the terms of the GNU Lesser General Public
7      the Free Software Foundation; either version 2 of the License, or      License as published by the Free Software Foundation; either
8      (at your option) any later version.      version 2.1 of the License, or (at your option) any later version.
9    
10      This program is distributed in the hope that it will be useful,      This library is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      GNU General Public License for more details.      Lesser General Public License for more details.
14    
15      You should have received a copy of the GNU General Public License          You should have received a copy of the GNU Lesser General Public License
16      along with this program; if not, write to the Free Software          along with this library; if not, write to the Free Software Foundation,
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA          Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */  */
19    
20  /*  /*
# Line 26  typedef struct Line 26  typedef struct
26          /*          /*
27           * CCID Sequence number           * CCID Sequence number
28           */           */
29          unsigned char bSeq;          unsigned char *pbSeq;
30            unsigned char real_bSeq;
31    
32          /*          /*
33           * VendorID << 16 + ProductID           * VendorID << 16 + ProductID
# Line 36  typedef struct Line 37  typedef struct
37          /*          /*
38           * Maximum message length           * Maximum message length
39           */           */
40          int dwMaxCCIDMessageLength;          unsigned int dwMaxCCIDMessageLength;
41    
42          /*          /*
43           * Features supported by the reader (directly from class Descriptor)           * Maximum IFSD
44             */
45            int dwMaxIFSD;
46    
47            /*
48             * Features supported by the reader (directly from Class Descriptor)
49           */           */
50          int dwFeatures;          int dwFeatures;
51    
52            /*
53             * PIN support of the reader (directly from Class Descriptor)
54             */
55            char bPINSupport;
56    
57            /*
58             * Display dimensions of the reader (directly from Class Descriptor)
59             */
60            unsigned int wLcdLayout;
61    
62            /*
63             * Default Clock
64             */
65            int dwDefaultClock;
66    
67            /*
68             * Max Data Rate
69             */
70            unsigned int dwMaxDataRate;
71    
72            /*
73             * Number of available slots
74             */
75            char bMaxSlotIndex;
76    
77            /*
78             * Slot in use
79             */
80            char bCurrentSlotIndex;
81    
82            /*
83             * The array of data rates supported by the reader
84             */
85            unsigned int *arrayOfSupportedDataRates;
86    
87            /*
88             * Read communication port timeout
89             * value is milliseconds
90             * this value can evolve dynamically if card request it (time processing).
91             */
92            unsigned int readTimeout;
93    
94            /*
95             * Card protocol
96             */
97            int cardProtocol;
98    
99            /*
100             * bInterfaceProtocol (CCID, ICCD-A, ICCD-B)
101             */
102            int bInterfaceProtocol;
103    
104            /*
105             * bNumEndpoints
106             */
107            int bNumEndpoints;
108    
109            /*
110             * GemCore SIM PRO slot status management
111             * The reader always reports a card present even if no card is inserted.
112             * If the Power Up fails the driver will report IFD_ICC_NOT_PRESENT instead
113             * of IFD_ICC_PRESENT
114             */
115            int dwSlotStatus;
116    
117            /*
118             * bVoltageSupport (bit field)
119             * 1 = 5.0V
120             * 2 = 3.0V
121             * 4 = 1.8V
122             */
123            int bVoltageSupport;
124    
125            /*
126             * USB serial number of the device (if any)
127             */
128            char *sIFD_serial_number;
129    
130            /*
131             * USB iManufacturer string
132             */
133            const char *sIFD_iManufacturer;
134    
135            /*
136             * USB bcdDevice
137             */
138            int IFD_bcdDevice;
139  } _ccid_descriptor;  } _ccid_descriptor;
140    
141    /* Features from dwFeatures */
142    #define CCID_CLASS_AUTO_CONF_ATR        0x00000002
143  #define CCID_CLASS_AUTO_VOLTAGE         0x00000008  #define CCID_CLASS_AUTO_VOLTAGE         0x00000008
144  #define CCID_CLASS_EXCHANGE_MASK        0x00070000  #define CCID_CLASS_AUTO_BAUD            0x00000020
145    #define CCID_CLASS_AUTO_PPS_PROP        0x00000040
146    #define CCID_CLASS_AUTO_PPS_CUR         0x00000080
147    #define CCID_CLASS_AUTO_IFSD            0x00000400
148    #define CCID_CLASS_CHARACTER            0x00000000
149  #define CCID_CLASS_TPDU                         0x00010000  #define CCID_CLASS_TPDU                         0x00010000
150  #define CCID_CLASS_SHORT_APDU           0x00020000  #define CCID_CLASS_SHORT_APDU           0x00020000
151  #define CCID_CLASS_EXTENDED_APDU        0x00040000  #define CCID_CLASS_EXTENDED_APDU        0x00040000
152    #define CCID_CLASS_EXCHANGE_MASK        0x00070000
153    
154    /* Features from bPINSupport */
155    #define CCID_CLASS_PIN_VERIFY           0x01
156    #define CCID_CLASS_PIN_MODIFY           0x02
157    
158  /* See CCID specs ch. 4.2.1 */  /* See CCID specs ch. 4.2.1 */
159    #define CCID_ICC_PRESENT_ACTIVE         0x00    /* 00 0000 00 */
160    #define CCID_ICC_PRESENT_INACTIVE       0x01    /* 00 0000 01 */
161    #define CCID_ICC_ABSENT                         0x02    /* 00 0000 10 */
162    #define CCID_ICC_STATUS_MASK            0x03    /* 00 0000 11 */
163    
164  #define CCID_COMMAND_FAILED                     0x40    /* 01 0000 00 */  #define CCID_COMMAND_FAILED                     0x40    /* 01 0000 00 */
165  #define CCID_TIME_EXTENSION                     0x80    /* 10 0000 00 */  #define CCID_TIME_EXTENSION                     0x80    /* 10 0000 00 */
166    
167    /* bInterfaceProtocol for ICCD */
168    #define PROTOCOL_CCID   0       /* plain CCID */
169    #define PROTOCOL_ICCD_A 1       /* ICCD Version A */
170    #define PROTOCOL_ICCD_B 2       /* ICCD Version B */
171    
172  /* Product identification for special treatments */  /* Product identification for special treatments */
173  #define GEMPC433        0x08E64433  #define GEMPC433        0x08E64433
174  #define GEMPCKEY        0x08E63438  #define GEMPCKEY        0x08E63438
175  #define GEMPCTWIN       0x08E63437  #define GEMPCTWIN       0x08E63437
176    #define GEMPCPINPAD 0x08E63478
177    #define GEMCORESIMPRO 0x08E63480
178    #define GEMCOREPOSPRO 0x08E63479
179    #define GEMALTOPROXDU 0x08E65503
180    #define GEMALTOPROXSU 0x08E65504
181    #define GEMALTO_EZIO_CBP 0x08E634C3
182  #define CARDMAN3121     0x076B3021  #define CARDMAN3121     0x076B3021
183    #define LTC31           0x07830003
184    #define SCR331DI        0x04E65111
185    #define SCR331DINTTCOM  0x04E65120
186    #define SDI010          0x04E65121
187    #define CHERRYXX33      0x046A0005
188    #define CHERRYST2000    0x046A003E
189    #define OZ776           0x0B977762
190    #define OZ776_7772      0x0B977772
191    #define SPR532          0x04E6E003
192    #define MYSMARTPAD      0x09BE0002
193    #define CHERRYXX44      0x046a0010
194    #define CL1356D         0x0B810200
195    #define REINER_SCT      0x0C4B0300
196    #define SEG                     0x08E68000
197    #define BLUDRIVEII_CCID 0x1B0E1078
198    #define DELLSCRK    0x413C2101
199    #define DELLSK      0x413C2100
200    #define KOBIL_TRIBANK   0x0D463010
201    #define KOBIL_MIDENTITY_VISUAL  0x0D460D46
202    #define VEGAALPHA   0x09820008
203    #define HPSMARTCARDKEYBOARD 0x03F01024
204    
205    #define VENDOR_GEMALTO 0x08E6
206    #define GET_VENDOR(readerID) ((readerID >> 16) & 0xFFFF)
207    
208    /*
209     * The O2Micro OZ776S reader has a wrong USB descriptor
210     * The extra[] field is associated with the last endpoint instead of the
211     * main USB descriptor
212     */
213    #define O2MICRO_OZ776_PATCH
214    
215  /* Escape sequence codes */  /* Escape sequence codes */
216  #define ESC_GEMPC_SET_ISO_MODE          1  #define ESC_GEMPC_SET_ISO_MODE          1
217  #define ESC_GEMPC_SET_APDU_MODE         2  #define ESC_GEMPC_SET_APDU_MODE         2
218    
219    /*
220  int ccid_open_hack(int lun);   * Possible values :
221  void ccid_error(int error, char *file, int line);   * 3 -> 1.8V, 3V, 5V
222  _ccid_descriptor *get_ccid_descriptor(int lun);   * 2 -> 3V, 5V
223     * 1 -> 5V only
224     * 0 -> automatic (selection made by the reader)
225     */
226    /*
227     * To be safe we default to 5V
228     * otherwise we would have to parse the ATR and get the value of TAi (i>2) when
229     * in T=15
230     */
231    #define VOLTAGE_AUTO 0
232    #define VOLTAGE_5V 1
233    #define VOLTAGE_3V 2
234    #define VOLTAGE_1_8V 3
235    
236    int ccid_open_hack_pre(unsigned int reader_index);
237    int ccid_open_hack_post(unsigned int reader_index);
238    void ccid_error(int error, const char *file, int line, const char *function);
239    _ccid_descriptor *get_ccid_descriptor(unsigned int reader_index);
240    
241  /* convert a 4 byte integer in USB format into an int */  /* convert a 4 byte integer in USB format into an int */
242  #define dw2i(a, x) ((((((a[x+3] << 8) + a[x+2]) << 8) + a[x+1]) << 8) + a[x])  #define dw2i(a, x) (unsigned int)((((((a[x+3] << 8) + a[x+2]) << 8) + a[x+1]) << 8) + a[x])
243    
244    /* all the data rates specified by ISO 7816-3 Fi/Di tables */
245    #define ISO_DATA_RATES 10753, 14337, 15625, 17204, \
246                    20833, 21505, 23438, 25806, 28674, \
247                    31250, 32258, 34409, 39063, 41667, \
248                    43011, 46875, 52083, 53763, 57348, \
249                    62500, 64516, 68817, 71685, 78125, \
250                    83333, 86022, 93750, 104167, 107527, \
251                    114695, 125000, 129032, 143369, 156250, \
252                    166667, 172043, 215054, 229391, 250000, \
253                    344086
254    
255    /* data rates supported by the secondary slots on the GemCore Pos Pro & SIM Pro */
256    #define GEMPLUS_CUSTOM_DATA_RATES 10753, 21505, 43011, 125000
257    

Legend:
Removed from v.413  
changed lines
  Added in v.6021

  ViewVC Help
Powered by ViewVC 1.1.5