aboutsummaryrefslogtreecommitdiff
path: root/gdb/ser-unix.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1995-03-07 09:03:37 +0000
committerStu Grossman <grossman@cygnus>1995-03-07 09:03:37 +0000
commit85c8b135fe413021e644dbd69a56ae7abe455f2e (patch)
treef034a40857e4f3eff1176ea6664b8967e6674051 /gdb/ser-unix.c
parent7baea9460866303161d1598eddb93a936973ef1d (diff)
downloadgdb-85c8b135fe413021e644dbd69a56ae7abe455f2e.zip
gdb-85c8b135fe413021e644dbd69a56ae7abe455f2e.tar.gz
gdb-85c8b135fe413021e644dbd69a56ae7abe455f2e.tar.bz2
* serial.h ser-go32.c ser-go32-para.c ser-mac.c ser-tcp.c
ser-unix.c: Add SERIAL_SETSTOPBITS to set the number of stopbits (needed for IDP board?!?!?).
Diffstat (limited to 'gdb/ser-unix.c')
-rw-r--r--gdb/ser-unix.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 237384b..55d2a02 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -628,6 +628,51 @@ hardwire_setbaudrate(scb, rate)
}
static int
+hardwire_setstopbits(scb, num)
+ serial_t scb;
+ int num;
+{
+ struct hardwire_ttystate state;
+ int newbit;
+
+ if (get_tty_state(scb, &state))
+ return -1;
+
+ switch (num)
+ {
+ case SERIAL_1_STOPBITS:
+ newbit = 0;
+ break;
+ case SERIAL_1_AND_A_HALF_STOPBITS:
+ case SERIAL_2_STOPBITS:
+ newbit = 1;
+ break;
+ default:
+ return 1;
+ }
+
+#ifdef HAVE_TERMIOS
+ if (!newbit)
+ state.termios.c_cflag &= ~CSTOPB;
+ else
+ state.termios.c_cflag |= CSTOPB; /* two bits */
+#endif
+
+#ifdef HAVE_TERMIO
+ if (!newbit)
+ state.termio.c_cflag &= ~CSTOPB;
+ else
+ state.termio.c_cflag |= CSTOPB; /* two bits */
+#endif
+
+#ifdef HAVE_SGTTY
+ return 0; /* sgtty doesn't support this */
+#endif
+
+ return set_tty_state (scb, &state);
+}
+
+static int
hardwire_write(scb, str, len)
serial_t scb;
const char *str;
@@ -675,6 +720,7 @@ static struct serial_ops hardwire_ops =
hardwire_print_tty_state,
hardwire_noflush_set_tty_state,
hardwire_setbaudrate,
+ hardwire_setstopbits,
};
void