AD8402,
};
+enum cb_pcidas_boardid {
+ BOARD_PCIDAS1602_16,
+ BOARD_PCIDAS1200,
+ BOARD_PCIDAS1602_12,
+ BOARD_PCIDAS1200_JR,
+ BOARD_PCIDAS1602_16_JR,
+ BOARD_PCIDAS1000,
+ BOARD_PCIDAS1001,
+ BOARD_PCIDAS1002,
+};
+
struct cb_pcidas_board {
const char *name;
- unsigned short device_id;
int ai_nchan; /* Inputs in single-ended mode */
int ai_bits; /* analog input resolution */
int ai_speed; /* fastest conversion period in ns */
};
static const struct cb_pcidas_board cb_pcidas_boards[] = {
- {
+ [BOARD_PCIDAS1602_16] = {
.name = "pci-das1602/16",
- .device_id = 0x1,
.ai_nchan = 16,
.ai_bits = 16,
.ai_speed = 5000,
.trimpot = AD8402,
.has_dac08 = 1,
.is_1602 = 1,
- }, {
+ },
+ [BOARD_PCIDAS1200] = {
.name = "pci-das1200",
- .device_id = 0xF,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 3200,
.fifo_size = 1024,
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
- }, {
+ },
+ [BOARD_PCIDAS1602_12] = {
.name = "pci-das1602/12",
- .device_id = 0x10,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 3200,
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
.is_1602 = 1,
- }, {
+ },
+ [BOARD_PCIDAS1200_JR] = {
.name = "pci-das1200/jr",
- .device_id = 0x19,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 3200,
.fifo_size = 1024,
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
- }, {
+ },
+ [BOARD_PCIDAS1602_16_JR] = {
.name = "pci-das1602/16/jr",
- .device_id = 0x1C,
.ai_nchan = 16,
.ai_bits = 16,
.ai_speed = 5000,
.trimpot = AD8402,
.has_dac08 = 1,
.is_1602 = 1,
- }, {
+ },
+ [BOARD_PCIDAS1000] = {
.name = "pci-das1000",
- .device_id = 0x4C,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 4000,
.fifo_size = 1024,
.ranges = &cb_pcidas_ranges,
.trimpot = AD7376,
- }, {
+ },
+ [BOARD_PCIDAS1001] = {
.name = "pci-das1001",
- .device_id = 0x1a,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 6800,
.fifo_size = 1024,
.ranges = &cb_pcidas_alt_ranges,
.trimpot = AD7376,
- }, {
+ },
+ [BOARD_PCIDAS1002] = {
.name = "pci-das1002",
- .device_id = 0x1b,
.ai_nchan = 16,
.ai_bits = 12,
.ai_speed = 6800,
return IRQ_HANDLED;
}
-static const void *cb_pcidas_find_boardinfo(struct comedi_device *dev,
- struct pci_dev *pcidev)
-{
- const struct cb_pcidas_board *thisboard;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(cb_pcidas_boards); i++) {
- thisboard = &cb_pcidas_boards[i];
- if (thisboard->device_id == pcidev->device)
- return thisboard;
- }
- return NULL;
-}
-
static int cb_pcidas_auto_attach(struct comedi_device *dev,
- unsigned long context_unused)
+ unsigned long context)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
- const struct cb_pcidas_board *thisboard;
+ const struct cb_pcidas_board *thisboard = NULL;
struct cb_pcidas_private *devpriv;
struct comedi_subdevice *s;
int i;
int ret;
- thisboard = cb_pcidas_find_boardinfo(dev, pcidev);
+ if (context < ARRAY_SIZE(cb_pcidas_boards))
+ thisboard = &cb_pcidas_boards[context];
if (!thisboard)
return -ENODEV;
dev->board_ptr = thisboard;
}
static DEFINE_PCI_DEVICE_TABLE(cb_pcidas_pci_table) = {
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0001) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x000f) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0010) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0019) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001c) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x004c) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001a) },
- { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x001b) },
+ { PCI_VDEVICE(CB, 0x0001), BOARD_PCIDAS1602_16 },
+ { PCI_VDEVICE(CB, 0x000f), BOARD_PCIDAS1200 },
+ { PCI_VDEVICE(CB, 0x0010), BOARD_PCIDAS1602_12 },
+ { PCI_VDEVICE(CB, 0x0019), BOARD_PCIDAS1200_JR },
+ { PCI_VDEVICE(CB, 0x001c), BOARD_PCIDAS1602_16_JR },
+ { PCI_VDEVICE(CB, 0x004c), BOARD_PCIDAS1000 },
+ { PCI_VDEVICE(CB, 0x001a), BOARD_PCIDAS1001 },
+ { PCI_VDEVICE(CB, 0x001b), BOARD_PCIDAS1002 },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, cb_pcidas_pci_table);