Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325467
b: refs/heads/master
c: 5c813bb
h: refs/heads/master
i:
  325465: 49a4818
  325463: fe55ea8
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 21, 2012
1 parent cc17346 commit b27aa64
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 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: 5a5614cb669f9f99bb3e983b3c4987a1eaef852b
refs/heads/master: 5c813bb100431eff1f78d75682ae1fe2d30744b4
39 changes: 16 additions & 23 deletions trunk/drivers/staging/comedi/drivers/s526.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,27 +381,18 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
}

static int s526_gpct_winsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
struct s526_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
short value;
union cmReg cmReg;
unsigned long chan_iobase = dev->iobase + chan * 8;

inw(chan_iobase + REG_C0M); /* Is this read required? */

cmReg.value = inw(dev->iobase + REG_C0M + chan * 8);
/* Check what Application of Counter this channel is configured for */
switch (devpriv->s526_gpct_config[chan].app) {
case PositionMeasurement:
outw(0xFFFF & ((*data) >> 16), dev->iobase + REG_C0H + chan * 8);
outw(0xFFFF & (*data), dev->iobase + REG_C0L + chan * 8);
break;

case SinglePulseGeneration:
outw(0xFFFF & ((*data) >> 16), dev->iobase + REG_C0H + chan * 8);
outw(0xFFFF & (*data), dev->iobase + REG_C0L + chan * 8);
break;

case PulseTrainGeneration:
/* data[0] contains the PULSE_WIDTH
data[1] contains the PULSE_PERIOD
Expand All @@ -410,22 +401,24 @@ static int s526_gpct_winsn(struct comedi_device *dev,
pulse frequency on the selected source
*/
if ((data[1] > data[0]) && (data[0] > 0)) {
(devpriv->s526_gpct_config[chan]).data[0] = data[0];
(devpriv->s526_gpct_config[chan]).data[1] = data[1];
devpriv->s526_gpct_config[chan].data[0] = data[0];
devpriv->s526_gpct_config[chan].data[1] = data[1];
} else {
return -EINVAL;
}

value = (short)((*data >> 16) & 0xFFFF);
outw(value, dev->iobase + REG_C0H + chan * 8);
value = (short)(*data & 0xFFFF);
outw(value, dev->iobase + REG_C0L + chan * 8);
/* Fall thru to write the PULSE_WIDTH */

case PositionMeasurement:
case SinglePulseGeneration:
outw((data[0] >> 16) & 0xffff, chan_iobase + REG_C0H);
outw(data[0] & 0xffff, chan_iobase + REG_C0L);
break;
default: /* Impossible */

default:
return -EINVAL;
break;
}
/* return the number of samples written */

return insn->n;
}

Expand Down

0 comments on commit b27aa64

Please sign in to comment.