LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-11-2010, 01:09 AM   #1
ramukaka
LQ Newbie
 
Registered: Oct 2009
Posts: 20

Rep: Reputation: 0
DMA transfer within kernel space


Hi,

I am new to linux device driver development and I'm trying to learn the
DMA transfer. Currently I have created a DMA buffer using pci_alloc_consistent() function. Since I don't have a real DMA enabled pci device, so I am thinking of transfer the data in the DMA buffer to some other buffer within kernel space(let say created through kmalloc) using DMA.

Is it possible to do DMA transfer within kernel space? If yes, please provide some sample code for the same.

Thanks in advance
Ravi Gupta
 
Old 08-11-2010, 01:34 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Yes, the kernel can do DMA.

And no, no software (not even the kernel) can do DMA transfer without DMA hardware.

Suggestion:
Read this article and see if it clears anything up for you:
http://www.xml.com/ldd/chapter/book/ch13.html#t4
<= it sounds like you're already familiar with some/all of this
but I think it might be useful to (re)read anyway...
 
Old 08-11-2010, 01:57 AM   #3
ramukaka
LQ Newbie
 
Registered: Oct 2009
Posts: 20

Original Poster
Rep: Reputation: 0
>> Yes, the kernel can do DMA.
That I know but is it possible to do it within RAM?

>>And no, no software (not even the kernel) can do DMA transfer without DMA hardware.
Is there anyway to check whether your hardware supports DMA, I am currently developing on standard x86 based machine.

anyway thanks for the quick reply.
 
Old 08-11-2010, 12:13 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Is there anyway to check whether your hardware supports DMA
Yes.

The link I cited above (Linux Device Drivers, Rubini & Corbet) cites this kernel API: pci_dma_supported().

It also has sample code, much (essential!) background information, and details about what to do if your device doesn't happen to be a PCI device.

'Hope that helps .. PSM

Last edited by paulsm4; 08-11-2010 at 12:14 PM.
 
Old 01-20-2011, 06:51 PM   #5
mhamzeh
LQ Newbie
 
Registered: Jan 2011
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by ramukaka View Post
Hi,

I am new to linux device driver development and I'm trying to learn the
DMA transfer. Currently I have created a DMA buffer using pci_alloc_consistent() function. Since I don't have a real DMA enabled pci device, so I am thinking of transfer the data in the DMA buffer to some other buffer within kernel space(let say created through kmalloc) using DMA.

Is it possible to do DMA transfer within kernel space? If yes, please provide some sample code for the same.

Thanks in advance
Ravi Gupta
Hi,

I am also new in linux device driver world. I have the same issue and I would like to use DMA to copy from memory to memory. However, when I use APIs provided in dmaengine.h such as dma_request_channel or dma_find_channel with all combination of masks, the function returns NULL. On the other hand, when I use lower level APIs such as dma_request I can get a channel which implies that there are free channels in my system to use. Any suggestion?

Thanks
Mahdi
 
  


Reply

Tags
kernel


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Transfer data from kernel to user space pmil Programming 11 08-01-2009 05:23 AM
DMA xmit from kernel space to pci device memory amirh Linux - Software 1 04-06-2007 04:10 PM
DMA xmit from kernel space to pci device memory amirh Linux - Newbie 0 04-06-2007 04:06 PM
Unable to use DMA transfer modes Rounan Linux - Hardware 14 02-20-2004 10:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:47 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