called pcl726.
config COMEDI_PCL730
- tristate "Advantech PCL-730 and ADlink ACL-7130 ISA card support"
+ tristate "Advantech PCL-730/PCM-3730 and compatible board support"
---help---
Enable support for Advantech PCL-730, ICP ISO-730 and ADlink
- ACL-7130 ISA cards
+ ACL-7130 ISA cards as well as the Advantech PCM-3730 and clone
+ PC/104 boards.
To compile this driver as a module, choose M here: the module will be
called pcl730.
To compile this driver as a module, choose M here: the module will be
called pcm3724.
-config COMEDI_PCM3730
- tristate "Advantech PCM-3730 and clone PC/104 board support"
- ---help---
- Enable support for Advantech PCM-3730 and clone PC/104 boards
-
- To compile this driver as a module, choose M here: the module will be
- called pcm3730.
-
config COMEDI_AMPLC_DIO200_ISA
tristate "Amplicon PC212E/PC214E/PC215E/PC218E/PC272E"
select COMEDI_AMPLC_DIO200
* Devices: (Advantech) PCL-730 [pcl730]
* (ICP) ISO-730 [iso730]
* (Adlink) ACL-7130 [acl7130]
+ * (Advantech) PCM-3730 [pcm3730]
* Author: José Luis Sánchez (jsanchezv@teleline.es)
* Status: untested
*
#include <linux/ioport.h>
+/*
+ * Register I/O map
+ *
+ * The pcm3730 PC/104 board does not have the PCL730_IDIO_HI register.
+ */
#define PCL730_IDIO_LO 0 /* Isolated Digital I/O low byte (ID0-ID7) */
#define PCL730_IDIO_HI 1 /* Isolated Digital I/O high byte (ID8-ID15) */
#define PCL730_DIO_LO 2 /* TTL Digital I/O low byte (D0-D7) */
#define PCL730_DIO_HI 3 /* TTL Digital I/O high byte (D8-D15) */
struct pcl730_board {
- const char *name; /* board name */
- unsigned int io_range; /* len of I/O space */
+ const char *name;
+ unsigned int io_range;
+ int n_iso_chan;
};
static const struct pcl730_board pcl730_boards[] = {
{
.name = "pcl730",
.io_range = 0x04,
+ .n_iso_chan = 16,
}, {
.name = "iso730",
.io_range = 0x04,
+ .n_iso_chan = 16,
}, {
.name = "acl7130",
.io_range = 0x08,
+ .n_iso_chan = 16,
+ }, {
+ .name = "pcm3730",
+ .io_range = 0x04,
+ .n_iso_chan = 8,
},
};
if (mask & 0x00ff)
outb(s->state & 0xff, dev->iobase + reg);
- if (mask & 0xff00)
+ if ((mask & 0xff00) && (s->n_chan > 8))
outb((s->state >> 8) & 0xff, dev->iobase + reg + 1);
}
unsigned int *data)
{
unsigned long reg = (unsigned long)s->private;
+ unsigned int val;
+
+ val = inb(dev->iobase + reg);
+ if (s->n_chan > 8)
+ val |= (inb(dev->iobase + reg + 1) << 8);
- data[1] = inb(dev->iobase + reg) | (inb(dev->iobase + reg + 1) << 8);
+ data[1] = val;
return insn->n;
}
s = &dev->subdevices[0];
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE;
- s->n_chan = 16;
+ s->n_chan = board->n_iso_chan;
s->maxdata = 1;
s->range_table = &range_digital;
s->insn_bits = pcl730_do_insn_bits;
s = &dev->subdevices[1];
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
- s->n_chan = 16;
+ s->n_chan = board->n_iso_chan;
s->maxdata = 1;
s->range_table = &range_digital;
s->insn_bits = pcl730_di_insn_bits;
+++ /dev/null
-/*
- * comedi/drivers/pcm3730.c
- * Driver for PCM3730 and clones
- * Blaine Lee
- * from pcl725 by David S.
- */
-/*
-Driver: pcm3730
-Description: PCM3730
-Author: Blaine Lee
-Devices: [Advantech] PCM-3730 (pcm3730)
-Status: unknown
-
-Configuration options:
- [0] - I/O port base
-*/
-
-#include "../comedidev.h"
-
-#include <linux/ioport.h>
-
-#define PCM3730_SIZE 4 /* consecutive io port addresses */
-
-#define PCM3730_DOA 0 /* offsets for each port */
-#define PCM3730_DOB 2
-#define PCM3730_DOC 3
-#define PCM3730_DIA 0
-#define PCM3730_DIB 2
-#define PCM3730_DIC 3
-
-static int pcm3730_do_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
-{
- if (data[0]) {
- s->state &= ~data[0];
- s->state |= (data[0] & data[1]);
- outb(s->state, dev->iobase + (unsigned long)(s->private));
- }
- data[1] = s->state;
-
- return insn->n;
-}
-
-static int pcm3730_di_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
-{
- data[1] = inb(dev->iobase + (unsigned long)(s->private));
- return insn->n;
-}
-
-static int pcm3730_attach(struct comedi_device *dev,
- struct comedi_devconfig *it)
-{
- struct comedi_subdevice *s;
- int ret;
-
- ret = comedi_request_region(dev, it->options[0], PCM3730_SIZE);
- if (ret)
- return ret;
-
- ret = comedi_alloc_subdevices(dev, 6);
- if (ret)
- return ret;
-
- s = &dev->subdevices[0];
- s->type = COMEDI_SUBD_DO;
- s->subdev_flags = SDF_WRITABLE;
- s->maxdata = 1;
- s->n_chan = 8;
- s->insn_bits = pcm3730_do_insn_bits;
- s->range_table = &range_digital;
- s->private = (void *)PCM3730_DOA;
-
- s = &dev->subdevices[1];
- s->type = COMEDI_SUBD_DO;
- s->subdev_flags = SDF_WRITABLE;
- s->maxdata = 1;
- s->n_chan = 8;
- s->insn_bits = pcm3730_do_insn_bits;
- s->range_table = &range_digital;
- s->private = (void *)PCM3730_DOB;
-
- s = &dev->subdevices[2];
- s->type = COMEDI_SUBD_DO;
- s->subdev_flags = SDF_WRITABLE;
- s->maxdata = 1;
- s->n_chan = 8;
- s->insn_bits = pcm3730_do_insn_bits;
- s->range_table = &range_digital;
- s->private = (void *)PCM3730_DOC;
-
- s = &dev->subdevices[3];
- s->type = COMEDI_SUBD_DI;
- s->subdev_flags = SDF_READABLE;
- s->maxdata = 1;
- s->n_chan = 8;
- s->insn_bits = pcm3730_di_insn_bits;
- s->range_table = &range_digital;
- s->private = (void *)PCM3730_DIA;
-
- s = &dev->subdevices[4];
- s->type = COMEDI_SUBD_DI;
- s->subdev_flags = SDF_READABLE;
- s->maxdata = 1;
- s->n_chan = 8;
- s->insn_bits = pcm3730_di_insn_bits;
- s->range_table = &range_digital;
- s->private = (void *)PCM3730_DIB;
-
- s = &dev->subdevices[5];
- s->type = COMEDI_SUBD_DI;
- s->subdev_flags = SDF_READABLE;
- s->maxdata = 1;
- s->n_chan = 8;
- s->insn_bits = pcm3730_di_insn_bits;
- s->range_table = &range_digital;
- s->private = (void *)PCM3730_DIC;
-
- printk(KERN_INFO "\n");
-
- return 0;
-}
-
-static struct comedi_driver pcm3730_driver = {
- .driver_name = "pcm3730",
- .module = THIS_MODULE,
- .attach = pcm3730_attach,
- .detach = comedi_legacy_detach,
-};
-module_comedi_driver(pcm3730_driver);
-
-MODULE_AUTHOR("Comedi http://www.comedi.org");
-MODULE_DESCRIPTION("Comedi low-level driver");
-MODULE_LICENSE("GPL");