97 #include "../comedidev.h"
116 #define MAX_N_CALDACS 32
121 .name =
"at-mio-16e-1",
124 .ai_fifo_depth = 8192,
130 .ao_fifo_depth = 2048,
131 .ao_range_table = &range_ni_E_ao_ext,
135 .num_p0_dio_channels = 8,
140 .name =
"at-mio-16e-2",
143 .ai_fifo_depth = 2048,
149 .ao_fifo_depth = 2048,
150 .ao_range_table = &range_ni_E_ao_ext,
154 .num_p0_dio_channels = 8,
159 .name =
"at-mio-16e-10",
162 .ai_fifo_depth = 512,
169 .ao_range_table = &range_ni_E_ao_ext,
172 .num_p0_dio_channels = 8,
178 .name =
"at-mio-16de-10",
181 .ai_fifo_depth = 512,
188 .ao_range_table = &range_ni_E_ao_ext,
191 .num_p0_dio_channels = 8,
197 .name =
"at-mio-64e-3",
200 .ai_fifo_depth = 2048,
206 .ao_fifo_depth = 2048,
207 .ao_range_table = &range_ni_E_ao_ext,
211 .num_p0_dio_channels = 8,
216 .name =
"at-mio-16xe-50",
219 .ai_fifo_depth = 512,
229 .num_p0_dio_channels = 8,
235 .name =
"at-mio-16xe-10",
238 .ai_fifo_depth = 512,
244 .ao_fifo_depth = 2048,
245 .ao_range_table = &range_ni_E_ao_ext,
248 .num_p0_dio_channels = 8,
254 .name =
"at-ai-16xe-10",
257 .ai_fifo_depth = 512,
265 .num_p0_dio_channels = 8,
271 static const int ni_irqpin[] = {
272 -1, -1, -1, 0, 1, 2, -1, 3, -1, -1, 4, 5, 6, -1, -1, 7
275 #define interrupt_pin(a) (ni_irqpin[(a)])
277 #define IRQ_POLARITY 0
279 #define NI_E_IRQ_FLAGS 0
287 #define devpriv ((struct ni_private *)dev->private)
291 #define ni_writel(a, b) (outl((a), (b)+dev->iobase))
292 #define ni_readl(a) (inl((a)+dev->iobase))
293 #define ni_writew(a, b) (outw((a), (b)+dev->iobase))
294 #define ni_readw(a) (inw((a)+dev->iobase))
295 #define ni_writeb(a, b) (outb((a), (b)+dev->iobase))
296 #define ni_readb(a) (inb((a)+dev->iobase))
315 spin_unlock_irqrestore(&
devpriv->window_lock, flags);
330 spin_unlock_irqrestore(&
devpriv->window_lock, flags);
336 {.id =
"NIC1900", .driver_data = 0},
337 {.id =
"NIC2400", .driver_data = 0},
338 {.id =
"NIC2500", .driver_data = 0},
339 {.id =
"NIC2600", .driver_data = 0},
340 {.id =
"NIC2700", .driver_data = 0},
348 static int ni_isapnp_find_board(
struct pnp_dev **dev)
364 (
"ni_atmio: %s found but already active, skipping.\n",
372 if (!pnp_port_valid(isapnp_dev, 0)
373 || !pnp_irq_valid(isapnp_dev, 0)) {
375 printk(
"ni_atmio: pnp invalid port or irq, aborting\n");
380 if (i == n_ni_boards)
388 int device_id = ni_read_eeprom(dev, 511);
392 if (ni_boards[i].device_id == device_id)
396 if (device_id == 255)
397 printk(
" can't find board\n");
398 else if (device_id == 0)
399 printk(
" EEPROM read error (?) or device not found\n");
401 printk(
" unknown device ID %d -- contact author\n", device_id);
416 ret = ni_alloc_private(dev);
420 devpriv->stc_writew = &ni_atmio_win_out;
421 devpriv->stc_readw = &ni_atmio_win_in;
422 devpriv->stc_writel = &win_out2;
429 ret = ni_isapnp_find_board(&isapnp_dev);
433 iobase = pnp_port_start(isapnp_dev, 0);
435 devpriv->isapnp_dev = isapnp_dev;
440 printk(
"comedi%d: ni_atmio: 0x%04lx", dev->
minor, iobase);
442 printk(
" I/O port conflict\n");
453 printk(
" board fingerprint:");
454 for (i = 0; i < 16; i += 2) {
463 board = ni_getboardtype(dev);
475 if (irq > 15 || ni_irqpin[irq] == -1) {
476 printk(
" invalid irq %u\n", irq);
479 printk(
" ( irq = %u )", irq);
484 printk(
" irq not available\n");
492 ret = ni_E_init(dev);
502 mio_common_detach(dev);
512 .driver_name =
"ni_atmio",
514 .attach = ni_atmio_attach,
515 .detach = ni_atmio_detach,