|
|
1.1 root 1: /* ttyinit.c - ttyinit */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <proc.h>
6: #include <tty.h>
7: #include <io.h>
8: #include <slu.h>
9:
10: /*------------------------------------------------------------------------
11: * ttyinit - initialize buffers and modes for a tty line
12: *------------------------------------------------------------------------
13: */
14: ttyinit(devptr)
15: struct devsw *devptr;
16: {
17: register struct tty *iptr;
18: register struct csr *cptr;
19: int junk, isconsole;
20:
21: /* set up interrupt vector and interrupt dispatch table */
22:
23: iptr = &tty[devptr->dvminor];
24: iosetvec(devptr->dvnum, (int)iptr, (int)iptr);
25:
26: devptr->dvioblk = (char *)iptr; /* fill tty control blk */
27: isconsole = (devptr->dvnum == CONSOLE); /* make console cooked */
28: iptr->ioaddr = (struct csr *)devptr->dvcsr;/* copy in csr addr. */
29: iptr->ihead = iptr->itail = 0; /* empty input queue */
30: iptr->isem = screate(0); /* chars. read so far=0 */
31: iptr->osem = screate(OBUFLEN); /* buffer available=all */
32: iptr->odsend = 0; /* sends delayed so far */
33: iptr->ohead = iptr->otail = 0; /* output queue empty */
34: iptr->ehead = iptr->etail = 0; /* echo queue empty */
35: iptr->imode = (isconsole ? IMCOOKED : IMRAW);
36: iptr->iecho = iptr->evis = isconsole; /* echo console input */
37: iptr->ierase = iptr->ieback = isconsole;/* console honors erase */
38: iptr->ierasec = BACKSP; /* using ^h */
39: iptr->ecrlf = iptr->icrlf = isconsole; /* map RETURN on input */
40: iptr->ocrlf = iptr->oflow = isconsole; /* map RETURN on output */
41: iptr->ieof = iptr->ikill = isconsole; /* set line kill=KILLCH */
42: iptr->iintr = FALSE;
43: iptr->iintrc = INTRCH;
44: iptr->iintpid = BADPID;
45: iptr->ikillc = KILLCH;
46: iptr->ieofc = EOFC;
47: iptr->oheld = FALSE;
48: iptr->ostart = STRTCH;
49: iptr->ostop = STOPCH;
50: iptr->icursor = 0;
51: iptr->ifullc = TFULLC;
52: cptr = (struct csr *)devptr->dvcsr;
53: junk = cptr->crbuf; /* clear receiver and */
54: cptr->crstat = SLUENABLE; /* enable in. interrupts*/
55: cptr->ctstat = SLUDISABLE; /* disable out. " */
56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.