From 1cd2d95031ccd7cc1dd932be15f30514453f4c21 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 13 Oct 2000 09:21:21 +0000 Subject: [PATCH] dio fixes --- lib/comedi.c | 7 +------ lib/dio.c | 27 +++++++-------------------- lib/filler.c | 4 ++++ 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/lib/comedi.c b/lib/comedi.c index d1553c7..0df6202 100644 --- a/lib/comedi.c +++ b/lib/comedi.c @@ -143,12 +143,7 @@ int comedi_do_insnlist(comedi_t *it,comedi_insnlist *il) int comedi_do_insn(comedi_t *it,comedi_insn *insn) { - comedi_insnlist il; - - il.insns = insn; - il.n_insns = 1; - - return comedi_do_insnlist(it,&il); + return ioctl(it->fd,COMEDI_INSN,insn); } int comedi_lock(comedi_t *it,unsigned int subdevice) diff --git a/lib/dio.c b/lib/dio.c index 924f3b9..ff453dd 100644 --- a/lib/dio.c +++ b/lib/dio.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -53,12 +52,8 @@ int comedi_dio_config(comedi_t *it,unsigned int subdev,unsigned int chan,unsigne #if 0 if(s->has_insn){ comedi_insn insn; - comedi_insnlist il; lsampl_t data; - il.n_insns = 1; - il.insns = &insn; - memset(&insn,0,sizeof(insn)); insn.insn = INSN_CONFIG; insn.n = 1; @@ -67,7 +62,7 @@ int comedi_dio_config(comedi_t *it,unsigned int subdev,unsigned int chan,unsigne insn.chanspec = CR_PACK(chan,0,0); data=io; - return ioctl(it->fd,COMEDI_INSN,&il); + return comedi_do_insn(it,&insn); }else #endif { @@ -82,7 +77,7 @@ int comedi_dio_config(comedi_t *it,unsigned int subdev,unsigned int chan,unsigne trig.chanlist=&chan; trig.data=(sampl_t *)&data; - return ioctl_trigger(it->fd,&trig); + return comedi_trigger(it,&trig); } } @@ -103,12 +98,8 @@ int comedi_dio_read(comedi_t *it,unsigned int subdev,unsigned int chan, if(s->has_insn){ comedi_insn insn; - comedi_insnlist il; lsampl_t data; - il.n_insns = 1; - il.insns = &insn; - memset(&insn,0,sizeof(insn)); insn.insn = INSN_READ; insn.n = 1; @@ -116,7 +107,7 @@ int comedi_dio_read(comedi_t *it,unsigned int subdev,unsigned int chan, insn.subdev = subdev; insn.chanspec = CR_PACK(chan,0,0); - ret = ioctl(it->fd,COMEDI_INSN,&il); + ret = comedi_do_insn(it,&insn); *val = data; @@ -132,7 +123,7 @@ int comedi_dio_read(comedi_t *it,unsigned int subdev,unsigned int chan, trig.chanlist=&chan; trig.data=(sampl_t *)&data; - ret=ioctl_trigger(it->fd,&trig); + ret=comedi_trigger(it,&trig); if(ret>=0 && val)*val=data; @@ -155,12 +146,8 @@ int comedi_dio_write(comedi_t *it,unsigned int subdev,unsigned int chan, if(s->has_insn){ comedi_insn insn; - comedi_insnlist il; lsampl_t data; - il.n_insns = 1; - il.insns = &insn; - memset(&insn,0,sizeof(insn)); insn.insn = INSN_WRITE; insn.n = 1; @@ -170,7 +157,7 @@ int comedi_dio_write(comedi_t *it,unsigned int subdev,unsigned int chan, data = val; - return ioctl(it->fd,COMEDI_INSN,&il); + return comedi_do_insn(it,&insn); }else{ comedi_trig trig; lsampl_t data; @@ -185,7 +172,7 @@ int comedi_dio_write(comedi_t *it,unsigned int subdev,unsigned int chan, trig.chanlist=&chan; trig.data=(sampl_t *)&data; - return ioctl_trigger(it->fd,&trig); + return comedi_trigger(it,&trig); } } @@ -218,7 +205,7 @@ int comedi_dio_bitfield(comedi_t *it,unsigned int subdev,unsigned int mask,unsig data[0]=mask; data[1]=*bits; - ret = ioctl(it->fd,COMEDI_INSN,&insn); + ret = comedi_do_insn(it,&insn); if(ret<0)return ret; diff --git a/lib/filler.c b/lib/filler.c index 20dc2e2..ccb41d9 100644 --- a/lib/filler.c +++ b/lib/filler.c @@ -185,10 +185,12 @@ static int do_test_for_insn(comedi_t *dev,unsigned int subdevice) if(ret<0 && errno==EIO){ return 0; } +#if 0 if(ret<0){ fprintf(stderr,"BUG in do_test_for_insn()\n"); return 0; } +#endif return 1; } @@ -217,10 +219,12 @@ static int do_test_for_insn_bits(comedi_t *dev,unsigned int subdevice) if(ret<0 && (errno==EINVAL || errno==EIO)){ return 0; } +#if 0 if(ret<0){ fprintf(stderr,"BUG in do_test_for_insn_bits()\n"); return 0; } +#endif return 1; } -- 2.26.2