uint16_t fifo_size_reg_mask;
};
+enum pcidas64_boardid {
+ BOARD_PCIDAS6402_16,
+ BOARD_PCIDAS6402_12,
+ BOARD_PCIDAS64_M1_16,
+ BOARD_PCIDAS64_M2_16,
+ BOARD_PCIDAS64_M3_16,
+ BOARD_PCIDAS6013,
+ BOARD_PCIDAS6014,
+ BOARD_PCIDAS6023,
+ BOARD_PCIDAS6025,
+ BOARD_PCIDAS6030,
+ BOARD_PCIDAS6031,
+ BOARD_PCIDAS6032,
+ BOARD_PCIDAS6033,
+ BOARD_PCIDAS6034,
+ BOARD_PCIDAS6035,
+ BOARD_PCIDAS6036,
+ BOARD_PCIDAS6040,
+ BOARD_PCIDAS6052,
+ BOARD_PCIDAS6070,
+ BOARD_PCIDAS6071,
+ BOARD_PCIDAS4020_12,
+ BOARD_PCIDAS6402_16_JR,
+ BOARD_PCIDAS64_M1_16_JR,
+ BOARD_PCIDAS64_M2_16_JR,
+ BOARD_PCIDAS64_M3_16_JR,
+ BOARD_PCIDAS64_M1_14,
+ BOARD_PCIDAS64_M2_14,
+ BOARD_PCIDAS64_M3_14,
+};
+
struct pcidas64_board {
const char *name;
- int device_id; /* pci device id */
int ai_se_chans; /* number of ai inputs in single-ended mode */
int ai_bits; /* analog input resolution */
int ai_speed; /* fastest conversion period in ns */
static const int bytes_in_sample = 2;
static const struct pcidas64_board pcidas64_boards[] = {
- {
+ [BOARD_PCIDAS6402_16] = {
.name = "pci-das6402/16",
- .device_id = 0x1d,
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS6402_12] = {
.name = "pci-das6402/12", /* XXX check */
- .device_id = 0x1e,
.ai_se_chans = 64,
.ai_bits = 12,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M1_16] = {
.name = "pci-das64/m1/16",
- .device_id = 0x35,
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 1000,
.ai_fifo = &ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M2_16] = {
.name = "pci-das64/m2/16",
- .device_id = 0x36,
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 500,
.ai_fifo = &ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M3_16] = {
.name = "pci-das64/m3/16",
- .device_id = 0x37,
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 333,
.ai_fifo = &ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS6013] = {
.name = "pci-das6013",
- .device_id = 0x78,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6014] = {
.name = "pci-das6014",
- .device_id = 0x79,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6023] = {
.name = "pci-das6023",
- .device_id = 0x5d,
.ai_se_chans = 16,
.ai_bits = 12,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS6025] = {
.name = "pci-das6025",
- .device_id = 0x5e,
.ai_se_chans = 16,
.ai_bits = 12,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS6030] = {
.name = "pci-das6030",
- .device_id = 0x5f,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 10000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6031] = {
.name = "pci-das6031",
- .device_id = 0x60,
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 10000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6032] = {
.name = "pci-das6032",
- .device_id = 0x61,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 10000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6033] = {
.name = "pci-das6033",
- .device_id = 0x62,
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 10000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6034] = {
.name = "pci-das6034",
- .device_id = 0x63,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6035] = {
.name = "pci-das6035",
- .device_id = 0x64,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6036] = {
.name = "pci-das6036",
- .device_id = 0x6f,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 5000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6040] = {
.name = "pci-das6040",
- .device_id = 0x65,
.ai_se_chans = 16,
.ai_bits = 12,
.ai_speed = 2000,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6052] = {
.name = "pci-das6052",
- .device_id = 0x66,
.ai_se_chans = 16,
.ai_bits = 16,
.ai_speed = 3333,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6070] = {
.name = "pci-das6070",
- .device_id = 0x67,
.ai_se_chans = 16,
.ai_bits = 12,
.ai_speed = 800,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS6071] = {
.name = "pci-das6071",
- .device_id = 0x68,
.ai_se_chans = 64,
.ai_bits = 12,
.ai_speed = 800,
.ai_fifo = &ai_fifo_60xx,
.has_8255 = 0,
},
- {
+ [BOARD_PCIDAS4020_12] = {
.name = "pci-das4020/12",
- .device_id = 0x52,
.ai_se_chans = 4,
.ai_bits = 12,
.ai_speed = 50,
.has_8255 = 1,
},
#if 0
- {
+ /*
+ * The device id for these boards is unknown
+ */
+
+ [BOARD_PCIDAS6402_16_JR] = {
.name = "pci-das6402/16/jr",
- .device_id = 0 /* XXX, */
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 5000,
.ai_fifo = ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M1_16_JR] = {
.name = "pci-das64/m1/16/jr",
- .device_id = 0 /* XXX, */
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 1000,
.ai_fifo = ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M2_16_JR] = {
.name = "pci-das64/m2/16/jr",
- .device_id = 0 /* XXX, */
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 500,
.ai_fifo = ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M3_16_JR] = {
.name = "pci-das64/m3/16/jr",
- .device_id = 0 /* XXX, */
.ai_se_chans = 64,
.ai_bits = 16,
.ai_speed = 333,
.ai_fifo = ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M1_14] = {
.name = "pci-das64/m1/14",
- .device_id = 0, /* XXX */
.ai_se_chans = 64,
.ai_bits = 14,
.ai_speed = 1000,
.ai_fifo = ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M2_14] = {
.name = "pci-das64/m2/14",
- .device_id = 0, /* XXX */
.ai_se_chans = 64,
.ai_bits = 14,
.ai_speed = 500,
.ai_fifo = ai_fifo_64xx,
.has_8255 = 1,
},
- {
+ [BOARD_PCIDAS64_M3_14] = {
.name = "pci-das64/m3/14",
- .device_id = 0, /* XXX */
.ai_se_chans = 64,
.ai_bits = 14,
.ai_speed = 333,
return 0;
}
-static const struct pcidas64_board
-*cb_pcidas64_find_pci_board(struct pci_dev *pcidev)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(pcidas64_boards); i++)
- if (pcidev->device == pcidas64_boards[i].device_id)
- return &pcidas64_boards[i];
- return NULL;
-}
-
static int auto_attach(struct comedi_device *dev,
- unsigned long context_unused)
+ unsigned long context)
{
- const struct pcidas64_board *thisboard;
- struct pcidas64_private *devpriv;
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+ const struct pcidas64_board *thisboard = NULL;
+ struct pcidas64_private *devpriv;
uint32_t local_range, local_decode;
int retval;
- dev->board_ptr = cb_pcidas64_find_pci_board(pcidev);
- if (!dev->board_ptr) {
- dev_err(dev->class_dev,
- "cb_pcidas64: does not support pci %s\n",
- pci_name(pcidev));
- return -EINVAL;
- }
- thisboard = comedi_board(dev);
+ if (context < ARRAY_SIZE(pcidas64_boards))
+ thisboard = &pcidas64_boards[context];
+ if (!thisboard)
+ return -ENODEV;
+ dev->board_ptr = thisboard;
devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
if (!devpriv)
}
static DEFINE_PCI_DEVICE_TABLE(cb_pcidas64_pci_table) = {
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001d) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001e) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0035) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0036) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0037) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0052) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x005d) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x005e) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x005f) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0061) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0062) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0063) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0064) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0066) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0067) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0068) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x006f) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0078) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0079) },
+ { PCI_VDEVICE(CB, 0x001d), BOARD_PCIDAS6402_16 },
+ { PCI_VDEVICE(CB, 0x001e), BOARD_PCIDAS6402_12 },
+ { PCI_VDEVICE(CB, 0x0035), BOARD_PCIDAS64_M1_16 },
+ { PCI_VDEVICE(CB, 0x0036), BOARD_PCIDAS64_M2_16 },
+ { PCI_VDEVICE(CB, 0x0037), BOARD_PCIDAS64_M3_16 },
+ { PCI_VDEVICE(CB, 0x0052), BOARD_PCIDAS4020_12 },
+ { PCI_VDEVICE(CB, 0x005d), BOARD_PCIDAS6023 },
+ { PCI_VDEVICE(CB, 0x005e), BOARD_PCIDAS6025 },
+ { PCI_VDEVICE(CB, 0x005f), BOARD_PCIDAS6030 },
+ { PCI_VDEVICE(CB, 0x0060), BOARD_PCIDAS6031 },
+ { PCI_VDEVICE(CB, 0x0061), BOARD_PCIDAS6032 },
+ { PCI_VDEVICE(CB, 0x0062), BOARD_PCIDAS6033 },
+ { PCI_VDEVICE(CB, 0x0063), BOARD_PCIDAS6034 },
+ { PCI_VDEVICE(CB, 0x0064), BOARD_PCIDAS6035 },
+ { PCI_VDEVICE(CB, 0x0065), BOARD_PCIDAS6040 },
+ { PCI_VDEVICE(CB, 0x0066), BOARD_PCIDAS6052 },
+ { PCI_VDEVICE(CB, 0x0067), BOARD_PCIDAS6070 },
+ { PCI_VDEVICE(CB, 0x0068), BOARD_PCIDAS6071 },
+ { PCI_VDEVICE(CB, 0x006f), BOARD_PCIDAS6036 },
+ { PCI_VDEVICE(CB, 0x0078), BOARD_PCIDAS6013 },
+ { PCI_VDEVICE(CB, 0x0079), BOARD_PCIDAS6014 },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, cb_pcidas64_pci_table);