|
|
1.1 root 1: /* ttyoin.c - ttyoin */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <tty.h>
6: #include <io.h>
7:
8: #ifdef lsi11
9: # include <slu.h>
10: #else
11: # include <necuart.h>
12: #endif
13:
14: /*------------------------------------------------------------------------
15: * ttyoin -- lower-half tty device driver for output interrupts
16: *------------------------------------------------------------------------
17: */
18: INTPROC ttyoin(ttyp, cptr)
19: struct tty *ttyp;
20: struct csr *cptr;
21: {
22: int ct;
23:
24: #ifdef DEBUG
25: dotrace("ttyoin", &ttyp, 2);
26: #endif
27: if (ttyp->ehead != ttyp->etail) {
28: sluputch(cptr, ttyp->ebuff[ttyp->etail++]);
29: if (ttyp->etail >= EBUFLEN)
30: ttyp->etail = 0;
31: return;
32: }
33: if (ttyp->oheld) { /* honor flow control */
34: slutdisable(cptr, ttyp);
35: return;
36: }
37: if ((ct=scount(ttyp->osem)) < OBUFLEN) {
38: sluputch(cptr, ttyp->obuff[ttyp->otail++]);
39: if (ttyp->otail >= OBUFLEN)
40: ttyp->otail = 0;
41: if (ct > OBMINSP)
42: signal(ttyp->osem);
43: else if ( ++(ttyp->odsend) == OBMINSP) {
44: ttyp->odsend = 0;
45: signaln(ttyp->osem, OBMINSP);
46: }
47: } else
48: slutdisable(cptr, ttyp);
49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.