Re: Continuous acquisition latency and buffer overflow

I have a continuous acquisiton application based on
the mmap.c method and found the following useful.

cmd->flags = TRIG_WAKE_EOS;
This causes the result of "comedi_get_buffer_contents"
to update scanwise rather than in virtual memory page
size chunks (something like 4k byte chunks).  A
scanwise callback would be nice but I don't know if it
is possible.

comedi_config /dev/comedi0 driver --read-buffer=4096
Enlarge the read buffer as the default is quite small.
Use any value appropriate for you application.  The
application can sense buffer size with
"comedi_get_buffer_size()".

So long as you conusme the data and "markDataFree" at
a  rate faster than is being acquired, the buffer is
recycled indefinitely.

Mike


--- Eric Keller <eekeller_at_psu.edu> wrote:

> 
> From: Jonathan Wang <jtwang_at_MIT.EDU>
> 
> snip
> 
> >Also, as I will be doing continuous acquisition for
> a long time, I am 
> >worried about the mmap buffer overflowing. I see
> that the demo program 
> >mmap.c in comedilib/demo simply increments pointers
> in its mmap'ed 
> >buffer to read values. However, this seems
> dangerous to me, since 
> >eventually the pointers will increment past 2^32
> and the buffer will 
> >overflow. Could somebody clarify the way this
> works?
> 
> Jonathan,
> I also worried about this, but you see that they
> take the modulo (%) of the
> counter with the buffer length, so that the index
> into the buffer is always
> within the range of the buffer.  It's obviously hard
> to read, but that handles
> the case when your read wraps around much more
> simply that checking the bounds
> of the index.
> 
> As far as your control question, I also want to do
> this.  My program does a lot
> of processing, and I only want to be woken up at the
> end of a scan.  There is
> some mention of a comedi callback, but it appears
> not to be documented except
> possibly in the source.
> Regards,
> Eric Keller
> 
> >Thanks,
> >Jonathan
> 
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
>
https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi
> 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

Received on 2004-10-07Z14:44:19