* (Adlink) ACL-7130 [acl7130]
* (Advantech) PCM-3730 [pcm3730]
* (Advantech) PCL-725 [pcl725]
+ * (Advantech) PCL-733 [pcl733]
* Author: José Luis Sánchez (jsanchezv@teleline.es)
* Status: untested
*
*
* The pcm3730 PC/104 board does not have the PCL730_IDIO_HI register.
* The pcl725 ISA board uses separate registers for isolated digital I/O.
+ * The pcl733 ISA board uses all four registers for isolated digital inputs.
*/
#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) */
unsigned int io_range;
unsigned is_pcl725:1;
unsigned has_ttl_io:1;
- int n_iso_chan;
+ int n_subdevs;
+ int n_iso_out_chan;
+ int n_iso_in_chan;
int n_ttl_chan;
};
.name = "pcl730",
.io_range = 0x04,
.has_ttl_io = 1,
- .n_iso_chan = 16,
+ .n_subdevs = 4,
+ .n_iso_out_chan = 16,
+ .n_iso_in_chan = 16,
.n_ttl_chan = 16,
}, {
.name = "iso730",
.io_range = 0x04,
- .n_iso_chan = 16,
+ .n_subdevs = 4,
+ .n_iso_out_chan = 16,
+ .n_iso_in_chan = 16,
.n_ttl_chan = 16,
}, {
.name = "acl7130",
.io_range = 0x08,
.has_ttl_io = 1,
- .n_iso_chan = 16,
+ .n_subdevs = 4,
+ .n_iso_out_chan = 16,
+ .n_iso_in_chan = 16,
.n_ttl_chan = 16,
}, {
.name = "pcm3730",
.io_range = 0x04,
.has_ttl_io = 1,
- .n_iso_chan = 8,
+ .n_subdevs = 4,
+ .n_iso_out_chan = 8,
+ .n_iso_in_chan = 8,
.n_ttl_chan = 16,
}, {
.name = "pcl725",
.io_range = 0x02,
.is_pcl725 = 1,
- .n_iso_chan = 8,
+ .n_subdevs = 2,
+ .n_iso_out_chan = 8,
+ .n_iso_in_chan = 8,
+ }, {
+ .name = "pcl733",
+ .io_range = 0x04,
+ .n_subdevs = 1,
+ .n_iso_in_chan = 32,
},
};
return insn->n;
}
-static int pcl730_di_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
+static unsigned int pcl730_get_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s)
{
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);
+ if (s->n_chan > 16)
+ val |= (inb(dev->iobase + reg + 2) << 16);
+ if (s->n_chan > 24)
+ val |= (inb(dev->iobase + reg + 3) << 24);
+
+ return val;
+}
- data[1] = val;
+static int pcl730_di_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
+{
+ data[1] = pcl730_get_bits(dev, s);
return insn->n;
}
{
const struct pcl730_board *board = comedi_board(dev);
struct comedi_subdevice *s;
+ int subdev;
int ret;
ret = comedi_request_region(dev, it->options[0], board->io_range);
if (ret)
return ret;
- ret = comedi_alloc_subdevices(dev, board->has_ttl_io ? 4 : 2);
+ ret = comedi_alloc_subdevices(dev, board->n_subdevs);
if (ret)
return ret;
- /* Isolated Digital Outputs */
- s = &dev->subdevices[0];
- s->type = COMEDI_SUBD_DO;
- s->subdev_flags = SDF_WRITABLE;
- s->n_chan = board->n_iso_chan;
- s->maxdata = 1;
- s->range_table = &range_digital;
- s->insn_bits = pcl730_do_insn_bits;
- s->private = (void *)PCL730_IDIO_LO;
-
- /* Isolated Digital Inputs */
- s = &dev->subdevices[1];
- s->type = COMEDI_SUBD_DI;
- s->subdev_flags = SDF_READABLE;
- s->n_chan = board->n_iso_chan;
- s->maxdata = 1;
- s->range_table = &range_digital;
- s->insn_bits = pcl730_di_insn_bits;
- s->private = board->is_pcl725 ? (void *)PCL730_IDIO_HI
- : (void *)PCL730_IDIO_LO;
+ subdev = 0;
+
+ if (board->n_iso_out_chan) {
+ /* Isolated Digital Outputs */
+ s = &dev->subdevices[subdev++];
+ s->type = COMEDI_SUBD_DO;
+ s->subdev_flags = SDF_WRITABLE;
+ s->n_chan = board->n_iso_out_chan;
+ s->maxdata = 1;
+ s->range_table = &range_digital;
+ s->insn_bits = pcl730_do_insn_bits;
+ s->private = (void *)PCL730_IDIO_LO;
+ }
+
+ if (board->n_iso_in_chan) {
+ /* Isolated Digital Inputs */
+ s = &dev->subdevices[subdev++];
+ s->type = COMEDI_SUBD_DI;
+ s->subdev_flags = SDF_READABLE;
+ s->n_chan = board->n_iso_in_chan;
+ s->maxdata = 1;
+ s->range_table = &range_digital;
+ s->insn_bits = pcl730_di_insn_bits;
+ s->private = board->is_pcl725 ? (void *)PCL730_IDIO_HI
+ : (void *)PCL730_IDIO_LO;
+ }
if (board->has_ttl_io) {
/* TTL Digital Outputs */
- s = &dev->subdevices[2];
+ s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE;
s->n_chan = board->n_ttl_chan;
s->private = (void *)PCL730_DIO_LO;
/* TTL Digital Inputs */
- s = &dev->subdevices[3];
+ s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
s->n_chan = board->n_ttl_chan;
Driver: poc
Description: Generic driver for very simple devices
Author: ds
-Devices: [Keithley Metrabyte] DAC-02 (dac02), [Advantech] PCL-733 (pcl733),
+Devices: [Keithley Metrabyte] DAC-02 (dac02)
PCL-734 (pcl734)
Updated: Sat, 16 Mar 2002 17:34:48 -0800
Status: unknown
This driver is indended to support very simple ISA-based devices,
including:
dac02 - Keithley DAC-02 analog output board
- pcl733 - Advantech PCL-733
pcl734 - Advantech PCL-734
Configuration options:
return 1;
}
-static int pcl733_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
-{
- data[1] = inb(dev->iobase + 0);
- data[1] |= (inb(dev->iobase + 1) << 8);
- data[1] |= (inb(dev->iobase + 2) << 16);
- data[1] |= (inb(dev->iobase + 3) << 24);
-
- return insn->n;
-}
-
static int pcl734_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
.winsn = dac02_ao_winsn,
.rinsn = readback_insn,
.range = &range_unknown,
- }, {
- .name = "pcl733",
- .iosize = 4,
- .type = COMEDI_SUBD_DI,
- .n_chan = 32,
- .n_bits = 1,
- .insnbits = pcl733_insn_bits,
- .range = &range_digital,
}, {
.name = "pcl734",
.iosize = 4,