/* Serial interface for local (hardwired) serial ports on Un*x like systems
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2003,
+ 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GDB.
#include <sys/socket.h>
#include <sys/time.h>
+#include "gdb_select.h"
#include "gdb_string.h"
+#include "gdbcmd.h"
#ifdef HAVE_TERMIOS
{
struct termios termios;
};
+
+#ifdef CRTSCTS
+/* Boolean to explicitly enable or disable h/w flow control. */
+static int serial_hwflow;
+static void
+show_serial_hwflow (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("Hardware flow control is %s.\n"), value);
+}
+#endif
+
#endif /* termios */
#ifdef HAVE_TERMIO
the full length of time. I think that is OK. */
timeout.tv_sec = 0;
timeout.tv_usec = 250000;
- select (0, 0, 0, 0, &timeout);
+ gdb_select (0, 0, 0, 0, &timeout);
status = ioctl (scb->fd, TIOCCBRK, 0);
return status;
}
state.termios.c_lflag = 0;
state.termios.c_cflag &= ~(CSIZE | PARENB);
state.termios.c_cflag |= CLOCAL | CS8;
+#ifdef CRTSCTS
+ /* h/w flow control. */
+ if (serial_hwflow)
+ state.termios.c_cflag |= CRTSCTS;
+ else
+ state.termios.c_cflag &= ~CRTSCTS;
+#ifdef CRTS_IFLOW
+ if (serial_hwflow)
+ state.termios.c_cflag |= CRTS_IFLOW;
+ else
+ state.termios.c_cflag &= ~CRTS_IFLOW;
+#endif
+#endif
state.termios.c_cc[VMIN] = 0;
state.termios.c_cc[VTIME] = 0;
#endif
FD_SET (scb->fd, &readfds);
if (timeout >= 0)
- numfds = select (scb->fd + 1, &readfds, 0, 0, &tv);
+ numfds = gdb_select (scb->fd + 1, &readfds, 0, 0, &tv);
else
- numfds = select (scb->fd + 1, &readfds, 0, 0, 0);
+ numfds = gdb_select (scb->fd + 1, &readfds, 0, 0, 0);
if (numfds <= 0)
if (numfds == 0)
ops->read_prim = ser_unix_read_prim;
ops->write_prim = ser_unix_write_prim;
serial_add_interface (ops);
+
+#ifdef HAVE_TERMIOS
+#ifdef CRTSCTS
+ add_setshow_boolean_cmd ("remoteflow", no_class,
+ &serial_hwflow, _("\
+Set use of hardware flow control for remote serial I/O."), _("\
+Show use of hardware flow control for remote serial I/O."), _("\
+Enable or disable hardware flow control (RTS/CTS) on the serial port\n\
+when debugging using remote targets."),
+ NULL,
+ show_serial_hwflow,
+ &setlist, &showlist);
+#endif
+#endif
}
int