Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | #include<asm/bitops.h> |
2 | #include<kernel/kern.h> |
||
3 | |||
4 | struct device *irq2dev_map[16] = {0, 0, /* ... zeroed */}; |
||
5 | |||
6 | static DWORD handled; /* The irq lines we have a handler on. */ |
||
7 | static volatile int irq_number = 0; /* The latest irq number we actually found. */ |
||
8 | |||
9 | static void autoirq_probe(int irq) |
||
10 | { |
||
11 | irq_number = irq; |
||
12 | cprintf("Autoirq: %d\n", irq); |
||
13 | |||
14 | return; |
||
15 | } |
||
16 | |||
17 | int autoirq_setup(int waittime) |
||
18 | { |
||
19 | int i; |
||
20 | |||
21 | handled = 0; |
||
22 | |||
23 | for (i = 0; i < 16; i++) { |
||
24 | if (handler_set(i, autoirq_probe, NIL) == 1) { |
||
25 | set_bit(i, (void *)&handled); |
||
26 | } |
||
27 | } |
||
28 | |||
29 | /* Hang out at least <waittime> jiffies waiting for bogus IRQ hits. */ |
||
30 | task_delay(waittime); |
||
31 | |||
32 | return handled; |
||
33 | } |
||
34 | |||
35 | int autoirq_report(int waittime) |
||
36 | { |
||
37 | int i; |
||
38 | |||
39 | /* Hang out at least <waittime> jiffies waiting for the IRQ. */ |
||
40 | task_delay(waittime); |
||
41 | |||
42 | /* Retract the irq handlers that we installed. */ |
||
43 | for (i = 0; i < 16; i++) { |
||
44 | if (test_bit(i, (void *)&handled)) |
||
45 | handler_remove(i); |
||
46 | } |
||
47 | return irq_number; |
||
48 | } |
||
49 | |||
50 | /* |
||
51 | * Local variables: |
||
52 | * compile-command: "gcc -DKERNEL -Wall -O6 -fomit-frame-pointer -I/usr/src/linux/net/tcp -c auto_irq.c" |
||
53 | * version-control: t |
||
54 | * kept-new-versions: 5 |
||
55 | * c-indent-level: 4 |
||
56 | * tab-width: 4 |
||
57 | * End: |
||
58 | */ |