added comedi_mark_buffer_written() (untested)

This commit is contained in:
Frank Mori Hess 2005-01-10 00:46:28 +00:00
parent 22eea6221e
commit 9f6b16e004
5 changed files with 45 additions and 4 deletions

View file

@ -55,7 +55,7 @@ handbook
<holder>David Schleef</holder>
</copyright>
<copyright>
<year>2001-2003</year>
<year>2001-2003, 2005</year>
<holder>Frank Mori Hess</holder>
</copyright>
<copyright>

View file

@ -795,18 +795,38 @@ Description:
are available in the streaming buffer is returned. If there is
an error, -1 is returned.
Function: comedi_mark_buffer_read -- streaming buffer status
Function: comedi_mark_buffer_read -- streaming buffer control
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int num_bytes
Description:
The function comedi_mark_buffer_read() is used on a subdevice
that has a Comedi command in progress. This function can be
that has a Comedi input command in progress. It should only be used
if you are using a mmap() (as opposed
to calling read() on the device file) to read data from Comedi's buffer,
since Comedi will automatically keep track of how many bytes have been
transferred via read() calls. This function is
used to indicate that the next num_bytes bytes in the buffer
are no longer needed and may be discarded.
If there is an error, -1 is returned.
Function: comedi_mark_buffer_written -- streaming buffer control
Retval: int
Param: comedi_t * device
Param: unsigned int subdevice
Param: unsigned int num_bytes
Description:
The function comedi_mark_buffer_written() is used on a subdevice
that has a Comedi output command in progress. It should only be used
if you are using a mmap() (as opposed to calling write() on the device
file) to write data to Comedi's buffer, since Comedi
will automatically keep track of how many bytes have been
transferred via write() calls. This function is
used to indicate that the next num_bytes bytes in the buffer
are valid and may be sent to the device.
If there is an error, -1 is returned.
Function: comedi_get_buffer_offset -- streaming buffer status
Retval: int
Param: comedi_t * device

View file

@ -171,6 +171,8 @@ int comedi_set_max_buffer_size(comedi_t *it, unsigned int subdev,
int comedi_get_buffer_contents(comedi_t *it, unsigned int subdev);
int comedi_mark_buffer_read(comedi_t *it, unsigned int subdev,
unsigned int bytes);
int comedi_mark_buffer_written(comedi_t *it, unsigned int subdev,
unsigned int bytes);
int comedi_get_buffer_offset(comedi_t *it, unsigned int subdev);
#ifdef _COMEDILIB_DEPRECATED

View file

@ -84,7 +84,21 @@ int _comedi_mark_buffer_read(comedi_t *it, unsigned int subdev, unsigned int byt
bi.bytes_read = bytes;
ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, (unsigned long)&bi);
__comedi_errno = errno;
if(__comedi_errno == EINVAL)__comedi_errno = EBUF_OVR;
if(__comedi_errno == EPIPE)__comedi_errno = EBUF_OVR;
return bi.buf_int_count - bi.buf_user_count;
}
EXPORT_ALIAS_DEFAULT(_comedi_mark_buffer_written,comedi_mark_buffer_written,0.7.23);
int _comedi_mark_buffer_written(comedi_t *it, unsigned int subdev, unsigned int bytes)
{
int ret;
comedi_bufinfo bi;
memset(&bi, 0, sizeof(bi));
bi.bytes_written = bytes;
ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, (unsigned long)&bi);
__comedi_errno = errno;
if(__comedi_errno == EPIPE)__comedi_errno = EBUF_UNDR;
return bi.buf_int_count - bi.buf_user_count;
}

View file

@ -80,3 +80,8 @@ v0.7.20 {
comedi_parse_calibration_file;
} v0.7.19;
v0.7.23 {
global:
comedi_mark_buffer_written;
} v0.7.20;