Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Linux-Driver for Altera PCIe HIP or simple methode to access PCIe

Hi everyone!

I know it's an old problem, but I don't see it solved yet.

I' currently working on a FPGA-Design on the Arria II GX Development Kit. I made a I2C-Core which I now have to feed with some bits and bytes (Device adress, Datas and so on (I think PIOs are a good choice)). I connected my core over the PIOs with the PCIe Compiler in the design example "a2gx_qsys_pcie_gen1x4" (from http://www.alterawiki.com/wiki/pci_express_in_qsys_example_designs) and kicked out the On-Chip-Memory because I placed my PIOs on its base-adresses.

My host-pc has to be a Debian 6.0.

Now I just want to access the base-adresses of my PIOs to check if my core works. Just like the "Simple version of software source code" found also here: http://www.alterawiki.com/uploads/b/b4/alt_pcie_qsys_simple_sw.zip

I've tested it long ago with windows, but it uses a jungo-driver which only works for 30 days.

I only need a very simple driver. I just want to read/write on the base-adresses.

My biggest problem I just have absolutely no knowledge about Linux-Drivers.

Is there someone out there who can help me a bit getting started?

Or has Altera finally wrote a useful but simple driver?

I've already tried these:

http://trac.assembla.com/altpciechdma/browser/

: seems incomplete and hasn't been accessed for four years now.

ftp://ftp.altera.com/up/pub/altera_material/12.0/tutorials/using_pcie_on_de4_design_files.zip

ftp://ftp.altera.com/up/pub/altera_material/12.0/tutorials/

: looks good, at least I THINK I installed the module but then something crashed.

Please Help.

Thank you.

13 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'd steal the PCI code, but write a character driver.

    You can then use preadv() and pwritev() in the application, and a 'first cut' driver just does copy_to/from_user() directly from the user buffer to the io_remmap()ed pcie addresses.

    If you remember to update the file offset, you can use hexdump as a test program (might do lots of 16 byte reads).

    Getting dma working involves finding the correct dma engine! Given that a 1k transfer probably doesn't take significantly longer than a single word you probably want to spin waiting for 'dma done', not an interrupt terminated dma. You also want a dma that is cheap to setup.

    For the ppc we use linux doesn't have a driver at all for the pcie dma block - so I could write a very simple one.