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
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
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;
}