简体   繁体   中英

How to make PCI device initiate a DMA operation?

I need to find a way to trigger DMA operations easily at my command to facilitate hardware debugging. Is it possible to initialize a DMA read on existing PCI device (eg sound card or netcard) in my Linux, by writing directly to its registers? Or do I have to write a custom driver and invoke it by insmod ?

There is no standard way to start a DMA operation. Generally, you need to prepare a DMA buffer on the host and setup DMA registers on your device, load DMA address(s), size(s) etc.

However, there is no single standard for DMA registers for PCI devices. You need to find the specification document of your PCI device. In that spec, look for DMA chapter (this is also called PCI "master access" as opposed to "target access").

You will find there: - If scatter-gather or contiguous DMA are supported. - How to setup DMA registers, one of them is usually called DMA CSR - "DMA command/status register". - If the device supports complicated DMA layout (one or many ring buffers, chain of DMA descriptors etc.)

But the good thing is that many PCI devices support 0-size DMA. Which does not do any memory access but just triggers a "DMA complete" interrupt. This can be a very convenient place to start for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM