mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 01:24:12 +08:00
staging: comedi: ni_at_a2150: convert driver to use the comedi_8254 module
The hardware supported by this driver includes an 8254 timer. For aesthetics, convert it to use the comedi_8254 module to provide support for the 8254 timer. 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
af5a97344f
commit
e875132a3a
@ -469,6 +469,7 @@ config COMEDI_ADQ12B
|
||||
config COMEDI_NI_AT_A2150
|
||||
tristate "NI AT-A2150 ISA card support"
|
||||
select COMEDI_ISADMA if ISA_DMA_API
|
||||
select COMEDI_8254
|
||||
---help---
|
||||
Enable support for National Instruments AT-A2150 cards
|
||||
|
||||
|
@ -68,7 +68,7 @@ TRIG_WAKE_EOS
|
||||
|
||||
#include "comedi_isadma.h"
|
||||
#include "comedi_fc.h"
|
||||
#include "8253.h"
|
||||
#include "comedi_8254.h"
|
||||
|
||||
#define A2150_DMA_BUFFER_SIZE 0xff00 /* size in bytes of dma buffer */
|
||||
|
||||
@ -110,8 +110,6 @@ TRIG_WAKE_EOS
|
||||
#define DMA_INTR_EN_BIT 0x800 /* enable interrupt on dma terminal count */
|
||||
#define DMA_DEM_EN_BIT 0x1000 /* enables demand mode dma */
|
||||
#define I8253_BASE_REG 0x14
|
||||
#define I8253_MODE_REG 0x17
|
||||
#define HW_COUNT_DISABLE 0x30 /* disable hardware counting of conversions */
|
||||
|
||||
struct a2150_board {
|
||||
const char *name;
|
||||
@ -488,7 +486,6 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
||||
struct comedi_isadma_desc *desc = &dma->desc[0];
|
||||
struct comedi_async *async = s->async;
|
||||
struct comedi_cmd *cmd = &async->cmd;
|
||||
unsigned long timer_base = dev->iobase + I8253_BASE_REG;
|
||||
unsigned int old_config_bits = devpriv->config_bits;
|
||||
unsigned int trigger_bits;
|
||||
|
||||
@ -547,8 +544,7 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
|
||||
outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG);
|
||||
|
||||
/* may need to wait 72 sampling periods if timing was changed */
|
||||
i8254_set_mode(timer_base, 0, 2, I8254_MODE0 | I8254_BINARY);
|
||||
i8254_write(timer_base, 0, 2, 72);
|
||||
comedi_8254_load(dev->pacer, 2, 72, I8254_MODE0 | I8254_BINARY);
|
||||
|
||||
/* setup start triggering */
|
||||
trigger_bits = 0;
|
||||
@ -726,6 +722,11 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
/* an IRQ and DMA are required to support async commands */
|
||||
a2150_alloc_irq_and_dma(dev, it);
|
||||
|
||||
dev->pacer = comedi_8254_init(dev->iobase + I8253_BASE_REG,
|
||||
0, I8254_IO8, 0);
|
||||
if (!dev->pacer)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = comedi_alloc_subdevices(dev, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -747,10 +748,6 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||
s->cancel = a2150_cancel;
|
||||
}
|
||||
|
||||
/* need to do this for software counting of completed conversions, to
|
||||
* prevent hardware count from stopping acquisition */
|
||||
outw(HW_COUNT_DISABLE, dev->iobase + I8253_MODE_REG);
|
||||
|
||||
/* set card's irq and dma levels */
|
||||
outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user