static ni_board ni_boards[]={
{ device_id: 44,
+ isapnp_id: 0x1900, /* probably wrong */
name: "at-mio-16e-1",
n_adchan: 16,
adbits: 12,
caldac: {mb88341},
},
{ device_id: 25,
+ isapnp_id: 0x1900, /* probably wrong */
name: "at-mio-16e-2",
n_adchan: 16,
adbits: 12,
caldac: {mb88341},
},
{ device_id: 36,
+ isapnp_id: 0x1900, /* probably wrong */
name: "at-mio-16e-10",
n_adchan: 16,
adbits: 12,
has_8255: 0,
},
{ device_id: 37,
+ isapnp_id: 0x1900, /* probably wrong */
name: "at-mio-16de-10",
n_adchan: 16,
adbits: 12,
has_8255: 1,
},
{ device_id: 38,
+ isapnp_id: 0x1900, /* probably wrong */
name: "at-mio-64e-3",
n_adchan: 64,
adbits: 12,
caldac: {mb88341},
},
{ device_id: 39,
+ isapnp_id: 0x2700,
name: "at-mio-16xe-50",
n_adchan: 16,
adbits: 16,
has_8255: 0,
},
{ device_id: 50,
+ isapnp_id: 0x1900, /* probably wrong */
name: "at-mio-16xe-10",
n_adchan: 16,
adbits: 16,
has_8255: 0,
},
{ device_id: 51,
+ isapnp_id: 0x1900, /* probably wrong */
name: "at-ai-16xe-10",
n_adchan: 16,
adbits: 16,
has_8255: 0,
}
};
-
+static const int num_ni_boards = sizeof( ni_boards ) / sizeof( ni_board );
static int ni_irqpin[]={-1,-1,-1,0,1,2,-1,3,-1,-1,4,5,6,-1,-1,7};
#ifdef __ISAPNP__
static struct isapnp_device_id device_ids[] = {
- { ISAPNP_DEVICE_SINGLE('N','I','C',0x1900,'N','I','C',0x0000), },
+ { ISAPNP_DEVICE_SINGLE('N','I','C',0x1900,'N','I','C',0x1900), },
+ { ISAPNP_DEVICE_SINGLE('N','I','C',0x2700,'N','I','C',0x2700), },
{ ISAPNP_DEVICE_SINGLE_END, },
};
MODULE_DEVICE_TABLE(isapnp, device_ids);
return 0;
}
-static int ni_atmio_attach(comedi_device *dev,comedi_devconfig *it)
+static int ni_isapnp_find_board( struct pci_dev **dev )
{
- struct pci_dev *isapnp_dev;
- int ret;
- int iobase;
- int board;
- int irq;
+#ifdef __ISAPNP__
+ struct pci_dev *isapnp_dev = NULL;
- iobase=it->options[0];
- irq=it->options[1];
- isapnp_dev = NULL;
- if( iobase == 0 )
+ for( i = 0; i < num_ni_boards; i++ )
{
-#ifdef __ISAPNP__
isapnp_dev = isapnp_find_dev(NULL,
ISAPNP_VENDOR('N','I','C'),
- ISAPNP_FUNCTION(0x1900),
+ ISAPNP_FUNCTION( ni_boards[ i ].isapnp_id ),
NULL);
- if(!isapnp_dev)
- return -ENODEV;
+ if(!isapnp_dev) continue;
- if(isapnp_dev->active)
- return -EBUSY;
+ if(isapnp_dev->active) continue;
if(isapnp_dev->prepare(isapnp_dev)<0)
return -EAGAIN;
if(!(isapnp_dev->resource[0].flags & IORESOURCE_IO))
return -ENODEV;
+#if 0
if(!isapnp_dev->ro){
/* override resource */
if(it->options[0] != 0){
isapnp_resource_change(&isapnp_dev->resource[0],
- it->options[0], 1);
+ it->options[0], NI_SIZE);
}
}
+#endif
if(isapnp_dev->activate(isapnp_dev)<0){
printk("isapnp configure failed!\n");
return -ENOMEM;
}
+ break;
+ }
+ if( i == num_ni_boards ) return -ENODEV;
+ *dev = isapnp_dev;
+ return 0;
+#else
+ return -EIO;
+#endif
+}
+
+static int ni_atmio_attach(comedi_device *dev,comedi_devconfig *it)
+{
+ struct pci_dev *isapnp_dev;
+ int ret;
+ int iobase;
+ int board;
+ int irq;
+
+ iobase=it->options[0];
+ irq=it->options[1];
+ isapnp_dev = NULL;
+ if( iobase == 0 )
+ {
+ ret = ni_isapnp_find_board( &isapnp_dev );
+ if( ret < 0 ) return ret;
+
+#ifdef __ISAPNP__
iobase = isapnp_dev->resource[0].start;
irq = isapnp_dev->irq_resource[0].start;
devpriv->isapnp_dev = isapnp_dev;
+#else
+ return -EIO;
#endif
}