Forum Discussion
Altera PCI Express Development Kit: Linux DMA Driver
Hi,
I am a newbie to FPGA design and implementation. While installing the PCI express board on LINUX machine, I don't see Demo application driver for DMA read and write for LINUX (Manual talks about windows installation). I want to generate DMA read and write in Linux box. Does anyone have pointer to a sample application, driver or sof file for the same. Let me know if I am wrong in understanding. Thanks in advance. -Vineet64 Replies
- Altera_Forum
Honored Contributor
Hello Vineet,
Another forum member and I wrote a Linux Device Driver for the scatter gather design that is generated with the Altera PCI Express core wizard. It is now in the kernel tree, in the drivers/staging/ area: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree;f=drivers/staging/altpciechdma;h=ef7dd8fe0e082860742da72655892f12fb088114;hb=f3b8436ad9a8ad36b3c9fa1fe030c7f38e5d3d0b - Altera_Forum
Honored Contributor
Thanks for the pointer
- Altera_Forum
Honored Contributor
--- Quote Start --- Hello Vineet, Another forum member and I wrote a Linux Device Driver for the scatter gather design that is generated with the Altera PCI Express core wizard. It is now in the kernel tree, in the drivers/staging/ area: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree;f=drivers/staging/altpciechdma;h=ef7dd8fe0e082860742da72655892f12fb088114;hb=f3b8436ad9a8ad36b3c9fa1fe030c7f38e5d3d0b --- Quote End --- Do you have a README or test application to test this driver ? Also, it would be good if you can exactly specify which kernel version it has been tested on. Thanks - Altera_Forum
Honored Contributor
According to the .c file, the kernel has been tested by the authors on 2.6.20 and 2.6.24. I've compiled it on 2.6.27 and 2.6.28, and now on 2.6.18 (Red Hat 5), but I had to comment out the cdev.h# include. The authors also state that the file is primarily for testing designs. Linux modules are kind of different from normal c programming and compiling, but good references are LDD3 <http://lwn.net/Kernel/LDD3/> and <http://dirac.org/linux/writing/lkmpg/2.6/lkmpg-2.6.0.html>. The Authors frequently refer to LDD3, but I found the 2nd site's compiling instructions to be more useful.
So you compile the module using make, insert the module using insmod, and then if the driver and board work then you can view the results by issuing the dmesg command. The driver includes a test function that is ran automatically at insmod, when the driver "probes" the device. If it doesn't work, make sure the BAR array defined in the C file matches the BARs defined in your megafunction. In my case, I'm using an Arria GX Design Example that does not use BAR 4, which is non zero in the unmodified driver code. Easy fix though. - Altera_Forum
Honored Contributor
Thanks for the reply. I was able to insmod and rmmod the module. I was trying in latest kernel 2.6.29. I will check with 2.6.24. Thanks for pointers. I also refer to LDD3. Update you if I succeed in running the driver. Thanks again
- Altera_Forum
Honored Contributor
I have tried to insmod into kernel 2.6.24.1 . It gives me "'altpciechdma.ko' : -1 Invalid module format". I assume 2.6.24 means it should work with sub branches of this kernel.
Thanks for help - Altera_Forum
Honored Contributor
I am able to load module and testing it now.
- Altera_Forum
Honored Contributor
Probably you just had to remake the module using the new kernel. Glad to hear you got it working.
- Altera_Forum
Honored Contributor
Well, I am able to register my driver successfully but probe function is not invoked. Lspci gives me unkown altera device. Help.
- Altera_Forum
Honored Contributor
It's probing now. Just ignore previous mail