Commit 09ed1b72 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: das08: add DAS08JR_AO_UPDATE_REG

"JR" boards with analog output channels have a jumper that controls
whether analog output channels are updated simultaneously or
individually.  When set to update individually, individual channels are
updated when the high byte register is written. When set to update
simultaneously, channels are not updated until the digital inputs
register is read.  The driver doesn't know how the jumper is set and is
not interested in the simultaneous output feature, so it updates a
channel by writing the low byte, then the high byte, then reading the
digital inputs register.  To make the code more explicit, add a macro
`DAS08JR_AO_UPDATE_REG` with the same value as the `DAS08JR_DI_REG`
macro (for digital inputs) and use it when reading the register to
update the analog outputs.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7b2098f6
...@@ -101,6 +101,11 @@ ...@@ -101,6 +101,11 @@
#define DAS08JR_AO_LSB_REG(x) ((x) ? 0x06 : 0x04) #define DAS08JR_AO_LSB_REG(x) ((x) ? 0x06 : 0x04)
/* (W) analog output m.s.b. registers for 2 channels ("JR" boards) */ /* (W) analog output m.s.b. registers for 2 channels ("JR" boards) */
#define DAS08JR_AO_MSB_REG(x) ((x) ? 0x07 : 0x05) #define DAS08JR_AO_MSB_REG(x) ((x) ? 0x07 : 0x05)
/*
* (R) update analog outputs ("JR" boards set for simultaneous output)
* (same register as digital inputs)
*/
#define DAS08JR_AO_UPDATE_REG 0x03
/* /*
cio-das08_aox.pdf cio-das08_aox.pdf
...@@ -358,7 +363,7 @@ static void das08_ao_set_data(struct comedi_device *dev, ...@@ -358,7 +363,7 @@ static void das08_ao_set_data(struct comedi_device *dev,
outb(lsb, dev->iobase + DAS08JR_AO_LSB_REG(chan)); outb(lsb, dev->iobase + DAS08JR_AO_LSB_REG(chan));
outb(msb, dev->iobase + DAS08JR_AO_MSB_REG(chan)); outb(msb, dev->iobase + DAS08JR_AO_MSB_REG(chan));
/* load DACs */ /* load DACs */
inb(dev->iobase + DAS08JR_DI_REG); inb(dev->iobase + DAS08JR_AO_UPDATE_REG);
} else { } else {
outb(lsb, dev->iobase + DAS08AO_AO_LSB(chan)); outb(lsb, dev->iobase + DAS08AO_AO_LSB(chan));
outb(msb, dev->iobase + DAS08AO_AO_MSB(chan)); outb(msb, dev->iobase + DAS08AO_AO_MSB(chan));
......
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