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 * Lab-PC-1200AI (lab-pc-1200ai), Lab-PC+ (lab-pc+)
22 * Author: Frank Mori Hess <fmhess@users.sourceforge.net>
25 * Configuration options - ISA boards:
26 * [0] - I/O port base address
27 * [1] - IRQ (optional, required for timed or externally triggered
29 * [2] - DMA channel (optional)
31 * Tested with lab-pc-1200. For the older Lab-PC+, not all input
32 * ranges and analog references will work, the available ranges/arefs
33 * will depend on how you have configured the jumpers on your board
34 * (see your owner's manual).
36 * Kernel-level ISA plug-and-play support for the lab-pc-1200 boards
37 * has not yet been added to the driver, mainly due to the fact that
38 * I don't know the device id numbers. If you have one of these boards,
39 * please file a bug report at http://comedi.org/ so I can get the
40 * necessary information from you.
42 * The 1200 series boards have onboard calibration dacs for correcting
43 * analog input/output offsets and gains. The proper settings for these
44 * caldacs are stored on the board's eeprom. To read the caldac values
45 * from the eeprom and store them into a file that can be then be used
46 * by comedilib, use the comedi_calibrate program.
48 * The Lab-pc+ has quirky chanlist requirements when scanning multiple
49 * channels. Multiple channel scan sequence must start at highest channel,
50 * then decrement down to channel 0. The rest of the cards can scan down
51 * like lab-pc+ or scan up from channel zero. Chanlists consisting of all
52 * one channel are also legal, and allow you to pace conversions in bursts.
55 * 341309a (labpc-1200 register manual)
59 #include <linux/module.h>
61 #include "../comedidev.h"
64 #include "ni_labpc_isadma.h"
66 static const struct labpc_boardinfo labpc_boards[] = {
68 .name = "lab-pc-1200",
74 .name = "lab-pc-1200ai",
85 static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
87 unsigned int irq = it->options[1];
88 unsigned int dma_chan = it->options[2];
91 ret = comedi_request_region(dev, it->options[0], 0x20);
95 ret = labpc_common_attach(dev, irq, 0);
100 labpc_init_dma_chan(dev, dma_chan);
105 static void labpc_detach(struct comedi_device *dev)
107 labpc_free_dma_chan(dev);
108 labpc_common_detach(dev);
109 comedi_legacy_detach(dev);
112 static struct comedi_driver labpc_driver = {
113 .driver_name = "ni_labpc",
114 .module = THIS_MODULE,
115 .attach = labpc_attach,
116 .detach = labpc_detach,
117 .num_names = ARRAY_SIZE(labpc_boards),
118 .board_name = &labpc_boards[0].name,
119 .offset = sizeof(struct labpc_boardinfo),
121 module_comedi_driver(labpc_driver);
123 MODULE_AUTHOR("Comedi http://www.comedi.org");
124 MODULE_DESCRIPTION("Comedi driver for NI Lab-PC ISA boards");
125 MODULE_LICENSE("GPL");