linux/drivers/staging/comedi/drivers/ni_daq_dio24.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24
   4 * Copyright (C) 2002 Daniel Vecino Castel <dvecino@able.es>
   5 *
   6 * PCMCIA crap at end of file is adapted from dummy_cs.c 1.31
   7 * 2001/08/24 12:13:13 from the pcmcia package.
   8 * The initial developer of the pcmcia dummy_cs.c code is David A. Hinds
   9 * <dahinds@users.sourceforge.net>.  Portions created by David A. Hinds
  10 * are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
  11 */
  12
  13/*
  14 * Driver: ni_daq_dio24
  15 * Description: National Instruments PCMCIA DAQ-Card DIO-24
  16 * Author: Daniel Vecino Castel <dvecino@able.es>
  17 * Devices: [National Instruments] PCMCIA DAQ-Card DIO-24 (ni_daq_dio24)
  18 * Status: ?
  19 * Updated: Thu, 07 Nov 2002 21:53:06 -0800
  20 *
  21 * This is just a wrapper around the 8255.o driver to properly handle
  22 * the PCMCIA interface.
  23 */
  24
  25#include <linux/module.h>
  26#include "../comedi_pcmcia.h"
  27
  28#include "8255.h"
  29
  30static int dio24_auto_attach(struct comedi_device *dev,
  31                             unsigned long context)
  32{
  33        struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
  34        struct comedi_subdevice *s;
  35        int ret;
  36
  37        link->config_flags |= CONF_AUTO_SET_IO;
  38        ret = comedi_pcmcia_enable(dev, NULL);
  39        if (ret)
  40                return ret;
  41        dev->iobase = link->resource[0]->start;
  42
  43        ret = comedi_alloc_subdevices(dev, 1);
  44        if (ret)
  45                return ret;
  46
  47        /* 8255 dio */
  48        s = &dev->subdevices[0];
  49        return subdev_8255_init(dev, s, NULL, 0x00);
  50}
  51
  52static struct comedi_driver driver_dio24 = {
  53        .driver_name    = "ni_daq_dio24",
  54        .module         = THIS_MODULE,
  55        .auto_attach    = dio24_auto_attach,
  56        .detach         = comedi_pcmcia_disable,
  57};
  58
  59static int dio24_cs_attach(struct pcmcia_device *link)
  60{
  61        return comedi_pcmcia_auto_config(link, &driver_dio24);
  62}
  63
  64static const struct pcmcia_device_id dio24_cs_ids[] = {
  65        PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c),        /* daqcard-dio24 */
  66        PCMCIA_DEVICE_NULL
  67};
  68MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids);
  69
  70static struct pcmcia_driver dio24_cs_driver = {
  71        .name           = "ni_daq_dio24",
  72        .owner          = THIS_MODULE,
  73        .id_table       = dio24_cs_ids,
  74        .probe          = dio24_cs_attach,
  75        .remove         = comedi_pcmcia_auto_unconfig,
  76};
  77module_comedi_pcmcia_driver(driver_dio24, dio24_cs_driver);
  78
  79MODULE_AUTHOR("Daniel Vecino Castel <dvecino@able.es>");
  80MODULE_DESCRIPTION(
  81        "Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24");
  82MODULE_LICENSE("GPL");
  83