This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:multiasm:cs:chapter_3_13 [2024/09/27 22:21] – created pczekalski | en:multiasm:cs:chapter_3_13 [2026/01/10 20:22] (current) – pczekalski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== DMA ====== | ====== DMA ====== | ||
| + | Direct memory access (DMA) is the mechanism for fast data transfer between peripherals and memory. In some implementations, | ||
| + | |||
| + | The DMA controller is a specialised unit that controls the data transfer process. It implements several channels, each containing an address register, which is used to address the memory location and a counter specifying how many cycles should be performed. The address and counter registers have corresponding temporal address and counter registers that are updated after every transfer. The address register and counter must be programmed by the processor. It is usually done in the system startup procedure. The system with an inactive DMA controller is presented in Fig.{{ref> | ||
| + | |||
| + | <figure DMAinactive> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The process of data transfer is done in some steps. Let us consider the situation in which a peripheral has data to be transferred. | ||
| + | * peripheral signals the request to transfer data (DREQ). | ||
| + | * DMA controller forwards the request to the processor (HOLD). | ||
| + | * The processor accepts the DMA cycle (HLDA) and switches off from the buses. | ||
| + | * DMA controller generates the address on the address bus and sends the acknowledge signal to the peripheral (DACK). | ||
| + | * Peripheral sends the data on the data bus. | ||
| + | * DMA generates a write signal to store data in the memory. | ||
| + | * DMA controller updates the address register and the counter. | ||
| + | * If the counter reaches zero, data transfer stops. | ||
| + | |||
| + | Everything is done without any action on the processor' | ||
| + | |||
| + | <figure DMAactive> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | DMA transfer can be done in some modes: | ||
| + | * Single - one transfer at a time | ||
| + | * Block (burst) - block of data at a time | ||
| + | * On-demand - as long as the I/O device accepts transfer | ||
| + | * Cycle stealing - one cycle DMA, one CPU | ||
| + | * Transparent - DMA works when the CPU is executing instructions | ||
| + | |||
| + | DMA controllers are implemented in personal computers, as well as in advanced microcontrollers and systems-on-a-chip, | ||
| + | |||