- fixed compilation error with raw serial enabled

- removed unnecessary spaces
This commit is contained in:
Volker Ruppert 2007-11-03 16:47:49 +00:00
parent cc80157a94
commit c73f262dc3
2 changed files with 33 additions and 47 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: serial_raw.cc,v 1.20 2006-03-07 21:11:19 sshwarts Exp $ // $Id: serial_raw.cc,v 1.21 2007-11-03 16:47:49 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2004 MandrakeSoft S.A. // Copyright (C) 2004 MandrakeSoft S.A.
@ -43,7 +43,7 @@
DWORD WINAPI RawSerialThread(VOID *this_ptr); DWORD WINAPI RawSerialThread(VOID *this_ptr);
#endif #endif
serial_raw::serial_raw(char *devname) serial_raw::serial_raw(const char *devname)
{ {
#ifdef WIN32 #ifdef WIN32
char portstr[MAX_PATH]; char portstr[MAX_PATH];
@ -96,7 +96,7 @@ serial_raw::serial_raw(char *devname)
rxdata_count = 0; rxdata_count = 0;
} }
serial_raw::~serial_raw (void) serial_raw::~serial_raw(void)
{ {
if (present) { if (present) {
#ifdef WIN32 #ifdef WIN32
@ -113,8 +113,7 @@ serial_raw::~serial_raw (void)
} }
} }
void void serial_raw::set_baudrate(int rate)
serial_raw::set_baudrate (int rate)
{ {
BX_DEBUG (("set_baudrate %d", rate)); BX_DEBUG (("set_baudrate %d", rate));
#ifdef WIN32 #ifdef WIN32
@ -136,8 +135,7 @@ serial_raw::set_baudrate (int rate)
#endif #endif
} }
void void serial_raw::set_data_bits(int val)
serial_raw::set_data_bits (int val)
{ {
BX_DEBUG (("set data bits (%d)", val)); BX_DEBUG (("set data bits (%d)", val));
#ifdef WIN32 #ifdef WIN32
@ -146,8 +144,7 @@ serial_raw::set_data_bits (int val)
#endif #endif
} }
void void serial_raw::set_stop_bits(int val)
serial_raw::set_stop_bits (int val)
{ {
BX_DEBUG (("set stop bits (%d)", val)); BX_DEBUG (("set stop bits (%d)", val));
#ifdef WIN32 #ifdef WIN32
@ -162,8 +159,7 @@ serial_raw::set_stop_bits (int val)
#endif #endif
} }
void void serial_raw::set_parity_mode(int mode)
serial_raw::set_parity_mode (int mode)
{ {
BX_DEBUG (("set parity mode %d", mode)); BX_DEBUG (("set parity mode %d", mode));
#ifdef WIN32 #ifdef WIN32
@ -193,8 +189,7 @@ serial_raw::set_parity_mode (int mode)
#endif #endif
} }
void void serial_raw::set_break(int mode)
serial_raw::set_break (int mode)
{ {
BX_DEBUG (("set break %s", mode?"on":"off")); BX_DEBUG (("set break %s", mode?"on":"off"));
#ifdef WIN32 #ifdef WIN32
@ -206,8 +201,7 @@ serial_raw::set_break (int mode)
#endif #endif
} }
void void serial_raw::set_modem_control(int ctrl)
serial_raw::set_modem_control (int ctrl)
{ {
BX_DEBUG (("set modem control 0x%02x", ctrl)); BX_DEBUG (("set modem control 0x%02x", ctrl));
#ifdef WIN32 #ifdef WIN32
@ -216,8 +210,7 @@ serial_raw::set_modem_control (int ctrl)
#endif #endif
} }
int int serial_raw::get_modem_status()
serial_raw::get_modem_status ()
{ {
int status = 0; int status = 0;
@ -228,8 +221,7 @@ serial_raw::get_modem_status ()
return status; return status;
} }
void void serial_raw::setup_port()
serial_raw::setup_port ()
{ {
#ifdef WIN32 #ifdef WIN32
DWORD DErr; DWORD DErr;
@ -248,8 +240,7 @@ serial_raw::setup_port ()
#endif #endif
} }
void void serial_raw::transmit(Bit8u byte)
serial_raw::transmit (Bit8u byte)
{ {
#ifdef WIN32 #ifdef WIN32
DWORD DErr, Len2; DWORD DErr, Len2;
@ -280,15 +271,13 @@ serial_raw::transmit (Bit8u byte)
} }
} }
bx_bool bx_bool serial_raw::ready_transmit()
serial_raw::ready_transmit ()
{ {
BX_DEBUG (("ready_transmit returning %d", present)); BX_DEBUG (("ready_transmit returning %d", present));
return present; return present;
} }
bx_bool bx_bool serial_raw::ready_receive()
serial_raw::ready_receive ()
{ {
#ifdef WIN32_RECEIVE_RAW #ifdef WIN32_RECEIVE_RAW
if ((rxdata_count == 0) && (thread_rxdata_count > 0)) { if ((rxdata_count == 0) && (thread_rxdata_count > 0)) {
@ -300,8 +289,7 @@ serial_raw::ready_receive ()
return (rxdata_count > 0); return (rxdata_count > 0);
} }
int int serial_raw::receive()
serial_raw::receive ()
{ {
#ifdef WIN32 #ifdef WIN32
int data; int data;
@ -365,8 +353,7 @@ DWORD WINAPI RawSerialThread(VOID *this_ptr)
return 0; return 0;
} }
void void serial_raw::serial_thread()
serial_raw::serial_thread ()
{ {
DWORD DErr, Len2; DWORD DErr, Len2;
DWORD EvtMask, MSR, Temp; DWORD EvtMask, MSR, Temp;
@ -485,8 +472,7 @@ serial_raw::serial_thread ()
thread_active = FALSE; thread_active = FALSE;
} }
void void serial_raw::enq_event(Bit16s event)
serial_raw::enq_event (Bit16s event)
{ {
if (thread_rxdata_count < THREAD_RX_BUFSIZE) { if (thread_rxdata_count < THREAD_RX_BUFSIZE) {
thread_rxdata_buffer[thread_rxdata_count++] = event; thread_rxdata_buffer[thread_rxdata_count++] = event;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: serial_raw.h,v 1.12 2006-03-07 21:11:19 sshwarts Exp $ // $Id: serial_raw.h,v 1.13 2007-11-03 16:47:49 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
@ -38,27 +38,27 @@
class serial_raw : public logfunctions { class serial_raw : public logfunctions {
public: public:
serial_raw (char *devname); serial_raw(const char *devname);
virtual ~serial_raw (); virtual ~serial_raw();
void set_baudrate (int rate); void set_baudrate(int rate);
void set_data_bits (int ); void set_data_bits(int);
void set_stop_bits (int); void set_stop_bits(int);
void set_parity_mode (int mode); void set_parity_mode(int mode);
void set_break (int mode); void set_break(int mode);
void set_modem_control (int ctrl); void set_modem_control(int ctrl);
int get_modem_status (); int get_modem_status();
void transmit (Bit8u byte); void transmit(Bit8u byte);
bx_bool ready_transmit (); bx_bool ready_transmit();
bx_bool ready_receive (); bx_bool ready_receive();
int receive (); int receive ();
#ifdef WIN32_RECEIVE_RAW #ifdef WIN32_RECEIVE_RAW
void serial_thread (); void serial_thread();
#endif #endif
private: private:
void setup_port (); void setup_port();
#ifdef WIN32_RECEIVE_RAW #ifdef WIN32_RECEIVE_RAW
void enq_event (Bit16s event); void enq_event(Bit16s event);
#endif #endif
bx_bool present; bx_bool present;
unsigned rxdata_count; unsigned rxdata_count;