Hello,

I'm trying to install an interrupt handler for interrupt 10 which is
generated by
a PCI video card.  In the code below I request the irq, do some outs and
in's to 
clear the vga interrupt and then enable it, and then do a hard interrupt
enable.

The program seems to die after I do the hard enable, at least that is the last
message I have logged.  Potentially it appears to crash after I get to the
interrupt
handler, but I guess that is just speculation.   Below is the code, thanks

Maybe this is a hint, sometimes on the console it says UNKNOWN INTERRUPT.
The interrupt
is not listed in /proc/interrupts but it is listed in /proc/pci as being
generated by
the video card.

Adam

#include <asm/io.h>
#include <rtl_fifo.h>
#include <rtl_core.h>
#include <rtl_time.h>
#include <rtl.h>

unsigned int intr_handler(unsigned int,struct pt_regs*);

unsigned int interrupt_count=0;

int init_module(void)
{
        char portbyte;

        //this is called when the module is loaded.
        //here we should install our interrupt handle
        printk("Loading interrupt module\n");
        //interrupt 10 is where the video card retrace is
        rtl_request_irq(10,intr_handler);
        printk("Requested interrupt 10\n");

        //now lets do the stuff to the vga so we know what the hell
        //we are doing
        outb_p(0x3d4,0x11);
        portbyte=inb_p(0x3d5);  

        //clear the interrupt flag
        portbyte=(portbyte & 0xef) | 0x20;
        outb_p(0x3d5,(portbyte & 0xef)|0x20);   

        //now enable the interrupt
        portbyte=(portbyte & 0xdf)|0x10;
        outb_p(0x3d5,portbyte);

        rtl_hard_enable_irq(10);
        printk("Hard enabled interrupt 10\n");
        return 0;
}

void cleanup_module(void)
{
        printk("Exiting interrupt module\n");
        printk("Got '%d' interrupts\n",interrupt_count);
        rtl_hard_disable_irq(10);
        rtl_free_irq(10);
}

unsigned int intr_handler(unsigned int irq,struct pt_regs *regs)
{
  //char portbyte;

        //called at interrupt time....lets just do a printk
        //printk("Got interrupt '%d'",interrupt_count);
        //      interrupt_count++;
        /*
        outb_p(0x3d4,11);
        portbyte=inb_p(0x3d5);
        outb_p(0x3d4,11);
        outb_p(0x3d5,portbyte & 0xef);
        */
        rtl_hard_enable_irq(10);
        return 0;
}


--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to