aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-unix.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2007-05-22 10:57:12 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2007-05-22 10:57:12 +0000
commit23776285b76dc215c60997f27ed37f37dbc63165 (patch)
treeecac6677086b1ea40e77ec61b32537a6877aad32 /gdb/ser-unix.c
parent0e9517a90d502269cd2b16ce646580dbb6a79033 (diff)
downloadgdb-23776285b76dc215c60997f27ed37f37dbc63165.zip
gdb-23776285b76dc215c60997f27ed37f37dbc63165.tar.gz
gdb-23776285b76dc215c60997f27ed37f37dbc63165.tar.bz2
gdb/:
* ser-unix.c (show_serial_hwflow): New function. (hardwire_raw): Add hardware flow control support. (_initialize_ser_hardwire): Add "set/show remoteflow". * Makefile.in (ser-unix.o): Depend on $(gdbcmd_h). * NEWS: Document the new command. gdb/doc/: * gdb.texinfo (Remote Configuration): Document "set/show remoteflow".
Diffstat (limited to 'gdb/ser-unix.c')
-rw-r--r--gdb/ser-unix.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index c45bfc6..3a24ac1 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -33,6 +33,7 @@
#include "gdb_select.h"
#include "gdb_string.h"
+#include "gdbcmd.h"
#ifdef HAVE_TERMIOS
@@ -40,6 +41,18 @@ struct hardwire_ttystate
{
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
@@ -387,6 +400,19 @@ hardwire_raw (struct serial *scb)
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
@@ -892,6 +918,20 @@ _initialize_ser_hardwire (void)
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