From owner-freebsd-current@FreeBSD.ORG Sat May 15 12:04:32 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 338B216A4CE for ; Sat, 15 May 2004 12:04:32 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 044A443D1F for ; Sat, 15 May 2004 12:04:31 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.11/8.12.11) with ESMTP id i4FJ4LMm058453; Sat, 15 May 2004 12:04:21 -0700 (PDT) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) i4FJ4LVj010144; Sat, 15 May 2004 12:04:21 -0700 (PDT) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.11/8.12.11/Submit) id i4FJ4DHT010143; Sat, 15 May 2004 12:04:13 -0700 (PDT) (envelope-from marcel) Date: Sat, 15 May 2004 12:04:13 -0700 From: Marcel Moolenaar To: Roman Kurakin Message-ID: <20040515190413.GB9900@dhcp01.pn.xcllnt.net> References: <40A26162.9030607@cronyx.ru> <20040512.200542.09569104.imp@bsdimp.com> <20040513155109.GB6572@dhcp01.pn.xcllnt.net> <40A4E2CB.2000007@cronyx.ru> <20040515041301.O22881@gamplex.bde.org> <40A537C8.1010407@cronyx.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40A537C8.1010407@cronyx.ru> User-Agent: Mutt/1.4.2.1i cc: freebsd-current@freebsd.org Subject: Re: Sio & Puc memory mapped X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2004 19:04:32 -0000 On Sat, May 15, 2004 at 01:19:04AM +0400, Roman Kurakin wrote: > > >>May I ask you to make some tests for me? > >> > >>We have a set of tests, which we use for testings of our async > >>adapters. I add support for one of ours cards via puc(4)&uart(4) > >>drivers. These tests works fine with patches for sio(4) driver (was > >>tested with 5.2 sio), but fails with puc(4)&uart(4). > >> > >>I don't have any other cards supported by uart(4), so I can't test > >>it by my self. If you have a time and ability, I'll send these tests > >>for you. > >> > >> > >Why not just use sio? It has been tested for hundreds if not thousands > >of programmer hours in various versions over the last 16 years. uart > >fails even simple tests, and has low performance. > > > I second. Sio works just fine with mem-maped cards after small patch. [detailed feedback has been sent privately to rik@] With the following two changes/fixes to the test program, uart(4) passes all tests: --- asytest.c~ Fri May 14 11:50:10 2004 +++ asytest.c Sat May 15 11:31:03 2004 @@ -152,6 +152,7 @@ } opt = chan[i].old_options; + cfmakeraw (&opt); cfsetspeed (&opt, baud); opt.c_cflag = CREAD | CS8; opt.c_lflag &= ~ICANON; @@ -198,7 +199,7 @@ for (c=chan; cfd > 0) { if (c->ready_to_transmit) { - s = write (c->fd, tbuf+it, IOSZ); + s = write (c->fd, tbuf+it, IOSZ-it); if (s <= 0) { if (s < 0) { if (errno != EAGAIN) The first (the cfmakeraw() insertion) may be related to uart(4) not setting proper defaults, but may also be related to uart(4) setting different *valid* defaults. The second is a genuine test program bug triggered by write() doing partial writes. This bug too may be the result of uart(4) not setting the right defaults, but since the test program doesn't assume complete writes the bug is primarily in the test program by virtue of allowing partial writes. In any way, it's very common for the simple test cases to not test proper behaviour, but to actually test whether the behaviour is the same as for sio(4) or not. I have no doubt that uart(4) has more flaws than I already know about, but the general negativity expressed by bde@ in this case is FUD and in practice the test programs are as much, if not more broken than uart(4) is. FYI, -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net