Remove all the ioctl_ wrappers, because they were dumb.
This commit is contained in:
parent
8f29543c11
commit
619f6afc47
7 changed files with 23 additions and 71 deletions
10
lib/buffer.c
10
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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
16
lib/filler.c
16
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;i<RANGE_LENGTH(range_type);i++){
|
||||
|
|
45
lib/ioctl.c
45
lib/ioctl.c
|
@ -38,49 +38,4 @@
|
|||
|
||||
/* ioctl wrappers */
|
||||
|
||||
int ioctl_devinfo(int fd,comedi_devinfo *it)
|
||||
{
|
||||
return ioctl(fd,COMEDI_DEVINFO,it);
|
||||
}
|
||||
|
||||
int ioctl_subdinfo(int fd,comedi_subdinfo *it)
|
||||
{
|
||||
return ioctl(fd,COMEDI_SUBDINFO,it);
|
||||
}
|
||||
|
||||
int ioctl_chaninfo(int fd,unsigned int subdev,lsampl_t *maxdata_list,unsigned int *flaglist,unsigned int *rangelist)
|
||||
{
|
||||
comedi_chaninfo ci;
|
||||
|
||||
ci.subdev=subdev;
|
||||
ci.flaglist=flaglist;
|
||||
ci.rangelist=rangelist;
|
||||
ci.maxdata_list=maxdata_list;
|
||||
|
||||
return ioctl(fd,COMEDI_CHANINFO,&ci);
|
||||
}
|
||||
|
||||
int ioctl_trigger(int fd,comedi_trig *it)
|
||||
{
|
||||
return ioctl(fd,COMEDI_TRIG,it);
|
||||
}
|
||||
|
||||
int ioctl_rangeinfo(int fd,int range_type,comedi_krange *range_ptr)
|
||||
{
|
||||
comedi_rangeinfo it;
|
||||
|
||||
it.range_type=range_type;
|
||||
it.range_ptr=range_ptr;
|
||||
|
||||
return ioctl(fd,COMEDI_RANGEINFO,&it);
|
||||
}
|
||||
|
||||
int ioctl_bufconfig(int fd, comedi_bufconfig *bc)
|
||||
{
|
||||
return ioctl(fd, COMEDI_BUFCONFIG, bc);
|
||||
}
|
||||
|
||||
int ioctl_bufinfo(int fd, comedi_bufinfo *bi)
|
||||
{
|
||||
return ioctl(fd, COMEDI_BUFINFO, bi);
|
||||
}
|
||||
|
|
|
@ -119,17 +119,6 @@ struct subdevice_struct{
|
|||
|
||||
|
||||
|
||||
/* ioctl wrappers */
|
||||
|
||||
int ioctl_devinfo(int fd,comedi_devinfo *it);
|
||||
int ioctl_subdinfo(int fd,comedi_subdinfo *it);
|
||||
int ioctl_chaninfo(int fd,unsigned int subdev,lsampl_t *maxdata_list,
|
||||
unsigned int *flaglist,unsigned int *rangelist);
|
||||
int ioctl_trigger(int fd,comedi_trig *it);
|
||||
int ioctl_rangeinfo(int fd,int range_type,comedi_krange *range_ptr);
|
||||
int ioctl_bufconfig(int fd, comedi_bufconfig *bc);
|
||||
int ioctl_bufinfo(int fd, comedi_bufinfo *bi);
|
||||
|
||||
/* filler routines */
|
||||
|
||||
int get_subdevices(comedi_t *it);
|
||||
|
|
4
lib/sv.c
4
lib/sv.c
|
@ -107,7 +107,7 @@ int sv_measure_l(comedi_sv_t *it,double *data)
|
|||
for(n=0;n<it->n;){
|
||||
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;n<it->n;){
|
||||
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue