IRQ, DMA and I/O Ports - Introduction - IRQ – Interrupt Request • Stands for "Interrupt Request." PCs use interrupt requests to manage various hardware operations. • IRQs are hardware lines over which devices can send interrupt signals to the microprocessor • Devices such as sound cards, modems, and keyboards can all send interrupt requests to the processor • For example, when you press a key on your keyboard it sends a signal to the processor via an IRQ channel (usually IRQ 1) to let it know that it needs to process some data. • IRQ conflicts can occur when new hardware is installed using the same channel of another hardware. For example, it can cause problems if you have your mouse on COM 1 (IRQ4) and a modem on COM 3 (IRQ4) both using the same IRQ channel. • You may find you cannot manually change your IRQ settings (the Use automatic settings will be greyed out), this is usually related to the ACPI (Advanced Programmable Interrupt Controller) function in Windows according to the Intel APIC Architecture. • In later version of Windows , fully automated device detection and configuration is used (PnP-Plug and Play) but could still fall back to manual settings if necessary. Default ISA (Industry Standard Architecture) IRQ Allocation: • IRQ 0 — system timer (cannot be changed); • IRQ 1 — keyboard controller (cannot be changed); • IRQ 2 — cascaded signals from IRQs 8–15; — any devices configured to use IRQ 2 will actually be using IRQ 9 • IRQ 3 — serial port controller for COM2 (shared with COM4, if present); • IRQ 4 — serial port controller for COM1 (shared with COM3, if present); • IRQ 5 — LPT port 2 or sound card; • IRQ 6 — floppy disk controller; • IRQ 7 — LPT port 1 or It is used for printers or for any parallel port if a printer is not present. • IRQ 8 — RTC Timer • IRQ 9 — The Interrupt is left open for the use of peripherals. open interrupt / available or SCSI host adapter; — any devices configured to use IRQ 2 will actually be using IRQ 9 • IRQ 10 — The Interrupt is left open for the use of peripherals. open interrupt / available or SCSI or NIC; • IRQ 11 — The Interrupt is left open for the use of peripherals. open interrupt / available or SCSI or NIC; • IRQ 12 — mouse on PS/2 connector; • IRQ 13 — math co-processor or integrated floating point unit or inter-processor interrupt (use depends on OS); • IRQ 14 — primary ATA channel; • IRQ 15 — secondary ATA channel; • When a signal arrives on an IRQ channel, that is a message to the CPU. The IRQ Controller 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 empty. • 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 two of them together through IRQ 2 or 9. All PCs with ISA bus include two 8259 chips. To view your current IRQ assignments you can open Device Manager. Click on START, click on CONTROL PANEL. • Click on Performance and Maintenance. • Click on System. • Click on the Hardware tab. • Click the DEVICE MANAGER button. • Once you have Device Manager open, select VIEW from the toolbar menu, and then click Resources by Type. If you are experiencing problems with a newly installed/configured piece of hardware and the drivers are installed correctly, then check to see if it has its own IRQ channel. DMA - Direct memory access • Direct memory access (DMA) channels are system pathways used by many devices to transfer information directly to and from memory. • DMA is a system which allows an adapter to transfer data to RAM without CPU involvement. Example of how DMA works Diagram of DMA 8257 interface with Intel 8085 chip • DMA data transfer signals are assigned to a DMA controller on the motherboard. A controller chip (Intel 8237) has clearance to move data to and from RAM through the I/O bus, without giving more work to the CPU. • Many hardware systems use DMA, including disk drive controllers, graphics cards, network cards and sound cards. • Computers that have DMA channels can transfer data to and from devices with much less CPU usage than computers without a DMA channel. This allows computation and data transfer to proceed in parallel for faster data processing. • Without DMA, when the CPU is using programmed input/output, it is fully occupied with read or write operation and is therefore unavailable to perform other work. • With DMA, the CPU initiates the transfer, does other operations while the transfer is in progress, and receives an interrupt from the DMA controller when the operation is done. • This feature is useful any time the CPU cannot keep up with the rate of data transfer, or where the CPU needs to perform useful work while waiting for a relatively slow I/O data transfer. Input/Output Ports • Input/Output ports are memory addresses used by the processor for direct communication with a device that has sent an interrupt signal to the processor. • Not be confused with Input/Output Port Interface which is commonly termed as “I/O Ports” such as the socket connectors behind a computer. • The I/O port assignment can be made either manually or automatically using PnP. When configuring the I/O port of any device in your computer it is important that it does not share the same I/O port as another device or you will encounter a hardware conflict. • The exchange of commands or data between the processor and the device takes place through the I/O port address of the device, which is a hexadecimal number. • If a program needs to send a byte to the serial port, it issues an OUT instruction to the CPU with the address of that serial port. The CPU notifies the address bus to activate the I/O port and the address bus signals the appropriate byte location on the motherboard. The CPU then sends the data character over the data bus to that memory location. • No two devices can share the same I/O port. Many devices use multiple I/O port addresses, which are expressed as a range of hexadecimal numbers. Common Example Serial Port Hardware Configuration Settings COM Port # IRQ I/O Port Address 1 4 3F8-3FFh 2 3 2F8-2FFh 3 4 3E8-3EFh 4 3 2E8-2EFh Common Example Parallel Port Hardware Configuration Settings LPT Port # IRQ I/O Port Address Range LPT1 7 378-37Fh or 3BC-38Fh LPT2 5 278-27Fh or 378-37Fh LPT3 5 278-27Fh An I/O channel is a 3 digit hexadecimal number used to identify and signal a peripheral device. They handle the transfer of data between internal memory and peripheral equipment. 130h - Used for SCSI host adapters 140h - Used for SCSI host adapters 170h - Secondary IDE Interface 1F0h - Primary IDE Interface 220h - Typically used for Sound Blaster-type sound cards 240h - An alternate address for sound cards 278h - Assigned to LPT2 or LPT3 and generally used with IRQ 5 280h - Network Interface cards or the Aria Synthesizer 2A0h - An alternate address for NIC cards or the Aria Synthesizer 2E8h - Assigned to COM 4 and used with IRQ 3 2F8h - Assigned to COM 2 and used with IRQ 3 300h - Another Network Interface Card choice 320h – Another for Network cards, unless there is a SCSI host adapter or MIDI device 330h - A common place for the SCSI host adapters 340h - Another good alternative for the SCSI host adapter 360h - Another Network card choice 378h - The first parallel printer port (LPT 1) in color systems, commonly used with IRQ 7. 3BCh - The first parallel printer port (LPT1) in monochrome systems 3E8h - Assigned to COM 3 and used with IRQ 4 3F8h - Assigned to COM 1 and used with IRQ 4 • To view how your computer has assigned your I/O addresses, open Device Manager, click View at the top of the Device Manager window, click Resources by type, and then select Input/Output (IO). This should give you an output similar to the picture shown below. For a complete list of I/O Port address go to : http://en.wikipedia.org/wiki/Input/output_base_address References • http://www.karbosguide.com/hardware/module5a3.ht m • http://www.cs.mcgill.ca/~cs573/fall2003/suppnotes/le c273/lecture8/index.htm • http://en.wikipedia.org/wiki/Input/output_base_addre ss • http://www.onlinecomputertips.com/pchardware/irq.html