Thu Aug 7 13:39:31 1997 Geoffrey Noer <noer@cygnus.com>
[deliverable/binutils-gdb.git] / gdb / ser-mac.c
index 98a503c297ab91724f07571658b7b97b90afc2ed..35400029b028fefd1e7728015011b397246f4573 100644 (file)
@@ -16,7 +16,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "serial.h"
@@ -60,7 +60,7 @@ mac_open (scb, name)
   /* Alloc buffer space first - that way any allocation failures are
      intercepted before the serial driver gets involved. */
   if (mac_input_buffer == NULL)
-    mac_input_buffer = (char *) xmalloc (256);
+    mac_input_buffer = (char *) xmalloc (4096);
   /* Match on a name and open a port. */
   if (strcmp (name, "modem") == 0)
     {
@@ -101,7 +101,7 @@ mac_open (scb, name)
     }
   /* We got something open. */
   if (1 /* using custom buffer */)
-    SerSetBuf (input_refnum, mac_input_buffer, 256);
+    SerSetBuf (input_refnum, mac_input_buffer, 4096);
   /* Set to a GDB-preferred state. */
   SerReset (input_refnum,  stop10|noParity|data8|baud9600);
   SerReset (output_refnum, stop10|noParity|data8|baud9600);
@@ -239,12 +239,46 @@ mac_print_tty_state (scb, ttystate)
   return;
 }
 
+/* If there is a tricky formula to relate real baud rates
+   to what the serial driver wants, we should use it.  Until
+   we get one, this table will have to do.  */
+
+static struct {
+  int real_rate;
+  int bits;
+} mac_baud_rate_table[] = {
+  { 57600, baud57600 },
+  { 38400, 1 },
+  { 19200, baud19200 },
+  { 9600, baud9600 },
+  { 7200, baud7200 },
+  { 4800, baud4800 },
+  { 3600, baud3600 },
+  { 2400, baud2400 },
+  { 1800, baud1800 },
+  { 1200, baud1200 },
+  { 600, baud600 },
+  { 300, baud300 },
+  { 0, 0 }
+};
+
 static int
 mac_set_baud_rate (scb, rate)
      serial_t scb;
      int rate;
 {
-  return 0;
+  int i, bits;
+
+  for (i = 0; mac_baud_rate_table[i].real_rate != 0; ++i)
+    {
+      if (mac_baud_rate_table[i].real_rate == rate)
+       {
+         bits = mac_baud_rate_table[i].bits;
+         break;
+       }
+    }
+  SerReset (input_refnum,  stop10|noParity|data8|bits);
+  SerReset (output_refnum, stop10|noParity|data8|bits);
 }
 
 static int
@@ -294,7 +328,7 @@ mac_close (serial_t scb)
   if (output_refnum)
     {
       if (0 /* custom buffer */)
-       SetSetBuf (input_refnum, mac_output_buffer, 0);
+       SerSetBuf (input_refnum, mac_output_buffer, 0);
       CloseDriver (output_refnum);
       output_refnum = 0;
     }
This page took 0.024344 seconds and 4 git commands to generate.