About Interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
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

In the program:

Init module:
/* enable serial port interrupts , SER_PORT=0x03f8 */
outb( 0x01, SER_PORT+1 );
free_irq(4, NULL);
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)
{
        static unsigned char scandata;
        static struct tq_struct task =
        {
                routine:got_data,
                data:&scandata
        };
        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? 

Thanks,
Dhanashri

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux