added comedi_get_buffer_offset() to kcomedilib
authorFrank Mori Hess <fmhess@speakeasy.net>
Thu, 27 Mar 2003 17:02:43 +0000 (17:02 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Thu, 27 Mar 2003 17:02:43 +0000 (17:02 +0000)
comedi/kcomedilib/get.c
comedi/kcomedilib/ksyms.c
include/linux/comedilib.h

index 5a2aed512a0053474ee1972101f802fa020668f8..3146b5b28de938ff969a80a50652e463e9d6d960 100644 (file)
@@ -187,7 +187,7 @@ int comedi_get_buffer_contents( comedi_t *d, unsigned int subdevice )
        comedi_subdevice *s = dev->subdevices + subdevice;
        comedi_async *async;
 
-       if( subdevice > dev->n_subdevices ) return -1;
+       if( subdevice >= dev->n_subdevices ) return -1;
        async = s->async;
        if(async == NULL) return 0;
 
@@ -221,7 +221,7 @@ int comedi_mark_buffer_read( comedi_t *d, unsigned int subdevice,
        comedi_subdevice *s = dev->subdevices + subdevice;
        comedi_async *async;
 
-       if( subdevice > dev->n_subdevices ) return -1;
+       if( subdevice >= dev->n_subdevices ) return -1;
        async = s->async;
        if( async == NULL ) return -1;
 
@@ -244,3 +244,15 @@ int comedi_get_buffer_size(comedi_t *d,unsigned int subdev)
        return async->prealloc_bufsz;
 }
 
+int comedi_get_buffer_offset( comedi_t *d, unsigned int subdevice)
+{
+       comedi_device *dev = (comedi_device *)d;
+       comedi_subdevice *s = dev->subdevices + subdevice;
+       comedi_async *async;
+
+       if( subdevice >= dev->n_subdevices ) return -1;
+       async = s->async;
+       if(async == NULL) return 0;
+
+       return async->buf_read_ptr;
+}
index 9ce57014fdac3819aeb22af09f147336eadb546d..fcbc783e560ccec7160625a6605c28d8b5b33f90 100644 (file)
@@ -90,6 +90,7 @@ EXPORT_SYMBOL(comedi_get_buffer_size);
 //EXPORT_SYMBOL(comedi_get_max_buffer_size);
 //EXPORT_SYMBOL(comedi_set_buffer_size);
 EXPORT_SYMBOL(comedi_get_buffer_contents);
+EXPORT_SYMBOL(comedi_get_buffer_offset);
 
 /* low-level stuff */
 //EXPORT_SYMBOL(comedi_trigger);
index 8cc52e65ba08b6eda548d7c948c238aff12c45c9..7b07eedf58c45f4dfa8111d987ace58114919e34 100644 (file)
@@ -118,7 +118,7 @@ int comedi_get_buffer_size(comedi_t *dev,unsigned int subdev);
 int comedi_mark_buffer_read( comedi_t *dev, unsigned int subdevice,
        unsigned int num_bytes );
 int comedi_get_buffer_contents( comedi_t *dev, unsigned int subdevice );
-
+int comedi_get_buffer_offset( comedi_t *dev, unsigned int subdevice );
 
 
 #else