staging: comedi: das16m1: clarify 8254 timer programming
Refactor the 8254 timer programming to use the i8254_set_mode() and i8254_write() helpers instead of i8254_load(). This allows us to use the I8254_MODE* defines to clarify the code. 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:
parent
22e09dff08
commit
bef74ba884
@ -272,6 +272,7 @@ static int das16m1_cmd_exec(struct comedi_device *dev,
|
|||||||
struct das16m1_private_struct *devpriv = dev->private;
|
struct das16m1_private_struct *devpriv = dev->private;
|
||||||
struct comedi_async *async = s->async;
|
struct comedi_async *async = s->async;
|
||||||
struct comedi_cmd *cmd = &async->cmd;
|
struct comedi_cmd *cmd = &async->cmd;
|
||||||
|
unsigned long timer_base = dev->iobase + DAS16M1_8254_FIRST;
|
||||||
unsigned int byte, i;
|
unsigned int byte, i;
|
||||||
|
|
||||||
/* disable interrupts and internal pacer */
|
/* disable interrupts and internal pacer */
|
||||||
@ -283,11 +284,11 @@ static int das16m1_cmd_exec(struct comedi_device *dev,
|
|||||||
/* Initialize lower half of hardware counter, used to determine how
|
/* Initialize lower half of hardware counter, used to determine how
|
||||||
* many samples are in fifo. Value doesn't actually load into counter
|
* many samples are in fifo. Value doesn't actually load into counter
|
||||||
* until counter's next clock (the next a/d conversion) */
|
* until counter's next clock (the next a/d conversion) */
|
||||||
i8254_load(dev->iobase + DAS16M1_8254_FIRST, 0, 1, 0, 2);
|
i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY);
|
||||||
|
i8254_write(timer_base, 0, 1, 0);
|
||||||
/* remember current reading of counter so we know when counter has
|
/* remember current reading of counter so we know when counter has
|
||||||
* actually been loaded */
|
* actually been loaded */
|
||||||
devpriv->initial_hw_count =
|
devpriv->initial_hw_count = i8254_read(timer_base, 0, 1);
|
||||||
i8254_read(dev->iobase + DAS16M1_8254_FIRST, 0, 1);
|
|
||||||
/* setup channel/gain queue */
|
/* setup channel/gain queue */
|
||||||
for (i = 0; i < cmd->chanlist_len; i++) {
|
for (i = 0; i < cmd->chanlist_len; i++) {
|
||||||
outb(i, dev->iobase + DAS16M1_QUEUE_ADDR);
|
outb(i, dev->iobase + DAS16M1_QUEUE_ADDR);
|
||||||
|
Loading…
Reference in New Issue
Block a user