1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40#include <linux/module.h>
41
42#include "../comedi_pcmcia.h"
43
44#include "ni_labpc.h"
45
46static const struct labpc_boardinfo labpc_cs_boards[] = {
47 {
48 .name = "daqcard-1200",
49 .ai_speed = 10000,
50 .has_ao = 1,
51 .is_labpc1200 = 1,
52 },
53};
54
55static int labpc_cs_auto_attach(struct comedi_device *dev,
56 unsigned long context)
57{
58 struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
59 int ret;
60
61
62 dev->board_ptr = &labpc_cs_boards[0];
63
64 link->config_flags |= CONF_AUTO_SET_IO |
65 CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
66 ret = comedi_pcmcia_enable(dev, NULL);
67 if (ret)
68 return ret;
69 dev->iobase = link->resource[0]->start;
70
71 if (!link->irq)
72 return -EINVAL;
73
74 return labpc_common_attach(dev, link->irq, IRQF_SHARED);
75}
76
77static void labpc_cs_detach(struct comedi_device *dev)
78{
79 labpc_common_detach(dev);
80 comedi_pcmcia_disable(dev);
81}
82
83static struct comedi_driver driver_labpc_cs = {
84 .driver_name = "ni_labpc_cs",
85 .module = THIS_MODULE,
86 .auto_attach = labpc_cs_auto_attach,
87 .detach = labpc_cs_detach,
88};
89
90static int labpc_cs_attach(struct pcmcia_device *link)
91{
92 return comedi_pcmcia_auto_config(link, &driver_labpc_cs);
93}
94
95static const struct pcmcia_device_id labpc_cs_ids[] = {
96 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0103),
97 PCMCIA_DEVICE_NULL
98};
99MODULE_DEVICE_TABLE(pcmcia, labpc_cs_ids);
100
101static struct pcmcia_driver labpc_cs_driver = {
102 .name = "daqcard-1200",
103 .owner = THIS_MODULE,
104 .id_table = labpc_cs_ids,
105 .probe = labpc_cs_attach,
106 .remove = comedi_pcmcia_auto_unconfig,
107};
108module_comedi_pcmcia_driver(driver_labpc_cs, labpc_cs_driver);
109
110MODULE_DESCRIPTION("Comedi driver for National Instruments Lab-PC");
111MODULE_AUTHOR("Frank Mori Hess <fmhess@users.sourceforge.net>");
112MODULE_LICENSE("GPL");
113