Tuesday, 6 May 2008

The use of IRQ and I/O Ports in Networking

I/O Addresses
The computer's memory map uses certain memory addresses for selected tasks and hardware allocation. The I/O addresses are in hexadecimal format (Sweet, 2005).
[1] The routines for accessing I/O ports are maintained within /usr/include/asm/io.h. When programming any Unix or Unix like O/S (such as Linux), each byte that is input from a port (call inb(port)) returns the same byte information. To output a byte (call outb(value, port)) the same process is used, but the I/O port must be defined. Thus to input a word (2 bytes) from ports X and X+1 one byte is assigned to each port to structure the word using the assembler instruction call inw(X). Output of the word is achieved using the two ports, [outw(value, X)].
The manual pages for ioperm(2), iopl(2), and the other macros give further details of their use.

IRQ's (Interrupt Request) Lines
IRQ is an asynchronous signal sent to microprocessor to advertise completion of a task. IRQ's are the direct access path from hardware and other peripherals to the main computer (CPU) and allow devices linked to the computer to signal the CPU to request CPU time. Three IRQ’s (of the 16) are dedicated to the main system board as the system timer, keyboard, and memory parity error signal (Tackett, 1998; Minnich, 2000).

The parallel port
The parallel port's base address is the I/O address. This is generally (although not always) 0x3bc for /dev/lp0, 0x378 for /dev/lp1, and 0x278 for /dev/lp2. Extended bidirectional mode, ECP/EPP modes and the IEEE 1284 standard in general treat this somewhat differently leaving programmers to write a kernel driver if they need to include ECP/EPP printer modes (Frisch, AEleen, 1995).

Serial port
RS-232 is the (most common/general) serial port protocol. Standard Linux serial drivers are adequate for nearly all applications. The IRQ and I/O are used by Linux in the Kernel mode to communicate with the serial ports. As the Serial port protocol and drivers are defined by Linux in User mode, it is unlikely that direct calls would need to be made to them.
A system call is made when access an I/O device or a file (like read or write) is required (Doell, 1994).
Overall and how this relates to Networking
Network I/O is unpredictable (Loukides, 1992); traffic flows are rarely synchronous or consistent leading the system to sort multiple I/O requests efficiently. IRQ are used by the system to allocate CPU time to the various input streams. I/O is used to match up the byte and create words.

[1] Fraser et al (2004)

1 comment:

Anonymous said...

nice post...