src/main/resources/doc/en/html/libs/soc/socdma.html
| Library: | System On Chip components | | Introduced: | 4.1 |
The DMA engine is a simple linear memory-copy DMA controller. It copies data from a source address to a destination address in configurable bursts, driven by a clock signal. This component is primarily intended to be used with the VGA screen component to efficiently copy image data into the VGA framebuffer, but it can be used for any memory-to-memory transfer.
The DMA engine supports three independent bus connections: one for control register access (the DMA acts as a slave on this bus), one for source reads (master-only), and one for destination writes (master-only). This allows routing data transfers across different SoC buses. If the source or destination bus is not explicitly configured, the control bus is used as a fallback.
A transfer is initiated by programming the source address, destination address, and length registers, then writing the START bit in the control register. Once started, the DMA engine copies burst size words (32-bit) per clock cycle until all bytes have been transferred. At the end of the transfer the DONE status bit is set, and optionally an interrupt is raised if IRQ_EN was set in the control register.
While a transfer is in progress (BUSY=1), writes to the SRC_ADDR, DST_ADDR, and LENGTH registers are ignored.
With the default burst size of 16 words/tick, the DMA engine can transfer data roughly 80× faster than a CPU-driven memcpy loop (which requires ~5 clock cycles per word due to instruction fetch, decode, and execute overhead).
On the west side of the DMA component:
On the east side of the DMA component:
| Offset | Register | Access | Description |
| 0x00 | SRC_ADDR | R/W | Source address (must be word-aligned). Writes are ignored while BUSY. |
| 0x04 | DST_ADDR | R/W | Destination address (must be word-aligned). Writes are ignored while BUSY. |
| 0x08 | LENGTH | R/W | Transfer length in bytes (must be a multiple of 4). Writes are ignored while BUSY. |
| 0x0C | CONTROL | R/W | bit 0 (START): Write 1 to start a new transfer (ignored if BUSY or LENGTH=0).
bit 1 (IRQ_EN): Set to enable interrupt on transfer completion. |
| 0x10 | STATUS | R/W1C | bit 0 (BUSY): Read-only. 1 while a transfer is in progress.
bit 1 (DONE): Write-1-to-clear. Set when a transfer has completed. Writing 1 to this bit clears it and de-asserts the IRQ output. |
| 0x14 | BYTES_DONE | RO | Number of bytes transferred so far. Resets to 0 when a new transfer starts. |
To use the DMA engine to copy an image into the VGA framebuffer:
Note: DMA write transactions are visible to bus sniffers (such as the VGA component), so the VGA display updates in real time during a DMA transfer. DMA read transactions are hidden from the bus trace to reduce noise.