diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-07-08 20:11:12 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-07-08 20:11:12 +0000 |
commit | cc61049cca934074f2f8c58fefc3937a182cc9c8 (patch) | |
tree | a355f80b561774fb4b95dfec40151441f493a425 /gdb/ser-mac.c | |
parent | 10ba702db332e1006e739e8d5283dd8eade720c0 (diff) | |
download | gdb-cc61049cca934074f2f8c58fefc3937a182cc9c8.zip gdb-cc61049cca934074f2f8c58fefc3937a182cc9c8.tar.gz gdb-cc61049cca934074f2f8c58fefc3937a182cc9c8.tar.bz2 |
* ser-mac.c: Make obsolete.
* Makefile.in (ser-mac.o): Ditto.
Diffstat (limited to 'gdb/ser-mac.c')
-rw-r--r-- | gdb/ser-mac.c | 772 |
1 files changed, 386 insertions, 386 deletions
diff --git a/gdb/ser-mac.c b/gdb/ser-mac.c index ed0b693..e507cf9 100644 --- a/gdb/ser-mac.c +++ b/gdb/ser-mac.c @@ -1,386 +1,386 @@ -/* Remote serial interface for local (hardwired) serial ports for Macintosh. - Copyright 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc. - Contributed by Cygnus Support. Written by Stan Shebs. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "defs.h" -#include "serial.h" - -#include <Types.h> -#include <Devices.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. */ - -struct mac_ttystate - { - int bogus; - }; - -static int mac_open (serial_t scb, const char *name); -static void mac_raw (serial_t scb); -static int mac_readchar (serial_t scb, int timeout); -static int mac_setbaudrate (serial_t scb, int rate); -static int mac_write (serial_t scb, const char *str, int len); -static void mac_close (serial_t scb); -static serial_ttystate mac_get_tty_state (serial_t scb); -static int mac_set_tty_state (serial_t scb, serial_ttystate state); -static char *aptr (short p); - -short input_refnum; -short output_refnum; - -char *mac_input_buffer; -char *mac_output_buffer; - -static int -mac_open (serial_t scb, const char *name) -{ - OSErr err; - - /* 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 (4096); - /* Match on a name and open a port. */ - if (strcmp (name, "modem") == 0) - { - err = OpenDriver ("\p.AIn", &input_refnum); - if (err != 0) - { - return (-1); - } - err = OpenDriver ("\p.AOut", &output_refnum); - if (err != 0) - { - CloseDriver (input_refnum); - return (-1); - } - } - else if (strcmp (name, "printer") == 0) - { - err = OpenDriver ("\p.BIn", &input_refnum); - if (err != 0) - { - return (-1); - } - err = OpenDriver ("\p.BOut", &output_refnum); - if (err != 0) - { - CloseDriver (input_refnum); - return (-1); - } - /* fake */ - scb->fd = 1; - return 0; - } - else - { - error ("You must specify a valid serial port name; your choices are `modem' or `printer'."); - errno = ENOENT; - return (-1); - } - /* We got something open. */ - if (1 /* using custom buffer */ ) - 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); - { - CntrlParam cb; - struct SerShk *handshake; - - cb.ioCRefNum = output_refnum; - cb.csCode = 14; - handshake = (struct SerShk *) &cb.csParam[0]; - handshake->fXOn = 0; - handshake->fCTS = 0; - handshake->xOn = 0; - handshake->xOff = 0; - handshake->errs = 0; - handshake->evts = 0; - handshake->fInX = 0; - handshake->fDTR = 0; - err = PBControl ((ParmBlkPtr) & cb, 0); - if (err < 0) - return (-1); - } - /* fake */ - scb->fd = 1; - return 0; -} - -static int -mac_noop (serial_t scb) -{ - return 0; -} - -static void -mac_raw (serial_t scb) -{ - /* Always effectively in raw mode. */ -} - -/* Read a character with user-specified timeout. TIMEOUT is number of seconds - to wait, or -1 to wait forever. Use timeout of 0 to effect a poll. Returns - char if successful. Returns -2 if timeout expired, EOF if line dropped - dead, or -3 for any other error (see errno in that case). */ - -static int -mac_readchar (serial_t scb, int timeout) -{ - int status, n; - /* time_t */ unsigned long start_time, now; - OSErr err; - CntrlParam cb; - IOParam pb; - - if (scb->bufcnt-- > 0) - return *scb->bufp++; - - time (&start_time); - - while (1) - { - cb.ioCRefNum = input_refnum; - cb.csCode = 2; - err = PBStatus ((ParmBlkPtr) & cb, 0); - if (err < 0) - return SERIAL_ERROR; - n = *((long *) &cb.csParam[0]); - if (n > 0) - { - pb.ioRefNum = input_refnum; - pb.ioBuffer = (Ptr) (scb->buf); - pb.ioReqCount = (n > 64 ? 64 : n); - err = PBRead ((ParmBlkPtr) & pb, 0); - if (err < 0) - return SERIAL_ERROR; - scb->bufcnt = pb.ioReqCount; - scb->bufcnt--; - scb->bufp = scb->buf; - return *scb->bufp++; - } - else if (timeout == 0) - return SERIAL_TIMEOUT; - else if (timeout == -1) - ; - else - { - time (&now); - if (now > start_time + timeout) - return SERIAL_TIMEOUT; - } - PROGRESS (1); - } -} - -/* mac_{get set}_tty_state() are both dummys to fill out the function - vector. Someday, they may do something real... */ - -static serial_ttystate -mac_get_tty_state (serial_t scb) -{ - struct mac_ttystate *state; - - state = (struct mac_ttystate *) xmalloc (sizeof *state); - - return (serial_ttystate) state; -} - -static int -mac_set_tty_state (serial_t scb, serial_ttystate ttystate) -{ - return 0; -} - -static int -mac_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, - serial_ttystate old_ttystate) -{ - return 0; -} - -static void -mac_print_tty_state (serial_t scb, - serial_ttystate ttystate, - struct ui_file *stream) -{ - /* Nothing to print. */ - 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 (serial_t scb, int rate) -{ - 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 -mac_set_stop_bits (serial_t scb, int num) -{ - return 0; -} - -int first_mac_write = 0; - -static int -mac_write (serial_t scb, const char *str, int len) -{ - OSErr err; - IOParam pb; - - if (first_mac_write++ < 4) - { - sleep (1); - } - pb.ioRefNum = output_refnum; - pb.ioBuffer = (Ptr) str; - pb.ioReqCount = len; - err = PBWrite ((ParmBlkPtr) & pb, 0); - if (err < 0) - { - return 1; - } - return 0; -} - -static void -mac_close (serial_t scb) -{ - if (input_refnum) - { - if (1 /* custom buffer */ ) - SerSetBuf (input_refnum, mac_input_buffer, 0); - CloseDriver (input_refnum); - input_refnum = 0; - } - if (output_refnum) - { - if (0 /* custom buffer */ ) - SerSetBuf (input_refnum, mac_output_buffer, 0); - CloseDriver (output_refnum); - output_refnum = 0; - } -} - -static struct serial_ops mac_ops = -{ - "hardwire", - 0, - mac_open, - mac_close, - mac_readchar, - mac_write, - mac_noop, /* flush output */ - mac_noop, /* flush input */ - mac_noop, /* send break -- currently only for nindy */ - mac_raw, - mac_get_tty_state, - mac_set_tty_state, - mac_print_tty_state, - mac_noflush_set_tty_state, - mac_set_baud_rate, - mac_set_stop_bits, - mac_noop, /* wait for output to drain */ -}; - -void -_initialize_ser_mac (void) -{ - serial_add_interface (&mac_ops); -} +/* OBSOLETE /* Remote serial interface for local (hardwired) serial ports for Macintosh. */ +/* OBSOLETE Copyright 1994, 1995, 1996, 1998, 2000 Free Software Foundation, Inc. */ +/* OBSOLETE Contributed by Cygnus Support. Written by Stan Shebs. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */ +/* OBSOLETE Boston, MA 02111-1307, USA. */ */ +/* OBSOLETE */ +/* OBSOLETE #include "defs.h" */ +/* OBSOLETE #include "serial.h" */ +/* OBSOLETE */ +/* OBSOLETE #include <Types.h> */ +/* OBSOLETE #include <Devices.h> */ +/* OBSOLETE /* This is the regular Mac Serial.h, but copied to a different name */ +/* OBSOLETE so as not to get confused with the GDB serial.h above. */ */ +/* OBSOLETE #include "MacSerial.h" */ +/* OBSOLETE */ +/* OBSOLETE /* This is unused for now. We just return a placeholder. */ */ +/* OBSOLETE */ +/* OBSOLETE struct mac_ttystate */ +/* OBSOLETE { */ +/* OBSOLETE int bogus; */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE static int mac_open (serial_t scb, const char *name); */ +/* OBSOLETE static void mac_raw (serial_t scb); */ +/* OBSOLETE static int mac_readchar (serial_t scb, int timeout); */ +/* OBSOLETE static int mac_setbaudrate (serial_t scb, int rate); */ +/* OBSOLETE static int mac_write (serial_t scb, const char *str, int len); */ +/* OBSOLETE static void mac_close (serial_t scb); */ +/* OBSOLETE static serial_ttystate mac_get_tty_state (serial_t scb); */ +/* OBSOLETE static int mac_set_tty_state (serial_t scb, serial_ttystate state); */ +/* OBSOLETE static char *aptr (short p); */ +/* OBSOLETE */ +/* OBSOLETE short input_refnum; */ +/* OBSOLETE short output_refnum; */ +/* OBSOLETE */ +/* OBSOLETE char *mac_input_buffer; */ +/* OBSOLETE char *mac_output_buffer; */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_open (serial_t scb, const char *name) */ +/* OBSOLETE { */ +/* OBSOLETE OSErr err; */ +/* OBSOLETE */ +/* OBSOLETE /* Alloc buffer space first - that way any allocation failures are */ +/* OBSOLETE intercepted before the serial driver gets involved. */ */ +/* OBSOLETE if (mac_input_buffer == NULL) */ +/* OBSOLETE mac_input_buffer = (char *) xmalloc (4096); */ +/* OBSOLETE /* Match on a name and open a port. */ */ +/* OBSOLETE if (strcmp (name, "modem") == 0) */ +/* OBSOLETE { */ +/* OBSOLETE err = OpenDriver ("\p.AIn", &input_refnum); */ +/* OBSOLETE if (err != 0) */ +/* OBSOLETE { */ +/* OBSOLETE return (-1); */ +/* OBSOLETE } */ +/* OBSOLETE err = OpenDriver ("\p.AOut", &output_refnum); */ +/* OBSOLETE if (err != 0) */ +/* OBSOLETE { */ +/* OBSOLETE CloseDriver (input_refnum); */ +/* OBSOLETE return (-1); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE else if (strcmp (name, "printer") == 0) */ +/* OBSOLETE { */ +/* OBSOLETE err = OpenDriver ("\p.BIn", &input_refnum); */ +/* OBSOLETE if (err != 0) */ +/* OBSOLETE { */ +/* OBSOLETE return (-1); */ +/* OBSOLETE } */ +/* OBSOLETE err = OpenDriver ("\p.BOut", &output_refnum); */ +/* OBSOLETE if (err != 0) */ +/* OBSOLETE { */ +/* OBSOLETE CloseDriver (input_refnum); */ +/* OBSOLETE return (-1); */ +/* OBSOLETE } */ +/* OBSOLETE /* fake */ */ +/* OBSOLETE scb->fd = 1; */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE error ("You must specify a valid serial port name; your choices are `modem' or `printer'."); */ +/* OBSOLETE errno = ENOENT; */ +/* OBSOLETE return (-1); */ +/* OBSOLETE } */ +/* OBSOLETE /* We got something open. */ */ +/* OBSOLETE if (1 /* using custom buffer */ ) */ +/* OBSOLETE SerSetBuf (input_refnum, mac_input_buffer, 4096); */ +/* OBSOLETE /* Set to a GDB-preferred state. */ */ +/* OBSOLETE SerReset (input_refnum, stop10 | noParity | data8 | baud9600); */ +/* OBSOLETE SerReset (output_refnum, stop10 | noParity | data8 | baud9600); */ +/* OBSOLETE { */ +/* OBSOLETE CntrlParam cb; */ +/* OBSOLETE struct SerShk *handshake; */ +/* OBSOLETE */ +/* OBSOLETE cb.ioCRefNum = output_refnum; */ +/* OBSOLETE cb.csCode = 14; */ +/* OBSOLETE handshake = (struct SerShk *) &cb.csParam[0]; */ +/* OBSOLETE handshake->fXOn = 0; */ +/* OBSOLETE handshake->fCTS = 0; */ +/* OBSOLETE handshake->xOn = 0; */ +/* OBSOLETE handshake->xOff = 0; */ +/* OBSOLETE handshake->errs = 0; */ +/* OBSOLETE handshake->evts = 0; */ +/* OBSOLETE handshake->fInX = 0; */ +/* OBSOLETE handshake->fDTR = 0; */ +/* OBSOLETE err = PBControl ((ParmBlkPtr) & cb, 0); */ +/* OBSOLETE if (err < 0) */ +/* OBSOLETE return (-1); */ +/* OBSOLETE } */ +/* OBSOLETE /* fake */ */ +/* OBSOLETE scb->fd = 1; */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_noop (serial_t scb) */ +/* OBSOLETE { */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE mac_raw (serial_t scb) */ +/* OBSOLETE { */ +/* OBSOLETE /* Always effectively in raw mode. */ */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Read a character with user-specified timeout. TIMEOUT is number of seconds */ +/* OBSOLETE to wait, or -1 to wait forever. Use timeout of 0 to effect a poll. Returns */ +/* OBSOLETE char if successful. Returns -2 if timeout expired, EOF if line dropped */ +/* OBSOLETE dead, or -3 for any other error (see errno in that case). */ */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_readchar (serial_t scb, int timeout) */ +/* OBSOLETE { */ +/* OBSOLETE int status, n; */ +/* OBSOLETE /* time_t */ unsigned long start_time, now; */ +/* OBSOLETE OSErr err; */ +/* OBSOLETE CntrlParam cb; */ +/* OBSOLETE IOParam pb; */ +/* OBSOLETE */ +/* OBSOLETE if (scb->bufcnt-- > 0) */ +/* OBSOLETE return *scb->bufp++; */ +/* OBSOLETE */ +/* OBSOLETE time (&start_time); */ +/* OBSOLETE */ +/* OBSOLETE while (1) */ +/* OBSOLETE { */ +/* OBSOLETE cb.ioCRefNum = input_refnum; */ +/* OBSOLETE cb.csCode = 2; */ +/* OBSOLETE err = PBStatus ((ParmBlkPtr) & cb, 0); */ +/* OBSOLETE if (err < 0) */ +/* OBSOLETE return SERIAL_ERROR; */ +/* OBSOLETE n = *((long *) &cb.csParam[0]); */ +/* OBSOLETE if (n > 0) */ +/* OBSOLETE { */ +/* OBSOLETE pb.ioRefNum = input_refnum; */ +/* OBSOLETE pb.ioBuffer = (Ptr) (scb->buf); */ +/* OBSOLETE pb.ioReqCount = (n > 64 ? 64 : n); */ +/* OBSOLETE err = PBRead ((ParmBlkPtr) & pb, 0); */ +/* OBSOLETE if (err < 0) */ +/* OBSOLETE return SERIAL_ERROR; */ +/* OBSOLETE scb->bufcnt = pb.ioReqCount; */ +/* OBSOLETE scb->bufcnt--; */ +/* OBSOLETE scb->bufp = scb->buf; */ +/* OBSOLETE return *scb->bufp++; */ +/* OBSOLETE } */ +/* OBSOLETE else if (timeout == 0) */ +/* OBSOLETE return SERIAL_TIMEOUT; */ +/* OBSOLETE else if (timeout == -1) */ +/* OBSOLETE ; */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE time (&now); */ +/* OBSOLETE if (now > start_time + timeout) */ +/* OBSOLETE return SERIAL_TIMEOUT; */ +/* OBSOLETE } */ +/* OBSOLETE PROGRESS (1); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* mac_{get set}_tty_state() are both dummys to fill out the function */ +/* OBSOLETE vector. Someday, they may do something real... */ */ +/* OBSOLETE */ +/* OBSOLETE static serial_ttystate */ +/* OBSOLETE mac_get_tty_state (serial_t scb) */ +/* OBSOLETE { */ +/* OBSOLETE struct mac_ttystate *state; */ +/* OBSOLETE */ +/* OBSOLETE state = (struct mac_ttystate *) xmalloc (sizeof *state); */ +/* OBSOLETE */ +/* OBSOLETE return (serial_ttystate) state; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_set_tty_state (serial_t scb, serial_ttystate ttystate) */ +/* OBSOLETE { */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_noflush_set_tty_state (serial_t scb, serial_ttystate new_ttystate, */ +/* OBSOLETE serial_ttystate old_ttystate) */ +/* OBSOLETE { */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE mac_print_tty_state (serial_t scb, */ +/* OBSOLETE serial_ttystate ttystate, */ +/* OBSOLETE struct ui_file *stream) */ +/* OBSOLETE { */ +/* OBSOLETE /* Nothing to print. */ */ +/* OBSOLETE return; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* If there is a tricky formula to relate real baud rates */ +/* OBSOLETE to what the serial driver wants, we should use it. Until */ +/* OBSOLETE we get one, this table will have to do. */ */ +/* OBSOLETE */ +/* OBSOLETE static struct */ +/* OBSOLETE { */ +/* OBSOLETE int real_rate; */ +/* OBSOLETE int bits; */ +/* OBSOLETE } */ +/* OBSOLETE mac_baud_rate_table[] = */ +/* OBSOLETE { */ +/* OBSOLETE { */ +/* OBSOLETE 57600, baud57600 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 38400, 1 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 19200, baud19200 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 9600, baud9600 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 7200, baud7200 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 4800, baud4800 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 3600, baud3600 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 2400, baud2400 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 1800, baud1800 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 1200, baud1200 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 600, baud600 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 300, baud300 */ +/* OBSOLETE } */ +/* OBSOLETE , */ +/* OBSOLETE { */ +/* OBSOLETE 0, 0 */ +/* OBSOLETE } */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_set_baud_rate (serial_t scb, int rate) */ +/* OBSOLETE { */ +/* OBSOLETE int i, bits; */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; mac_baud_rate_table[i].real_rate != 0; ++i) */ +/* OBSOLETE { */ +/* OBSOLETE if (mac_baud_rate_table[i].real_rate == rate) */ +/* OBSOLETE { */ +/* OBSOLETE bits = mac_baud_rate_table[i].bits; */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE SerReset (input_refnum, stop10 | noParity | data8 | bits); */ +/* OBSOLETE SerReset (output_refnum, stop10 | noParity | data8 | bits); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_set_stop_bits (serial_t scb, int num) */ +/* OBSOLETE { */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE int first_mac_write = 0; */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE mac_write (serial_t scb, const char *str, int len) */ +/* OBSOLETE { */ +/* OBSOLETE OSErr err; */ +/* OBSOLETE IOParam pb; */ +/* OBSOLETE */ +/* OBSOLETE if (first_mac_write++ < 4) */ +/* OBSOLETE { */ +/* OBSOLETE sleep (1); */ +/* OBSOLETE } */ +/* OBSOLETE pb.ioRefNum = output_refnum; */ +/* OBSOLETE pb.ioBuffer = (Ptr) str; */ +/* OBSOLETE pb.ioReqCount = len; */ +/* OBSOLETE err = PBWrite ((ParmBlkPtr) & pb, 0); */ +/* OBSOLETE if (err < 0) */ +/* OBSOLETE { */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE mac_close (serial_t scb) */ +/* OBSOLETE { */ +/* OBSOLETE if (input_refnum) */ +/* OBSOLETE { */ +/* OBSOLETE if (1 /* custom buffer */ ) */ +/* OBSOLETE SerSetBuf (input_refnum, mac_input_buffer, 0); */ +/* OBSOLETE CloseDriver (input_refnum); */ +/* OBSOLETE input_refnum = 0; */ +/* OBSOLETE } */ +/* OBSOLETE if (output_refnum) */ +/* OBSOLETE { */ +/* OBSOLETE if (0 /* custom buffer */ ) */ +/* OBSOLETE SerSetBuf (input_refnum, mac_output_buffer, 0); */ +/* OBSOLETE CloseDriver (output_refnum); */ +/* OBSOLETE output_refnum = 0; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static struct serial_ops mac_ops = */ +/* OBSOLETE { */ +/* OBSOLETE "hardwire", */ +/* OBSOLETE 0, */ +/* OBSOLETE mac_open, */ +/* OBSOLETE mac_close, */ +/* OBSOLETE mac_readchar, */ +/* OBSOLETE mac_write, */ +/* OBSOLETE mac_noop, /* flush output */ */ +/* OBSOLETE mac_noop, /* flush input */ */ +/* OBSOLETE mac_noop, /* send break -- currently only for nindy */ */ +/* OBSOLETE mac_raw, */ +/* OBSOLETE mac_get_tty_state, */ +/* OBSOLETE mac_set_tty_state, */ +/* OBSOLETE mac_print_tty_state, */ +/* OBSOLETE mac_noflush_set_tty_state, */ +/* OBSOLETE mac_set_baud_rate, */ +/* OBSOLETE mac_set_stop_bits, */ +/* OBSOLETE mac_noop, /* wait for output to drain */ */ +/* OBSOLETE }; */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE _initialize_ser_mac (void) */ +/* OBSOLETE { */ +/* OBSOLETE serial_add_interface (&mac_ops); */ +/* OBSOLETE } */ |