~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/drivers/net/auto_irq.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* auto_irq.c: Auto-configure IRQ lines for linux. */
  2 /*
  3     Written 1994 by Donald Becker.
  4 
  5     The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
  6     Center of Excellence in Space Data and Information Sciences
  7       Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
  8 
  9     This code is a general-purpose IRQ line detector for devices with
 10     jumpered IRQ lines.  If you can make the device raise an IRQ (and
 11     that IRQ line isn't already being used), these routines will tell
 12     you what IRQ line it's using -- perfect for those oh-so-cool boot-time
 13     device probes!
 14 
 15     To use this, first call autoirq_setup(timeout). TIMEOUT is how many
 16     'jiffies' (1/100 sec.) to detect other devices that have active IRQ lines,
 17     and can usually be zero at boot.  'autoirq_setup()' returns the bit
 18     vector of nominally-available IRQ lines (lines may be physically in-use,
 19     but not yet registered to a device).
 20     Next, set up your device to trigger an interrupt.
 21     Finally call autoirq_report(TIMEOUT) to find out which IRQ line was
 22     most recently active.  The TIMEOUT should usually be zero, but may
 23     be set to the number of jiffies to wait for a slow device to raise an IRQ.
 24 
 25     The idea of using the setup timeout to filter out bogus IRQs came from
 26     the serial driver.
 27 */
 28 
 29 
 30 #ifdef version
 31 static const char *version=
 32 "auto_irq.c:v1.11 Donald Becker (becker@cesdis.gsfc.nasa.gov)";
 33 #endif
 34 
 35 #include <linux/module.h>
 36 #include <linux/sched.h>
 37 #include <linux/delay.h>
 38 #include <asm/bitops.h>
 39 #include <asm/io.h>
 40 #include <asm/irq.h>
 41 #include <linux/netdevice.h>
 42 
 43 static unsigned long irqs;
 44 
 45 void autoirq_setup(int waittime)
 46 {
 47         irqs = probe_irq_on();
 48 }
 49 
 50 #define BUSY_LOOP_UNTIL(j) while ((long)(jiffies-(j)) < 0) ;
 51 int autoirq_report(int waittime)
 52 {
 53         unsigned long delay = jiffies + waittime;
 54         BUSY_LOOP_UNTIL(delay)
 55         return probe_irq_off(irqs);
 56 }
 57 
 58 EXPORT_SYMBOL(autoirq_setup);
 59 EXPORT_SYMBOL(autoirq_report);
 60 
 61 
 62 /*
 63  * Local variables:
 64  *  compile-command: "gcc -DKERNEL -Wall -O6 -fomit-frame-pointer -I/usr/src/linux/net/tcp -c auto_irq.c"
 65  *  version-control: t
 66  *  kept-new-versions: 5
 67  *  c-indent-level: 4
 68  *  tab-width: 4
 69  * End:
 70  */
 71 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.