and integer type, and got rid of a bunch of casts (and added a few).
memset(&bc, 0, sizeof(bc));
bc.subdevice = subdev;
bc.size = size;
- ret = comedi_ioctl(it->fd, COMEDI_BUFCONFIG, (unsigned long)&bc);
+ ret = comedi_ioctl(it->fd, COMEDI_BUFCONFIG, &bc);
if(ret < 0) return ret;
return bc.size;
memset(&bc, 0, sizeof(bc));
bc.subdevice = subdev;
bc.maximum_size = max_size;
- ret = comedi_ioctl(it->fd, COMEDI_BUFCONFIG, (unsigned long)&bc);
+ ret = comedi_ioctl(it->fd, COMEDI_BUFCONFIG, &bc);
if(ret < 0) return ret;
return bc.maximum_size;
memset(&bi, 0, sizeof(bi));
bi.subdevice = subdev;
- ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, (unsigned long)&bi);
+ ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, &bi);
if(ret < 0)
{
if(__comedi_errno == EPIPE)__comedi_errno = EBUF_OVR;
memset(&bi, 0, sizeof(bi));
bi.subdevice = subdev;
bi.bytes_read = bytes;
- ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, (unsigned long)&bi);
+ ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, &bi);
if(ret < 0)
{
if(__comedi_errno == EPIPE)__comedi_errno = EBUF_OVR;
memset(&bi, 0, sizeof(bi));
bi.subdevice = subdev;
bi.bytes_written = bytes;
- ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, (unsigned long)&bi);
+ ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, &bi);
if(ret < 0)
{
if(__comedi_errno == EPIPE)__comedi_errno = EBUF_UNDR;
memset(&bi, 0, sizeof(bi));
bi.subdevice = subdev;
- ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, (unsigned long)&bi);
+ ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, &bi);
if(ret < 0) return ret;
return bi.buf_read_ptr;
}
memset(&bi, 0, sizeof(bi));
bi.subdevice = subdev;
- ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, (unsigned long)&bi);
+ ret = comedi_ioctl(it->fd, COMEDI_BUFINFO, &bi);
if(ret < 0) return ret;
return bi.buf_write_count;
}
goto cleanup;
}
- if(comedi_ioctl(it->fd, COMEDI_DEVINFO, (unsigned long)&it->devinfo)<0)
+ if(comedi_ioctl(it->fd, COMEDI_DEVINFO, &it->devinfo) < 0)
goto cleanup;
it->n_subdevices=it->devinfo.n_subdevs;
EXPORT_ALIAS_DEFAULT(_comedi_cancel,comedi_cancel,0.7.18);
int _comedi_cancel(comedi_t *it,unsigned int subdevice)
{
- return comedi_ioctl(it->fd,COMEDI_CANCEL,subdevice);
+ return comedi_ioctl(it->fd, COMEDI_CANCEL, (void*)subdevice);
}
EXPORT_ALIAS_DEFAULT(_comedi_poll,comedi_poll,0.7.18);
int _comedi_poll(comedi_t *it,unsigned int subdevice)
{
- return comedi_ioctl(it->fd,COMEDI_POLL,subdevice);
+ return comedi_ioctl(it->fd, COMEDI_POLL, (void*)subdevice);
}
EXPORT_ALIAS_DEFAULT(_comedi_fileno,comedi_fileno,0.7.18);
if(!it || !t)
return -1;
- return comedi_ioctl(it->fd, COMEDI_TRIG, (unsigned long)t);
+ return comedi_ioctl(it->fd, COMEDI_TRIG, t);
}
EXPORT_ALIAS_DEFAULT(_comedi_command,comedi_command,0.7.18);
int _comedi_command(comedi_t *it,comedi_cmd *t)
{
int ret;
- ret = comedi_ioctl(it->fd, COMEDI_CMD, (unsigned long)t);
+ ret = comedi_ioctl(it->fd, COMEDI_CMD, t);
__comedi_errno = errno;
switch(__comedi_errno){
case EIO:
int _comedi_command_test(comedi_t *it,comedi_cmd *t)
{
int ret;
- ret = comedi_ioctl(it->fd, COMEDI_CMDTEST, (unsigned long)t);
+ ret = comedi_ioctl(it->fd, COMEDI_CMDTEST, t);
__comedi_errno = errno;
switch(__comedi_errno){
case EIO:
int _comedi_do_insnlist(comedi_t *it,comedi_insnlist *il)
{
int ret;
- ret = comedi_ioctl(it->fd, COMEDI_INSNLIST, (unsigned long)il);
+ ret = comedi_ioctl(it->fd, COMEDI_INSNLIST, il);
__comedi_errno = errno;
return ret;
}
int _comedi_do_insn(comedi_t *it,comedi_insn *insn)
{
if(it->has_insn_ioctl){
- return comedi_ioctl(it->fd, COMEDI_INSN, (unsigned long)insn);
+ return comedi_ioctl(it->fd, COMEDI_INSN, insn);
}else{
comedi_insnlist il;
int ret;
il.n_insns = 1;
il.insns = insn;
- ret = comedi_ioctl(it->fd, COMEDI_INSNLIST, (unsigned long)&il);
+ ret = comedi_ioctl(it->fd, COMEDI_INSNLIST, &il);
if(ret<0)return ret;
return insn->n;
EXPORT_ALIAS_DEFAULT(_comedi_lock,comedi_lock,0.7.18);
int _comedi_lock(comedi_t *it,unsigned int subdevice)
{
- return comedi_ioctl(it->fd, COMEDI_LOCK, subdevice);
+ return comedi_ioctl(it->fd, COMEDI_LOCK, (void*)subdevice);
}
EXPORT_ALIAS_DEFAULT(_comedi_unlock,comedi_unlock,0.7.18);
int _comedi_unlock(comedi_t *it,unsigned int subdevice)
{
- return comedi_ioctl(it->fd, COMEDI_UNLOCK, subdevice);
+ return comedi_ioctl(it->fd, COMEDI_UNLOCK, (void*)subdevice);
}
}
cmd.chanlist=&chan;
- return comedi_ioctl(it->fd, COMEDI_TRIG, (unsigned long)&cmd);
+ return comedi_ioctl(it->fd, COMEDI_TRIG, &cmd);
}
}
cmd.data=sdata;
}
- ret = comedi_ioctl(it->fd, COMEDI_TRIG, (unsigned long)&cmd);
+ ret = comedi_ioctl(it->fd, COMEDI_TRIG, &cmd);
if(ret<0)
return ret;
goto cleanup;
}
- ret = comedi_ioctl(it->fd, COMEDI_SUBDINFO, (unsigned long)s);
+ ret = comedi_ioctl(it->fd, COMEDI_SUBDINFO, s);
if(ret < 0)
{
debug_int(ret);
ci.flaglist = r[i].flags_list;
ci.rangelist = r[i].range_type_list;
ci.maxdata_list = r[i].maxdata_list;
- ret = comedi_ioctl(it->fd, COMEDI_CHANINFO, (unsigned long)&ci);
+ ret = comedi_ioctl(it->fd, COMEDI_CHANINFO, &ci);
if(ret < 0){
debug_int(ret);
goto cleanup;
return 0;
cleanup:
-
+
if(s)
free(s);
memset(&ri, 0, sizeof(ri));
ri.range_type = range_type;
ri.range_ptr = kr;
- ret = comedi_ioctl(fd, COMEDI_RANGEINFO, (unsigned long)&ri);
+ ret = comedi_ioctl(fd, COMEDI_RANGEINFO, &ri);
if(ret<0){
fprintf(stderr,"ioctl(%d,COMEDI_RANGEINFO,0x%08x,%p)\n",fd,range_type,kr);
free(r);
it.scan_end_src = TRIG_ANY;
it.stop_src = TRIG_ANY;
- ret = comedi_ioctl(dev->fd, COMEDI_CMDTEST, (unsigned long)&it);
+ ret = comedi_ioctl(dev->fd, COMEDI_CMDTEST, &it);
if(ret<0 && errno==EIO){
return 0;
insn.data = data;
memset(insn.data, 0, insn.n * sizeof(insn.data[0]));
- ret = comedi_ioctl(dev->fd, COMEDI_INSNLIST, (unsigned long)&il);
+ ret = comedi_ioctl(dev->fd, COMEDI_INSNLIST, &il);
if(ret<0){
if(errno!=EIO){
insn.data = data;
memset(insn.data, 0, insn.n * sizeof(insn.data[0]));
- ret = comedi_ioctl(dev->fd, COMEDI_INSN, (unsigned long)&insn);
+ ret = comedi_ioctl(dev->fd, COMEDI_INSN, &insn);
if(ret<0){
if(errno!=EIO){
libc_error();
return -1;
}
- ret = comedi_ioctl(it->fd, COMEDI_SUBDINFO, (unsigned long)s);
+ ret = comedi_ioctl(it->fd, COMEDI_SUBDINFO, s);
if(ret < 0)
{
free(s);
/* ioctl wrappers */
-int _comedi_ioctl( int fd, int request, unsigned long arg )
+int _comedi_ioctl(int fd, int request, void *arg)
{
int ret;
- ret = ioctl( fd, request, arg );
- if( ret < 0 )
+ ret = ioctl(fd, request, arg);
+ if(ret < 0)
libc_error();
return ret;
}
-int _comedi_ioctl_debug(int fd, int request, unsigned long arg)
+int _comedi_ioctl_debug(int fd, int request, void *arg)
{
int ret;
- fprintf(stderr,"ioctl(%d,0x%08x,0x%08lx) = ",fd,request,arg);
- ret = _comedi_ioctl(fd,request,arg);
- fprintf(stderr,"%d\n",ret);
+ fprintf(stderr,"ioctl(%d,0x%08x,%p) = ",fd, request, arg);
+ ret = _comedi_ioctl(fd, request, arg);
+ fprintf(stderr,"%d\n", ret);
return ret;
}
#define comedi_ioctl _comedi_ioctl
//#define comedi_ioctl _comedi_ioctl_debug
-int _comedi_ioctl( int fd, int request, unsigned long arg );
-int _comedi_ioctl_debug(int,int,unsigned long);
+int _comedi_ioctl(int fd, int request, void *arg);
+int _comedi_ioctl_debug(int, int, void*);
/* filler routines */
val=malloc(sizeof(*val)*it->n);
chan=CR_PACK(it->chan,it->range,it->aref);
-
+
t.subdev=it->subdevice;
t.mode=0;
t.flags=TRIG_DITHER;
for(n=0;n<it->n;){
t.data=(void *)(val+n);
t.n=it->n-n;
- i = comedi_ioctl(it->dev->fd, COMEDI_TRIG, (unsigned long)&t);
+ i = comedi_ioctl(it->dev->fd, COMEDI_TRIG, &t);
if(i<=0){
ret=i;
goto out;
val=malloc(sizeof(*val)*it->n);
chan=CR_PACK(it->chan,it->range,it->aref);
-
+
t.subdev=it->subdevice;
t.mode=0;
t.flags=TRIG_DITHER;
for(n=0;n<it->n;){
t.data=val+n;
t.n=it->n-n;
- i = comedi_ioctl(it->dev->fd, COMEDI_TRIG, (unsigned long)&t);
+ i = comedi_ioctl(it->dev->fd, COMEDI_TRIG, &t);
if(i<=0){
ret=i;
goto out;