diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-06-06 15:37:20 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-08 21:56:57 -0700 |
commit | 145ff35bab0c64320cba09a1c720525e035025c4 (patch) | |
tree | 02615ed0dd09c1ed6206a01cd65997e0e0e3b94b /drivers/staging/comedi/drivers/pcl730.c | |
parent | b37668d0808a1bf15d05e678f431fb5fb4659c90 (diff) |
staging: comedi: pcl730: add support for the PCM-3730 PC/104 board
The PCM-3730 PC/104 board has the same register i/o map as the PCL-730
ISA board. The only difference is the number of isolated digital input
and output channels.
Add support for the PCM-3770 board to the pcl730 driver and remove the
standalone pcm3730 driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/pcl730.c')
-rw-r--r-- | drivers/staging/comedi/drivers/pcl730.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index c77e347e7b1e..4b9a4fbd7b72 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -10,6 +10,7 @@ * 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 * @@ -24,26 +25,39 @@ #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, }, }; @@ -62,7 +76,7 @@ static int pcl730_do_insn_bits(struct comedi_device *dev, 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); } @@ -77,8 +91,13 @@ static int pcl730_di_insn_bits(struct comedi_device *dev, 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; } @@ -102,7 +121,7 @@ static int pcl730_attach(struct comedi_device *dev, 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; @@ -112,7 +131,7 @@ static int pcl730_attach(struct comedi_device *dev, 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; |