libftdi Archives

Subject: Re: How to use async mode

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 3 Feb 2010 18:45:50 +0100
>>>>> "Jim" == Jim Paris <jim@xxxxxxxx> writes:

    Jim> 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.

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

I have tried  with two structs ftdi_transfer_control *tc and two buffers and
when submitting one tc reading the other. But inside libftdi, both submits
initialize a transfer on the same readbuffer, so data got scrambled.

Bye
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

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

Current Thread