DMA mode

DMA controller

insert image description here
1) Accept the DMA request from the peripheral (a request from the peripheral to transmit a word), and send a bus request to the CPU.
2) The CPU responds to the bus request, sends out a bus response signal, takes over control of the bus, and enters the DMA operation cycle.
3) Determine the address and length of the main memory unit for transmitting data, and automatically modify the main memory address count and transmission length count.
4) Specify the transmission direction of data between the main memory and peripherals, issue control signals such as reading and writing, and perform data transmission operations.
5) Report the end of the DMA operation to the CPU.
insert image description here

DMA transfer process

insert image description here
insert image description here

DMA transfer method

There is a data path between the main memory and the DMA controller, so when information is exchanged between the main memory and the I/O device, it does not pass through the CPU. However, when the I/O device and the CPU access the main memory at the same time, conflicts may occur. In order to effectively use the main memory, the DMA controller and the CPU usually use the following three methods to use the main memory.
insert image description here

Features of the DMA method

There is a direct data path between main memory and the DMA interface.
Because the data transmitted by DMA does not need to pass through the CPU, there is no need to interrupt the current program, I/O works in parallel with the host computer, and the program and transmission work in parallel.
The DMA method has the following characteristics:
① It decouples the fixed relationship between the main memory and the CPU, and the main memory can be accessed by both the CPU and peripherals.
② When the data block is transferred, the determination of the main memory address and the count of the transferred data are all directly realized by the hardware circuit.
③ A dedicated buffer zone should be developed in the main memory to provide and receive peripheral data in a timely manner.
④ The DMA transmission speed is fast, and the CPU and peripherals work in parallel, which improves the system efficiency.
⑤ Before the transfer starts, the DMA needs to be pre-processed through the program, and after the end, it needs to be post-processed through the interrupt method.

DMA mode vs interrupt mode

insert image description here

Guess you like

Origin blog.csdn.net/weixin_51711289/article/details/127768940