From: Frank Mori Hess Date: Fri, 23 Nov 2001 03:03:56 +0000 (+0000) Subject: removed more old trig stuff X-Git-Tag: r0_7_62~91 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=62d7af7914e74c2ab049889cb857dde61b0568fa;p=comedi.git removed more old trig stuff --- diff --git a/comedi/kcomedilib/data.c b/comedi/kcomedilib/data.c index bb70b53d..3e96bdbf 100644 --- a/comedi/kcomedilib/data.c +++ b/comedi/kcomedilib/data.c @@ -37,16 +37,13 @@ #include #include -#define USE_INSN - extern volatile int rtcomedi_lock_semaphore; int comedi_data_write(unsigned int dev,unsigned int subdev,unsigned int chan, unsigned int range,unsigned int aref,lsampl_t data) { -#ifdef USE_INSN comedi_insn insn; - + memset(&insn,0,sizeof(insn)); insn.insn = INSN_WRITE; insn.n = 1; @@ -55,33 +52,13 @@ int comedi_data_write(unsigned int dev,unsigned int subdev,unsigned int chan, insn.chanspec = CR_PACK(chan,range,aref); return comedi_do_insn(dev,&insn); -#else - comedi_trig cmd; - sampl_t sdata = data; - - memset(&cmd,0,sizeof(cmd)); - - cmd.flags = TRIG_WRITE; - cmd.n_chan = 1; - cmd.n = 1; - - chan = CR_PACK(chan,range,aref); - cmd.subdev = subdev; - cmd.data = &sdata; - cmd.data_len = sizeof(sampl_t); - - cmd.chanlist = &chan; - - return comedi_trigger(dev,subdev,&cmd); -#endif } int comedi_data_read(unsigned int dev,unsigned int subdev,unsigned int chan, unsigned int range,unsigned int aref,lsampl_t *data) { -#ifdef USE_INSN comedi_insn insn; - + memset(&insn,0,sizeof(insn)); insn.insn = INSN_READ; insn.n = 1; @@ -90,28 +67,5 @@ int comedi_data_read(unsigned int dev,unsigned int subdev,unsigned int chan, insn.chanspec = CR_PACK(chan,range,aref); return comedi_do_insn(dev,&insn); -#else - comedi_trig cmd; - int ret; - sampl_t sdata; - - memset(&cmd,0,sizeof(cmd)); - - cmd.n_chan = 1; - cmd.n = 1; - - chan = CR_PACK(chan,range,aref); - cmd.subdev = subdev; - cmd.data = &sdata; - cmd.data_len = sizeof(sampl_t); - - cmd.chanlist = &chan; - - ret = comedi_trigger(dev,subdev,&cmd); - - *data = sdata; - - return ret; -#endif } diff --git a/comedi/kcomedilib/dio.c b/comedi/kcomedilib/dio.c index d2b9a819..63284127 100644 --- a/comedi/kcomedilib/dio.c +++ b/comedi/kcomedilib/dio.c @@ -37,14 +37,11 @@ #include #include -#define USE_INSN - extern volatile int rtcomedi_lock_semaphore; int comedi_dio_config(unsigned int dev,unsigned int subdev,unsigned int chan, unsigned int io) { -#ifdef USE_INSN comedi_insn insn; memset(&insn,0,sizeof(insn)); @@ -55,30 +52,11 @@ int comedi_dio_config(unsigned int dev,unsigned int subdev,unsigned int chan, insn.chanspec = CR_PACK(chan,0,0); return comedi_do_insn(dev,&insn); -#else - comedi_trig cmd; - sampl_t sdata = io; - - memset(&cmd,0,sizeof(cmd)); - - cmd.flags = TRIG_CONFIG|TRIG_WRITE; - cmd.n_chan = 1; - cmd.n = 1; - - cmd.subdev = subdev; - cmd.data = &sdata; - cmd.data_len = sizeof(sampl_t); - - cmd.chanlist = &chan; - - return comedi_trigger(dev,subdev,&cmd); -#endif } int comedi_dio_read(unsigned int dev,unsigned int subdev,unsigned int chan, unsigned int *val) { -#ifdef USE_INSN comedi_insn insn; memset(&insn,0,sizeof(insn)); @@ -89,32 +67,11 @@ int comedi_dio_read(unsigned int dev,unsigned int subdev,unsigned int chan, insn.chanspec = CR_PACK(chan,0,0); return comedi_do_insn(dev,&insn); -#else - comedi_trig cmd; - sampl_t sdata; - int ret; - - memset(&cmd,0,sizeof(cmd)); - - cmd.n_chan = 1; - cmd.n = 1; - cmd.subdev = subdev; - cmd.data = &sdata; - cmd.data_len = sizeof(sampl_t); - cmd.chanlist = &chan; - - ret = comedi_trigger(dev,subdev,&cmd); - - *val = sdata; - - return ret; -#endif } int comedi_dio_write(unsigned int dev,unsigned int subdev,unsigned int chan, unsigned int val) { -#ifdef USE_INSN comedi_insn insn; memset(&insn,0,sizeof(insn)); @@ -125,31 +82,11 @@ int comedi_dio_write(unsigned int dev,unsigned int subdev,unsigned int chan, insn.chanspec = CR_PACK(chan,0,0); return comedi_do_insn(dev,&insn); -#else - comedi_trig cmd; - sampl_t sdata=val; - int ret; - - memset(&cmd,0,sizeof(cmd)); - - cmd.flags = TRIG_WRITE; - cmd.n_chan = 1; - cmd.n = 1; - cmd.subdev = subdev; - cmd.data = &sdata; - cmd.data_len = sizeof(sampl_t); - cmd.chanlist = &chan; - - ret = comedi_trigger(dev,subdev,&cmd); - - return ret; -#endif } int comedi_dio_bitfield(unsigned int minor,unsigned int subdev,unsigned int mask, unsigned int *bits) { -#ifdef USE_INSN comedi_insn insn; lsampl_t data[2]; int ret; @@ -168,31 +105,6 @@ int comedi_dio_bitfield(unsigned int minor,unsigned int subdev,unsigned int mask *bits = data[1]; return ret; -#else - int ret; - unsigned int i,n_chan; - unsigned int m,bit; - comedi_subdevice *s; - - s=comedi_get_device_by_minor(minor)->subdevices+subdev; - - n_chan=s->n_chan; - if(n_chan>32)n_chan=32; - - for(i=0,m=1;ibuf_int_ptr=0; async->buf_int_count=0; -// cur_trig deprecated, looks like all drivers have abandoned it by now - FMH -// s->cur_trig.data_len = async->cmd.data_len; -// s->cur_trig.data = async->cmd.data; - async->data = cmd->data; async->data_len = cmd->data_len; async->cur_chan = 0; @@ -425,191 +421,6 @@ int comedi_command_test(unsigned int minor,comedi_cmd *cmd) return s->do_cmdtest(dev,s,cmd); } -#ifdef unused -/* - COMEDI_TRIG - trigger ioctl - - arg: - pointer to trig structure - - reads: - trig structure at arg - channel/range list - - writes: - modified trig structure at arg - data list - - this function is too complicated -*/ -static int comedi_trig_ioctl_mode0(comedi_device *dev,comedi_subdevice *s,comedi_trig *it); -static int comedi_trig_ioctl_modeN(comedi_device *dev,comedi_subdevice *s,comedi_trig *it); -int comedi_trigger(unsigned int minor,unsigned int subdev,comedi_trig *it) -{ - comedi_device *dev; - comedi_subdevice *s; - int ret; - - if((ret=minor_to_dev(minor,&dev))<0) - return ret; - - if(it->subdev>=dev->n_subdevices) - return -ENODEV; - - s=dev->subdevices+it->subdev; - if(s->type==COMEDI_SUBD_UNUSED) - return -EIO; - - if(it->mode==0) - return comedi_trig_ioctl_mode0(dev,s,it); - - if(s->async == NULL) - return -ENODEV; - - return comedi_trig_ioctl_modeN(dev,s,it); -} - -static int comedi_trig_ioctl_mode0(comedi_device *dev,comedi_subdevice *s,comedi_trig *it) -{ - int ret=0; - - /* are we locked? (ioctl lock) */ - if(s->lock && s->lock!=&rtcomedi_lock_semaphore) - return -EACCES; - - /* are we busy? */ - if(s->busy) - return -EBUSY; - s->busy=(void *)&rtcomedi_lock_semaphore; - - /* make sure channel/gain list isn't too long */ - if(it->n_chan > s->len_chanlist){ - ret = -EINVAL; - goto cleanup; - } - - /* make sure each element in channel/gain list is valid */ - if((ret=check_chanlist(s,it->n_chan,it->chanlist))<0) - goto cleanup; - - if(it->data==NULL){ - ret=-EINVAL; - goto cleanup; - } - - if(!it->data_len){ -#if 0 - ret=-EINVAL; - goto cleanup; -#else - it->data_len=it->n_chan*it->n*sizeof(sampl_t); - rt_printk("comedi: warning: trig->data_len not set\n"); -#endif - } - - //s->cur_trig=*it; - - ret=s->trig[0](dev,s,it); - - if(ret>it->n*it->n_chan){ - rt_printk("comedi: (bug) trig returned too many samples\n"); - } - -cleanup: - s->busy=NULL; - - return ret; -} - -static int comedi_trig_ioctl_modeN(comedi_device *dev,comedi_subdevice *s,comedi_trig *it) -{ - int ret=0; - comedi_async *async = s->async; - - /* are we locked? (ioctl lock) */ - if(s->lock && s->lock!=&rtcomedi_lock_semaphore) - return -EACCES; - - /* are we busy? */ - if(s->busy) - return -EBUSY; - s->busy=(void *)&rtcomedi_lock_semaphore; - - /* make sure channel/gain list isn't too long */ - if(it->n_chan > s->len_chanlist){ - ret = -EINVAL; - goto cleanup; - } - - if(async == NULL) - return -ENODEV; - - /* make sure each element in channel/gain list is valid */ - if((ret=check_chanlist(s,it->n_chan,it->chanlist))<0) - goto cleanup; - - async->buf_user_ptr=0; - async->buf_user_count=0; - async->buf_int_ptr=0; - async->buf_int_count=0; - - if(it->data==NULL){ - ret=-EINVAL; - goto cleanup; - } - - if(!it->data_len){ -#if 0 - ret=-EINVAL; - goto cleanup; -#else - it->data_len=it->n_chan*it->n*sizeof(sampl_t); - rt_printk("comedi: warning: trig->data_len not set\n"); -#endif - } - - if(it->mode>=5 || s->trig[it->mode]==NULL){ - ret=-EINVAL; - goto cleanup; - } - -// s->cur_trig=*it; - async->data = it->data; - async->data_len = it->data_len; - - ret=s->trig[it->mode](dev,s,it); - - if(ret==0)return 0; - -cleanup: - s->busy=NULL; - - return ret; -} - -/* - This function does the same as above, but without any sanity - checks. Any insanity in code calling this function must be - assumed by the writer. - */ -int __comedi_trigger(unsigned int minor,unsigned int subdev,comedi_trig *it) -{ - comedi_device *dev; - comedi_subdevice *s; - int ret=0; - - dev=comedi_get_device_by_minor(minor); - s=dev->subdevices+subdev; - -// s->cur_trig=*it; - - ret=s->trig[it->mode](dev,s,it); - - return ret; -} -#endif - /* * COMEDI_INSN * perform an instruction diff --git a/comedi/kcomedilib/ksyms.c b/comedi/kcomedilib/ksyms.c index b5aab56f..db6bcbf6 100644 --- a/comedi/kcomedilib/ksyms.c +++ b/comedi/kcomedilib/ksyms.c @@ -43,9 +43,6 @@ /* functions specific to kcomedilib */ -#ifdef unused -EXPORT_SYMBOL(__comedi_trigger); -#endif EXPORT_SYMBOL(comedi_register_callback); EXPORT_SYMBOL(comedi_get_subdevice_flags); EXPORT_SYMBOL(comedi_get_len_chanlist); @@ -81,9 +78,6 @@ EXPORT_SYMBOL(comedi_get_n_ranges); //EXPORT_SYMBOL(comedi_range_is_chan_specific); //EXPORT_SYMBOL(comedi_maxdata_is_chan_specific); EXPORT_SYMBOL(comedi_cancel); -#ifdef unused -EXPORT_SYMBOL(comedi_trigger); -#endif EXPORT_SYMBOL(comedi_command); EXPORT_SYMBOL(comedi_command_test); //EXPORT_SYMBOL(comedi_do_insnlist);