switch (licr & 0x03) { case CL_DMAMODE: reoir = 0x08;
switch (cmr & CL_RXMASK) { case CL_RXDMAINT: { int nbuf; u_short cnt; int bufcomplete; u_char status, dmabsts; u_char risrh = sc->cl_reg->cl_risrh; dmabsts = sc->cl_reg->cl_dmabsts; #ifdef DMA_DEBUG log(LOG_WARNING, "cl_txintr: DMAMODE channel %x dmabsts %x risrl %x risrh %x\n", channel, dmabsts, risrl, risrh); #endif nbuf = (risrh & 0x08) ? 1 : 0; bufcomplete = (risrh & 0x20) ? 1 : 0; if (nbuf == 0) { cnt  = sc->cl_reg->cl_arbcnt; status =  sc->cl_reg->cl_arbsts; } else { cnt  = sc->cl_reg->cl_brbcnt; status =  sc->cl_reg->cl_brbsts; } #ifdef DMA_DEBUG log(LOG_WARNING, "cl_rxintr: 1channel %x buf %x cnt %x status %x\n", channel, nbuf, cnt, status); #endif #if USE_BUFFER cl_appendbufn(sc, channel, sc->rx[nbuf], cnt); #else { int i; u_char *pbuf; tp = sc->sc_cl[channel].tty; pbuf = sc->sc_cl[channel].rx[nbuf];  { u_short rcbadru, rcbadrl; u_char arbsts, brbsts; u_char *pbufs, *pbufe; rcbadru = sc->cl_reg->cl_rcbadru; rcbadrl = sc->cl_reg->cl_rcbadrl; arbsts =  sc->cl_reg->cl_arbsts; brbsts =  sc->cl_reg->cl_brbsts; pbufs = sc->sc_cl[channel].rxp[nbuf]; pbufe = (u_char *)(((u_long)rcbadru << 16) | (u_long)rcbadrl); cnt = pbufe - pbufs; #ifdef DMA_DEBUG log(LOG_WARNING, "cl_rxintr: rcbadru %x rcbadrl %x arbsts %x brbsts %x cnt %x\n", rcbadru, rcbadrl, arbsts, brbsts, cnt); #endif #ifdef DMA_DEBUG1 log(LOG_WARNING, "cl_rxintr: buf %x cnt %x\n", nbuf, cnt); #endif } reoir = 0x0 | (bufcomplete) ? 0 : 0xd0; sc->cl_reg->cl_reoir = reoir; #ifdef DMA_DEBUG log(LOG_WARNING, "cl_rxintr: reoir %x\n", reoir); #endif delay(10);  #ifdef DMA_DEBUG log(LOG_WARNING, "cl_rxintr: 2channel %x buf %x cnt %x status %x\n", channel, nbuf, cnt, status); #endif for (i = 0; i < cnt; i++) { u_char c; c = pbuf[i]; (*linesw[tp->t_line].l_rint)(c,tp); }  if (nbuf == 0) { sc->cl_reg->cl_arbcnt = CL_BUFSIZE; sc->cl_reg->cl_arbsts = 0x01; } else { sc->cl_reg->cl_brbcnt = CL_BUFSIZE; sc->cl_reg->cl_brbsts = 0x01; } } #endif } sc->cl_reg->cl_reoir = reoir;
cl_rxintr(sc)	struct clsoftc *sc;{	u_char rir, channel, licr, risrl;	u_char c;	u_char fifocnt;	struct tty *tp;	int i;	u_char reoir;		rir = sc->cl_reg->cl_rir;	if((rir & 0x40) == 0x0) {		/* only if intr is not shared ??? */		printf ("cl_rxintr extra intr\n");		return 0;	}	sc->sc_rxintrcnt.ev_count++;	channel = rir & 0x3;	licr = sc->cl_reg->cl_licr;	reoir = 0x08;	sc->sc_cl[channel].rxcnt ++;	switch (licr & 0x03) {	case CL_DMAMODE:		reoir = 0x08;		break;	case CL_INTRMODE:		risrl = sc->cl_reg->cl_risrl;		if (risrl & 0x80) {			/* timeout, no characters */			reoir = 0x08;		} else		/* We don't need no sinkin special characters */		if (risrl & 0x08) {			cl_overflow (sc, channel, &sc->sc_fotime, "fifo");			reoir = 0x08;		} else		if (risrl & 0x04) {			cl_parity(sc, channel);			reoir = 0x08;		} else		if (risrl & 0x02) {			cl_frame(sc, channel);			reoir = 0x08;		} else		if (risrl & 0x01) {			cl_break(sc, channel);			reoir = 0x08;		} else {			fifocnt = sc->cl_reg->cl_rfoc;			tp = sc->sc_cl[channel].tty;			for (i = 0; i < fifocnt; i++) {				c = sc->cl_reg->cl_rdr;#if USE_BUFFER				cl_appendbuf(sc, channel, c);#else				/* does any restricitions exist on spl				 * for this call				 */				(*linesw[tp->t_line].l_rint)(c,tp);				reoir = 0x00;#endif			}		}		break;	default:		printf("cl_rxintr unknown mode %x\n",licr & 0x03);		/* we probably will go to hell quickly now */		reoir = 0x08;	}	sc->cl_reg->cl_reoir = reoir;	return 1;}