Karbosguide.com - Module 5a3.

About IRQs, DMA, bus mastering etc.


The contents:

  • IRQ
  • DMA
  • Bus mastering

  • Next page
  • Previous page


  • IRQs

    When you install an expansion board in a slot, it gets connected to the I/O bus. Now the board can send and receive data. But who regulates the traffic? Who gives clearance to the new controller to send data? It would appear that data traffic could soon be chaotic.

    [top]

    To control data traffic on the I/O bus, the concept of IRQ (Interrupt ReQuest) was created. Interrupts are a fundamental principle in the PC design. There are two types of interrupts: Software Interrupts are used to call any number of BIOS routines. Hardware Interrupts are the subject of this page.


    Hardware Interrupts

    The adapter or unit on the I/O bus uses the interrupt to signal request to send or receive data. An interrupt signal is like a door bell. The unit signals by applying a voltage to one of the wires in the bus - an IRQ. When the CPU acknowledges the signal, it knows that the unit wants send or receive data, or is finished.

    The advantage of IRQs is that the CPU can manage other tasks, while an adapter "massages" its data. When the adapter has finished its task, it will report to the CPU with a new IRQ.

    As an example, let us see how keyboard data are handled. The keyboard send bits, serially, through the cable to the keyboard controller. The controller organizes them in groups of 8 (one byte). Every time it has a byte, it sends an IRQ to the I/O bus. The IRQ controller asks the CPU permission to use the bus, to send the byte to wherever. The IRQ controller reports back to the keyboard controller, giving clearance to send the next character (byte):


    IRQ wires

    Physically, the IRQ is a wire on the bus. This wire connects to all expansion slots. Therefore, regardless of in which slot you install an adapter, the adapter can communicate with an IRQ.

    In the pristine PC design (the original PC/XT bus) you found 8 IRQ's. The more recent PC is "born" with 16 IRQs, but five of them are internal, and cannot be used with I/O cards, and one of them connects the lower IRQ's with the higher (IRQ2/9).

    We find 10 accessible IRQs on the I/O buses. Each of those consist of a circuit board wire, which goes through the entire bus. When you install an expansion card in a vacant slot, one of the IRQs is assigned to it.

    When a signal arrives on an IRQ channel, that is a message to the CPU. It is told that a unit wants to get on the bus. Which unit is to be identified through the IRQ number.

    Next the unit is admitted to the bus, to send or receive data. When the transaction is completed, another signal is transmitted to the CPU to indicate that the bus is vacant.

    The IRQs have different priorities, so the CPU knows which IRQ have priority, if two signals are sent simultaneously.

    The IRQ system is guided by a controller chip, like Intel 8259. It can handle 8 IRQ signals and couple two of them together, via IRQ 2 or 9. All PCs with ISA bus include two 8259 chips.


    MSD (Microsoft Diagnose System)

    Let me show an image of the MSD diagnostic program, which you can run in Windows 95/98. It shows the use of IRQs on a PC:

    MSD shows the IRQs of the PC, where the program is run. There are a total of 15 IRQ channels and each IRQ is assigned to a unit. However, it is not always possible to utilize IRQ 9. It functions like a bridge between two parts in the IRQ system.

    In the above illustration, IRQ numbers 5, 10, 11, 12, and 15 appear vacant.

    IRQ numbers 2 and 9 show the linking between those two IRQ controllers.

    Some IRQs are reserved for various internal units, which must also be able to disconnect the CPU. Those are IRQ numbers 0, 1, 2, 8, and 13, as you can see in the illustration above. They are not available for other units. In principle, the remainder are available for expansion boards and EIDE units.

    IRQs are assigned during the PC start-up. An ISA expansion board is assigned a given IRQ during start-up. That IRQ is used every time that expansion board uses the bus.

    Shared IRQs

    The modern I/O buses MCA, EISA and PCI permit shared IRQs. Thus, two adapters can share one IRQ. When the IRQ is activated, the drive programs for the two adapters are checked, to identify which is on the bus.


    IRQ and conflicts on the ISA bus

    The IRQ system can cause some problems on the unintelligent ISA bus. When bus and adapters are referred to as unintelligent, it implies that they are unable to organize the IRQ distribution on their own.

    In order to function, an ISA network controller must be assigned an IRQ. The manufacturer could preset it to work with IRQ 9, 10, 11, or 12. One of these values, let us say IRQ 11, is preset as the default value. When the customer installs that board, during start-up it will try to access the bus as IRQ 11. If no other units are connected to IRQ 11, it should work. If IRQ 11 is occupied, we have a problem. Those two units would get in a conflict. Often, the PC will not start at all and panic erupts.

    The solution is to change the IRQ of the adapter. The manufacturer has designed the board to work on IRQ 9, 10, 11, or 12. Number 11 was the default. If that does not work, you must adjust to another. This can be done with the accompanying software, or by resetting a little jumper - an electric contact on the board, which has to be reset. The manual for the board will include instructions about how to do this.

    These IRQ problems can be a terrible nuisance. If both sound and net boards had to be installed in ISA slots in the same PC, sometimes I had to give up.

    In Windows 95 (System, Computer, Properties) you can find an excellent overview of the IRQs. Here it is from my Danish version:




    DMA

    IRQs are only one of the problems with ISA boards. The other one is DMA (Direct Memory Access). That is a system which allows an adapter to transfer data to RAM without CPU involvement.

    Normally, the CPU controls all bus activities. With DMA, this "intelligence" is assigned to a DMA controller on the system board. This special controller chip (Intel 8237) has clearance to move data to and from RAM, via the I/O bus, without burdening the CPU.

    You can implement a number of DMA channels, which can be used by the ISA boards. Each channel has its own number and one controller can be in charge of four channels. Each ISA unit can occupy one of these channels, if so designed. Diskette drives utilize DMA.

    The DMA system can result in conflicts between two units on the bus, if they have requested the same DMA channel. As an example, on ISA sound boards you have to reset both IRQ and DMA number.

    It is important to enable DMA for your harddisk in Windows . See how in this Windows tip.



    Bus mastering

    There are no DMA channels on the PCI bus. Instead bus mastering is employed. It is a similar system, where special controller functions allow adapters to control the bus. Thus, they can deliver their data directly to RAM, minimizing the workload on the CPU. It does not need to keep track of the transactions, the bus master takes care of that.

    This allows the PC to multitask, handle more than one task at a time. The hard disk can pour streams of data to RAM, while the CPU handles some other task. The bus mastering system works fairly well with EIDE hard disks. However in this particular area, the SCSI controller is far more advanced. EIDE bus mastering is rather new and we will see further developments in this area.

    Bus mastering version Chip set Year
    DMA mode 2 82430FX 1995
    Ultra DMA 82430TX 1997

    The latest version Ultra DMA/66 is described in module 5b.


  • Next page
  • Previous page


    Learn more

    Read: Module 5b about EIDE, Ultra DMA and AGP.

    Read Module 5c about SCSI, USB etc.

    Read Module 6b with a little about Windows 95/98.

    Read Module 6c about the relationship between BIOS, OS and hardware

    Read Module 7a about the videosystem

    Read about video cards in Module 7b.

    Read about digital sound in Module 7c.

    [Main page]
    [Karbo's Dictionary]
    [The Software Guides]


    Copyright (c) 1996-2011 by Michael B. Karbo. www.Karbosguide.com.