1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>request_threaded_irq</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux generic IRQ handling"><link rel="up" href="pubfunctions.html" title="Chapter&#160;9.&#160;Public Functions Provided"><link rel="prev" href="API-free-irq.html" title="free_irq"><link rel="next" href="API-request-any-context-irq.html" title="request_any_context_irq"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">request_threaded_irq</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-free-irq.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;9.&#160;Public Functions Provided</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-request-any-context-irq.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-request-threaded-irq"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>request_threaded_irq &#8212; 
2     allocate an interrupt line
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">request_threaded_irq </b>(</code></td><td>unsigned int <var class="pdparam">irq</var>, </td></tr><tr><td>&#160;</td><td>irq_handler_t <var class="pdparam">handler</var>, </td></tr><tr><td>&#160;</td><td>irq_handler_t <var class="pdparam">thread_fn</var>, </td></tr><tr><td>&#160;</td><td>unsigned long <var class="pdparam">irqflags</var>, </td></tr><tr><td>&#160;</td><td>const char * <var class="pdparam">devname</var>, </td></tr><tr><td>&#160;</td><td>void * <var class="pdparam">dev_id</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1103183932"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>irq</code></em></span></dt><dd><p>
4     Interrupt line to allocate
5    </p></dd><dt><span class="term"><em class="parameter"><code>handler</code></em></span></dt><dd><p>
6     Function to be called when the IRQ occurs.
7     Primary handler for threaded interrupts
8     If NULL and thread_fn != NULL the default
9     primary handler is installed
10    </p></dd><dt><span class="term"><em class="parameter"><code>thread_fn</code></em></span></dt><dd><p>
11     Function called from the irq handler thread
12     If NULL, no irq thread is created
13    </p></dd><dt><span class="term"><em class="parameter"><code>irqflags</code></em></span></dt><dd><p>
14     Interrupt type flags
15    </p></dd><dt><span class="term"><em class="parameter"><code>devname</code></em></span></dt><dd><p>
16     An ascii name for the claiming device
17    </p></dd><dt><span class="term"><em class="parameter"><code>dev_id</code></em></span></dt><dd><p>
18     A cookie passed back to the handler function
19    </p></dd></dl></div></div><div class="refsect1"><a name="idp1103190716"></a><h2>Description</h2><p>
20   This call allocates interrupt resources and enables the
21   interrupt line and IRQ handling. From the point this
22   call is made your handler function may be invoked. Since
23   your handler function must clear any interrupt the board
24   raises, you must take care both to initialise your hardware
25   and to set up the interrupt handler in the right order.
26   </p><p>
27
28   If you want to set up a threaded irq handler for your device
29   then you need to supply <em class="parameter"><code>handler</code></em> and <em class="parameter"><code>thread_fn</code></em>. <em class="parameter"><code>handler</code></em> is
30   still called in hard interrupt context and has to check
31   whether the interrupt originates from the device. If yes it
32   needs to disable the interrupt on the device and return
33   IRQ_WAKE_THREAD which will wake up the handler thread and run
34   <em class="parameter"><code>thread_fn</code></em>. This split handler design is necessary to support
35   shared interrupts.
36   </p><p>
37
38   Dev_id must be globally unique. Normally the address of the
39   device data structure is used as the cookie. Since the handler
40   receives this value it makes sense to use it.
41   </p><p>
42
43   If your interrupt is shared you must pass a non NULL dev_id
44   as this is required when freeing the interrupt.
45</p></div><div class="refsect1"><a name="idp1103194068"></a><h2>Flags</h2><p>
46   </p><p>
47
48   IRQF_SHARED		Interrupt is shared
49   IRQF_TRIGGER_*		Specify active edge(s) or level
50</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-free-irq.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="pubfunctions.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-request-any-context-irq.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">free_irq</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">request_any_context_irq</span></td></tr></table></div></body></html>
51