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