aboutsummaryrefslogtreecommitdiff
path: root/gdb/serial.h
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1993-05-29 01:33:36 +0000
committerStu Grossman <grossman@cygnus>1993-05-29 01:33:36 +0000
commit38dc5e123ff76ec9c9b58a780c84e74226374b83 (patch)
treec41438ce57feef0d0b4719e8981abfa3bd3959c0 /gdb/serial.h
parent633c8b0a9d08b46a792cb99441f288d405e69633 (diff)
downloadgdb-38dc5e123ff76ec9c9b58a780c84e74226374b83.zip
gdb-38dc5e123ff76ec9c9b58a780c84e74226374b83.tar.gz
gdb-38dc5e123ff76ec9c9b58a780c84e74226374b83.tar.bz2
* Makefile.in: Add new file ser-tcp.c.
* defs.h (memcmp): Add decl for memcmp to #ifndef MEM_FNS_DECLARED. * findvar.c (write_register): See if we are writing back the same value that's already in the register. If so, don't bother. * remote.c (putpkt, getpkt): Improve handling of communication problems. * ser-go32.c: Prototype it to death. Update serial_ops and add dummy routines where appropriate. * ser-tcp.c: New module to implement serial I/O via TCP connections. * ser-unix.c: Clean up getting/setting of tty state. Get rid of SERIAL_RESTORE, add SERIAL_{GET|SET}_TTY_STATE interfaces. * serial.c: Add start of support for connect command. (serial_open): Distinguish between tcp and local devices. * serial.h (struct serial_ops): Get rid of restore, add get_tty_state and set_tty_state. Define protoypes and macros for this mess. * gdbserver/remote-utils.c: Add tcp support. (readchar): Do some real buffering. Handle error conditions gracefully. * gdbserver/remote-inflow-sparc.c: Update to remote-inflow.c (Lynx), remove lots of cruft.
Diffstat (limited to 'gdb/serial.h')
-rw-r--r--gdb/serial.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/gdb/serial.h b/gdb/serial.h
index 9aa9425..f83fda7 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -19,13 +19,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Terminal state pointer. This is specific to each type of interface. */
-typedef PTR ttystate;
+typedef PTR serial_ttystate;
struct _serial_t
{
int fd; /* File descriptor */
struct serial_ops *ops; /* Function vector */
- ttystate ttystate; /* Not used (yet) */
+ serial_ttystate ttystate; /* Not used (yet) */
int bufcnt; /* Amount of data in receive buffer */
unsigned char *bufp; /* Current byte */
unsigned char buf[BUFSIZ]; /* Da buffer itself */
@@ -42,7 +42,8 @@ struct serial_ops {
int (*readchar) PARAMS ((serial_t, int timeout));
int (*write) PARAMS ((serial_t, const char *str, int len));
void (*go_raw) PARAMS ((serial_t));
- void (*restore) PARAMS ((serial_t));
+ serial_ttystate (*get_tty_state) PARAMS ((serial_t));
+ int (*set_tty_state) PARAMS ((serial_t, serial_ttystate));
int (*setbaudrate) PARAMS ((serial_t, int rate));
};
@@ -52,6 +53,8 @@ void serial_add_interface PARAMS ((struct serial_ops *optable));
serial_t serial_open PARAMS ((const char *name));
+serial_t serial_fdopen PARAMS ((int fd));
+
/* For most routines, if a failure is indicated, then errno should be
examined. */
@@ -60,10 +63,18 @@ serial_t serial_open PARAMS ((const char *name));
#define SERIAL_OPEN(NAME) serial_open(NAME)
+/* Open a new serial stream using a file handle. */
+
+#define SERIAL_FDOPEN(FD) serial_fdopen(FD)
+
/* Turn the port into raw mode. */
#define SERIAL_RAW(SERIAL_T) (SERIAL_T)->ops->go_raw((SERIAL_T))
+#define SERIAL_GET_TTY_STATE(SERIAL_T) (SERIAL_T)->ops->get_tty_state((SERIAL_T))
+
+#define SERIAL_SET_TTY_STATE(SERIAL_T, TTYSTATE) (SERIAL_T)->ops->set_tty_state((SERIAL_T), (TTYSTATE))
+
/* Read one char from the serial device with TIMEOUT seconds timeout.
Returns char if ok, else one of the following codes. Note that all
error codes are guaranteed to be < 0. */
@@ -90,7 +101,3 @@ void serial_close PARAMS ((serial_t));
#define SERIAL_CLOSE(SERIAL_T) serial_close(SERIAL_T)
-/* Restore the serial port to the state saved in oldstate. XXX - currently
- unused! */
-
-#define SERIAL_RESTORE(SERIAL_T) (SERIAL_T)->ops->restore((SERIAL_T))