USG_PG3/usr/source/head/tty.h
/*
* A clist structure is the head
* of a linked list queue of characters.
* The characters are stored in 4-word
* blocks containing a link and 6 characters.
* The routines getc and putc (m45.s or m40.s)
* manipulate these structures.
*/
struct clist
{
int c_cc; /* character count */
int c_cf; /* pointer to first block */
int c_cl; /* pointer to last block */
};
/*
* A tty structure is needed for
* each UNIX character device that
* is used for normal terminal IO.
* The routines in tty.c handle the
* common code associated with
* these structures.
* The definition and device dependent
* code is in each driver. (kl.c dc.c dh.c)
*/
struct tty
{
int t_dev; /* device number */
char t_discp; /* line discipline */
char t_dtype; /* device type (kl dl dc dh) */
int t_pgrp; /* process group name */
int *t_addr; /* device address (register or startup fcn) */
int t_speeds; /* output+input line speed */
int t_flags; /* mode, settable by stty call */
int t_state; /* internal state, not visible externally */
char t_linest; /* line state */
char t_char; /* character temporary */
struct clist t_rawq; /* input chars right off device */
struct clist t_canq; /* input chars after erase and kill */
struct clist t_outq; /* output list to device */
char t_delct; /* number of delimiters in raw q */
char t_col; /* printing column of device */
char t_erase; /* erase character */
char t_kill; /* kill character */
int t_lword; /* extra word reserved for new disciplines */
};
char partab[]; /* ASCII table: parity, character class */
#define TTIPRI 10
#define TTOPRI 20
#define CERASE '#' /* default special characters */
#define CEOT 004
#define CKILL '@'
#define CQUIT 034 /* FS, cntl shift L */
#define CINTR 0177 /* DEL */
#define CXSTOP 01 /* SOH, cntl a */
#define CTOUT 040000 /* timeout character */
#define CPRES 0100000 /* character present (in low order byte) */
/* Character read errors */
#define PERROR 010000 /* parity error */
#define FRERROR 020000 /* framing error */
#define OVERRUN 040000 /* data overrun */
/* limits */
#define TTHIWAT 100
#define TTLOWAT 50
#define TTYHOG 256
/* modes */
#define HUPCL 01
#define XTABS 02
#define LCASE 04
#define ECHO 010
#define CRMOD 020
#define RAW 040
#define ODDP 0100
#define EVENP 0200
#define NLDELAY 001400
#define TBDELAY 006000
#define CRDELAY 030000
#define VTDELAY 040000
#define HDUP 0100000
/* Internal state bits */
#define TIMEOUT 01 /* Delay timeout in progress */
#define WOPEN 02 /* Waiting for open to complete */
#define ISOPEN 04 /* Device is open */
#define SSTART 010 /* Has special start routine at addr */
#define CARR_ON 020 /* Software copy of carrier-present */
#define BUSY 040 /* Output in progress */
#define ASLEEP 0100 /* Wakeup when output done */
#define XCLUDE 0200 /* Exclusive use flag against open */
#define XMTSTOP 0400 /* Output temporarily interrupted */
/* Hardware bits */
#define DONE 0200
/* Modem status bits */
#define SR 01 /* secondary receive */
#define CTS 02 /* clear to send */
#define CARRIER 04 /* main carrier receive */
/* Modem control operations */
#define FSTATUS 0 /* fetch modem status */
#define HUP 01 /* Hangup (turn off data terminal ready) */
#define DISABLE 02 /* hangup and disable modem interrupts */
#define TURNON 03 /* enable + data terminal ready */
/* TURNON operation permits independent setting of RQS and ST as follows */
#define RQS 04 /* request to send ('or' with TURNON) */
#define ST 010 /* secondary transmit ('or' with TURNON) */
/* ioctl commands */
#define GETD 0000 /* get line discipline */
#define CHNGD 0001 /* change line discp. and exec. subcmd */
#define GTTY 0010 /* gtty command */
#define STTY 0011 /* stty command */
#define STTYNF 0012 /* stty without flush */
#define FEK 0013 /* fetch erase and kill characters */
#define SEK 0014 /* set erase and kill characters */
#define XCLD 0015 /* prevent opens on channel */
#define UNSET 0200 /* unset line discipline */
#define SET 0201 /* set line discipline */