K
K
Kamikaze10242014-11-26 10:29:55
linux
Kamikaze1024, 2014-11-26 10:29:55

How to access device pci memory when writing a driver under Linux?

There is a pci board based on the plx controller. It has its own memory. How to access the cells of this memory when implementing a linux driver?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2014-11-26
@leahch

Here it is important to know how this board is visible on PCI. Is there DMA, or just PCI registers?
Explain long enough, it is better to read, and if something is not clear, ask more specific questions.
General:
- find the pci_get_device() device
- set the PCI registers, enable the device
- set the interrupt handler
- map DMA and registers
- further, we usually work through interrupt handling, IOCTL implementation or through the device descriptor. (about the implementation of your ioctls, it's better to first see if any of the existing ones fit)
Documentation on working with PCI from the driver - https://www.kernel.org/doc/Documentation/PCI/pci.txt
Very good explanation of how PCI works -www.tldp.org/LDP/tlk/dd/pci.html
And be sure to read this book in full - www.tldp.org/LDP/tlk You
can start developing fast drivers with Pomeranz (but there is no PCI, but only implementation examples drivers) www.tldp.org/LDP/lkmpg/2.6/html/index.html
In any case, to help lspci, the documentation in the kernel itself and of course the sources of the drivers and what I recommended.
PS. And yes, it is not as difficult as I have written! A simple PCI driver in 100-150 lines!!!!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question