The below functions are used to install and uninstall the interrupt handler in Linux kernel which are declared in <linux/interrupt.h>, implement the interrupt registration interface:
To make interrupt request :-
int request_irq(unsigned int irq, irq_handler_t (*handler)(int, void *), unsigned long irqflags,
const char *dev_name, void *dev_id);
int request_irq(unsigned int irq, irq_handler_t (*handler)(int, void *), unsigned long irqflags,
const char *dev_name, void *dev_id);
Return value from request_irq is either 0 in case of success or a negative error code.
The parameter's of this functions are as follows:
unsigned int irq - The interrupt number being requested.
irq_handler_t (*handler)(int, void *) - Pointer to the interrupt handler routine (ISR) being installed.
unsigned long flags - flag specifies that interrupts generated by this device should follow some specific stuffs - flags are like IRQF_DISABLED /IRQF_SAMPLE_RANDOM/IRQF_TIMER/IRQF_SHARED (most commonly used - interrupt line can be shared among multiple interrupt handlers)
const char *dev_name - The string passed to request_irq is used in /proc/interrupts to show the owner of the interrupt.
void *dev_id - dev_id must be globally unique, if pointer used for shared interrupt lines, it is a unique identifier that is used when the interrupt line is freed and that may also be used by the driver to point to its own private data area to find which device is interrupting. dev_id can be set to NULL, if the interrupt is not shared.
To free the installed interrupt handler :-
void free_irq(unsigned int irq, void *dev_id);