home *** CD-ROM | disk | FTP | other *** search
- COMRING1 is a collection of Lattice "C" functions that set up COM1 to be
- completely interrupt driven. When you want to transmit something, it is
- placed in the transmit ring, and you immediately regain control to do
- other processing. In the meantime, the interrupt routine is sending data
- from the transmit ring out the com port. Later on, you can check to see
- if the operation is done, or add more data to the xmit ring before the
- previous xmit is finished. The receive function works similarily. When a
- character is received, it is put into a ring. When you ask for a byte,
- it is taken from the ring. This isn't quite true multi-tasking, but it's
- close.
-
- This version is a test version. As soon as I am sure it is solid, it will
- be easy to do the same thing for COM2. Eventually I intend to write a
- multiple user BBS program that will not require any special software
- like Concurrent DOS or Topview.
-
- Each function is described below. They were compiled using the small model.
- Support for the other models will come later.
-
-
- ************************************************************************
-
- c1setup (rcvlen, xmtlen)
- int rcvlen, xmtlen
-
- Allocates storage for transmit & receive ring. Enables all interrupts
- and sets new interrupt vector. Returns 0 if all ok, or 1 if insufficient
- storage for rings.
-
- ************************************************************************
- c1bcnt(rbc, xbc)
- int *rbc, *xbc
-
- Sends the current byte counts of the receive & transmit rings.
-
- ************************************************************************
-
- c1init (speed, parity, databits, stopbits)
- int speed, parity, databits, stopbits;
-
- Initializes the communications port. Return codes are:
- 0 - all parameters valid
- 1 - invalid speed (110,150,300,600,1200,2400,4800,9600)
- 2 - invalid parity ('S','M','O','E','N')
- 3 - invalid data bits ('5', '6', '7', '8')
- 4 - invalid stop bits ('1', '2')
-
- ************************************************************************
-
- c1mstat()
- int function that returns modem status. Refer to Technical
- Reference manual for bit meanings.
-
- ************************************************************************
-
- c1rbyte (rb, rstat)
- char *rb, *rstat
-
- int function that gets a received byte and status from the receive ring.
- Returns 0 if a character has been received, or 1 if the ring is empty.
-
- ************************************************************************
-
- c1smc(dsw)
- int dsw
-
- Sets modem control (dtr, rts) on or off.
-
- ************************************************************************
-
- c1xmitb(xchar)
- char xchar
-
- Inserts a character into the xmit ring.
-
- ************************************************************************
-
- c1xmits(string)
- char *string
-
- Int function that puts a string into the xmit ring. Returns 0 if entire
- string was put in, or returns number of bytes that weren't put in because
- the ring was full.
-
- ************************************************************************
-
- c1xmitsw(string)
- char *string
-
- Same as c1smits, but waits for the xmit operation to finish.
-
- ************************************************************************
-
- ckxfull()
-
- Int function returns 0 if xmit ring is not full, returns 1 if it is full.
-
- ************************************************************************
-
-
-
- If you have any problems, comments, suggestions etc. leave me (John Cantlin)
- a message on the Consultants Exchange RBBS (714) 842-6348.
-
-