Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317651
b: refs/heads/master
c: f66faa5
h: refs/heads/master
i:
  317649: dda204c
  317647: ee08dd9
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 6, 2012
1 parent afa3f45 commit 5015244
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7671896c4f7f66116798d7314a03995eddac4134
refs/heads/master: f66faa576f084bed49d4a34e0bc2289ff0d07a70
35 changes: 16 additions & 19 deletions trunk/drivers/staging/comedi/drivers/cb_pcidas.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,36 +382,33 @@ static inline unsigned int cal_enable_bits(struct comedi_device *dev)
return CAL_EN_BIT | CAL_SRC_BITS(devpriv->calibration_source);
}

/*
* "instructions" read/write data in "one-shot" or "software-triggered"
* mode.
*/
static int cb_pcidas_ai_rinsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct cb_pcidas_private *devpriv = dev->private;
int n, i;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int range = CR_RANGE(insn->chanspec);
unsigned int aref = CR_AREF(insn->chanspec);
unsigned int bits;
static const int timeout = 10000;
int channel;
/* enable calibration input if appropriate */
int n, i;

/* enable calibration input if appropriate */
if (insn->chanspec & CR_ALT_SOURCE) {
outw(cal_enable_bits(dev),
devpriv->control_status + CALIBRATION_REG);
channel = 0;
chan = 0;
} else {
outw(0, devpriv->control_status + CALIBRATION_REG);
channel = CR_CHAN(insn->chanspec);
}
/* set mux limits and gain */
bits = BEGIN_SCAN(channel) |
END_SCAN(channel) | GAIN_BITS(CR_RANGE(insn->chanspec));
/* set unipolar/bipolar */
if (CR_RANGE(insn->chanspec) & IS_UNIPOLAR)

/* set mux limits and gain */
bits = BEGIN_SCAN(chan) | END_SCAN(chan) | GAIN_BITS(range);
/* set unipolar/bipolar */
if (range & IS_UNIPOLAR)
bits |= UNIP;
/* set singleended/differential */
if (CR_AREF(insn->chanspec) != AREF_DIFF)
/* set single-ended/differential */
if (aref != AREF_DIFF)
bits |= SE;
outw(bits, devpriv->control_status + ADCMUX_CONT);

Expand All @@ -425,11 +422,11 @@ static int cb_pcidas_ai_rinsn(struct comedi_device *dev,

/* wait for conversion to end */
/* return -ETIMEDOUT if there is a timeout */
for (i = 0; i < timeout; i++) {
for (i = 0; i < 10000; i++) {
if (inw(devpriv->control_status + ADCMUX_CONT) & EOC)
break;
}
if (i == timeout)
if (i == 10000)
return -ETIMEDOUT;

/* read data */
Expand Down

0 comments on commit 5015244

Please sign in to comment.