From: Frank Mori Hess Date: Thu, 27 Mar 2003 17:02:43 +0000 (+0000) Subject: added comedi_get_buffer_offset() to kcomedilib X-Git-Tag: r0_7_67x~55 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4a776de504184fdbd3e2b1bca8129f2d1f7f50ac;p=comedi.git added comedi_get_buffer_offset() to kcomedilib --- diff --git a/comedi/kcomedilib/get.c b/comedi/kcomedilib/get.c index 5a2aed51..3146b5b2 100644 --- a/comedi/kcomedilib/get.c +++ b/comedi/kcomedilib/get.c @@ -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; +} diff --git a/comedi/kcomedilib/ksyms.c b/comedi/kcomedilib/ksyms.c index 9ce57014..fcbc783e 100644 --- a/comedi/kcomedilib/ksyms.c +++ b/comedi/kcomedilib/ksyms.c @@ -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); diff --git a/include/linux/comedilib.h b/include/linux/comedilib.h index 8cc52e65..7b07eedf 100644 --- a/include/linux/comedilib.h +++ b/include/linux/comedilib.h @@ -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