Commit 5826d99a authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: das08: rename DAS08_LSB and DAS08_MSB

The `DAS08_LSB` and `DAS08_MSB` macros contain the offsets to the
least-significant and most-significant analog input data registers.
Rename them to `DAS08_AI_LSB_REG` and `DAS08_AI_MSB_REG` respectively
and add comments to document them.
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 3c7cab30
......@@ -42,8 +42,20 @@
*/
#define DAS08_LSB 0
#define DAS08_MSB 1
/*
* Data format of DAS08_AI_LSB_REG and DAS08_AI_MSB_REG depends on
* 'ai_encoding' member of board structure:
*
* das08_encode12 : DATA[11..4] = MSB[7..0], DATA[3..0] = LSB[7..4].
* das08_pcm_encode12 : DATA[11..8] = MSB[3..0], DATA[7..9] = LSB[7..0].
* das08_encode16 : SIGN = MSB[7], MAGNITUDE[14..8] = MSB[6..0],
* MAGNITUDE[7..0] = LSB[7..0].
* SIGN==0 for negative input, SIGN==1 for positive input.
* Note: when read a second time after conversion
* complete, MSB[7] is an "over-range" bit.
*/
#define DAS08_AI_LSB_REG 0x00 /* (R) AI least significant bits */
#define DAS08_AI_MSB_REG 0x01 /* (R) AI most significant bits */
#define DAS08_TRIG_12BIT 1
#define DAS08_STATUS 2
#define DAS08_EOC (1<<7)
......@@ -214,8 +226,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
range = CR_RANGE(insn->chanspec);
/* clear crap */
inb(dev->iobase + DAS08_LSB);
inb(dev->iobase + DAS08_MSB);
inb(dev->iobase + DAS08_AI_LSB_REG);
inb(dev->iobase + DAS08_AI_MSB_REG);
/* set multiplexer */
/* lock to prevent race with digital output */
......@@ -235,7 +247,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
for (n = 0; n < insn->n; n++) {
/* clear over-range bits for 16-bit boards */
if (thisboard->ai_nbits == 16)
if (inb(dev->iobase + DAS08_MSB) & 0x80)
if (inb(dev->iobase + DAS08_AI_MSB_REG) & 0x80)
dev_info(dev->class_dev, "over-range\n");
/* trigger conversion */
......@@ -245,8 +257,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
if (ret)
return ret;
msb = inb(dev->iobase + DAS08_MSB);
lsb = inb(dev->iobase + DAS08_LSB);
msb = inb(dev->iobase + DAS08_AI_MSB_REG);
lsb = inb(dev->iobase + DAS08_AI_LSB_REG);
if (thisboard->ai_encoding == das08_encode12) {
data[n] = (lsb >> 4) | (msb << 4);
} else if (thisboard->ai_encoding == das08_pcm_encode12) {
......
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