1: #
   2: /*
   3:  */
   4: 
   5: /*
   6:  *	DM-BB driver
   7:  */
   8: #include "../param.h"
   9: #include "../tty.h"
  10: #include "../conf.h"
  11: 
  12: #define DMADDR  0170500
  13: 
  14: struct  tty dh11[];
  15: int ndh11;      /* Set by dh.c to number of lines */
  16: 
  17: #define DONE    0200
  18: #define SCENABL 040
  19: #define CLSCAN  01000
  20: #define TURNON  07  /* RQ send, CD lead, line enable */
  21: #define TURNOFF 1   /* line enable only */
  22: #define CARRIER 0100
  23: 
  24: struct dmregs {
  25:     int dmcsr;
  26:     int dmlstat;
  27: };
  28: 
  29: /*
  30:  * Turn on the line associated with the (DH) device dev.
  31:  */
  32: dmopen(dev)
  33: {
  34:     register struct tty *tp;
  35: 
  36:     tp = &dh11[dev.d_minor];
  37:     DMADDR->dmcsr = dev.d_minor;
  38:     DMADDR->dmlstat = TURNON;
  39:     if (DMADDR->dmlstat&CARRIER)
  40:         tp->t_state =| CARR_ON;
  41:     DMADDR->dmcsr = IENABLE|SCENABL;
  42:     spl5();
  43:     while ((tp->t_state&CARR_ON)==0)
  44:         sleep(&tp->t_rawq, TTIPRI);
  45:     spl0();
  46: }
  47: 
  48: /*
  49:  * If a DH line has the HUPCL mode,
  50:  * turn off carrier when it is closed.
  51:  */
  52: dmclose(dev)
  53: {
  54:     register struct tty *tp;
  55: 
  56:     tp = &dh11[dev.d_minor];
  57:     if (tp->t_flags&HUPCL) {
  58:         DMADDR->dmcsr = dev.d_minor;
  59:         DMADDR->dmlstat = TURNOFF;
  60:         DMADDR->dmcsr = IENABLE|SCENABL;
  61:     }
  62: }
  63: 
  64: /*
  65:  * DM11 interrupt.
  66:  * Mainly, deal with carrier transitions.
  67:  */
  68: dmint()
  69: {
  70:     register struct tty *tp;
  71: 
  72:     if (DMADDR->dmcsr&DONE) {
  73:         tp = &dh11[DMADDR->dmcsr&017];
  74:         if (tp < &dh11[ndh11]) {
  75:             wakeup(tp);
  76:             if ((DMADDR->dmlstat&CARRIER)==0) {
  77:                 if ((tp->t_state&WOPEN)==0) {
  78:                     signal(tp, SIGHUP);
  79:                     DMADDR->dmlstat = 0;
  80:                     flushtty(tp);
  81:                 }
  82:                 tp->t_state =& ~CARR_ON;
  83:             } else
  84:                 tp->t_state =| CARR_ON;
  85:         }
  86:         DMADDR->dmcsr = IENABLE|SCENABL;
  87:     }
  88: }

Defined functions

dmclose defined in line 52; used 2 times
dmint defined in line 68; never used
dmopen defined in line 32; used 1 times

Defined variables

dh11 defined in line 14; used 4 times
ndh11 defined in line 15; used 1 times
  • in line 74

Defined struct's

dmregs defined in line 24; never used

Defined macros

CARRIER defined in line 22; used 2 times
CLSCAN defined in line 19; never used
DMADDR defined in line 12; used 12 times
DONE defined in line 17; used 1 times
  • in line 72
SCENABL defined in line 18; used 3 times
TURNOFF defined in line 21; used 1 times
  • in line 59
TURNON defined in line 20; used 1 times
  • in line 38
Last modified: 1975-07-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 714
Valid CSS Valid XHTML 1.0 Strict