1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Xenomai API: Interruptions management services.</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<form action="search.php" method="get">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><label> <u>S</u>earch for </label></td>
<td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
</tr>
</table>
</form>
</li>
</ul>
</div>
</div>
<div class="contents">
<h1>Interruptions management services.<br>
<small>
[<a class="el" href="group__posix.html">POSIX skin.</a>]</small>
</h1>
<p>
<div class="dynheader">
Collaboration diagram for Interruptions management services.:</div>
<div class="dynsection">
<center><table><tr><td><img src="group__posix__intr.png" border="0" alt="" usemap="#group____posix____intr_map">
<map name="group____posix____intr_map">
<area shape="rect" href="group__posix.html" title="Xenomai POSIX skin is an implementation of a small subset of the Single Unix specification..." alt="" coords="7,5,100,32"></map></td></tr></table></center>
</div>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Interruptions management services.
<p>
The services described here allow applications written using the POSIX skin to handle interrupts, either in kernel-space or in user-space.<p>
Note however, that it is recommended to use the standardized driver API of the RTDM skin (see <a class="el" href="group__rtdm.html">Real-Time Driver Model</a>).
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__posix__intr.html#gf3a9c7f6f99728f07d14a64518033acb">pthread_intr_attach_np</a> (pthread_intr_t *intrp, unsigned irq, xnisr_t isr, xniack_t iack)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create and attach an interrupt object. <a href="#gf3a9c7f6f99728f07d14a64518033acb"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__posix__intr.html#gd85032757591da13e1263ff94d3e2e73">pthread_intr_detach_np</a> (pthread_intr_t intr)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destroy an interrupt object. <a href="#gd85032757591da13e1263ff94d3e2e73"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__posix__intr.html#g2aa9b968ad1d3101d6ef5c4ab1ce9f25">pthread_intr_control_np</a> (pthread_intr_t intr, int cmd)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Control the state of an interrupt channel. <a href="#g2aa9b968ad1d3101d6ef5c4ab1ce9f25"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__posix__intr.html#g6b6286b729876ba65abb999260639fb3">pthread_intr_wait_np</a> (pthread_intr_t intr, const struct timespec *to)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Wait for the next interruption. <a href="#g6b6286b729876ba65abb999260639fb3"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="gf3a9c7f6f99728f07d14a64518033acb"></a><!-- doxytag: member="intr.c::pthread_intr_attach_np" ref="gf3a9c7f6f99728f07d14a64518033acb" args="(pthread_intr_t *intrp, unsigned irq, xnisr_t isr, xniack_t iack)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int pthread_intr_attach_np </td>
<td>(</td>
<td class="paramtype">pthread_intr_t * </td>
<td class="paramname"> <em>intrp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned </td>
<td class="paramname"> <em>irq</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xnisr_t </td>
<td class="paramname"> <em>isr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">xniack_t </td>
<td class="paramname"> <em>iack</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Create and attach an interrupt object.
<p>
This service creates and attaches an interrupt object.<p>
<dl class="user" compact><dt><b>In kernel-space:</b></dt><dd></dd></dl>
This service installs <em>isr</em> as the handler for the interrupt <em>irq</em>. If <em>iack</em> is not null it is a custom interrupt acknowledge routine.<p>
When called upon reception of an interrupt, the <em>isr</em> function is passed the address of an underlying <b>xnintr_t</b> object, and should use the macro <em>PTHREAD_IDESC()</em> to get the <b>pthread_intr_t</b> object. The meaning of the <em>isr</em> and <em>iack</em> function and what they should return is explained in <a class="el" href="group__intr.html#g6017e33c5871d313b4de053d938dd95b" title="Initialize an interrupt object.">xnintr_init()</a> documentation.<p>
This service is a non-portable extension of the POSIX interface.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>intrp</em> </td><td>address where the created interrupt object identifier will be stored on success;</td></tr>
<tr><td valign="top"></td><td valign="top"><em>irq</em> </td><td>IRQ channel;</td></tr>
<tr><td valign="top"></td><td valign="top"><em>isr</em> </td><td>interrupt handling routine;</td></tr>
<tr><td valign="top"></td><td valign="top"><em>iack</em> </td><td>if not <em>NULL</em>, optional interrupt acknowledge routine.</td></tr>
</table>
</dl>
<dl class="user" compact><dt><b>In user-space:</b></dt><dd></dd></dl>
The prototype of this service is :<p>
<b>int pthread_intr_attach_np (pthread_intr_t *intrp, unsigned irq, int mode);</b><p>
This service causes the installation of a default interrupt handler which unblocks any Xenomai user-space interrupt server thread blocked in a call to <a class="el" href="group__posix__intr.html#g6b6286b729876ba65abb999260639fb3" title="Wait for the next interruption.">pthread_intr_wait_np()</a>, and returns a value depending on the <em>mode</em> parameter.<p>
<dl class="user" compact><dt><b>Parameters:</b></dt><dd><em>intrp</em> and <em>irq</em> have the same meaning as in kernel-space; <em>mode</em> is a bitwise OR of the following values:<ul>
<li>PTHREAD_INOAUTOENA, meaning that the interrupt should not be automatically re-enabled.</li><li>PTHREAD_IPROPAGATE, meaning that the interrupt should be propagated to lower priority domains. In effect, PTHREAD_IPROPAGATE implies PTHREAD_INOAUTOENA since it would make no sense to re-enable the interrupt channel before the next domain down the pipeline has had a chance to process the propagated interrupt.</li></ul>
</dd></dl>
This service is intended to be used in conjunction with the <a class="el" href="group__posix__intr.html#g6b6286b729876ba65abb999260639fb3" title="Wait for the next interruption.">pthread_intr_wait_np()</a> service.<p>
The return values are identical in kernel-space and user-space.<p>
<dl compact><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>on success; </td></tr>
<tr><td valign="top"></td><td valign="top"><em>-1</em> </td><td>with <em>errno</em> set if:<ul>
<li>ENOSYS, kernel-space Xenomai POSIX skin was built without support for interrupts, use RTDM or enable CONFIG_XENO_OPT_POSIX_INTR in kernel configuration;</li><li>ENOMEM, insufficient memory exists in the system heap to create the interrupt object, increase CONFIG_XENO_OPT_SYS_HEAPSZ;</li><li>EINVAL, a low-level error occured while attaching the interrupt;</li><li>EBUSY, an interrupt handler was already registered for the irq line <em>irq</em>. </li></ul>
</td></tr>
</table>
</dl>
<p>References <a class="el" href="ksrc_2skins_2posix_2intr_8c-source.html#l00202">pthread_intr_detach_np()</a>, <a class="el" href="ksrc_2nucleus_2intr_8c-source.html#l00705">xnintr_attach()</a>, <a class="el" href="ksrc_2nucleus_2intr_8c-source.html#l00614">xnintr_init()</a>, and <a class="el" href="synch_8c-source.html#l00102">xnsynch_init()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g2aa9b968ad1d3101d6ef5c4ab1ce9f25"></a><!-- doxytag: member="intr.c::pthread_intr_control_np" ref="g2aa9b968ad1d3101d6ef5c4ab1ce9f25" args="(pthread_intr_t intr, int cmd)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int pthread_intr_control_np </td>
<td>(</td>
<td class="paramtype">pthread_intr_t </td>
<td class="paramname"> <em>intr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>cmd</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Control the state of an interrupt channel.
<p>
This service allow to enable or disable an interrupt channel.<p>
This service is a non-portable extension of the POSIX interface.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>intr</em> </td><td>identifier of the interrupt to be enabled or disabled.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>cmd</em> </td><td>one of PTHREAD_IENABLE or PTHREAD_IDISABLE.</td></tr>
</table>
</dl>
<dl compact><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>on success; </td></tr>
<tr><td valign="top"></td><td valign="top"><em>-1</em> </td><td>with <em>errno</em> set if:<ul>
<li>ENOSYS, kernel-space Xenomai POSIX skin was built without support for interrupts, use RTDM or enable CONFIG_XENO_OPT_POSIX_INTR in kernel configuration;</li><li>EINVAL, the identifier <em>intr</em> or <em>cmd</em> is invalid;</li><li>EPERM, the interrupt <em>intr</em> does not belong to the current process. </li></ul>
</td></tr>
</table>
</dl>
<p>References <a class="el" href="ksrc_2nucleus_2intr_8c-source.html#l00866">xnintr_disable()</a>, and <a class="el" href="ksrc_2nucleus_2intr_8c-source.html#l00834">xnintr_enable()</a>.</p>
</div>
</div><p>
<a class="anchor" name="gd85032757591da13e1263ff94d3e2e73"></a><!-- doxytag: member="intr.c::pthread_intr_detach_np" ref="gd85032757591da13e1263ff94d3e2e73" args="(pthread_intr_t intr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int pthread_intr_detach_np </td>
<td>(</td>
<td class="paramtype">pthread_intr_t </td>
<td class="paramname"> <em>intr</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Destroy an interrupt object.
<p>
This service destroys the interrupt object <em>intr</em>. The memory allocated for this object is returned to the system heap, so further references using the same object identifier are not guaranteed to fail.<p>
If a user-space interrupt server is blocked in a call to <a class="el" href="group__posix__intr.html#g6b6286b729876ba65abb999260639fb3" title="Wait for the next interruption.">pthread_intr_wait_np()</a>, it is unblocked and the blocking service returns with an error of EIDRM.<p>
This service is a non-portable extension of the POSIX interface.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>intr</em> </td><td>identifier of the interrupt object to be destroyed.</td></tr>
</table>
</dl>
<dl compact><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>on success; </td></tr>
<tr><td valign="top"></td><td valign="top"><em>-1</em> </td><td>with <em>errno</em> set if:<ul>
<li>ENOSYS, kernel-space Xenomai POSIX skin was built without support for interrupts, use RTDM or enable CONFIG_XENO_OPT_POSIX_INTR in kernel configuration;</li><li>EINVAL, the interrupt object <em>intr</em> is invalid;</li><li>EPERM, the interrupt <em>intr</em> does not belong to the current process. </li></ul>
</td></tr>
</table>
</dl>
<p>Referenced by <a class="el" href="ksrc_2skins_2posix_2intr_8c-source.html#l00102">pthread_intr_attach_np()</a>.</p>
</div>
</div><p>
<a class="anchor" name="g6b6286b729876ba65abb999260639fb3"></a><!-- doxytag: member="intr.c::pthread_intr_wait_np" ref="g6b6286b729876ba65abb999260639fb3" args="(pthread_intr_t intr, const struct timespec *to)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int pthread_intr_wait_np </td>
<td>(</td>
<td class="paramtype">pthread_intr_t </td>
<td class="paramname"> <em>intr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const struct timespec * </td>
<td class="paramname"> <em>to</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Wait for the next interruption.
<p>
This service is used by user-space interrupt server threads, to wait, if no interrupt is pending, for the next interrupt.<p>
This service is a cancelation point. If a thread is canceled while blocked in a call to this service, no interruption notification is lost.<p>
This service is a non-portable extension of the POSIX interface.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>intr</em> </td><td>interrupt object identifier;</td></tr>
<tr><td valign="top"></td><td valign="top"><em>to</em> </td><td>if not <em>NULL</em>, timeout, expressed as a time interval.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the number of interrupt received on success; <p>
-1 with <em>errno</em> set if:<ul>
<li>ENOSYS, kernel-space Xenomai POSIX skin was built without support for interrupts, use RTDM or enable CONFIG_XENO_OPT_POSIX_INTR in kernel configuration;</li><li>EIDRM, the interrupt object was deleted;</li><li>EPERM, the interrupt <em>intr</em> does not belong to the current process;</li><li>ETIMEDOUT, the timeout specified by <em>to</em> expired;</li><li>EINTR, <a class="el" href="group__posix__intr.html#g6b6286b729876ba65abb999260639fb3" title="Wait for the next interruption.">pthread_intr_wait_np()</a> was interrupted by a signal. </li></ul>
</dd></dl>
</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Aug 2 12:48:40 2010 for Xenomai API by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
|