diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-07-11 17:52:32 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-07-11 17:52:32 +0000 |
commit | 819cc324665b3ac1842b105d906308f7ab692a76 (patch) | |
tree | e3784018165b88ebe8ba4a17ac651815ac705f9d /gdb | |
parent | 30120c466956627fbfdc64dde2e6415a9986e7d1 (diff) | |
download | gdb-819cc324665b3ac1842b105d906308f7ab692a76.zip gdb-819cc324665b3ac1842b105d906308f7ab692a76.tar.gz gdb-819cc324665b3ac1842b105d906308f7ab692a76.tar.bz2 |
s/typedef serial_t/struct serial */
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 39 | ||||
-rw-r--r-- | gdb/dsrec.c | 21 | ||||
-rw-r--r-- | gdb/inflow.c | 2 | ||||
-rw-r--r-- | gdb/mon960-rom.c | 2 | ||||
-rw-r--r-- | gdb/nindy-share/Onindy.c | 2 | ||||
-rw-r--r-- | gdb/nindy-share/nindy.c | 6 | ||||
-rw-r--r-- | gdb/nindy-share/ttyflush.c | 2 | ||||
-rw-r--r-- | gdb/ocd.c | 2 | ||||
-rw-r--r-- | gdb/remote-array.c | 4 | ||||
-rw-r--r-- | gdb/remote-e7000.c | 2 | ||||
-rw-r--r-- | gdb/remote-es.c | 2 | ||||
-rw-r--r-- | gdb/remote-mips.c | 6 | ||||
-rw-r--r-- | gdb/remote-nindy.c | 4 | ||||
-rw-r--r-- | gdb/remote-nrom.c | 8 | ||||
-rw-r--r-- | gdb/remote-os9k.c | 2 | ||||
-rw-r--r-- | gdb/remote-rdp.c | 2 | ||||
-rw-r--r-- | gdb/remote-sds.c | 2 | ||||
-rw-r--r-- | gdb/remote-st.c | 2 | ||||
-rw-r--r-- | gdb/remote.c | 4 | ||||
-rw-r--r-- | gdb/ser-e7kpc.c | 41 | ||||
-rw-r--r-- | gdb/ser-go32.c | 46 | ||||
-rw-r--r-- | gdb/ser-pipe.c | 8 | ||||
-rw-r--r-- | gdb/ser-tcp.c | 8 | ||||
-rw-r--r-- | gdb/ser-unix.c | 129 | ||||
-rw-r--r-- | gdb/ser-unix.h | 41 | ||||
-rw-r--r-- | gdb/serial.c | 75 | ||||
-rw-r--r-- | gdb/serial.h | 98 | ||||
-rw-r--r-- | gdb/sh3-rom.c | 4 | ||||
-rw-r--r-- | gdb/sparcl-tdep.c | 16 | ||||
-rw-r--r-- | gdb/sparclet-rom.c | 2 | ||||
-rw-r--r-- | gdb/srec.h | 2 | ||||
-rw-r--r-- | gdb/utils.c | 2 | ||||
-rw-r--r-- | gdb/w89k-rom.c | 2 | ||||
-rw-r--r-- | gdb/xmodem.c | 8 | ||||
-rw-r--r-- | gdb/xmodem.h | 6 |
35 files changed, 325 insertions, 277 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cc7c411..2320282 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,42 @@ +2001-07-10 Andrew Cagney <ac131313@redhat.com> + + * serial.h (typedef serial_t): Delete. Replace all references to + serial_t with `struct serial *'. + * serial.c: Update. + * nindy-share/ttyflush.c: Update. + * nindy-share/ttyflush.c: Update. + * nindy-share/Onindy.c: Update. + * nindy-share/nindy.c: Update. + * remote-rdp.c: Update. + * remote-sds.c: Update. + * remote-st.c: Update. + * remote-nindy.c: Update. + * remote-mips.c: Update. + * remote-e7000.c: Update. + * remote-os9k.c: Update. + * remote-nrom.c: Update. + * remote-es.c: Update. + * remote-array.c: Update. + * ocd.c: Update. + * mon960-rom.c: Update. + * dsrec.c: Update. + * inflow.c: Update. + * ser-e7kpc.c: Update. + * sparclet-rom.c: Update. + * srec.h: Update. + * ser-tcp.c: Update. + * ser-go32.c: Update. + * sparcl-tdep.c: Update. + * w89k-rom.c: Update. + * utils.c: Update. + * sh3-rom.c: Update. + * remote.c: Update. + * ser-pipe.c: Update. + * ser-unix.c: Update. + * ser-unix.h: Update. + * xmodem.c: Update. + * xmodem.h: Update. + 2001-07-11 J.T. Conklin <jtc@redback.com> From Greg McGary <greg@mcgary.org>: diff --git a/gdb/dsrec.c b/gdb/dsrec.c index 669a74a..01fba79 100644 --- a/gdb/dsrec.c +++ b/gdb/dsrec.c @@ -33,19 +33,20 @@ static int make_srec (char *srec, CORE_ADDR targ_addr, bfd * abfd, int flags); /* Download an executable by converting it to S records. DESC is a - serial_t to send the data to. FILE is the name of the file to be - loaded. LOAD_OFFSET is the offset into memory to load data into. - It is usually specified by the user and is useful with the a.out - file format. MAXRECSIZE is the length in chars of the largest - S-record the host can accomodate. This is measured from the - starting `S' to the last char of the checksum. FLAGS is various - random flags, and HASHMARK is non-zero to cause a `#' to be + `struct serial *' to send the data to. FILE is the name of the + file to be loaded. LOAD_OFFSET is the offset into memory to load + data into. It is usually specified by the user and is useful with + the a.out file format. MAXRECSIZE is the length in chars of the + largest S-record the host can accomodate. This is measured from + the starting `S' to the last char of the checksum. FLAGS is + various random flags, and HASHMARK is non-zero to cause a `#' to be printed out for each record loaded. WAITACK, if non-NULL, is a - function that waits for an acknowledgement after each S-record, - and returns non-zero if the ack is read correctly. */ + function that waits for an acknowledgement after each S-record, and + returns non-zero if the ack is read correctly. */ void -load_srec (serial_t desc, const char *file, bfd_vma load_offset, int maxrecsize, +load_srec (struct serial *desc, const char *file, bfd_vma load_offset, + int maxrecsize, int flags, int hashmark, int (*waitack) (void)) { bfd *abfd; diff --git a/gdb/inflow.c b/gdb/inflow.c index 28ebf7d..f24704d 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -70,7 +70,7 @@ static void terminal_ours_1 (int); /* Record terminal status separately for debugger and inferior. */ -static serial_t stdin_serial; +static struct serial *stdin_serial; /* TTY state for the inferior. We save it whenever the inferior stops, and restore it when it resumes. */ diff --git a/gdb/mon960-rom.c b/gdb/mon960-rom.c index 847d4cf..2b7fe5f 100644 --- a/gdb/mon960-rom.c +++ b/gdb/mon960-rom.c @@ -53,7 +53,7 @@ mon960_load_gen (char *filename, int from_tty) #else static void -mon960_load (serial_t desc, char *file, int hashmark) +mon960_load (struct serial *desc, char *file, int hashmark) { bfd *abfd; asection *s; diff --git a/gdb/nindy-share/Onindy.c b/gdb/nindy-share/Onindy.c index a11400d..f89bafd 100644 --- a/gdb/nindy-share/Onindy.c +++ b/gdb/nindy-share/Onindy.c @@ -58,7 +58,7 @@ extern int quiet; /* 1 => stifle unnecessary messages */ /* tty connected to 960/NINDY board. */ -extern serial_t nindy_serial; +extern struct serial *nindy_serial; static OninStrGet(); diff --git a/gdb/nindy-share/nindy.c b/gdb/nindy-share/nindy.c index 9846fc6..f32b1a2 100644 --- a/gdb/nindy-share/nindy.c +++ b/gdb/nindy-share/nindy.c @@ -89,7 +89,7 @@ #define TIMEOUT -1 int quiet = 0; /* 1 => stifle unnecessary messages */ -serial_t nindy_serial; +struct serial *nindy_serial; static int old_nindy = 0; /* 1 => use old (hex) communication protocol */ static ninStrGet(); @@ -514,7 +514,7 @@ parse_baudrate(s) static int try_baudrate (serial, brp) - serial_t serial; + struct serial *serial; struct baudrate *brp; { unsigned char c; @@ -540,7 +540,7 @@ try_baudrate (serial, brp) ******************************************************************************/ static autobaud( serial, brp ) - serial_t serial; + struct serial *serial; struct baudrate *brp; { int i; diff --git a/gdb/nindy-share/ttyflush.c b/gdb/nindy-share/ttyflush.c index ff3b644..786850a 100644 --- a/gdb/nindy-share/ttyflush.c +++ b/gdb/nindy-share/ttyflush.c @@ -27,7 +27,7 @@ int tty_flush (serial) - serial_t serial; + struct serial *serial; { while (1) { @@ -83,7 +83,7 @@ static int remote_timeout = 2; /* Descriptor for I/O to remote machine. Initialize it to NULL so that ocd_open knows that we don't have a file open when the program starts. */ -static serial_t ocd_desc = NULL; +static struct serial *ocd_desc = NULL; void ocd_error (char *s, int error_code) diff --git a/gdb/remote-array.c b/gdb/remote-array.c index beb0c6b..dc7589a 100644 --- a/gdb/remote-array.c +++ b/gdb/remote-array.c @@ -90,7 +90,7 @@ static int timeout = 30; * Descriptor for I/O to remote machine. Initialize it to NULL so that * array_open knows that we don't have a file open when the program starts. */ -serial_t array_desc = NULL; +struct serial *array_desc = NULL; /* * this array of registers need to match the indexes used by GDB. The @@ -694,7 +694,7 @@ array_wait (ptid_t ptid, struct target_waitstatus *status) int old_timeout = timeout; int result, i; char c; - serial_t tty_desc; + struct serial *tty_desc; serial_ttystate ttystate; debuglogs (1, "array_wait (), printing extraneous text."); diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 320584b..2a9a176 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -115,7 +115,7 @@ static void expect_prompt (void); static int e7000_parse_device (char *args, char *dev_name, int baudrate); /* Variables. */ -static serial_t e7000_desc; +static struct serial *e7000_desc; /* Allow user to chose between using hardware breakpoints or memory. */ static int use_hard_breakpoints = 0; /* use sw breakpoints by default */ diff --git a/gdb/remote-es.c b/gdb/remote-es.c index 6423fe2..7aa4d62 100644 --- a/gdb/remote-es.c +++ b/gdb/remote-es.c @@ -231,7 +231,7 @@ static int m68020; es1800_open knows that we don't have a file open when the program starts. */ -static serial_t es1800_desc = NULL; +static struct serial *es1800_desc = NULL; #define PBUFSIZ 1000 #define HDRLEN sizeof("@.BAAAAAAAA=$VV\r") diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 882cbca..5adb729 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -362,10 +362,10 @@ static int mips_receive_wait = 5; static int mips_need_reply = 0; /* Handle used to access serial I/O stream. */ -static serial_t mips_desc; +static struct serial *mips_desc; /* UDP handle used to download files to target. */ -static serial_t udp_desc; +static struct serial *udp_desc; static int udp_in_use; /* TFTP filename used to download files to DDB board, in the form @@ -1540,7 +1540,7 @@ device is attached to the target board (e.g., /dev/ttya).\n" /* Open and initialize the serial port. */ mips_desc = SERIAL_OPEN (serial_port_name); - if (mips_desc == (serial_t) NULL) + if (mips_desc == NULL) perror_with_name (serial_port_name); if (baud_rate != -1) diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c index 9b8dfe8..0acd90d 100644 --- a/gdb/remote-nindy.c +++ b/gdb/remote-nindy.c @@ -141,7 +141,7 @@ char *nindy_ttyname; /* name of tty to talk to nindy on, or null */ #define FALSE 0 /* From nindy-share/nindy.c. */ -extern serial_t nindy_serial; +extern struct serial *nindy_serial; static int have_regs = 0; /* 1 iff regs read since i960 last halted */ static int regs_changed = 0; /* 1 iff regs were modified since last read */ @@ -277,7 +277,7 @@ nindy_resume (ptid_t ptid, int step, enum target_signal siggnal) struct clean_up_tty_args { serial_ttystate state; - serial_t serial; + struct serial *serial; }; static struct clean_up_tty_args tty_args; diff --git a/gdb/remote-nrom.c b/gdb/remote-nrom.c index 9b6b047..3409723 100644 --- a/gdb/remote-nrom.c +++ b/gdb/remote-nrom.c @@ -46,8 +46,8 @@ static void nrom_passthru (char *, int); /* We talk to the NetROM over these sockets. */ -static serial_t load_desc = NULL; -static serial_t ctrl_desc = NULL; +static struct serial *load_desc = NULL; +static struct serial *ctrl_desc = NULL; static int load_port = DEFAULT_NETROM_LOAD_PORT; static int control_port = DEFAULT_NETROM_CONTROL_PORT; @@ -97,11 +97,11 @@ nrom_kill (void) nrom_close (0); } -static serial_t +static struct serial * open_socket (char *name, int port) { char sockname[100]; - serial_t desc; + struct serial *desc; sprintf (sockname, "%s:%d", name, port); desc = SERIAL_OPEN (sockname); diff --git a/gdb/remote-os9k.c b/gdb/remote-os9k.c index 3302580..1b693eb 100644 --- a/gdb/remote-os9k.c +++ b/gdb/remote-os9k.c @@ -80,7 +80,7 @@ static int tty_xoff = 0; static int timeout = 10; static int is_trace_mode = 0; /* Descriptor for I/O to remote machine. Initialize it to NULL */ -static serial_t monitor_desc = NULL; +static struct serial *monitor_desc = NULL; static CORE_ADDR bufaddr = 0; static int buflen = 0; diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 673e423..f0fe2a9 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -55,7 +55,7 @@ #endif extern struct target_ops remote_rdp_ops; -static serial_t io; +static struct serial *io; static host_callback *callback = &default_callback; struct diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c index 7d2f547..73fab94 100644 --- a/gdb/remote-sds.c +++ b/gdb/remote-sds.c @@ -127,7 +127,7 @@ static int sds_timeout = 2; that sds_open knows that we don't have a file open when the program starts. */ -static serial_t sds_desc = NULL; +static struct serial *sds_desc = NULL; /* This limit comes from the monitor. */ diff --git a/gdb/remote-st.c b/gdb/remote-st.c index 55e1392..cda69b6 100644 --- a/gdb/remote-st.c +++ b/gdb/remote-st.c @@ -61,7 +61,7 @@ static int timeout = 24; st2000_open knows that we don't have a file open when the program starts. */ -static serial_t st2000_desc; +static struct serial *st2000_desc; /* Send data to stdebug. Works just like printf. */ diff --git a/gdb/remote.c b/gdb/remote.c index 86ba3c1..72a7913 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -240,7 +240,7 @@ static int remote_break; /* Descriptor for I/O to remote machine. Initialize it to NULL so that remote_open knows that we don't have a file open when the program starts. */ -static serial_t remote_desc = NULL; +static struct serial *remote_desc = NULL; /* This is set by the target (thru the 'S' message) to denote that the target is in kernel mode. */ @@ -5669,7 +5669,7 @@ static void *async_client_context; static serial_event_ftype remote_async_serial_handler; static void -remote_async_serial_handler (serial_t scb, void *context) +remote_async_serial_handler (struct serial *scb, void *context) { /* Don't propogate error information up to the client. Instead let the client find out about the error by querying the target. */ diff --git a/gdb/ser-e7kpc.c b/gdb/ser-e7kpc.c index 209765e..49b2c89 100644 --- a/gdb/ser-e7kpc.c +++ b/gdb/ser-e7kpc.c @@ -33,14 +33,14 @@ #include <sys/dos.h> #endif -static int e7000pc_open (serial_t scb, const char *name); -static void e7000pc_raw (serial_t scb); -static int e7000pc_readchar (serial_t scb, int timeout); -static int e7000pc_setbaudrate (serial_t scb, int rate); -static int e7000pc_write (serial_t scb, const char *str, int len); -static void e7000pc_close (serial_t scb); -static serial_ttystate e7000pc_get_tty_state (serial_t scb); -static int e7000pc_set_tty_state (serial_t scb, serial_ttystate state); +static int e7000pc_open (struct serial *scb, const char *name); +static void e7000pc_raw (struct serial *scb); +static int e7000pc_readchar (struct serial *scb, int timeout); +static int e7000pc_setbaudrate (struct serial *scb, int rate); +static int e7000pc_write (struct serial *scb, const char *str, int len); +static void e7000pc_close (struct serial *scb); +static serial_ttystate e7000pc_get_tty_state (struct serial *scb); +static int e7000pc_set_tty_state (struct serial *scb, serial_ttystate state); #define OFF_DPD 0x0000 #define OFF_DDP 0x1000 @@ -291,7 +291,7 @@ dosasync_write (int fd, const char *buf, int len) } static int -e7000pc_open (serial_t scb, const char *name) +e7000pc_open (struct serial *scb, const char *name) { if (strncasecmp (name, "pc", 2) != 0) { @@ -308,19 +308,19 @@ e7000pc_open (serial_t scb, const char *name) } static int -e7000pc_noop (serial_t scb) +e7000pc_noop (struct serial *scb) { return 0; } static void -e7000pc_raw (serial_t scb) +e7000pc_raw (struct serial *scb) { /* Always in raw mode */ } static int -e7000pc_readchar (serial_t scb, int timeout) +e7000pc_readchar (struct serial *scb, int timeout) { char buf; @@ -345,7 +345,7 @@ struct e7000pc_ttystate vector. Someday, they may do something real... */ static serial_ttystate -e7000pc_get_tty_state (serial_t scb) +e7000pc_get_tty_state (struct serial *scb) { struct e7000pc_ttystate *state; @@ -355,20 +355,21 @@ e7000pc_get_tty_state (serial_t scb) } static int -e7000pc_set_tty_state (serial_t scb, serial_ttystate ttystate) +e7000pc_set_tty_state (struct serial *scb, serial_ttystate ttystate) { return 0; } static int -e7000pc_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, +e7000pc_noflush_set_tty_state (struct serial *scb, + serial_ttystate new_ttystate, serial_ttystate old_ttystate) { return 0; } static void -e7000pc_print_tty_state (serial_t scb, +e7000pc_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *stream) { @@ -377,19 +378,19 @@ e7000pc_print_tty_state (serial_t scb, } static int -e7000pc_setbaudrate (serial_t scb, int rate) +e7000pc_setbaudrate (struct serial *scb, int rate) { return 0; } static int -e7000pc_setstopbits (serial_t scb, int rate) +e7000pc_setstopbits (struct serial *scb, int rate) { return 0; } static int -e7000pc_write (serial_t scb, const char *str, int len) +e7000pc_write (struct serial *scb, const char *str, int len) { dosasync_write (scb->fd, str, len); @@ -397,7 +398,7 @@ e7000pc_write (serial_t scb, const char *str, int len) } static void -e7000pc_close (serial_t scb) +e7000pc_close (struct serial *scb) { } diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c index a8521f2..0642b5a 100644 --- a/gdb/ser-go32.c +++ b/gdb/ser-go32.c @@ -228,14 +228,14 @@ ports[4] = } }; -static int dos_open (serial_t scb, const char *name); -static void dos_raw (serial_t scb); -static int dos_readchar (serial_t scb, int timeout); -static int dos_setbaudrate (serial_t scb, int rate); -static int dos_write (serial_t scb, const char *str, int len); -static void dos_close (serial_t scb); -static serial_ttystate dos_get_tty_state (serial_t scb); -static int dos_set_tty_state (serial_t scb, serial_ttystate state); +static int dos_open (struct serial *scb, const char *name); +static void dos_raw (struct serial *scb); +static int dos_readchar (struct serial *scb, int timeout); +static int dos_setbaudrate (struct serial *scb, int rate); +static int dos_write (struct serial *scb, const char *str, int len); +static void dos_close (struct serial *scb); +static serial_ttystate dos_get_tty_state (struct serial *scb); +static int dos_set_tty_state (struct serial *scb, serial_ttystate state); static int dos_baudconv (int rate); #define inb(p,a) inportb((p)->base + (a)) @@ -453,7 +453,7 @@ dos_unhookirq (struct intrupt *intr) static int -dos_open (serial_t scb, const char *name) +dos_open (struct serial *scb, const char *name) { struct dos_ttystate *port; int fd, i; @@ -558,7 +558,7 @@ ok: static void -dos_close (serial_t scb) +dos_close (struct serial *scb) { struct dos_ttystate *port; struct intrupt *intrupt; @@ -600,19 +600,19 @@ dos_close (serial_t scb) static int -dos_noop (serial_t scb) +dos_noop (struct serial *scb) { return 0; } static void -dos_raw (serial_t scb) +dos_raw (struct serial *scb) { /* Always in raw mode */ } static int -dos_readchar (serial_t scb, int timeout) +dos_readchar (struct serial *scb, int timeout) { struct dos_ttystate *port = &ports[scb->fd]; long then; @@ -630,7 +630,7 @@ dos_readchar (serial_t scb, int timeout) static serial_ttystate -dos_get_tty_state (serial_t scb) +dos_get_tty_state (struct serial *scb) { struct dos_ttystate *port = &ports[scb->fd]; struct dos_ttystate *state; @@ -654,7 +654,7 @@ dos_get_tty_state (serial_t scb) } static int -dos_set_tty_state (serial_t scb, serial_ttystate ttystate) +dos_set_tty_state (struct serial *scb, serial_ttystate ttystate) { struct dos_ttystate *state; @@ -664,7 +664,7 @@ dos_set_tty_state (serial_t scb, serial_ttystate ttystate) } static int -dos_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, +dos_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate) { struct dos_ttystate *state; @@ -675,7 +675,7 @@ dos_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, } static int -dos_flush_input (serial_t scb) +dos_flush_input (struct serial *scb) { struct dos_ttystate *port = &ports[scb->fd]; disable (); @@ -687,7 +687,7 @@ dos_flush_input (serial_t scb) } static void -dos_print_tty_state (serial_t scb, serial_ttystate ttystate, +dos_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *stream) { /* Nothing to print */ @@ -718,7 +718,7 @@ dos_baudconv (int rate) static int -dos_setbaudrate (serial_t scb, int rate) +dos_setbaudrate (struct serial *scb, int rate) { struct dos_ttystate *port = &ports[scb->fd]; @@ -750,7 +750,7 @@ dos_setbaudrate (serial_t scb, int rate) } static int -dos_setstopbits (serial_t scb, int num) +dos_setstopbits (struct serial *scb, int num) { struct dos_ttystate *port = &ports[scb->fd]; unsigned char cfcr; @@ -777,7 +777,7 @@ dos_setstopbits (serial_t scb, int num) } static int -dos_write (serial_t scb, const char *str, int len) +dos_write (struct serial *scb, const char *str, int len) { volatile struct dos_ttystate *port = &ports[scb->fd]; int fifosize = port->fifo ? 16 : 1; @@ -818,7 +818,7 @@ dos_write (serial_t scb, const char *str, int len) static int -dos_sendbreak (serial_t scb) +dos_sendbreak (struct serial *scb) { volatile struct dos_ttystate *port = &ports[scb->fd]; unsigned char cfcr; @@ -856,7 +856,7 @@ static struct serial_ops dos_ops = dos_setbaudrate, dos_setstopbits, dos_noop, /* wait for output to drain */ - (void (*)(serial_t, int))NULL /* change into async mode */ + (void (*)(struct serial *, int))NULL /* change into async mode */ }; diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index 3e23287..bca0e54 100644 --- a/gdb/ser-pipe.c +++ b/gdb/ser-pipe.c @@ -34,8 +34,8 @@ #include <signal.h> -static int pipe_open (serial_t scb, const char *name); -static void pipe_close (serial_t scb); +static int pipe_open (struct serial *scb, const char *name); +static void pipe_close (struct serial *scb); extern void _initialize_ser_pipe (void); @@ -47,7 +47,7 @@ struct pipe_state /* Open up a raw pipe */ static int -pipe_open (serial_t scb, const char *name) +pipe_open (struct serial *scb, const char *name) { #if !HAVE_SOCKETPAIR return -1; @@ -117,7 +117,7 @@ pipe_open (serial_t scb, const char *name) } static void -pipe_close (serial_t scb) +pipe_close (struct serial *scb) { struct pipe_state *state = scb->state; if (state != NULL) diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index 30281cd..fe5cb44 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -34,15 +34,15 @@ #include <signal.h> #include "gdb_string.h" -static int tcp_open (serial_t scb, const char *name); -static void tcp_close (serial_t scb); +static int tcp_open (struct serial *scb, const char *name); +static void tcp_close (struct serial *scb); void _initialize_ser_tcp (void); /* Open up a raw tcp socket */ static int -tcp_open (serial_t scb, const char *name) +tcp_open (struct serial *scb, const char *name) { char *port_str; int port; @@ -122,7 +122,7 @@ tcp_open (serial_t scb, const char *name) } static void -tcp_close (serial_t scb) +tcp_close (struct serial *scb) { if (scb->fd < 0) return; diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index ee17c12..e12e776 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -64,32 +64,37 @@ struct hardwire_ttystate }; #endif /* sgtty */ -static int hardwire_open (serial_t scb, const char *name); -static void hardwire_raw (serial_t scb); -static int wait_for (serial_t scb, int timeout); -static int hardwire_readchar (serial_t scb, int timeout); -static int do_hardwire_readchar (serial_t scb, int timeout); -static int generic_readchar (serial_t scb, int timeout, int (*do_readchar) (serial_t scb, int timeout)); +static int hardwire_open (struct serial *scb, const char *name); +static void hardwire_raw (struct serial *scb); +static int wait_for (struct serial *scb, int timeout); +static int hardwire_readchar (struct serial *scb, int timeout); +static int do_hardwire_readchar (struct serial *scb, int timeout); +static int generic_readchar (struct serial *scb, int timeout, + int (*do_readchar) (struct serial *scb, + int timeout)); static int rate_to_code (int rate); -static int hardwire_setbaudrate (serial_t scb, int rate); -static void hardwire_close (serial_t scb); -static int get_tty_state (serial_t scb, struct hardwire_ttystate * state); -static int set_tty_state (serial_t scb, struct hardwire_ttystate * state); -static serial_ttystate hardwire_get_tty_state (serial_t scb); -static int hardwire_set_tty_state (serial_t scb, serial_ttystate state); -static int hardwire_noflush_set_tty_state (serial_t, serial_ttystate, - serial_ttystate); -static void hardwire_print_tty_state (serial_t, serial_ttystate, struct ui_file *); -static int hardwire_drain_output (serial_t); -static int hardwire_flush_output (serial_t); -static int hardwire_flush_input (serial_t); -static int hardwire_send_break (serial_t); -static int hardwire_setstopbits (serial_t, int); - -static int do_unix_readchar (serial_t scb, int timeout); +static int hardwire_setbaudrate (struct serial *scb, int rate); +static void hardwire_close (struct serial *scb); +static int get_tty_state (struct serial *scb, + struct hardwire_ttystate * state); +static int set_tty_state (struct serial *scb, + struct hardwire_ttystate * state); +static serial_ttystate hardwire_get_tty_state (struct serial *scb); +static int hardwire_set_tty_state (struct serial *scb, serial_ttystate state); +static int hardwire_noflush_set_tty_state (struct serial *, serial_ttystate, + serial_ttystate); +static void hardwire_print_tty_state (struct serial *, serial_ttystate, + struct ui_file *); +static int hardwire_drain_output (struct serial *); +static int hardwire_flush_output (struct serial *); +static int hardwire_flush_input (struct serial *); +static int hardwire_send_break (struct serial *); +static int hardwire_setstopbits (struct serial *, int); + +static int do_unix_readchar (struct serial *scb, int timeout); static timer_handler_func push_event; static handler_func fd_event; -static void reschedule (serial_t scb); +static void reschedule (struct serial *scb); void _initialize_ser_hardwire (void); @@ -98,7 +103,7 @@ extern int (*ui_loop_hook) (int); /* Open up a real live device for serial I/O */ static int -hardwire_open (serial_t scb, const char *name) +hardwire_open (struct serial *scb, const char *name) { scb->fd = open (name, O_RDWR); if (scb->fd < 0) @@ -108,7 +113,7 @@ hardwire_open (serial_t scb, const char *name) } static int -get_tty_state (serial_t scb, struct hardwire_ttystate *state) +get_tty_state (struct serial *scb, struct hardwire_ttystate *state) { #ifdef HAVE_TERMIOS if (tcgetattr (scb->fd, &state->termios) < 0) @@ -138,7 +143,7 @@ get_tty_state (serial_t scb, struct hardwire_ttystate *state) } static int -set_tty_state (serial_t scb, struct hardwire_ttystate *state) +set_tty_state (struct serial *scb, struct hardwire_ttystate *state) { #ifdef HAVE_TERMIOS if (tcsetattr (scb->fd, TCSANOW, &state->termios) < 0) @@ -168,7 +173,7 @@ set_tty_state (serial_t scb, struct hardwire_ttystate *state) } static serial_ttystate -hardwire_get_tty_state (serial_t scb) +hardwire_get_tty_state (struct serial *scb) { struct hardwire_ttystate *state; @@ -181,7 +186,7 @@ hardwire_get_tty_state (serial_t scb) } static int -hardwire_set_tty_state (serial_t scb, serial_ttystate ttystate) +hardwire_set_tty_state (struct serial *scb, serial_ttystate ttystate) { struct hardwire_ttystate *state; @@ -191,7 +196,7 @@ hardwire_set_tty_state (serial_t scb, serial_ttystate ttystate) } static int -hardwire_noflush_set_tty_state (serial_t scb, +hardwire_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate) { @@ -224,7 +229,7 @@ hardwire_noflush_set_tty_state (serial_t scb, } static void -hardwire_print_tty_state (serial_t scb, +hardwire_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *stream) { @@ -282,7 +287,7 @@ hardwire_print_tty_state (serial_t scb, /* Wait for the output to drain away, as opposed to flushing (discarding) it */ static int -hardwire_drain_output (serial_t scb) +hardwire_drain_output (struct serial *scb) { #ifdef HAVE_TERMIOS return tcdrain (scb->fd); @@ -311,7 +316,7 @@ hardwire_drain_output (serial_t scb) } static int -hardwire_flush_output (serial_t scb) +hardwire_flush_output (struct serial *scb) { #ifdef HAVE_TERMIOS return tcflush (scb->fd, TCOFLUSH); @@ -328,7 +333,7 @@ hardwire_flush_output (serial_t scb) } static int -hardwire_flush_input (serial_t scb) +hardwire_flush_input (struct serial *scb) { ser_unix_flush_input (scb); @@ -347,7 +352,7 @@ hardwire_flush_input (serial_t scb) } static int -hardwire_send_break (serial_t scb) +hardwire_send_break (struct serial *scb) { #ifdef HAVE_TERMIOS return tcsendbreak (scb->fd, 0); @@ -377,7 +382,7 @@ hardwire_send_break (serial_t scb) } static void -hardwire_raw (serial_t scb) +hardwire_raw (struct serial *scb) { struct hardwire_ttystate state; @@ -432,7 +437,7 @@ hardwire_raw (serial_t scb) an overflowed timer is unnecessary. */ static int -wait_for (serial_t scb, int timeout) +wait_for (struct serial *scb, int timeout) { #ifdef HAVE_SGTTY while (1) @@ -553,7 +558,7 @@ wait_for (serial_t scb, int timeout) that. */ static int -do_hardwire_readchar (serial_t scb, int timeout) +do_hardwire_readchar (struct serial *scb, int timeout) { int status, delta; int detach = 0; @@ -621,7 +626,7 @@ do_hardwire_readchar (serial_t scb, int timeout) } static int -hardwire_readchar (serial_t scb, int timeout) +hardwire_readchar (struct serial *scb, int timeout) { return generic_readchar (scb, timeout, do_hardwire_readchar); } @@ -772,7 +777,7 @@ rate_to_code (int rate) } static int -hardwire_setbaudrate (serial_t scb, int rate) +hardwire_setbaudrate (struct serial *scb, int rate) { struct hardwire_ttystate state; int baud_code = rate_to_code (rate); @@ -811,7 +816,7 @@ hardwire_setbaudrate (serial_t scb, int rate) } static int -hardwire_setstopbits (serial_t scb, int num) +hardwire_setstopbits (struct serial *scb, int num) { struct hardwire_ttystate state; int newbit; @@ -854,7 +859,7 @@ hardwire_setstopbits (serial_t scb, int num) } static void -hardwire_close (serial_t scb) +hardwire_close (struct serial *scb) { if (scb->fd < 0) return; @@ -867,20 +872,20 @@ hardwire_close (serial_t scb) /* Generic operations used by all UNIX/FD based serial interfaces. */ serial_ttystate -ser_unix_nop_get_tty_state (serial_t scb) +ser_unix_nop_get_tty_state (struct serial *scb) { /* allocate a dummy */ return (serial_ttystate) XMALLOC (int); } int -ser_unix_nop_set_tty_state (serial_t scb, serial_ttystate ttystate) +ser_unix_nop_set_tty_state (struct serial *scb, serial_ttystate ttystate) { return 0; } void -ser_unix_nop_raw (serial_t scb) +ser_unix_nop_raw (struct serial *scb) { return; /* Always in raw mode */ } @@ -889,7 +894,7 @@ ser_unix_nop_raw (serial_t scb) otherwise SERIAL_TIMEOUT or SERIAL_ERROR. */ int -ser_unix_wait_for (serial_t scb, int timeout) +ser_unix_wait_for (struct serial *scb, int timeout) { while (1) { @@ -934,7 +939,7 @@ ser_unix_wait_for (serial_t scb, int timeout) dead, or -3 for any other error (see errno in that case). */ static int -do_unix_readchar (serial_t scb, int timeout) +do_unix_readchar (struct serial *scb, int timeout) { int status; int delta; @@ -1025,8 +1030,8 @@ do_unix_readchar (serial_t scb, int timeout) will be called. */ static int -generic_readchar (serial_t scb, int timeout, - int (do_readchar) (serial_t scb, int timeout)) +generic_readchar (struct serial *scb, int timeout, + int (do_readchar) (struct serial *scb, int timeout)) { int ch; if (scb->bufcnt > 0) @@ -1063,13 +1068,13 @@ generic_readchar (serial_t scb, int timeout, } int -ser_unix_readchar (serial_t scb, int timeout) +ser_unix_readchar (struct serial *scb, int timeout) { return generic_readchar (scb, timeout, do_unix_readchar); } int -ser_unix_nop_noflush_set_tty_state (serial_t scb, +ser_unix_nop_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate) { @@ -1077,7 +1082,7 @@ ser_unix_nop_noflush_set_tty_state (serial_t scb, } void -ser_unix_nop_print_tty_state (serial_t scb, +ser_unix_nop_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *stream) { @@ -1086,19 +1091,19 @@ ser_unix_nop_print_tty_state (serial_t scb, } int -ser_unix_nop_setbaudrate (serial_t scb, int rate) +ser_unix_nop_setbaudrate (struct serial *scb, int rate) { return 0; /* Never fails! */ } int -ser_unix_nop_setstopbits (serial_t scb, int num) +ser_unix_nop_setstopbits (struct serial *scb, int num) { return 0; /* Never fails! */ } int -ser_unix_write (serial_t scb, const char *str, int len) +ser_unix_write (struct serial *scb, const char *str, int len) { int cc; @@ -1115,13 +1120,13 @@ ser_unix_write (serial_t scb, const char *str, int len) } int -ser_unix_nop_flush_output (serial_t scb) +ser_unix_nop_flush_output (struct serial *scb) { return 0; } int -ser_unix_flush_input (serial_t scb) +ser_unix_flush_input (struct serial *scb) { if (scb->bufcnt >= 0) { @@ -1134,13 +1139,13 @@ ser_unix_flush_input (serial_t scb) } int -ser_unix_nop_send_break (serial_t scb) +ser_unix_nop_send_break (struct serial *scb) { return 0; } int -ser_unix_nop_drain_output (serial_t scb) +ser_unix_nop_drain_output (struct serial *scb) { return 0; } @@ -1177,7 +1182,7 @@ enum { scheduled task is only changed when needed. */ static void -reschedule (serial_t scb) +reschedule (struct serial *scb) { if (SERIAL_IS_ASYNC_P (scb)) { @@ -1244,7 +1249,7 @@ reschedule (serial_t scb) static void fd_event (int error, void *context) { - serial_t scb = context; + struct serial *scb = context; if (error != 0) { scb->bufcnt = SERIAL_ERROR; @@ -1286,7 +1291,7 @@ fd_event (int error, void *context) static void push_event (void *context) { - serial_t scb = context; + struct serial *scb = context; scb->async_state = NOTHING_SCHEDULED; /* Timers are one-off */ scb->async_handler (scb, scb->async_context); /* re-schedule */ @@ -1296,7 +1301,7 @@ push_event (void *context) /* Put the SERIAL device into/out-of ASYNC mode. */ void -ser_unix_async (serial_t scb, +ser_unix_async (struct serial *scb, int async_p) { if (async_p) diff --git a/gdb/ser-unix.h b/gdb/ser-unix.h index e4b2c16..861694f 100644 --- a/gdb/ser-unix.h +++ b/gdb/ser-unix.h @@ -26,23 +26,28 @@ /* Generic UNIX/FD functions */ -extern int ser_unix_nop_flush_output (serial_t scb); -extern int ser_unix_flush_input (serial_t scb); -extern int ser_unix_nop_send_break (serial_t scb); -extern void ser_unix_nop_raw (serial_t scb); -extern serial_ttystate ser_unix_nop_get_tty_state (serial_t scb); -extern int ser_unix_nop_set_tty_state (serial_t scb, serial_ttystate ttystate); -extern void ser_unix_nop_print_tty_state (serial_t scb, serial_ttystate ttystate, struct ui_file *stream); -extern int ser_unix_nop_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate); -extern int ser_unix_nop_setbaudrate (serial_t scb, int rate); -extern int ser_unix_nop_setstopbits (serial_t scb, int rate); -extern int ser_unix_nop_drain_output (serial_t scb); - -extern int ser_unix_wait_for (serial_t scb, int timeout); -extern int ser_unix_readchar (serial_t scb, int timeout); - -extern int ser_unix_write (serial_t scb, const char *str, int len); - -extern void ser_unix_async (serial_t scb, int async_p); +extern int ser_unix_nop_flush_output (struct serial *scb); +extern int ser_unix_flush_input (struct serial *scb); +extern int ser_unix_nop_send_break (struct serial *scb); +extern void ser_unix_nop_raw (struct serial *scb); +extern serial_ttystate ser_unix_nop_get_tty_state (struct serial *scb); +extern int ser_unix_nop_set_tty_state (struct serial *scb, + serial_ttystate ttystate); +extern void ser_unix_nop_print_tty_state (struct serial *scb, + serial_ttystate ttystate, + struct ui_file *stream); +extern int ser_unix_nop_noflush_set_tty_state (struct serial *scb, + serial_ttystate new_ttystate, + serial_ttystate old_ttystate); +extern int ser_unix_nop_setbaudrate (struct serial *scb, int rate); +extern int ser_unix_nop_setstopbits (struct serial *scb, int rate); +extern int ser_unix_nop_drain_output (struct serial *scb); + +extern int ser_unix_wait_for (struct serial *scb, int timeout); +extern int ser_unix_readchar (struct serial *scb, int timeout); + +extern int ser_unix_write (struct serial *scb, const char *str, int len); + +extern void ser_unix_async (struct serial *scb, int async_p); #endif diff --git a/gdb/serial.c b/gdb/serial.c index 4dd66fc..38e1e0e 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -38,11 +38,11 @@ static struct serial_ops *serial_ops_list = NULL; /* This is the last serial stream opened. Used by connect command. */ -static serial_t last_serial_opened = NULL; +static struct serial *last_serial_opened = NULL; /* Pointer to list of scb's. */ -static serial_t scb_base; +static struct serial *scb_base; /* Non-NULL gives filename which contains a recording of the remote session, suitable for playback by gdbserver. */ @@ -63,7 +63,6 @@ static const char *serial_logbase = logbase_ascii; #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - static int serial_current_type = 0; /* Log char CH of type CHTYPE, with TIMEOUT */ @@ -172,10 +171,10 @@ serial_add_interface (struct serial_ops *optable) /* Open up a device or a network socket, depending upon the syntax of NAME. */ -serial_t +struct serial * serial_open (const char *name) { - serial_t scb; + struct serial *scb; struct serial_ops *ops; const char *open_name = name; @@ -239,10 +238,10 @@ serial_open (const char *name) return scb; } -serial_t +struct serial * serial_fdopen (const int fd) { - serial_t scb; + struct serial *scb; struct serial_ops *ops; for (scb = scb_base; scb; scb = scb->next) @@ -281,9 +280,9 @@ serial_fdopen (const int fd) } static void -do_serial_close (serial_t scb, int really_close) +do_serial_close (struct serial *scb, int really_close) { - serial_t tmp_scb; + struct serial *tmp_scb; last_serial_opened = NULL; @@ -333,19 +332,19 @@ do_serial_close (serial_t scb, int really_close) } void -serial_close (serial_t scb) +serial_close (struct serial *scb) { do_serial_close (scb, 1); } void -serial_un_fdopen (serial_t scb) +serial_un_fdopen (struct serial *scb) { do_serial_close (scb, 0); } int -serial_readchar (serial_t scb, int timeout) +serial_readchar (struct serial *scb, int timeout) { int ch; @@ -376,7 +375,7 @@ serial_readchar (serial_t scb, int timeout) } int -serial_write (serial_t scb, const char *str, int len) +serial_write (struct serial *scb, const char *str, int len) { if (serial_logfp != NULL) { @@ -394,7 +393,7 @@ serial_write (serial_t scb, const char *str, int len) } void -serial_printf (serial_t desc, const char *format,...) +serial_printf (struct serial *desc, const char *format,...) { va_list args; char *buf; @@ -408,25 +407,25 @@ serial_printf (serial_t desc, const char *format,...) } int -serial_drain_output (serial_t scb) +serial_drain_output (struct serial *scb) { return scb->ops->drain_output (scb); } int -serial_flush_output (serial_t scb) +serial_flush_output (struct serial *scb) { return scb->ops->flush_output (scb); } int -serial_flush_input (serial_t scb) +serial_flush_input (struct serial *scb) { return scb->ops->flush_input (scb); } int -serial_send_break (serial_t scb) +serial_send_break (struct serial *scb) { if (serial_logfp != NULL) serial_logchar (serial_logfp, 'w', SERIAL_BREAK, 0); @@ -435,25 +434,25 @@ serial_send_break (serial_t scb) } void -serial_raw (serial_t scb) +serial_raw (struct serial *scb) { scb->ops->go_raw (scb); } serial_ttystate -serial_get_tty_state (serial_t scb) +serial_get_tty_state (struct serial *scb) { return scb->ops->get_tty_state (scb); } int -serial_set_tty_state (serial_t scb, serial_ttystate ttystate) +serial_set_tty_state (struct serial *scb, serial_ttystate ttystate) { return scb->ops->set_tty_state (scb, ttystate); } void -serial_print_tty_state (serial_t scb, +serial_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *stream) { @@ -461,7 +460,7 @@ serial_print_tty_state (serial_t scb, } int -serial_noflush_set_tty_state (serial_t scb, +serial_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate) { @@ -469,31 +468,31 @@ serial_noflush_set_tty_state (serial_t scb, } int -serial_setbaudrate (serial_t scb, int rate) +serial_setbaudrate (struct serial *scb, int rate) { return scb->ops->setbaudrate (scb, rate); } int -serial_setstopbits (serial_t scb, int num) +serial_setstopbits (struct serial *scb, int num) { return scb->ops->setstopbits (scb, num); } int -serial_can_async_p (serial_t scb) +serial_can_async_p (struct serial *scb) { return (scb->ops->async != NULL); } int -serial_is_async_p (serial_t scb) +serial_is_async_p (struct serial *scb) { return (scb->ops->async != NULL) && (scb->async_handler != NULL); } void -serial_async (serial_t scb, +serial_async (struct serial *scb, serial_event_ftype *handler, void *context) { @@ -506,7 +505,7 @@ serial_async (serial_t scb, } int -deprecated_serial_fd (serial_t scb) +deprecated_serial_fd (struct serial *scb) { /* FIXME: should this output a warning that deprecated code is being called? */ @@ -519,23 +518,22 @@ deprecated_serial_fd (serial_t scb) } void -serial_debug (serial_t scb, int debug_p) +serial_debug (struct serial *scb, int debug_p) { scb->debug_p = debug_p; } int -serial_debug_p (serial_t scb) +serial_debug_p (struct serial *scb) { return scb->debug_p || global_serial_debug_p; } #if 0 -/* - The connect command is #if 0 because I hadn't thought of an elegant - way to wait for I/O on two serial_t's simultaneously. Two solutions - came to mind: +/* The connect command is #if 0 because I hadn't thought of an elegant + way to wait for I/O on two `struct serial *'s simultaneously. Two + solutions came to mind: 1) Fork, and have have one fork handle the to user direction, and have the other hand the to target direction. This @@ -545,13 +543,12 @@ serial_debug_p (serial_t scb) the target side can both be waited on via the same mechanism. This may not be true for DOS, if GDB is talking to the target via a TCP socket. - -grossman, 8 Jun 93 - */ + -grossman, 8 Jun 93 */ /* Connect the user directly to the remote system. This command acts just like the 'cu' or 'tip' command. Use <CR>~. or <CR>~^D to break out. */ -static serial_t tty_desc; /* Controlling terminal */ +static struct serial *tty_desc; /* Controlling terminal */ static void cleanup_tty (serial_ttystate ttystate) @@ -568,7 +565,7 @@ connect_command (char *args, int fromtty) int c; char cur_esc = 0; serial_ttystate ttystate; - serial_t port_desc; /* TTY port */ + struct serial *port_desc; /* TTY port */ dont_repeat (); diff --git a/gdb/serial.h b/gdb/serial.h index 0a8df3c..1863d21 100644 --- a/gdb/serial.h +++ b/gdb/serial.h @@ -30,28 +30,26 @@ typedef void *serial_ttystate; struct serial; -typedef struct serial *serial_t; -/* Try to open NAME. Returns a new serial_t on success, NULL on - failure. */ +/* Try to open NAME. Returns a new `struct serial *' on success, NULL + on failure. */ -extern serial_t serial_open (const char *name); +extern struct serial *serial_open (const char *name); #define SERIAL_OPEN(NAME) serial_open(NAME) /* Open a new serial stream using a file handle. */ -extern serial_t serial_fdopen (const int fd); +extern struct serial *serial_fdopen (const int fd); #define SERIAL_FDOPEN(FD) serial_fdopen(FD) -/* Push out all buffers, close the device and destroy SERIAL_T. */ +/* Push out all buffers, close the device and destroy SCB. */ -extern void serial_close (serial_t); +extern void serial_close (struct serial *scb); #define SERIAL_CLOSE(SERIAL_T) serial_close ((SERIAL_T)) -/* Push out all buffers and destroy SERIAL_T without closing the - device. */ +/* Push out all buffers and destroy SCB without closing the device. */ -extern void serial_un_fdopen (serial_t scb); +extern void serial_un_fdopen (struct serial *scb); #define SERIAL_UN_FDOPEN(SERIAL_T) serial_un_fdopen ((SERIAL_T)) /* Read one char from the serial device with TIMEOUT seconds to wait @@ -70,50 +68,50 @@ enum serial_rc { things like the line dropping dead. */ }; -extern int serial_readchar (serial_t scb, int timeout); +extern int serial_readchar (struct serial *scb, int timeout); #define SERIAL_READCHAR(SERIAL_T, TIMEOUT) serial_readchar ((SERIAL_T), (TIMEOUT)) -/* Write LEN chars from STRING to the port SERIAL_T. Returns 0 for +/* Write LEN chars from STRING to the port SCB. Returns 0 for success, non-zero for failure. */ -extern int serial_write (serial_t scb, const char *str, int len); +extern int serial_write (struct serial *scb, const char *str, int len); #define SERIAL_WRITE(SERIAL_T, STRING,LEN) serial_write (SERIAL_T, STRING, LEN) /* Write a printf style string onto the serial port. */ -extern void serial_printf (serial_t desc, const char *,...) ATTR_FORMAT (printf, 2, 3); +extern void serial_printf (struct serial *desc, const char *,...) ATTR_FORMAT (printf, 2, 3); /* Allow pending output to drain. */ -extern int serial_drain_output (serial_t); +extern int serial_drain_output (struct serial *); #define SERIAL_DRAIN_OUTPUT(SERIAL_T) serial_drain_output ((SERIAL_T)) /* Flush (discard) pending output. Might also flush input (if this system can't flush only output). */ -extern int serial_flush_output (serial_t); +extern int serial_flush_output (struct serial *); #define SERIAL_FLUSH_OUTPUT(SERIAL_T) serial_flush_output ((SERIAL_T)) /* Flush pending input. Might also flush output (if this system can't flush only input). */ -extern int serial_flush_input (serial_t); +extern int serial_flush_input (struct serial *); #define SERIAL_FLUSH_INPUT(SERIAL_T) serial_flush_input ((SERIAL_T)) /* Send a break between 0.25 and 0.5 seconds long. */ -extern int serial_send_break (serial_t scb); +extern int serial_send_break (struct serial *scb); #define SERIAL_SEND_BREAK(SERIAL_T) serial_send_break (SERIAL_T) /* Turn the port into raw mode. */ -extern void serial_raw (serial_t scb); +extern void serial_raw (struct serial *scb); #define SERIAL_RAW(SERIAL_T) serial_raw ((SERIAL_T)) /* Return a pointer to a newly malloc'd ttystate containing the state of the tty. */ -extern serial_ttystate serial_get_tty_state (serial_t scb); +extern serial_ttystate serial_get_tty_state (struct serial *scb); #define SERIAL_GET_TTY_STATE(SERIAL_T) serial_get_tty_state ((SERIAL_T)) /* Set the state of the tty to TTYSTATE. The change is immediate. @@ -121,14 +119,14 @@ extern serial_ttystate serial_get_tty_state (serial_t scb); Returns 0 for success, negative value for error (in which case errno contains the error). */ -extern int serial_set_tty_state (serial_t scb, serial_ttystate ttystate); +extern int serial_set_tty_state (struct serial *scb, serial_ttystate ttystate); #define SERIAL_SET_TTY_STATE(SERIAL_T, TTYSTATE) serial_set_tty_state ((SERIAL_T), (TTYSTATE)) /* printf_filtered a user-comprehensible description of ttystate on the specified STREAM. FIXME: At present this sends output to the default stream - GDB_STDOUT. */ -extern void serial_print_tty_state (serial_t scb, serial_ttystate ttystate, struct ui_file *); +extern void serial_print_tty_state (struct serial *scb, serial_ttystate ttystate, struct ui_file *); #define SERIAL_PRINT_TTY_STATE(SERIAL_T, TTYSTATE, STREAM) serial_print_tty_state ((SERIAL_T), (TTYSTATE), (STREAM)) /* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the @@ -137,14 +135,14 @@ extern void serial_print_tty_state (serial_t scb, serial_ttystate ttystate, stru This means that we never switch in or out of raw mode, even if NEW_TTYSTATE specifies a switch. */ -extern int serial_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate); +extern int serial_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate, serial_ttystate old_ttystate); #define SERIAL_NOFLUSH_SET_TTY_STATE(SERIAL_T, NEW_TTYSTATE, OLD_TTYSTATE) \ serial_noflush_set_tty_state ((SERIAL_T), (NEW_TTYSTATE), (OLD_TTYSTATE)) /* Set the baudrate to the decimal value supplied. Returns 0 for success, -1 for failure. */ -extern int serial_setbaudrate (serial_t scb, int rate); +extern int serial_setbaudrate (struct serial *scb, int rate); #define SERIAL_SETBAUDRATE(SERIAL_T, RATE) serial_setbaudrate ((SERIAL_T), (RATE)) /* Set the number of stop bits to the value specified. Returns 0 for @@ -154,27 +152,27 @@ extern int serial_setbaudrate (serial_t scb, int rate); #define SERIAL_1_AND_A_HALF_STOPBITS 2 /* 1.5 bits, snicker... */ #define SERIAL_2_STOPBITS 3 -extern int serial_setstopbits (serial_t scb, int num); +extern int serial_setstopbits (struct serial *scb, int num); #define SERIAL_SETSTOPBITS(SERIAL_T, NUM) serial_setstopbits ((SERIAL_T), (NUM)) /* Asynchronous serial interface: */ /* Can the serial device support asynchronous mode? */ -extern int serial_can_async_p (serial_t scb); +extern int serial_can_async_p (struct serial *scb); #define SERIAL_CAN_ASYNC_P(SERIAL_T) serial_can_async_p ((SERIAL_T)) /* Has the serial device been put in asynchronous mode? */ -extern int serial_is_async_p (serial_t scb); +extern int serial_is_async_p (struct serial *scb); #define SERIAL_IS_ASYNC_P(SERIAL_T) serial_is_async_p ((SERIAL_T)) /* For ASYNC enabled devices, register a callback and enable asynchronous mode. To disable asynchronous mode, register a NULL callback. */ -typedef void (serial_event_ftype) (serial_t scb, void *context); -extern void serial_async (serial_t scb, serial_event_ftype *handler, void *context); +typedef void (serial_event_ftype) (struct serial *scb, void *context); +extern void serial_async (struct serial *scb, serial_event_ftype *handler, void *context); #define SERIAL_ASYNC(SERIAL_T, HANDLER, CONTEXT) serial_async ((SERIAL_T), (HANDLER), (CONTEXT)) /* Provide direct access to the underlying FD (if any) used to @@ -182,7 +180,7 @@ extern void serial_async (serial_t scb, serial_event_ftype *handler, void *conte deprecated. Will call internal_error() if the operation isn't applicable to the current serial device. */ -extern int deprecated_serial_fd (serial_t scb); +extern int deprecated_serial_fd (struct serial *scb); #define DEPRECATED_SERIAL_FD(SERIAL_T) deprecated_serial_fd ((SERIAL_T)) /* Trace/debug mechanism. @@ -190,10 +188,10 @@ extern int deprecated_serial_fd (serial_t scb); SERIAL_DEBUG() enables/disables internal debugging. SERIAL_DEBUG_P() indicates the current debug state. */ -extern void serial_debug (serial_t scb, int debug_p); +extern void serial_debug (struct serial *scb, int debug_p); #define SERIAL_DEBUG(SERIAL_T, DEBUG_P) serial_debug ((SERIAL_T), (DEBUG_P)) -extern int serial_debug_p (serial_t scb); +extern int serial_debug_p (struct serial *scb); #define SERIAL_DEBUG_P(SERIAL_T) serial_debug_p ((SERIAL_T)) @@ -215,7 +213,7 @@ struct serial still need to wait for this many more seconds. */ char *name; /* The name of the device or host */ - struct serial *next; /* Pointer to the next serial_t */ + struct serial *next; /* Pointer to the next `struct serial *' */ int refcnt; /* Number of pointers to this block */ int debug_p; /* Trace this serial devices operation. */ int async_state; /* Async internal state. */ @@ -227,28 +225,30 @@ struct serial_ops { char *name; struct serial_ops *next; - int (*open) (serial_t, const char *name); - void (*close) (serial_t); - int (*readchar) (serial_t, int timeout); - int (*write) (serial_t, const char *str, int len); + int (*open) (struct serial *, const char *name); + void (*close) (struct serial *); + int (*readchar) (struct serial *, int timeout); + int (*write) (struct serial *, const char *str, int len); /* Discard pending output */ - int (*flush_output) (serial_t); + int (*flush_output) (struct serial *); /* Discard pending input */ - int (*flush_input) (serial_t); - int (*send_break) (serial_t); - void (*go_raw) (serial_t); - serial_ttystate (*get_tty_state) (serial_t); - int (*set_tty_state) (serial_t, serial_ttystate); - void (*print_tty_state) (serial_t, serial_ttystate, struct ui_file *); - int (*noflush_set_tty_state) (serial_t, serial_ttystate, serial_ttystate); - int (*setbaudrate) (serial_t, int rate); - int (*setstopbits) (serial_t, int num); + int (*flush_input) (struct serial *); + int (*send_break) (struct serial *); + void (*go_raw) (struct serial *); + serial_ttystate (*get_tty_state) (struct serial *); + int (*set_tty_state) (struct serial *, serial_ttystate); + void (*print_tty_state) (struct serial *, serial_ttystate, + struct ui_file *); + int (*noflush_set_tty_state) (struct serial *, serial_ttystate, + serial_ttystate); + int (*setbaudrate) (struct serial *, int rate); + int (*setstopbits) (struct serial *, int num); /* Wait for output to drain */ - int (*drain_output) (serial_t); + int (*drain_output) (struct serial *); /* Change the serial device into/out of asynchronous mode, call the specified function when ever there is something interesting. */ - void (*async) (serial_t scb, int async_p); + void (*async) (struct serial *scb, int async_p); }; /* Add a new serial interface to the interface list */ diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index c0f26df..b47031e 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -28,7 +28,7 @@ #include "arch-utils.h" #include "regcache.h" -static serial_t parallel; +static struct serial *parallel; static int parallel_in_use; static void sh3_open (char *args, int from_tty); @@ -120,7 +120,7 @@ sh3_supply_register (char *regname, int regnamelen, char *val, int vallen) } static void -sh3_load (serial_t desc, char *file, int hashmark) +sh3_load (struct serial *desc, char *file, int hashmark) { if (parallel_in_use) { diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c index a910d0c..9c2cb6b 100644 --- a/gdb/sparcl-tdep.c +++ b/gdb/sparcl-tdep.c @@ -38,14 +38,14 @@ static struct target_ops sparclite_ops; static char *remote_target_name = NULL; -static serial_t remote_desc = NULL; +static struct serial *remote_desc = NULL; static int serial_flag; #ifdef HAVE_SOCKETS static int udp_fd = -1; #endif -static serial_t open_tty (char *name); -static int send_resp (serial_t desc, char c); +static struct serial *open_tty (char *name); +static int send_resp (struct serial *desc, char c); static void close_tty (void * ignore); #ifdef HAVE_SOCKETS static int recv_udp_buf (int fd, unsigned char *buf, int len, int timeout); @@ -259,10 +259,10 @@ sparclite_stopped_data_address (void) return 0; } -static serial_t +static struct serial * open_tty (char *name) { - serial_t desc; + struct serial *desc; desc = SERIAL_OPEN (name); if (!desc) @@ -287,7 +287,7 @@ open_tty (char *name) /* Read a single character from the remote end, masking it down to 7 bits. */ static int -readchar (serial_t desc, int timeout) +readchar (struct serial *desc, int timeout) { int ch; char s[10]; @@ -313,7 +313,7 @@ readchar (serial_t desc, int timeout) } static void -debug_serial_write (serial_t desc, char *buf, int len) +debug_serial_write (struct serial *desc, char *buf, int len) { char s[10]; @@ -331,7 +331,7 @@ debug_serial_write (serial_t desc, char *buf, int len) static int -send_resp (serial_t desc, char c) +send_resp (struct serial *desc, char c) { debug_serial_write (desc, &c, 1); return readchar (desc, remote_timeout); diff --git a/gdb/sparclet-rom.c b/gdb/sparclet-rom.c index 937e57c..ea2c158 100644 --- a/gdb/sparclet-rom.c +++ b/gdb/sparclet-rom.c @@ -105,7 +105,7 @@ sparclet_supply_register (char *regname, int regnamelen, char *val, int vallen) } static void -sparclet_load (serial_t desc, char *file, int hashmark) +sparclet_load (struct serial *desc, char *file, int hashmark) { bfd *abfd; asection *s; @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -void load_srec (serial_t desc, const char *file, bfd_vma load_offset, +void load_srec (struct serial *desc, const char *file, bfd_vma load_offset, int maxrecsize, int flags, int hashmark, int (*waitack) (void)); diff --git a/gdb/utils.c b/gdb/utils.c index 855f474..a4adb86 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -825,7 +825,7 @@ print_sys_errmsg (char *string, int errcode) void quit (void) { - serial_t gdb_stdout_serial = serial_fdopen (1); + struct serial *gdb_stdout_serial = serial_fdopen (1); target_terminal_ours (); diff --git a/gdb/w89k-rom.c b/gdb/w89k-rom.c index ec9e2e7..331358b 100644 --- a/gdb/w89k-rom.c +++ b/gdb/w89k-rom.c @@ -160,7 +160,7 @@ static int hashmark = 1; /* flag set by "set hash" */ extern struct monitor_ops w89k_cmds; /* fwd decl */ static void -w89k_load (serial_t desc, char *file, int hashmark) +w89k_load (struct serial *desc, char *file, int hashmark) { bfd *abfd; asection *s; diff --git a/gdb/xmodem.c b/gdb/xmodem.c index 1ed9138..c428bc8 100644 --- a/gdb/xmodem.c +++ b/gdb/xmodem.c @@ -36,7 +36,7 @@ static int blknum; /* XMODEM block number */ static int crcflag; /* Sez we are using CRC's instead of cksums */ static int -readchar (serial_t desc, int timeout) +readchar (struct serial *desc, int timeout) { int c; @@ -109,7 +109,7 @@ docrc (unsigned char *p, int len) send NAK or CRC request. */ int -xmodem_init_xfer (serial_t desc) +xmodem_init_xfer (struct serial *desc) { int c; int i; @@ -160,7 +160,7 @@ xmodem_init_xfer (serial_t desc) */ void -xmodem_send_packet (serial_t desc, unsigned char *packet, int len, int hashmark) +xmodem_send_packet (struct serial *desc, unsigned char *packet, int len, int hashmark) { int i; int retries; @@ -246,7 +246,7 @@ xmodem_send_packet (serial_t desc, unsigned char *packet, int len, int hashmark) /* Finish off the transfer. Send out the EOT, and wait for an ACK. */ void -xmodem_finish_xfer (serial_t desc) +xmodem_finish_xfer (struct serial *desc) { int retries; diff --git a/gdb/xmodem.h b/gdb/xmodem.h index e753c51..86c5008 100644 --- a/gdb/xmodem.h +++ b/gdb/xmodem.h @@ -18,10 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -int xmodem_init_xfer (serial_t desc); -void send_xmodem_packet (serial_t desc, unsigned char *packet, int len, +int xmodem_init_xfer (struct serial *desc); +void send_xmodem_packet (struct serial *desc, unsigned char *packet, int len, int hashmark); -void xmodem_finish_xfer (serial_t desc); +void xmodem_finish_xfer (struct serial *desc); #define XMODEM_DATASIZE 128 /* The data size is ALWAYS 128 */ #define XMODEM_1KDATASIZE 1024 /* Unless it's 1024!!! */ |