Writing serial port interrupt handler in linux
Kindly help !!
#include <linux/kernel.h> #include <linux/interrupt.h> #include <asm/io.h>
#define PORT 0x3F8
irq_handler_t isrSerialPort (int irq, void dev_id, struct pt_regs regs) { printk ("\nThank god !\n"); return (irq_handler_t) IRQ_HANDLED; }
int init_module () { outb (0x01, PORT + 1); outb (0x83, PORT + 3);
// Set Baud rate - Divisor Latch Low Byte
outb (0x0C, PORT + 0);
// Set Baud rate - Divisor Latch High Byte
outb (0x00, PORT + 1);
// number of bytes to read
outb (0x07, PORT + 2);
outb (0x03, PORT + 3);
int h = request_irq (4, (irq_handler_t) isrSerialPort,
SA_SHIRQ, "God", (void *) (isrSerialPort)); // Interrupt when data received
outb (0x01, PORT + 1);
return h;
}MODULE_LICENSE ("GPL");