diff options
| author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-11-04 10:54:53 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-07 09:34:03 -0800 |
| commit | 502ccab2b644f2445af463e434783e56b407f31b (patch) | |
| tree | b1fd728f1886ca9a5e6055b541a374e2131a12fd | |
| parent | dc0a05608d465eda9b340b958af40c1eae61af7b (diff) | |
staging: comedi: addi_apci_3120: tidy up timer 2 programming in apci3120_ai_cmd()
Tidy up the programming of timer 2.
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/addi-data/hwdrv_apci3120.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 3656f9d23ebc..54c85837160e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -426,16 +426,20 @@ static int apci3120_ai_cmd(struct comedi_device *dev, outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG); if (cmd->stop_src == TRIG_COUNT) { - /* configure Timer2 For counting EOS */ - - /* (1) Init timer 2 in mode 0 and write timer value */ + /* + * Timer 2 is used in MODE0 (hardware retriggerable + * one-shot) to count the number of scans. + * + * NOTE: not sure about the -2 value + */ apci3120_timer_set_mode(dev, 2, APCI3120_TIMER_MODE0); - - /* Set the scan stop count (not sure about the -2) */ apci3120_timer_write(dev, 2, cmd->stop_arg - 2); apci3120_clr_timer2_interrupt(dev); + apci3120_timer_enable(dev, 2, true); + + /* configure Timer 2 For counting EOS */ devpriv->mode |= APCI3120_MODE_TIMER2_AS_COUNTER | APCI3120_MODE_TIMER2_CLK_EOS | APCI3120_MODE_TIMER2_IRQ_ENA; @@ -443,8 +447,6 @@ static int apci3120_ai_cmd(struct comedi_device *dev, devpriv->b_Timer2Mode = APCI3120_COUNTER; devpriv->b_Timer2Interrupt = 1; - - apci3120_timer_enable(dev, 2, true); } } |
