Rev 513 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
495 | giacomo | 1 | #include <linuxcomp.h> |
2 | |||
3 | #include <asm/ptrace.h> |
||
4 | #include <asm-generic/errno-base.h> |
||
5 | #include <linux/kernel.h> |
||
6 | |||
7 | #define NIL -1 |
||
8 | |||
9 | static struct { |
||
10 | void (*func)(int, void *dev_id, struct pt_regs *); |
||
11 | void *data; |
||
12 | int flags; |
||
13 | } handlers[16]; |
||
14 | |||
15 | unsigned long intr_count = 0; |
||
16 | |||
17 | /* |
||
18 | * Generic Linux interrupt handler. |
||
19 | */ |
||
20 | static void linux_intr(int irq) |
||
21 | { |
||
22 | struct pt_regs regs; |
||
23 | |||
24 | //printk("linux_intr %d\n", irq); |
||
25 | |||
26 | intr_count++; |
||
27 | |||
28 | (*handlers[irq].func)(irq, handlers[irq].data, ®s); |
||
29 | |||
30 | intr_count--; |
||
31 | |||
32 | } |
||
33 | |||
34 | /* |
||
35 | * Attach a handler to an IRQ. |
||
36 | */ |
||
37 | int request_irq(unsigned int irq, void (*handler)(int, void *dev_id, struct pt_regs *), unsigned long flags, const char *device, void *dev_id) |
||
38 | { |
||
39 | |||
40 | if (handlers[irq].func) { |
||
41 | return (-EBUSY); |
||
42 | } |
||
43 | |||
44 | handlers[irq].func = handler; |
||
45 | handlers[irq].flags = flags; |
||
46 | handlers[irq].data = dev_id; |
||
47 | |||
48 | shark_handler_set(irq, linux_intr, NIL, TRUE); |
||
49 | |||
50 | return 0; |
||
51 | } |
||
52 | |||
53 | /* |
||
54 | * Deallocate an irq. |
||
55 | */ |
||
56 | void free_irq(unsigned int irq, void *a) |
||
57 | { |
||
58 | shark_handler_remove(irq); |
||
59 | handlers[irq].func = 0; |
||
60 | } |