libftdi Archives

Subject: Re: background read

From: "Anton A. Litvinov" <mirteney@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 9 Jul 2010 18:29:27 +0600
2010/7/6 Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>:
>>>>>> "Anton" == Anton A Litvinov <mirteney@xxxxxxxxx> writes:
>
> ...
>    Anton> Thought the number 8 seems "magic" for me.  For example changing
>    Anton> it to 12 leads to rare callback invocation and to floating point
>    Anton> exception
>

I realized that
my program is crashing only if ftdi_write_data overlaps with ftdi_readstream
working at the background.

>    Anton> Core was generated by `./test3'.  Program terminated with signal
>    Anton> 8, Arithmetic exception.  [New process 7272] #0
>    Anton> 0x00007f8977a14c0a in ftdi_readstream_cb (transfer=0x19da9c0) at
>    Anton> /home/anton/src/libftdi-1.0-HEAD-b013bcb/src/ftdi_stream.c:75 75
>    Anton> int numPackets = (length + packet_size - 1) / packet_size;
>
> Can you give more background, like what OS, what libusb-1 version etc.
>

Linux desktop 2.6.34-5-generic #14~lucid1-Ubuntu SMP Thu Jun 3
14:51:20 UTC 2010 x86_64 GNU/Linux
libftdi-1.0-HEAD-b013bcb (25 june 16:45)

> On a first rough test serveral runs with "12" on my hardware (FT2232H in
> sync fifo mode, libusb-1_0-0-1.0.6-17.1.x86_64, linux) didn't result in a
> crash.
>
> Perhaps run in gdb and when you hit the error type "p length<CR>p
> packet_size <CR>" and give us the returned numbers.
>

Core was generated by `./test'.
Program terminated with signal 8, Arithmetic exception.
[New process 5564]
#0  0x00007fb09ccadc0a in ftdi_readstream_cb (transfer=0x790e30) at
/home/anton/src/libftdi-1.0-HEAD-b013bcb/src/ftdi_stream.c:75
75             int numPackets = (length + packet_size - 1) / packet_size;
(gdb) info locals
i = 7886048
length = 448
ptr = (uint8_t *) 0x790ea0 "1`!`�\236\b"
numPackets = 0
res = 0
state = (FTDIStreamState *) 0x7fb09bef6020
packet_size = 0



> The numbers where taken from the original fastftdi code.
>
> 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
>
>



-- 
With best regards.
Anton

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

Current Thread