Friday 20 November 2015

Use Pci Irqs With Linux Pci Device Drivers

USB disks communicate with the CPU via the PCI bus.


PCI, or Peripheral Component Interconnection, is the bus used by the motherboard to connect to devices. When multiple devices are simultaneously connected to the motherboard, they must share the central processing unit, or CPU. They accomplish this with interrupt requests, or IRQs. Device drivers for Linux systems assign an IRQ number to the PCI device. The device uses the IRQ to notify the CPU that the device needs its attention. The CPU handles IRQs in a predefined priority scheme.


Instructions= 0) {


result = request_irq(short_irq, short_interrupt,


SA_INTERRUPT, "short", NULL);


if (result) {


printk(KERN_INFO "short: can't get assigned irq %i\n",


short_irq);


short_irq = -1;


}


else {


outb(0x10,short_base+2);


}


}


7. Save changes to the device driver by clicking "File," "Save."


8. Compile the device driver. At the command line, type "gcc -c," then a space and then the name of the source file. Using the previous example, type "gcc -c /home/code/device1.c" and press "Enter." The device driver is compiled.


9. Restart the computer to activate the newly modified device driver.

Tags: device driver