From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 19 21:39:30 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A21616A407; Thu, 19 Apr 2007 21:39:30 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 1E9FB13C469; Thu, 19 Apr 2007 21:39:30 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id C9B401A4D83; Thu, 19 Apr 2007 14:10:21 -0700 (PDT) Date: Thu, 19 Apr 2007 14:10:21 -0700 From: Alfred Perlstein To: hackers@freebsd.org, bde@freebsd.org Message-ID: <20070419211021.GH69188@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Cc: Subject: serial help ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2007 21:39:30 -0000 I'm working on some custom hardware and I'm getting garbled console output. I noticed that siocntxwait looks like this: static void siocntxwait(iobase) Port_t iobase; { int timo; /* * Wait for any pending transmission to finish. Required to avoid * the UART lockup bug when the speed is changed, and for normal * transmits. */ timo = 100000; while ((inb(iobase + com_lsr) & (LSR_TSRE | LSR_TXRDY)) != (LSR_TSRE | LSR_TXRDY) && --timo != 0) ; } Shouldn't there be some sort of DELAY in there? My platform has an emulated serial device in hardware, so it may be that the loop could run a LOT faster than transmit can happen... any ideas of what the DELAY should be? -- - Alfred Perlstein