Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

#include<asm/bitops.h>
#include<kernel/kern.h>

struct device *irq2dev_map[16] = {0, 0, /* ... zeroed */};

static DWORD handled;           /* The irq lines we have a handler on. */
static volatile int irq_number = 0;                     /* The latest irq number we actually found. */

static void autoirq_probe(int irq)
{
        irq_number = irq;
        cprintf("Autoirq: %d\n", irq);
       
        return;
}

int autoirq_setup(int waittime)
{
        int i;

        handled = 0;

        for (i = 0; i < 16; i++) {
                if (handler_set(i, autoirq_probe, NIL) == 1) {
                                set_bit(i, (void *)&handled);
                }
        }

        /* Hang out at least <waittime> jiffies waiting for bogus IRQ hits. */
        task_delay(waittime);

        return handled;
}

int autoirq_report(int waittime)
{
        int i;

        /* Hang out at least <waittime> jiffies waiting for the IRQ. */
        task_delay(waittime);

        /* Retract the irq handlers that we installed. */
        for (i = 0; i < 16; i++) {
                if (test_bit(i, (void *)&handled))
                        handler_remove(i);
        }
        return irq_number;
}

/*
 * Local variables:
 *  compile-command: "gcc -DKERNEL -Wall -O6 -fomit-frame-pointer -I/usr/src/linux/net/tcp -c auto_irq.c"
 *  version-control: t
 *  kept-new-versions: 5
 *  c-indent-level: 4
 *  tab-width: 4
 * End:
 */