[comp.binaries.ibm.pc.d] Looking for serial port binaries

nr@notecnirp.Princeton.EDU (Norman Ramsey) (11/01/88)

I'm looking for binaries to manage a serial port.  What I'd like to do
is have an interrupt routine that will grab characters as they come in
and slug them in a buffer (sending an XOFF if the buffer gets too
full).  I'd like a C-callable, non-blocking read that will just get me
all the characters in the input buffer.  I'd like a write (doesn't
have to be non-blocking; in fact that's quite hard) to write to the
serial port as well.  The interrupt routine should do the right thing
upon receiving XON or XOFF from the host.  Finally I'd like to set up
the port and the interrupt routine.  So something like the following
is in order:

void startserial (int port, int baudrate, int databits, char parity, ...);
	/* installs the interrupt routine, sets the port */

int readserial (int port, char *buffer, int limit);
	/* reads up to limit chars into buffer, returns number of chars
	   read, never blocks (i.e. returns 0 immediately if no
	   input available */

int writeserial (int port, char *buffer, int length);
	/* writes characters to serial port, may block (i.e. if host
	   has sent XOFF, this routine may not return until we get
	   XON. */

int stopserial (int port);
	/* restores the previous interrupt routine */


I'm sure that something like this, or something close to it, already
exists.  I've already looked on SIMTEL20, and I see maybe a dozen
programs that seem to deal directly with the serial port, and I have
no idea which one is closest to what I want, or whether I should just
get all of them and try to mix and match.

Can anyone point me in the right direction to get this done?

Norman Ramsey
nr@princeton.edu
Norman Ramsey
nr@princeton.edu

spolsky-joel@CS.YALE.EDU (Joel Spolsky) (11/01/88)

In article <12908@princeton.Princeton.EDU> nr@princeton.Princeton.EDU (Norman Ramsey) writes:

>I'm looking for binaries to manage a serial port.

on simtel20, look in the directory PD1:<MSDOS.TURBO-C> 

There are at least two packages that do what you want in there. I
can't remember the exact file names, but both have a COM somewhere in
the filename...

+----------------+---------------------------------------------------+
|  Joel Spolsky  | bitnet: spolsky@yalecs     uucp: ...!yale!spolsky |
|                | arpa:   spolsky@yale.edu   voicenet: 203-436-1483 |
+----------------+---------------------------------------------------+
                                               #include <disclaimer.h>