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#include <linux/module.h>
35#include "../comedi_pcmcia.h"
36
37#include "8255.h"
38
39static int dio24_auto_attach(struct comedi_device *dev,
40 unsigned long context)
41{
42 struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
43 struct comedi_subdevice *s;
44 int ret;
45
46 link->config_flags |= CONF_AUTO_SET_IO;
47 ret = comedi_pcmcia_enable(dev, NULL);
48 if (ret)
49 return ret;
50 dev->iobase = link->resource[0]->start;
51
52 ret = comedi_alloc_subdevices(dev, 1);
53 if (ret)
54 return ret;
55
56
57 s = &dev->subdevices[0];
58 ret = subdev_8255_init(dev, s, NULL, 0x00);
59 if (ret)
60 return ret;
61
62 return 0;
63}
64
65static struct comedi_driver driver_dio24 = {
66 .driver_name = "ni_daq_dio24",
67 .module = THIS_MODULE,
68 .auto_attach = dio24_auto_attach,
69 .detach = comedi_pcmcia_disable,
70};
71
72static int dio24_cs_attach(struct pcmcia_device *link)
73{
74 return comedi_pcmcia_auto_config(link, &driver_dio24);
75}
76
77static const struct pcmcia_device_id dio24_cs_ids[] = {
78 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c),
79 PCMCIA_DEVICE_NULL
80};
81MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids);
82
83static struct pcmcia_driver dio24_cs_driver = {
84 .name = "ni_daq_dio24",
85 .owner = THIS_MODULE,
86 .id_table = dio24_cs_ids,
87 .probe = dio24_cs_attach,
88 .remove = comedi_pcmcia_auto_unconfig,
89};
90module_comedi_pcmcia_driver(driver_dio24, dio24_cs_driver);
91
92MODULE_AUTHOR("Daniel Vecino Castel <dvecino@able.es>");
93MODULE_DESCRIPTION(
94 "Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24");
95MODULE_LICENSE("GPL");
96