Re: DMA and keeping track of reads/writes

On Thu, Aug 01, 2002 at 11:16:33PM -0400, bml wrote:
> I'm using the ni_pcidio driver to collect data with an externally driver
> timer and DMA enabled. I'm using current stable releases of both
> kcomedilib, comedi and the ni driver.
> 
> My question centers around keeping track of how much data is being
> DMA'd.  In non-DMA setups, one can use the buf_user_ptr (or another
> correct, up-to-date variable....) to track the reading and writing of
> data.  I am unsure how to keep track of this with DMA enabled, since
> these read/write pointer variables are no longer used. I'd like to know
> when new data is arrving and when I can overwrite old data (think
> circular buffer with my own rules).

On the application side, everything is the same, regardless of
whether the driver uses DMA or not.  That is, you check the
buffer head position (i.e., the total number of bytes that have
been written to the buffer) using comedi_get_buf_head_pos(), and if
it is greater than what it was last time you checked, there is
more data available.  When you are done with the data, call
comedi_set_user_int_count().

On the driver side, things have been significantly rewritten since
0.7.65 to keep track of read space, write space, and free space in
the buffer.

> Also, is there an easy way to change the buffer size on the hardware
> through kcomedilib?

No.



dave...

Received on 2002-08-06Z18:02:36