Channels and control blocks
By now, it should be reasonably clear that DMA controllers need to be pre-programmed with a block of parameters to allow them to operate. The hardware interface that they use is common to almost every different set of parameters — the only real differ-ence is when a single or dual address mode is used with the need to directly access a peripheral as well as the memory address bus.
It is also common for a peripheral to continually use a single set of parameters. As a result, the processor has to continually re-program the DMA controller prior to use if it is being shared between several peripherals. Each peripheral would have to inter-rupt the processor prior to use of the DMA to ensure that it was programmed. Instead of removing the interrupt burden from the processor, the processor still has it — albeit it is now programming the DMA controller and not moving data. Moving data could be an even lighter load!
To overcome this the idea of channels of control blocks was developed. Here the registers that contain the parameters are duplicated with a set for each channel. Each peripheral is assigned an external request line which when asserted will cause the DMA controller to start a DMA transfer in accordance with the param-eters that have been assigned with the request line. In this way, a single DMA controller can be shared with multiple peripherals, with each peripheral having its own channel. This is how the DMA controller in the IBM PC works. It supports four channels (0 to 3).
An extension to this idea of channels, or control blocks as they are also known, is the idea of chaining. With chaining, channels are linked together so that more complex patterns can be created. The first channel controls the DMA transfers until it has completed its allotted transfers and then control is passed to the next control block that has been chained to it. This simple tech-nique allows very complex addressing patterns to be created such as described in the paragraphs on 3D models.
There is one problem with the idea of channels and external pins: what happens if multiple requests are received by the DMA controller at the same time? To resolve this situation, arbitration is used to prioritise multiple requests. This may be a strict priority scheme where one channel has the highest priority or can be a fairer system such as a round-robin where the priority is equally distributed to give a fairer allocation of priority.