From: Frank Mori Hess Date: Fri, 20 Jul 2001 18:40:17 +0000 (+0000) Subject: made chanlist cmdtests return 5 X-Git-Tag: r0_7_60~36 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=73567e50b254e180d816fe5f628a35c6af50878e;p=comedi.git made chanlist cmdtests return 5 --- diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index b9282b19..231e9527 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -729,26 +729,6 @@ static int cb_pcidas_ai_cmdtest(comedi_device *dev,comedi_subdevice *s, } } - // check channel/gain list against card's limitations - if(cmd->chanlist) - { - gain = CR_RANGE(cmd->chanlist[0]); - start_chan = CR_CHAN(cmd->chanlist[0]); - for(i = 1; i < cmd->chanlist_len; i++) - { - if(CR_CHAN(cmd->chanlist[i]) != (start_chan + i) % s->n_chan) - { - comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); - err++; - } - if(CR_RANGE(cmd->chanlist[i]) != gain) - { - comedi_error(dev, "entries in chanlist must all have the same gain\n"); - err++; - } - } - } - if(err)return 3; /* step 4: fix up any arguments */ @@ -780,6 +760,28 @@ static int cb_pcidas_ai_cmdtest(comedi_device *dev,comedi_subdevice *s, if(err) return 4; + // check channel/gain list against card's limitations + if(cmd->chanlist) + { + gain = CR_RANGE(cmd->chanlist[0]); + start_chan = CR_CHAN(cmd->chanlist[0]); + for(i = 1; i < cmd->chanlist_len; i++) + { + if(CR_CHAN(cmd->chanlist[i]) != (start_chan + i) % s->n_chan) + { + comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); + err++; + } + if(CR_RANGE(cmd->chanlist[i]) != gain) + { + comedi_error(dev, "entries in chanlist must all have the same gain\n"); + err++; + } + } + } + + if(err) return 5; + return 0; } diff --git a/comedi/drivers/das16m1.c b/comedi/drivers/das16m1.c index f7487fe8..2cc53c45 100644 --- a/comedi/drivers/das16m1.c +++ b/comedi/drivers/das16m1.c @@ -178,27 +178,6 @@ static int das16m1_cmd_test(comedi_device *dev,comedi_subdevice *s, comedi_cmd * { unsigned int err=0, tmp, i; - // check chanlist against board's peculiarities - if(cmd->chanlist && cmd->chanlist_len > 1) - { - for(i = 0; i < cmd->chanlist_len; i++) - { - // even/odd channels must go into even/odd queue addresses - if((i % 2) != (CR_CHAN(cmd->chanlist[i]) % 2)) - { - comedi_error(dev, "bad chanlist:\n" - " even/odd channels must go have even/odd chanlist indices"); - err++; - } - } - if((cmd->chanlist_len % 2) != 0) - { - comedi_error(dev, "chanlist must be of even length or length 1"); - err++; - } - } - if(err) return -EINVAL; - /* make sure triggers are valid */ tmp=cmd->start_src; cmd->start_src &= TRIG_NOW | TRIG_EXT; @@ -285,6 +264,28 @@ static int das16m1_cmd_test(comedi_device *dev,comedi_subdevice *s, comedi_cmd * if(err) return 4; + // check chanlist against board's peculiarities + if(cmd->chanlist && cmd->chanlist_len > 1) + { + for(i = 0; i < cmd->chanlist_len; i++) + { + // even/odd channels must go into even/odd queue addresses + if((i % 2) != (CR_CHAN(cmd->chanlist[i]) % 2)) + { + comedi_error(dev, "bad chanlist:\n" + " even/odd channels must go have even/odd chanlist indices"); + err++; + } + } + if((cmd->chanlist_len % 2) != 0) + { + comedi_error(dev, "chanlist must be of even length or length 1"); + err++; + } + } + + if(err) return 5; + return 0; } diff --git a/comedi/drivers/das1800.c b/comedi/drivers/das1800.c index 01a51f6f..154e3654 100644 --- a/comedi/drivers/das1800.c +++ b/comedi/drivers/das1800.c @@ -1160,21 +1160,6 @@ static int das1800_ai_do_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_c err++; } - // make sure user is not trying to mix unipolar and bipolar ranges - if(cmd->chanlist) - { - unipolar = CR_RANGE(cmd->chanlist[0]) & UNIPOLAR; - for(i = 1; i < cmd->chanlist_len; i++) - { - if(unipolar != (CR_RANGE(cmd->chanlist[i]) & UNIPOLAR)) - { - comedi_error(dev, "unipolar and bipolar ranges cannot be mixed in the chanlist"); - err++; - break; - } - } - } - switch(cmd->stop_src) { case TRIG_EXT: @@ -1242,6 +1227,23 @@ static int das1800_ai_do_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_c if(err) return 4; + // make sure user is not trying to mix unipolar and bipolar ranges + if(cmd->chanlist) + { + unipolar = CR_RANGE(cmd->chanlist[0]) & UNIPOLAR; + for(i = 1; i < cmd->chanlist_len; i++) + { + if(unipolar != (CR_RANGE(cmd->chanlist[i]) & UNIPOLAR)) + { + comedi_error(dev, "unipolar and bipolar ranges cannot be mixed in the chanlist"); + err++; + break; + } + } + } + + if(err) return 5; + return 0; } diff --git a/comedi/drivers/das800.c b/comedi/drivers/das800.c index f85770e6..7e565f1b 100644 --- a/comedi/drivers/das800.c +++ b/comedi/drivers/das800.c @@ -688,6 +688,21 @@ static int das800_ai_do_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cm err++; } } + + if(err)return 3; + + /* step 4: fix up any arguments */ + + if(cmd->convert_src == TRIG_TIMER) + { + tmp = cmd->convert_arg; + /* calculate counter values that give desired timing */ + i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->divisor1), &(devpriv->divisor2), &(cmd->convert_arg), cmd->flags & TRIG_ROUND_MASK); + if(tmp != cmd->convert_arg) err++; + } + + if(err)return 4; + // check channel/gain list against card's limitations if(cmd->chanlist) { @@ -708,19 +723,7 @@ static int das800_ai_do_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cm } } - if(err)return 3; - - /* step 4: fix up any arguments */ - - if(cmd->convert_src == TRIG_TIMER) - { - tmp = cmd->convert_arg; - /* calculate counter values that give desired timing */ - i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->divisor1), &(devpriv->divisor2), &(cmd->convert_arg), cmd->flags & TRIG_ROUND_MASK); - if(tmp != cmd->convert_arg) err++; - } - - if(err)return 4; + if(err)return 5; return 0; }