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