Debian Codegraph @

src/hardware/serialport/libserial.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 /* $Id: libserial.h,v 1.2 2009-09-26 09:15:19 h-a-l-9000 Exp $ */
20
21 #include <string.h>
22
23 typedef struct _COMPORT *COMPORT;
24
25 bool SERIAL_open(const char* portname, COMPORT* port);
26 void SERIAL_close(COMPORT port);
27 void SERIAL_getErrorString(char* buffer, size_t length);
28
29 #define SERIAL_1STOP 1
30 #define SERIAL_2STOP 2
31 #define SERIAL_15STOP 0
32
33 // parity: n, o, e, m, s
34
35 bool SERIAL_setCommParameters(COMPORT port,
36 int baudrate, char parity, int stopbits, int length);
37
38 void SERIAL_setDTR(COMPORT port, bool value);
39 void SERIAL_setRTS(COMPORT port, bool value);
40 void SERIAL_setBREAK(COMPORT port, bool value);
41
42 #define SERIAL_CTS 0x10
43 #define SERIAL_DSR 0x20
44 #define SERIAL_RI 0x40
45 #define SERIAL_CD 0x80
46
47 int SERIAL_getmodemstatus(COMPORT port);
48 bool SERIAL_setmodemcontrol(COMPORT port, int flags);
49
50 bool SERIAL_sendchar(COMPORT port, char data);
51
52 // 0-7 char data, higher=flags
53 #define SERIAL_BREAK_ERR 0x10
54 #define SERIAL_FRAMING_ERR 0x08
55 #define SERIAL_PARITY_ERR 0x04
56 #define SERIAL_OVERRUN_ERR 0x02
57
58 int SERIAL_getextchar(COMPORT port);