From 09e00cc01e4202fb6126cd19d149ab2e7b90f54e Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Thu, 27 Mar 2003 16:54:26 +0000 Subject: [PATCH] added comedi_mark_buffer_read() and comedi_get_buffer_contents() to kcomedilib --- comedi/kcomedilib/get.c | 30 ++++++++++++++++++++++++++++++ comedi/kcomedilib/ksyms.c | 2 ++ include/linux/comedilib.h | 5 ++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/comedi/kcomedilib/get.c b/comedi/kcomedilib/get.c index e38a6983..5a2aed51 100644 --- a/comedi/kcomedilib/get.c +++ b/comedi/kcomedilib/get.c @@ -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; diff --git a/comedi/kcomedilib/ksyms.c b/comedi/kcomedilib/ksyms.c index 59e59cc5..9ce57014 100644 --- a/comedi/kcomedilib/ksyms.c +++ b/comedi/kcomedilib/ksyms.c @@ -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); diff --git a/include/linux/comedilib.h b/include/linux/comedilib.h index 462ce8ce..8cc52e65 100644 --- a/include/linux/comedilib.h +++ b/include/linux/comedilib.h @@ -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 ); -- 2.26.2