diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-10-24 23:33:30 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-25 02:35:50 (GMT) |
commit | be2fcdbf91f77c7658f87a782a86a3cfc0775b2d (patch) | |
tree | 82500097f84a7327b414de7769ab4ffd19a33d21 | |
parent | c8ffd143fac826787eb948930982902b5f0a778d (diff) | |
download | linux-fsl-qoriq-be2fcdbf91f77c7658f87a782a86a3cfc0775b2d.tar.xz |
staging: comedi: cb_pcidda: cleanup DACCONTROL defines
Rename the defines used for the D/A Control register so that they
have namespace with this driver. Cleanup the use of these defines.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/cb_pcidda.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 2e2d00a..90930c8 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -65,16 +65,14 @@ #define CB_DDA_DIO1_8255_BASE 0x04 /* DAC registers */ -#define DACONTROL 0 /* D/A CONTROL REGISTER */ -#define SU 0000001 /* Simultaneous update enabled */ -#define NOSU 0000000 /* Simultaneous update disabled */ -#define ENABLEDAC 0000002 /* Enable specified DAC */ -#define DISABLEDAC 0000000 /* Disable specified DAC */ -#define RANGE2V5 0000000 /* 2.5V */ -#define RANGE5V 0000200 /* 5V */ -#define RANGE10V 0000300 /* 10V */ -#define UNIP 0000400 /* Unipolar outputs */ -#define BIP 0000000 /* Bipolar outputs */ +#define CB_DDA_DA_CTRL_REG 0x00 /* D/A Control Register */ +#define CB_DDA_DA_CTRL_SU (1 << 0) /* Simultaneous update */ +#define CB_DDA_DA_CTRL_EN (1 << 1) /* Enable specified DAC */ +#define CB_DDA_DA_CTRL_DAC(x) ((x) << 2) /* Specify DAC channel */ +#define CB_DDA_DA_CTRL_RANGE2V5 (0 << 6) /* 2.5V range */ +#define CB_DDA_DA_CTRL_RANGE5V (2 << 6) /* 5V range */ +#define CB_DDA_DA_CTRL_RANGE10V (3 << 6) /* 10V range */ +#define CB_DDA_DA_CTRL_UNIP (1 << 8) /* Unipolar range */ #define DACALIBRATION1 4 /* D/A CALIBRATION REGISTER 1 */ /* write bits */ @@ -364,44 +362,35 @@ static int cb_pcidda_ao_winsn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct cb_pcidda_private *devpriv = dev->private; - unsigned int command; - unsigned int channel, range; - - channel = CR_CHAN(insn->chanspec); - range = CR_RANGE(insn->chanspec); + unsigned int channel = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); + unsigned int ctrl; /* adjust calibration dacs if range has changed */ if (range != devpriv->ao_range[channel]) cb_pcidda_calibrate(dev, channel, range); - /* output channel configuration */ - command = NOSU | ENABLEDAC; + ctrl = CB_DDA_DA_CTRL_EN | CB_DDA_DA_CTRL_DAC(channel); - /* output channel range */ switch (range) { case 0: - command |= BIP | RANGE10V; - break; - case 1: - command |= BIP | RANGE5V; - break; - case 2: - command |= BIP | RANGE2V5; - break; case 3: - command |= UNIP | RANGE10V; + ctrl |= CB_DDA_DA_CTRL_RANGE10V; break; + case 1: case 4: - command |= UNIP | RANGE5V; + ctrl |= CB_DDA_DA_CTRL_RANGE5V; break; + case 2: case 5: - command |= UNIP | RANGE2V5; + ctrl |= CB_DDA_DA_CTRL_RANGE2V5; break; } - /* output channel specification */ - command |= channel << 2; - outw(command, dev->iobase + DACONTROL); + if (range > 2) + ctrl |= CB_DDA_DA_CTRL_UNIP; + + outw(ctrl, dev->iobase + CB_DDA_DA_CTRL_REG); /* write data */ outw(data[0], dev->iobase + DADATA + channel * 2); |