Re: mmap'd streaming acquisition

On Mon, Aug 05, 2002 at 05:35:33PM +0100, bryan cole wrote:
> Can anyone suggest how to get comedi_get_buffer_offset() working without
> the read() call? I've tried disabling DMA in ni_pcimio.c with no change.
> I've also tried inserting comedi_poll() calls with no effect.

Sorry, there was a bug in demo/mmap.c.  It was looping on the
result of comedi_get_buffer_offset(), which points to the
start of the area that is under control of the application.
Naturally, it doesn't change until the application does something
to change it, e.g., by calling read().  Of course, what you _want_
is the end of the area, which is updated by the driver when there
is more data available.



dave...

Index: mmap.c
===================================================================
RCS file: /var/cvs/comedilib/demo/mmap.c,v
retrieving revision 1.8
diff -u -r1.8 mmap.c
--- mmap.c	16 Apr 2002 20:51:56 -0000	1.8
+++ mmap.c	6 Aug 2002 19:20:46 -0000
_at__at_ -79,9 +79,10 _at__at_
 		exit(1);
 	}
 
+	front = 0;
 	back = 0;
 	while(1){
-		front = comedi_get_buffer_offset(dev,subdevice);
+		front += comedi_get_buffer_contents(dev,subdevice);
 		if(verbose)fprintf(stderr,"front = %d, back = %d\n",front,back);
 		if(front<back)break;
 		if(front==back){

Received on 2002-08-06Z18:25:49