* and MF634 yet we will call them 0, 1, 2
*/
void __iomem *bar0_mem;
- void __iomem *bar1_mem;
void __iomem *bar2_mem;
/*
};
static int mf6x4_di_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
- struct mf6x4_private *devpriv = dev->private;
-
- data[1] = ioread16(devpriv->bar1_mem + MF6X4_DIN_R) & MF6X4_DIN_M;
+ data[1] = ioread16(dev->mmio + MF6X4_DIN_R) & MF6X4_DIN_M;
return insn->n;
}
static int mf6x4_do_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
- struct mf6x4_private *devpriv = dev->private;
-
if (comedi_dio_update_state(s, data))
- iowrite16(s->state & MF6X4_DOUT_M,
- devpriv->bar1_mem + MF6X4_DOUT_R);
+ iowrite16(s->state & MF6X4_DOUT_M, dev->mmio + MF6X4_DOUT_R);
data[1] = s->state;
static int mf6x4_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+ struct comedi_insn *insn,
+ unsigned int *data)
{
- struct mf6x4_private *devpriv = dev->private;
int chan = CR_CHAN(insn->chanspec);
int ret;
int i;
int d;
/* Set the ADC channel number in the scan list */
- iowrite16((1 << chan) & MF6X4_ADCTRL_M,
- devpriv->bar1_mem + MF6X4_ADCTRL_R);
+ iowrite16((1 << chan) & MF6X4_ADCTRL_M, dev->mmio + MF6X4_ADCTRL_R);
for (i = 0; i < insn->n; i++) {
/* Trigger ADC conversion by reading ADSTART */
- ioread16(devpriv->bar1_mem + MF6X4_ADSTART_R);
+ ioread16(dev->mmio + MF6X4_ADSTART_R);
ret = comedi_timeout(dev, s, insn, mf6x4_ai_eoc, 0);
if (ret)
return ret;
/* Read the actual value */
- d = ioread16(devpriv->bar1_mem + MF6X4_ADDATA_R);
+ d = ioread16(dev->mmio + MF6X4_ADDATA_R);
d &= s->maxdata;
data[i] = d;
}
- iowrite16(0x0, devpriv->bar1_mem + MF6X4_ADCTRL_R);
+ iowrite16(0x0, dev->mmio + MF6X4_ADCTRL_R);
return insn->n;
}
static int mf6x4_ao_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+ struct comedi_insn *insn,
+ unsigned int *data)
{
struct mf6x4_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
devpriv->gpioc_R);
for (i = 0; i < insn->n; i++) {
- iowrite16(data[i] & MF6X4_DA_M,
- devpriv->bar1_mem + MF6X4_DAC_R(chan));
+ iowrite16(data[i] & MF6X4_DA_M, dev->mmio + MF6X4_DAC_R(chan));
devpriv->ao_readback[chan] = data[i];
}
if (!devpriv->bar0_mem)
return -ENODEV;
- devpriv->bar1_mem = pci_ioremap_bar(pcidev, board->bar_nums[1]);
- if (!devpriv->bar1_mem)
+ dev->mmio = pci_ioremap_bar(pcidev, board->bar_nums[1]);
+ if (!dev->mmio)
return -ENODEV;
devpriv->bar2_mem = pci_ioremap_bar(pcidev, board->bar_nums[2]);
if (devpriv->bar0_mem)
iounmap(devpriv->bar0_mem);
- if (devpriv->bar1_mem)
- iounmap(devpriv->bar1_mem);
+ if (dev->mmio)
+ iounmap(dev->mmio);
if (devpriv->bar2_mem)
iounmap(devpriv->bar2_mem);