Forum Discussion
Altera_Forum
Honored Contributor
17 years agoAltera 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
As far as I know, the altpciechdma.c is not a char driver,or it is?
I wonder,how could I access this driver from yhe userspace? Somebody has experience using this driver in Linux? I cannot see this driver in $/dev/ . - Altera_Forum
Honored Contributor
--- Quote Start --- As far as I know, the altpciechdma.c is not a char driver,or it is? I wonder,how could I access this driver from yhe userspace? Somebody has experience using this driver in Linux? I cannot see this driver in $/dev/ . --- Quote End --- Up to now, I used the driver only for debugging my design. Perfomed some read/write accesses and allocated some memory for DMA writing from FPGA. I just removed the selftest function and replaced it by my own code (plus some minor changes in the rest of the driver). For this purpose you just have to compile the modules first (take a look at LDD3 oder at http://www.dirac.org/linux/writing/lkmpg/2.6/lkmpg-2.6.0.html which was quite well for me since I had some version problems). Then you have load the modules into the kernel (insmod), thats it! - Altera_Forum
Honored Contributor
I've also had problems with the compiling of this driver.
"Make" command gives a lot of errors,so I builded this driver using KDelevop. I loaded him into the kernel using modprobe command. "lsmod" displays this driver,but he is absent in$/dev/.... I suppose,I have to write the register part by myself.(register_chrdev(200,"altera",&fops.....)...). By the way this driver is still under development. Under selftest function,you mean the "probe" function. Can you post the changes? - Altera_Forum
Honored Contributor
--- Quote Start --- I've also had problems with the compiling of this driver. "Make" command gives a lot of errors,so I builded this driver using KDelevop. I loaded him into the kernel using modprobe command. "lsmod" displays this driver,but he is absent in$/dev/.... I suppose,I have to write the register part by myself.(register_chrdev(200,"altera",&fops.....)...). By the way this driver is still under development. Under selftest function,you mean the "probe" function. Can you post the changes? --- Quote End --- At the end of probe() there is a function call for the dma selftest. If you loaded the module you can use dmesg to view the printk message output. - Altera_Forum
Honored Contributor
Thank's for help.
- Altera_Forum
Honored Contributor
Hi
I am using x4 Arria GX Dev kit on Intel Core2Duo x86 64. My probe function gives me : ...... Enabled MSI interrupting. Using a 64-bit DMA mask. IRQ pin# 0 (0=none, 1=INTA#...4=INTD#). IRQ line# 0. Could not request IRQ# 251, error -38 altpciechdma: probe of 0000:01:00.0 failed with error -38 .... How do I have to specify the BAR's? static const unsigned long bar_min_len[APE_BAR_NUM] = { 32768, 0, 256, 0, 32768, 0 }; I dont understand,if the WinDriver doesnt let me to take the interrupt line, which I have already uninstalled, or I've incorrectly specified the BAR's? - Altera_Forum
Honored Contributor
I followed this thread to test the DMA driver. It worked OK with 32bit Fedora 11. When we moved the card to CentOS 4.3 64bit linux, the dma_test failed. I can't figure out why, please help!
Here is the dmesg: altpciechdma init(), built at Oct 13 2009 13:54:17 probe(dev = 0xffff81015fb33800, pciid = 0xffffffff88661b80) probe() ape = 0xffff81015c9ac7c0 sizeof(struct ape_chdma_table) = 4096. table_virt = 0xffff810140e35000, table_bus = 0x 140e35000. PCI: Enabling device 0000:06:00.0 (0000 -> 0002) PCI: Setting latency timer of device 0000:06:00.0 to 64 Enabled MSI interrupting. Using a 64-bit DMA mask. IRQ pin# 0 (0=none, 1=INTA#...4=INTD#). IRQ line# 0. Succesfully requested IRQ# 194 with dev_id 0xffff81015c9ac7c0 BAR0 0xc0000000-0xcfffffff flags 0x00000200 BAR1 0xdcf80000-0xdcfbffff flags 0x00000200 BAR2 0xdcfc0000-0xdcffffff flags 0x00000200 BAR[0] mapped at 0xffffc20010370000 with length 32768(/268435456). BAR[2] mapped at 0xffffc2000002a000 with length 256(/262144). bar_tests(), PAGE_SIZE = 0x1000 write_header = 0xffffc2000002a000. read_header = 0xffffc2000002a010. &write_header->w3 = 0xffffc2000002a00c &read_header->w3 = 0xffffc2000002a01c ape->table_virt = 0xffff810140e35000. Allocated cache-coherent DMA buffer (virtual address = 0xffff810140784000, bus address = 0x0000000140784000). writing 0x000400ff to 0xffffc2000002a010 writing 0x00000001 to 0xffffc2000002a014 writing 0x40e35000 to 0xffffc2000002a018 Flush posted writes Start DMA read writing 0x000000fe to 0xffffc2000002a01c EPLAST = 64222 POLL FOR READ: EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 .............. Start DMA write POLL FOR WRITE: EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 EPLAST = 64222, n = 254 ................ [ffff810140784000] = 0x40784000 != [ffff810140786000] = 0x40786000 ?! [ffff810140784004] = 0x40784004 != [ffff810140786004] = 0x40786004 ?! [ffff810140784008] = 0x40784008 != [ffff810140786008] = 0x40786008 ?! [ffff81014078400c] = 0x4078400c != [ffff81014078600c] = 0x4078600c ?! [ffff810140784010] = 0x40784010 != [ffff810140786010] = 0x40786010 ?! [ffff810140784014] = 0x40784014 != [ffff810140786014] = 0x40786014 ?! [ffff810140784018] = 0x40784018 != [ffff810140786018] = 0x40786018 ?! [ffff81014078401c] = 0x4078401c != [ffff81014078601c] = 0x4078601c ?! [ffff810140784020] = 0x40784020 != [ffff810140786020] = 0x40786020 ?! ---more errors follow! not printed--- DMA loop back test FAILED. bar_tests() end, result -1 probe() successful. - Altera_Forum
Honored Contributor
Well,I decided to give the altpcichdma driver manually the interrupt line.
From the /proc/interrupts,give the driver a free INT.In mine case INT#7. Write dev->irq_line=7. irq_line=7. rc=request_int(7,...); Dont let the driver to automatically detect the INT. In that case I've passed the DMA test successfuly. BAR[0] mapped at 0xffffc20010370000 with length 32768(/268435456). BAR[2] mapped at 0xffffc2000002a000 with length 256(/262144). Specify the bar struct={268435456,0,262144}; - Altera_Forum
Honored Contributor
Is there any way to watch the DMA transfer ArriaGX<->PCIe,or even better to save it in a file?
Maybe there are specified progs? - Altera_Forum
Honored Contributor
In altpciechdma, the EP address is set to 4096. Can anyone help explaining why 4096? and if 46bit Linux will have different address?
Thanks