DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/hardware/serialport/libserial.h
00001 /*
00002  *  Copyright (C) 2002-2013  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 
00020 typedef struct _COMPORT *COMPORT;
00021 
00022 bool SERIAL_open(const char* portname, COMPORT* port);
00023 void SERIAL_close(COMPORT port);
00024 void SERIAL_getErrorString(char* buffer, int length);
00025 
00026 #define SERIAL_1STOP 1
00027 #define SERIAL_2STOP 2
00028 #define SERIAL_15STOP 0
00029 
00030 // parity: n, o, e, m, s
00031 
00032 bool SERIAL_setCommParameters(COMPORT port,
00033                         int baudrate, char parity, int stopbits, int length);
00034 
00035 void SERIAL_setDTR(COMPORT port, bool value);
00036 void SERIAL_setRTS(COMPORT port, bool value);
00037 void SERIAL_setBREAK(COMPORT port, bool value);
00038 
00039 #define SERIAL_CTS 0x10
00040 #define SERIAL_DSR 0x20
00041 #define SERIAL_RI 0x40
00042 #define SERIAL_CD 0x80
00043 
00044 int SERIAL_getmodemstatus(COMPORT port);
00045 bool SERIAL_setmodemcontrol(COMPORT port, int flags);
00046 
00047 bool SERIAL_sendchar(COMPORT port, char data);
00048 
00049 // 0-7 char data, higher=flags
00050 #define SERIAL_BREAK_ERR 0x10
00051 #define SERIAL_FRAMING_ERR 0x08
00052 #define SERIAL_PARITY_ERR 0x04
00053 #define SERIAL_OVERRUN_ERR 0x02
00054 
00055 int SERIAL_getextchar(COMPORT port);