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/pci.h>
35
36#include "../comedidev.h"
37
38#include "das08.h"
39
40#define PCI_DEVICE_ID_PCIDAS08 0x0029
41
42static const struct das08_board_struct das08_pci_boards[] = {
43 {
44 .name = "pci-das08",
45 .ai_nbits = 12,
46 .ai_pg = das08_bipolar5,
47 .ai_encoding = das08_encode12,
48 .di_nchan = 3,
49 .do_nchan = 4,
50 .i8254_offset = 4,
51 .iosize = 8,
52 },
53};
54
55static int das08_pci_auto_attach(struct comedi_device *dev,
56 unsigned long context_unused)
57{
58 struct pci_dev *pdev = comedi_to_pci_dev(dev);
59 struct das08_private_struct *devpriv;
60 int ret;
61
62 devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
63 if (!devpriv)
64 return -ENOMEM;
65 dev->private = devpriv;
66
67
68 dev->board_ptr = &das08_pci_boards[0];
69
70 ret = comedi_pci_enable(dev);
71 if (ret)
72 return ret;
73 dev->iobase = pci_resource_start(pdev, 2);
74
75 return das08_common_attach(dev, dev->iobase);
76}
77
78static struct comedi_driver das08_pci_comedi_driver = {
79 .driver_name = "pci-das08",
80 .module = THIS_MODULE,
81 .auto_attach = das08_pci_auto_attach,
82 .detach = comedi_pci_disable,
83};
84
85static int das08_pci_probe(struct pci_dev *dev,
86 const struct pci_device_id *id)
87{
88 return comedi_pci_auto_config(dev, &das08_pci_comedi_driver,
89 id->driver_data);
90}
91
92static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = {
93 { PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_PCIDAS08) },
94 { 0 }
95};
96MODULE_DEVICE_TABLE(pci, das08_pci_table);
97
98static struct pci_driver das08_pci_driver = {
99 .name = "pci-das08",
100 .id_table = das08_pci_table,
101 .probe = das08_pci_probe,
102 .remove = comedi_pci_auto_unconfig,
103};
104module_comedi_pci_driver(das08_pci_comedi_driver, das08_pci_driver);
105
106MODULE_AUTHOR("Comedi http://www.comedi.org");
107MODULE_DESCRIPTION("Comedi low-level driver");
108MODULE_LICENSE("GPL");
109