Monday, February 7, 2011

What is an IRQ or Interrupt request?

An IRQ is is really an Interrupt Request line.  In the case of expansion boards, it is an actual contact (finger) on the board, and it is a corresponding pin in the sockets on the bus connected by a trace on the motherboard.  A device sends a interrupt to the motherboard's interrupt circuitry by changing the voltage level on the interrupt request line.  This voltage change acts via interrupt controller circuitry to interrupt the processor to service the device needing the CPU's attention.  Simply put, if, for example, a serial port is receiving data from a MODEM, it can't wait until it's buffer overflows for the CPU, etc. to come to its assistance
The CPU will then temporally store the program and data it is working on in an area of memory know as the stack and load a routine (program) to service the interrupting device, service the device (move that data out of its buffer, etc.), and then restore the program and data it was previously working on and resume what it was doing.  A CPU can be interrupted many times a second--a marvelously complicated affair when one considers that a CPU can be working on one interrupt request and be interrupted in this task by still another IRQ request of a higher priority, etc., and that it usually does all of this juggling without losing a beat or data.
The IRQ structure in today's PC's goes all the way back to the Intel 8086 processor and the Intel 8259 Programmable Interrupt Controller (I remember working with this combination in 1979).  The 8259 can control eight IRQ lines. When IBM came out with the XT computer with an 8080 processor and 8-bit expansion bus, it used one 8259, the top chip.  Later IBM came out with the 286 AT computer with an a 16-bit expansion bus and two 8259's as shown.  The INT signal (Interrupt--prioritized interrupt) of the second 8259 was connected to the old IRQ2 pin on the first 8259 and the IRQ 2 line was plugged into IRQ 9 on the new 8259.  The old 8-bit bus lives on in the 16-bit ISA expansion slot on your PC, which is really an expanded 8-bit socket with additional pins to bring it to 16-bits in front of it.  And the old 16 IRQ structure still governs those PCI slots.  Of course, the functions of 8259 have long since be incorporated into the large chipsets on today's motherboards.IRQs are prioritized and serviced in priority order by the CPU as determined by the controller.  As IRQs 8 through 15 trigger IRQ2 on the top 8259, thus, they have a higher priority than IRQs 3 through 7.  Any expansion board that is set to use IRQ 2 is really using IRQ 9.  Some boards lable/depict it as IRQ 2, others IRQ 9, and still others IRQ 2/9.  No matter what it is called, one must not set two ISA boards to the very same IRQ.

Here is a list of the IRQs and common settings:


IRQ 0
System timer interrupt from TIMER-0. No user-definable options.
IRQ 1
Keyboard controller
IRQ 2
Cascade for IRQs 8-15. IRQ 9 cascade to IRQ 2 through a software redirect.
IRQ 3
Available. The standard IRQ for COM 2/COM 4.
IRQ 4
Available. IRQ 4 is the standard for COM 1/COM 3 -- the serial mouse connection. Don't try to have the mouse share an IRQ.
IRQ 5
Available. This is the default IRQ for most sound cards. Network card and LPT 2 are often set to IRQ 5, IF a sound card is not used.
IRQ 6
Floppy Drive controller. No user-definable options.
IRQ 7
Primary parallel (printer) port - LPT 1. If a parallel port is not used, then IRQ 7 can be assigned to another device.
IRQ 8
Real Time Clock. No user-definable options.
IRQ 9
Cascades to IRQ 2.
IRQ 10
Available. If a sound card is using IRQ 5, then this IRQ can be used for a network card.
IRQ 11
Available. Often used for a SCSI controller.
IRQ 12
Available. Often used for the PS2 style mouse.
IRQ 13
Math Coprocessor. No user-definable optinos.
IRQ 14
Primary IDE (hard drive, CD ROM) controller. The 2 IDE devices on the same cable use the one IRQ.
IRQ 15
Secondary IDE channel. Available if the secondary channel is
 


No comments:

Post a Comment