source: branches/monitor-improvement/csctapi/ifd_towitoko.h@ 1228

Last change on this file since 1228 was 1228, checked in by alno, 13 years ago

WebIf:

  • Command: Merging revisions 1212-1227 of trunk
File size: 5.1 KB
Line 
1/*
2 ifd_towitoko.h
3 Interface device handling functions definitions.
4 An IFD object represents on of the slots within a drive.
5 All chipdrives but Twin have one IFD per drive and serial port.
6
7 This file is part of the Unix driver for Towitoko smartcard readers
8 Copyright (C) 2000 2001 Carlos Prados <cprados@yahoo.com>
9
10 This version is modified by doz21 to work in a special manner ;)
11
12 This library is free software; you can redistribute it and/or
13 modify it under the terms of the GNU Lesser General Public
14 License as published by the Free Software Foundation; either
15 version 2 of the License, or (at your option) any later version.
16
17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public
23 License along with this library; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25*/
26
27#ifndef _IFD_TOWITOKO_
28#define _IFD_TOWITOKO_
29
30#include "defines.h"
31#include "atr.h"
32#include "mc_global.h"
33
34/*
35 * Exported constants definition
36 */
37
38/* Return Codes */
39#define IFD_TOWITOKO_OK 0 /* OK */
40#define IFD_TOWITOKO_IO_ERROR 1 /* I/O Error */
41#define IFD_TOWITOKO_CHK_ERROR 2 /* Checksum error */
42#define IFD_TOWITOKO_PARAM_ERROR 3 /* Parameter error */
43#define IFD_TOWITOKO_UNSUPPORTED 4 /* Action not supported by IFD
44 hardware */
45
46/* Slots: Only Chipdrive twin has slot B */
47#define IFD_TOWITOKO_SLOT_A 0x01 /* Chipdrive slot A */
48#define IFD_TOWITOKO_SLOT_B 0x02 /* Chipdrive twin slot B */
49#define IFD_TOWITOKO_SLOT_MULTICAM 0x00 /* Multicam */
50
51/* Reader types */
52#define IFD_TOWITOKO_CHIPDRIVE_EXT_II 0x88
53#define IFD_TOWITOKO_CHIPDRIVE_EXT_I 0x84
54#define IFD_TOWITOKO_CHIPDRIVE_INT 0x90
55#define IFD_TOWITOKO_KARTENZWERG 0x80
56#define IFD_TOWITOKO_KARTENZWERG_II 0x64
57#define IFD_TOWITOKO_CHIPDRIVE_MICRO 0x61
58#define IFD_TOWITOKO_MULTICAM 0x21
59#define IFD_TOWITOKO_UNKNOWN 0x00
60
61/* Card status */
62#define IFD_TOWITOKO_NOCARD_NOCHANGE 0x00
63#define IFD_TOWITOKO_CARD_NOCHANGE 0x40
64#define IFD_TOWITOKO_NOCARD_CHANGE 0x80
65#define IFD_TOWITOKO_CARD_CHANGE 0xC0
66#define IFD_TOWITOKO_CARD(status) (((status) & 0x40) == 0x40)
67#define IFD_TOWITOKO_CHANGE(status) (((status) & 0x80) == 0x80)
68
69/* Led Color */
70#define IFD_TOWITOKO_LED_OFF 0x00
71#define IFD_TOWITOKO_LED_RED 0x01
72#define IFD_TOWITOKO_LED_GREEN 0x02
73#define IFD_TOWITOKO_LED_YELLOW 0x03
74
75/* IFD parity */
76//#define IFD_TOWITOKO_PARITY_ODD 0x80
77//#define IFD_TOWITOKO_PARITY_EVEN 0x40
78#define IFD_TOWITOKO_PARITY_ODD 1
79#define IFD_TOWITOKO_PARITY_EVEN 2
80#define IFD_TOWITOKO_PARITY_NONE 3
81
82/* ICC types */
83#define IFD_TOWITOKO_I2C_SHORT 0
84#define IFD_TOWITOKO_I2C_LONG 1
85#define IFD_TOWITOKO_2W 2
86#define IFD_TOWITOKO_3W 3
87#define IFD_TOWITOKO_ASYNC 4
88
89/* Maximum size of Pin */
90#define IFD_TOWITOKO_PIN_SIZE 3
91
92/*
93 * Exported Datatypes
94 */
95
96typedef struct
97{
98 unsigned block_delay; /* Delay (ms) after starting to transmit */
99 unsigned char_delay; /* Delay (ms) after transmiting sucesive chars */
100 unsigned block_timeout; /* Max timeout (ms) to receive firtst char */
101 unsigned char_timeout; /* Max timeout (ms) to receive sucesive characters */
102}
103IFD_Timings;
104
105/* Interface Device Handler */
106typedef struct
107{
108 IO_Serial *io; /* Handle of serial device */
109 BYTE slot; /* Chipdrive Twin Slot */
110 BYTE type; /* Reader type code */
111 BYTE firmware; /* Reader firmware version */
112}
113IFD_Towitoko;
114
115typedef IFD_Towitoko IFD;
116
117/*
118 * Exported functions declaration
119 */
120
121/* Create and Delete an IFD */
122extern IFD *IFD_Towitoko_New (void);
123extern void IFD_Towitoko_Delete (IFD * ifd);
124
125/* Handling of the drive associated with this IFD */
126extern int IFD_Towitoko_Init (IFD * ifd, IO_Serial * io, BYTE slot);
127extern int IFD_Towitoko_Close (IFD * ifd);
128
129/* Handling of this IFD */
130extern int IFD_Towitoko_SetBaudrate (IFD * ifd, unsigned long baudrate);
131extern int IFD_Towitoko_GetBaudrate (IFD * ifd, unsigned long *baudrate);
132extern int IFD_Towitoko_SetParity (IFD * ifd, BYTE parity);
133extern int IFD_Towitoko_SetLED ();
134
135/* General handling of ICC inserted in this IFD */
136extern int IFD_Towitoko_ActivateICC (IFD * ifd);
137extern int IFD_Towitoko_DeactivateICC (IFD * ifd);
138
139/* Asynchronous ICC handling functions */
140extern int IFD_Towitoko_ResetAsyncICC (IFD * ifd, ATR ** atr);
141
142/* Atributes of the drive associated with this IFD */
143extern BYTE IFD_Towitoko_GetType (IFD * ifd);
144extern BYTE IFD_Towitoko_GetFirmware (IFD * ifd);
145extern unsigned IFD_Towitoko_GetNumSlots ();
146extern unsigned long IFD_Towitoko_GetMaxBaudrate ();
147extern void IFD_Towitoko_GetDescription (IFD * ifd, BYTE * desc, unsigned length);
148
149/* Atributes of this IFD */
150extern BYTE IFD_Towitoko_GetSlot (IFD * ifd);
151
152#endif /* _IFD_TOWITOKO_ */
Note: See TracBrowser for help on using the repository browser.