Linux+ Hardware Part 07 – Expansion Slot Communications When cards are added to the expansion slots, they can communicate with the rest of the system in various ways to provide a better throughput. There are two “enhanced” communication methods: Direct Memory Access (DMA) Bus Mastering Direct Memory Access (DMA) If the card provides a method for faster communications, it is because a higher throughput of data is required. For example, a high-speed network card requires a faster throughput or a bottleneck is created to get the data through the system bus to Random Access Memory (RAM). In normal communications, data is sent from the card to the Central Processing Unit (CPU) for processing and then sent to the RAM. When the expansion card is operating in this way, when data is sent through the CPU it stops all other processing. When a system is using a card which is not using DMA, the processor will halt all other processing and work with the device only. In this case, the system will be slow when the card is being used. NOTE: It is possible to disable DMA on an expansion card, but this will only slow the system. Within each system is a DMA Controller. Each expansion slot has a channel to the DMA Controller. When a card needs to send data over DMA, it signals the DMA Controller. The DMA Controller then signals the CPU to request control of the Data Bus and Address Bus. Once the CPU has acknowledged the request, the DMA Controller takes over the Data and Address Buses before signaling the card to send its data. The data sent from the card will go along the Data Bus to the RAM location specified by the Address Bus. Since the processor is free from managing the data from the card, it can process instructions as long as it does not need the Data Bus or Address Bus to fetch them. DMA devices can help to keep a system running faster as long as the DMA Channel is enabled without conflicts. Similar to Interrupt Requests (IRQs), the DMA devices each have a DMA Channel 0 to 7 and no two devices can have the same DMA Channel. NOTE: Two devices with the same DMA Channel will cause conflicts similar to two devices with the same IRQ. Common DMA Channels used by default devices (if they exist) are as follows: 2 – Floppy Drives 3 – Printer Port 4 – DMA Controller DMA can also work in three modes of operation. The three modes are: Burst Mode Cycle Stealing Mode Transparent Mode A. Burst Mode In Burst Mode, the DMA Controller gains control of the Data and Address Bus and then signals the DMA device. The DMA device transmits one whole block of data before the Buses are released back to the CPU for it to use. NOTE: The size of a block can vary depending on the device on which it is stored. Be aware that in Burst Mode, the CPU is unable to access the Data or Address Bus until the whole block of data has been transmitted to RAM. If the device contains a large block-size, then the CPU idle time is longer. B. Cycle Stealing Mode With Cycle Stealing, the CPU has less idle time but the DMA device data transfer is a little slower. Once the DMA Controller has been granted control by the CPU for the Buses, the DMA device sends one byte of data and then releases control of the Buses. The CPU may process one instruction and then the DMA Controller regains control of the Buses and one more byte of data is transmitted. The process continues until the DMA Device is done sending its data. C. Transparent Mode Transparent Mode allows the CPU to use the Buses as needed and the DMA Controller uses the Buses only when they are not used by the CPU. In this mode, the CPU processes more data and the Buses are slower. The DMA devices will be faster when the CPU has no need of the Buses. Bus Mastering With Bus Mastering, the expansion card has its own processor which works in a similar fashion as the DMA Controller. The card’s processor can gain control of the Buses to transmit data. If two Bus Mastering devices were trying to gain control of the Buses, the Integrated System Peripheral (ISP) chip manages the devices to make sure there is no conflict. Between the IRQ, DMA and Bus Mastering, there is a priority for them to operate: RAM Refresh DMA CPU Bus Mastering devices I/O Communications Devices perform Input/Output (I/O) operations. Commands or data goes into a device while status information and data come out of a device. Each device has an I/O Address for the CPU to be able to communicate with the device. The address or range of addresses is referred to as a port. For example, the Communications Port 1 (COM1) uses addresses 03F8 to 03FF. NOTE: I/O Addresses are in hexadecimal. The numbering system goes from 0 to 9 then A to F. Some common system ports are: 0000-001F – DMA Controller 1 0020-003F – Interrupt Controller 1 0040-005F – System Timer 0060-006F – Keyboard 0070-007F – Real-time Clock 00A0-00BF – Interrupt Controller 2 00C0-00DF – DMA Controller 2 00F8-00FF – Math Coprocessor Expansion cards also have set ports for specific devices as follows: 01F0-01F8 – Fixed Disk 0200-0207 – Game Port 0278-027F – Parallel Port 2 (LPT2) 02E8-02EF – Serial Port 4 (COM4) 02F8-02FF – Serial Port 2 (COM2) 0330-0333 – SCSI Controller 0378-037F – Parallel Port 1 (LPT1) 03E8-03EF – Serial Port 3 (COM3) 03F0-03F7 – Floppy Controller 03F8-03FF – Serial Port 1 (COM1) FF80-FF9F – Universal Serial Bus (USB) NOTE: Be aware the expansion cards which use system memory will use memory in the range of 640KB to 1 MB. This range is the Reserved Memory range.