2 * comedi/drivers/ni_labpc.c
3 * Driver for National Instruments Lab-PC series boards and compatibles
4 * Copyright (C) 2001-2003 Frank Mori Hess <fmhess@users.sourceforge.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
19 * Description: National Instruments Lab-PC (& compatibles)
20 * Devices: (National Instruments) Lab-PC-1200 [lab-pc-1200]
21 * (National Instruments) Lab-PC-1200AI [lab-pc-1200ai]
22 * (National Instruments) Lab-PC+ [lab-pc+]
23 * Author: Frank Mori Hess <fmhess@users.sourceforge.net>
26 * Configuration options - ISA boards:
27 * [0] - I/O port base address
28 * [1] - IRQ (optional, required for timed or externally triggered
30 * [2] - DMA channel (optional)
32 * Tested with lab-pc-1200. For the older Lab-PC+, not all input
33 * ranges and analog references will work, the available ranges/arefs
34 * will depend on how you have configured the jumpers on your board
35 * (see your owner's manual).
37 * Kernel-level ISA plug-and-play support for the lab-pc-1200 boards
38 * has not yet been added to the driver, mainly due to the fact that
39 * I don't know the device id numbers. If you have one of these boards,
40 * please file a bug report at http://comedi.org/ so I can get the
41 * necessary information from you.
43 * The 1200 series boards have onboard calibration dacs for correcting
44 * analog input/output offsets and gains. The proper settings for these
45 * caldacs are stored on the board's eeprom. To read the caldac values
46 * from the eeprom and store them into a file that can be then be used
47 * by comedilib, use the comedi_calibrate program.
49 * The Lab-pc+ has quirky chanlist requirements when scanning multiple
50 * channels. Multiple channel scan sequence must start at highest channel,
51 * then decrement down to channel 0. The rest of the cards can scan down
52 * like lab-pc+ or scan up from channel zero. Chanlists consisting of all
53 * one channel are also legal, and allow you to pace conversions in bursts.
56 * 341309a (labpc-1200 register manual)
60 #include <linux/module.h>
62 #include "../comedidev.h"
65 #include "ni_labpc_isadma.h"
67 static const struct labpc_boardinfo labpc_boards[] = {
69 .name = "lab-pc-1200",
75 .name = "lab-pc-1200ai",
86 static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
88 struct labpc_private *devpriv;
89 unsigned int irq = it->options[1];
90 unsigned int dma_chan = it->options[2];
93 devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
97 ret = comedi_request_region(dev, it->options[0], 0x20);
101 ret = labpc_common_attach(dev, irq, 0);
106 labpc_init_dma_chan(dev, dma_chan);
111 static void labpc_detach(struct comedi_device *dev)
113 struct labpc_private *devpriv = dev->private;
116 labpc_free_dma_chan(dev);
118 comedi_legacy_detach(dev);
121 static struct comedi_driver labpc_driver = {
122 .driver_name = "ni_labpc",
123 .module = THIS_MODULE,
124 .attach = labpc_attach,
125 .detach = labpc_detach,
126 .num_names = ARRAY_SIZE(labpc_boards),
127 .board_name = &labpc_boards[0].name,
128 .offset = sizeof(struct labpc_boardinfo),
130 module_comedi_driver(labpc_driver);
132 MODULE_AUTHOR("Comedi http://www.comedi.org");
133 MODULE_DESCRIPTION("Comedi driver for NI Lab-PC ISA boards");
134 MODULE_LICENSE("GPL");