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;
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;
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;
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;
}
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;
}
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;
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)
}
cmd.chanlist=&chan;
- return ioctl_trigger(it->fd,&cmd);
+ return ioctl(it->fd, COMEDI_TRIG, &cmd);
}
}
cmd.data=sdata;
}
- ret=ioctl_trigger(it->fd,&cmd);
+ ret = ioctl(it->fd, COMEDI_TRIG, &cmd);
if(ret<0)
return ret;
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,
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){
{
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++){
/* 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);
-}
-/* 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);
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;
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;