1 /* interrupt.h */ 2 #ifndef _LINUX_INTERRUPT_H 3 #define _LINUX_INTERRUPT_H 4 5 #include <asm/bitops.h> 6 7 struct bh_struct { 8 void (*routine)(void *); 9 void *data; 10 }; 11 12 extern unsigned long bh_active; 13 extern unsigned long bh_mask; 14 extern struct bh_struct bh_base[32]; 15 16 asmlinkage void do_bottom_half(void); 17 18 /* Who gets which entry in bh_base. Things which will occur most often 19 should come first - in which case NET should be up the top with SERIAL/TQUEUE! */ 20 21 enum { 22 TIMER_BH = 0, 23 CONSOLE_BH, 24 TQUEUE_BH, 25 SERIAL_BH, 26 NET_BH, 27 IMMEDIATE_BH, 28 KEYBOARD_BH, 29 CYCLADES_BH 30 }; 31 32 extern inline void mark_bh(int nr) /* */ 33 { 34 set_bit(nr, &bh_active); 35 } 36 37 extern inline void disable_bh(int nr) /* */ 38 { 39 clear_bit(nr, &bh_mask); 40 } 41 42 extern inline void enable_bh(int nr) /* */ 43 { 44 set_bit(nr, &bh_mask); 45 } 46 47 /* 48 * Autoprobing for irqs: 49 * 50 * probe_irq_on() and probe_irq_off() provide robust primitives 51 * for accurate IRQ probing during kernel initialization. They are 52 * reasonably simple to use, are not "fooled" by spurious interrupts, 53 * and, unlike other attempts at IRQ probing, they do not get hung on 54 * stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards). 55 * 56 * For reasonably foolproof probing, use them as follows: 57 * 58 * 1. clear and/or mask the device's internal interrupt. 59 * 2. sti(); 60 * 3. irqs = probe_irq_on(); // "take over" all unassigned idle IRQs 61 * 4. enable the device and cause it to trigger an interrupt. 62 * 5. wait for the device to interrupt, using non-intrusive polling or a delay. 63 * 6. irq = probe_irq_off(irqs); // get IRQ number, 0=none, negative=multiple 64 * 7. service the device to clear its pending interrupt. 65 * 8. loop again if paranoia is required. 66 * 67 * probe_irq_on() returns a mask of snarfed irq's. 68 * 69 * probe_irq_off() takes the mask as a parameter, 70 * and returns the irq number which occurred, 71 * or zero if none occurred, or a negative irq number 72 * if more than one irq occurred. 73 */ 74 extern unsigned int probe_irq_on(void); /* returns 0 on failure */ 75 extern int probe_irq_off(unsigned int); /* returns 0 or negative on failure */ 76 77 #endif