44 #include "../comedidev.h"
65 #define MAX_N_CALDACS 32
69 .name =
"DAQCard-ai-16xe-50",
72 .ai_fifo_depth = 1024,
80 .num_p0_dio_channels = 8,
85 .name =
"DAQCard-ai-16e-4",
88 .ai_fifo_depth = 1024,
96 .num_p0_dio_channels = 8,
100 {.device_id = 0x02c4,
101 .name =
"DAQCard-6062E",
104 .ai_fifo_depth = 8192,
110 .ao_fifo_depth = 2048,
114 .num_p0_dio_channels = 8,
118 {.device_id = 0x075e,
119 .name =
"DAQCard-6024E",
122 .ai_fifo_depth = 1024,
132 .num_p0_dio_channels = 8,
136 {.device_id = 0x0245,
137 .name =
"DAQCard-6036E",
140 .ai_fifo_depth = 1024,
150 .num_p0_dio_channels = 8,
155 {.device_id = 0x0000,
156 .name =
"DAQCard-6715",
161 .num_p0_dio_channels = 8,
168 #define interrupt_pin(a) 0
170 #define IRQ_POLARITY 1
172 #define NI_E_IRQ_FLAGS IRQF_SHARED
180 #define devpriv ((struct ni_private *)dev->private)
184 #define ni_writel(a, b) (outl((a), (b)+dev->iobase))
185 #define ni_readl(a) (inl((a)+dev->iobase))
186 #define ni_writew(a, b) (outw((a), (b)+dev->iobase))
187 #define ni_readw(a) (inw((a)+dev->iobase))
188 #define ni_writeb(a, b) (outb((a), (b)+dev->iobase))
189 #define ni_readb(a) (inb((a)+dev->iobase))
208 spin_unlock_irqrestore(&
devpriv->window_lock, flags);
223 spin_unlock_irqrestore(&
devpriv->window_lock, flags);
232 .driver_name =
"ni_mio_cs",
234 .attach = mio_cs_attach,
235 .detach = mio_cs_detach,
241 struct pcmcia_device *
link);
245 mio_common_detach(dev);
250 static void mio_cs_config(
struct pcmcia_device *
link);
251 static void cs_release(
struct pcmcia_device *
link);
252 static void cs_detach(
struct pcmcia_device *);
254 static struct pcmcia_device *cur_dev =
NULL;
256 static int cs_attach(
struct pcmcia_device *
link)
265 static void cs_release(
struct pcmcia_device *
link)
270 static void cs_detach(
struct pcmcia_device *
link)
275 static int mio_cs_suspend(
struct pcmcia_device *
link)
282 static int mio_cs_resume(
struct pcmcia_device *
link)
289 static int mio_pcmcia_config_loop(
struct pcmcia_device *p_dev,
void *priv_data)
293 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
294 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
296 for (base = 0x000; base < 0x400; base += 0x20) {
297 p_dev->resource[0]->start = base;
306 static void mio_cs_config(
struct pcmcia_device *
link)
310 DPRINTK(
"mio_cs_config(link=%p)\n", link);
311 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
313 ret = pcmcia_loop_config(link, mio_pcmcia_config_loop,
NULL);
315 dev_warn(&link->dev,
"no configuration found\n");
320 dev_info(&link->dev,
"no IRQ available\n");
327 struct pcmcia_device *
link;
331 DPRINTK(
"mio_cs_attach(dev=%p,it=%p)\n", dev, it);
337 dev->
driver = &driver_ni_mio_cs;
338 dev->
iobase = link->resource[0]->start;
342 printk(
"comedi%d: %s: DAQCard: io 0x%04lx, irq %u, ",
349 printk(
" board fingerprint:");
350 for (i = 0; i < 32; i += 2) {
355 printk(
" board fingerprint (windowed):");
356 for (i = 0; i < 10; i++)
357 printk(
" 0x%04x", win_in(i));
362 dev->
board_ptr = ni_boards + ni_getboardtype(dev, link);
370 printk(
" irq not available\n");
376 ret = ni_alloc_private(dev);
380 devpriv->stc_writew = &mio_cs_win_out;
381 devpriv->stc_readw = &mio_cs_win_in;
382 devpriv->stc_writel = &win_out2;
385 ret = ni_E_init(dev);
394 struct pcmcia_device *link)
399 if (ni_boards[i].
device_id == link->card_id)
403 printk(
"unknown board 0x%04x -- pretend it is a ", link->card_id);
411 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010d),
412 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010c),
413 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x02c4),
414 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x075e),
415 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0245),
424 static struct pcmcia_driver ni_mio_cs_driver = {
426 .remove = &cs_detach,
427 .suspend = &mio_cs_suspend,
428 .resume = &mio_cs_resume,
429 .id_table = ni_mio_cs_ids,
445 while (cur_dev !=
NULL)
446 cs_detach(cur_dev->handle);