1 // SPDX-License-Identifier: GPL-2.0+
3 * comedi/drivers/ni_labpc.c
4 * Driver for National Instruments Lab-PC series boards and compatibles
5 * Copyright (C) 2001-2003 Frank Mori Hess <fmhess@users.sourceforge.net>
10 * Description: National Instruments Lab-PC (& compatibles)
11 * Devices: [National Instruments] Lab-PC-1200 (lab-pc-1200),
12 * Lab-PC-1200AI (lab-pc-1200ai), Lab-PC+ (lab-pc+)
13 * Author: Frank Mori Hess <fmhess@users.sourceforge.net>
16 * Configuration options - ISA boards:
17 * [0] - I/O port base address
18 * [1] - IRQ (optional, required for timed or externally triggered
20 * [2] - DMA channel (optional)
22 * Tested with lab-pc-1200. For the older Lab-PC+, not all input
23 * ranges and analog references will work, the available ranges/arefs
24 * will depend on how you have configured the jumpers on your board
25 * (see your owner's manual).
27 * Kernel-level ISA plug-and-play support for the lab-pc-1200 boards
28 * has not yet been added to the driver, mainly due to the fact that
29 * I don't know the device id numbers. If you have one of these boards,
30 * please file a bug report at https://comedi.org/ so I can get the
31 * necessary information from you.
33 * The 1200 series boards have onboard calibration dacs for correcting
34 * analog input/output offsets and gains. The proper settings for these
35 * caldacs are stored on the board's eeprom. To read the caldac values
36 * from the eeprom and store them into a file that can be then be used
37 * by comedilib, use the comedi_calibrate program.
39 * The Lab-pc+ has quirky chanlist requirements when scanning multiple
40 * channels. Multiple channel scan sequence must start at highest channel,
41 * then decrement down to channel 0. The rest of the cards can scan down
42 * like lab-pc+ or scan up from channel zero. Chanlists consisting of all
43 * one channel are also legal, and allow you to pace conversions in bursts.
46 * 341309a (labpc-1200 register manual)
50 #include <linux/module.h>
52 #include "../comedidev.h"
55 #include "ni_labpc_isadma.h"
57 static const struct labpc_boardinfo labpc_boards[] = {
59 .name = "lab-pc-1200",
65 .name = "lab-pc-1200ai",
76 static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
78 unsigned int irq = it->options[1];
79 unsigned int dma_chan = it->options[2];
82 ret = comedi_request_region(dev, it->options[0], 0x20);
86 ret = labpc_common_attach(dev, irq, 0);
91 labpc_init_dma_chan(dev, dma_chan);
96 static void labpc_detach(struct comedi_device *dev)
98 labpc_free_dma_chan(dev);
99 labpc_common_detach(dev);
100 comedi_legacy_detach(dev);
103 static struct comedi_driver labpc_driver = {
104 .driver_name = "ni_labpc",
105 .module = THIS_MODULE,
106 .attach = labpc_attach,
107 .detach = labpc_detach,
108 .num_names = ARRAY_SIZE(labpc_boards),
109 .board_name = &labpc_boards[0].name,
110 .offset = sizeof(struct labpc_boardinfo),
112 module_comedi_driver(labpc_driver);
114 MODULE_AUTHOR("Comedi https://www.comedi.org");
115 MODULE_DESCRIPTION("Comedi driver for NI Lab-PC ISA boards");
116 MODULE_LICENSE("GPL");