From owner-freebsd-hackers Wed Nov 19 18:07:56 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id SAA25455 for hackers-outgoing; Wed, 19 Nov 1997 18:07:56 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from out1.ibm.net (out1.ibm.net [165.87.194.252]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id SAA25443 for ; Wed, 19 Nov 1997 18:07:51 -0800 (PST) (envelope-from mouth@ibm.net) Received: from slip129-37-53-101.ca.us.ibm.net (slip129-37-53-101.ca.us.ibm.net [129.37.53.101]) by out1.ibm.net (8.8.5/8.6.9) with SMTP id CAA151046; Thu, 20 Nov 1997 02:07:24 GMT From: mouth@ibm.net (John Kelly) To: Bruce Evans Cc: hackers@freebsd.org Subject: Re: Status of 650 UART support Date: Thu, 20 Nov 1997 03:08:34 GMT Message-ID: <34739fe9.22409@smtp-gw01.ny.us.ibm.net> References: <199711150553.QAA31140@godzilla.zeta.org.au> In-Reply-To: <199711150553.QAA31140@godzilla.zeta.org.au> X-Mailer: Forte Agent 1.01/16.397 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.freebsd.org id SAA25451 Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Sat, 15 Nov 1997 16:53:53 +1100, Bruce Evans 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); >}