This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:cs:chapter_3_13 [2025/01/08 20:50] – ktokarz | en:multiasm:cs:chapter_3_13 [2025/01/08 21:16] (current) – ktokarz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== DMA ====== | ====== DMA ====== | ||
| - | Direct memory access (DMA) is the mechanism for fast data transfer between peripherals and memory. In some implementations, | + | Direct memory access (DMA) is the mechanism for fast data transfer between peripherals and memory. In some implementations, |
| - | Peripheral device reads/ | + | |
| - | No program execution | + | |
| - | Faster data transfer. | + | |
| - | Buses are controlled with DMA controller. | + | |
| - | No processor RD or WR cycles. | + | |
| - | < | + | DMA controller is a specialised unit which can control the data transfer process. It implements several channels each containing the address register which is used to address the memory location and counter to specify how many cycles should be performed. 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> |
| - | {{ : | + | |
| - | < | + | < |
| + | {{ : | ||
| + | < | ||
| </ | </ | ||
| - | Single | + | The process of data transfer is done in some steps, Let us consider the situation when a peripheral has some data to be transferred. |
| - | One transfer | + | * peripheral signals the request to transfer |
| - | Block (burst) | + | * DMA controller forwards |
| - | Block of data at the time | + | * The processor accepts the DMA cycle (HLDA) and switches off from the busses. |
| - | On-demand | + | * DMA controller generates the address on the address bus and sends the acknowledge signal to the peripheral (DACK). |
| - | As long as I/O device accepts | + | * Peripheral sends the data by the data bus. |
| - | Cycle stealing | + | * DMA generates a write signal to store data in the memory. |
| - | One cycle DMA, one CPU | + | * DMA controller updates address register and the counter. |
| - | Transparent | + | * If the counter reaches zero data transfer |
| - | DMA works when CPU is executing instructions | + | |
| + | Everything is done without any action of the processor, no program is fetched and executed. Because everything is done by hardware the transfer can be done in one memory access cycle so much faster than by the processor. Data transfer by processor is significantly slower because requires at least four instructions of program execution and two data transfers: one from the peripheral and another to the memory for one cycle. The system with an active DMA controller is presented in Fig.{{ref> | ||
| + | |||
| + | <figure DMAactive> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| - | Memory-to-memory | + | DMA transfer can be done in some modes: |
| - | Memory-to-peripheral | + | * Single |
| - | Peripheral-to-memory | + | * Block (burst) |
| - | Peripheral-to-peripheral | + | * On-demand |
| + | * Cycle stealing | ||
| + | * Transparent | ||