The DMA engine API
The DMA engine is a generic kernel framework for developing a DMA controller driver. The main goal of DMA is offloading the CPU when it comes to copy memory. One delegates a transaction (I/O data transfers) to the DMA engine by the use of channels. A DMA engine, through its driver/API, exposes a set of channels that can be used by other devices (slaves). The DMA Engine layout is shown in the following diagram:

DMA Engine layout
Here, we will simply walk through the (slave) API, which is applicable for slave DMA usage only. The mandatory header here is as follows:
#include <linux/dmaengine.h>
Using the slave DMA is straightforward, and consists of the following steps:
- Allocate a DMA slave channel.
- Set slave- and controller-specific parameters.
- Get a descriptor for the transaction.
- Submit the transaction.
- Issue pending requests and wait for callback notification.
Note
One can see a DMA channel as a highway for I/O data transfer.
Allocating a DMA slave channel
One requests a...