* ser-unix.c: Add hardware flow control support
@ 2007-03-30 11:55 Maciej W. Rozycki
2007-03-30 12:08 ` Daniel Jacobowitz
2007-03-30 12:26 ` Eli Zaretskii
0 siblings, 2 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2007-03-30 11:55 UTC (permalink / raw)
To: gdb-patches; +Cc: Chris Dearman, Maciej W. Rozycki
Hello,
This is a set of changes to add hardware flow control support to the
serial interface.
2007-03-30 Chris Dearman <chris@mips.com>
Maciej W. Rozycki <macro@mips.com>
* ser-unix.c (show_serial_hwflow): New function.
(hardwire_raw): Add hardware flow control support.
(_initialize_ser_hardwire): Add set/show remoteflow.
OK to apply?
Maciej
12226-0.diff
Index: binutils-quilt/src/gdb/ser-unix.c
===================================================================
--- binutils-quilt.orig/src/gdb/ser-unix.c 2007-03-30 12:36:15.000000000 +0100
+++ binutils-quilt/src/gdb/ser-unix.c 2007-03-30 12:42:31.000000000 +0100
@@ -33,6 +33,7 @@
#include "gdb_select.h"
#include "gdb_string.h"
+#include "gdbcmd.h"
#ifdef HAVE_TERMIOS
@@ -40,6 +41,18 @@
{
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 @@
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 @@
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."), _("\
+This value is used to enable or disable hardware flow control (RTS/CTS) on\n\
+the serial port when debugging using remote targets."),
+ NULL,
+ show_serial_hwflow,
+ &setlist, &showlist);
+#endif
+#endif
}
int
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ser-unix.c: Add hardware flow control support
2007-03-30 11:55 ser-unix.c: Add hardware flow control support Maciej W. Rozycki
@ 2007-03-30 12:08 ` Daniel Jacobowitz
2007-05-02 14:11 ` Maciej W. Rozycki
2007-03-30 12:26 ` Eli Zaretskii
1 sibling, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-03-30 12:08 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: gdb-patches, Chris Dearman, Maciej W. Rozycki
On Fri, Mar 30, 2007 at 12:54:50PM +0100, Maciej W. Rozycki wrote:
> Hello,
>
> This is a set of changes to add hardware flow control support to the
> serial interface.
>
> 2007-03-30 Chris Dearman <chris@mips.com>
> Maciej W. Rozycki <macro@mips.com>
>
> * ser-unix.c (show_serial_hwflow): New function.
> (hardwire_raw): Add hardware flow control support.
> (_initialize_ser_hardwire): Add set/show remoteflow.
>
> OK to apply?
At a minimum this will require documentation for the new command line
option; I would also recomend a NEWS entry. Oh, and you added a
#include, so you need a Makefile update too.
I noticed while looking for the right place to put the option that we
have an empty "set serial". Perhaps it should go under that instead.
No strong preference.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ser-unix.c: Add hardware flow control support
2007-03-30 11:55 ser-unix.c: Add hardware flow control support Maciej W. Rozycki
2007-03-30 12:08 ` Daniel Jacobowitz
@ 2007-03-30 12:26 ` Eli Zaretskii
1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2007-03-30 12:26 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: gdb-patches, chris, macro
> Date: Fri, 30 Mar 2007 12:54:50 +0100 (BST)
> From: "Maciej W. Rozycki" <macro@mips.com>
> cc: Chris Dearman <chris@mips.com>, "Maciej W. Rozycki" <macro@linux-mips.org>
>
> 2007-03-30 Chris Dearman <chris@mips.com>
> Maciej W. Rozycki <macro@mips.com>
>
> * ser-unix.c (show_serial_hwflow): New function.
> (hardwire_raw): Add hardware flow control support.
> (_initialize_ser_hardwire): Add set/show remoteflow.
>
> OK to apply?
Not without a corresponding change to the manual that describes this
new command.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ser-unix.c: Add hardware flow control support
2007-03-30 12:08 ` Daniel Jacobowitz
@ 2007-05-02 14:11 ` Maciej W. Rozycki
2007-05-21 12:22 ` Maciej W. Rozycki
0 siblings, 1 reply; 8+ messages in thread
From: Maciej W. Rozycki @ 2007-05-02 14:11 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, Chris Dearman, Maciej W. Rozycki
On Fri, 30 Mar 2007, Daniel Jacobowitz wrote:
> I noticed while looking for the right place to put the option that we
> have an empty "set serial". Perhaps it should go under that instead.
> No strong preference.
Well, we have "set remotebaud", which is at the top-level as well. And
which actually raises a question as to whether "set remoteflow" should not
be handled through "struct serial_ops" too? This way other serial
interfaces would have a chance to handle the option as well if somebody
cared.
Any opinions?
Maciej
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ser-unix.c: Add hardware flow control support
2007-05-02 14:11 ` Maciej W. Rozycki
@ 2007-05-21 12:22 ` Maciej W. Rozycki
2007-05-21 12:50 ` Daniel Jacobowitz
2007-05-21 20:08 ` Eli Zaretskii
0 siblings, 2 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2007-05-21 12:22 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, Chris Dearman, Maciej W. Rozycki
On Wed, 2 May 2007, Maciej W. Rozycki wrote:
> > I noticed while looking for the right place to put the option that we
> > have an empty "set serial". Perhaps it should go under that instead.
> > No strong preference.
>
> Well, we have "set remotebaud", which is at the top-level as well. And
> which actually raises a question as to whether "set remoteflow" should not
> be handled through "struct serial_ops" too? This way other serial
> interfaces would have a chance to handle the option as well if somebody
> cared.
>
> Any opinions?
OK, I gather there is no potential interest in platform-independent
approach at the moment, so I guess it may be implemented based on
ser-unix.c if a need arises. Here is my current version of the patch.
gdb/:
2007-05-21 Chris Dearman <chris@mips.com>
Maciej W. Rozycki <macro@mips.com>
* 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/:
2007-05-21 Maciej W. Rozycki <macro@mips.com>
* gdb.texinfo (Remote Configuration): Document "set/show
remoteflow".
OK to apply?
Maciej
12226-0.diff
Index: binutils-quilt/src/gdb/ser-unix.c
===================================================================
--- binutils-quilt.orig/src/gdb/ser-unix.c 2007-04-03 16:38:07.000000000 +0100
+++ binutils-quilt/src/gdb/ser-unix.c 2007-04-03 16:49:52.000000000 +0100
@@ -33,6 +33,7 @@
#include "gdb_select.h"
#include "gdb_string.h"
+#include "gdbcmd.h"
#ifdef HAVE_TERMIOS
@@ -40,6 +41,18 @@
{
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 @@
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 @@
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
Index: binutils-quilt/src/gdb/Makefile.in
===================================================================
--- binutils-quilt.orig/src/gdb/Makefile.in 2007-04-03 16:38:53.000000000 +0100
+++ binutils-quilt/src/gdb/Makefile.in 2007-04-03 16:38:53.000000000 +0100
@@ -2595,7 +2595,7 @@
ser-tcp.o: ser-tcp.c $(defs_h) $(serial_h) $(ser_base_h) $(ser_tcp_h) \
$(gdb_string_h)
ser-unix.o: ser-unix.c $(defs_h) $(serial_h) $(ser_base_h) $(ser_unix_h) \
- $(terminal_h) $(gdb_select_h) $(gdb_string_h)
+ $(terminal_h) $(gdb_select_h) $(gdb_string_h) $(gdbcmd_h)
ser-mingw.o: ser-mingw.c $(defs_h) $(serial_h) $(ser_base_h) \
$(ser_tcp_h) $(gdb_assert_h) $(gdb_string_h)
sh3-rom.o: sh3-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
Index: binutils-quilt/src/gdb/NEWS
===================================================================
--- binutils-quilt.orig/src/gdb/NEWS 2007-04-02 13:25:25.000000000 +0100
+++ binutils-quilt/src/gdb/NEWS 2007-04-03 16:49:20.000000000 +0100
@@ -31,6 +31,11 @@
* New commands
+set remoteflow
+show remoteflow
+ Enable or disable hardware flow control (RTS/CTS) on the serial port
+ when debugging using remote targets.
+
set mem inaccessible-by-default
show mem inaccessible-by-default
If the target supplies a memory map, for instance via the remote
Index: binutils-quilt/src/gdb/doc/gdb.texinfo
===================================================================
--- binutils-quilt.orig/src/gdb/doc/gdb.texinfo 2007-04-03 16:38:05.000000000 +0100
+++ binutils-quilt/src/gdb/doc/gdb.texinfo 2007-04-03 17:05:24.000000000 +0100
@@ -12820,6 +12820,14 @@
@item show remotedevice
Show the current name of the serial port.
+@item set remoteflow on
+@itemx set remoteflow off
+Enable or disable hardware flow control (@code{RTS}/@code{CTS})
+on the serial port used to communicate to the remote target.
+
+@item show remoteflow
+Show the current setting of hardware flow control.
+
@item set remotelogbase @var{base}
Set the base (a.k.a.@: radix) of logging serial protocol
communications to @var{base}. Supported values of @var{base} are:
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ser-unix.c: Add hardware flow control support
2007-05-21 12:22 ` Maciej W. Rozycki
@ 2007-05-21 12:50 ` Daniel Jacobowitz
2007-05-21 20:08 ` Eli Zaretskii
1 sibling, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2007-05-21 12:50 UTC (permalink / raw)
To: Maciej W. Rozycki, Eli Zaretskii
Cc: gdb-patches, Chris Dearman, Maciej W. Rozycki
On Mon, May 21, 2007 at 01:21:51PM +0100, Maciej W. Rozycki wrote:
> On Wed, 2 May 2007, Maciej W. Rozycki wrote:
>
> > > I noticed while looking for the right place to put the option that we
> > > have an empty "set serial". Perhaps it should go under that instead.
> > > No strong preference.
> >
> > Well, we have "set remotebaud", which is at the top-level as well. And
> > which actually raises a question as to whether "set remoteflow" should not
> > be handled through "struct serial_ops" too? This way other serial
> > interfaces would have a chance to handle the option as well if somebody
> > cared.
> >
> > Any opinions?
>
> OK, I gather there is no potential interest in platform-independent
> approach at the moment, so I guess it may be implemented based on
> ser-unix.c if a need arises. Here is my current version of the patch.
This is fine with me; Eli, are the documentation changes OK?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ser-unix.c: Add hardware flow control support
2007-05-21 12:22 ` Maciej W. Rozycki
2007-05-21 12:50 ` Daniel Jacobowitz
@ 2007-05-21 20:08 ` Eli Zaretskii
2007-05-22 10:57 ` Maciej W. Rozycki
1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2007-05-21 20:08 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: drow, gdb-patches, chris, macro
> Date: Mon, 21 May 2007 13:21:51 +0100 (BST)
> From: "Maciej W. Rozycki" <macro@mips.com>
> cc: gdb-patches@sourceware.org, Chris Dearman <chris@mips.com>, "Maciej W. Rozycki" <macro@linux-mips.org>
>
> gdb/doc/:
> 2007-05-21 Maciej W. Rozycki <macro@mips.com>
>
> * gdb.texinfo (Remote Configuration): Document "set/show
> remoteflow".
This part is fine, but please add a @kindex index entry for the new
command, as we do in general for every other.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: ser-unix.c: Add hardware flow control support
2007-05-21 20:08 ` Eli Zaretskii
@ 2007-05-22 10:57 ` Maciej W. Rozycki
0 siblings, 0 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2007-05-22 10:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: drow, gdb-patches, chris, macro
On Mon, 21 May 2007, Eli Zaretskii wrote:
> This part is fine, but please add a @kindex index entry for the new
> command, as we do in general for every other.
OK, and this one happens to hit this rule? Applied now with your
suggested changes.
Maciej
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-05-22 10:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-30 11:55 ser-unix.c: Add hardware flow control support Maciej W. Rozycki
2007-03-30 12:08 ` Daniel Jacobowitz
2007-05-02 14:11 ` Maciej W. Rozycki
2007-05-21 12:22 ` Maciej W. Rozycki
2007-05-21 12:50 ` Daniel Jacobowitz
2007-05-21 20:08 ` Eli Zaretskii
2007-05-22 10:57 ` Maciej W. Rozycki
2007-03-30 12:26 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox