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: directserial.h,v 1.2 2009-09-26 09:15:19 h-a-l-9000 Exp $ */ 20 21 // include guard 22 #ifndef DOSBOX_DIRECTSERIAL_WIN32_H 23 #define DOSBOX_DIRECTSERIAL_WIN32_H 24 25 #include "dosbox.h" 26 27 #if C_DIRECTSERIAL 28 29 #define DIRECTSERIAL_AVAILIBLE 30 #include "serialport.h" 31 32 #include "libserial.h" 33 34 class CDirectSerial : public CSerial { 35 public: 36 CDirectSerial(Bitu id, CommandLine* cmd); 37 ~CDirectSerial(); 38 39 void updatePortConfig(Bit16u divider, Bit8u lcr); 40 void updateMSR(); 41 void transmitByte(Bit8u val, bool first); 42 void setBreak(bool value); 43 44 void setRTSDTR(bool rts, bool dtr); 45 void setRTS(bool val); 46 void setDTR(bool val); 47 void handleUpperEvent(Bit16u type); 48 49 private: 50 COMPORT comport; 51 52 Bitu rx_state; 53 #define D_RX_IDLE 0 54 #define D_RX_WAIT 1 55 #define D_RX_BLOCKED 2 56 #define D_RX_FASTWAIT 3 57 58 Bitu rx_retry; // counter of retries (every millisecond) 59 Bitu rx_retry_max; // how many POLL_EVENTS to wait before causing 60 // an overrun error. 61 bool doReceive(); 62 63 #if SERIAL_DEBUG 64 bool dbgmsg_poll_block; 65 bool dbgmsg_rx_block; 66 #endif 67 68 }; 69 70 #endif // C_DIRECTSERIAL 71 #endif // include guard 72