On Tue, Mar 08, 2005 at 12:54:14PM +0530, Dhanashri Bhate wrote: > I am trying to write a simple interrupt driven driver for COM1 port, > which should print whatever data arrives on the COM1 port. > > The problem is, my module gets loaded properly, but control doesn't go > to the handler function. Looks like interrupt is not caught. > > here are some more details: > > version 2.4.18-14 , runlevel 3 > > Setserial shows this info: > /dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4, Baud_base: 115200, > close_delay: 256, divisor: 0 > closing_wait: 15360 > Flags: spd_normal skip_test So there already is a driver that took control of the serial port. > In the program: > > Init module: > /* enable serial port interrupts , SER_PORT=0x03f8 */ > outb( 0x01, SER_PORT+1 ); > free_irq(4, NULL); You can't randomly free interrupts, and you're certainly not supposed to free interrupts when you just *enabled* the interrupt source on the device. > request_irq(4,irq_handler,0,"serialport_irq_handler",NULL); > > In irq_handler: > > void irq_handler(int irq, void *dev_id, struct pt_regs *regs) IRQ handlers are not void functions, but return irqreturn_t. > { > static unsigned char scandata; > static struct tq_struct task = > { > routine:got_data, > data:&scandata > }; Interesting way to pass data, but wrong. The normal way is to put device instance related data in dev_id->priv (a void*, so you can put anything you want in it). > scandata = inb(SER_PORT); > printk( "<1>SerialPortDriver: in the irq_handler function\n"); > queue_task_irq(&task, &tq_immediate); > mark_bh(IMMEDIATE_BH); > } > > > Function got_data just prints the received data. > > Another program that polls COM1 works fine. Could anyone please tell > me whats wrong here? Two drivers competing for the same piece of hardware, that's a recipe for disaster. Remove the standard serial module and retry your own module. Erik -- Erik Mouw J.A.K.Mouw@xxxxxxxxxxxxxx mouw@xxxxxxxxxxxx
Attachment:
signature.asc
Description: Digital signature