From 45b2f0af3156f7075fcbccbb4b317a2bcaa065c9 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Mon, 18 Apr 2005 01:21:09 +0000 Subject: [PATCH] added comedi_mark_buffer_written() to kcomedilib --- comedi/kcomedilib/get.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/comedi/kcomedilib/get.c b/comedi/kcomedilib/get.c index 1f79ca50..0d7c45d8 100644 --- a/comedi/kcomedilib/get.c +++ b/comedi/kcomedilib/get.c @@ -232,6 +232,24 @@ int comedi_mark_buffer_read( comedi_t *d, unsigned int subdevice, return 0; } +int comedi_mark_buffer_written( 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; + int bytes_written; + + if( subdevice >= dev->n_subdevices ) return -1; + async = s->async; + if( async == NULL ) return -1; + bytes_written = comedi_buf_write_alloc(async, num_bytes); + comedi_buf_munge(dev, s, async->buf_write_alloc_count - async->munge_count); + comedi_buf_write_free(async, bytes_written); + if(bytes_written != num_bytes) return -1; + return 0; +} + int comedi_get_buffer_size(comedi_t *d,unsigned int subdev) { -- 2.26.2