Re: uart vs sio differences ?

From: Mike Tancsa <mike_at_sentex.net>
Date: Tue, 09 Dec 2008 14:20:31 -0500
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
_at__at_ -198,6 +198,7 _at__at_
         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));
_at__at_ -353,11 +354,27 _at__at_
                 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 
Received on Tue Dec 09 2008 - 18:20:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:38 UTC