int comedi_get_buffer_size(comedi_t *it,unsigned int subdevice);
int comedi_get_max_buffer_size(comedi_t *it,unsigned int subdevice);
-int comedi_set_buffer_size(comedi_t *it,unsigned int subdevice,int len);
+int comedi_set_buffer_size(comedi_t *it,unsigned int subdevice,unsigned int len);
/* triggers and commands */
enum comedi_oor_behavior comedi_set_global_oor_behavior(enum comedi_oor_behavior behavior);
-// changes size (in bytes) of comedi's preallocated buffer, returns size of new buffer
-int comedi_buf_resize(comedi_t *it, unsigned int subdev, unsigned int size);
-// changes maximum size of preallocated buffer, requires root priviledge, returns new max size
-int comedi_buf_resize_max(comedi_t *it, unsigned int subdev, unsigned int max_size);
-// returns size (in bytes) of comedi's preallocated buffer
-int comedi_buf_size(comedi_t *it, unsigned int subdev);
+// changes maximum size (in bytes) of preallocated buffer, requires root priviledge, returns new max size
+int comedi_set_max_buffer_size(comedi_t *it, unsigned int subdev, unsigned int max_size);
// returns number of bytes in buffer waiting to be read by user
-int comedi_buf_contents(comedi_t *it, unsigned int subdev);
+int comedi_get_buffer_contents(comedi_t *it, unsigned int subdev);
// marks 'bytes' number of bytes in buffer as read by user, returns number of bytes left to be read
-int comedi_buf_mark_read(comedi_t *it, unsigned int subdev, unsigned int bytes);
+int comedi_mark_buffer_read(comedi_t *it, unsigned int subdev, unsigned int bytes);
// returns offset in bytes from beginning of buffer for first unread data point in buffer
-int comedi_buf_offset(comedi_t *it, unsigned int subdev);
+int comedi_get_buffer_offset(comedi_t *it, unsigned int subdev);
#ifdef __cplusplus
}
#include <libinternal.h>
-int comedi_buf_resize(comedi_t *it, unsigned int subdev, unsigned int size)
+int comedi_set_buffer_size(comedi_t *it, unsigned int subdev, unsigned int size)
{
int ret;
comedi_bufconfig bc;
return bc.size;
}
-int comedi_buf_resize_max(comedi_t *it, unsigned int subdev, unsigned int max_size)
+int comedi_set_buffer_max_size(comedi_t *it, unsigned int subdev, unsigned int max_size)
{
int ret;
comedi_bufconfig bc;
return bc.maximum_size;
}
-int comedi_buf_size(comedi_t *it, unsigned int subdev)
+int comedi_get_buffer_size(comedi_t *it, unsigned int subdev)
{
- return comedi_buf_resize(it, subdev, 0);
+ return comedi_set_buffer_size(it, subdev, 0);
}
-int comedi_buf_contents(comedi_t *it, unsigned int subdev)
+int comedi_get_buffer_contents(comedi_t *it, unsigned int subdev)
{
- return comedi_buf_mark_read(it, subdev, 0);
+ return comedi_mark_buffer_read(it, subdev, 0);
}
-int comedi_buf_mark_read(comedi_t *it, unsigned int subdev, unsigned int bytes)
+int comedi_mark_buffer_read(comedi_t *it, unsigned int subdev, unsigned int bytes)
{
int ret;
comedi_bufinfo bi;
return bi.buf_int_count - bi.buf_user_count;
}
-int comedi_buf_offset(comedi_t *it, unsigned int subdev)
+int comedi_get_buffer_offset(comedi_t *it, unsigned int subdev)
{
int ret;
comedi_bufinfo bi;
}
-
-int comedi_get_buffer_size(comedi_t *it,unsigned int subd)
-{
- comedi_bufconfig bc;
- int ret;
-
- memset(&bc,0,sizeof(bc));
-
- bc.subdevice = subd;
-
- ret = ioctl(it->fd, COMEDI_BUFCONFIG, &bc);
- if(ret<0)return -1;
-
- return bc.size;
-}
-
-int comedi_get_max_buffer_size(comedi_t *it,unsigned int subd)
-{
- comedi_bufconfig bc;
- int ret;
-
- memset(&bc,0,sizeof(bc));
-
- bc.subdevice = subd;
-
- ret = ioctl(it->fd, COMEDI_BUFCONFIG, &bc);
- if(ret<0)return -1;
-
- return bc.maximum_size;
-}
-
-int comedi_set_buffer_size(comedi_t *it,unsigned int subd,int size)
-{
- comedi_bufconfig bc;
- int ret;
-
- memset(&bc,0,sizeof(bc));
-
- bc.subdevice = subd;
- bc.size = size;
-
- ret = ioctl(it->fd, COMEDI_BUFCONFIG, &bc);
- if(ret<0)return -1;
-
- return bc.size;
-}
-