linux/drivers/comedi/drivers/ni_65xx.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * ni_65xx.c
 * Comedi driver for National Instruments PCI-65xx static dio boards
 *
 * Copyright (C) 2006 Jon Grierson <[email protected]>
 * Copyright (C) 2006 Frank Mori Hess <[email protected]>
 *
 * COMEDI - Linux Control and Measurement Device Interface
 * Copyright (C) 1999,2002,2003 David A. Schleef <[email protected]>
 */

/*
 * Driver: ni_65xx
 * Description: National Instruments 65xx static dio boards
 * Author: Jon Grierson <[email protected]>,
 *	   Frank Mori Hess <[email protected]>
 * Status: testing
 * Devices: [National Instruments] PCI-6509 (pci-6509), PXI-6509 (pxi-6509),
 *   PCI-6510 (pci-6510), PCI-6511 (pci-6511), PXI-6511 (pxi-6511),
 *   PCI-6512 (pci-6512), PXI-6512 (pxi-6512), PCI-6513 (pci-6513),
 *   PXI-6513 (pxi-6513), PCI-6514 (pci-6514), PXI-6514 (pxi-6514),
 *   PCI-6515 (pxi-6515), PXI-6515 (pxi-6515), PCI-6516 (pci-6516),
 *   PCI-6517 (pci-6517), PCI-6518 (pci-6518), PCI-6519 (pci-6519),
 *   PCI-6520 (pci-6520), PCI-6521 (pci-6521), PXI-6521 (pxi-6521),
 *   PCI-6528 (pci-6528), PXI-6528 (pxi-6528)
 * Updated: Mon, 21 Jul 2014 12:49:58 +0000
 *
 * Configuration Options: not applicable, uses PCI auto config
 *
 * Based on the PCI-6527 driver by ds.
 * The interrupt subdevice (subdevice 3) is probably broken for all
 * boards except maybe the 6514.
 *
 * This driver previously inverted the outputs on PCI-6513 through to
 * PCI-6519 and on PXI-6513 through to PXI-6515.  It no longer inverts
 * outputs on those cards by default as it didn't make much sense.  If
 * you require the outputs to be inverted on those cards for legacy
 * reasons, set the module parameter "legacy_invert_outputs=true" when
 * loading the module, or set "ni_65xx.legacy_invert_outputs=true" on
 * the kernel command line if the driver is built in to the kernel.
 */

/*
 * Manuals (available from ftp://ftp.natinst.com/support/manuals)
 *
 *	370106b.pdf	6514 Register Level Programmer Manual
 */

#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/comedi/comedi_pci.h>

/*
 * PCI BAR1 Register Map
 */

/* Non-recurring Registers (8-bit except where noted) */
#define NI_65XX_ID_REG
#define NI_65XX_CLR_REG
#define NI_65XX_CLR_WDOG_INT
#define NI_65XX_CLR_WDOG_PING
#define NI_65XX_CLR_WDOG_EXP
#define NI_65XX_CLR_EDGE_INT
#define NI_65XX_CLR_OVERFLOW_INT
#define NI_65XX_STATUS_REG
#define NI_65XX_STATUS_WDOG_INT
#define NI_65XX_STATUS_FALL_EDGE
#define NI_65XX_STATUS_RISE_EDGE
#define NI_65XX_STATUS_INT
#define NI_65XX_STATUS_OVERFLOW_INT
#define NI_65XX_STATUS_EDGE_INT
#define NI_65XX_CTRL_REG
#define NI_65XX_CTRL_WDOG_ENA
#define NI_65XX_CTRL_FALL_EDGE_ENA
#define NI_65XX_CTRL_RISE_EDGE_ENA
#define NI_65XX_CTRL_INT_ENA
#define NI_65XX_CTRL_OVERFLOW_ENA
#define NI_65XX_CTRL_EDGE_ENA
#define NI_65XX_REV_REG
#define NI_65XX_FILTER_REG
#define NI_65XX_RTSI_ROUTE_REG
#define NI_65XX_RTSI_EDGE_REG
#define NI_65XX_RTSI_WDOG_REG
#define NI_65XX_RTSI_TRIG_REG
#define NI_65XX_AUTO_CLK_SEL_REG
#define NI_65XX_AUTO_CLK_SEL_STATUS
#define NI_65XX_AUTO_CLK_SEL_DISABLE
#define NI_65XX_WDOG_CTRL_REG
#define NI_65XX_WDOG_CTRL_ENA
#define NI_65XX_RTSI_CFG_REG
#define NI_65XX_RTSI_CFG_RISE_SENSE
#define NI_65XX_RTSI_CFG_FALL_SENSE
#define NI_65XX_RTSI_CFG_SYNC_DETECT
#define NI_65XX_WDOG_STATUS_REG
#define NI_65XX_WDOG_STATUS_EXP
#define NI_65XX_WDOG_INTERVAL_REG

/* Recurring port registers (8-bit) */
#define NI_65XX_PORT(x)
#define NI_65XX_IO_DATA_REG(x)
#define NI_65XX_IO_SEL_REG(x)
#define NI_65XX_IO_SEL_OUTPUT
#define NI_65XX_IO_SEL_INPUT
#define NI_65XX_RISE_EDGE_ENA_REG(x)
#define NI_65XX_FALL_EDGE_ENA_REG(x)
#define NI_65XX_FILTER_ENA(x)
#define NI_65XX_WDOG_HIZ_REG(x)
#define NI_65XX_WDOG_ENA(x)
#define NI_65XX_WDOG_HI_LO_REG(x)
#define NI_65XX_RTSI_ENA(x)

#define NI_65XX_PORT_TO_CHAN(x)
#define NI_65XX_CHAN_TO_PORT(x)
#define NI_65XX_CHAN_TO_MASK(x)

enum ni_65xx_boardid {};

struct ni_65xx_board {};

static const struct ni_65xx_board ni_65xx_boards[] =;

static bool ni_65xx_legacy_invert_outputs;
module_param_named(legacy_invert_outputs, ni_65xx_legacy_invert_outputs,
		   bool, 0444);
MODULE_PARM_DESC();

static unsigned int ni_65xx_num_ports(struct comedi_device *dev)
{}

static void ni_65xx_disable_input_filters(struct comedi_device *dev)
{}

/* updates edge detection for base_chan to base_chan+31 */
static void ni_65xx_update_edge_detection(struct comedi_device *dev,
					  unsigned int base_chan,
					  unsigned int rising,
					  unsigned int falling)
{}

static void ni_65xx_disable_edge_detection(struct comedi_device *dev)
{}

static int ni_65xx_dio_insn_config(struct comedi_device *dev,
				   struct comedi_subdevice *s,
				   struct comedi_insn *insn,
				   unsigned int *data)
{}

static int ni_65xx_dio_insn_bits(struct comedi_device *dev,
				 struct comedi_subdevice *s,
				 struct comedi_insn *insn,
				 unsigned int *data)
{}

static irqreturn_t ni_65xx_interrupt(int irq, void *d)
{}

static int ni_65xx_intr_cmdtest(struct comedi_device *dev,
				struct comedi_subdevice *s,
				struct comedi_cmd *cmd)
{}

static int ni_65xx_intr_cmd(struct comedi_device *dev,
			    struct comedi_subdevice *s)
{}

static int ni_65xx_intr_cancel(struct comedi_device *dev,
			       struct comedi_subdevice *s)
{}

static int ni_65xx_intr_insn_bits(struct comedi_device *dev,
				  struct comedi_subdevice *s,
				  struct comedi_insn *insn,
				  unsigned int *data)
{}

static int ni_65xx_intr_insn_config(struct comedi_device *dev,
				    struct comedi_subdevice *s,
				    struct comedi_insn *insn,
				    unsigned int *data)
{}

/* ripped from mite.h and mite_setup2() to avoid mite dependency */
#define MITE_IODWBSR
#define WENAB

static int ni_65xx_mite_init(struct pci_dev *pcidev)
{}

static int ni_65xx_auto_attach(struct comedi_device *dev,
			       unsigned long context)
{}

static void ni_65xx_detach(struct comedi_device *dev)
{}

static struct comedi_driver ni_65xx_driver =;

static int ni_65xx_pci_probe(struct pci_dev *dev,
			     const struct pci_device_id *id)
{}

static const struct pci_device_id ni_65xx_pci_table[] =;
MODULE_DEVICE_TABLE(pci, ni_65xx_pci_table);

static struct pci_driver ni_65xx_pci_driver =;
module_comedi_pci_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();