From 619f6afc47870affacf23ec9a61584a92651988e Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 11 May 2002 07:35:31 +0000 Subject: [PATCH] Remove all the ioctl_ wrappers, because they were dumb. --- lib/buffer.c | 10 +++++----- lib/comedi.c | 4 ++-- lib/data.c | 4 ++-- lib/filler.c | 16 ++++++++++++---- lib/ioctl.c | 45 --------------------------------------------- lib/libinternal.h | 11 ----------- lib/sv.c | 4 ++-- 7 files changed, 23 insertions(+), 71 deletions(-) diff --git a/lib/buffer.c b/lib/buffer.c index dee67d1..f7e952c 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -33,7 +33,7 @@ int comedi_set_buffer_size(comedi_t *it, unsigned int subdev, unsigned int size) memset(&bc, 0, sizeof(bc)); bc.subdevice = subdev; bc.size = size; - ret = ioctl_bufconfig(it->fd, &bc); + ret = ioctl(it->fd, COMEDI_BUFCONFIG, &bc); __comedi_errno = errno; if(ret < 0) return ret; @@ -48,7 +48,7 @@ int comedi_set_max_buffer_size(comedi_t *it, unsigned int subdev, unsigned int m memset(&bc, 0, sizeof(bc)); bc.subdevice = subdev; bc.maximum_size = max_size; - ret = ioctl_bufconfig(it->fd, &bc); + ret = ioctl(it->fd, COMEDI_BUFCONFIG, &bc); __comedi_errno = errno; if(ret < 0) return ret; @@ -77,7 +77,7 @@ int comedi_mark_buffer_read(comedi_t *it, unsigned int subdev, unsigned int byte memset(&bi, 0, sizeof(bi)); bi.bytes_read = bytes; - ret = ioctl_bufinfo(it->fd, &bi); + ret = ioctl(it->fd, COMEDI_BUFINFO, &bi); __comedi_errno = errno; if(__comedi_errno == EINVAL)__comedi_errno = EBUF_OVR; return bi.buf_int_count - bi.buf_user_count; @@ -89,7 +89,7 @@ int comedi_get_buffer_offset(comedi_t *it, unsigned int subdev) comedi_bufinfo bi; memset(&bi, 0, sizeof(bi)); - ret = ioctl_bufinfo(it->fd, &bi); + ret = ioctl(it->fd, COMEDI_BUFINFO, &bi); if(ret < 0) return ret; return bi.buf_user_ptr; } @@ -100,7 +100,7 @@ int comedi_get_front_count(comedi_t *it, unsigned int subdev) comedi_bufinfo bi; memset(&bi, 0, sizeof(bi)); - ret = ioctl_bufinfo(it->fd, &bi); + ret = ioctl(it->fd, COMEDI_BUFINFO, &bi); if(ret < 0) return ret; return bi.buf_int_count; } diff --git a/lib/comedi.c b/lib/comedi.c index 853857f..628ee9a 100644 --- a/lib/comedi.c +++ b/lib/comedi.c @@ -65,7 +65,7 @@ comedi_t *comedi_open(const char *fn) goto cleanup; } - if(ioctl_devinfo(it->fd,&it->devinfo)<0) + if(ioctl(it->fd, COMEDI_DEVINFO, &it->devinfo)<0) goto cleanup; it->n_subdevices=it->devinfo.n_subdevs; @@ -145,7 +145,7 @@ int comedi_trigger(comedi_t *it,comedi_trig *t) if(!it || !t) return -1; - return ioctl_trigger(it->fd,t); + return ioctl(it->fd, COMEDI_TRIG, t); } int comedi_command(comedi_t *it,comedi_cmd *t) diff --git a/lib/data.c b/lib/data.c index 72930d1..abae977 100644 --- a/lib/data.c +++ b/lib/data.c @@ -81,7 +81,7 @@ int comedi_data_write(comedi_t *it,unsigned int subdev,unsigned int chan,unsigne } cmd.chanlist=&chan; - return ioctl_trigger(it->fd,&cmd); + return ioctl(it->fd, COMEDI_TRIG, &cmd); } } @@ -134,7 +134,7 @@ static inline int comedi_internal_data_read_n(comedi_t *it, unsigned int subdev, cmd.data=sdata; } - ret=ioctl_trigger(it->fd,&cmd); + ret = ioctl(it->fd, COMEDI_TRIG, &cmd); if(ret<0) return ret; diff --git a/lib/filler.c b/lib/filler.c index 54d31e6..fe64102 100644 --- a/lib/filler.c +++ b/lib/filler.c @@ -49,12 +49,13 @@ int get_subdevices(comedi_t *it) int i,j; int ret; comedi_subdinfo *s; + comedi_chaninfo ci; subdevice *r; s=malloc(sizeof(comedi_subdinfo)*it->n_subdevices); debug_ptr(s); - ret=ioctl_subdinfo(it->fd,s); + ret = ioctl(it->fd, COMEDI_SUBDINFO, s); debug_int(ret); r=it->subdevices=realloc(it->subdevices, @@ -87,7 +88,11 @@ int get_subdevices(comedi_t *it) r[i].range_type_list=malloc(sizeof(*r[i].range_type_list)*r[i].n_chan); debug_ptr(r[i].range_type_list); } - ret=ioctl_chaninfo(it->fd,i,r[i].maxdata_list,r[i].flags_list,r[i].range_type_list); + ci.subdev = i; + ci.flaglist = r[i].flags_list; + ci.rangelist = r[i].range_type_list; + ci.maxdata_list = r[i].maxdata_list; + ret = ioctl(it->fd, COMEDI_CHANINFO, &ci); debug_int(ret); if(r[i].subd_flags&SDF_RANGETYPE){ @@ -117,15 +122,18 @@ comedi_range *get_rangeinfo(int fd,unsigned int range_type) { comedi_krange *kr; comedi_range *r; + comedi_rangeinfo ri; int ret; int i; kr=malloc(sizeof(comedi_krange)*RANGE_LENGTH(range_type)); r=malloc(sizeof(comedi_range)*RANGE_LENGTH(range_type)); - ret=ioctl_rangeinfo(fd,range_type,kr); + ri.range_type = range_type; + ri.range_ptr = kr; + ret = ioctl(fd, COMEDI_RANGEINFO, &ri); if(ret<0){ - fprintf(stderr,"ioctl_rangeinfo(%d,0x%08x,%p)\n",fd,range_type,kr); + fprintf(stderr,"ioctl(%d,COMEDI_RANGEINFO,0x%08x,%p)\n",fd,range_type,kr); } for(i=0;in;){ t.data=(void *)(val+n); t.n=it->n-n; - i=ioctl_trigger(it->dev->fd,&t); + i = ioctl(it->dev->fd, COMEDI_TRIG, &t); if(i<=0){ ret=i; goto out; @@ -160,7 +160,7 @@ int sv_measure_s(comedi_sv_t *it,double *data) for(n=0;nn;){ t.data=val+n; t.n=it->n-n; - i=ioctl_trigger(it->dev->fd,&t); + i = ioctl(it->dev->fd, COMEDI_TRIG, &t); if(i<=0){ ret=i; goto out; -- 2.26.2