From 25355e0993c1cb0dfe8bc7392f1ed04a4adb2b19 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Tue, 24 Jul 2001 00:28:28 +0000 Subject: [PATCH] added virt_to_bus() translations to set_dma_addr() arguments --- comedi/drivers/das16.c | 6 ++++-- comedi/drivers/das1800.c | 8 ++++---- comedi/drivers/ni_at_a2150.c | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index c9df9c21..3c519741 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -23,6 +23,8 @@ ************************************************************************ +Testing and debugging help provided by Daniel Koch. + Options: [0] - base io address [1] - irq (optional) @@ -814,7 +816,7 @@ static int das16_cmd_exec(comedi_device *dev,comedi_subdevice *s) /* clear flip-flop to make sure 2-byte registers for * count and address get set correctly */ clear_dma_ff(devpriv->dma_chan); - set_dma_addr(devpriv->dma_chan, (unsigned int) devpriv->dma_buffer); + set_dma_addr(devpriv->dma_chan, virt_to_bus(devpriv->dma_buffer)); // set appropriate size of transfer devpriv->dma_transfer_size = das16_suggest_transfer_size(*cmd); if(devpriv->adc_count * sample_size > devpriv->dma_transfer_size) @@ -1045,7 +1047,7 @@ static void das16_interrupt(int irq, void *d, struct pt_regs *regs) if(devpriv->adc_count > 0) devpriv->adc_count--; } // re-enable dma - set_dma_addr(devpriv->dma_chan, (unsigned int) devpriv->dma_buffer); + set_dma_addr(devpriv->dma_chan, virt_to_bus(devpriv->dma_buffer)); set_dma_count(devpriv->dma_chan, leftover * sample_size); enable_dma(devpriv->dma_chan); release_dma_lock(flags); diff --git a/comedi/drivers/das1800.c b/comedi/drivers/das1800.c index 154e3654..3fe02302 100644 --- a/comedi/drivers/das1800.c +++ b/comedi/drivers/das1800.c @@ -980,7 +980,7 @@ static void das1800_handle_dma(comedi_device *dev, comedi_subdevice *s) // re-enable dma (single dma) if((dual_dma == 0) && leftover) { - set_dma_addr(devpriv->dma_current, (unsigned int) devpriv->dma_current_buf); + set_dma_addr(devpriv->dma_current, virt_to_bus(devpriv->dma_current_buf)); set_dma_count(devpriv->dma_current, leftover * sizeof(short)); enable_dma(devpriv->dma_current); release_dma_lock(flags); @@ -1006,7 +1006,7 @@ static void das1800_handle_dma(comedi_device *dev, comedi_subdevice *s) { if(leftover) { - set_dma_addr(devpriv->dma_current, (unsigned int) buffer); + set_dma_addr(devpriv->dma_current, virt_to_bus(buffer)); set_dma_count(devpriv->dma_current, leftover * sizeof(short)); enable_dma(devpriv->dma_current); release_dma_lock(flags); @@ -1396,7 +1396,7 @@ void setup_dma(comedi_device *dev, comedi_cmd cmd) /* clear flip-flop to make sure 2-byte registers for * count and address get set correctly */ clear_dma_ff(devpriv->dma0); - set_dma_addr(devpriv->dma0, (unsigned int) devpriv->dma_buf0); + set_dma_addr(devpriv->dma0, virt_to_bus(devpriv->dma_buf0)); // set appropriate size of transfer if(devpriv->count * sizeof(short) >= devpriv->dma_buf_size || devpriv->forever) set_dma_count(devpriv->dma0, devpriv->dma_buf_size); @@ -1409,7 +1409,7 @@ void setup_dma(comedi_device *dev, comedi_cmd cmd) /* clear flip-flop to make sure 2-byte registers for * count and address get set correctly */ clear_dma_ff(devpriv->dma1); - set_dma_addr(devpriv->dma1, (unsigned int) devpriv->dma_buf1); + set_dma_addr(devpriv->dma1, virt_to_bus(devpriv->dma_buf1)); // set appropriate size of transfer if(devpriv->count * sizeof(short) >= 2 * devpriv->dma_buf_size || devpriv->forever) set_dma_count(devpriv->dma1, devpriv->dma_buf_size); diff --git a/comedi/drivers/ni_at_a2150.c b/comedi/drivers/ni_at_a2150.c index 2265c8a4..4009fd01 100644 --- a/comedi/drivers/ni_at_a2150.c +++ b/comedi/drivers/ni_at_a2150.c @@ -294,7 +294,7 @@ static void a2150_interrupt(int irq, void *d, struct pt_regs *regs) } } // re-enable dma - set_dma_addr(devpriv->dma, (unsigned int) devpriv->dma_buffer); + set_dma_addr(devpriv->dma, virt_to_bus(devpriv->dma_buffer)); set_dma_count(devpriv->dma, leftover * sample_size); enable_dma(devpriv->dma); release_dma_lock(flags); @@ -676,7 +676,7 @@ static int a2150_ai_cmd(comedi_device *dev, comedi_subdevice *s) /* clear flip-flop to make sure 2-byte registers for * count and address get set correctly */ clear_dma_ff(devpriv->dma); - set_dma_addr(devpriv->dma, (unsigned int) devpriv->dma_buffer); + set_dma_addr(devpriv->dma, virt_to_bus(devpriv->dma_buffer)); // set size of transfer to fill in 1/3 second devpriv->dma_transfer_size = sizeof(devpriv->dma_buffer[0]) * cmd->chanlist_len * (1000000000.0 / 3.0 ) / cmd->scan_begin_arg; -- 2.26.2