aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten2014-05-28 16:34:54 -0700
committerGreg Kroah-Hartman2014-06-18 14:34:44 -0700
commit6822fc79a7b5ff36b5e53c52074f8ac49d59ed42 (patch)
treee2a92764c1ad6e3b6a4e92123d60420ffec1aeac
parent521a0a6c44c1de93a18a2078d546aa0546983089 (diff)
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>
-rw-r--r--drivers/staging/comedi/drivers/adq12b.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/staging/comedi/drivers/adq12b.c b/drivers/staging/comedi/drivers/adq12b.c
index 2e36aeea8fb6..8b15cbec9891 100644
--- a/drivers/staging/comedi/drivers/adq12b.c
+++ b/drivers/staging/comedi/drivers/adq12b.c
@@ -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;
}