9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] devlpt and out of paper
@ 2000-08-13 17:00 Russ Cox
  0 siblings, 0 replies; only message in thread
From: Russ Cox @ 2000-08-13 17:00 UTC (permalink / raw)
  To: 9fans

as a followup to d. brownlee's mail,
we're now using the following in devlpt.c's outch.

	for(tries=0;; tries++) {
		status = inb(base+Qpsr);
		if(status&Fnotbusy)
			break;
		if((status&Fpe)==0 && (status&(Fselect|Fnoerror)) != (Fselect|Fnoerror))
			error(Eio);
		if(tries < 10)
			tsleep(&lptrendez, return0, nil, 1);
		else {
			outb(base+Qpcr, Finitbar|Fie);
			tsleep(&lptrendez, lptready, (void *)base, 100);
		}
	}

it seems to strike a good balance,
avoiding hammering the cpu with polling
and hammering the cpu with interrupts,
but still sending bytes out at a reasonable pace.

russ



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-08-13 17:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-13 17:00 [9fans] devlpt and out of paper Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).