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