TimeLinux1

Wednesday, October 13, 2010

Linux HowTo: IOPorts, Interrupts, DMA


The computer, in order to communicate with the hardware devices connected to it, assignes and uses certain mechanisms like ports, interrupts, dma. These signals are transmitted over the buses on the motherboard..

-bus:
           . communication channels over which peripherals communicate with the cpu.
           . bus exist on the mother board.
           . current bus architecture is called PCI. PCI replaced ISA that came with PC-AT in 1984. Hence ISA was also called AT Bus.
           . PCI supports 32 bit devices. ISA supported upto 16 bit devices.

-To see PCI devices:
          # cat /proc/pci
      or # lspci

-ports:
           . When cpu needs to communicate to peripheral devices, it does so by writing to IO ports or simply ports.
           . each device has its own separate port that is not shared with other devices.
-To see the IO ports on the system:
          # cat /proc/ioports
-Note: ports are denoted in hexadecimal eg. 37A

-interrupts:
           . interrupts or IRQs are signals generated by peripherals for the cpu to know.
           . when the cpu receives an interrupt signal, it temporarily suspends all its activities and attends to the interrupt (thats why called 'interrupt').
           . interrupts may be shared between peripheral devices (unlike ports)
-To see interrupts:
           # cat /proc/interrupts - current interrupts
           # dmesg | grep -i share - to see shared interrupts besides other things.

-dma:
           . direct memory access
           . for faster peripheral devices, generating interrupts to talk to cpu and then gain access to RAM could slow things down.
           . dma solves this problem by granting the peripheral direct access to memory areas; basically bypassing the cpu.
           # cat /proc/dma
           # dmesg | grep -i dma - to see dma info besides other things.

-pnp
           . with the advent of newer and multitude of peripherals, ports and interrupts became scarce. for instance two devices could not share ports or irqs.
           . thats when plug n play (pnp) concept came into being.
           . pnp devices report a set of interrupts/ports they need for working at boot time to bios and the system then doles those ports/irqs on need basis.
           . These days, pnp is a standard feature of most computers.

No comments:

Post a Comment