LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-04-2006, 08:32 AM   #1
bloggins
LQ Newbie
 
Registered: Mar 2006
Posts: 1

Rep: Reputation: 0
Need to program the DMA engine on a PC


I have a Tyan Thunder K8S PRO motherboard with dual AMD-64 Opterons on it. Its running Linux 2.6.11 gentoo. I have written the applications and drivers for the system I need but the one thing I have not been successful is in using DMA to transfer data from one of the cards to user space. To just memory map it and the to use memcpy() is not fast enough. I need burst mode to be used in transferring the data.

I have looked through the book "Linux Device Drivers" 3rd edition and in it is some of the required driver routines for setting up the DMA to a point. However, it would appear to only have one side of the DMA transfer described.

I need to transfer from RAM on my card to RAM in my user space. I created the driver entry point adc_read() so that a call to read() on my driver would take it as the entry point. The following code is what I have so far...

flags = claim_dma_lock();
disable_dma(ADC_DMA_CHANNEL);
clear_dma_ff(ADC_DMA_CHANNEL);
set_dma_mode(ADC_DMA_CHANNEL,DMA_MODE_READ);
set_dma_addr(ADC_DMA_CHANNEL,adcDmaBusAddr);
set_dma_count(ADC_DMA_CHANNEL,count);
enable_dma(ADC_DMA_CHANNEL);
while(get_dma_residue(ADC_DMA_CHANNEL) != 0);
release_dma_lock(flags);

this is essentially copied from the book I mentioned above. My problem is, I'm only giving the DMA one address. How can this possibly work and where would I set the address of the destination? Also, that while loop is potentially a disaster since this resides in the driver code. I need a done bit or some such but I could code around this by having an ioctl call to block until this transfer was complete.

I would like to hear from anyone who has done this in the past or who knows a good url to check out for examples.

Cheers!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard Drive Problems: timeout waiting for DMA; error waiting for DMA mintee Linux - Hardware 10 09-21-2007 05:06 AM
Skinning engine rpz Programming 0 09-15-2005 12:35 PM
besides xine engine, what else engine can be used in kaffeine? bravehao Linux - Newbie 1 06-04-2005 07:34 AM
Suse 8.2 change my DMA setting on my DVD-R drive to off & IDE DMA MODE NOT SHOWING IT maximalred Linux - General 0 08-23-2003 04:58 AM
Search Engine? phek Linux - General 1 09-20-2001 07:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration