1 | /*
|
---|
2 | icc_async.h
|
---|
3 | Asynchronous integrated circuit cards handling functions
|
---|
4 |
|
---|
5 | This file is part of the Unix driver for Towitoko smartcard readers
|
---|
6 | Copyright (C) 2000 2001 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 _ICC_ASYNC_
|
---|
26 | #define _ICC_ASYNC_
|
---|
27 |
|
---|
28 | #include "atr.h"
|
---|
29 | #include "icc_async_exports.h"
|
---|
30 |
|
---|
31 | /*
|
---|
32 | * Exported constants definition
|
---|
33 | */
|
---|
34 |
|
---|
35 | /* Return codes */
|
---|
36 | #ifdef OS_CYGWIN32
|
---|
37 | #undef Ok
|
---|
38 | #undef ERROR
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #define OK 0
|
---|
42 | #define ERROR 1
|
---|
43 |
|
---|
44 | #define ATR_TIMEOUT 1000
|
---|
45 | #define DEFAULT_BAUDRATE 9600
|
---|
46 |
|
---|
47 | /*
|
---|
48 | * Exported types definition
|
---|
49 | */
|
---|
50 |
|
---|
51 | //declare locking stuff for sc8in1 reader
|
---|
52 | static pthread_mutex_t sc8in1_lock; //semaphore for SC8in1, FIXME should not be global, but one per SC8in1
|
---|
53 |
|
---|
54 | /* Initialization and Deactivation */
|
---|
55 | int32_t ICC_Async_Activate (struct s_reader *reader, ATR * newatr, uint16_t deprecated);
|
---|
56 | int32_t ICC_Async_Close (struct s_reader *reader);
|
---|
57 | int32_t ICC_Async_Device_Init (struct s_reader *reader);
|
---|
58 |
|
---|
59 | /* Attributes */
|
---|
60 | int32_t ICC_Async_SetTimings (struct s_reader * reader, uint32_t wait_etu);
|
---|
61 | int32_t ICC_Async_GetStatus (struct s_reader *reader, int32_t * has_card);
|
---|
62 |
|
---|
63 |
|
---|
64 | /* Operations */
|
---|
65 | int32_t ICC_Async_CardWrite (struct s_reader *reader, unsigned char *cmd, uint16_t lc, unsigned char *rsp, uint16_t *lr);
|
---|
66 | int32_t ICC_Async_Transmit (struct s_reader *reader, uint32_t size, BYTE * buffer);
|
---|
67 | int32_t ICC_Async_Receive (struct s_reader *reader, uint32_t size, BYTE * buffer);
|
---|
68 |
|
---|
69 | #endif /* _ICC_ASYNC_ */
|
---|
70 |
|
---|