staging: comedi: adq12b: tidy up the register map defines

Cleanup the existing defines and add some missing bit defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2014-05-28 16:34:54 -07:00 committed by Greg Kroah-Hartman
parent 521a0a6c44
commit 6822fc79a7

View file

@ -79,18 +79,20 @@ If you do not specify any options, they will default to
#include "../comedidev.h"
/* address scheme (page 2.17 of the manual) */
#define ADQ12B_CTREG 0x00
#define ADQ12B_STINR 0x00
#define ADQ12B_OUTBR 0x04
#define ADQ12B_ADLOW 0x08
#define ADQ12B_ADHIG 0x09
#define ADQ12B_CONT0 0x0c
#define ADQ12B_CONT1 0x0d
#define ADQ12B_CONT2 0x0e
#define ADQ12B_COWORD 0x0f
/* mask of the bit at STINR to check end of conversion */
#define ADQ12B_EOC 0x20
#define ADQ12B_CTREG 0x00
#define ADQ12B_CTREG_MSKP (1 << 7) /* enable pacer interrupt */
#define ADQ12B_CTREG_GTP (1 << 6) /* enable pacer */
#define ADQ12B_CTREG_RANGE(x) ((x) << 4)
#define ADQ12B_CTREG_CHAN(x) ((x) << 0)
#define ADQ12B_STINR 0x00
#define ADQ12B_STINR_OUT2 (1 << 7) /* timer 2 output state */
#define ADQ12B_STINR_OUTP (1 << 6) /* pacer output state */
#define ADQ12B_STINR_EOC (1 << 5) /* A/D end-of-conversion */
#define ADQ12B_STINR_IN_MASK (0x1f << 0)
#define ADQ12B_OUTBR 0x04
#define ADQ12B_ADLOW 0x08
#define ADQ12B_ADHIG 0x09
#define ADQ12B_TIMER_BASE 0x0c
/* available ranges through the PGA gains */
static const struct comedi_lrange range_adq12b_ai_bipolar = {
@ -123,7 +125,7 @@ static int adq12b_ai_eoc(struct comedi_device *dev,
unsigned char status;
status = inb(dev->iobase + ADQ12B_STINR);
if (status & ADQ12B_EOC)
if (status & ADQ12B_STINR_EOC)
return 0;
return -EBUSY;
}
@ -141,7 +143,7 @@ static int adq12b_ai_insn_read(struct comedi_device *dev,
int i;
/* change channel and range only if it is different from the previous */
val = (range << 4) | chan;
val = ADQ12B_CTREG_RANGE(range) | ADQ12B_CTREG_CHAN(chan);
if (val != devpriv->last_ctreg) {
outb(val, dev->iobase + ADQ12B_CTREG);
devpriv->last_ctreg = val;
@ -170,7 +172,7 @@ static int adq12b_di_insn_bits(struct comedi_device *dev,
{
/* only bits 0-4 have information about digital inputs */
data[1] = (inb(dev->iobase + ADQ12B_STINR) & (0x1f));
data[1] = (inb(dev->iobase + ADQ12B_STINR) & ADQ12B_STINR_IN_MASK);
return insn->n;
}