// SPDX-License-Identifier: GPL-2.0+ /* * COMEDI driver for Advantech PCI-1720U * Copyright (c) 2015 H Hartley Sweeten <[email protected]> * * Separated from the adv_pci1710 driver written by: * Michal Dobes <[email protected]> * * COMEDI - Linux Control and Measurement Device Interface * Copyright (C) 2000 David A. Schleef <[email protected]> */ /* * Driver: adv_pci1720 * Description: 4-channel Isolated D/A Output board * Devices: [Advantech] PCI-7120U (adv_pci1720) * Author: H Hartley Sweeten <[email protected]> * Updated: Fri, 29 Oct 2015 17:19:35 -0700 * Status: untested * * Configuration options: not applicable, uses PCI auto config * * The PCI-1720 has 4 isolated 12-bit analog output channels with multiple * output ranges. It also has a BoardID switch to allow differentiating * multiple boards in the system. * * The analog outputs can operate in two modes, immediate and synchronized. * This driver currently does not support the synchronized output mode. * * Jumpers JP1 to JP4 are used to set the current sink ranges for each * analog output channel. In order to use the current sink ranges, the * unipolar 5V range must be used. The voltage output and sink output for * each channel is available on the connector as separate pins. * * Jumper JP5 controls the "hot" reset state of the analog outputs. * Depending on its setting, the analog outputs will either keep the * last settings and output values or reset to the default state after * a "hot" reset. The default state for all channels is uniploar 5V range * and all the output values are 0V. To allow this feature to work, the * analog outputs are not "reset" when the driver attaches. */ #include <linux/module.h> #include <linux/delay.h> #include <linux/comedi/comedi_pci.h> /* * PCI BAR2 Register map (dev->iobase) */ #define PCI1720_AO_LSB_REG(x) … #define PCI1720_AO_MSB_REG(x) … #define PCI1720_AO_RANGE_REG … #define PCI1720_AO_RANGE(c, r) … #define PCI1720_AO_RANGE_MASK(c) … #define PCI1720_SYNC_REG … #define PCI1720_SYNC_CTRL_REG … #define PCI1720_SYNC_CTRL_SC0 … #define PCI1720_BOARDID_REG … static const struct comedi_lrange pci1720_ao_range = …; static int pci1720_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { … } static int pci1720_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { … } static int pci1720_auto_attach(struct comedi_device *dev, unsigned long context) { … } static struct comedi_driver adv_pci1720_driver = …; static int adv_pci1720_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { … } static const struct pci_device_id adv_pci1720_pci_table[] = …; MODULE_DEVICE_TABLE(pci, adv_pci1720_pci_table); static struct pci_driver adv_pci1720_pci_driver = …; module_comedi_pci_driver(…); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;