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