1 // SPDX-License-Identifier: GPL-2.0+
3 * Driver for National Instruments daqcard-1200 boards
4 * Copyright (C) 2001, 2002, 2003 Frank Mori Hess <fmhess@users.sourceforge.net>
6 * PCMCIA crap is adapted from dummy_cs.c 1.31 2001/08/24 12:13:13
7 * 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.
15 * Description: National Instruments Lab-PC (& compatibles)
16 * Author: Frank Mori Hess <fmhess@users.sourceforge.net>
17 * Devices: [National Instruments] DAQCard-1200 (daqcard-1200)
20 * Thanks go to Fredrik Lingvall for much testing and perseverance in
21 * helping to debug daqcard-1200 support.
23 * The 1200 series boards have onboard calibration dacs for correcting
24 * analog input/output offsets and gains. The proper settings for these
25 * caldacs are stored on the board's eeprom. To read the caldac values
26 * from the eeprom and store them into a file that can be then be used by
27 * comedilib, use the comedi_calibrate program.
29 * Configuration options: none
31 * The daqcard-1200 has quirky chanlist requirements when scanning multiple
32 * channels. Multiple channel scan sequence must start at highest channel,
33 * then decrement down to channel 0. Chanlists consisting of all one channel
34 * are also legal, and allow you to pace conversions in bursts.
37 * 340988a (daqcard-1200)
40 #include <linux/module.h>
42 #include "../comedi_pcmcia.h"
46 static const struct labpc_boardinfo labpc_cs_boards[] = {
48 .name = "daqcard-1200",
55 static int labpc_cs_auto_attach(struct comedi_device *dev,
56 unsigned long context)
58 struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
61 /* The ni_labpc driver needs the board_ptr */
62 dev->board_ptr = &labpc_cs_boards[0];
64 link->config_flags |= CONF_AUTO_SET_IO |
65 CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
66 ret = comedi_pcmcia_enable(dev, NULL);
69 dev->iobase = link->resource[0]->start;
74 return labpc_common_attach(dev, link->irq, IRQF_SHARED);
77 static void labpc_cs_detach(struct comedi_device *dev)
79 labpc_common_detach(dev);
80 comedi_pcmcia_disable(dev);
83 static struct comedi_driver driver_labpc_cs = {
84 .driver_name = "ni_labpc_cs",
85 .module = THIS_MODULE,
86 .auto_attach = labpc_cs_auto_attach,
87 .detach = labpc_cs_detach,
90 static int labpc_cs_attach(struct pcmcia_device *link)
92 return comedi_pcmcia_auto_config(link, &driver_labpc_cs);
95 static const struct pcmcia_device_id labpc_cs_ids[] = {
96 PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0103), /* daqcard-1200 */
99 MODULE_DEVICE_TABLE(pcmcia, labpc_cs_ids);
101 static struct pcmcia_driver labpc_cs_driver = {
102 .name = "daqcard-1200",
103 .owner = THIS_MODULE,
104 .id_table = labpc_cs_ids,
105 .probe = labpc_cs_attach,
106 .remove = comedi_pcmcia_auto_unconfig,
108 module_comedi_pcmcia_driver(driver_labpc_cs, labpc_cs_driver);
110 MODULE_DESCRIPTION("Comedi driver for National Instruments Lab-PC");
111 MODULE_AUTHOR("Frank Mori Hess <fmhess@users.sourceforge.net>");
112 MODULE_LICENSE("GPL");