gnuk/ChibiOS_2.0.6/docs/html/group__mailboxes.html

847 lines
55 KiB
HTML
Raw Normal View History

2010-08-10 03:11:02 +00:00
<!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: Mailboxes</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">
2010-11-22 05:53:37 +00:00
<!-- Generated by Doxygen 1.7.1 -->
2010-08-10 03:11:02 +00:00
<div class="navigation" id="top">
<div class="tabs">
2010-11-22 05:53:37 +00:00
<ul class="tablist">
2010-08-10 03:11:02 +00:00
<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><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
2010-11-22 05:53:37 +00:00
<div class="header">
<div class="summary">
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
2010-08-10 03:11:02 +00:00
<h1>Mailboxes<br/>
<small>
[<a class="el" href="group__synchronization.html">Synchronization</a>]</small>
2010-11-22 05:53:37 +00:00
</h1> </div>
</div>
<div class="contents">
2010-08-10 03:11:02 +00:00
<p><div class="dynheader">
Collaboration diagram for Mailboxes:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<center><table><tr><td><img src="group__mailboxes.png" border="0" alt="" usemap="#group____mailboxes"/>
<map name="group____mailboxes" id="group____mailboxes">
<area shape="rect" id="node2" href="group__synchronization.html" title="Synchronization" alt="" coords="7,5,105,32"/> </map>
</td></tr></table></center>
2010-08-10 03:11:02 +00:00
</div>
</p>
<hr/><a name="_details"></a><h2>Description</h2>
<p>Asynchronous messages. </p>
<h2>Operation mode</h2>
<p>A mailbox is an asynchronous communication mechanism.<br/>
Operations defined for mailboxes:</p>
<ul>
<li><b>Post</b>: Posts a message on the mailbox in FIFO order.</li>
<li><b>Post Ahead</b>: Posts a message on the mailbox with urgent priority.</li>
<li><b>Fetch</b>: A message is fetched from the mailbox and removed from the queue.</li>
<li><b>Reset</b>: The mailbox is emptied and all the stored messages are lost.</li>
</ul>
<p>A message is a variable of type msg_t that is guaranteed to have the same size of and be compatible with (data) pointers (anyway an explicit cast is needed). If larger messages need to be exchanged then a pointer to a structure can be posted in the mailbox but the posting side has no predefined way to know when the message has been processed. A possible approach is to allocate memory (from a memory pool as example) from the posting side and free it on the fetching side. Another approach is to set a "done" flag into the structure pointed by the message.<br/>
In order to use the mailboxes APIs the <code>CH_USE_MAILBOXES</code> option must be enabled in <code><a class="el" href="chconf_8h.html" title="Configuration file template.">chconf.h</a></code>. </p>
2010-11-22 05:53:37 +00:00
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#gad9707fcb206d677fe9437d1f196d135f">chMBSize</a>(mbp)&nbsp;&nbsp;&nbsp;((mbp)-&gt;mb_top - (mbp)-&gt;mb_buffer)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the mailbox buffer size. <a href="#gad9707fcb206d677fe9437d1f196d135f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#ga883666d096d855c8c372c0241fc47142">chMBGetEmpty</a>(mbp)&nbsp;&nbsp;&nbsp;chSemGetCounterI(&amp;(mbp)-&gt;mb_emptysem)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the free space into the mailbox. <a href="#ga883666d096d855c8c372c0241fc47142"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#gad41c9e058c4a35cceeecbf21038f4c03">chMBGetFull</a>(mbp)&nbsp;&nbsp;&nbsp;chSemGetCounterI(&amp;(mbp)-&gt;mb_fullsem)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of messages into the mailbox. <a href="#gad41c9e058c4a35cceeecbf21038f4c03"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#ga620fdbcfe9e4f631f6ea87bed82aa581">chMBPeek</a>(mbp)&nbsp;&nbsp;&nbsp;(*(mbp)-&gt;mb_rdptr)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the next message in the queue without removing it. <a href="#ga620fdbcfe9e4f631f6ea87bed82aa581"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#ga258b7bab4fa19d63854e7f7f2e3641e6">_MAILBOX_DATA</a>(name, buffer, size)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Data part of a static mailbox initializer. <a href="#ga258b7bab4fa19d63854e7f7f2e3641e6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#gafb06e097629b88a09b1f29146a86bf20">MAILBOX_DECL</a>(name, buffer, size)&nbsp;&nbsp;&nbsp;Mailbox name = _MAILBOX_DATA(name, buffer, size)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Static mailbox initializer. <a href="#gafb06e097629b88a09b1f29146a86bf20"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#gaff65b97bfdbf9144e9727a100a9be93a">chMBInit</a> (Mailbox *mbp, <a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> *buf, <a class="el" href="group__types.html#ga090b3bab5602157ebf706a44041dc05e">cnt_t</a> n)</td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initializes a Mailbox object. <a href="#gaff65b97bfdbf9144e9727a100a9be93a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#ga4199e224456395c3dbc74dbc889dff94">chMBReset</a> (Mailbox *mbp)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resets a Mailbox object. <a href="#ga4199e224456395c3dbc74dbc889dff94"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#ga9bafcc634765886f59cf68c0e35d070d">chMBPost</a> (Mailbox *mbp, <a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> msg, <a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a> time)</td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Posts a message into a mailbox. <a href="#ga9bafcc634765886f59cf68c0e35d070d"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#gac6514c185ae87c2633132478ea48d689">chMBPostS</a> (Mailbox *mbp, <a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> msg, <a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a> time)</td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Posts a message into a mailbox. <a href="#gac6514c185ae87c2633132478ea48d689"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#ga55c5b8890b78127bc1fa5a324252d5e6">chMBPostAhead</a> (Mailbox *mbp, <a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> msg, <a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a> time)</td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Posts an high priority message into a mailbox. <a href="#ga55c5b8890b78127bc1fa5a324252d5e6"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#gaa9c91c0b781bec0df3540407d75b1bb3">chMBPostAheadS</a> (Mailbox *mbp, <a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> msg, <a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a> time)</td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Posts an high priority message into a mailbox. <a href="#gaa9c91c0b781bec0df3540407d75b1bb3"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#ga61543bf11d0caa737f5818c67548c055">chMBFetch</a> (Mailbox *mbp, <a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> *msgp, <a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a> time)</td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves a message from a mailbox. <a href="#ga61543bf11d0caa737f5818c67548c055"></a><br/></td></tr>
2010-11-22 05:53:37 +00:00
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mailboxes.html#gadc562242a8854497a1f9539cb9ffea09">chMBFetchS</a> (Mailbox *mbp, <a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> *msgp, <a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a> time)</td></tr>
2010-08-10 03:11:02 +00:00
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves a message from a mailbox. <a href="#gadc562242a8854497a1f9539cb9ffea09"></a><br/></td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="gad9707fcb206d677fe9437d1f196d135f"></a><!-- doxytag: member="chmboxes.h::chMBSize" ref="gad9707fcb206d677fe9437d1f196d135f" args="(mbp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define chMBSize</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">mbp</td>
2010-08-10 03:11:02 +00:00
<td>&nbsp;)&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;((mbp)-&gt;mb_top - (mbp)-&gt;mb_buffer)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the mailbox buffer size. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8h_source.html#l00080">80</a> of file <a class="el" href="chmboxes_8h_source.html">chmboxes.h</a>.</p>
</div>
</div>
<a class="anchor" id="ga883666d096d855c8c372c0241fc47142"></a><!-- doxytag: member="chmboxes.h::chMBGetEmpty" ref="ga883666d096d855c8c372c0241fc47142" args="(mbp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define chMBGetEmpty</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">mbp</td>
2010-08-10 03:11:02 +00:00
<td>&nbsp;)&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;chSemGetCounterI(&amp;(mbp)-&gt;mb_emptysem)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the free space into the mailbox. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>Can be invoked in any system state but if invoked out of a locked state then the returned value may change after reading. </dd>
<dd>
The returned value can be less than zero when there are waiting threads on the internal semaphore.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of empty message slots. </dd></dl>
<p>Definition at line <a class="el" href="chmboxes_8h_source.html#l00093">93</a> of file <a class="el" href="chmboxes_8h_source.html">chmboxes.h</a>.</p>
</div>
</div>
<a class="anchor" id="gad41c9e058c4a35cceeecbf21038f4c03"></a><!-- doxytag: member="chmboxes.h::chMBGetFull" ref="gad41c9e058c4a35cceeecbf21038f4c03" args="(mbp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define chMBGetFull</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">mbp</td>
2010-08-10 03:11:02 +00:00
<td>&nbsp;)&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;chSemGetCounterI(&amp;(mbp)-&gt;mb_fullsem)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the number of messages into the mailbox. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>Can be invoked in any system state but if invoked out of a locked state then the returned value may change after reading. </dd>
<dd>
The returned value can be less than zero when there are waiting threads on the internal semaphore.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of queued messages. </dd></dl>
<p>Definition at line <a class="el" href="chmboxes_8h_source.html#l00105">105</a> of file <a class="el" href="chmboxes_8h_source.html">chmboxes.h</a>.</p>
</div>
</div>
<a class="anchor" id="ga620fdbcfe9e4f631f6ea87bed82aa581"></a><!-- doxytag: member="chmboxes.h::chMBPeek" ref="ga620fdbcfe9e4f631f6ea87bed82aa581" args="(mbp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define chMBPeek</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">mbp</td>
2010-08-10 03:11:02 +00:00
<td>&nbsp;)&nbsp;</td>
<td>&nbsp;&nbsp;&nbsp;(*(mbp)-&gt;mb_rdptr)</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the next message in the queue without removing it. </p>
<dl class="note"><dt><b>Note:</b></dt><dd>A message must be waiting in the queue for this function to work or it would return garbage. The correct way to use this macro is to use <code><a class="el" href="group__mailboxes.html#gad41c9e058c4a35cceeecbf21038f4c03" title="Returns the number of messages into the mailbox.">chMBGetFull()</a></code> and then use this macro, all within a lock state. </dd></dl>
<p>Definition at line <a class="el" href="chmboxes_8h_source.html#l00114">114</a> of file <a class="el" href="chmboxes_8h_source.html">chmboxes.h</a>.</p>
</div>
</div>
<a class="anchor" id="ga258b7bab4fa19d63854e7f7f2e3641e6"></a><!-- doxytag: member="chmboxes.h::_MAILBOX_DATA" ref="ga258b7bab4fa19d63854e7f7f2e3641e6" args="(name, buffer, size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define _MAILBOX_DATA</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">name, </td>
2010-08-10 03:11:02 +00:00
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">buffer, </td>
2010-08-10 03:11:02 +00:00
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">size</td><td>&nbsp;</td>
</tr>
<tr>
2010-08-10 03:11:02 +00:00
<td></td>
2010-11-22 05:53:37 +00:00
<td>)</td>
<td></td><td></td><td></td>
2010-08-10 03:11:02 +00:00
</tr>
</table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment">{ \
(<a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> *)(buffer), \
(<a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> *)(buffer) + size, \
(<a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> *)(buffer), \
(<a class="code" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3" title="Message, use signed pointer equivalent.">msg_t</a> *)(buffer), \
<a class="code" href="group__semaphores.html#ga1100c867cc8bd8328f7a7db5e7c74f6d" title="Data part of a static semaphore initializer.">_SEMAPHORE_DATA</a>(name.mb_fullsem, 0), \
<a class="code" href="group__semaphores.html#ga1100c867cc8bd8328f7a7db5e7c74f6d" title="Data part of a static semaphore initializer.">_SEMAPHORE_DATA</a>(name.mb_emptysem, size), \
}
</pre></div>
<p>Data part of a static mailbox initializer. </p>
<p>This macro should be used when statically initializing a mailbox that is part of a bigger structure.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>name</em>&nbsp;</td><td>the name of the mailbox variable </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>buffer</em>&nbsp;</td><td>pointer to the mailbox buffer area </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>size</em>&nbsp;</td><td>size of the mailbox buffer area </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8h_source.html#l00125">125</a> of file <a class="el" href="chmboxes_8h_source.html">chmboxes.h</a>.</p>
</div>
</div>
<a class="anchor" id="gafb06e097629b88a09b1f29146a86bf20"></a><!-- doxytag: member="chmboxes.h::MAILBOX_DECL" ref="gafb06e097629b88a09b1f29146a86bf20" args="(name, buffer, size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define MAILBOX_DECL</td>
<td>(</td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">name, </td>
2010-08-10 03:11:02 +00:00
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">buffer, </td>
2010-08-10 03:11:02 +00:00
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype">&nbsp;</td>
<td class="paramname">size</td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td>&nbsp;&nbsp;&nbsp;Mailbox name = _MAILBOX_DATA(name, buffer, size)</td>
2010-08-10 03:11:02 +00:00
</tr>
</table>
</div>
<div class="memdoc">
<p>Static mailbox initializer. </p>
<p>Statically initialized mailboxes require no explicit initialization using <code><a class="el" href="group__mailboxes.html#gaff65b97bfdbf9144e9727a100a9be93a" title="Initializes a Mailbox object.">chMBInit()</a></code>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>name</em>&nbsp;</td><td>the name of the mailbox variable </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>buffer</em>&nbsp;</td><td>pointer to the mailbox buffer area </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>size</em>&nbsp;</td><td>size of the mailbox buffer area </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8h_source.html#l00143">143</a> of file <a class="el" href="chmboxes_8h_source.html">chmboxes.h</a>.</p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gaff65b97bfdbf9144e9727a100a9be93a"></a><!-- doxytag: member="chmboxes.h::chMBInit" ref="gaff65b97bfdbf9144e9727a100a9be93a" args="(Mailbox *mbp, msg_t *buf, cnt_t n)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void chMBInit </td>
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> *&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga090b3bab5602157ebf706a44041dc05e">cnt_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>n</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initializes a Mailbox object. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to the Mailbox structure to be initialized </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>buf</em>&nbsp;</td><td>the circular messages buffer </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>n</em>&nbsp;</td><td>the buffer size as number of <code>msg_t</code> </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00069">69</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, and <a class="el" href="group__semaphores.html#gafe8fc6155a871074e8017efd908b2c58">chSemInit()</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_gaff65b97bfdbf9144e9727a100a9be93a_cgraph.png" border="0" usemap="#group__mailboxes_gaff65b97bfdbf9144e9727a100a9be93a_cgraph" alt=""/></div>
<map name="group__mailboxes_gaff65b97bfdbf9144e9727a100a9be93a_cgraph" id="group__mailboxes_gaff65b97bfdbf9144e9727a100a9be93a_cgraph">
<area shape="rect" id="node3" href="group__semaphores.html#gafe8fc6155a871074e8017efd908b2c58" title="Initializes a semaphore with the specified counter value." alt="" coords="119,5,185,32"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
<a class="anchor" id="ga4199e224456395c3dbc74dbc889dff94"></a><!-- doxytag: member="chmboxes.h::chMBReset" ref="ga4199e224456395c3dbc74dbc889dff94" args="(Mailbox *mbp)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void chMBReset </td>
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Resets a Mailbox object. </p>
<p>All the waiting threads are resumed with status <code>RDY_RESET</code> and the queued messages are lost.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00086">86</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, <a class="el" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20">chSchRescheduleS()</a>, <a class="el" href="group__semaphores.html#gae7972b6b22b80ac09bac5a186277ab81">chSemResetI()</a>, <a class="el" href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, and <a class="el" href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_ga4199e224456395c3dbc74dbc889dff94_cgraph.png" border="0" usemap="#group__mailboxes_ga4199e224456395c3dbc74dbc889dff94_cgraph" alt=""/></div>
<map name="group__mailboxes_ga4199e224456395c3dbc74dbc889dff94_cgraph" id="group__mailboxes_ga4199e224456395c3dbc74dbc889dff94_cgraph">
<area shape="rect" id="node3" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20" title="Performs a reschedule if a higher priority thread is runnable." alt="" coords="131,5,248,32"/> <area shape="rect" id="node9" href="group__semaphores.html#gae7972b6b22b80ac09bac5a186277ab81" title="Performs a reset operation on the semaphore." alt="" coords="147,56,232,83"/> <area shape="rect" id="node5" href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e" title="Switches to the first thread on the runnable queue." alt="" coords="296,5,421,32"/> <area shape="rect" id="node7" href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298" title="Inserts a thread in the Ready List." alt="" coords="471,31,556,57"/> <area shape="rect" id="node12" href="group__internals.html#gacacfe77140cab62948e63d898bf4dfba" title="Removes the last&#45;out Thread from a queue and returns it." alt="" coords="320,107,397,133"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
<a class="anchor" id="ga9bafcc634765886f59cf68c0e35d070d"></a><!-- doxytag: member="chmboxes.h::chMBPost" ref="ga9bafcc634765886f59cf68c0e35d070d" args="(Mailbox *mbp, msg_t msg, systime_t time)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2010-11-22 05:53:37 +00:00
<td class="memname"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> chMBPost </td>
2010-08-10 03:11:02 +00:00
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>msg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>time</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Posts a message into a mailbox. </p>
<p>The invoking thread waits until a empty slot in the mailbox becomes available or the specified time runs out.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>msg</em>&nbsp;</td><td>the message to be posted on the mailbox </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>time</em>&nbsp;</td><td>the number of ticks before the operation timeouts, the following special values are allowed:</p>
<ul>
<li><em>TIME_IMMEDIATE</em> immediate timeout.</li>
<li><em>TIME_INFINITE</em> no timeout.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The operation status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>RDY_OK</em>&nbsp;</td><td>if the message was correctly posted. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_RESET</em>&nbsp;</td><td>if the mailbox was reset while waiting. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_TIMEOUT</em>&nbsp;</td><td>if the operation timed out. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00115">115</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__mailboxes.html#gac6514c185ae87c2633132478ea48d689">chMBPostS()</a>, <a class="el" href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, and <a class="el" href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_ga9bafcc634765886f59cf68c0e35d070d_cgraph.png" border="0" usemap="#group__mailboxes_ga9bafcc634765886f59cf68c0e35d070d_cgraph" alt=""/></div>
<map name="group__mailboxes_ga9bafcc634765886f59cf68c0e35d070d_cgraph" id="group__mailboxes_ga9bafcc634765886f59cf68c0e35d070d_cgraph">
<area shape="rect" id="node3" href="group__mailboxes.html#gac6514c185ae87c2633132478ea48d689" title="Posts a message into a mailbox." alt="" coords="125,56,203,83"/> <area shape="rect" id="node5" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20" title="Performs a reschedule if a higher priority thread is runnable." alt="" coords="252,5,369,32"/> <area shape="rect" id="node7" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d" title="Performs a signal operation on a semaphore." alt="" coords="268,56,353,83"/> <area shape="rect" id="node9" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03" title="Performs a wait operation on a semaphore with timeout specification." alt="" coords="251,107,371,133"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
<a class="anchor" id="gac6514c185ae87c2633132478ea48d689"></a><!-- doxytag: member="chmboxes.h::chMBPostS" ref="gac6514c185ae87c2633132478ea48d689" args="(Mailbox *mbp, msg_t msg, systime_t time)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2010-11-22 05:53:37 +00:00
<td class="memname"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> chMBPostS </td>
2010-08-10 03:11:02 +00:00
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>msg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>time</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Posts a message into a mailbox. </p>
<p>The invoking thread waits until a empty slot in the mailbox becomes available or the specified time runs out.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>msg</em>&nbsp;</td><td>the message to be posted on the mailbox </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>time</em>&nbsp;</td><td>the number of ticks before the operation timeouts, the following special values are allowed:</p>
<ul>
<li><em>TIME_IMMEDIATE</em> immediate timeout.</li>
<li><em>TIME_INFINITE</em> no timeout.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The operation status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>RDY_OK</em>&nbsp;</td><td>if the message was correctly posted. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_RESET</em>&nbsp;</td><td>if the mailbox was reset while waiting. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_TIMEOUT</em>&nbsp;</td><td>if the operation timed out. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00141">141</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, <a class="el" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20">chSchRescheduleS()</a>, <a class="el" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d">chSemSignalI()</a>, <a class="el" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03">chSemWaitTimeoutS()</a>, and <a class="el" href="group__scheduler.html#gae1c86078318e11c2fa57ee3c2ec69f61">RDY_OK</a>.</p>
<p>Referenced by <a class="el" href="group__mailboxes.html#ga9bafcc634765886f59cf68c0e35d070d">chMBPost()</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_gac6514c185ae87c2633132478ea48d689_cgraph.png" border="0" usemap="#group__mailboxes_gac6514c185ae87c2633132478ea48d689_cgraph" alt=""/></div>
<map name="group__mailboxes_gac6514c185ae87c2633132478ea48d689_cgraph" id="group__mailboxes_gac6514c185ae87c2633132478ea48d689_cgraph">
<area shape="rect" id="node3" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20" title="Performs a reschedule if a higher priority thread is runnable." alt="" coords="132,56,249,83"/> <area shape="rect" id="node11" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d" title="Performs a signal operation on a semaphore." alt="" coords="325,5,411,32"/> <area shape="rect" id="node15" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03" title="Performs a wait operation on a semaphore with timeout specification." alt="" coords="131,107,251,133"/> <area shape="rect" id="node5" href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e" title="Switches to the first thread on the runnable queue." alt="" coords="305,56,431,83"/> <area shape="rect" id="node7" href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298" title="Inserts a thread in the Ready List." alt="" coords="487,5,572,32"/> <area shape="rect" id="node9" href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a" title="Removes the first&#45;out Thread from a queue and returns it." alt="" coords="489,56,569,83"/> <area shape="rect" id="node17" href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b" title="Puts the current thread to sleep into the specified state with timeout specification." alt="" coords="299,107,437,133"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
<a class="anchor" id="ga55c5b8890b78127bc1fa5a324252d5e6"></a><!-- doxytag: member="chmboxes.h::chMBPostAhead" ref="ga55c5b8890b78127bc1fa5a324252d5e6" args="(Mailbox *mbp, msg_t msg, systime_t time)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2010-11-22 05:53:37 +00:00
<td class="memname"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> chMBPostAhead </td>
2010-08-10 03:11:02 +00:00
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>msg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>time</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Posts an high priority message into a mailbox. </p>
<p>The invoking thread waits until a empty slot in the mailbox becomes available or the specified time runs out.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>msg</em>&nbsp;</td><td>the message to be posted on the mailbox </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>time</em>&nbsp;</td><td>the number of ticks before the operation timeouts, the following special values are allowed:</p>
<ul>
<li><em>TIME_IMMEDIATE</em> immediate timeout.</li>
<li><em>TIME_INFINITE</em> no timeout.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The operation status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>RDY_OK</em>&nbsp;</td><td>if the message was correctly posted. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_RESET</em>&nbsp;</td><td>if the mailbox was reset while waiting. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_TIMEOUT</em>&nbsp;</td><td>if the operation timed out. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00174">174</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__mailboxes.html#gaa9c91c0b781bec0df3540407d75b1bb3">chMBPostAheadS()</a>, <a class="el" href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, and <a class="el" href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_ga55c5b8890b78127bc1fa5a324252d5e6_cgraph.png" border="0" usemap="#group__mailboxes_ga55c5b8890b78127bc1fa5a324252d5e6_cgraph" alt=""/></div>
<map name="group__mailboxes_ga55c5b8890b78127bc1fa5a324252d5e6_cgraph" id="group__mailboxes_ga55c5b8890b78127bc1fa5a324252d5e6_cgraph">
<area shape="rect" id="node3" href="group__mailboxes.html#gaa9c91c0b781bec0df3540407d75b1bb3" title="Posts an high priority message into a mailbox." alt="" coords="157,56,267,83"/> <area shape="rect" id="node5" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20" title="Performs a reschedule if a higher priority thread is runnable." alt="" coords="316,5,433,32"/> <area shape="rect" id="node7" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d" title="Performs a signal operation on a semaphore." alt="" coords="332,56,417,83"/> <area shape="rect" id="node9" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03" title="Performs a wait operation on a semaphore with timeout specification." alt="" coords="315,107,435,133"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
<a class="anchor" id="gaa9c91c0b781bec0df3540407d75b1bb3"></a><!-- doxytag: member="chmboxes.h::chMBPostAheadS" ref="gaa9c91c0b781bec0df3540407d75b1bb3" args="(Mailbox *mbp, msg_t msg, systime_t time)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2010-11-22 05:53:37 +00:00
<td class="memname"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> chMBPostAheadS </td>
2010-08-10 03:11:02 +00:00
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>msg</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>time</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Posts an high priority message into a mailbox. </p>
<p>The invoking thread waits until a empty slot in the mailbox becomes available or the specified time runs out.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>msg</em>&nbsp;</td><td>the message to be posted on the mailbox </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>time</em>&nbsp;</td><td>the number of ticks before the operation timeouts, the following special values are allowed:</p>
<ul>
<li><em>TIME_IMMEDIATE</em> immediate timeout.</li>
<li><em>TIME_INFINITE</em> no timeout.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The operation status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>RDY_OK</em>&nbsp;</td><td>if the message was correctly posted. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_RESET</em>&nbsp;</td><td>if the mailbox was reset while waiting. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_TIMEOUT</em>&nbsp;</td><td>if the operation timed out. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00200">200</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, <a class="el" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20">chSchRescheduleS()</a>, <a class="el" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d">chSemSignalI()</a>, <a class="el" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03">chSemWaitTimeoutS()</a>, and <a class="el" href="group__scheduler.html#gae1c86078318e11c2fa57ee3c2ec69f61">RDY_OK</a>.</p>
<p>Referenced by <a class="el" href="group__mailboxes.html#ga55c5b8890b78127bc1fa5a324252d5e6">chMBPostAhead()</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_gaa9c91c0b781bec0df3540407d75b1bb3_cgraph.png" border="0" usemap="#group__mailboxes_gaa9c91c0b781bec0df3540407d75b1bb3_cgraph" alt=""/></div>
<map name="group__mailboxes_gaa9c91c0b781bec0df3540407d75b1bb3_cgraph" id="group__mailboxes_gaa9c91c0b781bec0df3540407d75b1bb3_cgraph">
<area shape="rect" id="node3" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20" title="Performs a reschedule if a higher priority thread is runnable." alt="" coords="164,56,281,83"/> <area shape="rect" id="node11" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d" title="Performs a signal operation on a semaphore." alt="" coords="357,5,443,32"/> <area shape="rect" id="node15" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03" title="Performs a wait operation on a semaphore with timeout specification." alt="" coords="163,107,283,133"/> <area shape="rect" id="node5" href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e" title="Switches to the first thread on the runnable queue." alt="" coords="337,56,463,83"/> <area shape="rect" id="node7" href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298" title="Inserts a thread in the Ready List." alt="" coords="519,5,604,32"/> <area shape="rect" id="node9" href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a" title="Removes the first&#45;out Thread from a queue and returns it." alt="" coords="521,56,601,83"/> <area shape="rect" id="node17" href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b" title="Puts the current thread to sleep into the specified state with timeout specification." alt="" coords="331,107,469,133"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
<a class="anchor" id="ga61543bf11d0caa737f5818c67548c055"></a><!-- doxytag: member="chmboxes.h::chMBFetch" ref="ga61543bf11d0caa737f5818c67548c055" args="(Mailbox *mbp, msg_t *msgp, systime_t time)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2010-11-22 05:53:37 +00:00
<td class="memname"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> chMBFetch </td>
2010-08-10 03:11:02 +00:00
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> *&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>msgp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>time</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Retrieves a message from a mailbox. </p>
<p>The invoking thread waits until a message is posted in the mailbox or the specified time runs out.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
<tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>msgp</em>&nbsp;</td><td>pointer to a message variable for the received message </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>time</em>&nbsp;</td><td>the number of ticks before the operation timeouts, the following special values are allowed:</p>
<ul>
<li><em>TIME_IMMEDIATE</em> immediate timeout.</li>
<li><em>TIME_INFINITE</em> no timeout.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The operation status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>RDY_OK</em>&nbsp;</td><td>if a message was correctly fetched. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_RESET</em>&nbsp;</td><td>if the mailbox was reset while waiting. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_TIMEOUT</em>&nbsp;</td><td>if the operation timed out. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00233">233</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__mailboxes.html#gadc562242a8854497a1f9539cb9ffea09">chMBFetchS()</a>, <a class="el" href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, and <a class="el" href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_ga61543bf11d0caa737f5818c67548c055_cgraph.png" border="0" usemap="#group__mailboxes_ga61543bf11d0caa737f5818c67548c055_cgraph" alt=""/></div>
<map name="group__mailboxes_ga61543bf11d0caa737f5818c67548c055_cgraph" id="group__mailboxes_ga61543bf11d0caa737f5818c67548c055_cgraph">
<area shape="rect" id="node3" href="group__mailboxes.html#gadc562242a8854497a1f9539cb9ffea09" title="Retrieves a message from a mailbox." alt="" coords="131,56,213,83"/> <area shape="rect" id="node5" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20" title="Performs a reschedule if a higher priority thread is runnable." alt="" coords="263,5,380,32"/> <area shape="rect" id="node7" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d" title="Performs a signal operation on a semaphore." alt="" coords="279,56,364,83"/> <area shape="rect" id="node9" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03" title="Performs a wait operation on a semaphore with timeout specification." alt="" coords="261,107,381,133"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
<a class="anchor" id="gadc562242a8854497a1f9539cb9ffea09"></a><!-- doxytag: member="chmboxes.h::chMBFetchS" ref="gadc562242a8854497a1f9539cb9ffea09" args="(Mailbox *mbp, msg_t *msgp, systime_t time)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
2010-11-22 05:53:37 +00:00
<td class="memname"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> chMBFetchS </td>
2010-08-10 03:11:02 +00:00
<td>(</td>
<td class="paramtype">Mailbox *&nbsp;</td>
<td class="paramname"> <em>mbp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#ga35bcb0c321cd7bc45bf1a11fa17ebdd3">msg_t</a> *&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>msgp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
2010-11-22 05:53:37 +00:00
<td class="paramtype"><a class="el" href="group__types.html#gae3e32a98d431a02106616da3071832dd">systime_t</a>&nbsp;</td>
2010-08-10 03:11:02 +00:00
<td class="paramname"> <em>time</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Retrieves a message from a mailbox. </p>
<p>The invoking thread waits until a message is posted in the mailbox or the specified time runs out.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>mbp</em>&nbsp;</td><td>the pointer to an initialized Mailbox object </td></tr>
<tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>msgp</em>&nbsp;</td><td>pointer to a message variable for the received message </td></tr>
<tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>time</em>&nbsp;</td><td>the number of ticks before the operation timeouts, the following special values are allowed:</p>
<ul>
<li><em>TIME_IMMEDIATE</em> immediate timeout.</li>
<li><em>TIME_INFINITE</em> no timeout.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The operation status. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>RDY_OK</em>&nbsp;</td><td>if a message was correctly fetched. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_RESET</em>&nbsp;</td><td>if the mailbox was reset while waiting. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RDY_TIMEOUT</em>&nbsp;</td><td>if the operation timed out. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="chmboxes_8c_source.html#l00259">259</a> of file <a class="el" href="chmboxes_8c_source.html">chmboxes.c</a>.</p>
<p>References <a class="el" href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, <a class="el" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20">chSchRescheduleS()</a>, <a class="el" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d">chSemSignalI()</a>, <a class="el" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03">chSemWaitTimeoutS()</a>, and <a class="el" href="group__scheduler.html#gae1c86078318e11c2fa57ee3c2ec69f61">RDY_OK</a>.</p>
<p>Referenced by <a class="el" href="group__mailboxes.html#ga61543bf11d0caa737f5818c67548c055">chMBFetch()</a>.</p>
<p><div class="dynheader">
Here is the call graph for this function:</div>
2010-11-22 05:53:37 +00:00
<div class="dyncontent">
<div class="center"><img src="group__mailboxes_gadc562242a8854497a1f9539cb9ffea09_cgraph.png" border="0" usemap="#group__mailboxes_gadc562242a8854497a1f9539cb9ffea09_cgraph" alt=""/></div>
<map name="group__mailboxes_gadc562242a8854497a1f9539cb9ffea09_cgraph" id="group__mailboxes_gadc562242a8854497a1f9539cb9ffea09_cgraph">
<area shape="rect" id="node3" href="group__scheduler.html#ga4e38b4bee3d2330f6a0f1cdb7660af20" title="Performs a reschedule if a higher priority thread is runnable." alt="" coords="137,56,255,83"/> <area shape="rect" id="node11" href="group__semaphores.html#gaca0b70cf495a9cb7569e1cf5b07e2b3d" title="Performs a signal operation on a semaphore." alt="" coords="331,5,416,32"/> <area shape="rect" id="node15" href="group__semaphores.html#ga924ec5d191bb8debe8727ae4dd5d6d03" title="Performs a wait operation on a semaphore with timeout specification." alt="" coords="136,107,256,133"/> <area shape="rect" id="node5" href="group__scheduler.html#ga0257cf203e72a766a52059750cb97e6e" title="Switches to the first thread on the runnable queue." alt="" coords="311,56,436,83"/> <area shape="rect" id="node7" href="group__scheduler.html#ga535d58cfb3436c8d4e4586c31c062298" title="Inserts a thread in the Ready List." alt="" coords="492,5,577,32"/> <area shape="rect" id="node9" href="group__internals.html#ga042479f09357fc59befebf4dfe0e9f4a" title="Removes the first&#45;out Thread from a queue and returns it." alt="" coords="495,56,575,83"/> <area shape="rect" id="node17" href="group__scheduler.html#ga306e564f678c1a39139639490c77e78b" title="Puts the current thread to sleep into the specified state with timeout specification." alt="" coords="304,107,443,133"/> </map>
2010-08-10 03:11:02 +00:00
</div>
</p>
</div>
</div>
</div>
<hr size="1"><address style="text-align: right;"><small>
2010-11-22 05:53:37 +00:00
Generated on Sun Oct 24 2010 09:40:46 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.7.1</small></address>
2010-08-10 03:11:02 +00:00
</body>
</html>