How do dma work




















It's possible to do a flyby transfer that performs the read and write in a single bus cycle. Processors that support DMA provide one or more input signals that the bus requester can assert to gain control of the bus and one or more output signals that the processor asserts to indicate it has relinquished the bus. When designing with DMA, address buffers must be disabled during DMA so the bus requester can drive them without bus contention.

The system design may also need pullup resistors or terminators on control signals such as read and write strobes so the control signals don't float to the active state during the brief period when neither the processor nor the DMA controller is driving them.

DMA controllers require initialization by software. Typical setup parameters include the base address of the source area, the base address of the destination area, the length of the block, and whether the DMA controller should generate a processor interrupt once the block transfer is complete. It's typically possible to have the DMA controller automatically increment one or both addresses after each byte word transfer, so that the next transfer will be from the next memory location.

Transfers between peripherals and memory often require that the peripheral address not be incremented after each transfer. When the address is not incremented, each data byte will be transferred to or from the same memory location. Some DMA controllers support both. In burst mode, the DMA controller keeps control of the bus until all the data buffered by the requesting device has been transferred to memory or when the output device buffer is full, if writing to a peripheral.

In single-cycle mode, the DMA controller gives up the bus after each transfer. This overhead can result in a drop in overall system throughput if a lot of data needs to be transferred. In most designs, you would use single cycle mode if your system cannot tolerate more than a few cycles of added interrupt latency. Likewise, if the peripheral devices can buffer very large amounts of data, causing the DMA controller to tie up the bus for an excessive amount of time, single-cycle mode is preferable.

Note that some DMA controllers have larger address registers than length registers. For instance, a DMA controller with a bit address register and a bit length register can access a 4GB memory space, but can only transfer 64KB per block. If your application requires DMA transfers of larger amounts of data, software intervention is required after each block.

This eliminates the need for external bus buffers and ensures that the timing is handled correctly. Also, an internal DMA controller can transfer data to on-chip memory and peripherals, which is something that an external DMA controller cannot do. When the bit industry standard architecture ISA expansion bus was introduced, channels 5, 6 and 7 were added. ISA was a computer bus standard for IBM-compatible computers, allowing a device to initiate transactions bus mastering at a quicker speed.

A computer's system resource tools are used for communication between hardware and software. The four types of system resources are:. DMA channels are used to communicate data between the peripheral device and the system memory. All four system resources rely on certain lines on a bus. The transfer of data is first initiated by the CPU. The data block can be transferred to and from memory by the DMAC in three ways.

In burst mode, the system bus is released only after the data transfer is completed. Once the CPU allows the DMA controller to access to the system bus, the DMA controller will transfer all bytes of data in the data block before releasing control of the system buses back to the CPU, but it will cause the CPU to be inactive for a considerable long time.

The cycle stealing mode is used in a system where the CPU cannot be disabled for the length of time required for the burst transfer mode. On the one hand, in the cycle stealing mode, the data block transmission speed is not as fast as in the burst mode, but on the other hand, the CPU idle time is not as long as in the burst mode. The transparent mode takes the longest time to transfer data blocks, but it is also the most efficient mode in terms of overall system performance. In transparent mode, the Direct Memory Access controller transfers data only when the CPU performs operations that do not use the system buses.

It seems like your understanding is based on Bus Mastering, which I guess is more modern than the DMA concept that is described in that textbook. The DMA concept in the textbook is more primitive. I added the a diagram for a simplified model the book uses. The arrow 3 in the diagram doesn't seem to match the text description To determine which one is correct, the bus timing diagram for step 3 will be needed. More importantly, one needs to find out which device is responsible for holding the data signal in step 3.

Does the disk controller sends out the data to DMA controller first, and then the DMA controller repeat the data putting its own voltage onto the bus to the memory? The "Ack" in step 4 is also suspicious. Doesn't the DMA already know the number of bytes to be copied?

Not sure how to clarify. What books on OS and on architecture did you study or do you think are the best? Show 5 more comments. Active Oldest Votes. Q2 So, the whole point of a DMA controller is to "perform the tedious task of storing stuff from the device's internal buffer into main memory". Q3 kind of If you think of the hard disk as the stack of bricks just delivered to a building site, and the processor is the bricklayer that lays the bricks to build the house.

Improve this answer. Mats Petersson Mats Petersson 2 2 silver badges 7 7 bronze badges. Add a comment. Namely: What are the bus systems involved in this description? Most computer systems have a memory bus. Most computers have other kinds of bus systems as well. Does the disk IO go through the memory bus also? In other words, does the disk uses the address bus lines for addresses, and the data bus lines for data? Does the disk controller sees the memory bus as A memory bus?

That is, it thinks it is talking to a memory chip; i. Very unlikely - talking to a memory chip requires one to be ultra-precise about issuing commands according to DRAM timing latencies - a few clock cycles too early or too late, data loss will occur.



0コメント

  • 1000 / 1000