From 3436ff0452d869d88c3236d186ce983e7c3c4ef9 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Tue, 24 Apr 2001 16:37:51 +0000 Subject: [PATCH] removed buffer config functions that I accidentally duplicated, made names of alpha functions follow conventions of older functions --- include/comedilib.h | 16 ++++++--------- lib/buffer.c | 16 +++++++-------- lib/get.c | 47 --------------------------------------------- 3 files changed, 14 insertions(+), 65 deletions(-) diff --git a/include/comedilib.h b/include/comedilib.h index 4eea689..95804c5 100644 --- a/include/comedilib.h +++ b/include/comedilib.h @@ -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 } diff --git a/lib/buffer.c b/lib/buffer.c index ae9e955..8b0e2f9 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -2,7 +2,7 @@ #include -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; diff --git a/lib/get.c b/lib/get.c index e7ea066..73665b8 100644 --- a/lib/get.c +++ b/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; -} - -- 2.26.2