home *** CD-ROM | disk | FTP | other *** search
- // Written by Chris Sokol
-
- #ifndef TTYIO_H
- #define TTYIO_H 1
-
- #include <utype.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- void TTYInit(void);
- void TTYTerm(void);
-
- int TTYOpen(uint io, uint irq, int ty, uint *rb, uint rl, uint *tb, uint tl);
- // Returns >= 0 if opened, error otherwise
-
- int TTYClose(int h);
- // Returns 0 if closed, error otherwise
-
- int TTYAvail(int h);
- // Returns 1 if event available, 0 if event not available, error otherwise
-
- uint TTYGet(int h);
- // Returns event code (see enums below)
-
- int TTYPut(int h, uint c);
- // Returns 0 if character queued, error otherwise
-
- int TTYDone(int h);
- // Returns 1 if output complete, 0 if transmitting, error otherwise
-
- enum
- {
- // error values
-
- TTYbadhand = -1,
- TTYbadio = -2,
- TTYbadirq = -3,
- TTYbadtype = -4,
- TTYnullbuf = -5,
- TTYquefull = -6,
- };
-
- enum
- {
- // possible values for port type (param ty to TTYOpen())
-
- TTYnorm,
- TTYv8at0,
- TTYv8at1,
- TTYv8at2,
- TTYv8at3,
- TTYv8at4,
- TTYv8at5,
- TTYv8at6,
- TTYv8at7,
- };
-
- enum
- {
- // possible values for high byte of TTYGet()
-
- TTYrxchar, // low byte is a received character
- TTYrxlins, // low byte is new line status
- TTYrxmdms, // low byte is new modem status
-
- TTYhndinv = 0xfe, // error: handle is invalid
- TTYnodata = 0xff // error: no data is available
- };
-
- enum
- {
- // possible values for high byte of TTYPut()
-
- TTYtxchar, // low byte is a character to transmit
- TTYtxbaud, // low byte is new baud rate selector
- TTYtxhwfc, // low byte is CTS enable flag
- TTYtxlinc, // low byte is new line control
- TTYtxmdmc, // low byte is new modem control
- TTYtxxofc, // low byte is XON/XOFF enable flag
- };
-
- enum
- {
- // possible low byte values when high byte of TXPut() is TTYtxbaud
-
- TTY300,
- TTY1200,
- TTY2400,
- TTY4800,
- TTY9600,
- TTY19200,
- TTY38400,
- TTY57600,
- TTY115200,
- };
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-