Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 1997 03:08:34 GMT
From:      mouth@ibm.net (John Kelly)
To:        Bruce Evans <bde@zeta.org.au>
Cc:        hackers@freebsd.org
Subject:   Re: Status of 650 UART support
Message-ID:  <34739fe9.22409@smtp-gw01.ny.us.ibm.net>
In-Reply-To: <199711150553.QAA31140@godzilla.zeta.org.au>
References:  <199711150553.QAA31140@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 15 Nov 1997 16:53:53 +1100, Bruce Evans <bde@zeta.org.au>
wrote:

>> not sure how to calculate the time required for the 8-bit bus cycles.

> Each i/o takes about 1 usec on an 8MHz ISA bus (perhaps
>125 nsec more or less)

I tried some timing tests and measured almost 2 usec for one 8MHz ISA
bus I/O on a 486 DX4-100.

I used the following real-mode Turbo C DOS ISR with a dummy loop to
repeat reading the UART line status register a million times.  The
rest of the program (not shown) is a simple terninal program where I
can type characters which are sent to the modem and echoed back.  The
ISR grabs the incoming echoed characters and puts them in a buffer.

The difference between the start and end time (also not shown)  is
reported outside the ISR.

Only one "inportb(testbase)" line was present during the first timing
run, while the second run had two.  The difference between runs was
1.923 seconds, giving 1.923 usec for a single read from the UART line
status register.

>void interrupt com_int(void) {
>
>	start = clock();
>	testbase = portbase + LSR;
>	for (x = 1000000; x > 0; x--) {
>
>     		inportb(testbase);
>      		inportb(testbase);     /*  ONLY PRESENT DURING SECOND RUN */
>
>		if ((inportb(portbase + IIR) & RX_MASK) == RX_ID) {
>			while (inportb(portbase + LSR) & RCVRDY) {
>        				ccbuf[endbuf++] = inportb(portbase + RXR);
>        				endbuf &= (SBUFSIZ - 1);
>        				if (endbuf == startbuf) {
>        					SError = BUFOVFL;
>        					startbuf++;
>        					startbuf &= (SBUFSIZ - 1);
>        				}
>          			}
>      		}
>	}
>
>	end = clock();
>
>	/* Tell PIC End-Of-Interrupt */
>	outportb(ICR, EOI);
>}





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34739fe9.22409>