linux/drivers/comedi/drivers/pcl812.c

// SPDX-License-Identifier: GPL-2.0
/*
 * comedi/drivers/pcl812.c
 *
 * Author: Michal Dobes <[email protected]>
 *
 * hardware driver for Advantech cards
 *  card:   PCL-812, PCL-812PG, PCL-813, PCL-813B
 *  driver: pcl812,  pcl812pg,  pcl813,  pcl813b
 * and for ADlink cards
 *  card:   ACL-8112DG, ACL-8112HG, ACL-8112PG, ACL-8113, ACL-8216
 *  driver: acl8112dg,  acl8112hg,  acl8112pg,  acl8113,  acl8216
 * and for ICP DAS cards
 *  card:   ISO-813, A-821PGH, A-821PGL, A-821PGL-NDA, A-822PGH, A-822PGL,
 *  driver: iso813,  a821pgh,  a-821pgl, a-821pglnda,  a822pgh,  a822pgl,
 *  card:   A-823PGH, A-823PGL, A-826PG
 * driver:  a823pgh,  a823pgl,  a826pg
 */

/*
 * Driver: pcl812
 * Description: Advantech PCL-812/PG, PCL-813/B,
 *	     ADLink ACL-8112DG/HG/PG, ACL-8113, ACL-8216,
 *	     ICP DAS A-821PGH/PGL/PGL-NDA, A-822PGH/PGL, A-823PGH/PGL, A-826PG,
 *	     ICP DAS ISO-813
 * Author: Michal Dobes <[email protected]>
 * Devices: [Advantech] PCL-812 (pcl812), PCL-812PG (pcl812pg),
 *	PCL-813 (pcl813), PCL-813B (pcl813b), [ADLink] ACL-8112DG (acl8112dg),
 *	ACL-8112HG (acl8112hg), ACL-8113 (acl-8113), ACL-8216 (acl8216),
 *	[ICP] ISO-813 (iso813), A-821PGH (a821pgh), A-821PGL (a821pgl),
 *	A-821PGL-NDA (a821pclnda), A-822PGH (a822pgh), A-822PGL (a822pgl),
 *	A-823PGH (a823pgh), A-823PGL (a823pgl), A-826PG (a826pg)
 * Updated: Mon, 06 Aug 2007 12:03:15 +0100
 * Status: works (I hope. My board fire up under my hands
 *	       and I cann't test all features.)
 *
 * This driver supports insn and cmd interfaces. Some boards support only insn
 * because their hardware don't allow more (PCL-813/B, ACL-8113, ISO-813).
 * Data transfer over DMA is supported only when you measure only one
 * channel, this is too hardware limitation of these boards.
 *
 * Options for PCL-812:
 *   [0] - IO Base
 *   [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7; 10, 11, 12, 14, 15)
 *   [2] - DMA  (0=disable, 1, 3)
 *   [3] - 0=trigger source is internal 8253 with 2MHz clock
 *         1=trigger source is external
 *   [4] - 0=A/D input range is +/-10V
 *	   1=A/D input range is +/-5V
 *	   2=A/D input range is +/-2.5V
 *	   3=A/D input range is +/-1.25V
 *	   4=A/D input range is +/-0.625V
 *	   5=A/D input range is +/-0.3125V
 *   [5] - 0=D/A outputs 0-5V  (internal reference -5V)
 *	   1=D/A outputs 0-10V (internal reference -10V)
 *	   2=D/A outputs unknown (external reference)
 *
 * Options for PCL-812PG, ACL-8112PG:
 *   [0] - IO Base
 *   [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7; 10, 11, 12, 14, 15)
 *   [2] - DMA  (0=disable, 1, 3)
 *   [3] - 0=trigger source is internal 8253 with 2MHz clock
 *	   1=trigger source is external
 *   [4] - 0=A/D have max +/-5V input
 *	   1=A/D have max +/-10V input
 *   [5] - 0=D/A outputs 0-5V  (internal reference -5V)
 *	   1=D/A outputs 0-10V (internal reference -10V)
 *	   2=D/A outputs unknown (external reference)
 *
 * Options for ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH, ACL-8216, A-826PG:
 *   [0] - IO Base
 *   [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7; 10, 11, 12, 14, 15)
 *   [2] - DMA  (0=disable, 1, 3)
 *   [3] - 0=trigger source is internal 8253 with 2MHz clock
 *	   1=trigger source is external
 *   [4] - 0=A/D channels are S.E.
 *	   1=A/D channels are DIFF
 *   [5] - 0=D/A outputs 0-5V  (internal reference -5V)
 *	   1=D/A outputs 0-10V (internal reference -10V)
 *	   2=D/A outputs unknown (external reference)
 *
 * Options for A-821PGL/PGH:
 *   [0] - IO Base
 *   [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
 *   [2] - 0=A/D channels are S.E.
 *	   1=A/D channels are DIFF
 *   [3] - 0=D/A output 0-5V  (internal reference -5V)
 *	   1=D/A output 0-10V (internal reference -10V)
 *
 * Options for A-821PGL-NDA:
 *   [0] - IO Base
 *   [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
 *   [2] - 0=A/D channels are S.E.
 *	   1=A/D channels are DIFF
 *
 * Options for PCL-813:
 *   [0] - IO Base
 *
 * Options for PCL-813B:
 *   [0] - IO Base
 *   [1] - 0= bipolar inputs
 *	   1= unipolar inputs
 *
 * Options for ACL-8113, ISO-813:
 *   [0] - IO Base
 *   [1] - 0= 10V bipolar inputs
 *	   1= 10V unipolar inputs
 *	   2= 20V bipolar inputs
 *	   3= 20V unipolar inputs
 */

#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/gfp.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/comedi/comedidev.h>
#include <linux/comedi/comedi_8254.h>
#include <linux/comedi/comedi_isadma.h>

/*
 * Register I/O map
 */
#define PCL812_TIMER_BASE
#define PCL812_AI_LSB_REG
#define PCL812_AI_MSB_REG
#define PCL812_AI_MSB_DRDY
#define PCL812_AO_LSB_REG(x)
#define PCL812_AO_MSB_REG(x)
#define PCL812_DI_LSB_REG
#define PCL812_DI_MSB_REG
#define PCL812_STATUS_REG
#define PCL812_STATUS_DRDY
#define PCL812_RANGE_REG
#define PCL812_MUX_REG
#define PCL812_MUX_CHAN(x)
#define PCL812_MUX_CS0
#define PCL812_MUX_CS1
#define PCL812_CTRL_REG
#define PCL812_CTRL_TRIG(x)
#define PCL812_CTRL_DISABLE_TRIG
#define PCL812_CTRL_SOFT_TRIG
#define PCL812_CTRL_PACER_DMA_TRIG
#define PCL812_CTRL_PACER_EOC_TRIG
#define PCL812_SOFTTRIG_REG
#define PCL812_DO_LSB_REG
#define PCL812_DO_MSB_REG

#define MAX_CHANLIST_LEN

static const struct comedi_lrange range_pcl812pg_ai =;

static const struct comedi_lrange range_pcl812pg2_ai =;

static const struct comedi_lrange range812_bipolar1_25 =;

static const struct comedi_lrange range812_bipolar0_625 =;

static const struct comedi_lrange range812_bipolar0_3125 =;

static const struct comedi_lrange range_pcl813b_ai =;

static const struct comedi_lrange range_pcl813b2_ai =;

static const struct comedi_lrange range_iso813_1_ai =;

static const struct comedi_lrange range_iso813_1_2_ai =;

static const struct comedi_lrange range_iso813_2_ai =;

static const struct comedi_lrange range_iso813_2_2_ai =;

static const struct comedi_lrange range_acl8113_1_ai =;

static const struct comedi_lrange range_acl8113_1_2_ai =;

static const struct comedi_lrange range_acl8113_2_ai =;

static const struct comedi_lrange range_acl8113_2_2_ai =;

static const struct comedi_lrange range_acl8112dg_ai =;

static const struct comedi_lrange range_acl8112hg_ai =;

static const struct comedi_lrange range_a821pgh_ai =;

enum pcl812_boardtype {};

struct pcl812_board {};

static const struct pcl812_board boardtypes[] =;

struct pcl812_private {};

static void pcl812_ai_setup_dma(struct comedi_device *dev,
				struct comedi_subdevice *s,
				unsigned int unread_samples)
{}

static void pcl812_ai_set_chan_range(struct comedi_device *dev,
				     unsigned int chanspec, char wait)
{}

static void pcl812_ai_clear_eoc(struct comedi_device *dev)
{}

static void pcl812_ai_soft_trig(struct comedi_device *dev)
{}

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

static int pcl812_ai_eoc(struct comedi_device *dev,
			 struct comedi_subdevice *s,
			 struct comedi_insn *insn,
			 unsigned long context)
{}

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

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

static bool pcl812_ai_next_chan(struct comedi_device *dev,
				struct comedi_subdevice *s)
{}

static void pcl812_handle_eoc(struct comedi_device *dev,
			      struct comedi_subdevice *s)
{}

static void transfer_from_dma_buf(struct comedi_device *dev,
				  struct comedi_subdevice *s,
				  unsigned short *ptr,
				  unsigned int bufptr, unsigned int len)
{}

static void pcl812_handle_dma(struct comedi_device *dev,
			      struct comedi_subdevice *s)
{}

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

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

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

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

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

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

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

static void pcl812_reset(struct comedi_device *dev)
{}

static void pcl812_set_ai_range_table(struct comedi_device *dev,
				      struct comedi_subdevice *s,
				      struct comedi_devconfig *it)
{}

static void pcl812_alloc_dma(struct comedi_device *dev, unsigned int dma_chan)
{}

static void pcl812_free_dma(struct comedi_device *dev)
{}

static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{}

static void pcl812_detach(struct comedi_device *dev)
{}

static struct comedi_driver pcl812_driver =;
module_comedi_driver();

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