51 #include "../comedidev.h"
54 #include <linux/pci.h>
56 #define PCI_DEVICE_ID_ICP_MULTI 0x8000
58 #define ICP_MULTI_ADC_CSR 0
59 #define ICP_MULTI_AI 2
60 #define ICP_MULTI_DAC_CSR 4
61 #define ICP_MULTI_AO 6
62 #define ICP_MULTI_DI 8
63 #define ICP_MULTI_DO 0x0A
64 #define ICP_MULTI_INT_EN 0x0C
65 #define ICP_MULTI_INT_STAT 0x0E
66 #define ICP_MULTI_CNTR0 0x10
67 #define ICP_MULTI_CNTR1 0x12
68 #define ICP_MULTI_CNTR2 0x14
69 #define ICP_MULTI_CNTR3 0x16
71 #define ICP_MULTI_SIZE 0x20
75 #define ADC_BSY 0x0001
82 #define DAC_BSY 0x0001
87 #define ADC_READY 0x0001
88 #define DAC_READY 0x0002
89 #define DOUT_ERROR 0x0004
90 #define DIN_STATUS 0x0008
97 #define Status_IRQ 0x00ff
108 static const char range_codes_analog[] = { 0x00, 0x20, 0x10, 0x30 };
135 unsigned int *chanlist,
unsigned int n_chan)
138 unsigned int i,
range, chanprog;
144 for (i = 0; i < n_chan; i++) {
146 chanprog =
CR_CHAN(chanlist[i]);
171 range = range_codes_analog[
CR_RANGE(chanlist[i])];
197 setup_channel_list(dev, s, &insn->
chanspec, 1);
199 for (n = 0; n < insn->
n; n++) {
251 static int icp_multi_insn_write_ao(
struct comedi_device *dev,
281 for (n = 0; n < insn->
n; n++) {
338 for (n = 0; n < insn->
n; n++)
339 data[n] = devpriv->
ao_data[chan];
362 s->
state &= ~data[0];
363 s->
state |= (data[0] & data[1]);
375 static int icp_multi_insn_read_ctr(
struct comedi_device *dev,
382 static int icp_multi_insn_write_ctr(
struct comedi_device *dev,
390 static irqreturn_t interrupt_service_icp_multi(
int irq,
void *
d)
431 unsigned int *chanlist,
unsigned int n_chan)
441 for (i = 0; i < n_chan; i++) {
444 if (
CR_CHAN(chanlist[i]) > (s->nchan / 2)) {
446 "Incorrect differential ai ch-nr");
452 "Incorrect ai channel number");
471 for (i = 0; i < 4; i++) {
505 comedi_set_hw_dev(dev, &pcidev->
dev);
508 ret = alloc_private(dev,
sizeof(*devpriv));
527 icp_multi_reset(dev);
597 struct pci_dev *pcidev = comedi_to_pci_dev(dev);
602 icp_multi_reset(dev);
605 if (devpriv && devpriv->
io_addr)
614 .driver_name =
"icp_multi",
616 .attach_pci = icp_multi_attach_pci,
617 .detach = icp_multi_detach,
637 static struct pci_driver icp_multi_pci_driver = {
639 .id_table = icp_multi_pci_table,
640 .probe = icp_multi_pci_probe,