提交 9bd53e03 编写于 作者: I Ian Abbott 提交者: Greg Kroah-Hartman

staging: comedi: ni_labpc: migrate DMA status handling

Migrate the code for checking and handling the interrupt status handling
for ISA DMA transfers into new a new function
`labpc_handle_dma_status()` in the "ni_labpc_isadma" module.  Provide a
dummy inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma"
module is not being built.

The static function `handle_isa_dma()` also needs to move across to the
new module.
Signed-off-by: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 f88e8e09
......@@ -905,20 +905,6 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return 0;
}
#ifdef CONFIG_ISA_DMA_API
static void handle_isa_dma(struct comedi_device *dev)
{
struct labpc_private *devpriv = dev->private;
labpc_drain_dma(dev);
enable_dma(devpriv->dma_chan);
/* clear dma tc interrupt */
devpriv->write_byte(0x1, dev->iobase + DMATC_CLEAR_REG);
}
#endif
/* read all available samples from ai fifo */
static int labpc_drain_fifo(struct comedi_device *dev)
{
......@@ -1003,18 +989,9 @@ static irqreturn_t labpc_interrupt(int irq, void *d)
return IRQ_HANDLED;
}
#ifdef CONFIG_ISA_DMA_API
if (devpriv->current_transfer == isa_dma_transfer) {
/*
* if a dma terminal count of external stop trigger
* has occurred
*/
if (devpriv->stat1 & STAT1_GATA0 ||
(board->is_labpc1200 && devpriv->stat2 & STAT2_OUTA1)) {
handle_isa_dma(dev);
}
} else
#endif
if (devpriv->current_transfer == isa_dma_transfer)
labpc_handle_dma_status(dev);
else
labpc_drain_fifo(dev);
if (devpriv->stat1 & STAT1_CNTINT) {
......
......@@ -137,6 +137,33 @@ void labpc_drain_dma(struct comedi_device *dev)
}
EXPORT_SYMBOL_GPL(labpc_drain_dma);
static void handle_isa_dma(struct comedi_device *dev)
{
struct labpc_private *devpriv = dev->private;
labpc_drain_dma(dev);
enable_dma(devpriv->dma_chan);
/* clear dma tc interrupt */
devpriv->write_byte(0x1, dev->iobase + DMATC_CLEAR_REG);
}
void labpc_handle_dma_status(struct comedi_device *dev)
{
const struct labpc_boardinfo *board = comedi_board(dev);
struct labpc_private *devpriv = dev->private;
/*
* if a dma terminal count of external stop trigger
* has occurred
*/
if (devpriv->stat1 & STAT1_GATA0 ||
(board->is_labpc1200 && devpriv->stat2 & STAT2_OUTA1))
handle_isa_dma(dev);
}
EXPORT_SYMBOL_GPL(labpc_handle_dma_status);
int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan)
{
struct labpc_private *devpriv = dev->private;
......
......@@ -20,6 +20,7 @@ int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan);
void labpc_free_dma_chan(struct comedi_device *dev);
void labpc_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s);
void labpc_drain_dma(struct comedi_device *dev);
void labpc_handle_dma_status(struct comedi_device *dev);
#else
......@@ -47,6 +48,10 @@ static inline void labpc_drain_dma(struct comedi_device *dev)
{
}
static inline void labpc_handle_dma_status(struct comedi_device *dev)
{
}
#endif
#endif /* _NI_LABPC_ISADMA_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册