removed buffer config functions that I accidentally duplicated, made names of alpha functions follow conventions of older functions
This commit is contained in:
parent
09acff74e9
commit
3436ff0452
3 changed files with 14 additions and 65 deletions
|
@ -90,7 +90,7 @@ int comedi_maxdata_is_chan_specific(comedi_t *it,unsigned int subdevice);
|
|||
|
||||
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 */
|
||||
|
||||
|
@ -150,18 +150,14 @@ enum comedi_oor_behavior {
|
|||
|
||||
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
|
||||
}
|
||||
|
|
16
lib/buffer.c
16
lib/buffer.c
|
@ -2,7 +2,7 @@
|
|||
|
||||
#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;
|
||||
|
@ -16,7 +16,7 @@ int comedi_buf_resize(comedi_t *it, unsigned int subdev, unsigned int size)
|
|||
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;
|
||||
|
@ -30,17 +30,17 @@ int comedi_buf_resize_max(comedi_t *it, unsigned int subdev, unsigned int max_si
|
|||
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;
|
||||
|
@ -52,7 +52,7 @@ int comedi_buf_mark_read(comedi_t *it, unsigned int subdev, unsigned int bytes)
|
|||
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;
|
||||
|
|
47
lib/get.c
47
lib/get.c
|
@ -149,50 +149,3 @@ comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int
|
|||
}
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue