From 1ae66aeeb6960c00ad63e37a9b4ee5f32b07a243 Mon Sep 17 00:00:00 2001 From: Bryce Denney Date: Sat, 16 Jun 2001 19:27:41 +0000 Subject: [PATCH] - added empty stubs for serial_raw. To try it out, define USE_RAW_SERIAL in config.h and add serial_raw.o to the makefile in the iodev directory. --- bochs/config.h.in | 2 + bochs/iodev/serial.h | 6 +-- bochs/iodev/serial_raw.cc | 89 +++++++++++++++++++++++++++++++++++++++ bochs/iodev/serial_raw.h | 19 +++++++++ 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 bochs/iodev/serial_raw.cc create mode 100644 bochs/iodev/serial_raw.h diff --git a/bochs/config.h.in b/bochs/config.h.in index 77371c5c4..b28038ae0 100644 --- a/bochs/config.h.in +++ b/bochs/config.h.in @@ -229,6 +229,8 @@ #define BX_SOUND_OUTPUT_C bx_sound_output_c #endif +#define USE_RAW_SERIAL 0 + #define BX_USE_SPECIFIED_TIME0 0 // This enables writing to port 0xe9 and the output diff --git a/bochs/iodev/serial.h b/bochs/iodev/serial.h index de340a1dc..d76f183ea 100644 --- a/bochs/iodev/serial.h +++ b/bochs/iodev/serial.h @@ -144,6 +144,9 @@ public: bx_serial_c(void); ~bx_serial_c(void); BX_SER_SMF void init(bx_devices_c *); +#if USE_RAW_SERIAL + serial_raw* raw; +#endif // USE_RAW_SERIAL private: bx_serial_t s[BX_SERIAL_MAXDEV]; @@ -162,9 +165,6 @@ private: Bit32u read(Bit32u address, unsigned io_len); void write(Bit32u address, Bit32u value, unsigned io_len); #endif -#if USE_RAW_SERIAL - serial_raw* raw; -#endif // USE_RAW_SERIAL }; diff --git a/bochs/iodev/serial_raw.cc b/bochs/iodev/serial_raw.cc new file mode 100644 index 000000000..fd28bdce0 --- /dev/null +++ b/bochs/iodev/serial_raw.cc @@ -0,0 +1,89 @@ +// Copyright (C) 2001 MandrakeSoft S.A. +// +// MandrakeSoft S.A. +// 43, rue d'Aboukir +// 75002 Paris - France +// http://www.linux-mandrake.com/ +// http://www.mandrakesoft.com/ +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#include "bochs.h" +#define LOG_THIS bx_serial. + +serial_raw::serial_raw (char *ttypath, int signal) +{ + setprefix ("[SERR]"); + settype (SERRLOG); +} + +void +serial_raw::set_baudrate (int rate) +{ + BX_DEBUG (("set_baudrate %d", rate)); +} + +void +serial_raw::set_data_bits (int val) +{ + BX_DEBUG (("set data bits (%d)", val)); +} + +void +serial_raw::set_stop_bits (int val) +{ + BX_DEBUG (("set stop bits (%d)", val)); +} + +void +serial_raw::set_parity_mode (int x, int y) +{ + BX_DEBUG (("set parity %d %d", x, y)); +} + +void +serial_raw::transmit (int val) +{ + BX_DEBUG (("transmit %d", val)); +} + +void +serial_raw::send_hangup () +{ + BX_DEBUG (("send_hangup")); +} + +int +serial_raw::ready_transmit () +{ + BX_DEBUG (("ready_transmit returning 1")); + return 1; +} + +int +serial_raw::ready_receive () +{ + BX_DEBUG (("ready_receive returning 0")); + return 0; +} + +int +serial_raw::receive () +{ + BX_DEBUG (("receive returning 0")); + return (int)'A'; +} + diff --git a/bochs/iodev/serial_raw.h b/bochs/iodev/serial_raw.h new file mode 100644 index 000000000..973a206d8 --- /dev/null +++ b/bochs/iodev/serial_raw.h @@ -0,0 +1,19 @@ +#include + +#define P_EVEN 0 +#define P_ODD 1 +#define C_BREAK 201 + +class serial_raw : public logfunctions { + public: + serial_raw (char *ttypath, int signal); + void set_baudrate (int rate); + void set_data_bits (int ); + void set_stop_bits (int); + void set_parity_mode (int, int); + void transmit (int byte); + void send_hangup (); + int ready_transmit (); + int ready_receive (); + int receive (); +};