home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lxapi32.zip / Include / Linux / interrupt.h < prev    next >
C/C++ Source or Header  |  2002-04-26  |  2KB  |  84 lines

  1. /* $Id: interrupt.h,v 1.2 2002/04/26 23:09:06 smilcke Exp $ */
  2.  
  3. /* interrupt.h */
  4. #ifndef _LINUX_INTERRUPT_H
  5. #define _LINUX_INTERRUPT_H
  6.  
  7. #include <linux/kernel.h>
  8. //#include <asm/bitops.h>
  9. #include <asm/atomic.h>
  10.  
  11. struct irqaction {
  12.     void (*handler)(int, void *, struct pt_regs *);
  13.     unsigned long flags;
  14.     unsigned long mask;
  15.     const char *name;
  16.     void *dev_id;
  17.     struct irqaction *next;
  18. };
  19.  
  20. extern volatile unsigned char bh_running;
  21.  
  22. extern atomic_t bh_mask_count[32];
  23. extern unsigned long bh_active;
  24. extern unsigned long bh_mask;
  25. extern void (*bh_base[32])(void);
  26.  
  27. void do_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.     DIGI_BH,
  37.     SERIAL_BH,
  38.     RISCOM8_BH,
  39.     SPECIALIX_BH,
  40.     AURORA_BH,
  41.     ESP_BH,
  42.     NET_BH,
  43.     SCSI_BH,
  44.     IMMEDIATE_BH,
  45.     KEYBOARD_BH,
  46.     CYCLADES_BH,
  47.     CM206_BH,
  48.     JS_BH,
  49.     MACSERIAL_BH,
  50.     ISICOM_BH
  51. };
  52.  
  53. /*
  54.  * Autoprobing for irqs:
  55.  *
  56.  * probe_irq_on() and probe_irq_off() provide robust primitives
  57.  * for accurate IRQ probing during kernel initialization.  They are
  58.  * reasonably simple to use, are not "fooled" by spurious interrupts,
  59.  * and, unlike other attempts at IRQ probing, they do not get hung on
  60.  * stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards).
  61.  *
  62.  * For reasonably foolproof probing, use them as follows:
  63.  *
  64.  * 1. clear and/or mask the device's internal interrupt.
  65.  * 2. sti();
  66.  * 3. irqs = probe_irq_on();      // "take over" all unassigned idle IRQs
  67.  * 4. enable the device and cause it to trigger an interrupt.
  68.  * 5. wait for the device to interrupt, using non-intrusive polling or a delay.
  69.  * 6. irq = probe_irq_off(irqs);  // get IRQ number, 0=none, negative=multiple
  70.  * 7. service the device to clear its pending interrupt.
  71.  * 8. loop again if paranoia is required.
  72.  *
  73.  * probe_irq_on() returns a mask of allocated irq's.
  74.  *
  75.  * probe_irq_off() takes the mask as a parameter,
  76.  * and returns the irq number which occurred,
  77.  * or zero if none occurred, or a negative irq number
  78.  * if more than one irq occurred.
  79.  */
  80. extern unsigned long probe_irq_on(void);    /* returns 0 on failure */
  81. extern int probe_irq_off(unsigned long);    /* returns 0 or negative on failure */
  82.  
  83. #endif
  84.