From: Ian Abbott Date: Thu, 15 Nov 2007 16:11:21 +0000 (+0000) Subject: Fix AI channel enables for AREF_DIFF if the hardware is PCI230+ or PCI260+ X-Git-Tag: v0_7_76~63 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d61536c820ce825c51976ae857cd5afbf9346b7c;p=comedi.git Fix AI channel enables for AREF_DIFF if the hardware is PCI230+ or PCI260+ due to a difference in the way the register works between PCI230 and PCI230+ in differential mode. --- diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index 25a4eb07..a48938df 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -706,7 +706,15 @@ static int pci230_ai_rinsn(comedi_device * dev, comedi_subdevice * s, return -EINVAL; } gainshift = chan * 2; - adcen = 3 << gainshift; /* Enable channel pair */ + if (devpriv->hwver == 0) { + /* Original PCI230/260 expects both inputs of the + * differential channel to be enabled. */ + adcen = 3 << gainshift; + } else { + /* PCI230+/260+ expects only one input of the + * differential channel to be enabled. */ + adcen = 1 << gainshift; + } adccon |= PCI230_ADC_IM_DIF; } else { /* Single ended. */ @@ -1386,7 +1394,15 @@ static int pci230_ai_cmd(comedi_device * dev, comedi_subdevice * s) range = CR_RANGE(cmd->chanlist[i]); if (diff) { adcg |= pci230_ai_gain[range] << (2 * chan); - adcen |= 3 << (2 * chan); + if (devpriv->hwver == 0) { + /* Original PCI230/260 expects both inputs of + * the differential channel to be enabled. */ + adcen |= 3 << (2 * chan); + } else { + /* PCI230+/260+ expects only one input of the + * differential channel to be enabled. */ + adcen |= 1 << (2 * chan); + } } else { adcg |= pci230_ai_gain[range] << (chan & ~1); adcen |= 1 << chan;