1 /* interrupt.h */ 2 #ifndef_LINUX_INTERRUPT_H 3 #define_LINUX_INTERRUPT_H 4
5 #include <linux/kernel.h>
6 #include <asm/bitops.h>
7
8 structirqaction{ 9 void (*handler)(int, void *, structpt_regs *);
10 unsignedlongflags;
11 unsignedlongmask;
12 constchar *name;
13 void *dev_id;
14 structirqaction *next;
15 };
16
17
18 structbh_struct{ 19 void (*routine)(void *);
20 void *data;
21 };
22
23 externunsignedlongbh_active;
24 externunsignedlongbh_mask;
25 externstructbh_structbh_base[32];
26
27 asmlinkagevoiddo_bottom_half(void);
28
29 /* Who gets which entry in bh_base. Things which will occur most often 30 should come first - in which case NET should be up the top with SERIAL/TQUEUE! */ 31
32 enum{ 33 TIMER_BH = 0,
34 CONSOLE_BH,
35 TQUEUE_BH,
36 SERIAL_BH,
37 NET_BH,
38 IMMEDIATE_BH,
39 KEYBOARD_BH,
40 CYCLADES_BH,
41 CM206_BH 42 };
43
44 externinlinevoidmark_bh(intnr)
/* */ 45 { 46 set_bit(nr, &bh_active);
47 } 48
49 externinlinevoiddisable_bh(intnr)
/* */ 50 { 51 clear_bit(nr, &bh_mask);
52 } 53
54 externinlinevoidenable_bh(intnr)
/* */ 55 { 56 set_bit(nr, &bh_mask);
57 } 58
59 externinlinevoidstart_bh_atomic(void)
/* */ 60 { 61 intr_count++;
62 barrier();
63 } 64
65 externinlinevoidend_bh_atomic(void)
/* */ 66 { 67 barrier();
68 intr_count--;
69 } 70
71 /* 72 * Autoprobing for irqs: 73 * 74 * probe_irq_on() and probe_irq_off() provide robust primitives 75 * for accurate IRQ probing during kernel initialization. They are 76 * reasonably simple to use, are not "fooled" by spurious interrupts, 77 * and, unlike other attempts at IRQ probing, they do not get hung on 78 * stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards). 79 * 80 * For reasonably foolproof probing, use them as follows: 81 * 82 * 1. clear and/or mask the device's internal interrupt. 83 * 2. sti(); 84 * 3. irqs = probe_irq_on(); // "take over" all unassigned idle IRQs 85 * 4. enable the device and cause it to trigger an interrupt. 86 * 5. wait for the device to interrupt, using non-intrusive polling or a delay. 87 * 6. irq = probe_irq_off(irqs); // get IRQ number, 0=none, negative=multiple 88 * 7. service the device to clear its pending interrupt. 89 * 8. loop again if paranoia is required. 90 * 91 * probe_irq_on() returns a mask of allocated irq's. 92 * 93 * probe_irq_off() takes the mask as a parameter, 94 * and returns the irq number which occurred, 95 * or zero if none occurred, or a negative irq number 96 * if more than one irq occurred. 97 */ 98 externunsignedlongprobe_irq_on(void); /* returns 0 on failure */ 99 externintprobe_irq_off(unsignedlong); /* returns 0 or negative on failure */ 100
101 #endif