{
struct apci3xxx_private *devpriv = dev->private;
- if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL)
+ if ((readl(devpriv->mmio + 8) & 0x80000) == 0x80000)
return 1;
else
return 0;
/*******************************/
writel((unsigned int)b_TimeBase,
- devpriv->dw_AiBase + 36);
+ devpriv->mmio + 36);
/**************************/
/* Set the convert timing */
/*************************/
- writel(dw_ReloadValue, devpriv->dw_AiBase + 32);
+ writel(dw_ReloadValue, devpriv->mmio + 32);
} else {
/**************************/
/* Any conversion started */
return -EBUSY;
/* Clear the FIFO */
- writel(0x10000, devpriv->dw_AiBase + 12);
+ writel(0x10000, devpriv->mmio + 12);
/* Get and save the delay mode */
- delay_mode = readl(devpriv->dw_AiBase + 4);
+ delay_mode = readl(devpriv->mmio + 4);
delay_mode &= 0xfffffef0;
/* Channel configuration selection */
- writel(delay_mode, devpriv->dw_AiBase + 4);
+ writel(delay_mode, devpriv->mmio + 4);
/* Make the configuration */
val = (range & 3) | ((range >> 2) << 6) |
(devpriv->b_SingelDiff << 7);
- writel(val, devpriv->dw_AiBase + 0);
+ writel(val, devpriv->mmio + 0);
/* Channel selection */
- writel(delay_mode | 0x100, devpriv->dw_AiBase + 4);
- writel(chan, devpriv->dw_AiBase + 0);
+ writel(delay_mode | 0x100, devpriv->mmio + 4);
+ writel(chan, devpriv->mmio + 0);
/* Restore delay mode */
- writel(delay_mode, devpriv->dw_AiBase + 4);
+ writel(delay_mode, devpriv->mmio + 4);
/* Set the number of sequence to 1 */
- writel(1, devpriv->dw_AiBase + 48);
+ writel(1, devpriv->mmio + 48);
/* Save the interrupt flag */
devpriv->b_EocEosInterrupt = use_interrupt;
if (!use_interrupt) {
for (i = 0; i < insn->n; i++) {
/* Start the conversion */
- writel(0x80000, devpriv->dw_AiBase + 8);
+ writel(0x80000, devpriv->mmio + 8);
/* Wait the EOS */
do {
- val = readl(devpriv->dw_AiBase + 20);
+ val = readl(devpriv->mmio + 20);
val &= 0x1;
} while (!val);
/* Read the analog value */
- data[i] = readl(devpriv->dw_AiBase + 28);
+ data[i] = readl(devpriv->mmio + 28);
}
} else {
/* Start the conversion */
- writel(0x180000, devpriv->dw_AiBase + 8);
+ writel(0x180000, devpriv->mmio + 8);
}
return insn->n;
};
struct apci3xxx_private {
- void __iomem *dw_AiBase;
+ void __iomem *mmio;
unsigned int ui_AiNbrofChannels; /* how many channels is measured */
unsigned int ui_AiReadData[32];
unsigned char b_EocEosInterrupt;
int i;
/* Test if interrupt occur */
- status = readl(devpriv->dw_AiBase + 16);
+ status = readl(devpriv->mmio + 16);
if ((status & 0x2) == 0x2) {
/* Reset the interrupt */
- writel(status, devpriv->dw_AiBase + 16);
+ writel(status, devpriv->mmio + 16);
/* Test if interrupt enabled */
if (devpriv->b_EocEosInterrupt == 1) {
for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) {
unsigned int val;
- val = readl(devpriv->dw_AiBase + 28);
+ val = readl(devpriv->mmio + 28);
devpriv->ui_AiReadData[i] = val;
}
for (i = 0; i < insn->n; i++) {
/* Set the range selection */
- writel(range, devpriv->dw_AiBase + 96);
+ writel(range, devpriv->mmio + 96);
/* Write the analog value to the selected channel */
- writel((data[i] << 8) | chan, devpriv->dw_AiBase + 100);
+ writel((data[i] << 8) | chan, devpriv->mmio + 100);
/* Wait the end of transfer */
do {
- status = readl(devpriv->dw_AiBase + 96);
+ status = readl(devpriv->mmio + 96);
} while ((status & 0x100) != 0x100);
}
devpriv->b_EocEosInterrupt = 0;
/* Clear the start command */
- writel(0, devpriv->dw_AiBase + 8);
+ writel(0, devpriv->mmio + 8);
/* Reset the interrupt flags */
- val = readl(devpriv->dw_AiBase + 16);
- writel(val, devpriv->dw_AiBase + 16);
+ val = readl(devpriv->mmio + 16);
+ writel(val, devpriv->mmio + 16);
/* clear the EOS */
- readl(devpriv->dw_AiBase + 20);
+ readl(devpriv->mmio + 20);
/* Clear the FIFO */
for (i = 0; i < 16; i++)
- val = readl(devpriv->dw_AiBase + 28);
+ val = readl(devpriv->mmio + 28);
/* Enable the interrupt */
enable_irq(dev->irq);
return ret;
dev->iobase = pci_resource_start(pcidev, 2);
- devpriv->dw_AiBase = pci_ioremap_bar(pcidev, 3);
+ devpriv->mmio = pci_ioremap_bar(pcidev, 3);
if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, apci3xxx_irq_handler,
apci3xxx_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
- if (devpriv->dw_AiBase)
- iounmap(devpriv->dw_AiBase);
+ if (devpriv->mmio)
+ iounmap(devpriv->mmio);
}
comedi_pci_disable(dev);
}