/* Remote serial interface for local (hardwired) serial ports for Macintosh.
Copyright 1994 Free Software Foundation, Inc.
+ Contributed by Cygnus Support. Written by Stan Shebs.
This file is part of GDB.
#include <Types.h>
#include <Devices.h>
-#include <Serial.h>
+/* This is the regular Mac Serial.h, but copied to a different name
+ so as not to get confused with the GDB serial.h above. */
+#include "MacSerial.h"
/* This is unused for now. We just return a placeholder. */
}
else
{
+ error ("You must specify a port. Choices are `modem' or `printer'.");
errno = ENOENT;
return (-1);
}
int timeout;
{
int status, n;
- /* time_t */ unsigned long starttime, now;
+ /* time_t */ unsigned long start_time, now;
OSErr err;
CntrlParam cb;
IOParam pb;
if (scb->bufcnt-- > 0)
return *scb->bufp++;
- time (&starttime);
+ time (&start_time);
while (1)
{
else
{
time (&now);
- if (now > starttime + timeout) {
- printf_unfiltered ("start %u, now %u, timeout %d\n", starttime, now, timeout);
+ if (now > start_time + timeout)
return SERIAL_TIMEOUT;
- }
}
}
}
return 0;
}
+int first_mac_write = 0;
+
static int
mac_write (scb, str, len)
serial_t scb;
OSErr err;
IOParam pb;
+ if (first_mac_write++ < 4)
+ {
+ sec_sleep (1);
+ }
pb.ioRefNum = output_refnum;
pb.ioBuffer = (Ptr) str;
pb.ioReqCount = len;
return 0;
}
+sec_sleep (int timeout)
+{
+ unsigned long start_time, now;
+
+ time (&start_time);
+
+ while (1)
+ {
+ time (&now);
+ if (now > start_time + timeout)
+ return;
+ }
+}
+
static void
-mac_close (scb)
- serial_t scb;
+mac_close (serial_t scb)
{
if (input_refnum)
{