- cleaned up rx_timer() (raw serial support doesn't need the select function

This commit is contained in:
Volker Ruppert 2004-03-13 17:17:16 +00:00
parent 967297b8a4
commit 8a9b4a1429

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: serial.cc,v 1.51 2004-03-09 22:17:33 vruppert Exp $ // $Id: serial.cc,v 1.52 2004-03-13 17:17:16 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2004 MandrakeSoft S.A. // Copyright (C) 2004 MandrakeSoft S.A.
@ -978,11 +978,9 @@ bx_serial_c::rx_timer_handler(void *this_ptr)
void void
bx_serial_c::rx_timer(void) bx_serial_c::rx_timer(void)
{ {
#if BX_HAVE_SELECT #if BX_HAVE_SELECT && defined(SERIAL_ENABLE)
#ifndef __BEOS__
struct timeval tval; struct timeval tval;
fd_set fds; fd_set fds;
#endif
#endif #endif
Bit8u port = 0; Bit8u port = 0;
int timer_id; int timer_id;
@ -1000,8 +998,7 @@ bx_serial_c::rx_timer(void)
int bdrate = BX_SER_THIS s[port].baudrate / (BX_SER_THIS s[port].line_cntl.wordlen_sel + 5); int bdrate = BX_SER_THIS s[port].baudrate / (BX_SER_THIS s[port].line_cntl.wordlen_sel + 5);
unsigned char chbuf = 0; unsigned char chbuf = 0;
#if BX_HAVE_SELECT #if BX_HAVE_SELECT && defined(SERIAL_ENABLE)
#ifndef __BEOS__
tval.tv_sec = 0; tval.tv_sec = 0;
tval.tv_usec = 0; tval.tv_usec = 0;
@ -1012,6 +1009,7 @@ bx_serial_c::rx_timer(void)
FD_ZERO(&fds); FD_ZERO(&fds);
if (BX_SER_THIS s[port].tty_id >= 0) FD_SET(BX_SER_THIS s[port].tty_id, &fds); if (BX_SER_THIS s[port].tty_id >= 0) FD_SET(BX_SER_THIS s[port].tty_id, &fds);
#endif
if ((BX_SER_THIS s[port].line_status.rxdata_ready == 0) || if ((BX_SER_THIS s[port].line_status.rxdata_ready == 0) ||
(BX_SER_THIS s[port].fifo_cntl.enable)) { (BX_SER_THIS s[port].fifo_cntl.enable)) {
@ -1028,7 +1026,7 @@ bx_serial_c::rx_timer(void)
} }
if (rdy) { if (rdy) {
chbuf = data; chbuf = data;
#elif defined(SERIAL_ENABLE) #elif BX_HAVE_SELECT && defined(SERIAL_ENABLE)
if ((BX_SER_THIS s[port].tty_id >= 0) && (select(BX_SER_THIS s[port].tty_id + 1, &fds, NULL, NULL, &tval) == 1)) { if ((BX_SER_THIS s[port].tty_id >= 0) && (select(BX_SER_THIS s[port].tty_id + 1, &fds, NULL, NULL, &tval) == 1)) {
(void) read(BX_SER_THIS s[port].tty_id, &chbuf, 1); (void) read(BX_SER_THIS s[port].tty_id, &chbuf, 1);
BX_DEBUG(("com%d: read: '%c'", port+1, chbuf)); BX_DEBUG(("com%d: read: '%c'", port+1, chbuf));
@ -1048,8 +1046,6 @@ bx_serial_c::rx_timer(void)
// be read // be read
bdrate *= 4; bdrate *= 4;
} }
#endif
#endif
bx_pc_system.activate_timer(BX_SER_THIS s[port].rx_timer_index, bx_pc_system.activate_timer(BX_SER_THIS s[port].rx_timer_index,
(int) (1000000.0 / bdrate), (int) (1000000.0 / bdrate),