/* called from uartkick() with uart->tlock ilocked */ static void axpkick(Uart* uart) { Cc *cc; Ccb *ccb; uchar *ep, *mem, *rp, *wp, *bp; if(uart->cts == 0 || uart->blocked) return; cc = uart->regs; ccb = cc->ccb; mem = (uchar*)cc->ctlr->gcb; bp = mem + ccb->obsa; rp = mem + ccb->obrp; wp = mem + ccb->obwp; ep = mem + ccb->obea; while(wp != rp-1 && (rp != bp || wp != ep)){ /* * if we've exhausted the uart's output buffer, * ask for more from the output queue, and quit if there * isn't any. */ if(uart->op >= uart->oe && uartstageoutput(uart) == 0) break; *wp++ = *(uart->op++); if(wp > ep) wp = bp; ccb->obwp = wp - mem; } }
static void i8250kick(Uart* uart) { int i; Ctlr *ctlr; if(/* uart->cts == 0 || */ uart->blocked) return; if(!normalprint) { /* early */ if (uart->op < uart->oe) emptyoutstage(uart, uart->oe - uart->op); while ((i = uartstageoutput(uart)) > 0) emptyoutstage(uart, i); return; } /* nothing more to send? then disable xmit intr */ ctlr = uart->regs; if (uart->op >= uart->oe && qlen(uart->oq) == 0 && csr8r(ctlr, Lsr) & Temt) { ctlr->sticky[Ier] &= ~Ethre; csr8w(ctlr, Ier, 0); return; } /* * 128 here is an arbitrary limit to make sure * we don't stay in this loop too long. If the * chip's output queue is longer than 128, too * bad -- presotto */ for(i = 0; i < 128; i++){ if(!(csr8r(ctlr, Lsr) & Thre)) break; if(uart->op >= uart->oe && uartstageoutput(uart) == 0) break; csr8o(ctlr, Thr, *uart->op++); /* start tx */ ctlr->sticky[Ier] |= Ethre; csr8w(ctlr, Ier, 0); /* intr when done */ } }
static void oxkick(Uart *uart) { Port *port; if(uart->cts == 0 || uart->blocked) return; port = uart->regs; for(;;){ if(!(port->mem[Lsr] & 1<<5)) /* THR Empty */ break; if(uart->op >= uart->oe && uartstageoutput(uart) == 0) break; port->mem[Thr] = *(uart->op++); } }
static void ks8695_kick(Uart* uart) { int i; Ctlr *ctlr; if(uart->cts == 0 || uart->blocked) return; ctlr = uart->regs; for(i = 0; i < 16; i++){ if(!(csr8r(ctlr, Lsr) & Thre)) break; if(uart->op >= uart->oe && uartstageoutput(uart) == 0) break; csr8w(ctlr, Thr, *uart->op++); } }
static void kick(Uart *uart) { u32int *ap; ap = (u32int*)uart->regs; if(uart->blocked) return; coherence(); while(ap[MuLsr] & TxRdy){ if(uart->op >= uart->oe && uartstageoutput(uart) == 0) break; ap[MuIo] = *(uart->op++); } if(ap[MuLsr] & TxDone) ap[MuIer] &= ~TxIen; else ap[MuIer] |= TxIen; coherence(); }
static void i8250kick(Uart* uart) { int i; Ctlr *ctlr; if(uart->cts == 0 || uart->blocked) return; /* * 128 here is an arbitrary limit to make sure * we don't stay in this loop too long. If the * chip's output queue is longer than 128, too * bad -- presotto */ ctlr = uart->regs; for(i = 0; i < 128; i++){ if(!(csr8r(ctlr, Lsr) & Thre)) break; if(uart->op >= uart->oe && uartstageoutput(uart) == 0) break; outb(ctlr->io+Thr, *(uart->op++)); } }