root/drivers/staging/comedi/drivers/amplc_pc236.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. pc236_attach

   1 // SPDX-License-Identifier: GPL-2.0+
   2 /*
   3  * comedi/drivers/amplc_pc236.c
   4  * Driver for Amplicon PC36AT DIO boards.
   5  *
   6  * Copyright (C) 2002 MEV Ltd. <http://www.mev.co.uk/>
   7  *
   8  * COMEDI - Linux Control and Measurement Device Interface
   9  * Copyright (C) 2000 David A. Schleef <ds@schleef.org>
  10  */
  11 /*
  12  * Driver: amplc_pc236
  13  * Description: Amplicon PC36AT
  14  * Author: Ian Abbott <abbotti@mev.co.uk>
  15  * Devices: [Amplicon] PC36AT (pc36at)
  16  * Updated: Fri, 25 Jul 2014 15:32:40 +0000
  17  * Status: works
  18  *
  19  * Configuration options - PC36AT:
  20  *   [0] - I/O port base address
  21  *   [1] - IRQ (optional)
  22  *
  23  * The PC36AT board has a single 8255 appearing as subdevice 0.
  24  *
  25  * Subdevice 1 pretends to be a digital input device, but it always returns
  26  * 0 when read. However, if you run a command with scan_begin_src=TRIG_EXT,
  27  * a rising edge on port C bit 3 acts as an external trigger, which can be
  28  * used to wake up tasks.  This is like the comedi_parport device, but the
  29  * only way to physically disable the interrupt on the PC36AT is to remove
  30  * the IRQ jumper.  If no interrupt is connected, then subdevice 1 is
  31  * unused.
  32  */
  33 
  34 #include <linux/module.h>
  35 
  36 #include "../comedidev.h"
  37 
  38 #include "amplc_pc236.h"
  39 
  40 static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
  41 {
  42         struct pc236_private *devpriv;
  43         int ret;
  44 
  45         devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
  46         if (!devpriv)
  47                 return -ENOMEM;
  48 
  49         ret = comedi_request_region(dev, it->options[0], 0x4);
  50         if (ret)
  51                 return ret;
  52 
  53         return amplc_pc236_common_attach(dev, dev->iobase, it->options[1], 0);
  54 }
  55 
  56 static const struct pc236_board pc236_boards[] = {
  57         {
  58                 .name = "pc36at",
  59         },
  60 };
  61 
  62 static struct comedi_driver amplc_pc236_driver = {
  63         .driver_name = "amplc_pc236",
  64         .module = THIS_MODULE,
  65         .attach = pc236_attach,
  66         .detach = comedi_legacy_detach,
  67         .board_name = &pc236_boards[0].name,
  68         .offset = sizeof(struct pc236_board),
  69         .num_names = ARRAY_SIZE(pc236_boards),
  70 };
  71 
  72 module_comedi_driver(amplc_pc236_driver);
  73 
  74 MODULE_AUTHOR("Comedi http://www.comedi.org");
  75 MODULE_DESCRIPTION("Comedi driver for Amplicon PC36AT DIO boards");
  76 MODULE_LICENSE("GPL");

/* [<][>][^][v][top][bottom][index][help] */