4
votes

I am trying to write a linux driver for a PCIe device - the Adlink PCIe 7300A High-Speed digital-IO card.

The driver works fine for normal memory transfer, but attempting to use the card's bus-mastering capabilities to initiate DMA transfer of a buffer from CPU memory to the device's output FIFO buffer simply does not work.

I have been trying to solve this problem on the order of weeks, not on the order of days.

Any insight at all would really really be appreciated.

Driver code -- https://github.com/sbrookes/timing_driver_sdarn/blob/master/kernel_land/timing.c

Device Datasheet -- http://www.acceed.com/manuals/adlink/P7300A%20Manual.PDF

PLX 9080 PCI Interface chip Datasheet -- http://www.der-ingo.de/bin/milanhelp/PLX9080.pdf

I can not explain how much I would appreciate any bit of insight.

Thank you,

Scott

1
That driver is horribly buggy all over, but SO is not the correct site for code reviews. Anyway, what is the value of dma_bus_addr?CL.
@CL. - Sorry if I am polluting SO with bad questions. I don't know where else to turn.s.brookes
@CL. - Didn't mean to submit that so soon... anyway dma_virt_addr = pci_alloc_consistent(dev, 20*1024, &dma_bus_addr); printk(KERN_DEBUG "dma_bus_addr is 0x%x\n", dma_bus_addr); reports dma_bus_addr is 0x2c538000 but I don't know that this is the same each time I load the module... I want to play nice on this site, tell me what I can do to make sure of that? I can not explain how much I appreciate your help. Interested in all bugs as well as "best practices" too, btw. Thank you.s.brookes
Isn't dma_addr_t a 64-bit value?CL.
@CL. My card only has a 32 bit register for the destination address. So even if it is 64 bits the printk is trimming the leading zeros I think.s.brookes

1 Answers

3
votes

I seem to have solved the problem. It seems like there was an incorrect condition in the interrupt handler that was aborting the DMA transfer at the wrong time, never letting the transfer even begin.

A serious "duh" moment, but it took serious struggle to find it.

As per the comments, sorry if I polluted SO with my desperation. Still learning how to be a good citizen.

Not sure if the code linked above will remain static as my project changes or whether that link will reflect the most current version. Basically just be careful not to abort your transfer at the wrong time.