diff options
author | Ian Abbott <abbotti@mev.co.uk> | 2009-09-21 22:05:01 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-10-09 22:47:25 +0200 |
commit | 078a10df24ac87d18c2d52fb501ff652f481fb5b (patch) | |
tree | 575a055f74180138dbd730a6ff45ccc38ba70e3c /drivers | |
parent | Staging: comedi: ni_65xx.c: fix insn_bits shift calculation. (diff) | |
download | linux-078a10df24ac87d18c2d52fb501ff652f481fb5b.tar.xz linux-078a10df24ac87d18c2d52fb501ff652f481fb5b.zip |
Staging: comedi: ni_65xx.c: fix output inversion problem.
When reading DO subdevice with inverted outputs invert the values read
back from the ports to match the inversion of values written.
Signed-off-by: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/drivers/ni_65xx.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index b664ce083fc5..bbf75eb6d7f2 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -457,6 +457,12 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, port_read_bits = readb(private(dev)->mite->daq_io_addr + Port_Data(port)); /* printk("read 0x%x from port %i\n", port_read_bits, port); */ + if (s->type == COMEDI_SUBD_DO && board(dev)->invert_outputs) { + /* Outputs inverted, so invert value read back from + * DO subdevice. (Does not apply to boards with DIO + * subdevice.) */ + port_read_bits ^= 0xFF; + } if (bitshift > 0) { port_read_bits <<= bitshift; } else { |