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

dnclose defined in line 50; never used
dnint defined in line 86; never used
dnopen defined in line 35; never used
dnwrite defined in line 55; never used

Defined struct's

dn defined in line 13; used 4 times
  • in line 37(2), 57(2)

Defined macros

ACR defined in line 23; used 1 times
  • in line 67
CRQ defined in line 31; used 1 times
  • in line 46
DLO defined in line 24; used 1 times
  • in line 42
DNADDR defined in line 20; used 6 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
  • in line 82
DSS defined in line 27; used 1 times
  • in line 71
IENABLE defined in line 26; used 1 times
  • in line 46
MENABLE defined in line 29; used 3 times
PND defined in line 28; used 1 times
  • in line 74
PWI defined in line 22; used 2 times
Last modified: 1975-07-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1051
Valid CSS Valid XHTML 1.0 Strict