6402 and 6025 attach opposite meanings to single-ended/differential bit
authorFrank Mori Hess <fmhess@speakeasy.net>
Mon, 13 May 2002 04:07:31 +0000 (04:07 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Mon, 13 May 2002 04:07:31 +0000 (04:07 +0000)
comedi/drivers/cb_pcidas64.c

index 852c6a2666bd3b2544943b88009efb537e8dfab8..75d5c64151df18996bb48d445db3f74a118e1611 100644 (file)
@@ -1225,7 +1225,8 @@ static int ai_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsa
                // set gain
                bits |= board(dev)->ai_range_bits[CR_RANGE(insn->chanspec)];
                // set single-ended / differential
-               if(aref != AREF_DIFF)
+               if( ( board(dev)->layout == LAYOUT_64XX && aref != AREF_DIFF ) ||
+                       ( board(dev)->layout == LAYOUT_60XX && aref == AREF_DIFF ) )
                        bits |= ADC_SE_DIFF_BIT;
                if( aref == AREF_COMMON)
                        bits |= ADC_COMMON_BIT;
@@ -1330,7 +1331,10 @@ static int ai_config_calibration_source( comedi_device *dev, lsampl_t *data )
        lsampl_t source = data[1];
 
        if(source >= num_calibration_sources)
+       {
+               printk( "invalid calibration source: %i\n", source );
                return -EINVAL;
+       }
 
        DEBUG_PRINT("setting calibration source to %i\n", source);
        private(dev)->calibration_source = source;
@@ -1614,7 +1618,8 @@ static int ai_cmd(comedi_device *dev,comedi_subdevice *s)
                        // set gain
                        bits |= board(dev)->ai_range_bits[CR_RANGE(cmd->chanlist[i])];
                        // set single-ended / differential
-                       if(CR_AREF(cmd->chanlist[i]) != AREF_DIFF)
+                       if( ( board(dev)->layout == LAYOUT_64XX && CR_AREF(cmd->chanlist[i]) != AREF_DIFF ) ||
+                               ( board(dev)->layout == LAYOUT_60XX && CR_AREF(cmd->chanlist[i]) == AREF_DIFF ) )
                                bits |= ADC_SE_DIFF_BIT;
                        if(CR_AREF(cmd->chanlist[i]) == AREF_COMMON)
                                bits |= ADC_COMMON_BIT;