+Wed Sep 13 03:08:32 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * remote-mips.c (mips_expect, mips_getstring, mips_send_packet,
+ mips_send_packet, pmon_insert_breakpoint, send_srec,
+ pmon_check_ack, pmon_check_entry_address,
+ _initialize_remote_mips): Replace the magic two seconds with
+ ``remote_timeout''.
+ (pmon_check_entry_address, pmon_check_total): New functions. Use
+ ``remote_timeout'' instead of magic two seconds.
+ (pmon_end_download): Rewrite. Use pmon_check_entry_address and
+ pmon_check_total.
+
2000-09-12 Alexandre Oliva <aoliva@redhat.com>
* MAINTAINERS: Added myself.
int
mips_expect (const char *string)
{
- return mips_expect_timeout (string, 2);
+ return mips_expect_timeout (string, remote_timeout);
}
/* Read the required number of characters into the given buffer (which
immediate_quit++;
while (n > 0)
{
- c = SERIAL_READCHAR (mips_desc, 2);
+ c = SERIAL_READCHAR (mips_desc, remote_timeout);
if (c == SERIAL_TIMEOUT)
{
{
int rch;
- rch = mips_readchar (2);
+ rch = mips_readchar (remote_timeout);
if (rch == SYN)
{
ch = SYN;
}
if (i == len)
- (void) mips_receive_trailer (trlr, &garbage, &ch, 2);
+ (void) mips_receive_trailer (trlr, &garbage, &ch,
+ remote_timeout);
/* We don't bother checking the checksum, or providing an
ACK to the packet. */
mips_expect ("Bpt ");
- if (!mips_getstring (tbuff, 2))
+ if (!mips_getstring (tbuff, remote_timeout))
return 1;
tbuff[2] = '\0'; /* terminate the string */
if (sscanf (tbuff, "%d", &bpnum) != 1)
SERIAL_WRITE (mips_desc, srec, len);
- ch = mips_readchar (2);
+ ch = mips_readchar (remote_timeout);
switch (ch)
{
if (!tftp_in_use)
{
- c = SERIAL_READCHAR (udp_in_use ? udp_desc : mips_desc, 2);
+ c = SERIAL_READCHAR (udp_in_use ? udp_desc : mips_desc,
+ remote_timeout);
if ((c == SERIAL_TIMEOUT) || (c != 0x06))
{
fprintf_unfiltered (gdb_stderr,
}
static void
+pmon_check_entry_address (char *entry_address, int final)
+{
+ char hexnumber[9]; /* includes '\0' space */
+ mips_expect_timeout (entry_address, tftp_in_use ? 15 : remote_timeout);
+ sprintf (hexnumber, "%x", final);
+ mips_expect (hexnumber);
+ mips_expect ("\r\n");
+}
+
+static int
+pmon_check_total (int bintotal)
+{
+ char hexnumber[9]; /* includes '\0' space */
+ mips_expect ("\r\ntotal = 0x");
+ sprintf (hexnumber, "%x", bintotal);
+ mips_expect (hexnumber);
+ return mips_expect_download (" bytes\r\n");
+}
+
+static void
pmon_end_download (int final, int bintotal)
{
char hexnumber[9]; /* includes '\0' space */
/* Wait for the stuff that PMON prints after the load has completed.
The timeout value for use in the tftp case (15 seconds) was picked
arbitrarily but might be too small for really large downloads. FIXME. */
- if (mips_monitor == MON_LSI)
+ switch (mips_monitor)
{
+ case MON_LSI:
+ pmon_check_ack ("termination");
+ pmon_check_entry_address ("Entry address is ", final);
+ if (!pmon_check_total (bintotal))
+ return;
+ break;
+ default:
+ pmon_check_entry_address ("Entry Address = ", final);
pmon_check_ack ("termination");
- mips_expect_timeout ("Entry address is ", tftp_in_use ? 15 : 2);
+ if (!pmon_check_total (bintotal))
+ return;
+ break;
}
- else
- mips_expect_timeout ("Entry Address = ", tftp_in_use ? 15 : 2);
-
- sprintf (hexnumber, "%x", final);
- mips_expect (hexnumber);
- mips_expect ("\r\n");
- if (mips_monitor != MON_LSI)
- pmon_check_ack ("termination");
- mips_expect ("\r\ntotal = 0x");
- sprintf (hexnumber, "%x", bintotal);
- mips_expect (hexnumber);
- if (!mips_expect_download (" bytes\r\n"))
- return;
if (tftp_in_use)
remove (tftp_localname); /* Remove temporary file */