// SPDX-License-Identifier: GPL-2.0+ /* * comedi/drivers/ni_daq_700.c * Driver for DAQCard-700 DIO/AI * copied from 8255 * * COMEDI - Linux Control and Measurement Device Interface * Copyright (C) 1998 David A. Schleef <[email protected]> */ /* * Driver: ni_daq_700 * Description: National Instruments PCMCIA DAQCard-700 * Author: Fred Brooks <[email protected]>, * based on ni_daq_dio24 by Daniel Vecino Castel <[email protected]> * Devices: [National Instruments] PCMCIA DAQ-Card-700 (ni_daq_700) * Status: works * Updated: Wed, 21 May 2014 12:07:20 +0000 * * The daqcard-700 appears in Comedi as a digital I/O subdevice (0) with * 16 channels and a analog input subdevice (1) with 16 single-ended channels * or 8 differential channels, and three input ranges. * * Digital: The channel 0 corresponds to the daqcard-700's output * port, bit 0; channel 8 corresponds to the input port, bit 0. * * Digital direction configuration: channels 0-7 output, 8-15 input. * * Analog: The input range is 0 to 4095 with a default of -10 to +10 volts. * Valid ranges: * 0 for -10 to 10V bipolar * 1 for -5 to 5V bipolar * 2 for -2.5 to 2.5V bipolar * * IRQ is assigned but not used. * * Manuals: Register level: https://www.ni.com/pdf/manuals/340698.pdf * User Manual: https://www.ni.com/pdf/manuals/320676d.pdf */ #include <linux/module.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/comedi/comedi_pcmcia.h> /* daqcard700 registers */ #define DIO_W … #define DIO_R … #define CMD_R1 … #define CMD_R2 … #define CMD_R3 … #define STA_R1 … #define STA_R2 … #define ADFIFO_R … #define ADCLEAR_R … #define CDA_R0 … #define CDA_R1 … #define CDA_R2 … #define CMO_R … #define TIC_R … /* daqcard700 modes */ #define CMD_R3_DIFF … static const struct comedi_lrange range_daq700_ai = …; static int daq700_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { … } static int daq700_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { … } static int daq700_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned long context) { … } static int daq700_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { … } /* * Data acquisition is enabled. * The counter 0 output is high. * The I/O connector pin CLK1 drives counter 1 source. * Multiple-channel scanning is disabled. * All interrupts are disabled. * The analog input range is set to +-10 V * The analog input mode is single-ended. * The analog input circuitry is initialized to channel 0. * The A/D FIFO is cleared. */ static void daq700_ai_config(struct comedi_device *dev, struct comedi_subdevice *s) { … } static int daq700_auto_attach(struct comedi_device *dev, unsigned long context) { … } static struct comedi_driver daq700_driver = …; static int daq700_cs_attach(struct pcmcia_device *link) { … } static const struct pcmcia_device_id daq700_cs_ids[] = …; MODULE_DEVICE_TABLE(pcmcia, daq700_cs_ids); static struct pcmcia_driver daq700_cs_driver = …; module_comedi_pcmcia_driver(…); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;