Continuous acquisition latency and buffer overflow

I have a sensor which I would like to read continuously. As I will be 
doing control depending on the results of this sensor, I would like to 
be able to tune the latency with which acquired samples are passed into 
my program. I'm using a NI PCI-MIO6033E.

Currently I am using mmap to memory-map the acquisition buffer; 
however, the acquired values are passed from the card's buffer into the 
Comedi driver only when the card's buffer reaches some threshold.

Looking through the driver for my card (ni_mio_common.c), I see three 
options for the card to generate interrupts depending on the state of 
its buffer: AIMODE_HALF_FULL, AIMODE_SAMPLE, and AIMODE_SCAN. Is there 
a way for an application to change the way the card transfers samples 
to main memory?

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?

Thanks,
Jonathan

Received on 2004-10-05Z21:24:20