1 | /*
|
---|
2 | CT-BCS commands, responses and parameters for terminals
|
---|
3 | without keypad and display.
|
---|
4 |
|
---|
5 | This file is part of the Unix driver for Towitoko smartcard readers
|
---|
6 | Copyright (C) 1998 1999 2000 Carlos Prados <cprados@yahoo.com>
|
---|
7 |
|
---|
8 | This version is modified by doz21 to work in a special manner ;)
|
---|
9 |
|
---|
10 | This library is free software; you can redistribute it and/or
|
---|
11 | modify it under the terms of the GNU Lesser General Public
|
---|
12 | License as published by the Free Software Foundation; either
|
---|
13 | version 2 of the License, or (at your option) any later version.
|
---|
14 |
|
---|
15 | This library is distributed in the hope that it will be useful,
|
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | Lesser General Public License for more details.
|
---|
19 |
|
---|
20 | You should have received a copy of the GNU Lesser General Public
|
---|
21 | License along with this library; if not, write to the Free Software
|
---|
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef _CTBCS_
|
---|
26 | #define _CTBCS_
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * Command and response size
|
---|
30 | */
|
---|
31 | #define CTBCS_MIN_COMMAND_SIZE 2
|
---|
32 | #define CTBCS_MIN_RESPONSE_SIZE 2
|
---|
33 |
|
---|
34 | /*
|
---|
35 | * Class byte of all CTBCS commands
|
---|
36 | */
|
---|
37 | #define CTBCS_CLA 0x20
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * Mandatory CT-BCS commands
|
---|
41 | */
|
---|
42 | #define CTBCS_INS_RESET 0x11 /* Reset CT */
|
---|
43 | #define CTBCS_INS_REQUEST 0x12 /* Request ICC */
|
---|
44 | #define CTBCS_INS_STATUS 0x13 /* Get reader status */
|
---|
45 | #define CTBCS_INS_PARITY 0x17 /* Set reader parity */
|
---|
46 | #define CTBCS_INS_EJECT 0x15 /* Eject ICC */
|
---|
47 |
|
---|
48 |
|
---|
49 | #define CTBCS_P2_PARITY_ODD 0x01
|
---|
50 | #define CTBCS_P2_PARITY_EVEN 0x02
|
---|
51 | #define CTBCS_P2_PARITY_NONE 0x03
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * P1 parameter: functional units
|
---|
55 | */
|
---|
56 |
|
---|
57 | #define CTBCS_P1_CT_KERNEL 0x00
|
---|
58 | #define CTBCS_P1_INTERFACE1 0x01
|
---|
59 | #define CTBCS_P1_INTERFACE2 0x02
|
---|
60 | #define CTBCS_P1_INTERFACE3 0x03
|
---|
61 | #define CTBCS_P1_INTERFACE4 0x04
|
---|
62 | #define CTBCS_P1_INTERFACE5 0x05
|
---|
63 | #define CTBCS_P1_INTERFACE6 0x06
|
---|
64 | #define CTBCS_P1_INTERFACE7 0x07
|
---|
65 | #define CTBCS_P1_INTERFACE8 0x08
|
---|
66 | #define CTBCS_P1_INTERFACE9 0x09
|
---|
67 | #define CTBCS_P1_INTERFACE10 0x0A
|
---|
68 | #define CTBCS_P1_INTERFACE11 0x0B
|
---|
69 | #define CTBCS_P1_INTERFACE12 0x0C
|
---|
70 | #define CTBCS_P1_INTERFACE13 0x0D
|
---|
71 | #define CTBCS_P1_INTERFACE14 0x0E
|
---|
72 | #define CTBCS_P1_DISPLAY 0x40
|
---|
73 | #define CTBCS_P1_KEYPAD 0x50
|
---|
74 |
|
---|
75 | /*
|
---|
76 | * P2 parameter for Reset CT: data to be returned
|
---|
77 | */
|
---|
78 | #define CTBCS_P2_RESET_NO_RESP 0x00 /* Return no data */
|
---|
79 | #define CTBCS_P2_RESET_GET_ATR 0x01 /* Return complete ATR */
|
---|
80 | #define CTBCS_P2_RESET_GET_HIST 0x02 /* Return historical bytes */
|
---|
81 |
|
---|
82 | /*
|
---|
83 | * P2 parameter for Request ICC: data to be returned
|
---|
84 | */
|
---|
85 | #define CTBCS_P2_REQUEST_NO_RESP 0x00 /* Return no data */
|
---|
86 | #define CTBCS_P2_REQUEST_GET_ATR 0x01 /* Return complete ATR */
|
---|
87 | #define CTBCS_P2_REQUEST_GET_HIST 0x02 /* Return historical bytes */
|
---|
88 |
|
---|
89 | /*
|
---|
90 | * P2 parameter for Get status: TAG of data object to return
|
---|
91 | */
|
---|
92 | #define CTBCS_P2_STATUS_MANUFACTURER 0x46 /* Return manufacturer DO */
|
---|
93 | #define CTBCS_P2_STATUS_ICC 0x80 /* Return ICC DO */
|
---|
94 | #define CTBCS_P2_STATUS_PROTOCOL 0x81 /* Return ICC Protocol + Convention */
|
---|
95 |
|
---|
96 | /*
|
---|
97 | * General return codes
|
---|
98 | */
|
---|
99 | #define CTBCS_SW1_OK 0x90 /* Command successful */
|
---|
100 | #define CTBCS_SW2_OK 0x00
|
---|
101 | #define CTBCS_SW1_WRONG_LENGTH 0x67 /* Wrong length */
|
---|
102 | #define CTBCS_SW2_WRONG_LENGTH 0x00
|
---|
103 | #define CTBCS_SW1_COMMAND_NOT_ALLOWED 0x69 /* Command not allowed */
|
---|
104 | #define CTBCS_SW2_COMMAND_NOT_ALLOWED 0x00
|
---|
105 | #define CTBCS_SW1_WRONG_PARAM 0x6A /* Wrong parameters P1, P2 */
|
---|
106 | #define CTBCS_SW2_WRONG_PARAM 0x00
|
---|
107 | #define CTBCS_SW1_WRONG_INS 0x6D /* Wrong Instruction */
|
---|
108 | #define CTBCS_SW2_WRONG_INS 0x00
|
---|
109 | #define CTBCS_SW1_WRONG_CLA 0x6E /* Class not supported */
|
---|
110 | #define CTBCS_SW2_WRONG_CLA 0x00
|
---|
111 | #define CTBCS_SW1_ICC_ERROR 0x6F /* ICC removed, defective or */
|
---|
112 | #define CTBCS_SW2_ICC_ERROR 0x00 /* no longer reacts */
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * Return codes for Reset CT
|
---|
116 | */
|
---|
117 | #define CTBCS_SW1_RESET_CT_OK 0x90 /* Reset CT successful */
|
---|
118 | #define CTBCS_SW2_RESET_CT_OK 0x00
|
---|
119 | #define CTBCS_SW1_RESET_SYNC_OK 0x90 /* Synchoronous ICC, */
|
---|
120 | #define CTBCS_SW2_RESET_SYNC_OK 0x00 /* reset successful */
|
---|
121 | #define CTBCS_SW1_RESET_ASYNC_OK 0x90 /* Asynchoronous ICC, */
|
---|
122 | #define CTBCS_SW2_RESET_ASYNC_OK 0x01 /* reset successful */
|
---|
123 | #define CTBCS_SW1_RESET_ERROR 0x64 /* Reset not successful */
|
---|
124 | #define CTBCS_SW2_RESET_ERROR 0x00
|
---|
125 |
|
---|
126 | /*
|
---|
127 | * Return codes for Request ICC
|
---|
128 | */
|
---|
129 | #define CTBCS_SW1_REQUEST_SYNC_OK 0x90 /* Synchoronous ICC, */
|
---|
130 | #define CTBCS_SW2_REQUEST_SYNC_OK 0x00 /* reset successful */
|
---|
131 | #define CTBCS_SW1_REQUEST_ASYNC_OK 0x90 /* Asynchoronous ICC, */
|
---|
132 | #define CTBCS_SW2_REQUEST_ASYNC_OK 0x01 /* reset successful */
|
---|
133 | #define CTBCS_SW1_REQUEST_NO_CARD 0x62 /* No card present */
|
---|
134 | #define CTBCS_SW2_REQUEST_NO_CARD 0x00
|
---|
135 | #define CTBCS_SW1_REQUEST_CARD_PRESENT 0x62 /* Card already present */
|
---|
136 | #define CTBCS_SW2_REQUEST_CARD_PRESENT 0x01
|
---|
137 | #define CTBCS_SW1_REQUEST_ERROR 0x64 /* Reset not successful */
|
---|
138 | #define CTBCS_SW2_REQUEST_ERROR 0x00
|
---|
139 | #define CTBCS_SW1_REQUEST_TIMER_ERROR 0x69 /* Timer not supported */
|
---|
140 | #define CTBCS_SW2_REQUEST_TIMER_ERROR 0x00
|
---|
141 |
|
---|
142 | /*
|
---|
143 | * Return codes for Eject ICC
|
---|
144 | */
|
---|
145 | #define CTBCS_SW1_EJECT_OK 0x90 /* Command succesful, */
|
---|
146 | #define CTBCS_SW2_EJECT_OK 0x00
|
---|
147 | #define CTBCS_SW1_EJECT_REMOVED 0x90 /* Command succesful, */
|
---|
148 | #define CTBCS_SW2_EJECT_REMOVED 0x01 /* Card removed */
|
---|
149 | #define CTBCS_SW1_EJECT_NOT_REMOVED 0x62 /* Card not removed */
|
---|
150 | #define CTBCS_SW2_EJECT_NOT_REMOVED 0x00
|
---|
151 |
|
---|
152 | /*
|
---|
153 | * Data returned on Get Status command
|
---|
154 | */
|
---|
155 | #define CTBCS_DATA_STATUS_NOCARD 0x00 /* No card present */
|
---|
156 | #define CTBCS_DATA_STATUS_CARD 0x01 /* Card present */
|
---|
157 | #define CTBCS_DATA_STATUS_CARD_CONNECT 0x05 /* Card present */
|
---|
158 |
|
---|
159 | #endif /* _CTBCS_ */
|
---|
160 |
|
---|