1: #
2: /*
3: */
4:
5: /*
6: * KL/DL-11 driver
7: */
8: #include "../param.h"
9: #include "../conf.h"
10: #include "../user.h"
11: #include "../tty.h"
12: #include "../proc.h"
13:
14: /* base address */
15: #define KLADDR 0177560 /* console */
16: #define KLBASE 0176500 /* kl and dl11-a */
17: #define DLBASE 0175610 /* dl-e */
18: #define NKL11 1
19: #define NDL11 0
20: #define DSRDY 02
21: #define RDRENB 01
22:
23: struct tty kl11[NKL11+NDL11];
24:
25: struct klregs {
26: int klrcsr;
27: int klrbuf;
28: int kltcsr;
29: int kltbuf;
30: }
31:
32: klopen(dev, flag)
33: {
34: register char *addr;
35: register struct tty *tp;
36:
37: if(dev.d_minor >= NKL11+NDL11) {
38: u.u_error = ENXIO;
39: return;
40: }
41: tp = &kl11[dev.d_minor];
42: if (u.u_procp->p_ttyp == 0) {
43: u.u_procp->p_ttyp = tp;
44: tp->t_dev = dev;
45: }
46: /*
47: * set up minor 0 to address KLADDR
48: * set up minor 1 thru NKL11-1 to address from KLBASE
49: * set up minor NKL11 on to address from DLBASE
50: */
51: addr = KLADDR + 8*dev.d_minor;
52: if(dev.d_minor)
53: addr =+ KLBASE-KLADDR-8;
54: if(dev.d_minor >= NKL11)
55: addr =+ DLBASE-KLBASE-8*NKL11+8;
56: tp->t_addr = addr;
57: if ((tp->t_state&ISOPEN) == 0) {
58: tp->t_state = ISOPEN|CARR_ON;
59: tp->t_flags = XTABS|LCASE|ECHO|CRMOD;
60: tp->t_erase = CERASE;
61: tp->t_kill = CKILL;
62: }
63: addr->klrcsr =| IENABLE|DSRDY|RDRENB;
64: addr->kltcsr =| IENABLE;
65: }
66:
67: klclose(dev)
68: {
69: register struct tty *tp;
70:
71: tp = &kl11[dev.d_minor];
72: wflushtty(tp);
73: tp->t_state = 0;
74: }
75:
76: klread(dev)
77: {
78: ttread(&kl11[dev.d_minor]);
79: }
80:
81: klwrite(dev)
82: {
83: ttwrite(&kl11[dev.d_minor]);
84: }
85:
86: klxint(dev)
87: {
88: register struct tty *tp;
89:
90: tp = &kl11[dev.d_minor];
91: ttstart(tp);
92: if (tp->t_outq.c_cc == 0 || tp->t_outq.c_cc == TTLOWAT)
93: wakeup(&tp->t_outq);
94: }
95:
96: klrint(dev)
97: {
98: register int c, *addr;
99: register struct tty *tp;
100:
101: tp = &kl11[dev.d_minor];
102: addr = tp->t_addr;
103: c = addr->klrbuf;
104: addr->klrcsr =| RDRENB;
105: if ((c&0177)==0)
106: addr->kltbuf = c; /* hardware botch */
107: ttyinput(c, tp);
108: }
109:
110: klsgtty(dev, v)
111: int *v;
112: {
113: register struct tty *tp;
114:
115: tp = &kl11[dev.d_minor];
116: ttystty(tp, v);
117: }
Defined functions
Defined variables
kl11
defined in line
23; used 7 times
Defined struct's
Defined macros
DSRDY
defined in line
20; used 1 times
NDL11
defined in line
19; used 2 times
NKL11
defined in line
18; used 4 times