// SPDX-License-Identifier: GPL-2.0+ /* * Comedi driver for NI PCI-MIO E series cards * * COMEDI - Linux Control and Measurement Device Interface * Copyright (C) 1997-8 David A. Schleef <[email protected]> */ /* * Driver: ni_pcimio * Description: National Instruments PCI-MIO-E series and M series (all boards) * Author: ds, John Hallen, Frank Mori Hess, Rolf Mueller, Herbert Peremans, * Herman Bruyninckx, Terry Barnaby * Status: works * Devices: [National Instruments] PCI-MIO-16XE-50 (ni_pcimio), * PCI-MIO-16XE-10, PXI-6030E, PCI-MIO-16E-1, PCI-MIO-16E-4, PCI-6014, * PCI-6040E, PXI-6040E, PCI-6030E, PCI-6031E, PCI-6032E, PCI-6033E, * PCI-6071E, PCI-6023E, PCI-6024E, PCI-6025E, PXI-6025E, PCI-6034E, * PCI-6035E, PCI-6052E, PCI-6110, PCI-6111, PCI-6220, PXI-6220, * PCI-6221, PXI-6221, PCI-6224, PXI-6224, PCI-6225, PXI-6225, * PCI-6229, PXI-6229, PCI-6250, PXI-6250, PCI-6251, PXI-6251, * PCIe-6251, PXIe-6251, PCI-6254, PXI-6254, PCI-6259, PXI-6259, * PCIe-6259, PXIe-6259, PCI-6280, PXI-6280, PCI-6281, PXI-6281, * PCI-6284, PXI-6284, PCI-6289, PXI-6289, PCI-6711, PXI-6711, * PCI-6713, PXI-6713, PXI-6071E, PCI-6070E, PXI-6070E, * PXI-6052E, PCI-6036E, PCI-6731, PCI-6733, PXI-6733, * PCI-6143, PXI-6143 * Updated: Mon, 16 Jan 2017 12:56:04 +0000 * * These boards are almost identical to the AT-MIO E series, except that * they use the PCI bus instead of ISA (i.e., AT). See the notes for the * ni_atmio.o driver for additional information about these boards. * * Autocalibration is supported on many of the devices, using the * comedi_calibrate (or comedi_soft_calibrate for m-series) utility. * M-Series boards do analog input and analog output calibration entirely * in software. The software calibration corrects the analog input for * offset, gain and nonlinearity. The analog outputs are corrected for * offset and gain. See the comedilib documentation on * comedi_get_softcal_converter() for more information. * * By default, the driver uses DMA to transfer analog input data to * memory. When DMA is enabled, not all triggering features are * supported. * * Digital I/O may not work on 673x. * * Note that the PCI-6143 is a simultaineous sampling device with 8 * convertors. With this board all of the convertors perform one * simultaineous sample during a scan interval. The period for a scan * is used for the convert time in a Comedi cmd. The convert trigger * source is normally set to TRIG_NOW by default. * * The RTSI trigger bus is supported on these cards on subdevice 10. * See the comedilib documentation for details. * * Information (number of channels, bits, etc.) for some devices may be * incorrect. Please check this and submit a bug if there are problems * for your device. * * SCXI is probably broken for m-series boards. * * Bugs: * - When DMA is enabled, COMEDI_EV_CONVERT does not work correctly. */ /* * The PCI-MIO E series driver was originally written by * Tomasz Motylewski <...>, and ported to comedi by ds. * * References: * 341079b.pdf PCI E Series Register-Level Programmer Manual * 340934b.pdf DAQ-STC reference manual * * 322080b.pdf 6711/6713/6715 User Manual * * 320945c.pdf PCI E Series User Manual * 322138a.pdf PCI-6052E and DAQPad-6052E User Manual * * ISSUES: * - need to deal with external reference for DAC, and other DAC * properties in board properties * - deal with at-mio-16de-10 revision D to N changes, etc. * - need to add other CALDAC type * - need to slow down DAC loading. I don't trust NI's claim that * two writes to the PCI bus slows IO enough. I would prefer to * use udelay(). * Timing specs: (clock) * AD8522 30ns * DAC8043 120ns * DAC8800 60ns * MB88341 ? */ #include <linux/module.h> #include <linux/delay.h> #include <linux/comedi/comedi_pci.h> #include <asm/byteorder.h> #include "ni_stc.h" #include "mite.h" #define PCIDMA static const struct comedi_lrange range_ni_E_ao_ext = …; /* * These are not all the possible ao ranges for 628x boards. * They can do OFFSET +- REFERENCE where OFFSET can be * 0V, 5V, APFI<0,1>, or AO<0...3> and RANGE can * be 10V, 5V, 2V, 1V, APFI<0,1>, AO<0...3>. That's * 63 different possibilities. An AO channel * can not act as it's own OFFSET or REFERENCE. */ static const struct comedi_lrange range_ni_M_628x_ao = …; static const struct comedi_lrange range_ni_M_625x_ao = …; enum ni_pcimio_boardid { … }; static const struct ni_board_struct ni_boards[] = …; #include "ni_mio_common.c" static int pcimio_ai_change(struct comedi_device *dev, struct comedi_subdevice *s) { … } static int pcimio_ao_change(struct comedi_device *dev, struct comedi_subdevice *s) { … } static int pcimio_gpct0_change(struct comedi_device *dev, struct comedi_subdevice *s) { … } static int pcimio_gpct1_change(struct comedi_device *dev, struct comedi_subdevice *s) { … } static int pcimio_dio_change(struct comedi_device *dev, struct comedi_subdevice *s) { … } static void m_series_init_eeprom_buffer(struct comedi_device *dev) { … } static void init_6143(struct comedi_device *dev) { … } static void pcimio_detach(struct comedi_device *dev) { … } static int pcimio_auto_attach(struct comedi_device *dev, unsigned long context) { … } static struct comedi_driver ni_pcimio_driver = …; static int ni_pcimio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { … } static const struct pci_device_id ni_pcimio_pci_table[] = …; MODULE_DEVICE_TABLE(pci, ni_pcimio_pci_table); static struct pci_driver ni_pcimio_pci_driver = …; module_comedi_pci_driver(…); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;