Version:  2.0.40 2.2.26 2.4.37 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16

Linux/drivers/staging/comedi/drivers/das08_pci.c

  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.
 19  */
 20 
 21 /*
 22  * Driver: das08_pci
 23  * Description: DAS-08 PCI compatible boards
 24  * Devices: (ComputerBoards) PCI-DAS08 [pci-das08]
 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 
 34 #include <linux/module.h>
 35 #include <linux/pci.h>
 36 
 37 #include "../comedidev.h"
 38 
 39 #include "das08.h"
 40 
 41 #define PCI_DEVICE_ID_PCIDAS08          0x0029
 42 
 43 static const struct das08_board_struct das08_pci_boards[] = {
 44         {
 45                 .name           = "pci-das08",
 46                 .ai_nbits       = 12,
 47                 .ai_pg          = das08_bipolar5,
 48                 .ai_encoding    = das08_encode12,
 49                 .di_nchan       = 3,
 50                 .do_nchan       = 4,
 51                 .i8254_offset   = 4,
 52                 .iosize         = 8,
 53         },
 54 };
 55 
 56 static int das08_pci_auto_attach(struct comedi_device *dev,
 57                                  unsigned long context_unused)
 58 {
 59         struct pci_dev *pdev = comedi_to_pci_dev(dev);
 60         struct das08_private_struct *devpriv;
 61         int ret;
 62 
 63         devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
 64         if (!devpriv)
 65                 return -ENOMEM;
 66 
 67         /* The das08 driver needs the board_ptr */
 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 
 78 static 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 
 85 static 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 
 92 static const struct pci_device_id das08_pci_table[] = {
 93         { PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_DEVICE_ID_PCIDAS08) },
 94         { 0 }
 95 };
 96 MODULE_DEVICE_TABLE(pci, das08_pci_table);
 97 
 98 static 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 };
104 module_comedi_pci_driver(das08_pci_comedi_driver, das08_pci_driver);
105 
106 MODULE_AUTHOR("Comedi http://www.comedi.org");
107 MODULE_DESCRIPTION("Comedi low-level driver");
108 MODULE_LICENSE("GPL");
109 

This page was automatically generated by LXR 0.3.1 (source).  •  Linux is a registered trademark of Linus Torvalds  •  Contact us