libftdi Archives

Subject: Re: How to use async mode

From: Jim Paris <jim@xxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 3 Feb 2010 11:54:53 -0500
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.

I don't think submitting an async request and immediately waiting for
it to finish will speed things up over ftdi_read_data.  The benefit is
that you can do other things while it's receiving.
(Can you submit more read requests while you wait?)

-jim

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

Current Thread