mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-04-24 14:53:34 +08:00
* serial.h (SERIAL_ASYNC): Delete.
(DEPRECATED_SERIAL_FD): Delete. (SERIAL_DEBUG): Delete. (SERIAL_DEBUG_P): Delete. (SERIAL_DRAIN_OUTPUT): Delete. (SERIAL_FLUSH_OUTPUT): Delete. (SERIAL_FLUSH_INPUT): Delete. (SERIAL_SEND_BREAK): Delete. (SERIAL_RAW): Delete. (SERIAL_GET_TTY_STATE): Delete. (SERIAL_SET_TTY_STATE): Delete. (SERIAL_PRINT_TTY_STATE): Delete. (SERIAL_NOFLUSH_SET_TTY_STATE): Delete. (SERIAL_SETBAUDRATE): Delete. (SERIAL_SETSTOPBITS): Delete. (SERIAL_CAN_ASYNC_P): Delete. (SERIAL_IS_ASYNC_P): Delete. (SERIAL_UN_FDOPEN): Delete. (SERIAL_READCHAR): Delete. (SERIAL_CLOSE): Delete. (SERIAL_FDOPEN): Delete. (SERIAL_OPEN): Delete.
This commit is contained in:
parent
ea7c478fe2
commit
2cd58942b9
@ -1,3 +1,55 @@
|
|||||||
|
2001-07-14 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
* serial.h (SERIAL_ASYNC): Delete.
|
||||||
|
(DEPRECATED_SERIAL_FD): Delete.
|
||||||
|
(SERIAL_DEBUG): Delete.
|
||||||
|
(SERIAL_DEBUG_P): Delete.
|
||||||
|
(SERIAL_DRAIN_OUTPUT): Delete.
|
||||||
|
(SERIAL_FLUSH_OUTPUT): Delete.
|
||||||
|
(SERIAL_FLUSH_INPUT): Delete.
|
||||||
|
(SERIAL_SEND_BREAK): Delete.
|
||||||
|
(SERIAL_RAW): Delete.
|
||||||
|
(SERIAL_GET_TTY_STATE): Delete.
|
||||||
|
(SERIAL_SET_TTY_STATE): Delete.
|
||||||
|
(SERIAL_PRINT_TTY_STATE): Delete.
|
||||||
|
(SERIAL_NOFLUSH_SET_TTY_STATE): Delete.
|
||||||
|
(SERIAL_SETBAUDRATE): Delete.
|
||||||
|
(SERIAL_SETSTOPBITS): Delete.
|
||||||
|
(SERIAL_CAN_ASYNC_P): Delete.
|
||||||
|
(SERIAL_IS_ASYNC_P): Delete.
|
||||||
|
(SERIAL_UN_FDOPEN): Delete.
|
||||||
|
(SERIAL_READCHAR): Delete.
|
||||||
|
(SERIAL_CLOSE): Delete.
|
||||||
|
(SERIAL_FDOPEN): Delete.
|
||||||
|
(SERIAL_OPEN): Delete.
|
||||||
|
* ser-unix.c: Update.
|
||||||
|
* sparclet-rom.c: Update.
|
||||||
|
* remote-bug.c: Update.
|
||||||
|
* dsrec.c: Update.
|
||||||
|
* xmodem.c: Update.
|
||||||
|
* nindy-share/ttyflush.c: Update.
|
||||||
|
* nindy-share/Onindy.c: Update.
|
||||||
|
* utils.c: Update.
|
||||||
|
* serial.c: Update.
|
||||||
|
* remote-nindy.c: Update.
|
||||||
|
* inflow.c: Update.
|
||||||
|
* sparcl-tdep.c: Update.
|
||||||
|
* sh3-rom.c: Update.
|
||||||
|
* remote.c: Update.
|
||||||
|
* remote-utils.c: Update.
|
||||||
|
* remote-st.c: Update.
|
||||||
|
* remote-sds.c: Update.
|
||||||
|
* remote-rdp.c: Update.
|
||||||
|
* remote-os9k.c: Update.
|
||||||
|
* remote-nrom.c: Update.
|
||||||
|
* remote-mips.c: Update.
|
||||||
|
* remote-es.c: Update.
|
||||||
|
* remote-e7000.c: Update.
|
||||||
|
* remote-array.c: Update.
|
||||||
|
* ocd.c: Update.
|
||||||
|
* nindy-share/nindy.c: Update.
|
||||||
|
* monitor.c: Update.
|
||||||
|
|
||||||
2001-07-14 Andrew Cagney <ac131313@redhat.com>
|
2001-07-14 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
* mn10200-tdep.c: Replace value_ptr with ``struct value *''.
|
* mn10200-tdep.c: Replace value_ptr with ``struct value *''.
|
||||||
|
10
gdb/dsrec.c
10
gdb/dsrec.c
@ -84,7 +84,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
|||||||
srec[reclen] = '\0';
|
srec[reclen] = '\0';
|
||||||
puts_debug ("sent -->", srec, "<--");
|
puts_debug ("sent -->", srec, "<--");
|
||||||
}
|
}
|
||||||
SERIAL_WRITE (desc, srec, reclen);
|
serial_write (desc, srec, reclen);
|
||||||
|
|
||||||
for (s = abfd->sections; s; s = s->next)
|
for (s = abfd->sections; s; s = s->next)
|
||||||
if (s->flags & SEC_LOAD)
|
if (s->flags & SEC_LOAD)
|
||||||
@ -121,7 +121,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
|||||||
acknowledgement is sent back. */
|
acknowledgement is sent back. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (desc, srec, reclen);
|
serial_write (desc, srec, reclen);
|
||||||
if (ui_load_progress_hook)
|
if (ui_load_progress_hook)
|
||||||
if (ui_load_progress_hook (section_name, (unsigned long) i))
|
if (ui_load_progress_hook (section_name, (unsigned long) i))
|
||||||
error ("Canceled the download");
|
error ("Canceled the download");
|
||||||
@ -157,14 +157,14 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
|||||||
puts_debug ("sent -->", srec, "<--");
|
puts_debug ("sent -->", srec, "<--");
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_WRITE (desc, srec, reclen);
|
serial_write (desc, srec, reclen);
|
||||||
|
|
||||||
/* Some monitors need these to wake up properly. (Which ones? -sts) */
|
/* Some monitors need these to wake up properly. (Which ones? -sts) */
|
||||||
SERIAL_WRITE (desc, "\r\r", 2);
|
serial_write (desc, "\r\r", 2);
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
puts_debug ("sent -->", "\r\r", "<---");
|
puts_debug ("sent -->", "\r\r", "<---");
|
||||||
|
|
||||||
SERIAL_FLUSH_INPUT (desc);
|
serial_flush_input (desc);
|
||||||
|
|
||||||
report_transfer_performance (data_count, start_time, end_time);
|
report_transfer_performance (data_count, start_time, end_time);
|
||||||
}
|
}
|
||||||
|
25
gdb/inflow.c
25
gdb/inflow.c
@ -129,19 +129,20 @@ gdb_has_a_terminal (void)
|
|||||||
case no:
|
case no:
|
||||||
return 0;
|
return 0;
|
||||||
case have_not_checked:
|
case have_not_checked:
|
||||||
/* Get all the current tty settings (including whether we have a tty at
|
/* Get all the current tty settings (including whether we have a
|
||||||
all!). Can't do this in _initialize_inflow because SERIAL_FDOPEN
|
tty at all!). Can't do this in _initialize_inflow because
|
||||||
won't work until the serial_ops_list is initialized. */
|
serial_fdopen() won't work until the serial_ops_list is
|
||||||
|
initialized. */
|
||||||
|
|
||||||
#ifdef F_GETFL
|
#ifdef F_GETFL
|
||||||
tflags_ours = fcntl (0, F_GETFL, 0);
|
tflags_ours = fcntl (0, F_GETFL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gdb_has_a_terminal_flag = no;
|
gdb_has_a_terminal_flag = no;
|
||||||
stdin_serial = SERIAL_FDOPEN (0);
|
stdin_serial = serial_fdopen (0);
|
||||||
if (stdin_serial != NULL)
|
if (stdin_serial != NULL)
|
||||||
{
|
{
|
||||||
our_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
|
our_ttystate = serial_get_tty_state (stdin_serial);
|
||||||
|
|
||||||
if (our_ttystate != NULL)
|
if (our_ttystate != NULL)
|
||||||
{
|
{
|
||||||
@ -182,11 +183,11 @@ terminal_init_inferior_with_pgrp (int pgrp)
|
|||||||
{
|
{
|
||||||
if (gdb_has_a_terminal ())
|
if (gdb_has_a_terminal ())
|
||||||
{
|
{
|
||||||
/* We could just as well copy our_ttystate (if we felt like adding
|
/* We could just as well copy our_ttystate (if we felt like
|
||||||
a new function SERIAL_COPY_TTY_STATE). */
|
adding a new function serial_copy_tty_state()). */
|
||||||
if (inferior_ttystate)
|
if (inferior_ttystate)
|
||||||
xfree (inferior_ttystate);
|
xfree (inferior_ttystate);
|
||||||
inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
|
inferior_ttystate = serial_get_tty_state (stdin_serial);
|
||||||
|
|
||||||
#ifdef PROCESS_GROUP_TYPE
|
#ifdef PROCESS_GROUP_TYPE
|
||||||
inferior_process_group = pgrp;
|
inferior_process_group = pgrp;
|
||||||
@ -236,7 +237,7 @@ terminal_inferior (void)
|
|||||||
/* Because we were careful to not change in or out of raw mode in
|
/* Because we were careful to not change in or out of raw mode in
|
||||||
terminal_ours, we will not change in our out of raw mode with
|
terminal_ours, we will not change in our out of raw mode with
|
||||||
this call, so we don't flush any input. */
|
this call, so we don't flush any input. */
|
||||||
result = SERIAL_SET_TTY_STATE (stdin_serial, inferior_ttystate);
|
result = serial_set_tty_state (stdin_serial, inferior_ttystate);
|
||||||
OOPSY ("setting tty state");
|
OOPSY ("setting tty state");
|
||||||
|
|
||||||
if (!job_control)
|
if (!job_control)
|
||||||
@ -334,7 +335,7 @@ terminal_ours_1 (int output_only)
|
|||||||
|
|
||||||
if (inferior_ttystate)
|
if (inferior_ttystate)
|
||||||
xfree (inferior_ttystate);
|
xfree (inferior_ttystate);
|
||||||
inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
|
inferior_ttystate = serial_get_tty_state (stdin_serial);
|
||||||
#ifdef HAVE_TERMIOS
|
#ifdef HAVE_TERMIOS
|
||||||
inferior_process_group = tcgetpgrp (0);
|
inferior_process_group = tcgetpgrp (0);
|
||||||
#endif
|
#endif
|
||||||
@ -359,7 +360,7 @@ terminal_ours_1 (int output_only)
|
|||||||
though, since readline will deal with raw mode when/if it needs to.
|
though, since readline will deal with raw mode when/if it needs to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SERIAL_NOFLUSH_SET_TTY_STATE (stdin_serial, our_ttystate,
|
serial_noflush_set_tty_state (stdin_serial, our_ttystate,
|
||||||
inferior_ttystate);
|
inferior_ttystate);
|
||||||
|
|
||||||
if (job_control)
|
if (job_control)
|
||||||
@ -489,7 +490,7 @@ child_terminal_info (char *args, int from_tty)
|
|||||||
(int) inferior_process_group);
|
(int) inferior_process_group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SERIAL_PRINT_TTY_STATE (stdin_serial, inferior_ttystate, gdb_stdout);
|
serial_print_tty_state (stdin_serial, inferior_ttystate, gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NEW_TTY_PREFORK is called before forking a new child process,
|
/* NEW_TTY_PREFORK is called before forking a new child process,
|
||||||
|
@ -396,8 +396,8 @@ monitor_printf (char *pattern,...)
|
|||||||
void
|
void
|
||||||
monitor_write (char *buf, int buflen)
|
monitor_write (char *buf, int buflen)
|
||||||
{
|
{
|
||||||
if (SERIAL_WRITE (monitor_desc, buf, buflen))
|
if (serial_write (monitor_desc, buf, buflen))
|
||||||
fprintf_unfiltered (gdb_stderr, "SERIAL_WRITE failed: %s\n",
|
fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n",
|
||||||
safe_strerror (errno));
|
safe_strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ monitor_readchar (void)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
looping = 0;
|
looping = 0;
|
||||||
c = SERIAL_READCHAR (monitor_desc, timeout);
|
c = serial_readchar (monitor_desc, timeout);
|
||||||
|
|
||||||
if (c >= 0)
|
if (c >= 0)
|
||||||
c &= 0xff; /* don't lose bit 7 */
|
c &= 0xff; /* don't lose bit 7 */
|
||||||
@ -449,7 +449,7 @@ readchar (int timeout)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
looping = 0;
|
looping = 0;
|
||||||
c = SERIAL_READCHAR (monitor_desc, timeout);
|
c = serial_readchar (monitor_desc, timeout);
|
||||||
|
|
||||||
if (c >= 0)
|
if (c >= 0)
|
||||||
{
|
{
|
||||||
@ -772,27 +772,27 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
|
|||||||
xfree (dev_name);
|
xfree (dev_name);
|
||||||
dev_name = xstrdup (args);
|
dev_name = xstrdup (args);
|
||||||
|
|
||||||
monitor_desc = SERIAL_OPEN (dev_name);
|
monitor_desc = serial_open (dev_name);
|
||||||
|
|
||||||
if (!monitor_desc)
|
if (!monitor_desc)
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (monitor_desc, baud_rate))
|
if (serial_setbaudrate (monitor_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (monitor_desc);
|
serial_close (monitor_desc);
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (monitor_desc);
|
serial_raw (monitor_desc);
|
||||||
|
|
||||||
SERIAL_FLUSH_INPUT (monitor_desc);
|
serial_flush_input (monitor_desc);
|
||||||
|
|
||||||
/* some systems only work with 2 stop bits */
|
/* some systems only work with 2 stop bits */
|
||||||
|
|
||||||
SERIAL_SETSTOPBITS (monitor_desc, mon_ops->stopbits);
|
serial_setstopbits (monitor_desc, mon_ops->stopbits);
|
||||||
|
|
||||||
current_monitor = mon_ops;
|
current_monitor = mon_ops;
|
||||||
|
|
||||||
@ -822,7 +822,7 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
|
|||||||
monitor_expect_prompt (NULL, 0);
|
monitor_expect_prompt (NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_FLUSH_INPUT (monitor_desc);
|
serial_flush_input (monitor_desc);
|
||||||
|
|
||||||
/* Alloc breakpoints */
|
/* Alloc breakpoints */
|
||||||
if (mon_ops->set_break != NULL)
|
if (mon_ops->set_break != NULL)
|
||||||
@ -863,7 +863,7 @@ void
|
|||||||
monitor_close (int quitting)
|
monitor_close (int quitting)
|
||||||
{
|
{
|
||||||
if (monitor_desc)
|
if (monitor_desc)
|
||||||
SERIAL_CLOSE (monitor_desc);
|
serial_close (monitor_desc);
|
||||||
|
|
||||||
/* Free breakpoint memory */
|
/* Free breakpoint memory */
|
||||||
if (breakaddr != NULL)
|
if (breakaddr != NULL)
|
||||||
@ -1903,7 +1903,7 @@ monitor_read_memory (CORE_ADDR memaddr, char *myaddr, int len)
|
|||||||
|
|
||||||
if (current_monitor->getmem.term_cmd)
|
if (current_monitor->getmem.term_cmd)
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (monitor_desc, current_monitor->getmem.term_cmd,
|
serial_write (monitor_desc, current_monitor->getmem.term_cmd,
|
||||||
strlen (current_monitor->getmem.term_cmd));
|
strlen (current_monitor->getmem.term_cmd));
|
||||||
monitor_expect_prompt (NULL, 0);
|
monitor_expect_prompt (NULL, 0);
|
||||||
}
|
}
|
||||||
@ -2223,7 +2223,7 @@ monitor_stop (void)
|
|||||||
{
|
{
|
||||||
monitor_debug ("MON stop\n");
|
monitor_debug ("MON stop\n");
|
||||||
if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
|
if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
|
||||||
SERIAL_SEND_BREAK (monitor_desc);
|
serial_send_break (monitor_desc);
|
||||||
if (current_monitor->stop)
|
if (current_monitor->stop)
|
||||||
monitor_printf_noecho (current_monitor->stop);
|
monitor_printf_noecho (current_monitor->stop);
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ static int
|
|||||||
readchar()
|
readchar()
|
||||||
{
|
{
|
||||||
/* FIXME: Do we really want to be reading without a timeout? */
|
/* FIXME: Do we really want to be reading without a timeout? */
|
||||||
return SERIAL_READCHAR (nindy_serial, -1);
|
return serial_readchar (nindy_serial, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -222,10 +222,10 @@ getpkt (buf)
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Bad checksum (recv=0x%02x; calc=0x%02x); retrying\r\n",
|
"Bad checksum (recv=0x%02x; calc=0x%02x); retrying\r\n",
|
||||||
recv, csum );
|
recv, csum );
|
||||||
SERIAL_WRITE (nindy_serial, "-", 1);
|
serial_write (nindy_serial, "-", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_WRITE (nindy_serial, "+", 1);
|
serial_write (nindy_serial, "+", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -257,12 +257,12 @@ putpkt( cmd )
|
|||||||
resend = 1;
|
resend = 1;
|
||||||
do {
|
do {
|
||||||
if ( resend ) {
|
if ( resend ) {
|
||||||
SERIAL_WRITE ( nindy_serial, "\020", 1 );
|
serial_write ( nindy_serial, "\020", 1 );
|
||||||
SERIAL_WRITE( nindy_serial, cmd, strlen(cmd) );
|
serial_write( nindy_serial, cmd, strlen(cmd) );
|
||||||
SERIAL_WRITE( nindy_serial, checksum, strlen(checksum) );
|
serial_write( nindy_serial, checksum, strlen(checksum) );
|
||||||
}
|
}
|
||||||
/* FIXME: do we really want to be reading without timeout? */
|
/* FIXME: do we really want to be reading without timeout? */
|
||||||
ack = SERIAL_READCHAR (nindy_serial, -1);
|
ack = serial_readchar (nindy_serial, -1);
|
||||||
if (ack < 0)
|
if (ack < 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "error reading from serial port\n");
|
fprintf (stderr, "error reading from serial port\n");
|
||||||
|
@ -235,7 +235,7 @@ rdnin (buf,n,timeout)
|
|||||||
escape_seen = 0;
|
escape_seen = 0;
|
||||||
while (n)
|
while (n)
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (nindy_serial, timeout);
|
c = serial_readchar (nindy_serial, timeout);
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case SERIAL_ERROR:
|
case SERIAL_ERROR:
|
||||||
@ -308,14 +308,14 @@ getpkt(buf)
|
|||||||
cs_calc += buf[i];
|
cs_calc += buf[i];
|
||||||
}
|
}
|
||||||
if ( cs_calc == cs_recv ){
|
if ( cs_calc == cs_recv ){
|
||||||
SERIAL_WRITE (nindy_serial, "+", 1);
|
serial_write (nindy_serial, "+", 1);
|
||||||
return hdr[2];
|
return hdr[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bad checksum: report, send NAK, and re-receive
|
/* Bad checksum: report, send NAK, and re-receive
|
||||||
*/
|
*/
|
||||||
fprintf(stderr, errfmt, cs_recv, cs_calc );
|
fprintf(stderr, errfmt, cs_recv, cs_calc );
|
||||||
SERIAL_WRITE (nindy_serial, "-", 1);
|
serial_write (nindy_serial, "-", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ putpkt( msg, len )
|
|||||||
|
|
||||||
/* Attention, NINDY!
|
/* Attention, NINDY!
|
||||||
*/
|
*/
|
||||||
SERIAL_WRITE (nindy_serial, "\020", 1);
|
serial_write (nindy_serial, "\020", 1);
|
||||||
|
|
||||||
|
|
||||||
lenlo = len & 0xff;
|
lenlo = len & 0xff;
|
||||||
@ -387,19 +387,19 @@ putpkt( msg, len )
|
|||||||
|
|
||||||
/* Send checksummed message over and over until we get a positive ack
|
/* Send checksummed message over and over until we get a positive ack
|
||||||
*/
|
*/
|
||||||
SERIAL_WRITE (nindy_serial, buf, p - buf);
|
serial_write (nindy_serial, buf, p - buf);
|
||||||
while (1){
|
while (1){
|
||||||
if ( !rdnin(&ack,1,5) ){
|
if ( !rdnin(&ack,1,5) ){
|
||||||
/* timed out */
|
/* timed out */
|
||||||
fprintf(stderr,"ACK timed out; resending\r\n");
|
fprintf(stderr,"ACK timed out; resending\r\n");
|
||||||
/* Attention, NINDY! */
|
/* Attention, NINDY! */
|
||||||
SERIAL_WRITE (nindy_serial, "\020", 1);
|
serial_write (nindy_serial, "\020", 1);
|
||||||
SERIAL_WRITE (nindy_serial, buf, p - buf);
|
serial_write (nindy_serial, buf, p - buf);
|
||||||
} else if ( ack == '+' ){
|
} else if ( ack == '+' ){
|
||||||
return;
|
return;
|
||||||
} else if ( ack == '-' ){
|
} else if ( ack == '-' ){
|
||||||
fprintf( stderr, "Remote NAK; resending\r\n" );
|
fprintf( stderr, "Remote NAK; resending\r\n" );
|
||||||
SERIAL_WRITE (nindy_serial, buf, p - buf);
|
serial_write (nindy_serial, buf, p - buf);
|
||||||
} else {
|
} else {
|
||||||
fprintf( stderr, "Bad ACK, ignored: <%c>\r\n", ack );
|
fprintf( stderr, "Bad ACK, ignored: <%c>\r\n", ack );
|
||||||
}
|
}
|
||||||
@ -520,15 +520,15 @@ try_baudrate (serial, brp)
|
|||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
/* Set specified baud rate and flush all pending input */
|
/* Set specified baud rate and flush all pending input */
|
||||||
SERIAL_SETBAUDRATE (serial, brp->rate);
|
serial_setbaudrate (serial, brp->rate);
|
||||||
tty_flush (serial);
|
tty_flush (serial);
|
||||||
|
|
||||||
/* Send empty command with bad checksum, hope for NAK ('-') response */
|
/* Send empty command with bad checksum, hope for NAK ('-') response */
|
||||||
SERIAL_WRITE (serial, "\020\0\0\001", 4);
|
serial_write (serial, "\020\0\0\001", 4);
|
||||||
|
|
||||||
/* Anything but a quick '-', including error, eof, or timeout, means that
|
/* Anything but a quick '-', including error, eof, or timeout, means that
|
||||||
this baudrate doesn't work. */
|
this baudrate doesn't work. */
|
||||||
return SERIAL_READCHAR (serial, 1) == '-';
|
return serial_readchar (serial, 1) == '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@ -576,7 +576,7 @@ autobaud( serial, brp )
|
|||||||
ninBaud (brp->string);
|
ninBaud (brp->string);
|
||||||
|
|
||||||
/* Change our baud rate back to rate to which we just set NINDY. */
|
/* Change our baud rate back to rate to which we just set NINDY. */
|
||||||
SERIAL_SETBAUDRATE (serial, brp->rate);
|
serial_setbaudrate (serial, brp->rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
@ -615,7 +615,7 @@ ninBaud( baudrate )
|
|||||||
csum += *p;
|
csum += *p;
|
||||||
}
|
}
|
||||||
sprintf (msg, "\020z%s#%02x", baudrate, csum);
|
sprintf (msg, "\020z%s#%02x", baudrate, csum);
|
||||||
SERIAL_WRITE (nindy_serial, msg, strlen (msg));
|
serial_write (nindy_serial, msg, strlen (msg));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -714,17 +714,17 @@ ninConnect( name, baudrate, brk, silent, old_protocol )
|
|||||||
p = xmalloc(strlen(prefix[i]) + strlen(name) + 1 );
|
p = xmalloc(strlen(prefix[i]) + strlen(name) + 1 );
|
||||||
strcpy( p, prefix[i] );
|
strcpy( p, prefix[i] );
|
||||||
strcat( p, name );
|
strcat( p, name );
|
||||||
nindy_serial = SERIAL_OPEN (p);
|
nindy_serial = serial_open (p);
|
||||||
if (nindy_serial != NULL) {
|
if (nindy_serial != NULL) {
|
||||||
#ifdef TIOCEXCL
|
#ifdef TIOCEXCL
|
||||||
/* Exclusive use mode (hp9000 does not support it) */
|
/* Exclusive use mode (hp9000 does not support it) */
|
||||||
ioctl(nindy_serial->fd,TIOCEXCL,NULL);
|
ioctl(nindy_serial->fd,TIOCEXCL,NULL);
|
||||||
#endif
|
#endif
|
||||||
SERIAL_RAW (nindy_serial);
|
serial_raw (nindy_serial);
|
||||||
|
|
||||||
if (brk)
|
if (brk)
|
||||||
{
|
{
|
||||||
SERIAL_SEND_BREAK (nindy_serial);
|
serial_send_break (nindy_serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
brp = parse_baudrate( baudrate );
|
brp = parse_baudrate( baudrate );
|
||||||
|
@ -31,10 +31,10 @@ tty_flush (serial)
|
|||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
SERIAL_FLUSH_INPUT (serial);
|
serial_flush_input (serial);
|
||||||
SERIAL_FLUSH_OUTPUT (serial);
|
serial_flush_output (serial);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
switch (SERIAL_READCHAR (serial, 0))
|
switch (serial_readchar (serial, 0))
|
||||||
{
|
{
|
||||||
case SERIAL_TIMEOUT:
|
case SERIAL_TIMEOUT:
|
||||||
case SERIAL_ERROR:
|
case SERIAL_ERROR:
|
||||||
|
22
gdb/ocd.c
22
gdb/ocd.c
@ -163,7 +163,7 @@ void
|
|||||||
ocd_close (int quitting)
|
ocd_close (int quitting)
|
||||||
{
|
{
|
||||||
if (ocd_desc)
|
if (ocd_desc)
|
||||||
SERIAL_CLOSE (ocd_desc);
|
serial_close (ocd_desc);
|
||||||
ocd_desc = NULL;
|
ocd_desc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ ocd_start_remote (PTR dummy)
|
|||||||
|
|
||||||
immediate_quit++; /* Allow user to interrupt it */
|
immediate_quit++; /* Allow user to interrupt it */
|
||||||
|
|
||||||
SERIAL_SEND_BREAK (ocd_desc); /* Wake up the wiggler */
|
serial_send_break (ocd_desc); /* Wake up the wiggler */
|
||||||
|
|
||||||
speed = 80; /* Divide clock by 4000 */
|
speed = 80; /* Divide clock by 4000 */
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ device the OCD device is attached to (e.g. /dev/ttya).");
|
|||||||
|
|
||||||
if (strncmp (name, "wiggler", 7) == 0)
|
if (strncmp (name, "wiggler", 7) == 0)
|
||||||
{
|
{
|
||||||
ocd_desc = SERIAL_OPEN ("ocd");
|
ocd_desc = serial_open ("ocd");
|
||||||
if (!ocd_desc)
|
if (!ocd_desc)
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
|
|
||||||
@ -309,25 +309,25 @@ device the OCD device is attached to (e.g. /dev/ttya).");
|
|||||||
else
|
else
|
||||||
/* not using Wigglers.dll */
|
/* not using Wigglers.dll */
|
||||||
{
|
{
|
||||||
ocd_desc = SERIAL_OPEN (name);
|
ocd_desc = serial_open (name);
|
||||||
if (!ocd_desc)
|
if (!ocd_desc)
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (ocd_desc, baud_rate))
|
if (serial_setbaudrate (ocd_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (ocd_desc);
|
serial_close (ocd_desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (ocd_desc);
|
serial_raw (ocd_desc);
|
||||||
|
|
||||||
/* If there is something sitting in the buffer we might take it as a
|
/* If there is something sitting in the buffer we might take it as a
|
||||||
response to a command, which would be bad. */
|
response to a command, which would be bad. */
|
||||||
SERIAL_FLUSH_INPUT (ocd_desc);
|
serial_flush_input (ocd_desc);
|
||||||
|
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
{
|
{
|
||||||
@ -789,7 +789,7 @@ readchar (int timeout)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
ch = SERIAL_READCHAR (ocd_desc, timeout);
|
ch = serial_readchar (ocd_desc, timeout);
|
||||||
|
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
@ -843,7 +843,7 @@ reset_packet (void)
|
|||||||
static void
|
static void
|
||||||
output_packet (void)
|
output_packet (void)
|
||||||
{
|
{
|
||||||
if (SERIAL_WRITE (ocd_desc, pkt, pktp - pkt))
|
if (serial_write (ocd_desc, pkt, pktp - pkt))
|
||||||
perror_with_name ("output_packet: write failed");
|
perror_with_name ("output_packet: write failed");
|
||||||
|
|
||||||
reset_packet ();
|
reset_packet ();
|
||||||
@ -941,7 +941,7 @@ ocd_put_packet (unsigned char *buf, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*packet_ptr++ = -checksum;
|
*packet_ptr++ = -checksum;
|
||||||
if (SERIAL_WRITE (ocd_desc, packet, packet_ptr - packet))
|
if (serial_write (ocd_desc, packet, packet_ptr - packet))
|
||||||
perror_with_name ("output_packet: write failed");
|
perror_with_name ("output_packet: write failed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -191,8 +191,8 @@ printf_monitor (char *pattern,...)
|
|||||||
|
|
||||||
if (strlen (buf) > PBUFSIZ)
|
if (strlen (buf) > PBUFSIZ)
|
||||||
error ("printf_monitor(): string too long");
|
error ("printf_monitor(): string too long");
|
||||||
if (SERIAL_WRITE (array_desc, buf, strlen (buf)))
|
if (serial_write (array_desc, buf, strlen (buf)))
|
||||||
fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* write_monitor -- send raw data to monitor.
|
* write_monitor -- send raw data to monitor.
|
||||||
@ -200,8 +200,8 @@ printf_monitor (char *pattern,...)
|
|||||||
static void
|
static void
|
||||||
write_monitor (char data[], int len)
|
write_monitor (char data[], int len)
|
||||||
{
|
{
|
||||||
if (SERIAL_WRITE (array_desc, data, len))
|
if (serial_write (array_desc, data, len))
|
||||||
fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
|
||||||
|
|
||||||
*(data + len + 1) = '\0';
|
*(data + len + 1) = '\0';
|
||||||
debuglogs (1, "write_monitor(), Sending: \"%s\".", data);
|
debuglogs (1, "write_monitor(), Sending: \"%s\".", data);
|
||||||
@ -301,7 +301,7 @@ readchar (int timeout)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
c = SERIAL_READCHAR (array_desc, abs (timeout));
|
c = serial_readchar (array_desc, abs (timeout));
|
||||||
|
|
||||||
if (sr_get_debug () > 5)
|
if (sr_get_debug () > 5)
|
||||||
{
|
{
|
||||||
@ -560,21 +560,21 @@ array_open (char *args, char *name, int from_tty)
|
|||||||
mips_set_processor_type_command ("lsi33k", 0);
|
mips_set_processor_type_command ("lsi33k", 0);
|
||||||
|
|
||||||
strcpy (dev_name, args);
|
strcpy (dev_name, args);
|
||||||
array_desc = SERIAL_OPEN (dev_name);
|
array_desc = serial_open (dev_name);
|
||||||
|
|
||||||
if (array_desc == NULL)
|
if (array_desc == NULL)
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (array_desc, baud_rate))
|
if (serial_setbaudrate (array_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (array_desc);
|
serial_close (array_desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (array_desc);
|
serial_raw (array_desc);
|
||||||
|
|
||||||
#if defined (LOG_FILE)
|
#if defined (LOG_FILE)
|
||||||
log_file = fopen (LOG_FILE, "w");
|
log_file = fopen (LOG_FILE, "w");
|
||||||
@ -616,7 +616,7 @@ array_open (char *args, char *name, int from_tty)
|
|||||||
static void
|
static void
|
||||||
array_close (int quitting)
|
array_close (int quitting)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (array_desc);
|
serial_close (array_desc);
|
||||||
array_desc = NULL;
|
array_desc = NULL;
|
||||||
|
|
||||||
debuglogs (1, "array_close (quitting=%d)", quitting);
|
debuglogs (1, "array_close (quitting=%d)", quitting);
|
||||||
@ -705,9 +705,9 @@ array_wait (ptid_t ptid, struct target_waitstatus *status)
|
|||||||
timeout = 0; /* Don't time out -- user program is running. */
|
timeout = 0; /* Don't time out -- user program is running. */
|
||||||
|
|
||||||
#if !defined(__GO32__) && !defined(__MSDOS__) && !defined(_WIN32)
|
#if !defined(__GO32__) && !defined(__MSDOS__) && !defined(_WIN32)
|
||||||
tty_desc = SERIAL_FDOPEN (0);
|
tty_desc = serial_fdopen (0);
|
||||||
ttystate = SERIAL_GET_TTY_STATE (tty_desc);
|
ttystate = serial_get_tty_state (tty_desc);
|
||||||
SERIAL_RAW (tty_desc);
|
serial_raw (tty_desc);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
/* poll on the serial port and the keyboard. */
|
/* poll on the serial port and the keyboard. */
|
||||||
@ -731,10 +731,10 @@ array_wait (ptid_t ptid, struct target_waitstatus *status)
|
|||||||
fputc_unfiltered (c, gdb_stdout);
|
fputc_unfiltered (c, gdb_stdout);
|
||||||
gdb_flush (gdb_stdout);
|
gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
c = SERIAL_READCHAR (tty_desc, timeout);
|
c = serial_readchar (tty_desc, timeout);
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (array_desc, &c, 1);
|
serial_write (array_desc, &c, 1);
|
||||||
/* do this so it looks like there's keyboard echo */
|
/* do this so it looks like there's keyboard echo */
|
||||||
if (c == 3) /* exit on Control-C */
|
if (c == 3) /* exit on Control-C */
|
||||||
break;
|
break;
|
||||||
@ -744,7 +744,7 @@ array_wait (ptid_t ptid, struct target_waitstatus *status)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SERIAL_SET_TTY_STATE (tty_desc, ttystate);
|
serial_set_tty_state (tty_desc, ttystate);
|
||||||
#else
|
#else
|
||||||
expect_prompt (1);
|
expect_prompt (1);
|
||||||
debuglogs (4, "array_wait(), got the expect_prompt.");
|
debuglogs (4, "array_wait(), got the expect_prompt.");
|
||||||
|
@ -398,7 +398,7 @@ bug_srec_write_cr (char *s)
|
|||||||
printf ("%c", *p);
|
printf ("%c", *p);
|
||||||
|
|
||||||
do
|
do
|
||||||
SERIAL_WRITE (sr_get_desc (), p, 1);
|
serial_write (sr_get_desc (), p, 1);
|
||||||
while (sr_pollchar () != *p);
|
while (sr_pollchar () != *p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -154,8 +154,8 @@ puts_e7000debug (char *buf)
|
|||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
printf_unfiltered ("Sending %s\n", buf);
|
printf_unfiltered ("Sending %s\n", buf);
|
||||||
|
|
||||||
if (SERIAL_WRITE (e7000_desc, buf, strlen (buf)))
|
if (serial_write (e7000_desc, buf, strlen (buf)))
|
||||||
fprintf_unfiltered (gdb_stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n", safe_strerror (errno));
|
||||||
|
|
||||||
/* And expect to see it echoed, unless using the pc interface */
|
/* And expect to see it echoed, unless using the pc interface */
|
||||||
#if 0
|
#if 0
|
||||||
@ -170,13 +170,13 @@ putchar_e7000 (int x)
|
|||||||
char b[1];
|
char b[1];
|
||||||
|
|
||||||
b[0] = x;
|
b[0] = x;
|
||||||
SERIAL_WRITE (e7000_desc, b, 1);
|
serial_write (e7000_desc, b, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_e7000 (char *s)
|
write_e7000 (char *s)
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (e7000_desc, s, strlen (s));
|
serial_write (e7000_desc, s, strlen (s));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -198,7 +198,7 @@ readchar (int timeout)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (e7000_desc, timeout);
|
c = serial_readchar (e7000_desc, timeout);
|
||||||
}
|
}
|
||||||
while (c > 127);
|
while (c > 127);
|
||||||
|
|
||||||
@ -645,17 +645,17 @@ e7000_open (char *args, int from_tty)
|
|||||||
|
|
||||||
push_target (&e7000_ops);
|
push_target (&e7000_ops);
|
||||||
|
|
||||||
e7000_desc = SERIAL_OPEN (dev_name);
|
e7000_desc = serial_open (dev_name);
|
||||||
|
|
||||||
if (!e7000_desc)
|
if (!e7000_desc)
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
|
|
||||||
if (SERIAL_SETBAUDRATE (e7000_desc, baudrate))
|
if (serial_setbaudrate (e7000_desc, baudrate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (e7000_desc);
|
serial_close (e7000_desc);
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
}
|
}
|
||||||
SERIAL_RAW (e7000_desc);
|
serial_raw (e7000_desc);
|
||||||
|
|
||||||
#ifdef GDB_TARGET_IS_H8300
|
#ifdef GDB_TARGET_IS_H8300
|
||||||
h8300hmode = 1;
|
h8300hmode = 1;
|
||||||
@ -678,7 +678,7 @@ e7000_close (int quitting)
|
|||||||
{
|
{
|
||||||
if (e7000_desc)
|
if (e7000_desc)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (e7000_desc);
|
serial_close (e7000_desc);
|
||||||
e7000_desc = 0;
|
e7000_desc = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1170,7 +1170,7 @@ write_large (CORE_ADDR memaddr, unsigned char *myaddr, int len)
|
|||||||
compose[where++] = '\n';
|
compose[where++] = '\n';
|
||||||
compose[where++] = 0;
|
compose[where++] = 0;
|
||||||
|
|
||||||
SERIAL_WRITE (e7000_desc, compose, where);
|
serial_write (e7000_desc, compose, where);
|
||||||
j = readchar (0);
|
j = readchar (0);
|
||||||
if (j == -1)
|
if (j == -1)
|
||||||
{
|
{
|
||||||
@ -1604,9 +1604,9 @@ e7000_load (char *args, int from_tty)
|
|||||||
|
|
||||||
bfd_get_section_contents (pbfd, section, buf + 10, fptr, count);
|
bfd_get_section_contents (pbfd, section, buf + 10, fptr, count);
|
||||||
|
|
||||||
if (SERIAL_WRITE (e7000_desc, buf, count + 10))
|
if (serial_write (e7000_desc, buf, count + 10))
|
||||||
fprintf_unfiltered (gdb_stderr,
|
fprintf_unfiltered (gdb_stderr,
|
||||||
"e7000_load: SERIAL_WRITE failed: %s\n",
|
"e7000_load: serial_write failed: %s\n",
|
||||||
safe_strerror (errno));
|
safe_strerror (errno));
|
||||||
|
|
||||||
expect ("OK");
|
expect ("OK");
|
||||||
|
@ -311,41 +311,41 @@ es1800_open (char *name, int from_tty)
|
|||||||
|
|
||||||
#ifndef DEBUG_STDIN
|
#ifndef DEBUG_STDIN
|
||||||
|
|
||||||
es1800_desc = SERIAL_OPEN (name);
|
es1800_desc = serial_open (name);
|
||||||
if (es1800_desc == NULL)
|
if (es1800_desc == NULL)
|
||||||
{
|
{
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
savename = savestring (name, strlen (name));
|
savename = savestring (name, strlen (name));
|
||||||
|
|
||||||
es1800_saved_ttystate = SERIAL_GET_TTY_STATE (es1800_desc);
|
es1800_saved_ttystate = serial_get_tty_state (es1800_desc);
|
||||||
|
|
||||||
if ((fcflag = fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_GETFL, 0)) == -1)
|
if ((fcflag = fcntl (deprecated_serial_fd (es1800_desc), F_GETFL, 0)) == -1)
|
||||||
{
|
{
|
||||||
perror_with_name ("fcntl serial");
|
perror_with_name ("fcntl serial");
|
||||||
}
|
}
|
||||||
es1800_fc_save = fcflag;
|
es1800_fc_save = fcflag;
|
||||||
|
|
||||||
fcflag = (fcflag & (FREAD | FWRITE)); /* mask out any funny stuff */
|
fcflag = (fcflag & (FREAD | FWRITE)); /* mask out any funny stuff */
|
||||||
if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, fcflag) == -1)
|
if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, fcflag) == -1)
|
||||||
{
|
{
|
||||||
perror_with_name ("fcntl serial");
|
perror_with_name ("fcntl serial");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (es1800_desc, baud_rate))
|
if (serial_setbaudrate (es1800_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (es1800_desc);
|
serial_close (es1800_desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (es1800_desc);
|
serial_raw (es1800_desc);
|
||||||
|
|
||||||
/* If there is something sitting in the buffer we might take it as a
|
/* If there is something sitting in the buffer we might take it as a
|
||||||
response to a command, which would be bad. */
|
response to a command, which would be bad. */
|
||||||
SERIAL_FLUSH_INPUT (es1800_desc);
|
serial_flush_input (es1800_desc);
|
||||||
|
|
||||||
#endif /* DEBUG_STDIN */
|
#endif /* DEBUG_STDIN */
|
||||||
|
|
||||||
@ -427,10 +427,10 @@ es1800_close (int quitting)
|
|||||||
if (es1800_desc != NULL)
|
if (es1800_desc != NULL)
|
||||||
{
|
{
|
||||||
printf ("\nClosing connection to emulator...\n");
|
printf ("\nClosing connection to emulator...\n");
|
||||||
if (SERIAL_SET_TTY_STATE (es1800_desc, es1800_saved_ttystate) < 0)
|
if (serial_set_tty_state (es1800_desc, es1800_saved_ttystate) < 0)
|
||||||
print_sys_errmsg ("warning: unable to restore tty state", errno);
|
print_sys_errmsg ("warning: unable to restore tty state", errno);
|
||||||
fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, es1800_fc_save);
|
fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, es1800_fc_save);
|
||||||
SERIAL_CLOSE (es1800_desc);
|
serial_close (es1800_desc);
|
||||||
es1800_desc = NULL;
|
es1800_desc = NULL;
|
||||||
}
|
}
|
||||||
if (savename != NULL)
|
if (savename != NULL)
|
||||||
@ -1549,7 +1549,7 @@ readchar (void)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
ch = SERIAL_READCHAR (es1800_desc, timeout);
|
ch = serial_readchar (es1800_desc, timeout);
|
||||||
|
|
||||||
/* FIXME: doing an error() here will probably cause trouble, at least if from
|
/* FIXME: doing an error() here will probably cause trouble, at least if from
|
||||||
es1800_wait. */
|
es1800_wait. */
|
||||||
@ -1579,7 +1579,7 @@ static void
|
|||||||
send_with_reply (char *string, char *buf, int len)
|
send_with_reply (char *string, char *buf, int len)
|
||||||
{
|
{
|
||||||
send (string);
|
send (string);
|
||||||
SERIAL_WRITE (es1800_desc, "\r", 1);
|
serial_write (es1800_desc, "\r", 1);
|
||||||
|
|
||||||
#ifndef DEBUG_STDIN
|
#ifndef DEBUG_STDIN
|
||||||
expect (string, 1);
|
expect (string, 1);
|
||||||
@ -1598,7 +1598,7 @@ static void
|
|||||||
send_command (char *string)
|
send_command (char *string)
|
||||||
{
|
{
|
||||||
send (string);
|
send (string);
|
||||||
SERIAL_WRITE (es1800_desc, "\r", 1);
|
serial_write (es1800_desc, "\r", 1);
|
||||||
|
|
||||||
#ifndef DEBUG_STDIN
|
#ifndef DEBUG_STDIN
|
||||||
expect (string, 0);
|
expect (string, 0);
|
||||||
@ -1617,7 +1617,7 @@ send (char *string)
|
|||||||
{
|
{
|
||||||
fprintf (stderr, "Sending: %s\n", string);
|
fprintf (stderr, "Sending: %s\n", string);
|
||||||
}
|
}
|
||||||
SERIAL_WRITE (es1800_desc, string, strlen (string));
|
serial_write (es1800_desc, string, strlen (string));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1785,7 +1785,7 @@ es1800_transparent (char *args, int from_tty)
|
|||||||
perror_with_name ("ioctl console");
|
perror_with_name ("ioctl console");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fcflag = fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_GETFL, 0)) == -1)
|
if ((fcflag = fcntl (deprecated_serial_fd (es1800_desc), F_GETFL, 0)) == -1)
|
||||||
{
|
{
|
||||||
perror_with_name ("fcntl serial");
|
perror_with_name ("fcntl serial");
|
||||||
}
|
}
|
||||||
@ -1793,7 +1793,7 @@ es1800_transparent (char *args, int from_tty)
|
|||||||
es1800_fc_save = fcflag;
|
es1800_fc_save = fcflag;
|
||||||
fcflag = fcflag | FNDELAY;
|
fcflag = fcflag | FNDELAY;
|
||||||
|
|
||||||
if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, fcflag) == -1)
|
if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, fcflag) == -1)
|
||||||
{
|
{
|
||||||
perror_with_name ("fcntl serial");
|
perror_with_name ("fcntl serial");
|
||||||
}
|
}
|
||||||
@ -1811,7 +1811,7 @@ es1800_transparent (char *args, int from_tty)
|
|||||||
{
|
{
|
||||||
es1800_buf[es1800_cnt++] = inputbuf[i++];
|
es1800_buf[es1800_cnt++] = inputbuf[i++];
|
||||||
}
|
}
|
||||||
if ((cc = SERIAL_WRITE (es1800_desc, es1800_buf, es1800_cnt)) == -1)
|
if ((cc = serial_write (es1800_desc, es1800_buf, es1800_cnt)) == -1)
|
||||||
{
|
{
|
||||||
perror_with_name ("FEL! write:");
|
perror_with_name ("FEL! write:");
|
||||||
}
|
}
|
||||||
@ -1829,7 +1829,7 @@ es1800_transparent (char *args, int from_tty)
|
|||||||
perror_with_name ("FEL! read:");
|
perror_with_name ("FEL! read:");
|
||||||
}
|
}
|
||||||
|
|
||||||
cc = read (DEPRECATED_SERIAL_FD (es1800_desc), inputbuf, inputcnt);
|
cc = read (deprecated_serial_fd (es1800_desc), inputbuf, inputcnt);
|
||||||
if (cc != -1)
|
if (cc != -1)
|
||||||
{
|
{
|
||||||
for (i = 0; i < cc;)
|
for (i = 0; i < cc;)
|
||||||
@ -1868,7 +1868,7 @@ es1800_transparent (char *args, int from_tty)
|
|||||||
|
|
||||||
close (console);
|
close (console);
|
||||||
|
|
||||||
if (fcntl (DEPRECATED_SERIAL_FD (es1800_desc), F_SETFL, es1800_fc_save) == -1)
|
if (fcntl (deprecated_serial_fd (es1800_desc), F_SETFL, es1800_fc_save) == -1)
|
||||||
{
|
{
|
||||||
perror_with_name ("FEL! fcntl");
|
perror_with_name ("FEL! fcntl");
|
||||||
}
|
}
|
||||||
|
@ -455,11 +455,11 @@ static void
|
|||||||
close_ports (void)
|
close_ports (void)
|
||||||
{
|
{
|
||||||
mips_is_open = 0;
|
mips_is_open = 0;
|
||||||
SERIAL_CLOSE (mips_desc);
|
serial_close (mips_desc);
|
||||||
|
|
||||||
if (udp_in_use)
|
if (udp_in_use)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (udp_desc);
|
serial_close (udp_desc);
|
||||||
udp_in_use = 0;
|
udp_in_use = 0;
|
||||||
}
|
}
|
||||||
tftp_in_use = 0;
|
tftp_in_use = 0;
|
||||||
@ -551,10 +551,10 @@ mips_expect_timeout (const char *string, int timeout)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
/* Must use SERIAL_READCHAR here cuz mips_readchar would get confused if we
|
/* Must use serial_readchar() here cuz mips_readchar would get
|
||||||
were waiting for the mips_monitor_prompt... */
|
confused if we were waiting for the mips_monitor_prompt... */
|
||||||
|
|
||||||
c = SERIAL_READCHAR (mips_desc, timeout);
|
c = serial_readchar (mips_desc, timeout);
|
||||||
|
|
||||||
if (c == SERIAL_TIMEOUT)
|
if (c == SERIAL_TIMEOUT)
|
||||||
{
|
{
|
||||||
@ -607,7 +607,7 @@ mips_getstring (char *string, int n)
|
|||||||
immediate_quit++;
|
immediate_quit++;
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (mips_desc, remote_timeout);
|
c = serial_readchar (mips_desc, remote_timeout);
|
||||||
|
|
||||||
if (c == SERIAL_TIMEOUT)
|
if (c == SERIAL_TIMEOUT)
|
||||||
{
|
{
|
||||||
@ -626,13 +626,13 @@ mips_getstring (char *string, int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read a character from the remote, aborting on error. Returns
|
/* Read a character from the remote, aborting on error. Returns
|
||||||
SERIAL_TIMEOUT on timeout (since that's what SERIAL_READCHAR
|
SERIAL_TIMEOUT on timeout (since that's what serial_readchar()
|
||||||
returns). FIXME: If we see the string mips_monitor_prompt from
|
returns). FIXME: If we see the string mips_monitor_prompt from the
|
||||||
the board, then we are debugging on the main console port, and we
|
board, then we are debugging on the main console port, and we have
|
||||||
have somehow dropped out of remote debugging mode. In this case,
|
somehow dropped out of remote debugging mode. In this case, we
|
||||||
we automatically go back in to remote debugging mode. This is a
|
automatically go back in to remote debugging mode. This is a hack,
|
||||||
hack, put in because I can't find any way for a program running on
|
put in because I can't find any way for a program running on the
|
||||||
the remote board to terminate without also ending remote debugging
|
remote board to terminate without also ending remote debugging
|
||||||
mode. I assume users won't have any trouble with this; for one
|
mode. I assume users won't have any trouble with this; for one
|
||||||
thing, the IDT documentation generally assumes that the remote
|
thing, the IDT documentation generally assumes that the remote
|
||||||
debugging port is not the console port. This is, however, very
|
debugging port is not the console port. This is, however, very
|
||||||
@ -656,7 +656,7 @@ mips_readchar (int timeout)
|
|||||||
|
|
||||||
if (state == mips_monitor_prompt_len)
|
if (state == mips_monitor_prompt_len)
|
||||||
timeout = 1;
|
timeout = 1;
|
||||||
ch = SERIAL_READCHAR (mips_desc, timeout);
|
ch = serial_readchar (mips_desc, timeout);
|
||||||
|
|
||||||
if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off */
|
if (ch == SERIAL_TIMEOUT && timeout == -1) /* Watchdog went off */
|
||||||
{
|
{
|
||||||
@ -882,7 +882,7 @@ mips_send_packet (const char *s, int get_ack)
|
|||||||
fprintf_unfiltered (gdb_stdlog, "Writing \"%s\"\n", packet + 1);
|
fprintf_unfiltered (gdb_stdlog, "Writing \"%s\"\n", packet + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SERIAL_WRITE (mips_desc, packet,
|
if (serial_write (mips_desc, packet,
|
||||||
HDR_LENGTH + len + TRLR_LENGTH) != 0)
|
HDR_LENGTH + len + TRLR_LENGTH) != 0)
|
||||||
mips_error ("write to target failed: %s", safe_strerror (errno));
|
mips_error ("write to target failed: %s", safe_strerror (errno));
|
||||||
|
|
||||||
@ -1142,7 +1142,7 @@ mips_receive_packet (char *buff, int throw_error, int timeout)
|
|||||||
ack + 1);
|
ack + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
|
if (serial_write (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
|
||||||
{
|
{
|
||||||
if (throw_error)
|
if (throw_error)
|
||||||
mips_error ("write to target failed: %s", safe_strerror (errno));
|
mips_error ("write to target failed: %s", safe_strerror (errno));
|
||||||
@ -1182,7 +1182,7 @@ mips_receive_packet (char *buff, int throw_error, int timeout)
|
|||||||
ack + 1);
|
ack + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SERIAL_WRITE (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
|
if (serial_write (mips_desc, ack, HDR_LENGTH + TRLR_LENGTH) != 0)
|
||||||
{
|
{
|
||||||
if (throw_error)
|
if (throw_error)
|
||||||
mips_error ("write to target failed: %s", safe_strerror (errno));
|
mips_error ("write to target failed: %s", safe_strerror (errno));
|
||||||
@ -1295,7 +1295,7 @@ mips_exit_cleanups (PTR arg)
|
|||||||
static void
|
static void
|
||||||
mips_send_command (const char *cmd, int prompt)
|
mips_send_command (const char *cmd, int prompt)
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (mips_desc, cmd, strlen (cmd));
|
serial_write (mips_desc, cmd, strlen (cmd));
|
||||||
mips_expect (cmd);
|
mips_expect (cmd);
|
||||||
mips_expect ("\n");
|
mips_expect ("\n");
|
||||||
if (prompt)
|
if (prompt)
|
||||||
@ -1316,7 +1316,7 @@ mips_enter_debug (void)
|
|||||||
mips_send_command ("db tty0\r", 0);
|
mips_send_command ("db tty0\r", 0);
|
||||||
|
|
||||||
sleep (1);
|
sleep (1);
|
||||||
SERIAL_WRITE (mips_desc, "\r", sizeof "\r" - 1);
|
serial_write (mips_desc, "\r", sizeof "\r" - 1);
|
||||||
|
|
||||||
/* We don't need to absorb any spurious characters here, since the
|
/* We don't need to absorb any spurious characters here, since the
|
||||||
mips_receive_header will eat up a reasonable number of characters
|
mips_receive_header will eat up a reasonable number of characters
|
||||||
@ -1398,14 +1398,14 @@ mips_initialize (void)
|
|||||||
switch (j)
|
switch (j)
|
||||||
{
|
{
|
||||||
case 0: /* First, try sending a CR */
|
case 0: /* First, try sending a CR */
|
||||||
SERIAL_FLUSH_INPUT (mips_desc);
|
serial_flush_input (mips_desc);
|
||||||
SERIAL_WRITE (mips_desc, "\r", 1);
|
serial_write (mips_desc, "\r", 1);
|
||||||
break;
|
break;
|
||||||
case 1: /* First, try sending a break */
|
case 1: /* First, try sending a break */
|
||||||
SERIAL_SEND_BREAK (mips_desc);
|
serial_send_break (mips_desc);
|
||||||
break;
|
break;
|
||||||
case 2: /* Then, try a ^C */
|
case 2: /* Then, try a ^C */
|
||||||
SERIAL_WRITE (mips_desc, "\003", 1);
|
serial_write (mips_desc, "\003", 1);
|
||||||
break;
|
break;
|
||||||
case 3: /* Then, try escaping from download */
|
case 3: /* Then, try escaping from download */
|
||||||
{
|
{
|
||||||
@ -1419,9 +1419,9 @@ mips_initialize (void)
|
|||||||
packets. In-case we were downloading a large packet
|
packets. In-case we were downloading a large packet
|
||||||
we flush the output buffer before inserting a
|
we flush the output buffer before inserting a
|
||||||
termination sequence. */
|
termination sequence. */
|
||||||
SERIAL_FLUSH_OUTPUT (mips_desc);
|
serial_flush_output (mips_desc);
|
||||||
sprintf (tbuff, "\r/E/E\r");
|
sprintf (tbuff, "\r/E/E\r");
|
||||||
SERIAL_WRITE (mips_desc, tbuff, 6);
|
serial_write (mips_desc, tbuff, 6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1441,9 +1441,9 @@ mips_initialize (void)
|
|||||||
|
|
||||||
for (i = 1; i <= 33; i++)
|
for (i = 1; i <= 33; i++)
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (mips_desc, srec, 8);
|
serial_write (mips_desc, srec, 8);
|
||||||
|
|
||||||
if (SERIAL_READCHAR (mips_desc, 0) >= 0)
|
if (serial_readchar (mips_desc, 0) >= 0)
|
||||||
break; /* Break immediatly if we get something from
|
break; /* Break immediatly if we get something from
|
||||||
the board. */
|
the board. */
|
||||||
}
|
}
|
||||||
@ -1539,20 +1539,20 @@ device is attached to the target board (e.g., /dev/ttya).\n"
|
|||||||
unpush_target (current_ops);
|
unpush_target (current_ops);
|
||||||
|
|
||||||
/* Open and initialize the serial port. */
|
/* Open and initialize the serial port. */
|
||||||
mips_desc = SERIAL_OPEN (serial_port_name);
|
mips_desc = serial_open (serial_port_name);
|
||||||
if (mips_desc == NULL)
|
if (mips_desc == NULL)
|
||||||
perror_with_name (serial_port_name);
|
perror_with_name (serial_port_name);
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (mips_desc, baud_rate))
|
if (serial_setbaudrate (mips_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (mips_desc);
|
serial_close (mips_desc);
|
||||||
perror_with_name (serial_port_name);
|
perror_with_name (serial_port_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (mips_desc);
|
serial_raw (mips_desc);
|
||||||
|
|
||||||
/* Open and initialize the optional download port. If it is in the form
|
/* Open and initialize the optional download port. If it is in the form
|
||||||
hostname#portnumber, it's a UDP socket. If it is in the form
|
hostname#portnumber, it's a UDP socket. If it is in the form
|
||||||
@ -1562,7 +1562,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
|
|||||||
{
|
{
|
||||||
if (strchr (remote_name, '#'))
|
if (strchr (remote_name, '#'))
|
||||||
{
|
{
|
||||||
udp_desc = SERIAL_OPEN (remote_name);
|
udp_desc = serial_open (remote_name);
|
||||||
if (!udp_desc)
|
if (!udp_desc)
|
||||||
perror_with_name ("Unable to open UDP port");
|
perror_with_name ("Unable to open UDP port");
|
||||||
udp_in_use = 1;
|
udp_in_use = 1;
|
||||||
@ -2194,7 +2194,7 @@ Give up (and stop debugging it)? "))
|
|||||||
if (remote_debug > 0)
|
if (remote_debug > 0)
|
||||||
printf_unfiltered ("Sending break\n");
|
printf_unfiltered ("Sending break\n");
|
||||||
|
|
||||||
SERIAL_SEND_BREAK (mips_desc);
|
serial_send_break (mips_desc);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (mips_is_open)
|
if (mips_is_open)
|
||||||
@ -2203,7 +2203,7 @@ Give up (and stop debugging it)? "))
|
|||||||
|
|
||||||
/* Send a ^C. */
|
/* Send a ^C. */
|
||||||
cc = '\003';
|
cc = '\003';
|
||||||
SERIAL_WRITE (mips_desc, &cc, 1);
|
serial_write (mips_desc, &cc, 1);
|
||||||
sleep (1);
|
sleep (1);
|
||||||
target_mourn_inferior ();
|
target_mourn_inferior ();
|
||||||
}
|
}
|
||||||
@ -2773,7 +2773,7 @@ send_srec (char *srec, int len, CORE_ADDR addr)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
SERIAL_WRITE (mips_desc, srec, len);
|
serial_write (mips_desc, srec, len);
|
||||||
|
|
||||||
ch = mips_readchar (remote_timeout);
|
ch = mips_readchar (remote_timeout);
|
||||||
|
|
||||||
@ -2866,7 +2866,7 @@ mips_load_srec (char *args)
|
|||||||
|
|
||||||
send_srec (srec, reclen, abfd->start_address);
|
send_srec (srec, reclen, abfd->start_address);
|
||||||
|
|
||||||
SERIAL_FLUSH_INPUT (mips_desc);
|
serial_flush_input (mips_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3132,7 +3132,7 @@ pmon_check_ack (char *mesg)
|
|||||||
|
|
||||||
if (!tftp_in_use)
|
if (!tftp_in_use)
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (udp_in_use ? udp_desc : mips_desc,
|
c = serial_readchar (udp_in_use ? udp_desc : mips_desc,
|
||||||
remote_timeout);
|
remote_timeout);
|
||||||
if ((c == SERIAL_TIMEOUT) || (c != 0x06))
|
if ((c == SERIAL_TIMEOUT) || (c != 0x06))
|
||||||
{
|
{
|
||||||
@ -3266,7 +3266,7 @@ pmon_download (char *buffer, int length)
|
|||||||
if (tftp_in_use)
|
if (tftp_in_use)
|
||||||
fwrite (buffer, 1, length, tftp_file);
|
fwrite (buffer, 1, length, tftp_file);
|
||||||
else
|
else
|
||||||
SERIAL_WRITE (udp_in_use ? udp_desc : mips_desc, buffer, length);
|
serial_write (udp_in_use ? udp_desc : mips_desc, buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3404,7 +3404,7 @@ pmon_load_fast (char *file)
|
|||||||
|
|
||||||
if (finished)
|
if (finished)
|
||||||
{ /* Ignore the termination message: */
|
{ /* Ignore the termination message: */
|
||||||
SERIAL_FLUSH_INPUT (udp_in_use ? udp_desc : mips_desc);
|
serial_flush_input (udp_in_use ? udp_desc : mips_desc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* Deal with termination message: */
|
{ /* Deal with termination message: */
|
||||||
|
@ -158,7 +158,7 @@ static void
|
|||||||
nindy_close (int quitting)
|
nindy_close (int quitting)
|
||||||
{
|
{
|
||||||
if (nindy_serial != NULL)
|
if (nindy_serial != NULL)
|
||||||
SERIAL_CLOSE (nindy_serial);
|
serial_close (nindy_serial);
|
||||||
nindy_serial = NULL;
|
nindy_serial = NULL;
|
||||||
|
|
||||||
if (savename)
|
if (savename)
|
||||||
@ -285,7 +285,7 @@ static void
|
|||||||
clean_up_tty (PTR ptrarg)
|
clean_up_tty (PTR ptrarg)
|
||||||
{
|
{
|
||||||
struct clean_up_tty_args *args = (struct clean_up_tty_args *) ptrarg;
|
struct clean_up_tty_args *args = (struct clean_up_tty_args *) ptrarg;
|
||||||
SERIAL_SET_TTY_STATE (args->serial, args->state);
|
serial_set_tty_state (args->serial, args->state);
|
||||||
xfree (args->state);
|
xfree (args->state);
|
||||||
warning ("\n\nYou may need to reset the 80960 and/or reload your program.\n");
|
warning ("\n\nYou may need to reset the 80960 and/or reload your program.\n");
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ static void (*old_ctrlz) ();
|
|||||||
static void
|
static void
|
||||||
clean_up_int (void)
|
clean_up_int (void)
|
||||||
{
|
{
|
||||||
SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
|
serial_set_tty_state (tty_args.serial, tty_args.state);
|
||||||
xfree (tty_args.state);
|
xfree (tty_args.state);
|
||||||
|
|
||||||
signal (SIGINT, old_ctrlc);
|
signal (SIGINT, old_ctrlc);
|
||||||
@ -334,8 +334,8 @@ nindy_wait (ptid_t ptid, struct target_waitstatus *status)
|
|||||||
/* OPERATE IN PASSTHROUGH MODE UNTIL NINDY SENDS A DLE CHARACTER */
|
/* OPERATE IN PASSTHROUGH MODE UNTIL NINDY SENDS A DLE CHARACTER */
|
||||||
|
|
||||||
/* Save current tty attributes, and restore them when done. */
|
/* Save current tty attributes, and restore them when done. */
|
||||||
tty_args.serial = SERIAL_FDOPEN (0);
|
tty_args.serial = serial_fdopen (0);
|
||||||
tty_args.state = SERIAL_GET_TTY_STATE (tty_args.serial);
|
tty_args.state = serial_get_tty_state (tty_args.serial);
|
||||||
old_ctrlc = signal (SIGINT, clean_up_int);
|
old_ctrlc = signal (SIGINT, clean_up_int);
|
||||||
#ifdef SIGTSTP
|
#ifdef SIGTSTP
|
||||||
old_ctrlz = signal (SIGTSTP, clean_up_int);
|
old_ctrlz = signal (SIGTSTP, clean_up_int);
|
||||||
@ -347,19 +347,19 @@ nindy_wait (ptid_t ptid, struct target_waitstatus *status)
|
|||||||
<CR> and perform echo. */
|
<CR> and perform echo. */
|
||||||
/* This used to set CBREAK and clear ECHO and CRMOD. I hope this is close
|
/* This used to set CBREAK and clear ECHO and CRMOD. I hope this is close
|
||||||
enough. */
|
enough. */
|
||||||
SERIAL_RAW (tty_args.serial);
|
serial_raw (tty_args.serial);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* Input on remote */
|
/* Input on remote */
|
||||||
c = SERIAL_READCHAR (nindy_serial, -1);
|
c = serial_readchar (nindy_serial, -1);
|
||||||
if (c == SERIAL_ERROR)
|
if (c == SERIAL_ERROR)
|
||||||
{
|
{
|
||||||
error ("Cannot read from serial line");
|
error ("Cannot read from serial line");
|
||||||
}
|
}
|
||||||
else if (c == 0x1b) /* ESC */
|
else if (c == 0x1b) /* ESC */
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (nindy_serial, -1);
|
c = serial_readchar (nindy_serial, -1);
|
||||||
c &= ~0x40;
|
c &= ~0x40;
|
||||||
}
|
}
|
||||||
else if (c != 0x10) /* DLE */
|
else if (c != 0x10) /* DLE */
|
||||||
@ -392,7 +392,7 @@ nindy_wait (ptid_t ptid, struct target_waitstatus *status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_SET_TTY_STATE (tty_args.serial, tty_args.state);
|
serial_set_tty_state (tty_args.serial, tty_args.state);
|
||||||
xfree (tty_args.state);
|
xfree (tty_args.state);
|
||||||
discard_cleanups (old_cleanups);
|
discard_cleanups (old_cleanups);
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ reset_command (char *args, int from_tty)
|
|||||||
}
|
}
|
||||||
if (query ("Really reset the target system?", 0, 0))
|
if (query ("Really reset the target system?", 0, 0))
|
||||||
{
|
{
|
||||||
SERIAL_SEND_BREAK (nindy_serial);
|
serial_send_break (nindy_serial);
|
||||||
tty_flush (nindy_serial);
|
tty_flush (nindy_serial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ expect (char *string)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (ctrl_desc, 5);
|
c = serial_readchar (ctrl_desc, 5);
|
||||||
|
|
||||||
if (c == *p++)
|
if (c == *p++)
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ open_socket (char *name, int port)
|
|||||||
struct serial *desc;
|
struct serial *desc;
|
||||||
|
|
||||||
sprintf (sockname, "%s:%d", name, port);
|
sprintf (sockname, "%s:%d", name, port);
|
||||||
desc = SERIAL_OPEN (sockname);
|
desc = serial_open (sockname);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
perror_with_name (sockname);
|
perror_with_name (sockname);
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ open_socket (char *name, int port)
|
|||||||
static void
|
static void
|
||||||
load_cleanup (void)
|
load_cleanup (void)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (load_desc);
|
serial_close (load_desc);
|
||||||
load_desc = NULL;
|
load_desc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ nrom_load (char *args, int fromtty)
|
|||||||
struct cleanup *old_chain;
|
struct cleanup *old_chain;
|
||||||
|
|
||||||
/* Tell the netrom to get ready to download. */
|
/* Tell the netrom to get ready to download. */
|
||||||
if (SERIAL_WRITE (ctrl_desc, downloadstring, strlen (downloadstring)))
|
if (serial_write (ctrl_desc, downloadstring, strlen (downloadstring)))
|
||||||
error ("nrom_load: control_send() of `%s' failed", downloadstring);
|
error ("nrom_load: control_send() of `%s' failed", downloadstring);
|
||||||
|
|
||||||
expect ("Waiting for a connection...\n");
|
expect ("Waiting for a connection...\n");
|
||||||
@ -181,7 +181,7 @@ nrom_load (char *args, int fromtty)
|
|||||||
bfd_get_section_contents (pbfd, section, buffer, fptr,
|
bfd_get_section_contents (pbfd, section, buffer, fptr,
|
||||||
count);
|
count);
|
||||||
|
|
||||||
SERIAL_WRITE (load_desc, buffer, count);
|
serial_write (load_desc, buffer, count);
|
||||||
section_address += count;
|
section_address += count;
|
||||||
fptr += count;
|
fptr += count;
|
||||||
section_size -= count;
|
section_size -= count;
|
||||||
@ -234,9 +234,9 @@ static void
|
|||||||
nrom_close (int quitting)
|
nrom_close (int quitting)
|
||||||
{
|
{
|
||||||
if (load_desc)
|
if (load_desc)
|
||||||
SERIAL_CLOSE (load_desc);
|
serial_close (load_desc);
|
||||||
if (ctrl_desc)
|
if (ctrl_desc)
|
||||||
SERIAL_CLOSE (ctrl_desc);
|
serial_close (ctrl_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pass arguments directly to the NetROM. */
|
/* Pass arguments directly to the NetROM. */
|
||||||
@ -247,7 +247,7 @@ nrom_passthru (char *args, int fromtty)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
sprintf (buf, "%s\n", args);
|
sprintf (buf, "%s\n", args);
|
||||||
if (SERIAL_WRITE (ctrl_desc, buf, strlen (buf)))
|
if (serial_write (ctrl_desc, buf, strlen (buf)))
|
||||||
error ("nrom_reset: control_send() of `%s'failed", args);
|
error ("nrom_reset: control_send() of `%s'failed", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ printf_monitor (char *pattern,...)
|
|||||||
vsprintf (buf, pattern, args);
|
vsprintf (buf, pattern, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
if (SERIAL_WRITE (monitor_desc, buf, strlen (buf)))
|
if (serial_write (monitor_desc, buf, strlen (buf)))
|
||||||
fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a character from the remote system, doing all the fancy timeout stuff */
|
/* Read a character from the remote system, doing all the fancy timeout stuff */
|
||||||
@ -109,7 +109,7 @@ readchar (int timeout)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
c = SERIAL_READCHAR (monitor_desc, timeout);
|
c = serial_readchar (monitor_desc, timeout);
|
||||||
|
|
||||||
if (sr_get_debug ())
|
if (sr_get_debug ())
|
||||||
putchar (c & 0x7f);
|
putchar (c & 0x7f);
|
||||||
@ -311,17 +311,17 @@ rombug_open (char *args, int from_tty)
|
|||||||
unpush_target (&rombug_ops);
|
unpush_target (&rombug_ops);
|
||||||
|
|
||||||
strcpy (dev_name, args);
|
strcpy (dev_name, args);
|
||||||
monitor_desc = SERIAL_OPEN (dev_name);
|
monitor_desc = serial_open (dev_name);
|
||||||
if (monitor_desc == NULL)
|
if (monitor_desc == NULL)
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
|
|
||||||
/* if baud rate is set by 'set remotebaud' */
|
/* if baud rate is set by 'set remotebaud' */
|
||||||
if (SERIAL_SETBAUDRATE (monitor_desc, sr_get_baud_rate ()))
|
if (serial_setbaudrate (monitor_desc, sr_get_baud_rate ()))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (monitor_desc);
|
serial_close (monitor_desc);
|
||||||
perror_with_name ("RomBug");
|
perror_with_name ("RomBug");
|
||||||
}
|
}
|
||||||
SERIAL_RAW (monitor_desc);
|
serial_raw (monitor_desc);
|
||||||
if (tty_xon || tty_xoff)
|
if (tty_xon || tty_xoff)
|
||||||
{
|
{
|
||||||
struct hardware_ttystate
|
struct hardware_ttystate
|
||||||
@ -330,12 +330,12 @@ rombug_open (char *args, int from_tty)
|
|||||||
}
|
}
|
||||||
*tty_s;
|
*tty_s;
|
||||||
|
|
||||||
tty_s = (struct hardware_ttystate *) SERIAL_GET_TTY_STATE (monitor_desc);
|
tty_s = (struct hardware_ttystate *) serial_get_tty_state (monitor_desc);
|
||||||
if (tty_xon)
|
if (tty_xon)
|
||||||
tty_s->t.c_iflag |= IXON;
|
tty_s->t.c_iflag |= IXON;
|
||||||
if (tty_xoff)
|
if (tty_xoff)
|
||||||
tty_s->t.c_iflag |= IXOFF;
|
tty_s->t.c_iflag |= IXOFF;
|
||||||
SERIAL_SET_TTY_STATE (monitor_desc, (serial_ttystate) tty_s);
|
serial_set_tty_state (monitor_desc, (serial_ttystate) tty_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
rombug_is_open = 1;
|
rombug_is_open = 1;
|
||||||
@ -371,7 +371,7 @@ rombug_close (int quitting)
|
|||||||
{
|
{
|
||||||
if (rombug_is_open)
|
if (rombug_is_open)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (monitor_desc);
|
serial_close (monitor_desc);
|
||||||
monitor_desc = NULL;
|
monitor_desc = NULL;
|
||||||
rombug_is_open = 0;
|
rombug_is_open = 0;
|
||||||
}
|
}
|
||||||
@ -947,9 +947,9 @@ rombug_load (char *arg)
|
|||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SERIAL_WRITE (monitor_desc, buf, bytes_read))
|
if (serial_write (monitor_desc, buf, bytes_read))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "SERIAL_WRITE failed: (while downloading) %s\n", safe_strerror (errno));
|
fprintf (stderr, "serial_write failed: (while downloading) %s\n", safe_strerror (errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -1004,7 +1004,7 @@ static void
|
|||||||
cleanup_tty (void)
|
cleanup_tty (void)
|
||||||
{
|
{
|
||||||
printf ("\r\n[Exiting connect mode]\r\n");
|
printf ("\r\n[Exiting connect mode]\r\n");
|
||||||
/*SERIAL_RESTORE(0, &ttystate); */
|
/*serial_restore(0, &ttystate); */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1036,7 +1036,7 @@ connect_command (char *args, int fromtty)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
FD_SET (0, &readfds);
|
FD_SET (0, &readfds);
|
||||||
FD_SET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds);
|
FD_SET (deprecated_serial_fd (monitor_desc), &readfds);
|
||||||
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
|
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
|
||||||
}
|
}
|
||||||
while (numfds == 0);
|
while (numfds == 0);
|
||||||
@ -1071,7 +1071,7 @@ connect_command (char *args, int fromtty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET (DEPRECATED_SERIAL_FD (monitor_desc), &readfds))
|
if (FD_ISSET (deprecated_serial_fd (monitor_desc), &readfds))
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ remote_rdp_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
|
|||||||
static unsigned char
|
static unsigned char
|
||||||
get_byte (void)
|
get_byte (void)
|
||||||
{
|
{
|
||||||
int c = SERIAL_READCHAR (io, timeout);
|
int c = serial_readchar (io, timeout);
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
|
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
|
||||||
@ -217,7 +217,7 @@ put_byte (char val)
|
|||||||
{
|
{
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
|
fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
|
||||||
SERIAL_WRITE (io, &val, 1);
|
serial_write (io, &val, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -233,7 +233,7 @@ put_word (int val)
|
|||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
|
fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
|
||||||
|
|
||||||
SERIAL_WRITE (io, b, 4);
|
serial_write (io, b, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -264,8 +264,8 @@ rdp_init (int cold, int tty)
|
|||||||
int restype;
|
int restype;
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
SERIAL_FLUSH_INPUT (io);
|
serial_flush_input (io);
|
||||||
SERIAL_FLUSH_OUTPUT (io);
|
serial_flush_output (io);
|
||||||
|
|
||||||
if (tty)
|
if (tty)
|
||||||
printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
|
printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
|
||||||
@ -277,7 +277,7 @@ rdp_init (int cold, int tty)
|
|||||||
if (cold)
|
if (cold)
|
||||||
{
|
{
|
||||||
put_byte (RDP_RESET);
|
put_byte (RDP_RESET);
|
||||||
while ((restype = SERIAL_READCHAR (io, 1)) > 0)
|
while ((restype = serial_readchar (io, 1)) > 0)
|
||||||
{
|
{
|
||||||
switch (restype)
|
switch (restype)
|
||||||
{
|
{
|
||||||
@ -304,7 +304,7 @@ rdp_init (int cold, int tty)
|
|||||||
put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
|
put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
|
||||||
put_word (0);
|
put_word (0);
|
||||||
|
|
||||||
while (!sync && (restype = SERIAL_READCHAR (io, 1)) > 0)
|
while (!sync && (restype = serial_readchar (io, 1)) > 0)
|
||||||
{
|
{
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
|
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
|
||||||
@ -315,13 +315,13 @@ rdp_init (int cold, int tty)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_RESET:
|
case RDP_RESET:
|
||||||
while ((restype = SERIAL_READCHAR (io, 1)) == RDP_RESET)
|
while ((restype = serial_readchar (io, 1)) == RDP_RESET)
|
||||||
;
|
;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
|
printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
|
||||||
}
|
}
|
||||||
while ((restype = SERIAL_READCHAR (io, 1)) > 0);
|
while ((restype = serial_readchar (io, 1)) > 0);
|
||||||
|
|
||||||
if (tty)
|
if (tty)
|
||||||
{
|
{
|
||||||
@ -339,7 +339,7 @@ rdp_init (int cold, int tty)
|
|||||||
|
|
||||||
case RDP_RES_VALUE:
|
case RDP_RES_VALUE:
|
||||||
{
|
{
|
||||||
int resval = SERIAL_READCHAR (io, 1);
|
int resval = serial_readchar (io, 1);
|
||||||
|
|
||||||
if (remote_debug)
|
if (remote_debug)
|
||||||
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
|
fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
|
||||||
@ -459,13 +459,13 @@ send_rdp (char *template,...)
|
|||||||
pc = va_arg (alist, char *);
|
pc = va_arg (alist, char *);
|
||||||
val = va_arg (alist, int);
|
val = va_arg (alist, int);
|
||||||
dst = buf;
|
dst = buf;
|
||||||
SERIAL_WRITE (io, pc, val);
|
serial_write (io, pc, val);
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
/* Send whats in the queue */
|
/* Send whats in the queue */
|
||||||
if (dst != buf)
|
if (dst != buf)
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (io, buf, dst - buf);
|
serial_write (io, buf, dst - buf);
|
||||||
dst = buf;
|
dst = buf;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -995,12 +995,12 @@ rdp_execute_finish (void)
|
|||||||
while (running)
|
while (running)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
res = SERIAL_READCHAR (io, 1);
|
res = serial_readchar (io, 1);
|
||||||
while (res == SERIAL_TIMEOUT)
|
while (res == SERIAL_TIMEOUT)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
printf_filtered ("Waiting for target..\n");
|
printf_filtered ("Waiting for target..\n");
|
||||||
res = SERIAL_READCHAR (io, 1);
|
res = serial_readchar (io, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (res)
|
switch (res)
|
||||||
@ -1111,12 +1111,12 @@ remote_rdp_open (char *args, int from_tty)
|
|||||||
|
|
||||||
target_preopen (from_tty);
|
target_preopen (from_tty);
|
||||||
|
|
||||||
io = SERIAL_OPEN (args);
|
io = serial_open (args);
|
||||||
|
|
||||||
if (!io)
|
if (!io)
|
||||||
perror_with_name (args);
|
perror_with_name (args);
|
||||||
|
|
||||||
SERIAL_RAW (io);
|
serial_raw (io);
|
||||||
|
|
||||||
rdp_init (1, from_tty);
|
rdp_init (1, from_tty);
|
||||||
|
|
||||||
@ -1174,7 +1174,7 @@ remote_rdp_close (int quitting)
|
|||||||
{
|
{
|
||||||
callback->shutdown (callback);
|
callback->shutdown (callback);
|
||||||
if (io)
|
if (io)
|
||||||
SERIAL_CLOSE (io);
|
serial_close (io);
|
||||||
io = 0;
|
io = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ static void
|
|||||||
sds_close (int quitting)
|
sds_close (int quitting)
|
||||||
{
|
{
|
||||||
if (sds_desc)
|
if (sds_desc)
|
||||||
SERIAL_CLOSE (sds_desc);
|
serial_close (sds_desc);
|
||||||
sds_desc = NULL;
|
sds_desc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,8 +166,8 @@ sds_start_remote (PTR dummy)
|
|||||||
immediate_quit++; /* Allow user to interrupt it */
|
immediate_quit++; /* Allow user to interrupt it */
|
||||||
|
|
||||||
/* Ack any packet which the remote side has already sent. */
|
/* Ack any packet which the remote side has already sent. */
|
||||||
SERIAL_WRITE (sds_desc, "{#*\r\n", 5);
|
serial_write (sds_desc, "{#*\r\n", 5);
|
||||||
SERIAL_WRITE (sds_desc, "{#}\r\n", 5);
|
serial_write (sds_desc, "{#}\r\n", 5);
|
||||||
|
|
||||||
while ((c = readchar (1)) >= 0)
|
while ((c = readchar (1)) >= 0)
|
||||||
printf_unfiltered ("%c", c);
|
printf_unfiltered ("%c", c);
|
||||||
@ -201,25 +201,25 @@ device is attached to the remote system (e.g. /dev/ttya).");
|
|||||||
|
|
||||||
unpush_target (&sds_ops);
|
unpush_target (&sds_ops);
|
||||||
|
|
||||||
sds_desc = SERIAL_OPEN (name);
|
sds_desc = serial_open (name);
|
||||||
if (!sds_desc)
|
if (!sds_desc)
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (sds_desc, baud_rate))
|
if (serial_setbaudrate (sds_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (sds_desc);
|
serial_close (sds_desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SERIAL_RAW (sds_desc);
|
serial_raw (sds_desc);
|
||||||
|
|
||||||
/* If there is something sitting in the buffer we might take it as a
|
/* If there is something sitting in the buffer we might take it as a
|
||||||
response to a command, which would be bad. */
|
response to a command, which would be bad. */
|
||||||
SERIAL_FLUSH_INPUT (sds_desc);
|
serial_flush_input (sds_desc);
|
||||||
|
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
{
|
{
|
||||||
@ -688,7 +688,7 @@ readchar (int timeout)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
ch = SERIAL_READCHAR (sds_desc, timeout);
|
ch = serial_readchar (sds_desc, timeout);
|
||||||
|
|
||||||
if (remote_debug > 1 && ch >= 0)
|
if (remote_debug > 1 && ch >= 0)
|
||||||
fprintf_unfiltered (gdb_stdlog, "%c(%x)", ch, ch);
|
fprintf_unfiltered (gdb_stdlog, "%c(%x)", ch, ch);
|
||||||
@ -799,7 +799,7 @@ putmessage (unsigned char *buf, int len)
|
|||||||
header[0], header[1], header[2]);
|
header[0], header[1], header[2]);
|
||||||
gdb_flush (gdb_stdlog);
|
gdb_flush (gdb_stdlog);
|
||||||
}
|
}
|
||||||
if (SERIAL_WRITE (sds_desc, buf2, p - buf2))
|
if (serial_write (sds_desc, buf2, p - buf2))
|
||||||
perror_with_name ("putmessage: write failed");
|
perror_with_name ("putmessage: write failed");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -76,8 +76,8 @@ printf_stdebug (char *pattern,...)
|
|||||||
vsprintf (buf, pattern, args);
|
vsprintf (buf, pattern, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
if (SERIAL_WRITE (st2000_desc, buf, strlen (buf)))
|
if (serial_write (st2000_desc, buf, strlen (buf)))
|
||||||
fprintf (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
fprintf (stderr, "serial_write failed: %s\n", safe_strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a character from the remote system, doing all the fancy timeout
|
/* Read a character from the remote system, doing all the fancy timeout
|
||||||
@ -88,7 +88,7 @@ readchar (int timeout)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
c = SERIAL_READCHAR (st2000_desc, timeout);
|
c = serial_readchar (st2000_desc, timeout);
|
||||||
|
|
||||||
#ifdef LOG_FILE
|
#ifdef LOG_FILE
|
||||||
putc (c & 0x7f, log_file);
|
putc (c & 0x7f, log_file);
|
||||||
@ -280,18 +280,18 @@ or target st2000 <host> <port>\n");
|
|||||||
|
|
||||||
st2000_close (0);
|
st2000_close (0);
|
||||||
|
|
||||||
st2000_desc = SERIAL_OPEN (dev_name);
|
st2000_desc = serial_open (dev_name);
|
||||||
|
|
||||||
if (!st2000_desc)
|
if (!st2000_desc)
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
|
|
||||||
if (SERIAL_SETBAUDRATE (st2000_desc, baudrate))
|
if (serial_setbaudrate (st2000_desc, baudrate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (dev_name);
|
serial_close (dev_name);
|
||||||
perror_with_name (dev_name);
|
perror_with_name (dev_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (st2000_desc);
|
serial_raw (st2000_desc);
|
||||||
|
|
||||||
push_target (&st2000_ops);
|
push_target (&st2000_ops);
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ or target st2000 <host> <port>\n");
|
|||||||
static void
|
static void
|
||||||
st2000_close (int quitting)
|
st2000_close (int quitting)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (st2000_desc);
|
serial_close (st2000_desc);
|
||||||
|
|
||||||
#if defined (LOG_FILE)
|
#if defined (LOG_FILE)
|
||||||
if (log_file)
|
if (log_file)
|
||||||
@ -664,7 +664,7 @@ static void
|
|||||||
cleanup_tty (void)
|
cleanup_tty (void)
|
||||||
{
|
{
|
||||||
printf ("\r\n[Exiting connect mode]\r\n");
|
printf ("\r\n[Exiting connect mode]\r\n");
|
||||||
/* SERIAL_RESTORE(0, &ttystate); */
|
/* serial_restore(0, &ttystate); */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -699,7 +699,7 @@ connect_command (char *args, int fromtty)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
FD_SET (0, &readfds);
|
FD_SET (0, &readfds);
|
||||||
FD_SET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds);
|
FD_SET (deprecated_serial_fd (st2000_desc), &readfds);
|
||||||
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
|
numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0);
|
||||||
}
|
}
|
||||||
while (numfds == 0);
|
while (numfds == 0);
|
||||||
@ -734,7 +734,7 @@ connect_command (char *args, int fromtty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET (DEPRECATED_SERIAL_FD (st2000_desc), &readfds))
|
if (FD_ISSET (deprecated_serial_fd (st2000_desc), &readfds))
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -172,24 +172,24 @@ gr_open (char *args, int from_tty, struct gr_settings *gr)
|
|||||||
if (sr_get_device () == NULL)
|
if (sr_get_device () == NULL)
|
||||||
usage (gr->ops->to_shortname, NULL);
|
usage (gr->ops->to_shortname, NULL);
|
||||||
|
|
||||||
sr_set_desc (SERIAL_OPEN (sr_get_device ()));
|
sr_set_desc (serial_open (sr_get_device ()));
|
||||||
if (!sr_get_desc ())
|
if (!sr_get_desc ())
|
||||||
perror_with_name ((char *) sr_get_device ());
|
perror_with_name ((char *) sr_get_device ());
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (sr_get_desc (), baud_rate) != 0)
|
if (serial_setbaudrate (sr_get_desc (), baud_rate) != 0)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (sr_get_desc ());
|
serial_close (sr_get_desc ());
|
||||||
perror_with_name (sr_get_device ());
|
perror_with_name (sr_get_device ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (sr_get_desc ());
|
serial_raw (sr_get_desc ());
|
||||||
|
|
||||||
/* If there is something sitting in the buffer we might take it as a
|
/* If there is something sitting in the buffer we might take it as a
|
||||||
response to a command, which would be bad. */
|
response to a command, which would be bad. */
|
||||||
SERIAL_FLUSH_INPUT (sr_get_desc ());
|
serial_flush_input (sr_get_desc ());
|
||||||
|
|
||||||
/* default retries */
|
/* default retries */
|
||||||
if (sr_get_retries () == 0)
|
if (sr_get_retries () == 0)
|
||||||
@ -222,7 +222,7 @@ sr_readchar (void)
|
|||||||
{
|
{
|
||||||
int buf;
|
int buf;
|
||||||
|
|
||||||
buf = SERIAL_READCHAR (sr_get_desc (), sr_get_timeout ());
|
buf = serial_readchar (sr_get_desc (), sr_get_timeout ());
|
||||||
|
|
||||||
if (buf == SERIAL_TIMEOUT)
|
if (buf == SERIAL_TIMEOUT)
|
||||||
error ("Timeout reading from remote system.");
|
error ("Timeout reading from remote system.");
|
||||||
@ -238,7 +238,7 @@ sr_pollchar (void)
|
|||||||
{
|
{
|
||||||
int buf;
|
int buf;
|
||||||
|
|
||||||
buf = SERIAL_READCHAR (sr_get_desc (), 0);
|
buf = serial_readchar (sr_get_desc (), 0);
|
||||||
if (buf == SERIAL_TIMEOUT)
|
if (buf == SERIAL_TIMEOUT)
|
||||||
buf = 0;
|
buf = 0;
|
||||||
if (sr_get_debug () > 0)
|
if (sr_get_debug () > 0)
|
||||||
@ -281,7 +281,7 @@ sr_write (char *a, int l)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (SERIAL_WRITE (sr_get_desc (), a, l) != 0)
|
if (serial_write (sr_get_desc (), a, l) != 0)
|
||||||
perror_with_name ("sr_write: Error writing to remote");
|
perror_with_name ("sr_write: Error writing to remote");
|
||||||
|
|
||||||
if (sr_get_debug () > 0)
|
if (sr_get_debug () > 0)
|
||||||
@ -398,7 +398,7 @@ gr_close (int quitting)
|
|||||||
|
|
||||||
if (sr_is_open ())
|
if (sr_is_open ())
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (sr_get_desc ());
|
serial_close (sr_get_desc ());
|
||||||
sr_set_desc (NULL);
|
sr_set_desc (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
68
gdb/remote.c
68
gdb/remote.c
@ -1815,7 +1815,7 @@ static void
|
|||||||
remote_close (int quitting)
|
remote_close (int quitting)
|
||||||
{
|
{
|
||||||
if (remote_desc)
|
if (remote_desc)
|
||||||
SERIAL_CLOSE (remote_desc);
|
serial_close (remote_desc);
|
||||||
remote_desc = NULL;
|
remote_desc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2030,7 +2030,7 @@ remote_start_remote (PTR dummy)
|
|||||||
immediate_quit++; /* Allow user to interrupt it */
|
immediate_quit++; /* Allow user to interrupt it */
|
||||||
|
|
||||||
/* Ack any packet which the remote side has already sent. */
|
/* Ack any packet which the remote side has already sent. */
|
||||||
SERIAL_WRITE (remote_desc, "+", 1);
|
serial_write (remote_desc, "+", 1);
|
||||||
|
|
||||||
/* Let the stub know that we want it to return the thread. */
|
/* Let the stub know that we want it to return the thread. */
|
||||||
set_thread (-1, 0);
|
set_thread (-1, 0);
|
||||||
@ -2148,24 +2148,24 @@ serial device is attached to the remote system\n\
|
|||||||
|
|
||||||
unpush_target (target);
|
unpush_target (target);
|
||||||
|
|
||||||
remote_desc = SERIAL_OPEN (name);
|
remote_desc = serial_open (name);
|
||||||
if (!remote_desc)
|
if (!remote_desc)
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
|
if (serial_setbaudrate (remote_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (remote_desc);
|
serial_close (remote_desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (remote_desc);
|
serial_raw (remote_desc);
|
||||||
|
|
||||||
/* If there is something sitting in the buffer we might take it as a
|
/* If there is something sitting in the buffer we might take it as a
|
||||||
response to a command, which would be bad. */
|
response to a command, which would be bad. */
|
||||||
SERIAL_FLUSH_INPUT (remote_desc);
|
serial_flush_input (remote_desc);
|
||||||
|
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
{
|
{
|
||||||
@ -2245,24 +2245,24 @@ serial device is attached to the remote system\n\
|
|||||||
|
|
||||||
unpush_target (target);
|
unpush_target (target);
|
||||||
|
|
||||||
remote_desc = SERIAL_OPEN (name);
|
remote_desc = serial_open (name);
|
||||||
if (!remote_desc)
|
if (!remote_desc)
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
|
if (serial_setbaudrate (remote_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (remote_desc);
|
serial_close (remote_desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (remote_desc);
|
serial_raw (remote_desc);
|
||||||
|
|
||||||
/* If there is something sitting in the buffer we might take it as a
|
/* If there is something sitting in the buffer we might take it as a
|
||||||
response to a command, which would be bad. */
|
response to a command, which would be bad. */
|
||||||
SERIAL_FLUSH_INPUT (remote_desc);
|
serial_flush_input (remote_desc);
|
||||||
|
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
{
|
{
|
||||||
@ -2382,7 +2382,7 @@ remote_async_detach (char *args, int from_tty)
|
|||||||
|
|
||||||
/* Unregister the file descriptor from the event loop. */
|
/* Unregister the file descriptor from the event loop. */
|
||||||
if (target_is_async_p ())
|
if (target_is_async_p ())
|
||||||
SERIAL_ASYNC (remote_desc, NULL, 0);
|
serial_async (remote_desc, NULL, 0);
|
||||||
|
|
||||||
target_mourn_inferior ();
|
target_mourn_inferior ();
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
@ -2765,9 +2765,9 @@ remote_stop (void)
|
|||||||
fprintf_unfiltered (gdb_stdlog, "remote_stop called\n");
|
fprintf_unfiltered (gdb_stdlog, "remote_stop called\n");
|
||||||
|
|
||||||
if (remote_break)
|
if (remote_break)
|
||||||
SERIAL_SEND_BREAK (remote_desc);
|
serial_send_break (remote_desc);
|
||||||
else
|
else
|
||||||
SERIAL_WRITE (remote_desc, "\003", 1);
|
serial_write (remote_desc, "\003", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ask the user what to do when an interrupt is received. */
|
/* Ask the user what to do when an interrupt is received. */
|
||||||
@ -3908,7 +3908,7 @@ readchar (int timeout)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
ch = SERIAL_READCHAR (remote_desc, timeout);
|
ch = serial_readchar (remote_desc, timeout);
|
||||||
|
|
||||||
if (ch >= 0)
|
if (ch >= 0)
|
||||||
return (ch & 0x7f);
|
return (ch & 0x7f);
|
||||||
@ -4006,7 +4006,7 @@ putpkt_binary (char *buf, int cnt)
|
|||||||
fprintf_unfiltered (gdb_stdlog, "...");
|
fprintf_unfiltered (gdb_stdlog, "...");
|
||||||
gdb_flush (gdb_stdlog);
|
gdb_flush (gdb_stdlog);
|
||||||
}
|
}
|
||||||
if (SERIAL_WRITE (remote_desc, buf2, p - buf2))
|
if (serial_write (remote_desc, buf2, p - buf2))
|
||||||
perror_with_name ("putpkt: write failed");
|
perror_with_name ("putpkt: write failed");
|
||||||
|
|
||||||
/* read until either a timeout occurs (-2) or '+' is read */
|
/* read until either a timeout occurs (-2) or '+' is read */
|
||||||
@ -4308,19 +4308,19 @@ getpkt_sane (char *buf,
|
|||||||
fputstr_unfiltered (buf, 0, gdb_stdlog);
|
fputstr_unfiltered (buf, 0, gdb_stdlog);
|
||||||
fprintf_unfiltered (gdb_stdlog, "\n");
|
fprintf_unfiltered (gdb_stdlog, "\n");
|
||||||
}
|
}
|
||||||
SERIAL_WRITE (remote_desc, "+", 1);
|
serial_write (remote_desc, "+", 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try the whole thing again. */
|
/* Try the whole thing again. */
|
||||||
retry:
|
retry:
|
||||||
SERIAL_WRITE (remote_desc, "-", 1);
|
serial_write (remote_desc, "-", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have tried hard enough, and just can't receive the packet. Give up. */
|
/* We have tried hard enough, and just can't receive the packet. Give up. */
|
||||||
|
|
||||||
printf_unfiltered ("Ignoring packet error, continuing...\n");
|
printf_unfiltered ("Ignoring packet error, continuing...\n");
|
||||||
SERIAL_WRITE (remote_desc, "+", 1);
|
serial_write (remote_desc, "+", 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4351,7 +4351,7 @@ remote_async_kill (void)
|
|||||||
{
|
{
|
||||||
/* Unregister the file descriptor from the event loop. */
|
/* Unregister the file descriptor from the event loop. */
|
||||||
if (target_is_async_p ())
|
if (target_is_async_p ())
|
||||||
SERIAL_ASYNC (remote_desc, NULL, 0);
|
serial_async (remote_desc, NULL, 0);
|
||||||
|
|
||||||
/* For some mysterious reason, wait_for_inferior calls kill instead of
|
/* For some mysterious reason, wait_for_inferior calls kill instead of
|
||||||
mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */
|
mourn after it gets TARGET_WAITKIND_SIGNALLED. Work around it. */
|
||||||
@ -5319,7 +5319,7 @@ device is attached to the remote system (e.g. host:port).");
|
|||||||
|
|
||||||
unpush_target (&remote_cisco_ops);
|
unpush_target (&remote_cisco_ops);
|
||||||
|
|
||||||
remote_desc = SERIAL_OPEN (name);
|
remote_desc = serial_open (name);
|
||||||
if (!remote_desc)
|
if (!remote_desc)
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
|
|
||||||
@ -5330,17 +5330,17 @@ device is attached to the remote system (e.g. host:port).");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
baud_rate = (baud_rate > 0) ? baud_rate : 9600;
|
baud_rate = (baud_rate > 0) ? baud_rate : 9600;
|
||||||
if (SERIAL_SETBAUDRATE (remote_desc, baud_rate))
|
if (serial_setbaudrate (remote_desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (remote_desc);
|
serial_close (remote_desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (remote_desc);
|
serial_raw (remote_desc);
|
||||||
|
|
||||||
/* If there is something sitting in the buffer we might take it as a
|
/* If there is something sitting in the buffer we might take it as a
|
||||||
response to a command, which would be bad. */
|
response to a command, which would be bad. */
|
||||||
SERIAL_FLUSH_INPUT (remote_desc);
|
serial_flush_input (remote_desc);
|
||||||
|
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
{
|
{
|
||||||
@ -5508,7 +5508,7 @@ readtty (void)
|
|||||||
|
|
||||||
/* Make this a zero terminated string and write it out */
|
/* Make this a zero terminated string and write it out */
|
||||||
tty_input[tty_bytecount] = 0;
|
tty_input[tty_bytecount] = 0;
|
||||||
if (SERIAL_WRITE (remote_desc, tty_input, tty_bytecount))
|
if (serial_write (remote_desc, tty_input, tty_bytecount))
|
||||||
{
|
{
|
||||||
perror_with_name ("readtty: write failed");
|
perror_with_name ("readtty: write failed");
|
||||||
return FATAL_ERROR;
|
return FATAL_ERROR;
|
||||||
@ -5554,7 +5554,7 @@ minitelnet (void)
|
|||||||
|
|
||||||
FD_ZERO (&input);
|
FD_ZERO (&input);
|
||||||
FD_SET (fileno (stdin), &input);
|
FD_SET (fileno (stdin), &input);
|
||||||
FD_SET (DEPRECATED_SERIAL_FD (remote_desc), &input);
|
FD_SET (deprecated_serial_fd (remote_desc), &input);
|
||||||
|
|
||||||
status = select (tablesize, &input, 0, 0, 0);
|
status = select (tablesize, &input, 0, 0, 0);
|
||||||
if ((status == -1) && (errno != EINTR))
|
if ((status == -1) && (errno != EINTR))
|
||||||
@ -5578,9 +5578,9 @@ minitelnet (void)
|
|||||||
quit_flag = 0;
|
quit_flag = 0;
|
||||||
|
|
||||||
if (remote_break)
|
if (remote_break)
|
||||||
SERIAL_SEND_BREAK (remote_desc);
|
serial_send_break (remote_desc);
|
||||||
else
|
else
|
||||||
SERIAL_WRITE (remote_desc, "\003", 1);
|
serial_write (remote_desc, "\003", 1);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -5650,14 +5650,14 @@ static int
|
|||||||
remote_can_async_p (void)
|
remote_can_async_p (void)
|
||||||
{
|
{
|
||||||
/* We're async whenever the serial device is. */
|
/* We're async whenever the serial device is. */
|
||||||
return (current_target.to_async_mask_value) && SERIAL_CAN_ASYNC_P (remote_desc);
|
return (current_target.to_async_mask_value) && serial_can_async_p (remote_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remote_is_async_p (void)
|
remote_is_async_p (void)
|
||||||
{
|
{
|
||||||
/* We're async whenever the serial device is. */
|
/* We're async whenever the serial device is. */
|
||||||
return (current_target.to_async_mask_value) && SERIAL_IS_ASYNC_P (remote_desc);
|
return (current_target.to_async_mask_value) && serial_is_async_p (remote_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pass the SERIAL event on and up to the client. One day this code
|
/* Pass the SERIAL event on and up to the client. One day this code
|
||||||
@ -5685,12 +5685,12 @@ remote_async (void (*callback) (enum inferior_event_type event_type, void *conte
|
|||||||
|
|
||||||
if (callback != NULL)
|
if (callback != NULL)
|
||||||
{
|
{
|
||||||
SERIAL_ASYNC (remote_desc, remote_async_serial_handler, NULL);
|
serial_async (remote_desc, remote_async_serial_handler, NULL);
|
||||||
async_client_callback = callback;
|
async_client_callback = callback;
|
||||||
async_client_context = context;
|
async_client_context = context;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SERIAL_ASYNC (remote_desc, NULL, NULL);
|
serial_async (remote_desc, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Target async and target extended-async.
|
/* Target async and target extended-async.
|
||||||
|
@ -1184,7 +1184,7 @@ enum {
|
|||||||
static void
|
static void
|
||||||
reschedule (struct serial *scb)
|
reschedule (struct serial *scb)
|
||||||
{
|
{
|
||||||
if (SERIAL_IS_ASYNC_P (scb))
|
if (serial_is_async_p (scb))
|
||||||
{
|
{
|
||||||
int next_state;
|
int next_state;
|
||||||
switch (scb->async_state)
|
switch (scb->async_state)
|
||||||
@ -1220,7 +1220,7 @@ reschedule (struct serial *scb)
|
|||||||
next_state = scb->async_state;
|
next_state = scb->async_state;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (SERIAL_DEBUG_P (scb))
|
if (serial_debug_p (scb))
|
||||||
{
|
{
|
||||||
switch (next_state)
|
switch (next_state)
|
||||||
{
|
{
|
||||||
@ -1308,14 +1308,14 @@ ser_unix_async (struct serial *scb,
|
|||||||
{
|
{
|
||||||
/* Force a re-schedule. */
|
/* Force a re-schedule. */
|
||||||
scb->async_state = NOTHING_SCHEDULED;
|
scb->async_state = NOTHING_SCHEDULED;
|
||||||
if (SERIAL_DEBUG_P (scb))
|
if (serial_debug_p (scb))
|
||||||
fprintf_unfiltered (gdb_stdlog, "[fd%d->asynchronous]\n",
|
fprintf_unfiltered (gdb_stdlog, "[fd%d->asynchronous]\n",
|
||||||
scb->fd);
|
scb->fd);
|
||||||
reschedule (scb);
|
reschedule (scb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (SERIAL_DEBUG_P (scb))
|
if (serial_debug_p (scb))
|
||||||
fprintf_unfiltered (gdb_stdlog, "[fd%d->synchronous]\n",
|
fprintf_unfiltered (gdb_stdlog, "[fd%d->synchronous]\n",
|
||||||
scb->fd);
|
scb->fd);
|
||||||
/* De-schedule whatever tasks are currently scheduled. */
|
/* De-schedule whatever tasks are currently scheduled. */
|
||||||
|
28
gdb/serial.c
28
gdb/serial.c
@ -350,7 +350,7 @@ serial_readchar (struct serial *scb, int timeout)
|
|||||||
|
|
||||||
/* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
|
/* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
|
||||||
code is finished. */
|
code is finished. */
|
||||||
if (0 && SERIAL_IS_ASYNC_P (scb) && timeout < 0)
|
if (0 && serial_is_async_p (scb) && timeout < 0)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
"serial_readchar: blocking read in async mode");
|
"serial_readchar: blocking read in async mode");
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ serial_readchar (struct serial *scb, int timeout)
|
|||||||
in case we are getting ready to dump core or something. */
|
in case we are getting ready to dump core or something. */
|
||||||
gdb_flush (serial_logfp);
|
gdb_flush (serial_logfp);
|
||||||
}
|
}
|
||||||
if (SERIAL_DEBUG_P (scb))
|
if (serial_debug_p (scb))
|
||||||
{
|
{
|
||||||
fprintf_unfiltered (gdb_stdlog, "[");
|
fprintf_unfiltered (gdb_stdlog, "[");
|
||||||
serial_logchar (gdb_stdlog, 'r', ch, timeout);
|
serial_logchar (gdb_stdlog, 'r', ch, timeout);
|
||||||
@ -400,7 +400,7 @@ serial_printf (struct serial *desc, const char *format,...)
|
|||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
|
|
||||||
xvasprintf (&buf, format, args);
|
xvasprintf (&buf, format, args);
|
||||||
SERIAL_WRITE (desc, buf, strlen (buf));
|
serial_write (desc, buf, strlen (buf));
|
||||||
|
|
||||||
xfree (buf);
|
xfree (buf);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
@ -554,9 +554,9 @@ static void
|
|||||||
cleanup_tty (serial_ttystate ttystate)
|
cleanup_tty (serial_ttystate ttystate)
|
||||||
{
|
{
|
||||||
printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
|
printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
|
||||||
SERIAL_SET_TTY_STATE (tty_desc, ttystate);
|
serial_set_tty_state (tty_desc, ttystate);
|
||||||
xfree (ttystate);
|
xfree (ttystate);
|
||||||
SERIAL_CLOSE (tty_desc);
|
serial_close (tty_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -574,13 +574,13 @@ connect_command (char *args, int fromtty)
|
|||||||
|
|
||||||
printf_unfiltered ("[Entering connect mode. Use ~. or ~^D to escape]\n");
|
printf_unfiltered ("[Entering connect mode. Use ~. or ~^D to escape]\n");
|
||||||
|
|
||||||
tty_desc = SERIAL_FDOPEN (0);
|
tty_desc = serial_fdopen (0);
|
||||||
port_desc = last_serial_opened;
|
port_desc = last_serial_opened;
|
||||||
|
|
||||||
ttystate = SERIAL_GET_TTY_STATE (tty_desc);
|
ttystate = serial_get_tty_state (tty_desc);
|
||||||
|
|
||||||
SERIAL_RAW (tty_desc);
|
serial_raw (tty_desc);
|
||||||
SERIAL_RAW (port_desc);
|
serial_raw (port_desc);
|
||||||
|
|
||||||
make_cleanup (cleanup_tty, ttystate);
|
make_cleanup (cleanup_tty, ttystate);
|
||||||
|
|
||||||
@ -588,7 +588,7 @@ connect_command (char *args, int fromtty)
|
|||||||
{
|
{
|
||||||
int mask;
|
int mask;
|
||||||
|
|
||||||
mask = SERIAL_WAIT_2 (tty_desc, port_desc, -1);
|
mask = serial_wait_2 (tty_desc, port_desc, -1);
|
||||||
|
|
||||||
if (mask & 2)
|
if (mask & 2)
|
||||||
{ /* tty input */
|
{ /* tty input */
|
||||||
@ -596,7 +596,7 @@ connect_command (char *args, int fromtty)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (tty_desc, 0);
|
c = serial_readchar (tty_desc, 0);
|
||||||
|
|
||||||
if (c == SERIAL_TIMEOUT)
|
if (c == SERIAL_TIMEOUT)
|
||||||
break;
|
break;
|
||||||
@ -605,7 +605,7 @@ connect_command (char *args, int fromtty)
|
|||||||
perror_with_name ("connect");
|
perror_with_name ("connect");
|
||||||
|
|
||||||
cx = c;
|
cx = c;
|
||||||
SERIAL_WRITE (port_desc, &cx, 1);
|
serial_write (port_desc, &cx, 1);
|
||||||
|
|
||||||
switch (cur_esc)
|
switch (cur_esc)
|
||||||
{
|
{
|
||||||
@ -634,7 +634,7 @@ connect_command (char *args, int fromtty)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
c = SERIAL_READCHAR (port_desc, 0);
|
c = serial_readchar (port_desc, 0);
|
||||||
|
|
||||||
if (c == SERIAL_TIMEOUT)
|
if (c == SERIAL_TIMEOUT)
|
||||||
break;
|
break;
|
||||||
@ -644,7 +644,7 @@ connect_command (char *args, int fromtty)
|
|||||||
|
|
||||||
cx = c;
|
cx = c;
|
||||||
|
|
||||||
SERIAL_WRITE (tty_desc, &cx, 1);
|
serial_write (tty_desc, &cx, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
gdb/serial.h
30
gdb/serial.h
@ -35,22 +35,18 @@ struct serial;
|
|||||||
on failure. */
|
on failure. */
|
||||||
|
|
||||||
extern struct serial *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. */
|
/* Open a new serial stream using a file handle. */
|
||||||
|
|
||||||
extern struct serial *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 SCB. */
|
/* Push out all buffers, close the device and destroy SCB. */
|
||||||
|
|
||||||
extern void serial_close (struct serial *scb);
|
extern void serial_close (struct serial *scb);
|
||||||
#define SERIAL_CLOSE(SERIAL_T) serial_close ((SERIAL_T))
|
|
||||||
|
|
||||||
/* Push out all buffers and destroy SCB without closing the device. */
|
/* Push out all buffers and destroy SCB without closing the device. */
|
||||||
|
|
||||||
extern void serial_un_fdopen (struct serial *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
|
/* Read one char from the serial device with TIMEOUT seconds to wait
|
||||||
or -1 to wait forever. Use timeout of 0 to effect a poll.
|
or -1 to wait forever. Use timeout of 0 to effect a poll.
|
||||||
@ -69,13 +65,11 @@ enum serial_rc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern int serial_readchar (struct serial *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 SCB. Returns 0 for
|
/* Write LEN chars from STRING to the port SCB. Returns 0 for
|
||||||
success, non-zero for failure. */
|
success, non-zero for failure. */
|
||||||
|
|
||||||
extern int serial_write (struct serial *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. */
|
/* Write a printf style string onto the serial port. */
|
||||||
|
|
||||||
@ -84,35 +78,29 @@ extern void serial_printf (struct serial *desc, const char *,...) ATTR_FORMAT (p
|
|||||||
/* Allow pending output to drain. */
|
/* Allow pending output to drain. */
|
||||||
|
|
||||||
extern int serial_drain_output (struct serial *);
|
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
|
/* Flush (discard) pending output. Might also flush input (if this
|
||||||
system can't flush only output). */
|
system can't flush only output). */
|
||||||
|
|
||||||
extern int serial_flush_output (struct serial *);
|
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 pending input. Might also flush output (if this system can't
|
||||||
flush only input). */
|
flush only input). */
|
||||||
|
|
||||||
extern int serial_flush_input (struct serial *);
|
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. */
|
/* Send a break between 0.25 and 0.5 seconds long. */
|
||||||
|
|
||||||
extern int serial_send_break (struct serial *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. */
|
/* Turn the port into raw mode. */
|
||||||
|
|
||||||
extern void serial_raw (struct serial *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
|
/* Return a pointer to a newly malloc'd ttystate containing the state
|
||||||
of the tty. */
|
of the tty. */
|
||||||
|
|
||||||
extern serial_ttystate serial_get_tty_state (struct serial *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.
|
/* Set the state of the tty to TTYSTATE. The change is immediate.
|
||||||
When changing to or from raw mode, input might be discarded.
|
When changing to or from raw mode, input might be discarded.
|
||||||
@ -120,30 +108,25 @@ extern serial_ttystate serial_get_tty_state (struct serial *scb);
|
|||||||
errno contains the error). */
|
errno contains the error). */
|
||||||
|
|
||||||
extern int serial_set_tty_state (struct serial *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
|
/* printf_filtered a user-comprehensible description of ttystate on
|
||||||
the specified STREAM. FIXME: At present this sends output to the
|
the specified STREAM. FIXME: At present this sends output to the
|
||||||
default stream - GDB_STDOUT. */
|
default stream - GDB_STDOUT. */
|
||||||
|
|
||||||
extern void serial_print_tty_state (struct serial *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
|
/* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the
|
||||||
current state (generally obtained from a recent call to
|
current state (generally obtained from a recent call to
|
||||||
SERIAL_GET_TTY_STATE), but be careful not to discard any input.
|
serial_get_tty_state()), but be careful not to discard any input.
|
||||||
This means that we never switch in or out of raw mode, even if
|
This means that we never switch in or out of raw mode, even if
|
||||||
NEW_TTYSTATE specifies a switch. */
|
NEW_TTYSTATE specifies a switch. */
|
||||||
|
|
||||||
extern int serial_noflush_set_tty_state (struct serial *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
|
/* Set the baudrate to the decimal value supplied. Returns 0 for
|
||||||
success, -1 for failure. */
|
success, -1 for failure. */
|
||||||
|
|
||||||
extern int serial_setbaudrate (struct serial *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
|
/* Set the number of stop bits to the value specified. Returns 0 for
|
||||||
success, -1 for failure. */
|
success, -1 for failure. */
|
||||||
@ -153,19 +136,16 @@ extern int serial_setbaudrate (struct serial *scb, int rate);
|
|||||||
#define SERIAL_2_STOPBITS 3
|
#define SERIAL_2_STOPBITS 3
|
||||||
|
|
||||||
extern int serial_setstopbits (struct serial *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: */
|
/* Asynchronous serial interface: */
|
||||||
|
|
||||||
/* Can the serial device support asynchronous mode? */
|
/* Can the serial device support asynchronous mode? */
|
||||||
|
|
||||||
extern int serial_can_async_p (struct serial *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? */
|
/* Has the serial device been put in asynchronous mode? */
|
||||||
|
|
||||||
extern int serial_is_async_p (struct serial *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
|
/* For ASYNC enabled devices, register a callback and enable
|
||||||
asynchronous mode. To disable asynchronous mode, register a NULL
|
asynchronous mode. To disable asynchronous mode, register a NULL
|
||||||
@ -173,7 +153,6 @@ extern int serial_is_async_p (struct serial *scb);
|
|||||||
|
|
||||||
typedef void (serial_event_ftype) (struct serial *scb, 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);
|
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
|
/* Provide direct access to the underlying FD (if any) used to
|
||||||
implement the serial device. This interface is clearly
|
implement the serial device. This interface is clearly
|
||||||
@ -181,18 +160,15 @@ extern void serial_async (struct serial *scb, serial_event_ftype *handler, void
|
|||||||
applicable to the current serial device. */
|
applicable to the current serial device. */
|
||||||
|
|
||||||
extern int deprecated_serial_fd (struct serial *scb);
|
extern int deprecated_serial_fd (struct serial *scb);
|
||||||
#define DEPRECATED_SERIAL_FD(SERIAL_T) deprecated_serial_fd ((SERIAL_T))
|
|
||||||
|
|
||||||
/* Trace/debug mechanism.
|
/* Trace/debug mechanism.
|
||||||
|
|
||||||
SERIAL_DEBUG() enables/disables internal debugging.
|
serial_debug() enables/disables internal debugging.
|
||||||
SERIAL_DEBUG_P() indicates the current debug state. */
|
serial_debug_p() indicates the current debug state. */
|
||||||
|
|
||||||
extern void serial_debug (struct serial *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 (struct serial *scb);
|
extern int serial_debug_p (struct serial *scb);
|
||||||
#define SERIAL_DEBUG_P(SERIAL_T) serial_debug_p ((SERIAL_T))
|
|
||||||
|
|
||||||
|
|
||||||
/* Details of an instance of a serial object */
|
/* Details of an instance of a serial object */
|
||||||
|
@ -132,13 +132,13 @@ sh3_load (struct serial *desc, char *file, int hashmark)
|
|||||||
{
|
{
|
||||||
monitor_printf ("il;s:x\r");
|
monitor_printf ("il;s:x\r");
|
||||||
monitor_expect ("\005", NULL, 0); /* Look for ENQ */
|
monitor_expect ("\005", NULL, 0); /* Look for ENQ */
|
||||||
SERIAL_WRITE (desc, "\006", 1); /* Send ACK */
|
serial_write (desc, "\006", 1); /* Send ACK */
|
||||||
monitor_expect ("LO x\r", NULL, 0); /* Look for filename */
|
monitor_expect ("LO x\r", NULL, 0); /* Look for filename */
|
||||||
|
|
||||||
load_srec (desc, file, 0, 80, SREC_ALL, hashmark, NULL);
|
load_srec (desc, file, 0, 80, SREC_ALL, hashmark, NULL);
|
||||||
|
|
||||||
monitor_expect ("\005", NULL, 0); /* Look for ENQ */
|
monitor_expect ("\005", NULL, 0); /* Look for ENQ */
|
||||||
SERIAL_WRITE (desc, "\006", 1); /* Send ACK */
|
serial_write (desc, "\006", 1); /* Send ACK */
|
||||||
monitor_expect_prompt (NULL, 0);
|
monitor_expect_prompt (NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ sh3_open (char *args, int from_tty)
|
|||||||
|
|
||||||
if (parallel_port_name)
|
if (parallel_port_name)
|
||||||
{
|
{
|
||||||
parallel = SERIAL_OPEN (parallel_port_name);
|
parallel = serial_open (parallel_port_name);
|
||||||
|
|
||||||
if (!parallel)
|
if (!parallel)
|
||||||
perror_with_name ("Unable to open parallel port.");
|
perror_with_name ("Unable to open parallel port.");
|
||||||
@ -317,7 +317,7 @@ sh3e_open (char *args, int from_tty)
|
|||||||
|
|
||||||
if (parallel_port_name)
|
if (parallel_port_name)
|
||||||
{
|
{
|
||||||
parallel = SERIAL_OPEN (parallel_port_name);
|
parallel = serial_open (parallel_port_name);
|
||||||
|
|
||||||
if (!parallel)
|
if (!parallel)
|
||||||
perror_with_name ("Unable to open parallel port.");
|
perror_with_name ("Unable to open parallel port.");
|
||||||
@ -335,7 +335,7 @@ sh3_close (int quitting)
|
|||||||
monitor_close (quitting);
|
monitor_close (quitting);
|
||||||
if (parallel_in_use)
|
if (parallel_in_use)
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (parallel);
|
serial_close (parallel);
|
||||||
parallel_in_use = 0;
|
parallel_in_use = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,22 +264,22 @@ open_tty (char *name)
|
|||||||
{
|
{
|
||||||
struct serial *desc;
|
struct serial *desc;
|
||||||
|
|
||||||
desc = SERIAL_OPEN (name);
|
desc = serial_open (name);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
|
|
||||||
if (baud_rate != -1)
|
if (baud_rate != -1)
|
||||||
{
|
{
|
||||||
if (SERIAL_SETBAUDRATE (desc, baud_rate))
|
if (serial_setbaudrate (desc, baud_rate))
|
||||||
{
|
{
|
||||||
SERIAL_CLOSE (desc);
|
serial_close (desc);
|
||||||
perror_with_name (name);
|
perror_with_name (name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_RAW (desc);
|
serial_raw (desc);
|
||||||
|
|
||||||
SERIAL_FLUSH_INPUT (desc);
|
serial_flush_input (desc);
|
||||||
|
|
||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ readchar (struct serial *desc, int timeout)
|
|||||||
int ch;
|
int ch;
|
||||||
char s[10];
|
char s[10];
|
||||||
|
|
||||||
ch = SERIAL_READCHAR (desc, timeout);
|
ch = serial_readchar (desc, timeout);
|
||||||
|
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
@ -317,7 +317,7 @@ debug_serial_write (struct serial *desc, char *buf, int len)
|
|||||||
{
|
{
|
||||||
char s[10];
|
char s[10];
|
||||||
|
|
||||||
SERIAL_WRITE (desc, buf, len);
|
serial_write (desc, buf, len);
|
||||||
if (remote_debug > 0)
|
if (remote_debug > 0)
|
||||||
{
|
{
|
||||||
while (len-- > 0)
|
while (len-- > 0)
|
||||||
@ -343,7 +343,7 @@ close_tty (void *ignore)
|
|||||||
if (!remote_desc)
|
if (!remote_desc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SERIAL_CLOSE (remote_desc);
|
serial_close (remote_desc);
|
||||||
|
|
||||||
remote_desc = NULL;
|
remote_desc = NULL;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ sparclet_load (struct serial *desc, char *file, int hashmark)
|
|||||||
|
|
||||||
bfd_get_section_contents (abfd, s, buf, i, numbytes);
|
bfd_get_section_contents (abfd, s, buf, i, numbytes);
|
||||||
|
|
||||||
SERIAL_WRITE (desc, buf, numbytes);
|
serial_write (desc, buf, numbytes);
|
||||||
|
|
||||||
if (hashmark)
|
if (hashmark)
|
||||||
{
|
{
|
||||||
|
@ -842,8 +842,8 @@ quit (void)
|
|||||||
gdb_flush (gdb_stderr);
|
gdb_flush (gdb_stderr);
|
||||||
|
|
||||||
/* 3. The system-level buffer. */
|
/* 3. The system-level buffer. */
|
||||||
SERIAL_DRAIN_OUTPUT (gdb_stdout_serial);
|
serial_drain_output (gdb_stdout_serial);
|
||||||
SERIAL_UN_FDOPEN (gdb_stdout_serial);
|
serial_un_fdopen (gdb_stdout_serial);
|
||||||
|
|
||||||
annotate_error_begin ();
|
annotate_error_begin ();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ readchar (struct serial *desc, int timeout)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
c = SERIAL_READCHAR (desc, timeout);
|
c = serial_readchar (desc, timeout);
|
||||||
|
|
||||||
if (remote_debug > 0)
|
if (remote_debug > 0)
|
||||||
fputc_unfiltered (c, gdb_stdlog);
|
fputc_unfiltered (c, gdb_stdlog);
|
||||||
@ -217,7 +217,7 @@ xmodem_send_packet (struct serial *desc, unsigned char *packet, int len, int has
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
SERIAL_WRITE (desc, packet, pktlen);
|
serial_write (desc, packet, pktlen);
|
||||||
|
|
||||||
c = readchar (desc, 3);
|
c = readchar (desc, 3);
|
||||||
switch (c)
|
switch (c)
|
||||||
@ -238,7 +238,7 @@ xmodem_send_packet (struct serial *desc, unsigned char *packet, int len, int has
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */
|
serial_write (desc, "\004", 1); /* Send an EOT */
|
||||||
|
|
||||||
error ("xmodem_send_packet: Excessive retries.");
|
error ("xmodem_send_packet: Excessive retries.");
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ xmodem_finish_xfer (struct serial *desc)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
SERIAL_WRITE (desc, "\004", 1); /* Send an EOT */
|
serial_write (desc, "\004", 1); /* Send an EOT */
|
||||||
|
|
||||||
c = readchar (desc, 3);
|
c = readchar (desc, 3);
|
||||||
switch (c)
|
switch (c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user