2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-03 11:13:56 +08:00

staging: comedi: pcl816: introduce pcl816_isadma_program()

Introduce a helper function to program the ISA DMA controller. Program
the ISA DMA as described in Documentation/DMA-ISA-LPC.txt.

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:
H Hartley Sweeten 2015-01-13 10:16:22 -07:00 committed by Greg Kroah-Hartman
parent bed8d5381c
commit d77bf9736b

View File

@ -133,6 +133,20 @@ struct pcl816_private {
unsigned int ai_cmd_canceled:1;
};
static void pcl816_isadma_program(unsigned int dma_chan,
struct pcl816_dma_desc *dma)
{
unsigned long flags;
flags = claim_dma_lock();
clear_dma_ff(dma_chan);
set_dma_mode(dma_chan, DMA_MODE_READ);
set_dma_addr(dma_chan, dma->hw_addr);
set_dma_count(dma_chan, dma->size);
enable_dma(dma_chan);
release_dma_lock(flags);
}
static void pcl816_start_pacer(struct comedi_device *dev, bool load_counters)
{
struct pcl816_private *devpriv = dev->private;
@ -158,7 +172,6 @@ static void pcl816_ai_setup_dma(struct comedi_device *dev,
struct pcl816_private *devpriv = dev->private;
struct pcl816_dma_desc *dma = &devpriv->dma_desc[0];
struct comedi_cmd *cmd = &s->async->cmd;
unsigned int dma_flags;
if (cmd->stop_src == TRIG_COUNT) {
/* how many */
@ -178,13 +191,8 @@ static void pcl816_ai_setup_dma(struct comedi_device *dev,
}
devpriv->cur_dma = 0;
set_dma_mode(devpriv->dma, DMA_MODE_READ);
dma_flags = claim_dma_lock();
clear_dma_ff(devpriv->dma);
set_dma_addr(devpriv->dma, dma->hw_addr);
set_dma_count(devpriv->dma, dma->size);
release_dma_lock(dma_flags);
enable_dma(devpriv->dma);
pcl816_isadma_program(devpriv->dma, dma);
}
static void pcl816_ai_setup_next_dma(struct comedi_device *dev,
@ -193,7 +201,6 @@ static void pcl816_ai_setup_next_dma(struct comedi_device *dev,
struct pcl816_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
struct pcl816_dma_desc *dma;
unsigned long dma_flags;
disable_dma(devpriv->dma);
if (devpriv->dma_runs_to_end > -1 || cmd->stop_src == TRIG_NONE) {
@ -204,12 +211,8 @@ static void pcl816_ai_setup_next_dma(struct comedi_device *dev,
dma->size = devpriv->hwdmasize;
else
dma->size = devpriv->last_dma_run;
set_dma_mode(devpriv->dma, DMA_MODE_READ);
dma_flags = claim_dma_lock();
set_dma_addr(devpriv->dma, dma->hw_addr);
set_dma_count(devpriv->dma, dma->size);
release_dma_lock(dma_flags);
enable_dma(devpriv->dma);
pcl816_isadma_program(devpriv->dma, dma);
}
devpriv->dma_runs_to_end--;