1: #
2: /*
3: */
4:
5: /*
6: * DN-11 ACU interface
7: */
8:
9: #include "../param.h"
10: #include "../conf.h"
11: #include "../user.h"
12:
13: struct dn {
14: struct {
15: char dn_stat;
16: char dn_reg;
17: } dn11[3];
18: }
19:
20: #define DNADDR 0175200
21:
22: #define PWI 00200
23: #define ACR 00100
24: #define DLO 0020
25: #define DONE 0200
26: #define IENABLE 0100
27: #define DSS 040
28: #define PND 020
29: #define MENABLE 04
30: #define DPR 02
31: #define CRQ 01
32:
33: #define DNPRI 5
34:
35: dnopen(dev, flag)
36: {
37: register struct dn *dp;
38: register int rdev;
39:
40: rdev = dev.d_minor;
41: dp = &DNADDR->dn11[rdev];
42: if (dp->dn_reg&(PWI|DLO))
43: u.u_error = ENXIO;
44: else {
45: DNADDR->dn11[0].dn_stat =| MENABLE;
46: dp->dn_stat = IENABLE|MENABLE|CRQ;
47: }
48: }
49:
50: dnclose(dev)
51: {
52: DNADDR->dn11[dev.d_minor].dn_stat =& MENABLE;
53: }
54:
55: dnwrite(dev)
56: {
57: register struct dn *dp;
58: register c;
59: extern lbolt;
60:
61: dp = &DNADDR->dn11[dev.d_minor];
62: for(;;) {
63: while ((dp->dn_stat&DONE)==0)
64: sleep(DNADDR, DNPRI);
65: dp->dn_stat =& ~DONE;
66: contin:
67: if (dp->dn_reg&(PWI|ACR)) {
68: u.u_error = EIO;
69: return;
70: }
71: if (dp->dn_stat&DSS)
72: return;
73: c = 0;
74: if (u.u_count==0 || (dp->dn_stat&PND)==0 || (c=cpass())<0)
75: continue;
76: if (c=='-') {
77: sleep(&lbolt, DNPRI);
78: sleep(&lbolt, DNPRI);
79: goto contin;
80: }
81: dp->dn_reg = c-'0';
82: dp->dn_stat =| DPR;
83: }
84: }
85:
86: dnint(dev)
87: {
88: wakeup(DNADDR);
89: }
Defined functions
dnint
defined in line
86;
never used
Defined struct's
dn
defined in line
13; used 4 times
Defined macros
ACR
defined in line
23; used 1 times
CRQ
defined in line
31; used 1 times
DLO
defined in line
24; used 1 times
DNPRI
defined in line
33; used 3 times
DONE
defined in line
25; used 2 times
DPR
defined in line
30; used 1 times
DSS
defined in line
27; used 1 times
PND
defined in line
28; used 1 times
PWI
defined in line
22; used 2 times