source: branches/smartreader/csctapi/icc_async.h@ 1271

Last change on this file since 1271 was 1271, checked in by rorothetroll, 13 years ago

resync with trunk

File size: 3.2 KB
Line 
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 "defines.h"
29#include "atr.h"
30
31/*
32 * Exported constants definition
33 */
34
35/* Return codes */
36#define ICC_ASYNC_OK 0
37#define ICC_ASYNC_IFD_ERROR 1
38#define ICC_ASYNC_ATR_ERROR 2
39
40/* Card status */
41#define IFD_TOWITOKO_NOCARD_NOCHANGE 0x00
42#define IFD_TOWITOKO_CARD_NOCHANGE 0x40
43#define IFD_TOWITOKO_NOCARD_CHANGE 0x80
44#define IFD_TOWITOKO_CARD_CHANGE 0xC0
45#define IFD_TOWITOKO_CARD(status) (((status) & 0x40) == 0x40)
46#define IFD_TOWITOKO_CHANGE(status) (((status) & 0x80) == 0x80)
47
48/*
49 * Exported types definition
50 */
51
52typedef struct
53{
54 unsigned block_delay; /* Delay (ms) after starting to transmit */
55 unsigned char_delay; /* Delay (ms) after transmiting each sucesive char*/
56 unsigned block_timeout; /* Max timeout (ms) to receive first char */
57 unsigned char_timeout; /* Max timeout (ms) to receive sucesive characters */
58}
59ICC_Async_Timings;
60
61typedef struct
62{
63 ATR *atr; /* Answer to reset of this ICC */
64 int convention; /* Convention of this ICC */
65 unsigned long baudrate; /* Current baudrate (bps) for transmiting to this ICC */
66 ICC_Async_Timings timings; /* Current timings for transmiting to this ICC */
67 BYTE protocol_type; /* Type of protocol */
68}
69ICC_Async;
70
71/*
72 * Exported functions declaration
73 */
74
75/* Creation and Deletion */
76extern ICC_Async * ICC_Async_New (void);
77extern void ICC_Async_Delete (ICC_Async * icc);
78
79/* Initialization and Deactivation */
80extern int ICC_Async_Init (ICC_Async * icc);
81extern int ICC_Async_Close (ICC_Async * icc);
82
83/* Attributes */
84extern int ICC_Async_SetTimings (ICC_Async * icc, ICC_Async_Timings * timings);
85extern int ICC_Async_GetTimings (ICC_Async * icc, ICC_Async_Timings * timings);
86extern int ICC_Async_SetBaudrate (ICC_Async * icc, unsigned long baudrate);
87extern int ICC_Async_GetBaudrate (ICC_Async * icc, unsigned long * baudrate);
88extern ATR *ICC_Async_GetAtr (ICC_Async * icc);
89extern unsigned long ICC_Async_GetClockRate ();
90
91/* Operations */
92extern int ICC_Async_Transmit (ICC_Async * icc, unsigned size, BYTE * buffer);
93extern int ICC_Async_Receive (ICC_Async * icc, unsigned size, BYTE * buffer);
94
95#endif /* _ICC_ASYNC_ */
96
Note: See TracBrowser for help on using the repository browser.