pcclose(dev, flag) { if (flag==0) { spl4(); while (getc(&pc11.pcin) >= 0); PCADDR->pcrcsr = 0; pc11.pcstate = CLOSED; spl0(); } else pcleader(); }
static void xmtISR(int irq, InterruptContext *icp) { int dev; struct tty *tp; /* set process priority, re-enable interrupts */ spl4(); enableInt(); /* restart transmitter */ dev = irq / 2; tp = &terminal[dev]; ttstart(tp); if ((tp->t_state & ASLEEP) != 0 && tp->t_outq.c_cc <= TTLOWAT) { wakeup((caddr_t) &tp->t_outq); } }
pcread() { register int c; spl4(); do { while ((c = getc(&pc11.pcin)) < 0) { if (pc11.pcstate==EOF) goto out; if ((PCADDR->pcrcsr&(ERROR|BUSY|DONE))==0) PCADDR->pcrcsr =| IENABLE|RDRENB; sleep(&pc11.pcin, PCIPRI); } } while (passc(c)>=0); out: spl0(); }
static void rcvISR(int irq, InterruptContext *icp) { int dev; struct tty *tp; struct device *addr; int c; /* set process priority, re-enable interrupts */ spl4(); enableInt(); /* process received character */ dev = (irq - 1) / 2; tp = &terminal[dev]; addr = (struct device *) tp->t_addr; c = addr->rcvData; if (c == '^') { showProcTable(NULL); return; } ttyinput(c, tp); }
/* * QVSS vertical sync interrupt */ qvvint(int qv) { extern int selwait; register struct qvdevice *qvaddr; struct uba_device *ui; register struct qv_info *qp = qv_scn; int unit; struct tty *tp0; int i; register int j; /* * Mouse state info */ static ushort omouse = 0, nmouse = 0; static char omx=0, omy=0, mx=0, my=0, om_switch=0, m_switch=0; register int dx, dy; /* * Test and set the qv_ipl_lo flag. If the result is not zero then * someone else must have already gotten here. */ if( --qv_ipl_lo ) return; (void)spl4(); ui = qvinfo[qv]; unit = qv<<2; qvaddr = (struct qvdevice *)ui->ui_addr; tp0 = &qv_tty[QVCHAN(unit) + QVMOUSECHAN]; /* * See if the mouse has moved. */ if( omouse != (nmouse = qvaddr->qv_mouse) ) { omouse = nmouse; mx = nmouse & 0xff; my = nmouse >> 8; dy = my - omy; omy = my; dx = mx - omx; omx = mx; if( dy < 50 && dy > -50 && dx < 50 && dx > -50 ) { register vsEvent *vep; if( qp->mscale < 0 ) { /* Ray Lanza's original */ if( dy < 0 ) dy = -( dy * dy ); else dy *= dy; if( dx < 0 ) dx = -( dx * dx ); else dx *= dx; } else { /* Vs100 style, see WGA spec */ int thresh = qp->mthreshold; int scale = qp->mscale; if( abs(dx) > thresh ) { if ( dx < 0 ) dx = (dx + thresh)*scale - thresh; else dx = (dx - thresh)*scale + thresh; } if( abs(dy) > thresh ) { if ( dy < 0 ) dy = (dy + thresh)*scale - thresh; else dy = (dy - thresh)*scale + thresh; } } qp->mouse.x += dx; qp->mouse.y -= dy; if( qp->mouse.x < 0 ) qp->mouse.x = 0; if( qp->mouse.y < 0 ) qp->mouse.y = 0; if( qp->mouse.x > qp->max_cur_x ) qp->mouse.x = qp->max_cur_x; if( qp->mouse.y > qp->max_cur_y ) qp->mouse.y = qp->max_cur_y; if( tp0->t_state & TS_ISOPEN ) qv_pos_cur( qp->mouse.x, qp->mouse.y ); if (qp->mouse.y < qp->mbox.bottom && qp->mouse.y >= qp->mbox.top && qp->mouse.x < qp->mbox.right && qp->mouse.x >= qp->mbox.left) goto switches; qp->mbox.bottom = 0; /* trash box */ if (EVROUND(qp->itail+1) == qp->ihead) goto switches; i = EVROUND(qp->itail - 1); if ((qp->itail != qp->ihead) && (i != qp->ihead)) { vep = & qp->ibuff[i]; if(vep->vse_type == VSE_MMOTION) { vep->vse_x = qp->mouse.x; vep->vse_y = qp->mouse.y; goto switches; } } /* put event into queue and do select */ vep = & qp->ibuff[qp->itail]; vep->vse_type = VSE_MMOTION; vep->vse_time = TOY; vep->vse_x = qp->mouse.x; vep->vse_y = qp->mouse.y; qp->itail = EVROUND(qp->itail+1); } }