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: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f68d07f080
commit
82e71174ae
@ -156,6 +156,7 @@ config COMEDI_PCL730
|
||||
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 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
|
||||
called pcl730.
|
||||
@ -533,8 +534,7 @@ config COMEDI_POC
|
||||
tristate "Generic driver for very simple devices"
|
||||
---help---
|
||||
Enable generic support for very simple / POC (Piece of Crap) boards,
|
||||
Keithley Metrabyte DAC-02 (dac02), Advantech PCL-733 (pcl733) and
|
||||
PCL-734 (pcl734)
|
||||
Keithley Metrabyte DAC-02 (dac02) and Advantech PCL-734 (pcl734).
|
||||
|
||||
To compile this driver as a module, choose M here: the module will be
|
||||
called poc.
|
||||
|
@ -12,6 +12,7 @@
|
||||
* (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
|
||||
*
|
||||
@ -31,6 +32,7 @@
|
||||
*
|
||||
* 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) */
|
||||
@ -42,7 +44,9 @@ struct pcl730_board {
|
||||
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;
|
||||
};
|
||||
|
||||
@ -51,30 +55,45 @@ static const struct pcl730_board pcl730_boards[] = {
|
||||
.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,
|
||||
},
|
||||
};
|
||||
|
||||
@ -102,10 +121,8 @@ static int pcl730_do_insn_bits(struct comedi_device *dev,
|
||||
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;
|
||||
@ -113,8 +130,20 @@ static int pcl730_di_insn_bits(struct comedi_device *dev,
|
||||
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);
|
||||
|
||||
data[1] = val;
|
||||
return 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;
|
||||
}
|
||||
@ -124,40 +153,47 @@ static int pcl730_attach(struct comedi_device *dev,
|
||||
{
|
||||
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;
|
||||
subdev = 0;
|
||||
|
||||
/* 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;
|
||||
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;
|
||||
@ -167,7 +203,7 @@ static int pcl730_attach(struct comedi_device *dev,
|
||||
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;
|
||||
|
@ -18,7 +18,7 @@
|
||||
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
|
||||
@ -26,7 +26,6 @@ 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:
|
||||
@ -97,18 +96,6 @@ static int dac02_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
|
||||
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)
|
||||
@ -176,14 +163,6 @@ static const struct boarddef_struct boards[] = {
|
||||
.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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user