From 236af5e336970a6b58cd17e0a2981bd96f3d09a0 Mon Sep 17 00:00:00 2001 From: Yury Grechishchev Date: Tue, 24 Mar 2015 00:15:42 +0300 Subject: GDB: Add set/show serial parity command. The "set serial parity" command allows the user to control which parity to use when communicating over a serial connection, rather than having the parity hardcoded to none. gdb/ChangeLog: * NEWS: Mention set/show serial parity command. * monitor.c (monitor_open): Call serial_setparity. * remote.c (remote_open_1): Likewise. * ser-base.c (ser_base_serparity): New function. * ser-base.h (ser_base_setparity): Add declaration. * ser-go32.c (dos_ops): Set "setparity" field. * ser-mingw.c (ser_windows_raw): Do not set state.fParity and state.Parity. (ser_windows_setparity): New function. (hardwire_ops): Add ser_windows_setparity. (tty_ops): Add NULL for setparity field. (pipe_ops): Add ser_base_setparity. (tcp_ops): Likewise. * ser-pipe.c (pipe_ops): Likewise. * ser-tcp.c (tcp_ops): Likewise. * ser-unix.c (hardwire_setparity): Add declaration. (hardwire_raw): Don't reset PARENB flag. (hardwire_setparity): New function. (hardwire_ops): Add hardwire_setparity. * serial.c (serial_setparity): New function. (serial_parity): New global. (parity_none, parity_odd, parity_even, parity_enums, parity): New static globals. (set_parity): New function. (_initialize_serial): Add set/show serial parity commands. * serial.h (GDBPARITY_NONE): Define. (GDBPARITY_ODD): Define. (GDBPARITY_EVEN): Define. (serial_setparity) Add declaration. (struct serial_ops): Add setparity field. * target.h (serial_parity): Add declaration. gdb/doc/ChangeLog: * gdb.texinfo (Remote configuration): Document "set/show serial parity" command. --- gdb/serial.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gdb/serial.h') diff --git a/gdb/serial.h b/gdb/serial.h index 9eb1c39..add0f15 100644 --- a/gdb/serial.h +++ b/gdb/serial.h @@ -186,6 +186,14 @@ extern int serial_setbaudrate (struct serial *scb, int rate); extern int serial_setstopbits (struct serial *scb, int num); +#define GDBPARITY_NONE 0 +#define GDBPARITY_ODD 1 +#define GDBPARITY_EVEN 2 + +/* Set parity for serial port. Returns 0 for success, -1 for failure. */ + +extern int serial_setparity (struct serial *scb, int parity); + /* Asynchronous serial interface: */ /* Can the serial device support asynchronous mode? */ @@ -271,6 +279,9 @@ struct serial_ops serial_ttystate); int (*setbaudrate) (struct serial *, int rate); int (*setstopbits) (struct serial *, int num); + /* Set the value PARITY as parity setting for serial object. + Return 0 in the case of success. */ + int (*setparity) (struct serial *, int parity); /* Wait for output to drain. */ int (*drain_output) (struct serial *); /* Change the serial device into/out of asynchronous mode, call -- cgit v1.1