if (devpriv->timer_mode == ADDIDATA_WATCHDOG) {
ctrl = 0;
} else {
- ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG);
+ ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG);
ctrl &= 0xfffff9fe;
}
- outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG);
+ outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG);
/* enable/disable the timer interrupt */
ctrl = (data[1] == 1) ? 0x2 : 0;
- outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG);
+ outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG);
- outl(data[2], dev->iobase + APCI3501_TIMER_TIMEBASE_REG);
- outl(data[3], dev->iobase + APCI3501_TIMER_RELOAD_REG);
+ outl(data[2], devpriv->tcw + ADDI_TCW_TIMEBASE_REG);
+ outl(data[3], devpriv->tcw + ADDI_TCW_RELOAD_REG);
- ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG);
+ ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG);
if (devpriv->timer_mode == ADDIDATA_WATCHDOG) {
/* Set the mode (e2->e0) NOTE: this doesn't look correct */
ctrl |= 0xfff819e0;
ctrl &= 0xfff719e2;
ctrl |= (2 << 13) | 0x10;
}
- outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG);
+ outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG);
return insn->n;
}
if (devpriv->timer_mode == ADDIDATA_WATCHDOG ||
devpriv->timer_mode == ADDIDATA_TIMER) {
- ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG);
+ ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG);
ctrl &= 0xfffff9ff;
if (data[1] == 1) { /* enable */
} else if (data[1] == 2) { /* trigger */
ctrl |= 0x200;
}
- outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG);
+ outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG);
}
- inl(dev->iobase + APCI3501_TIMER_STATUS_REG);
+ inl(devpriv->tcw + ADDI_TCW_STATUS_REG);
return insn->n;
}
devpriv->timer_mode != ADDIDATA_WATCHDOG)
return -EINVAL;
- data[0] = inl(dev->iobase + APCI3501_TIMER_STATUS_REG) & 0x1;
- data[1] = inl(dev->iobase + APCI3501_TIMER_SYNC_REG);
+ data[0] = inl(devpriv->tcw + ADDI_TCW_STATUS_REG) & 0x1;
+ data[1] = inl(devpriv->tcw + ADDI_TCW_VAL_REG);
return insn->n;
}
#include <linux/sched.h>
#include "../comedi_pci.h"
+#include "addi_tcw.h"
#include "amcc_s5933.h"
/*
#define APCI3501_AO_DATA_VAL(x) ((x) << 8)
#define APCI3501_AO_DATA_BIPOLAR BIT(31)
#define APCI3501_AO_TRIG_SCS_REG 0x08
-#define APCI3501_TIMER_SYNC_REG 0x20
-#define APCI3501_TIMER_RELOAD_REG 0x24
-#define APCI3501_TIMER_TIMEBASE_REG 0x28
-#define APCI3501_TIMER_CTRL_REG 0x2c
-#define APCI3501_TIMER_STATUS_REG 0x30
-#define APCI3501_TIMER_IRQ_REG 0x34
-#define APCI3501_TIMER_WARN_RELOAD_REG 0x38
-#define APCI3501_TIMER_WARN_TIMEBASE_REG 0x3c
+#define APCI3501_TIMER_BASE 0x20
#define APCI3501_DO_REG 0x40
#define APCI3501_DI_REG 0x50
struct apci3501_private {
unsigned long amcc;
+ unsigned long tcw;
struct task_struct *tsk_Current;
unsigned char timer_mode;
};
unsigned int ctrl;
/* Disable Interrupt */
- ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG);
+ ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG);
ctrl &= 0xfffff9fd;
- outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG);
+ outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG);
- status = inl(dev->iobase + APCI3501_TIMER_IRQ_REG) & 0x1;
+ status = inl(devpriv->tcw + ADDI_TCW_IRQ_REG) & 0x1;
if (!status) {
dev_err(dev->class_dev, "IRQ from unknown source\n");
return IRQ_NONE;
/* Enable Interrupt Send a signal to from kernel to user space */
send_sig(SIGIO, devpriv->tsk_Current, 0);
- ctrl = inl(dev->iobase + APCI3501_TIMER_CTRL_REG);
+ ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG);
ctrl &= 0xfffff9fd;
ctrl |= 1 << 1;
- outl(ctrl, dev->iobase + APCI3501_TIMER_CTRL_REG);
- inl(dev->iobase + APCI3501_TIMER_STATUS_REG);
+ outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG);
+ inl(devpriv->tcw + ADDI_TCW_STATUS_REG);
return IRQ_HANDLED;
}
if (ret)
return ret;
- dev->iobase = pci_resource_start(pcidev, 1);
devpriv->amcc = pci_resource_start(pcidev, 0);
+ dev->iobase = pci_resource_start(pcidev, 1);
+ devpriv->tcw = dev->iobase + APCI3501_TIMER_BASE;
ao_n_chan = apci3501_eeprom_get_ao_n_chan(dev);