Annotation of 3BSD/sys/dev/dhdm.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     DM-BB driver
                      3:  */
                      4: #include "../h/param.h"
                      5: #include "../h/tty.h"
                      6: #include "../h/conf.h"
                      7: #include "../h/map.h"
                      8: #include "../h/pte.h"
                      9: #include "../h/uba.h"
                     10: 
                     11: #define        DMADDR  ((struct device *)(UBA0_DEV+0170500))
                     12: 
                     13: struct tty dh11[];
                     14: int    ndh11;          /* Set by dh.c to number of lines */
                     15: 
                     16: #define        DONE    0200
                     17: #define        SCENABL 040
                     18: #define        CLSCAN  01000
                     19: #define        TURNON  03      /* CD lead, line enable */
                     20: #define        RQS     04      /* request to send */
                     21: #define        TURNOFF 1       /* line enable only */
                     22: #define        CARRIER 0100
                     23: 
                     24: struct device
                     25: {
                     26:        short   dmcsr;
                     27:        short   dmlstat;
                     28:        short   junk[2];
                     29: };
                     30: 
                     31: /*
                     32:  * Turn on the line associated with the (DH) device dev.
                     33:  */
                     34: dmopen(dev)
                     35: {
                     36:        register struct tty *tp;
                     37:        register struct device *addr;
                     38:        register d;
                     39: 
                     40:        d = minor(dev);
                     41:        tp = &dh11[d];
                     42:        addr = DMADDR;
                     43:        addr += d>>4;
                     44:        spl5();
                     45:        addr->dmcsr = d&017;
                     46:        addr->dmlstat = TURNON;
                     47:        if (addr->dmlstat&CARRIER)
                     48:                tp->t_state |= CARR_ON;
                     49:        addr->dmcsr = IENABLE|SCENABL;
                     50:        while ((tp->t_state&CARR_ON)==0)
                     51:                sleep((caddr_t)&tp->t_rawq, TTIPRI);
                     52:        spl0();
                     53: }
                     54: 
                     55: /*
                     56:  * Dump control bits into the DM registers.
                     57:  */
                     58: dmctl(dev, bits)
                     59: {
                     60:        register struct device *addr;
                     61:        register d, s;
                     62: 
                     63:        d = minor(dev);
                     64:        addr = DMADDR;
                     65:        addr += d>>4;
                     66:        s = spl5();
                     67:        addr->dmcsr = d&017;
                     68:        addr->dmlstat = bits;
                     69:        addr->dmcsr = IENABLE|SCENABL;
                     70:        splx(s);
                     71: }
                     72: 
                     73: /*
                     74:  * DM11 interrupt.
                     75:  * Mainly, deal with carrier transitions.
                     76:  */
                     77: dmint(dev)
                     78: {
                     79:        register struct tty *tp;
                     80:        register struct device *addr;
                     81:        register d;
                     82: 
                     83:        d = minor(dev);
                     84:        addr = DMADDR;
                     85:        addr += d;
                     86:        if (addr->dmcsr&DONE) {
                     87:                tp = &dh11[(d<<4)+(addr->dmcsr&017)];
                     88:                if (tp < &dh11[ndh11]) {
                     89:                        wakeup((caddr_t)&tp->t_rawq);
                     90:                        if ((addr->dmlstat&CARRIER)==0) {
                     91:                                if ((tp->t_state&WOPEN)==0) {
                     92:                                        signal(tp->t_pgrp, SIGHUP);
                     93:                                        addr->dmlstat = 0;
                     94:                                        flushtty(tp);
                     95:                                }
                     96:                                tp->t_state &= ~CARR_ON;
                     97:                        } else
                     98:                                tp->t_state |= CARR_ON;
                     99:                }
                    100:                addr->dmcsr = IENABLE|SCENABL;
                    101:        }
                    102: }
                    103: 
                    104: 
                    105: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.