Re: Cmd/mmap with realtime

On Thu, 7 Nov 2002, Frank Mori Hess wrote:

> Maybe your problems aren't hardware related though.  Are you just seeing a 
> problem when you reach the end of comedi's buffer?  Maybe you are just trying 
> to do mmap access and not marking any of your data as read, so comedi thinks 
> you have lost data? 

BTW. There should be an option to avoid the obligation to mark the data as
read. Even ALSA has it - it is equivalent to setting the number of unread
samples which are allowed to be in the buffer to be greater than the
buffer size.

I am working with rt tasks which sometimes may be active, sometimes
sleeping. I do not want to stop DAQ and loose time calibration (I need AO
even while I do not measure AI) just becase I do not need the data for
some time. Also when there are two or three threads reading data which of
them should mark the data as read?

I believe that when using circular buffer the handling of "read
pointer" is part of the application (or the library for the convinience),
not the driver. I can easily check for overruns by looking at the time and
current buffer pointer (getting the current pointer precisely and fast is
important for me - if not supported by the HW I have a method of
overwriting the data I have read with a "magick" values and then
periodically testing where the new data have appeared in the buffer). 

Additional reason for NOT using a function which marks the data as
read: it adds vulneralibility to future API changes. What is not used can
not get broken ;-)

Best regards and thank for all hard work all of you have put into
Comedi. I am complaining just because I want it better.

--
Tomek

Received on 2002-11-09Z10:30:49