Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Dec 2008 14:20:31 -0500
From:      Mike Tancsa <mike@sentex.net>
To:        Scott Long <scottl@samsco.org>
Cc:        Marcel Moolenaar <xcllnt@mac.com>, freebsd-current@freebsd.org
Subject:   Re: uart vs sio differences ?
Message-ID:  <200812091920.mB9JKWD1048771@lava.sentex.ca>
In-Reply-To: <493EA759.4000504@samsco.org>
References:  <200812081621.mB8GLMxB041498@lava.sentex.ca> <ED8BC24F-EAC3-4266-AF54-4C6262DDC156@mac.com> <200812081906.mB8J6oha042222@lava.sentex.ca> <CF6E0ACA-CCFA-4A35-A88F-C95484309A78@mac.com> <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>

next in thread | previous in thread | raw e-mail | index | archive | help
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 




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