added comedi_mark_buffer_read() and comedi_get_buffer_contents() to kcomedilib
authorFrank Mori Hess <fmhess@speakeasy.net>
Thu, 27 Mar 2003 16:54:26 +0000 (16:54 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Thu, 27 Mar 2003 16:54:26 +0000 (16:54 +0000)
comedi/kcomedilib/get.c
comedi/kcomedilib/ksyms.c
include/linux/comedilib.h

index e38a6983c80ddf848926b5be73f943f718d7bc7a..5a2aed512a0053474ee1972101f802fa020668f8 100644 (file)
@@ -181,6 +181,19 @@ unsigned int comedi_get_buf_head_pos(comedi_t *d,unsigned int subdevice)
        return async->buf_write_count;
 }
 
+int comedi_get_buffer_contents( 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_write_count - async->buf_read_count;
+}
+
 /*
  * ALPHA
 */
@@ -201,6 +214,23 @@ int comedi_set_user_int_count(comedi_t *d,unsigned int subdevice,unsigned int bu
        return 0;
 }
 
+int comedi_mark_buffer_read( comedi_t *d, unsigned int subdevice,
+       unsigned int num_bytes )
+{
+       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 -1;
+
+       comedi_buf_read_free( async, num_bytes );
+
+       return 0;
+}
+
+
 int comedi_get_buffer_size(comedi_t *d,unsigned int subdev)
 {
        comedi_device *dev = (comedi_device *)d;
index 59e59cc556fdb33d1251b38c1e5794d251b4a0f5..9ce57014fdac3819aeb22af09f147336eadb546d 100644 (file)
@@ -89,6 +89,7 @@ EXPORT_SYMBOL(comedi_get_n_ranges);
 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);
 
 /* low-level stuff */
 //EXPORT_SYMBOL(comedi_trigger);
@@ -125,6 +126,7 @@ EXPORT_SYMBOL(comedi_command_test);
 EXPORT_SYMBOL(comedi_poll);
 
 /* buffer configuration */
+EXPORT_SYMBOL(comedi_mark_buffer_read);
 
 //EXPORT_SYMBOL(comedi_get_range);
 EXPORT_SYMBOL(comedi_get_len_chanlist);
index 462ce8ced8a0e36f1963e73a52c45ce3f7c02ac4..8cc52e65ba08b6eda548d7c948c238aff12c45c9 100644 (file)
@@ -114,7 +114,10 @@ int comedi_set_user_int_count(comedi_t *dev,unsigned int subdevice,
        unsigned int buf_user_count);
 int comedi_map(comedi_t *dev, unsigned int subdev, void *ptr);
 int comedi_unmap(comedi_t *dev, unsigned int subdev);
-int comedi_get_buffer_size(comedi_t *it,unsigned int subdev);
+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 );