本文将介绍DMA controller的相关知识点。

1. Background

1.1 Third-party

Standard DMA, also called third-party DMA, uses a DMA controller. A DMA controller can generate memory addresses and initiate memory read or write cycles. It contains several hardware registers that can be written and read by the CPU. These include a memory address register, a byte count register, and one or more control registers. Depending on what features the DMA controller provides, these control registers might specify some combination of the source, the destination, the direction of the transfer (reading from the I/O device or writing to the I/O device), the size of the transfer unit, and/or the number of bytes to transfer in one burst.

To carry out an input, output or memory-to-memory operation, the host processor initializes the DMA controller with a count of the number of words to transfer, and the memory address to use. The CPU then commands the peripheral device to initiate a data transfer. The DMA controller then provides addresses and read/write control lines to the system memory. Each time a byte of data is ready to be transferred between the peripheral device and memory, the DMA controller increments its internal address register until the full block of data is transferred.

1.2 Bus mastering

In a bus mastering system, also known as a first-party DMA system, the CPU and peripherals can each be granted control of the memory bus. Where a peripheral can become a bus master, it can directly write to system memory without the involvement of the CPU, providing memory address and control signals as required. Some measures must be provided to put the processor into a hold condition so that bus contention does not occur

2. Real-world DMA Controllers


DMA channels are system pathways used by many devices to transfer information directly to and from memory.

2.1 DMA channels

To find out what DMA channels your system uses, you can use the cat /proc/dma command:

1
2
$ cat /proc/dma
4: cascade


这里的DMA channels可不用深究,了解即可。

3. Bus Mastering DMA


参考资料:

  1. Basic Components Of a Computer System
  2. Direct memory access wikipedia
  3. Direct Memory Access (DMA) Channels