gnuk/ChibiOS_2.0.2/docs/html/chthreads_8h_source.html
2010-08-10 12:11:02 +09:00

376 lines
47 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ChibiOS/RT: chthreads.h Source File</title>
<link href="custom.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<table style="text-align: center; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 80px;"><img alt="ChibiOS/RT Logo" src="logo_small.png"></td>
<td><big><big>ChibiOS/RT</big></big><br><br>Architecture - Reference Manual - Guides</td>
<td style="width: 80px;"></td>
</tr>
</tbody>
</table>
<hr size="1">
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<h1>chthreads.h</h1><a href="chthreads_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment"> This file is part of ChibiOS/RT.</span>
<a name="l00005"></a>00005 <span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment"> ChibiOS/RT is free software; you can redistribute it and/or modify</span>
<a name="l00007"></a>00007 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
<a name="l00008"></a>00008 <span class="comment"> the Free Software Foundation; either version 3 of the License, or</span>
<a name="l00009"></a>00009 <span class="comment"> (at your option) any later version.</span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment"> ChibiOS/RT is distributed in the hope that it will be useful,</span>
<a name="l00012"></a>00012 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00013"></a>00013 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00014"></a>00014 <span class="comment"> GNU General Public License for more details.</span>
<a name="l00015"></a>00015 <span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment"> You should have received a copy of the GNU General Public License</span>
<a name="l00017"></a>00017 <span class="comment"> along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00018"></a>00018 <span class="comment"></span>
<a name="l00019"></a>00019 <span class="comment"> ---</span>
<a name="l00020"></a>00020 <span class="comment"></span>
<a name="l00021"></a>00021 <span class="comment"> A special exception to the GPL can be applied should you wish to distribute</span>
<a name="l00022"></a>00022 <span class="comment"> a combined work that includes ChibiOS/RT, without being obliged to provide</span>
<a name="l00023"></a>00023 <span class="comment"> the source code for any proprietary components. See the file exception.txt</span>
<a name="l00024"></a>00024 <span class="comment"> for full details of how and when the exception can be applied.</span>
<a name="l00025"></a>00025 <span class="comment">*/</span>
<a name="l00026"></a>00026 <span class="comment"></span>
<a name="l00027"></a>00027 <span class="comment">/**</span>
<a name="l00028"></a>00028 <span class="comment"> * @file chthreads.h</span>
<a name="l00029"></a>00029 <span class="comment"> * @brief Threads macros and structures.</span>
<a name="l00030"></a>00030 <span class="comment"> *</span>
<a name="l00031"></a>00031 <span class="comment"> * @addtogroup threads</span>
<a name="l00032"></a>00032 <span class="comment"> * @{</span>
<a name="l00033"></a>00033 <span class="comment"> */</span>
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <span class="preprocessor">#ifndef _CHTHREADS_H_</span>
<a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#define _CHTHREADS_H_</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="comment">/*</span>
<a name="l00039"></a>00039 <span class="comment"> * Module dependencies check.</span>
<a name="l00040"></a>00040 <span class="comment"> */</span>
<a name="l00041"></a>00041 <span class="preprocessor">#if CH_USE_DYNAMIC &amp;&amp; !CH_USE_WAITEXIT</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#error &quot;CH_USE_DYNAMIC requires CH_USE_WAITEXIT&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_DYNAMIC &amp;&amp; !CH_USE_HEAP &amp;&amp; !CH_USE_MEMPOOLS</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span><span class="preprocessor">#error &quot;CH_USE_DYNAMIC requires CH_USE_HEAP and/or CH_USE_MEMPOOLS&quot;</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00048"></a>00048 <span class="comment">/**</span>
<a name="l00049"></a>00049 <span class="comment"> * @extends ThreadsQueue</span>
<a name="l00050"></a>00050 <span class="comment"> *</span>
<a name="l00051"></a>00051 <span class="comment"> * @brief Structure representing a thread.</span>
<a name="l00052"></a>00052 <span class="comment"> * @note Not all the listed fields are always needed, by switching off some</span>
<a name="l00053"></a>00053 <span class="comment"> * not needed ChibiOS/RT subsystems it is possible to save RAM space</span>
<a name="l00054"></a>00054 <span class="comment"> * by shrinking the @p Thread structure.</span>
<a name="l00055"></a>00055 <span class="comment"> */</span>
<a name="l00056"></a><a class="code" href="struct_thread.html">00056</a> <span class="keyword">struct </span><a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> {
<a name="l00057"></a><a class="code" href="struct_thread.html#a49d3270919a6e423a47de20bc57beaa1">00057</a> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="struct_thread.html#a49d3270919a6e423a47de20bc57beaa1" title="Next in the list/queue.">p_next</a>; <span class="comment">/**&lt; @brief Next in the list/queue. */</span>
<a name="l00058"></a>00058 <span class="comment">/* End of the fields shared with the ThreadsList structure. */</span>
<a name="l00059"></a><a class="code" href="struct_thread.html#a7661cf39bbb29453ce0c48a94708fb69">00059</a> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="struct_thread.html#a7661cf39bbb29453ce0c48a94708fb69" title="Previous in the queue.">p_prev</a>; <span class="comment">/**&lt; @brief Previous in the queue. */</span>
<a name="l00060"></a>00060 <span class="comment">/* End of the fields shared with the ThreadsQueue structure. */</span>
<a name="l00061"></a><a class="code" href="struct_thread.html#ae60cc22956f4c19965cb94045333aa9c">00061</a> <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> <a class="code" href="struct_thread.html#ae60cc22956f4c19965cb94045333aa9c" title="Thread priority.">p_prio</a>; <span class="comment">/**&lt; @brief Thread priority. */</span>
<a name="l00062"></a><a class="code" href="struct_thread.html#afd8825ffa1551fff7a1fe636d437408c">00062</a> <span class="keyword">struct </span><a class="code" href="structcontext.html" title="Platform dependent part of the Thread structure.">context</a> <a class="code" href="struct_thread.html#afd8825ffa1551fff7a1fe636d437408c" title="Processor context.">p_ctx</a>; <span class="comment">/**&lt; @brief Processor context. */</span>
<a name="l00063"></a>00063 <span class="preprocessor">#if CH_USE_REGISTRY</span>
<a name="l00064"></a><a class="code" href="struct_thread.html#a735bed4a4185b8fd502c01d7ad491710">00064</a> <span class="preprocessor"></span> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="struct_thread.html#a735bed4a4185b8fd502c01d7ad491710" title="Newer registry element.">p_newer</a>; <span class="comment">/**&lt; @brief Newer registry element. */</span>
<a name="l00065"></a><a class="code" href="struct_thread.html#ac1e1ab5bfeca96e03971460a9c76ef5c">00065</a> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="struct_thread.html#ac1e1ab5bfeca96e03971460a9c76ef5c" title="Older registry element.">p_older</a>; <span class="comment">/**&lt; @brief Older registry element. */</span>
<a name="l00066"></a>00066 <span class="preprocessor">#endif</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span> <span class="comment">/* End of the fields shared with the ReadyList structure. */</span><span class="comment"></span>
<a name="l00068"></a>00068 <span class="comment"> /**</span>
<a name="l00069"></a>00069 <span class="comment"> * @brief Current thread state.</span>
<a name="l00070"></a>00070 <span class="comment"> */</span>
<a name="l00071"></a><a class="code" href="struct_thread.html#a3c3e9d6abccb62c3a5fab6ef043a391f">00071</a> <a class="code" href="group__types.html#ga52d7ed152360a74632afa37bbeeca7ca" title="Thread state, uint8_t is ok.">tstate_t</a> <a class="code" href="struct_thread.html#a3c3e9d6abccb62c3a5fab6ef043a391f" title="Current thread state.">p_state</a>;<span class="comment"></span>
<a name="l00072"></a>00072 <span class="comment"> /**</span>
<a name="l00073"></a>00073 <span class="comment"> * @brief Various thread flags.</span>
<a name="l00074"></a>00074 <span class="comment"> */</span>
<a name="l00075"></a><a class="code" href="struct_thread.html#a1e044ddc7521288d6fb473756a214d23">00075</a> <a class="code" href="group__types.html#ga6a5d8a9ab4f4a012d6763548c3b21ec7" title="Thread mode flags, uint8_t is ok.">tmode_t</a> <a class="code" href="struct_thread.html#a1e044ddc7521288d6fb473756a214d23" title="Various thread flags.">p_flags</a>;
<a name="l00076"></a>00076 <span class="preprocessor">#if CH_USE_DYNAMIC</span>
<a name="l00077"></a>00077 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00078"></a>00078 <span class="comment"> * @brief References to this thread.</span>
<a name="l00079"></a>00079 <span class="comment"> */</span>
<a name="l00080"></a><a class="code" href="struct_thread.html#af86d1da435197d113bc42fe8139a21c5">00080</a> <a class="code" href="group__types.html#ga205898ea166481281fec650f2a7e85a3" title="Thread references counter, uint8_t is ok.">trefs_t</a> <a class="code" href="struct_thread.html#af86d1da435197d113bc42fe8139a21c5" title="References to this thread.">p_refs</a>;
<a name="l00081"></a>00081 <span class="preprocessor">#endif</span>
<a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_NESTED_LOCKS</span>
<a name="l00083"></a>00083 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00084"></a>00084 <span class="comment"> * @brief Number of nested locks.</span>
<a name="l00085"></a>00085 <span class="comment"> */</span>
<a name="l00086"></a>00086 <a class="code" href="group__types.html#ga090b3bab5602157ebf706a44041dc05e" title="Counter, recommended fastest signed.">cnt_t</a> p_locks;
<a name="l00087"></a>00087 <span class="preprocessor">#endif</span>
<a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#if CH_DBG_THREADS_PROFILING</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00090"></a>00090 <span class="comment"> * @brief Thread consumed time in ticks.</span>
<a name="l00091"></a>00091 <span class="comment"> * @note This field can overflow.</span>
<a name="l00092"></a>00092 <span class="comment"> */</span>
<a name="l00093"></a><a class="code" href="struct_thread.html#a723aab9bf515e789c3d9ea81f9dbd6a0">00093</a> <span class="keyword">volatile</span> <a class="code" href="group__types.html#gae3e32a98d431a02106616da3071832dd" title="System Time, recommended fastest unsigned.">systime_t</a> <a class="code" href="struct_thread.html#a723aab9bf515e789c3d9ea81f9dbd6a0" title="Thread consumed time in ticks.">p_time</a>;
<a name="l00094"></a>00094 <span class="preprocessor">#endif</span>
<a name="l00095"></a>00095 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00096"></a>00096 <span class="comment"> * @brief State-specific fields.</span>
<a name="l00097"></a>00097 <span class="comment"> * @note All the fields declared in this union are only valid in the</span>
<a name="l00098"></a>00098 <span class="comment"> * specified state or condition and are thus volatile.</span>
<a name="l00099"></a>00099 <span class="comment"> */</span>
<a name="l00100"></a>00100 <span class="keyword">union </span>{<span class="comment"></span>
<a name="l00101"></a>00101 <span class="comment"> /**</span>
<a name="l00102"></a>00102 <span class="comment"> * @brief Thread wakeup code.</span>
<a name="l00103"></a>00103 <span class="comment"> * @note This field contains the low level message sent to the thread</span>
<a name="l00104"></a>00104 <span class="comment"> * by the waking thread or interrupt handler. The value is valid</span>
<a name="l00105"></a>00105 <span class="comment"> * after exiting the @p chSchWakeupS() function.</span>
<a name="l00106"></a>00106 <span class="comment"> */</span>
<a name="l00107"></a><a class="code" href="struct_thread.html#ad5792c30fbd60df0de223b0f398fc6d7">00107</a> <a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> <a class="code" href="struct_thread.html#ad5792c30fbd60df0de223b0f398fc6d7" title="Thread wakeup code.">rdymsg</a>;<span class="comment"></span>
<a name="l00108"></a>00108 <span class="comment"> /**</span>
<a name="l00109"></a>00109 <span class="comment"> * @brief Thread exit code.</span>
<a name="l00110"></a>00110 <span class="comment"> * @note The thread termination code is stored in this field in order</span>
<a name="l00111"></a>00111 <span class="comment"> * to be retrieved by the thread performing a @p chThdWait() on</span>
<a name="l00112"></a>00112 <span class="comment"> * this thread.</span>
<a name="l00113"></a>00113 <span class="comment"> */</span>
<a name="l00114"></a><a class="code" href="struct_thread.html#addbf4614b204bdc2a3480c434cf7baaf">00114</a> <a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> <a class="code" href="struct_thread.html#addbf4614b204bdc2a3480c434cf7baaf" title="Thread exit code.">exitcode</a>;<span class="comment"></span>
<a name="l00115"></a>00115 <span class="comment"> /**</span>
<a name="l00116"></a>00116 <span class="comment"> * @brief Pointer to a generic &quot;wait&quot; object.</span>
<a name="l00117"></a>00117 <span class="comment"> * @note This field is used to get a generic pointer to a synchronization</span>
<a name="l00118"></a>00118 <span class="comment"> * object and is valid when the thread is in one of the wait</span>
<a name="l00119"></a>00119 <span class="comment"> * states.</span>
<a name="l00120"></a>00120 <span class="comment"> */</span>
<a name="l00121"></a><a class="code" href="struct_thread.html#a4f016b01444741e6f9b420436b748862">00121</a> <span class="keywordtype">void</span> *<a class="code" href="struct_thread.html#a4f016b01444741e6f9b420436b748862" title="Pointer to a generic &amp;quot;wait&amp;quot; object.">wtobjp</a>;
<a name="l00122"></a>00122 <span class="preprocessor">#if CH_USE_EVENTS</span>
<a name="l00123"></a>00123 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00124"></a>00124 <span class="comment"> * @brief Enabled events mask.</span>
<a name="l00125"></a>00125 <span class="comment"> * @note This field is only valied while the thread is in the</span>
<a name="l00126"></a>00126 <span class="comment"> * @p THD_STATE_WTOREVT or @p THD_STATE_WTANDEVT states.</span>
<a name="l00127"></a>00127 <span class="comment"> */</span>
<a name="l00128"></a><a class="code" href="struct_thread.html#adb02f57eaf969c9e55f19a250e364f5a">00128</a> <a class="code" href="group__types.html#gabff0c32475baf20ea8c5c710d6e8b708" title="Event Mask, recommended fastest unsigned.">eventmask_t</a> <a class="code" href="struct_thread.html#adb02f57eaf969c9e55f19a250e364f5a" title="Enabled events mask.">ewmask</a>;
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span> } <a class="code" href="struct_thread.html#a72cd0424b6098ca241fac1f74d21b56a" title="State-specific fields.">p_u</a>;
<a name="l00131"></a>00131 <span class="preprocessor">#if CH_USE_WAITEXIT</span>
<a name="l00132"></a>00132 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00133"></a>00133 <span class="comment"> * @brief Termination waiting list.</span>
<a name="l00134"></a>00134 <span class="comment"> */</span>
<a name="l00135"></a><a class="code" href="struct_thread.html#ad1088bc1f9970cc102dc28000134e9ab">00135</a> <a class="code" href="struct_threads_list.html" title="Generic threads single link list, it works like a stack.">ThreadsList</a> <a class="code" href="struct_thread.html#ad1088bc1f9970cc102dc28000134e9ab" title="Termination waiting list.">p_waiting</a>;
<a name="l00136"></a>00136 <span class="preprocessor">#endif</span>
<a name="l00137"></a>00137 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_MESSAGES</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00139"></a>00139 <span class="comment"> * @brief Messages queue.</span>
<a name="l00140"></a>00140 <span class="comment"> */</span>
<a name="l00141"></a><a class="code" href="struct_thread.html#a282cb59bdbe00fcdf9741c47b735fa1f">00141</a> <a class="code" href="struct_threads_queue.html" title="Generic threads bidirectional linked list header and element.">ThreadsQueue</a> <a class="code" href="struct_thread.html#a282cb59bdbe00fcdf9741c47b735fa1f" title="Messages queue.">p_msgqueue</a>;<span class="comment"></span>
<a name="l00142"></a>00142 <span class="comment"> /**</span>
<a name="l00143"></a>00143 <span class="comment"> * @brief Thread message.</span>
<a name="l00144"></a>00144 <span class="comment"> */</span>
<a name="l00145"></a><a class="code" href="struct_thread.html#a8651bb33a6947efd9061c035ca0b728f">00145</a> <a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> <a class="code" href="struct_thread.html#a8651bb33a6947efd9061c035ca0b728f" title="Thread message.">p_msg</a>;
<a name="l00146"></a>00146 <span class="preprocessor">#endif</span>
<a name="l00147"></a>00147 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_EVENTS</span>
<a name="l00148"></a>00148 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00149"></a>00149 <span class="comment"> * @brief Pending events mask.</span>
<a name="l00150"></a>00150 <span class="comment"> */</span>
<a name="l00151"></a><a class="code" href="struct_thread.html#aa571d2963bd8100fa210715dc5669522">00151</a> <a class="code" href="group__types.html#gabff0c32475baf20ea8c5c710d6e8b708" title="Event Mask, recommended fastest unsigned.">eventmask_t</a> <a class="code" href="struct_thread.html#aa571d2963bd8100fa210715dc5669522" title="Pending events mask.">p_epending</a>;
<a name="l00152"></a>00152 <span class="preprocessor">#endif</span>
<a name="l00153"></a>00153 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_MUTEXES</span>
<a name="l00154"></a>00154 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00155"></a>00155 <span class="comment"> * @brief List of the mutexes owned by this thread.</span>
<a name="l00156"></a>00156 <span class="comment"> * @note The list is terminated by a @p NULL in this field.</span>
<a name="l00157"></a>00157 <span class="comment"> */</span>
<a name="l00158"></a><a class="code" href="struct_thread.html#a3ae80b4b3de4c7a23c542ca251e1f017">00158</a> <a class="code" href="struct_mutex.html" title="Mutex structure.">Mutex</a> *<a class="code" href="struct_thread.html#a3ae80b4b3de4c7a23c542ca251e1f017" title="List of the mutexes owned by this thread.">p_mtxlist</a>;<span class="comment"></span>
<a name="l00159"></a>00159 <span class="comment"> /**</span>
<a name="l00160"></a>00160 <span class="comment"> * @brief Thread&#39;s own, non-inherited, priority.</span>
<a name="l00161"></a>00161 <span class="comment"> */</span>
<a name="l00162"></a><a class="code" href="struct_thread.html#a38de11dd7f8cdcfbc45b2c467f400fe8">00162</a> <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> <a class="code" href="struct_thread.html#a38de11dd7f8cdcfbc45b2c467f400fe8" title="Thread&amp;#39;s own, non-inherited, priority.">p_realprio</a>;
<a name="l00163"></a>00163 <span class="preprocessor">#endif</span>
<a name="l00164"></a>00164 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_DYNAMIC &amp;&amp; CH_USE_MEMPOOLS</span>
<a name="l00165"></a>00165 <span class="preprocessor"></span><span class="comment"> /**</span>
<a name="l00166"></a>00166 <span class="comment"> * @brief Memory Pool where the thread workspace is returned.</span>
<a name="l00167"></a>00167 <span class="comment"> */</span>
<a name="l00168"></a><a class="code" href="struct_thread.html#ae0e65912a0c02df5477a3a524cd41d97">00168</a> <span class="keywordtype">void</span> *<a class="code" href="struct_thread.html#ae0e65912a0c02df5477a3a524cd41d97" title="Memory Pool where the thread workspace is returned.">p_mpool</a>;
<a name="l00169"></a>00169 <span class="preprocessor">#endif</span>
<a name="l00170"></a>00170 <span class="preprocessor"></span> <span class="comment">/* Extra fields defined in chconf.h.*/</span>
<a name="l00171"></a>00171 <a class="code" href="group__config.html#gaba26fd717f33330fa56dcc7919a3f02f" title="Threads descriptor structure hook.">THREAD_EXT_FIELDS</a>
<a name="l00172"></a>00172 };
<a name="l00173"></a>00173 <span class="comment"></span>
<a name="l00174"></a>00174 <span class="comment">/** @brief Thread state: Ready to run, waiting on the ready list.*/</span>
<a name="l00175"></a><a class="code" href="group__threads.html#ga1f7b83c73a5b850a3f33bddbdb024fb3">00175</a> <span class="preprocessor">#define THD_STATE_READY 0</span>
<a name="l00176"></a>00176 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Currently running.*/</span>
<a name="l00177"></a><a class="code" href="group__threads.html#ga247c4d33e862f51e90df9a602175f80b">00177</a> <span class="preprocessor">#define THD_STATE_CURRENT 1</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Thread created in suspended state.*/</span>
<a name="l00179"></a><a class="code" href="group__threads.html#gace00089d9d68ba83bb866396332c15d8">00179</a> <span class="preprocessor">#define THD_STATE_SUSPENDED 2</span>
<a name="l00180"></a>00180 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting on a semaphore.*/</span>
<a name="l00181"></a><a class="code" href="group__threads.html#gad0b81cae859c0a6bc6a0d2036aa8e272">00181</a> <span class="preprocessor">#define THD_STATE_WTSEM 3</span>
<a name="l00182"></a>00182 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting on a mutex.*/</span>
<a name="l00183"></a><a class="code" href="group__threads.html#gac18de5096ff3c841e69672cab0868cdf">00183</a> <span class="preprocessor">#define THD_STATE_WTMTX 4</span>
<a name="l00184"></a>00184 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting in @p chCondWait().*/</span>
<a name="l00185"></a><a class="code" href="group__threads.html#ga286c5b1a6459d654d5794fc17e93c939">00185</a> <span class="preprocessor">#define THD_STATE_WTCOND 5</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting in @p chThdSleep() or @p chThdSleepUntil().*/</span>
<a name="l00187"></a><a class="code" href="group__threads.html#ga1b56c4f78480669018aea61711430048">00187</a> <span class="preprocessor">#define THD_STATE_SLEEPING 6</span>
<a name="l00188"></a>00188 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting in @p chThdWait().*/</span>
<a name="l00189"></a><a class="code" href="group__threads.html#gaf726245829b74db3a77a5f4bcc17bf67">00189</a> <span class="preprocessor">#define THD_STATE_WTEXIT 7</span>
<a name="l00190"></a>00190 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting in @p chEvtWaitXXX().*/</span>
<a name="l00191"></a><a class="code" href="group__threads.html#gacd5f28475be26c300aa3444b9bad8feb">00191</a> <span class="preprocessor">#define THD_STATE_WTOREVT 8</span>
<a name="l00192"></a>00192 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting in @p chEvtWaitAllTimeout().*/</span>
<a name="l00193"></a><a class="code" href="group__threads.html#ga1227eb701b7ecaa8e8cd03edeeb79a92">00193</a> <span class="preprocessor">#define THD_STATE_WTANDEVT 9</span>
<a name="l00194"></a>00194 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting in @p chMsgSend().*/</span>
<a name="l00195"></a><a class="code" href="group__threads.html#gaff813590802bfd53cbf0560b680b89f5">00195</a> <span class="preprocessor">#define THD_STATE_SNDMSG 10</span>
<a name="l00196"></a>00196 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: Waiting in @p chMsgWait().*/</span>
<a name="l00197"></a><a class="code" href="group__threads.html#gaf46c55b4468f0dad5cd0b3ef73e1be26">00197</a> <span class="preprocessor">#define THD_STATE_WTMSG 11</span>
<a name="l00198"></a>00198 <span class="preprocessor"></span><span class="comment">/** @brief Thread state: After termination.*/</span>
<a name="l00199"></a><a class="code" href="group__threads.html#ga10583a3a3fb4c62693bb08796f8d13ae">00199</a> <span class="preprocessor">#define THD_STATE_FINAL 12</span>
<a name="l00200"></a>00200 <span class="preprocessor"></span>
<a name="l00201"></a>00201 <span class="comment">/*</span>
<a name="l00202"></a>00202 <span class="comment"> * Various flags into the thread p_flags field.</span>
<a name="l00203"></a>00203 <span class="comment"> */</span>
<a name="l00204"></a><a class="code" href="group__threads.html#ga03fc66bb40f45829816cd4e8353fead2">00204</a> <span class="preprocessor">#define THD_MEM_MODE_MASK 3 </span><span class="comment">/**&lt; @brief Thread memory mode mask. */</span>
<a name="l00205"></a><a class="code" href="group__threads.html#ga222e36a338ac4048b1da998f112771ea">00205</a> <span class="preprocessor">#define THD_MEM_MODE_STATIC 0 </span><span class="comment">/**&lt; @brief Thread memory mode: static. */</span>
<a name="l00206"></a><a class="code" href="group__threads.html#ga706ca53f21d35623480e8e5a239c3fcb">00206</a> <span class="preprocessor">#define THD_MEM_MODE_HEAP 1 </span><span class="comment">/**&lt; @brief Thread memory mode: heap. */</span>
<a name="l00207"></a><a class="code" href="group__threads.html#ga70a7c2fa69d7ca90e6f191c2ebd8cc6f">00207</a> <span class="preprocessor">#define THD_MEM_MODE_MEMPOOL 2 </span><span class="comment">/**&lt; @brief Thread memory mode: pool. */</span>
<a name="l00208"></a><a class="code" href="group__threads.html#ga756a0e7dec9a4d374b6b9e913c5adf81">00208</a> <span class="preprocessor">#define THD_TERMINATE 4 </span><span class="comment">/**&lt; @brief Termination requested. */</span>
<a name="l00209"></a>00209 <span class="comment"></span>
<a name="l00210"></a>00210 <span class="comment">/** @brief Thread function.*/</span>
<a name="l00211"></a><a class="code" href="group__threads.html#gabfe59aa7d2ed1b8e57a2ce17bcbc1189">00211</a> <span class="keyword">typedef</span> <a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> (*<a class="code" href="group__threads.html#gabfe59aa7d2ed1b8e57a2ce17bcbc1189" title="Thread function.">tfunc_t</a>)(<span class="keywordtype">void</span> *);
<a name="l00212"></a>00212
<a name="l00213"></a>00213 <span class="comment">/*</span>
<a name="l00214"></a>00214 <span class="comment"> * Threads APIs.</span>
<a name="l00215"></a>00215 <span class="comment"> */</span>
<a name="l00216"></a>00216 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00217"></a>00217 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00218"></a>00218 <span class="preprocessor">#endif</span>
<a name="l00219"></a>00219 <span class="preprocessor"></span> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="group__threads.html#ga4f6ae58bb3cedfc03aacde6d49e49d35" title="Initializes a thread structure.">init_thread</a>(<a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *tp, <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> prio);
<a name="l00220"></a>00220 <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="group__threads.html#ga79f6f4475974671b7f5d57ce804de8cb" title="Initializes a new thread.">chThdInit</a>(<span class="keywordtype">void</span> *wsp, <span class="keywordtype">size_t</span> size,
<a name="l00221"></a>00221 <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> prio, <a class="code" href="group__threads.html#gabfe59aa7d2ed1b8e57a2ce17bcbc1189" title="Thread function.">tfunc_t</a> pf, <span class="keywordtype">void</span> *arg);
<a name="l00222"></a>00222 <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="group__threads.html#ga048e588238dd336c6059133b3d0c3435" title="Creates a new thread into a static memory area.">chThdCreateStatic</a>(<span class="keywordtype">void</span> *wsp, <span class="keywordtype">size_t</span> size,
<a name="l00223"></a>00223 <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> prio, <a class="code" href="group__threads.html#gabfe59aa7d2ed1b8e57a2ce17bcbc1189" title="Thread function.">tfunc_t</a> pf, <span class="keywordtype">void</span> *arg);
<a name="l00224"></a>00224 <span class="preprocessor">#if CH_USE_DYNAMIC &amp;&amp; CH_USE_WAITEXIT &amp;&amp; CH_USE_HEAP</span>
<a name="l00225"></a>00225 <span class="preprocessor"></span> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="group__threads.html#ga50b84e3e82a4e09c1066e1d422e4c780" title="Creates a new thread allocating the memory from the heap.">chThdCreateFromHeap</a>(<a class="code" href="structmemory__heap.html" title="Structure describing a memory heap.">MemoryHeap</a> *heapp, <span class="keywordtype">size_t</span> size,
<a name="l00226"></a>00226 <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> prio, <a class="code" href="group__threads.html#gabfe59aa7d2ed1b8e57a2ce17bcbc1189" title="Thread function.">tfunc_t</a> pf, <span class="keywordtype">void</span> *arg);
<a name="l00227"></a>00227 <span class="preprocessor">#endif</span>
<a name="l00228"></a>00228 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_DYNAMIC &amp;&amp; CH_USE_WAITEXIT &amp;&amp; CH_USE_MEMPOOLS</span>
<a name="l00229"></a>00229 <span class="preprocessor"></span> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="group__threads.html#gad3ccc1a6f054c543258ed2fe97ed2f58" title="Creates a new thread allocating the memory from the specified Memory Pool.">chThdCreateFromMemoryPool</a>(<a class="code" href="struct_memory_pool.html" title="Memory pool descriptor.">MemoryPool</a> *mp, <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> prio,
<a name="l00230"></a>00230 <a class="code" href="group__threads.html#gabfe59aa7d2ed1b8e57a2ce17bcbc1189" title="Thread function.">tfunc_t</a> pf, <span class="keywordtype">void</span> *arg);
<a name="l00231"></a>00231 <span class="preprocessor">#endif</span>
<a name="l00232"></a>00232 <span class="preprocessor"></span> <a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> <a class="code" href="group__threads.html#ga5a5d9388c64e4c1a3aec129d2831eefe" title="Changes the running thread priority level then reschedules if necessary.">chThdSetPriority</a>(<a class="code" href="group__types.html#ga5f2488ba73e5969cbc0f7033735374ee" title="Priority, use the fastest unsigned type.">tprio_t</a> newprio);
<a name="l00233"></a>00233 <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="group__threads.html#ga2c1ce2be73cd177af7e577b282232a7d" title="Resumes a suspended thread.">chThdResume</a>(<a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *tp);
<a name="l00234"></a>00234 <span class="keywordtype">void</span> <a class="code" href="group__threads.html#ga7ea7371fa41598ebd523622587ce3f22" title="Requests a thread termination.">chThdTerminate</a>(<a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *tp);
<a name="l00235"></a>00235 <span class="keywordtype">void</span> <a class="code" href="group__threads.html#ga8b10a49e2ec522a5ddecabdc453afcab" title="Suspends the invoking thread for the specified time.">chThdSleep</a>(<a class="code" href="group__types.html#gae3e32a98d431a02106616da3071832dd" title="System Time, recommended fastest unsigned.">systime_t</a> time);
<a name="l00236"></a>00236 <span class="keywordtype">void</span> <a class="code" href="group__threads.html#ga9e6e2f8d46d415e8f0862daf0be1d984" title="Suspends the invoking thread until the system time arrives to the specified value...">chThdSleepUntil</a>(<a class="code" href="group__types.html#gae3e32a98d431a02106616da3071832dd" title="System Time, recommended fastest unsigned.">systime_t</a> time);
<a name="l00237"></a>00237 <span class="keywordtype">void</span> <a class="code" href="group__threads.html#gacb0a8f22a8358487eaebab3c84b1c4a1" title="Yields the time slot.">chThdYield</a>(<span class="keywordtype">void</span>);
<a name="l00238"></a>00238 <span class="keywordtype">void</span> <a class="code" href="group__threads.html#ga24ab3a3a4d70214ee360867a1c3c75ac" title="Terminates the current thread by specifying an exit status code.">chThdExit</a>(<a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> msg);
<a name="l00239"></a>00239 <span class="preprocessor">#if CH_USE_DYNAMIC</span>
<a name="l00240"></a>00240 <span class="preprocessor"></span> <a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *<a class="code" href="group__threads.html#gabefc5734beaf29ae0bcd52cd41744930" title="Adds a reference to a thread object.">chThdAddRef</a>(<a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *tp);
<a name="l00241"></a>00241 <span class="keywordtype">void</span> <a class="code" href="group__threads.html#gaa22f80040cf192015be4607f31a0ac80" title="Releases a reference to a thread object.">chThdRelease</a>(<a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *tp);
<a name="l00242"></a>00242 <span class="preprocessor">#endif</span>
<a name="l00243"></a>00243 <span class="preprocessor"></span><span class="preprocessor">#if CH_USE_WAITEXIT</span>
<a name="l00244"></a>00244 <span class="preprocessor"></span> <a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> <a class="code" href="group__threads.html#ga94a5727ecdbe0f738dfc8e1ede1c3409" title="Blocks the execution of the invoking thread until the specified thread terminates...">chThdWait</a>(<a class="code" href="struct_thread.html" title="Structure representing a thread.">Thread</a> *tp);
<a name="l00245"></a>00245 <span class="preprocessor">#endif</span>
<a name="l00246"></a>00246 <span class="preprocessor"></span><span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00247"></a>00247 <span class="preprocessor"></span>}
<a name="l00248"></a>00248 <span class="preprocessor">#endif</span>
<a name="l00249"></a>00249 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00250"></a>00250 <span class="comment">/**</span>
<a name="l00251"></a>00251 <span class="comment"> * @brief Returns a pointer to the current @p Thread.</span>
<a name="l00252"></a>00252 <span class="comment"> */</span>
<a name="l00253"></a><a class="code" href="group__threads.html#gaa36662628234799d205ff8c0cc6745c5">00253</a> <span class="preprocessor">#define chThdSelf() currp</span>
<a name="l00254"></a>00254 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00255"></a>00255 <span class="comment">/**</span>
<a name="l00256"></a>00256 <span class="comment"> * @brief Returns the current thread priority.</span>
<a name="l00257"></a>00257 <span class="comment"> */</span>
<a name="l00258"></a><a class="code" href="group__threads.html#gac71903de6268d886ff58022854b8b6dd">00258</a> <span class="preprocessor">#define chThdGetPriority() (currp-&gt;p_prio)</span>
<a name="l00259"></a>00259 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00260"></a>00260 <span class="comment">/**</span>
<a name="l00261"></a>00261 <span class="comment"> * @brief Returns the pointer to the @p Thread local storage area, if any.</span>
<a name="l00262"></a>00262 <span class="comment"> */</span>
<a name="l00263"></a><a class="code" href="group__threads.html#ga44ea29c71507ec19cf668de199fcbcca">00263</a> <span class="preprocessor">#define chThdLS() (void *)(currp + 1)</span>
<a name="l00264"></a>00264 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00265"></a>00265 <span class="comment">/**</span>
<a name="l00266"></a>00266 <span class="comment"> * @brief Verifies if the specified thread is in the @p THD_STATE_FINAL state.</span>
<a name="l00267"></a>00267 <span class="comment"> *</span>
<a name="l00268"></a>00268 <span class="comment"> * @param[in] tp the pointer to the thread</span>
<a name="l00269"></a>00269 <span class="comment"> * @retval TRUE thread terminated.</span>
<a name="l00270"></a>00270 <span class="comment"> * @retval FALSE thread not terminated.</span>
<a name="l00271"></a>00271 <span class="comment"> */</span>
<a name="l00272"></a><a class="code" href="group__threads.html#ga91fad809cfc40e5e989b5bc893741f30">00272</a> <span class="preprocessor">#define chThdTerminated(tp) ((tp)-&gt;p_state == THD_STATE_FINAL)</span>
<a name="l00273"></a>00273 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00274"></a>00274 <span class="comment">/**</span>
<a name="l00275"></a>00275 <span class="comment"> * @brief Verifies if the current thread has a termination request pending.</span>
<a name="l00276"></a>00276 <span class="comment"> *</span>
<a name="l00277"></a>00277 <span class="comment"> * @retval TRUE termination request pended.</span>
<a name="l00278"></a>00278 <span class="comment"> * @retval FALSE termination request not pended.</span>
<a name="l00279"></a>00279 <span class="comment"> */</span>
<a name="l00280"></a><a class="code" href="group__threads.html#ga5591a9f97ff77b40bd5fc29f16f12a6b">00280</a> <span class="preprocessor">#define chThdShouldTerminate() (currp-&gt;p_flags &amp; THD_TERMINATE)</span>
<a name="l00281"></a>00281 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00282"></a>00282 <span class="comment">/**</span>
<a name="l00283"></a>00283 <span class="comment"> * @brief Resumes a thread created with @p chThdInit().</span>
<a name="l00284"></a>00284 <span class="comment"> *</span>
<a name="l00285"></a>00285 <span class="comment"> * @param[in] tp the pointer to the thread</span>
<a name="l00286"></a>00286 <span class="comment"> */</span>
<a name="l00287"></a><a class="code" href="group__threads.html#gaca27314f95f0b691d5a83a017157fd09">00287</a> <span class="preprocessor">#define chThdResumeI(tp) chSchReadyI(tp)</span>
<a name="l00288"></a>00288 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00289"></a>00289 <span class="comment">/**</span>
<a name="l00290"></a>00290 <span class="comment"> * @brief Suspends the invoking thread for the specified time.</span>
<a name="l00291"></a>00291 <span class="comment"> *</span>
<a name="l00292"></a>00292 <span class="comment"> * @param[in] time the delay in system ticks, the special values are</span>
<a name="l00293"></a>00293 <span class="comment"> * handled as follow:</span>
<a name="l00294"></a>00294 <span class="comment"> * - @a TIME_INFINITE the thread enters an infinite sleep</span>
<a name="l00295"></a>00295 <span class="comment"> * state.</span>
<a name="l00296"></a>00296 <span class="comment"> * - @a TIME_IMMEDIATE this value is accepted but</span>
<a name="l00297"></a>00297 <span class="comment"> * interpreted as a normal time specification not as</span>
<a name="l00298"></a>00298 <span class="comment"> * an immediate timeout specification.</span>
<a name="l00299"></a>00299 <span class="comment"> * .</span>
<a name="l00300"></a>00300 <span class="comment"> */</span>
<a name="l00301"></a><a class="code" href="group__threads.html#ga851dc0c4ac72885bf09feebdef4673ac">00301</a> <span class="preprocessor">#define chThdSleepS(time) chSchGoSleepTimeoutS(THD_STATE_SLEEPING, time)</span>
<a name="l00302"></a>00302 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00303"></a>00303 <span class="comment">/**</span>
<a name="l00304"></a>00304 <span class="comment"> * @brief Delays the invoking thread for the specified number of seconds.</span>
<a name="l00305"></a>00305 <span class="comment"> * @note The specified time is rounded up to a value allowed by the real</span>
<a name="l00306"></a>00306 <span class="comment"> * system clock.</span>
<a name="l00307"></a>00307 <span class="comment"> * @note The maximum specified value is implementation dependent.</span>
<a name="l00308"></a>00308 <span class="comment"> *</span>
<a name="l00309"></a>00309 <span class="comment"> * @param[in] sec the time in seconds</span>
<a name="l00310"></a>00310 <span class="comment"> */</span>
<a name="l00311"></a><a class="code" href="group__threads.html#ga5fc3d014124e558bc59c423a74668c8d">00311</a> <span class="preprocessor">#define chThdSleepSeconds(sec) chThdSleep(S2ST(sec))</span>
<a name="l00312"></a>00312 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00313"></a>00313 <span class="comment">/**</span>
<a name="l00314"></a>00314 <span class="comment"> * @brief Delays the invoking thread for the specified number of</span>
<a name="l00315"></a>00315 <span class="comment"> * milliseconds.</span>
<a name="l00316"></a>00316 <span class="comment"> * @note The specified time is rounded up to a value allowed by the real</span>
<a name="l00317"></a>00317 <span class="comment"> * system clock.</span>
<a name="l00318"></a>00318 <span class="comment"> * @note The maximum specified value is implementation dependent.</span>
<a name="l00319"></a>00319 <span class="comment"> *</span>
<a name="l00320"></a>00320 <span class="comment"> * @param[in] msec the time in milliseconds</span>
<a name="l00321"></a>00321 <span class="comment"> */</span>
<a name="l00322"></a><a class="code" href="group__threads.html#ga5aebc25e053a0094714abce4cad9f56f">00322</a> <span class="preprocessor">#define chThdSleepMilliseconds(msec) chThdSleep(MS2ST(msec))</span>
<a name="l00323"></a>00323 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00324"></a>00324 <span class="comment">/**</span>
<a name="l00325"></a>00325 <span class="comment"> * @brief Delays the invoking thread for the specified number of</span>
<a name="l00326"></a>00326 <span class="comment"> * microseconds.</span>
<a name="l00327"></a>00327 <span class="comment"> * @note The specified time is rounded up to a value allowed by the real</span>
<a name="l00328"></a>00328 <span class="comment"> * system clock.</span>
<a name="l00329"></a>00329 <span class="comment"> * @note The maximum specified value is implementation dependent.</span>
<a name="l00330"></a>00330 <span class="comment"> *</span>
<a name="l00331"></a>00331 <span class="comment"> * @param[in] usec the time in microseconds</span>
<a name="l00332"></a>00332 <span class="comment"> */</span>
<a name="l00333"></a><a class="code" href="group__threads.html#ga596f4015871a919694911bc50ba8bd94">00333</a> <span class="preprocessor">#define chThdSleepMicroseconds(usec) chThdSleep(US2ST(usec))</span>
<a name="l00334"></a>00334 <span class="preprocessor"></span>
<a name="l00335"></a>00335 <span class="preprocessor">#endif </span><span class="comment">/* _CHTHREADS_H_ */</span>
<a name="l00336"></a>00336 <span class="comment"></span>
<a name="l00337"></a>00337 <span class="comment">/** @} */</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>
Generated on Sun Jul 11 13:13:01 2010 for ChibiOS/RT by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.6.3</small></address>
</body>
</html>