From: David Schleef Date: Fri, 8 Jun 2001 22:33:44 +0000 (+0000) Subject: Added internal trigger support X-Git-Tag: r0_7_60~181 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=810a97f2e2663abe05a4bdc13d58922fe1094947;p=comedi.git Added internal trigger support --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 24e65adb..6662e26e 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -593,6 +593,11 @@ static int do_insnlist_ioctl(comedi_device *dev,void *arg,void *file) { struct timeval tv; + if(insn.n!=2){ + ret=-EINVAL; + goto error; + } + do_gettimeofday(&tv); data[0]=tv.tv_sec; data[1]=tv.tv_usec; @@ -601,14 +606,29 @@ static int do_insnlist_ioctl(comedi_device *dev,void *arg,void *file) break; } case INSN_WAIT: - if(insn.n<1 || data[0]>=100000){ + if(insn.n!=1 || data[0]>=100000){ ret=-EINVAL; break; } udelay(data[0]/1000); ret=1; break; + case INSN_INTTRIG: + if(insn.subdev>=dev->n_subdevices){ + DPRINTK("%d not useable subdevice\n",insn.subdev); + ret=-EINVAL; + goto error; + } + s=dev->subdevices+insn.subdev; + if(!s->async || !s->async->inttrig){ + DPRINTK("no async or no inttrig\n"); + ret=-EINVAL; + goto error; + } + ret = s->async->inttrig(dev,s,0); + break; default: + DPRINTK("invalid insn\n"); ret=-EINVAL; } }else{ diff --git a/include/linux/comedi.h b/include/linux/comedi.h index 95e61700..a5175cfa 100644 --- a/include/linux/comedi.h +++ b/include/linux/comedi.h @@ -97,6 +97,7 @@ typedef unsigned short sampl_t; #define INSN_CONFIG ( 3 | INSN_MASK_READ|INSN_MASK_WRITE) #define INSN_GTOD ( 4 | INSN_MASK_READ|INSN_MASK_SPECIAL) #define INSN_WAIT ( 5 | INSN_MASK_WRITE|INSN_MASK_SPECIAL) +#define INSN_INTTRIG ( 6 | INSN_MASK_WRITE|INSN_MASK_SPECIAL) /* trigger flags */ @@ -126,8 +127,6 @@ typedef unsigned short sampl_t; #define TRIG_EXT 0x00000040 /* trigger on external signal N */ #define TRIG_INT 0x00000080 /* trigger on comedi-internal signal N */ -#define TRIG_INVAL 0x00000100 /* choice was invalid */ - /* subdevice flags */ #define SDF_BUSY 0x0001 /* device is busy */ diff --git a/include/linux/comedidev.h b/include/linux/comedidev.h index dd58094b..cc8aecd8 100644 --- a/include/linux/comedidev.h +++ b/include/linux/comedidev.h @@ -103,6 +103,8 @@ struct comedi_subdevice_struct{ int (*do_lock)(comedi_device *,comedi_subdevice *); int (*do_unlock)(comedi_device *,comedi_subdevice *); + int (*buf_change)(comedi_device *,comedi_subdevice *s); + unsigned int state; }; @@ -130,6 +132,8 @@ struct comedi_async_struct{ unsigned int cb_mask; int (*cb_func)(unsigned int flags,void *); void *cb_arg; + + int (*inttrig)(comedi_device *dev,comedi_subdevice *s,unsigned int x); }; struct comedi_driver_struct{