- serial mouse support prepared (TODO: redirect mouse data to serial port)

This commit is contained in:
Volker Ruppert 2004-11-27 10:09:41 +00:00
parent 5213e903bd
commit 24cb20a563
3 changed files with 66 additions and 46 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.17 2004-11-06 10:50:02 vruppert Exp $ // $Id: config.cc,v 1.18 2004-11-27 10:09:26 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -865,6 +865,7 @@ void bx_init_options ()
"file", "file",
"term", "term",
"raw", "raw",
"mouse",
NULL NULL
}; };

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: serial.cc,v 1.57 2004-09-05 21:09:46 vruppert Exp $ // $Id: serial.cc,v 1.58 2004-11-27 10:09:27 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2004 MandrakeSoft S.A. // Copyright (C) 2004 MandrakeSoft S.A.
@ -261,6 +261,8 @@ bx_serial_c::init(void)
#else #else
BX_PANIC(("raw serial support not present")); BX_PANIC(("raw serial support not present"));
#endif #endif
} else if (!strcmp(mode, "mouse")) {
BX_SER_THIS s[i].io_mode = BX_SER_MODE_MOUSE;
} else if (strcmp(mode, "null")) { } else if (strcmp(mode, "null")) {
BX_PANIC(("unknown serial i/o mode")); BX_PANIC(("unknown serial i/o mode"));
} }
@ -564,6 +566,7 @@ bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
bx_bool new_b0, new_b1, new_b2, new_b3; bx_bool new_b0, new_b1, new_b2, new_b3;
bx_bool new_b4, new_b5, new_b6, new_b7; bx_bool new_b4, new_b5, new_b6, new_b7;
bx_bool gen_int = 0; bx_bool gen_int = 0;
bx_bool detect_mouse = 0;
Bit8u offset, new_wordlen; Bit8u offset, new_wordlen;
#if USE_RAW_SERIAL #if USE_RAW_SERIAL
bx_bool mcr_changed = 0; bx_bool mcr_changed = 0;
@ -801,6 +804,9 @@ bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
break; break;
case BX_SER_MCR: /* MODEM control register */ case BX_SER_MCR: /* MODEM control register */
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_MOUSE) {
detect_mouse = (new_b0 & new_b1);
}
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) { if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
#if USE_RAW_SERIAL #if USE_RAW_SERIAL
mcr_changed = (BX_SER_THIS s[port].modem_cntl.dtr != new_b0) | mcr_changed = (BX_SER_THIS s[port].modem_cntl.dtr != new_b0) |
@ -874,6 +880,9 @@ bx_serial_c::write(Bit32u address, Bit32u value, unsigned io_len)
} }
raise_interrupt(port, BX_SER_INT_MODSTAT); raise_interrupt(port, BX_SER_INT_MODSTAT);
} else { } else {
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_MOUSE) {
if (detect_mouse) rx_fifo_enq(port, 'M');
}
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) { if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) {
#if USE_RAW_SERIAL #if USE_RAW_SERIAL
if (mcr_changed) { if (mcr_changed) {
@ -1008,6 +1017,9 @@ bx_serial_c::tx_timer(void)
BX_SER_THIS s[port].raw->transmit(BX_SER_THIS s[port].tsrbuffer); BX_SER_THIS s[port].raw->transmit(BX_SER_THIS s[port].tsrbuffer);
#endif #endif
break; break;
case BX_SER_MODE_MOUSE:
BX_INFO(("com%d: write to mouse ignored: 0x%02x", port+1, BX_SER_THIS s[port].tsrbuffer));
break;
} }
} }
@ -1084,7 +1096,8 @@ bx_serial_c::rx_timer(void)
} }
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)) {
if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_RAW) { switch (BX_SER_THIS s[port].io_mode) {
case BX_SER_MODE_RAW:
#if USE_RAW_SERIAL #if USE_RAW_SERIAL
int data; int data;
if ((data_ready = BX_SER_THIS s[port].raw->ready_receive())) { if ((data_ready = BX_SER_THIS s[port].raw->ready_receive())) {
@ -1125,7 +1138,8 @@ bx_serial_c::rx_timer(void)
chbuf = data; chbuf = data;
} }
#endif #endif
} else if (BX_SER_THIS s[port].io_mode == BX_SER_MODE_TERM) { break;
case BX_SER_MODE_TERM:
#if BX_HAVE_SELECT && defined(SERIAL_ENABLE) #if 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);
@ -1133,6 +1147,10 @@ bx_serial_c::rx_timer(void)
data_ready = 1; data_ready = 1;
} }
#endif #endif
break;
case BX_SER_MODE_MOUSE:
// TODO: get data from mouse queue
break;
} }
if (data_ready) { if (data_ready) {
if (!BX_SER_THIS s[port].modem_cntl.local_loopback) { if (!BX_SER_THIS s[port].modem_cntl.local_loopback) {

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: serial.h,v 1.22 2004-09-11 15:39:52 vruppert Exp $ // $Id: serial.h,v 1.23 2004-11-27 10:09:41 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2004 MandrakeSoft S.A. // Copyright (C) 2004 MandrakeSoft S.A.
@ -66,6 +66,7 @@ extern "C" {
#define BX_SER_MODE_FILE 1 #define BX_SER_MODE_FILE 1
#define BX_SER_MODE_TERM 2 #define BX_SER_MODE_TERM 2
#define BX_SER_MODE_RAW 3 #define BX_SER_MODE_RAW 3
#define BX_SER_MODE_MOUSE 4
enum { enum {
BX_SER_INT_IER, BX_SER_INT_IER,