staging: comedi: comedi_test: use unsigned int for waveform timing
[linux-2.6-block.git] / drivers / staging / comedi / drivers / das08_pci.c
CommitLineData
f91f9bea
HS
1/*
2 * das08_pci.c
3 * comedi driver for DAS08 PCI boards
4 *
5 * COMEDI - Linux Control and Measurement Device Interface
6 * Copyright (C) 2000 David A. Schleef <ds@schleef.org>
7 * Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net>
8 * Copyright (C) 2004 Salvador E. Tropea <set@users.sf.net> <set@ieee.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
f91f9bea
HS
19 */
20
21/*
22 * Driver: das08_pci
23 * Description: DAS-08 PCI compatible boards
7ba7eea0 24 * Devices: [ComputerBoards] PCI-DAS08 (pci-das08)
f91f9bea
HS
25 * Author: Warren Jasper, ds, Frank Hess
26 * Updated: Fri, 31 Aug 2012 19:19:06 +0100
27 * Status: works
28 *
29 * This is the PCI-specific support split off from the das08 driver.
30 *
31 * Configuration Options: not applicable, uses PCI auto config
32 */
33
ce157f80 34#include <linux/module.h>
f91f9bea 35
0483a811 36#include "../comedi_pci.h"
f91f9bea
HS
37
38#include "das08.h"
39
f91f9bea
HS
40static const struct das08_board_struct das08_pci_boards[] = {
41 {
42 .name = "pci-das08",
f91f9bea
HS
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
0bdab509 60 devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
f91f9bea
HS
61 if (!devpriv)
62 return -ENOMEM;
f91f9bea
HS
63
64 /* The das08 driver needs the board_ptr */
65 dev->board_ptr = &das08_pci_boards[0];
66
818f569f 67 ret = comedi_pci_enable(dev);
f91f9bea
HS
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
f91f9bea
HS
75static struct comedi_driver das08_pci_comedi_driver = {
76 .driver_name = "pci-das08",
77 .module = THIS_MODULE,
78 .auto_attach = das08_pci_auto_attach,
aac307f9 79 .detach = comedi_pci_detach,
f91f9bea
HS
80};
81
82static int das08_pci_probe(struct pci_dev *dev,
b8f4ac23 83 const struct pci_device_id *id)
f91f9bea 84{
b8f4ac23
HS
85 return comedi_pci_auto_config(dev, &das08_pci_comedi_driver,
86 id->driver_data);
f91f9bea
HS
87}
88
41e043fc 89static const struct pci_device_id das08_pci_table[] = {
472cd3db 90 { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0029) },
f91f9bea
HS
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");