|
DMA Fundamentals
DMA Fundamentals on Various PC Platforms by National Semiconductor Original IBM PC and PC/XT DMA Implementation All DMA controllers discussed in this application note are related to the Intel 8237A DMA controller used in the original IBM PC. This DMA controller has four channels with 16-bit memory-address and byte-count registers for each channel. The 16-bit count register limits the length of a preprogrammed DMA transfer sequence to 64 kilobytes. The PC added an 8-bit page register external to the 8237A to extend the 16-bit address to the 24-bit PC memory address. With this extension, reprogrammed DMA transfer sequences cannot cross 64 kilobyte page boundaries, because the page register does not increment when the address register reaches 0FFFFH. The 8237A implements single, block, and demand DMA transfer modes. The PC uses two of the DMA channels, one channel to transfer data from floppy disk to memory and vice versa (Channel 2) and the other channel to perform memory refresh cycles (Channel 0). The remaining channels are made available to I/O boards plugged into the PC bus, such as communications peripherals. The PC I/O Channel bus has a TC signal and DMA request signals DRQX and DMA acknowledge signals DACKX*, where X is the DMA channel number. The 8237A DMA controller of the PC performs 8-bit, flyby transfers because the PC has an 8-bit bus. When an I/O device needs a DMA transfer, the device asserts DRQX. Later the DMA controller places the appropriate memory address on the bus and asserts DACKX* one or more times. The assertion signals the I/O device to read or write data as specified by the read and write control signals. If the transfer is the last of the sequence, TC is asserted along with the final DACKX*. In addition to the normal I/O-to-memory flyby transfer mode, the 8237A has a special memory-to-memory transfer mode that uses two DMA channels to transfer data from one memory buffer to another. In the PC, the 8237A operates at 4.77 MHz and can transfer data up to 900 kbytes/sec in demand transfer mode. ISA (PC AT) Extensions to DMA Implementation The 16-bit Industry Standard Architecture (ISA) or PC AT computers increased the number of DMA channels to seven. Two Intel 8237A-5 DMA controllers are cascaded together, and each chip has four channels. DMA Controller 1 has Channels 0 through 3 and implements the original 8-bit, flyby DMA transfers of the PC between 8-bit I/O adapters and 8-bit or 16-bit system memory. DMA Controller 2 has Channels 4 through 7. Channel 4 is used to cascade the operation of the two DMA controllers and is therefore not available for general use. Channels 5, 6, and 7 implement 16-bit, flyby DMA transfers between 16-bit I/O adapters and 16-bit system memory. The count registers in DMA Controller 2 act as 16-bit, word-count registers, and addresses A1 through A16 are written into the address registers. The page registers hold the upper seven bits of the 24-bit address, and address A0 is assumed to be zero. For 16-bit transfers then, the maximum transfer length is extended to 128 kilobytes and DMA transfers cannot be performed across a 128 kilobyte page boundary. With an 8-MHz ISA bus, the 8237A operates at 4 MHz (it has a 5-MHz clock limit) which translates to an 800 kbyte/sec demand mode transfer rate for 8-bit transfers and 1.6 Mbyte/sec rate for 16-bit transfers. Both for the original PC and for ISA computers, top DMA transfer rates are limited by memory refresh requirements. One memory refresh cycle must be executed every 15 µsec. A device designed to use demand DMA transfers must deliberately drop DRQ and relinquish the bus every 15 µsec for memory refresh to occur. In an ISA system, block-mode transfers are not very practical because the 8237A does not relinquish the bus until the entire DMA sequence is complete, and only 24 ISA transfers can be performed in 15 µsec. Because sustained DMA transfers are difficult to implement and multiple devices use the DMA controller, I/O devices should have onboard buffering, particularly in critical timing applications such as counter-controlled pattern generation where data must be output at a fixed rate. Micro Channel DMA Implementation The Micro Channel DMA controller design evolved from the ISA DMA controller, but several significant changes were made. The Micro Channel has eight DMA channels capable of transferring either 8-bit or 16-bit data. The Micro Channel does not use dedicated DRQ or DACK* signals. Instead, the Micro Channel uses the bus master arbitration signals for DMA requests with the same protocol that bus masters use for requesting the bus. However, instead of the I/O device controlling the bus, the DMA controller recognizes the arbitration level, becomes bus master, and performs a fetch-and-deposit DMA transfer. This transfer is a memory cycle followed by an I/O cycle, or vice versa, and temporarily stores the data between cycles. The I/O device can use the arbitration signals as DMA acknowledge signals during the I/O cycle, which makes programming each channel similar to the ISA programming. The I/O device can also be addressed by the DMA controller during the I/O cycle. The DMA controller has a set of registers that are compatible with the ISA DMA controller plus extended registers and extended programming modes. In extended programming, the DMA controller has full 24-bit memory-address registers (completely addressing 16 megabytes) and 16-bit I/O-address registers. Therefore, the controller does not have the ISA 64 kilobyte or 128 kilobyte transfer and page-addressing limitations. The DMA controller supports both single and demand transfer modes. The Micro Channel DMA controller has some limitations not found in the ISA implementation. Auto-initialize mode is not supported (1), and a channel is automatically disabled when reaching TC. As a result, the DMA controller must be reprogrammed whenever a channel terminates, regardless of whether the channel restarts with the same address and count. In addition, the I/O device must recognize the TC occurrence and not assert more DMA requests until the channel is reprogrammed and re-enabled; otherwise, a system exception occurs after a time-out period. In ISA implementation, the DMA controller either auto-initializes and continues data transfer or ignores the DMA request until the controller is reprogrammed. Both limitations make designing DMA software more difficult for a Micro Channel I/O device than for an ISA device. The Micro Channel DMA controller can achieve a top transfer rate of close to 5 Mbytes/sec. Because Micro Channel DMA arbitration occurs in series with data transfers, arbitration activity slightly reduces overall data transfer bus bandwidth. As in ISA implementation, one memory refresh cycle is executed every 15 µsec, which also slightly reduces the DMA transfer rates. In addition, buffering is required for critically timed DMA operations. 1 Actually, there is a claim that autoinitialize mode is supported. However, this claim is not documented,and National Instruments was not able to obtain confirmation from IBM technical support. |