source: trunk/csctapi/io_serial.h@ 1236

Last change on this file since 1236 was 1236, checked in by dingo35, 11 years ago

New SetParity function in IO_Serial

File size: 3.0 KB
Line 
1/*
2 io_serial.h
3 Serial port input/output definitions
4
5 This file is part of the Unix driver for Towitoko smartcard readers
6 Copyright (C) 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 _IO_SERIAL_
26#define _IO_SERIAL_
27
28#include "defines.h"
29
30//#define IO_Serial_DTR_Set() IO_Serial_DTR_RTS(1, 1)
31//#define IO_Serial_DTR_Clr() IO_Serial_DTR_RTS(1, 0)
32#define IO_Serial_RTS_Set() IO_Serial_DTR_RTS(0, 1)
33#define IO_Serial_RTS_Clr() IO_Serial_DTR_RTS(0, 0)
34/*
35 * Exported constants definition
36 */
37
38/* Type of parity of the serial device */
39#define PARITY_ODD 1
40#define PARITY_EVEN 2
41#define PARITY_NONE 3
42
43/* Values for the modem lines */
44#define IO_SERIAL_HIGH 1
45#define IO_SERIAL_LOW 0
46
47/* Maximum size of PnP Com ID */
48#define IO_SERIAL_PNPID_SIZE 256
49
50/*
51 * Exported datatypes definition
52 */
53
54/* IO_Serial exported datatype */
55typedef struct
56{
57 /* Settings that can be modified */
58 unsigned long input_bitrate;
59 unsigned long output_bitrate;
60 unsigned bits;
61 unsigned stopbits;
62 int parity;
63 int dtr;
64 int rts;
65 /* end settings that can be modified */
66 BYTE PnP_id[IO_SERIAL_PNPID_SIZE]; /* PnP Id of the serial device */
67 unsigned PnP_id_size; /* Length of PnP Id */
68}
69IO_Serial;
70
71int wr; //FIXME should be in ifd_phoenix.c or .h
72
73/*
74 * Exported functions declaration
75 */
76
77/* IO_Serial creation and deletion */
78//extern void IO_Serial_Reopen (IO_Serial * io);
79extern void IO_Serial_Flush ();
80extern IO_Serial *IO_Serial_New (int mhz, int cardmhz);
81extern void IO_Serial_Delete (IO_Serial * io);
82
83/* Initialization and closing */
84extern bool IO_Serial_Init (IO_Serial * io, int reader_type);
85extern bool IO_Serial_Close (IO_Serial * io);
86
87/* Transmission properties */
88extern bool IO_Serial_SetPropertiesOld (IO_Serial * io);
89extern bool IO_Serial_GetPropertiesOld (IO_Serial * io);
90extern bool IO_Serial_DTR_RTS(int, int);
91#if defined(TUXBOX) && defined(PPC)
92extern void IO_Serial_Ioctl_Lock(int);
93#else
94#define IO_Serial_Ioctl_Lock(b) {} //FIXME ugly !!
95#endif
96
97/* Input and output */
98extern bool IO_Serial_Read (unsigned timeout, unsigned size, BYTE * data);
99extern bool IO_Serial_Write (unsigned delay, unsigned size, BYTE * data);
100
101/* Serial port atributes */
102extern void IO_Serial_GetPnPId (IO_Serial * io, BYTE * pnp_id, unsigned *length);
103
104#endif /* IO_SERIAL */
Note: See TracBrowser for help on using the repository browser.