Commit 82e71174 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcl730: add support for the PCL-733 ISA board

The PCL-733 ISA board can be supported by this driver. This board has
32 isolated digital inputs.

Add support for the PCL-733 board to the pcl730 driver and remove it
from the poc driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f68d07f0
...@@ -156,6 +156,7 @@ config COMEDI_PCL730 ...@@ -156,6 +156,7 @@ config COMEDI_PCL730
ADlink ACL-7130 isolated - 16 in/16 out ttl - 16 in/16 out ADlink ACL-7130 isolated - 16 in/16 out ttl - 16 in/16 out
Advantech PCM-3730 isolated - 8 in/8 out ttl - 16 in/16 out Advantech PCM-3730 isolated - 8 in/8 out ttl - 16 in/16 out
Advantech PCL-725 isolated - 8 in/8 out Advantech PCL-725 isolated - 8 in/8 out
Advantech PCL-733 isolated - 32 in
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called pcl730. called pcl730.
...@@ -533,8 +534,7 @@ config COMEDI_POC ...@@ -533,8 +534,7 @@ config COMEDI_POC
tristate "Generic driver for very simple devices" tristate "Generic driver for very simple devices"
---help--- ---help---
Enable generic support for very simple / POC (Piece of Crap) boards, Enable generic support for very simple / POC (Piece of Crap) boards,
Keithley Metrabyte DAC-02 (dac02), Advantech PCL-733 (pcl733) and Keithley Metrabyte DAC-02 (dac02) and Advantech PCL-734 (pcl734).
PCL-734 (pcl734)
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called poc. called poc.
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
* (Adlink) ACL-7130 [acl7130] * (Adlink) ACL-7130 [acl7130]
* (Advantech) PCM-3730 [pcm3730] * (Advantech) PCM-3730 [pcm3730]
* (Advantech) PCL-725 [pcl725] * (Advantech) PCL-725 [pcl725]
* (Advantech) PCL-733 [pcl733]
* Author: José Luis Sánchez (jsanchezv@teleline.es) * Author: José Luis Sánchez (jsanchezv@teleline.es)
* Status: untested * Status: untested
* *
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
* *
* The pcm3730 PC/104 board does not have the PCL730_IDIO_HI register. * 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 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_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_IDIO_HI 1 /* Isolated Digital I/O high byte (ID8-ID15) */
...@@ -42,7 +44,9 @@ struct pcl730_board { ...@@ -42,7 +44,9 @@ struct pcl730_board {
unsigned int io_range; unsigned int io_range;
unsigned is_pcl725:1; unsigned is_pcl725:1;
unsigned has_ttl_io: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; int n_ttl_chan;
}; };
...@@ -51,30 +55,45 @@ static const struct pcl730_board pcl730_boards[] = { ...@@ -51,30 +55,45 @@ static const struct pcl730_board pcl730_boards[] = {
.name = "pcl730", .name = "pcl730",
.io_range = 0x04, .io_range = 0x04,
.has_ttl_io = 1, .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, .n_ttl_chan = 16,
}, { }, {
.name = "iso730", .name = "iso730",
.io_range = 0x04, .io_range = 0x04,
.n_iso_chan = 16, .n_subdevs = 4,
.n_iso_out_chan = 16,
.n_iso_in_chan = 16,
.n_ttl_chan = 16, .n_ttl_chan = 16,
}, { }, {
.name = "acl7130", .name = "acl7130",
.io_range = 0x08, .io_range = 0x08,
.has_ttl_io = 1, .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, .n_ttl_chan = 16,
}, { }, {
.name = "pcm3730", .name = "pcm3730",
.io_range = 0x04, .io_range = 0x04,
.has_ttl_io = 1, .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, .n_ttl_chan = 16,
}, { }, {
.name = "pcl725", .name = "pcl725",
.io_range = 0x02, .io_range = 0x02,
.is_pcl725 = 1, .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,
}, },
}; };
...@@ -102,10 +121,8 @@ static int pcl730_do_insn_bits(struct comedi_device *dev, ...@@ -102,10 +121,8 @@ static int pcl730_do_insn_bits(struct comedi_device *dev,
return insn->n; return insn->n;
} }
static int pcl730_di_insn_bits(struct comedi_device *dev, static unsigned int pcl730_get_bits(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s)
struct comedi_insn *insn,
unsigned int *data)
{ {
unsigned long reg = (unsigned long)s->private; unsigned long reg = (unsigned long)s->private;
unsigned int val; unsigned int val;
...@@ -113,8 +130,20 @@ static int pcl730_di_insn_bits(struct comedi_device *dev, ...@@ -113,8 +130,20 @@ static int pcl730_di_insn_bits(struct comedi_device *dev,
val = inb(dev->iobase + reg); val = inb(dev->iobase + reg);
if (s->n_chan > 8) if (s->n_chan > 8)
val |= (inb(dev->iobase + reg + 1) << 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; return insn->n;
} }
...@@ -124,40 +153,47 @@ static int pcl730_attach(struct comedi_device *dev, ...@@ -124,40 +153,47 @@ static int pcl730_attach(struct comedi_device *dev,
{ {
const struct pcl730_board *board = comedi_board(dev); const struct pcl730_board *board = comedi_board(dev);
struct comedi_subdevice *s; struct comedi_subdevice *s;
int subdev;
int ret; int ret;
ret = comedi_request_region(dev, it->options[0], board->io_range); ret = comedi_request_region(dev, it->options[0], board->io_range);
if (ret) if (ret)
return ret; return ret;
ret = comedi_alloc_subdevices(dev, board->has_ttl_io ? 4 : 2); ret = comedi_alloc_subdevices(dev, board->n_subdevs);
if (ret) if (ret)
return ret; return ret;
/* Isolated Digital Outputs */ subdev = 0;
s = &dev->subdevices[0];
s->type = COMEDI_SUBD_DO; if (board->n_iso_out_chan) {
s->subdev_flags = SDF_WRITABLE; /* Isolated Digital Outputs */
s->n_chan = board->n_iso_chan; s = &dev->subdevices[subdev++];
s->maxdata = 1; s->type = COMEDI_SUBD_DO;
s->range_table = &range_digital; s->subdev_flags = SDF_WRITABLE;
s->insn_bits = pcl730_do_insn_bits; s->n_chan = board->n_iso_out_chan;
s->private = (void *)PCL730_IDIO_LO; s->maxdata = 1;
s->range_table = &range_digital;
/* Isolated Digital Inputs */ s->insn_bits = pcl730_do_insn_bits;
s = &dev->subdevices[1]; s->private = (void *)PCL730_IDIO_LO;
s->type = COMEDI_SUBD_DI; }
s->subdev_flags = SDF_READABLE;
s->n_chan = board->n_iso_chan; if (board->n_iso_in_chan) {
s->maxdata = 1; /* Isolated Digital Inputs */
s->range_table = &range_digital; s = &dev->subdevices[subdev++];
s->insn_bits = pcl730_di_insn_bits; s->type = COMEDI_SUBD_DI;
s->private = board->is_pcl725 ? (void *)PCL730_IDIO_HI s->subdev_flags = SDF_READABLE;
: (void *)PCL730_IDIO_LO; 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) { if (board->has_ttl_io) {
/* TTL Digital Outputs */ /* TTL Digital Outputs */
s = &dev->subdevices[2]; s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_DO; s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE; s->subdev_flags = SDF_WRITABLE;
s->n_chan = board->n_ttl_chan; s->n_chan = board->n_ttl_chan;
...@@ -167,7 +203,7 @@ static int pcl730_attach(struct comedi_device *dev, ...@@ -167,7 +203,7 @@ static int pcl730_attach(struct comedi_device *dev,
s->private = (void *)PCL730_DIO_LO; s->private = (void *)PCL730_DIO_LO;
/* TTL Digital Inputs */ /* TTL Digital Inputs */
s = &dev->subdevices[3]; s = &dev->subdevices[subdev++];
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE; s->subdev_flags = SDF_READABLE;
s->n_chan = board->n_ttl_chan; s->n_chan = board->n_ttl_chan;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
Driver: poc Driver: poc
Description: Generic driver for very simple devices Description: Generic driver for very simple devices
Author: ds Author: ds
Devices: [Keithley Metrabyte] DAC-02 (dac02), [Advantech] PCL-733 (pcl733), Devices: [Keithley Metrabyte] DAC-02 (dac02)
PCL-734 (pcl734) PCL-734 (pcl734)
Updated: Sat, 16 Mar 2002 17:34:48 -0800 Updated: Sat, 16 Mar 2002 17:34:48 -0800
Status: unknown Status: unknown
...@@ -26,7 +26,6 @@ Status: unknown ...@@ -26,7 +26,6 @@ Status: unknown
This driver is indended to support very simple ISA-based devices, This driver is indended to support very simple ISA-based devices,
including: including:
dac02 - Keithley DAC-02 analog output board dac02 - Keithley DAC-02 analog output board
pcl733 - Advantech PCL-733
pcl734 - Advantech PCL-734 pcl734 - Advantech PCL-734
Configuration options: Configuration options:
...@@ -97,18 +96,6 @@ static int dac02_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -97,18 +96,6 @@ static int dac02_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
return 1; 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, static int pcl734_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
...@@ -176,14 +163,6 @@ static const struct boarddef_struct boards[] = { ...@@ -176,14 +163,6 @@ static const struct boarddef_struct boards[] = {
.winsn = dac02_ao_winsn, .winsn = dac02_ao_winsn,
.rinsn = readback_insn, .rinsn = readback_insn,
.range = &range_unknown, .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", .name = "pcl734",
.iosize = 4, .iosize = 4,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment