public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Custom PCIe Device Driver
@ 2008-01-26 13:10 Sanka Piyaratna
  0 siblings, 0 replies; 2+ messages in thread
From: Sanka Piyaratna @ 2008-01-26 13:10 UTC (permalink / raw)
  To: linux-kernel

Hi Everyone,

I am currently developing a custom PCIe device and the Linux kernel 
driver for this. I am able to use the device as a character device with 
PIO and now I am working on getting the DMA to work. I have implemented 
2 BARs (BAR0 - mem and BAR5 - mem) in the PCIe device. I have 
implemented the DMA in my custom device firmware to transfer a block of 
memory via the PCIe bus and now trying to get this to work with the 
device driver.

As I understand it, I can get hold of the PCI bus to become the bus 
master and then initiate the DMA transfer from my device. However, I 
don't understand how I can specify within my kernel driver how to 
specify which BAR to use.

Does this mean when I initiate a transfer from the hardware, the memory 
get transferred into the location allocated by by  pci_map_single() 
function regardless of which BAR the memory comes from? or do I need to 
specify the BAR using a mask?

Would some one be able to point me to an example code please?

Thanks and Regards,

Sanka

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Custom PCIe Device Driver
       [not found] <fa.lEecbnbm5VCSz+Y6rXCe4LJLkqw@ifi.uio.no>
@ 2008-01-27  1:46 ` Robert Hancock
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Hancock @ 2008-01-27  1:46 UTC (permalink / raw)
  To: Sanka Piyaratna; +Cc: linux-kernel

Sanka Piyaratna wrote:
> Hi Everyone,
> 
> I am currently developing a custom PCIe device and the Linux kernel 
> driver for this. I am able to use the device as a character device with 
> PIO and now I am working on getting the DMA to work. I have implemented 
> 2 BARs (BAR0 - mem and BAR5 - mem) in the PCIe device. I have 
> implemented the DMA in my custom device firmware to transfer a block of 
> memory via the PCIe bus and now trying to get this to work with the 
> device driver.
> 
> As I understand it, I can get hold of the PCI bus to become the bus 
> master and then initiate the DMA transfer from my device. However, I 
> don't understand how I can specify within my kernel driver how to 
> specify which BAR to use.
> 
> Does this mean when I initiate a transfer from the hardware, the memory 
> get transferred into the location allocated by by  pci_map_single() 
> function regardless of which BAR the memory comes from? or do I need to 
> specify the BAR using a mask?
> 
> Would some one be able to point me to an example code please?
> 
> Thanks and Regards,
> 
> Sanka

Your question doesn't seem to make much sense. DMA transfers have 
nothing to do with BARs at all, they don't come "from" or "to" one.

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-27  1:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <fa.lEecbnbm5VCSz+Y6rXCe4LJLkqw@ifi.uio.no>
2008-01-27  1:46 ` Custom PCIe Device Driver Robert Hancock
2008-01-26 13:10 Sanka Piyaratna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox