From owner-freebsd-current@FreeBSD.ORG Tue Dec 9 19:20:35 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAAEC1065675 for ; Tue, 9 Dec 2008 19:20:35 +0000 (UTC) (envelope-from mike@sentex.net) Received: from smarthost1.sentex.ca (smarthost1.sentex.ca [64.7.153.18]) by mx1.freebsd.org (Postfix) with ESMTP id 966398FC08 for ; Tue, 9 Dec 2008 19:20:35 +0000 (UTC) (envelope-from mike@sentex.net) Received: from lava.sentex.ca (pyroxene.sentex.ca [199.212.134.18]) by smarthost1.sentex.ca (8.14.3/8.14.3) with ESMTP id mB9JKXbh087934; Tue, 9 Dec 2008 14:20:33 -0500 (EST) (envelope-from mike@sentex.net) Received: from mdt-xp.sentex.net (simeon.sentex.ca [192.168.43.27]) by lava.sentex.ca (8.13.8/8.13.3) with ESMTP id mB9JKWD1048771 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Dec 2008 14:20:32 -0500 (EST) (envelope-from mike@sentex.net) Message-Id: <200812091920.mB9JKWD1048771@lava.sentex.ca> X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Tue, 09 Dec 2008 14:20:31 -0500 To: Scott Long From: Mike Tancsa In-Reply-To: <493EA759.4000504@samsco.org> References: <200812081621.mB8GLMxB041498@lava.sentex.ca> <200812081906.mB8J6oha042222@lava.sentex.ca> <200812082049.mB8KnHSN042710@lava.sentex.ca> <84A7F176-5A74-48AC-859A-C0D4C7CBCB48@mac.com> <7.1.0.9.0.20081208173515.13f62e88@sentex.net> <200812091457.mB9EvLSD047534@lava.sentex.ca> <493EA759.4000504@samsco.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Scanned-By: MIMEDefang 2.64 on 64.7.153.18 Cc: Marcel Moolenaar , freebsd-current@freebsd.org Subject: Re: uart vs sio differences ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 09 Dec 2008 19:20:36 -0000 At 12:14 PM 12/9/2008, Scott Long wrote: buffer. I'll see if I can come up with some code for this today. Not >sure if the same can be done for ucom since the USB stack below it >presents a lot more complications and overhead. Hi Scott, It seems to work in the USB case if I reduce the receive and xmit buffers. Do you know if there are any nasty unintended side effects of doing this ? I did the follow simple hack to the driver to get our app to work. --- sys/dev/usb/uftdi.c.orig 2008-12-09 11:47:02.000000000 -0500 +++ sys/dev/usb/uftdi.c 2008-12-09 11:47:05.000000000 -0500 @@ -198,6 +198,7 @@ usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; int i; + unsigned int ivar; usbd_status err; struct ucom_softc *ucom = &sc->sc_ucom; DPRINTFN(10,("\nuftdi_attach: sc=%p\n", sc)); @@ -353,11 +354,27 @@ ucom->sc_portno = FTDI_PIT_SIOA; else ucom->sc_portno = FTDI_PIT_SIOA + id->bInterfaceNumber; - /* bulkin, bulkout set above */ - ucom->sc_ibufsize = UFTDIIBUFSIZE; - ucom->sc_obufsize = UFTDIOBUFSIZE - sc->sc_hdrlen; - ucom->sc_ibufsizepad = UFTDIIBUFSIZE; + /* For certain low speed / timing sensitive applications having the buffers too large causes + data to be stuck in the queue too long. By adding a tuneable, users can lower the buffer + size to what works for their application + */ + + if (!resource_int_value( + "uftdi", device_get_unit(ucom->sc_dev), "buffersize", &ivar) && (ivar > sc->sc_hdrlen && ivar <= UFTDIIBUFSIZE) ) { + ucom->sc_ibufsize = ivar; + ucom->sc_obufsize = ivar - sc->sc_hdrlen; + ucom->sc_ibufsizepad = ivar;; + device_printf(ucom->sc_dev, "Setting buffers to %d\n",ivar); + } + else + { + ucom->sc_ibufsize = UFTDIIBUFSIZE; + ucom->sc_obufsize = UFTDIOBUFSIZE - sc->sc_hdrlen; + ucom->sc_ibufsizepad = UFTDIIBUFSIZE; + device_printf(ucom->sc_dev, "Setting buffers to default of %d\n",UFTDIIBUFSIZE); + + } ucom->sc_opkthdrlen = sc->sc_hdrlen; ---Mike