libftdi Archives

Subject: Re: How to use async mode

From: Jie Zhang <jie.zhang@xxxxxxxxxx>
To: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 4 Feb 2010 01:26:45 +0800
Hi Uwe,

On 02/04/2010 12:48 AM, Uwe Bonnes wrote:
Hello,

with my FT2232H test setup, libftdi-1/libusb-1 with asyn mode enabled and
following code snipplet (after setting up everything):

       struct ftdi_transfer_control *tc;
       int size = (1<<(CHUNKEXP));
       unsigned char buf[size];
       int actual_length;
       int res;
       if(do_async)
         {
           tc  = ftdi_read_data_submit(&ftdic,
                                         buf,
                                         size);
           res = ftdi_transfer_data_done (tc);
        }
       else
         {
           res = ftdi_read_data(&ftdic, buf, size);
         }
         if (res>0)
         /*do something with the data */

I don't see any consistant difference between both modes. Reading tops out
at 22 MByte/sec if no further processing is done. Writing out the data gets
me down to 18 MByte/sec

Probably I use the async mode in some wrong way. Any usage hints welcome!

ftdi_read_data = ftdi_read_data_submit + ftdi_transfer_data_done.

So actually the same code is executed whether do_async is true or not. Generally async mode is used to submit data transfer requests without need to wait for their completion until you really need the data read back.

I did those work about half a year ago and then switched to other tasks. So I need to refresh my memory before answer your question. I will also try to review and test your patches for libftdi-1 in this week I hope.


Jie

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
Current Thread