View Single Post
  #4 (permalink)  
Old 05-09-2006, 03:03 AM
Mark McDougall
Posts: n/a
Default Re: PCI Express and DMA

SongDragon wrote:

> I am looking for some assistance writing a driver and FPGA code to
> handle DMA on a PCI Express system. The FPGA is a Xilinx V2P with a
> Xilinx x4 PCIe LogiCORE (v3.0).

Assuming the LogiCORE is capable of bus mastering, you need to
instantiate a 'DMA controller' in your FPGA; either your own design or
borrowed from another source.

A 'DMA controller' can simply be a set of registers (sometimes referred
to as 'descriptors') mapped into the host address space that allow the
software to set a DMA transfer - source address, destination address,
transfer size, control/status etc - hit a 'GO' bit, and generate an
interrupt when it's done. If you want to get more fancy, add multiple
channels, scatter-gather descriptors, request queuing, etc.

From the back side of the PCIe core, all the DMA controller does is
request the bus and issue a standard (burst in PCI-land) read/write
to/from the source/destination addresses in the register. PCIe itself
has no concept of 'DMA' - all it sees is another PCIe transfer.

Exactly how you establish the transfer in the core is dependent on the
backend interface of the LogiCORE. You shouldn't have to worry about the
format of the TLP at all if there's a decent backend interface.

> Are there any reference designs /
> sample code available?

A DMA controller IP core for PCI would still illustrate the concepts and
give some insight into what you're up for. At the risk of muddying the
waters further, there's a wishbone DMA core on opencores which can
ultimately be used for PCI DMA transfers when connected to a PCI core
(the opencores PCI core is a wishbone bridge so it bolts straight on).
Might even be worth just looking at the doco for it.

As for the driver, that will depend on what class of device you're
implementing, especially if you're talking about windows. Your best bet
there is to find an open-source/example driver for a similar device. If
you're doing windows and need a 'grass-roots' high performance driver,
prepare yourself for a frustrating and challenging time.


Mark McDougall, Engineer
Virtual Logic Pty Ltd, <>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266
Reply With Quote