667 lines
46 KiB
HTML
667 lines
46 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<title>Message Queue</title>
|
|
<title>CMSIS-RTOS2: Message Queue</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<link href="cmsis.css" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<script type="text/javascript" src="printComponentTabs.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(initResizable);
|
|
$(window).load(resizeHeight);
|
|
</script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 46px;">
|
|
<td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">CMSIS-RTOS2
|
|
 <span id="projectnumber">Version 2.1.0</span>
|
|
</div>
|
|
<div id="projectbrief">Real-Time Operating System: API and RTX Reference Implementation</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<div id="CMSISnav" class="tabs1">
|
|
<ul class="tablist">
|
|
<script type="text/javascript">
|
|
<!--
|
|
writeComponentTabs.call(this);
|
|
//-->
|
|
</script>
|
|
</ul>
|
|
</div>
|
|
<!-- Generated by Doxygen 1.8.6 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Usage and Description</span></a></li>
|
|
<li><a href="modules.html"><span>Reference</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){initNavTree('group__CMSIS__RTOS__Message.html','');});
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#nested-classes">Data Structures</a> |
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">Message Queue<div class="ingroups"><a class="el" href="group__CMSIS__RTOS.html">CMSIS-RTOS2 API</a></div></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Exchange messages between threads in a FIFO-like operation.
|
|
<a href="#details">More...</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
|
|
Data Structures</h2></td></tr>
|
|
<tr class="memitem:structosMessageQueueAttr__t"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#structosMessageQueueAttr__t">osMessageQueueAttr_t</a></td></tr>
|
|
<tr class="memdesc:structosMessageQueueAttr__t"><td class="mdescLeft"> </td><td class="mdescRight">Attributes structure for message queue. <a href="group__CMSIS__RTOS__Message.html#structosMessageQueueAttr__t">More...</a><br/></td></tr>
|
|
<tr class="separator:structosMessageQueueAttr__t"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:ga24e895a00f9d484db33aaf784c57bfed"><td class="memItemLeft" align="right" valign="top"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a> (uint32_t msg_count, uint32_t msg_size, const <a class="el" href="group__CMSIS__RTOS__Message.html#structosMessageQueueAttr__t">osMessageQueueAttr_t</a> *attr)</td></tr>
|
|
<tr class="memdesc:ga24e895a00f9d484db33aaf784c57bfed"><td class="mdescLeft"> </td><td class="mdescRight">Create and Initialize a Message Queue object. <a href="#ga24e895a00f9d484db33aaf784c57bfed">More...</a><br/></td></tr>
|
|
<tr class="separator:ga24e895a00f9d484db33aaf784c57bfed"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gae7cf7bf2b97a5ae481fb60fcce99247a"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#gae7cf7bf2b97a5ae481fb60fcce99247a">osMessageQueueGetName</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id)</td></tr>
|
|
<tr class="memdesc:gae7cf7bf2b97a5ae481fb60fcce99247a"><td class="mdescLeft"> </td><td class="mdescRight">Get name of a Message Queue object. <a href="#gae7cf7bf2b97a5ae481fb60fcce99247a">More...</a><br/></td></tr>
|
|
<tr class="separator:gae7cf7bf2b97a5ae481fb60fcce99247a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gadd5c8996850d1213976ba89cda689acc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#gadd5c8996850d1213976ba89cda689acc">osMessageQueuePut</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)</td></tr>
|
|
<tr class="memdesc:gadd5c8996850d1213976ba89cda689acc"><td class="mdescLeft"> </td><td class="mdescRight">Put a Message into a Queue or timeout if Queue is full. <a href="#gadd5c8996850d1213976ba89cda689acc">More...</a><br/></td></tr>
|
|
<tr class="separator:gadd5c8996850d1213976ba89cda689acc"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gad90d4959466a7a65105061da8256ab9e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#gad90d4959466a7a65105061da8256ab9e">osMessageQueueGet</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)</td></tr>
|
|
<tr class="memdesc:gad90d4959466a7a65105061da8256ab9e"><td class="mdescLeft"> </td><td class="mdescRight">Get a Message from a Queue or timeout if Queue is empty. <a href="#gad90d4959466a7a65105061da8256ab9e">More...</a><br/></td></tr>
|
|
<tr class="separator:gad90d4959466a7a65105061da8256ab9e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gac24f87d4f395e9e9c900c320e45ade8a"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#gac24f87d4f395e9e9c900c320e45ade8a">osMessageQueueGetCapacity</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id)</td></tr>
|
|
<tr class="memdesc:gac24f87d4f395e9e9c900c320e45ade8a"><td class="mdescLeft"> </td><td class="mdescRight">Get maximum number of messages in a Message Queue. <a href="#gac24f87d4f395e9e9c900c320e45ade8a">More...</a><br/></td></tr>
|
|
<tr class="separator:gac24f87d4f395e9e9c900c320e45ade8a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga96d3d84069b20359de48109e28a1a89e"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#ga96d3d84069b20359de48109e28a1a89e">osMessageQueueGetMsgSize</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id)</td></tr>
|
|
<tr class="memdesc:ga96d3d84069b20359de48109e28a1a89e"><td class="mdescLeft"> </td><td class="mdescRight">Get maximum message size in a Memory Pool. <a href="#ga96d3d84069b20359de48109e28a1a89e">More...</a><br/></td></tr>
|
|
<tr class="separator:ga96d3d84069b20359de48109e28a1a89e"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ga6a32ac394fcff568b251c160cc3014b2"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#ga6a32ac394fcff568b251c160cc3014b2">osMessageQueueGetCount</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id)</td></tr>
|
|
<tr class="memdesc:ga6a32ac394fcff568b251c160cc3014b2"><td class="mdescLeft"> </td><td class="mdescRight">Get number of queued messages in a Message Queue. <a href="#ga6a32ac394fcff568b251c160cc3014b2">More...</a><br/></td></tr>
|
|
<tr class="separator:ga6a32ac394fcff568b251c160cc3014b2"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaddf0904427436dd3880d46263c2dc9fa"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#gaddf0904427436dd3880d46263c2dc9fa">osMessageQueueGetSpace</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id)</td></tr>
|
|
<tr class="memdesc:gaddf0904427436dd3880d46263c2dc9fa"><td class="mdescLeft"> </td><td class="mdescRight">Get number of available slots for messages in a Message Queue. <a href="#gaddf0904427436dd3880d46263c2dc9fa">More...</a><br/></td></tr>
|
|
<tr class="separator:gaddf0904427436dd3880d46263c2dc9fa"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gac6dce7f9ad132d266292c2e979d861b4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#gac6dce7f9ad132d266292c2e979d861b4">osMessageQueueReset</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id)</td></tr>
|
|
<tr class="memdesc:gac6dce7f9ad132d266292c2e979d861b4"><td class="mdescLeft"> </td><td class="mdescRight">Reset a Message Queue to initial empty state. <a href="#gac6dce7f9ad132d266292c2e979d861b4">More...</a><br/></td></tr>
|
|
<tr class="separator:gac6dce7f9ad132d266292c2e979d861b4"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:gaba987f665444e0d83fa6a3a68bc72abe"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__Message.html#gaba987f665444e0d83fa6a3a68bc72abe">osMessageQueueDelete</a> (<a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mq_id)</td></tr>
|
|
<tr class="memdesc:gaba987f665444e0d83fa6a3a68bc72abe"><td class="mdescLeft"> </td><td class="mdescRight">Delete a Message Queue object. <a href="#gaba987f665444e0d83fa6a3a68bc72abe">More...</a><br/></td></tr>
|
|
<tr class="separator:gaba987f665444e0d83fa6a3a68bc72abe"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
|
|
<p><b>Message</b> <b>passing</b> is another basic communication model between threads. In the message passing model, one thread sends data explicitly, while another thread receives it. The operation is more like some kind of I/O rather than a direct access to information to be shared. In CMSIS-RTOS, this mechanism is called s <b>message</b> <b>queue</b>. The data is passed from one thread to another in a FIFO-like operation. Using message queue functions, you can control, send, receive, or wait for messages. The data to be passed can be of integer or pointer type:</p>
|
|
<div class="image">
|
|
<img src="MessageQueue.png" alt="MessageQueue.png"/>
|
|
<div class="caption">
|
|
CMSIS-RTOS Message Queue</div></div>
|
|
<p> Compared to a <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html">Memory Pool</a>, message queues are less efficient in general, but solve a broader range of problems. Sometimes, threads do not have a common address space or the use of shared memory raises problems, such as mutual exclusion.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>The functions <a class="el" href="group__CMSIS__RTOS__Message.html#gadd5c8996850d1213976ba89cda689acc">osMessageQueuePut</a>, <a class="el" href="group__CMSIS__RTOS__Message.html#gad90d4959466a7a65105061da8256ab9e">osMessageQueueGet</a>, <a class="el" href="group__CMSIS__RTOS__Message.html#gac24f87d4f395e9e9c900c320e45ade8a">osMessageQueueGetCapacity</a>, <a class="el" href="group__CMSIS__RTOS__Message.html#ga96d3d84069b20359de48109e28a1a89e">osMessageQueueGetMsgSize</a>, <a class="el" href="group__CMSIS__RTOS__Message.html#ga6a32ac394fcff568b251c160cc3014b2">osMessageQueueGetCount</a>, <a class="el" href="group__CMSIS__RTOS__Message.html#gaddf0904427436dd3880d46263c2dc9fa">osMessageQueueGetSpace</a> can be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd>
|
|
<dd>
|
|
Refer to <a class="el" href="config_rtx5.html#msgQueueConfig">Message Queue Configuration</a> for RTX5 configuration options. </dd></dl>
|
|
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
|
|
<a name="structosMessageQueueAttr__t" id="structosMessageQueueAttr__t"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">struct osMessageQueueAttr_t</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<div class="textblock"><p>Attributes structure for message queue. </p>
|
|
</div><table class="fieldtable">
|
|
<tr><th colspan="3">Data Fields</th></tr>
|
|
<tr><td class="fieldtype">
|
|
<a class="anchor" id="a8f8f80d37794cde9472343e4487ba3eb"></a>const char *</td>
|
|
<td class="fieldname">
|
|
name</td>
|
|
<td class="fielddoc">
|
|
name of the message queue </td></tr>
|
|
<tr><td class="fieldtype">
|
|
<a class="anchor" id="a712a8f140170e6798f561e783265a279"></a>uint32_t</td>
|
|
<td class="fieldname">
|
|
attr_bits</td>
|
|
<td class="fielddoc">
|
|
attribute bits </td></tr>
|
|
<tr><td class="fieldtype">
|
|
<a class="anchor" id="a8c66c30fe3b487298af0e70eb93a197a"></a>void *</td>
|
|
<td class="fieldname">
|
|
cb_mem</td>
|
|
<td class="fielddoc">
|
|
memory for control block </td></tr>
|
|
<tr><td class="fieldtype">
|
|
<a class="anchor" id="a5c542fd75887b7be589b39a2062910de"></a>uint32_t</td>
|
|
<td class="fieldname">
|
|
cb_size</td>
|
|
<td class="fielddoc">
|
|
size of provided memory for control block </td></tr>
|
|
<tr><td class="fieldtype">
|
|
<a class="anchor" id="aa4b46f91d1f929b4d3017275d2a592aa"></a>void *</td>
|
|
<td class="fieldname">
|
|
mq_mem</td>
|
|
<td class="fielddoc">
|
|
memory for data storage </td></tr>
|
|
<tr><td class="fieldtype">
|
|
<a class="anchor" id="a07e8199f8d810c55d154c1a3afe2991e"></a>uint32_t</td>
|
|
<td class="fieldname">
|
|
mq_size</td>
|
|
<td class="fielddoc">
|
|
size of provided memory for data storage </td></tr>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Function Documentation</h2>
|
|
<a class="anchor" id="ga24e895a00f9d484db33aaf784c57bfed"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> osMessageQueueNew </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>msg_count</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>msg_size</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const <a class="el" href="group__CMSIS__RTOS__Message.html#structosMessageQueueAttr__t">osMessageQueueAttr_t</a> * </td>
|
|
<td class="paramname"><em>attr</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg_count</td><td>maximum number of messages in queue. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg_size</td><td>maximum message size in bytes. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">attr</td><td>message queue attributes; NULL: default values. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>message queue ID for reference by other functions or NULL in case of error.</dd></dl>
|
|
<p>The function <b>osMessageQueueNew</b> creates and initializes a message queue object and returns the pointer to the message queue object identifier or <span class="XML-Token">NULL</span> in case of an error.</p>
|
|
<p>The parameter <em>msg_count</em> specifies the maximum number of messages om the queue.</p>
|
|
<p>The parameter <em>msg_size</em> sets message size in bytes.</p>
|
|
<p>The parameter <em>attr</em> specifies additional message queue attributes. Default attributes will be used if set to <span class="XML-Token">NULL</span>.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>.</dd></dl>
|
|
<p><b>Code Example</b></p>
|
|
<p>Refer to <a class="el" href="group__CMSIS__RTOS__Message.html#gadd5c8996850d1213976ba89cda689acc">osMessageQueuePut</a> </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gae7cf7bf2b97a5ae481fb60fcce99247a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const char * osMessageQueueGetName </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>name as NULL terminated string.</dd></dl>
|
|
<p>The function <b>osMessageQueueGetName</b> returns the pointer to the name string of the message queue identified by parameter <em>mq_id</em> or <span class="XML-Token">NULL</span> in case of an error.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gadd5c8996850d1213976ba89cda689acc"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">*<a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> osMessageQueuePut </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const void * </td>
|
|
<td class="paramname"><em>msg_ptr</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t </td>
|
|
<td class="paramname"><em>msg_prio</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>timeout</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg_ptr</td><td>pointer to buffer with message to put into a queue. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">msg_prio</td><td>message priority. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td><a class="el" href="theory_of_operation.html#CMSIS_RTOS_TimeOutValue">Timeout Value</a> or 0 in case of no time-out. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>status code that indicates the execution status of the function.</dd></dl>
|
|
<p>The blocking function <b>osMessageQueuePut</b> puts a message into the the message queue specified by parameter <em>mq_id</em>.</p>
|
|
<p>The parameter <em>msg_ptr</em> points to the buffer with the message to be put into the queue.</p>
|
|
<p>The parameter <em>msg_prio</em> defines the message priority (higher numbers indicate a higher priority).</p>
|
|
<p>The parameter <em>timeout</em> specifies how long the system waits to put the message into the queue. While the system waits, the thread that is calling this function is put into the <b>BLOCKED</b> state. The parameter <a class="el" href="theory_of_operation.html#CMSIS_RTOS_TimeOutValue">timeout</a> can have the following values:</p>
|
|
<ul>
|
|
<li>when <em>timeout</em> is <span class="XML-Token">0</span>, the function returns instantly.</li>
|
|
<li>when <em>timeout</em> is set to <b>osWaitForever</b> the function will wait for an infinite time until the message is delivered.</li>
|
|
<li>all other values specify a time in kernel ticks for a timeout.</li>
|
|
</ul>
|
|
<p>Possible <a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> return values:</p>
|
|
<ul>
|
|
<li><em>osOK:</em> the message has been put into the queue.</li>
|
|
<li><em>osErrorTimeout:</em> the message could not be put into the queue in the given time.</li>
|
|
<li><em>osErrorResource:</em> not enough space in the queue.</li>
|
|
<li><em>osErrorParameter:</em> the parameter <em>mq_id</em> is incorrect, non-zero timeout specified in an ISR.</li>
|
|
</ul>
|
|
<dl class="section note"><dt>Note</dt><dd>May be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a> if the parameter <em>timeout</em> is set to <span class="XML-Token">0</span>.</dd></dl>
|
|
<p><b>Code Example:</b> </p>
|
|
<div class="fragment"><div class="line"><span class="preprocessor">#include "<a class="code" href="cmsis__os2_8h.html">cmsis_os2.h</a>"</span> <span class="comment">// CMSIS RTOS header file</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/*----------------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> * Message Queue creation & usage</span></div>
|
|
<div class="line"><span class="comment"> *---------------------------------------------------------------------------*/</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keywordtype">void</span> Thread_MsgQueue1 (<span class="keywordtype">void</span> *argument); <span class="comment">// thread function 1</span></div>
|
|
<div class="line"><span class="keywordtype">void</span> Thread_MsgQueue2 (<span class="keywordtype">void</span> *argument); <span class="comment">// thread function 2</span></div>
|
|
<div class="line"><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> tid_Thread_MsgQueue1; <span class="comment">// thread id 1</span></div>
|
|
<div class="line"><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> tid_Thread_MsgQueue2; <span class="comment">// thread id 2</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#define MSGQUEUE_OBJECTS 16 // number of Message Queue Objects</span></div>
|
|
<div class="line"><span class="preprocessor"></span> </div>
|
|
<div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>{ <span class="comment">// object data type</span></div>
|
|
<div class="line"> uint8_t Buf[32];</div>
|
|
<div class="line"> uint8_t Idx;</div>
|
|
<div class="line">} MSGQUEUE_OBJ_t;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mpid_MemPool2; <span class="comment">// memory pool id</span></div>
|
|
<div class="line"><a class="code" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> mid_MsgQueue; <span class="comment">// message queue id</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keywordtype">int</span> Init_MsgQueue (<span class="keywordtype">void</span>) {</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> mid_MsgQueue = <a class="code" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>(MSGQUEUE_OBJECTS, <span class="keyword">sizeof</span>(MSGQUEUE_OBJ_t), NULL);</div>
|
|
<div class="line"> <span class="keywordflow">if</span> (!mid_MsgQueue) {</div>
|
|
<div class="line"> ; <span class="comment">// Message Queue object not created, handle failure</span></div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> tid_Thread_MsgQueue1 = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a> (Thread_MsgQueue1, NULL, NULL);</div>
|
|
<div class="line"> <span class="keywordflow">if</span> (!tid_Thread_MsgQueue1) <span class="keywordflow">return</span>(-1);</div>
|
|
<div class="line"> tid_Thread_MsgQueue2 = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a> (Thread_MsgQueue2, NULL, NULL);</div>
|
|
<div class="line"> <span class="keywordflow">if</span> (!tid_Thread_MsgQueue2) <span class="keywordflow">return</span>(-1);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="keywordflow">return</span>(0);</div>
|
|
<div class="line">}</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keywordtype">void</span> Thread_MsgQueue1 (<span class="keywordtype">void</span> *argument) {</div>
|
|
<div class="line"> MSGQUEUE_OBJ_t pMsg = 0;</div>
|
|
<div class="line"></div>
|
|
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
|
|
<div class="line"> ; <span class="comment">// Insert thread code here...</span></div>
|
|
<div class="line"> pMsg->Buf[0] = 0x55; <span class="comment">// do some work...</span></div>
|
|
<div class="line"> pMsg->Idx = 0;</div>
|
|
<div class="line"> <a class="code" href="group__CMSIS__RTOS__Message.html#gadd5c8996850d1213976ba89cda689acc">osMessageQueuePut</a> (mid_MsgQueue, &pMsg, NULL, NULL);</div>
|
|
<div class="line"> <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gad01c7ec26535b1de6b018bb9466720e2">osThreadYield</a> (); <span class="comment">// suspend thread</span></div>
|
|
<div class="line"> }</div>
|
|
<div class="line">}</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keywordtype">void</span> Thread_MsgQueue2 (<span class="keywordtype">void</span> *argument) {</div>
|
|
<div class="line"></div>
|
|
<div class="line"> MSGQUEUE_OBJ_t pMsg = 0;</div>
|
|
<div class="line"></div>
|
|
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
|
|
<div class="line"> ; <span class="comment">// Insert thread code here...</span></div>
|
|
<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__Message.html#gad90d4959466a7a65105061da8256ab9e">osMessageQueueGet</a> (mid_MsgQueue, &pMsg, NULL, NULL); <span class="comment">// wait for message</span></div>
|
|
<div class="line"> <span class="keywordflow">if</span> (status == <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813ea9e1c9e2550bb4de8969a935acffc968f">osOK</a>) {</div>
|
|
<div class="line"> ; <span class="comment">// process data</span></div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> }</div>
|
|
<div class="line">}</div>
|
|
</div><!-- fragment -->
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gad90d4959466a7a65105061da8256ab9e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> osMessageQueueGet </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">void * </td>
|
|
<td class="paramname"><em>msg_ptr</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>msg_prio</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint32_t </td>
|
|
<td class="paramname"><em>timeout</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">msg_ptr</td><td>pointer to buffer for message to get from a queue. </td></tr>
|
|
<tr><td class="paramdir">[out]</td><td class="paramname">msg_prio</td><td>pointer to buffer for message priority or NULL. </td></tr>
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td><a class="el" href="theory_of_operation.html#CMSIS_RTOS_TimeOutValue">Timeout Value</a> or 0 in case of no time-out. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>status code that indicates the execution status of the function.</dd></dl>
|
|
<p>The function <b>osMessageQueueGet</b> retrieves a message from the message queue specified by the parameter <em>mq_id</em> and saves it to the buffer pointed to by the parameter <em>msg_ptr</em>.</p>
|
|
<p>The parameter <em>msg_prio</em> is a pointer to the buffer containing the message priority or token{NULL}.</p>
|
|
<p>The parameter <em>timeout</em> specifies how long the system waits to retrieve the message from the queue. While the system waits, the thread that is calling this function is put into the <b>BLOCKED</b> state. The parameter <a class="el" href="theory_of_operation.html#CMSIS_RTOS_TimeOutValue">timeout</a> can have the following values:</p>
|
|
<ul>
|
|
<li>when <em>timeout</em> is <span class="XML-Token">0</span>, the function returns instantly.</li>
|
|
<li>when <em>timeout</em> is set to <b>osWaitForever</b> the function will wait for an infinite time until the message is retrieved.</li>
|
|
<li>all other values specify a time in kernel ticks for a timeout.</li>
|
|
</ul>
|
|
<p>Possible <a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> return values:</p>
|
|
<ul>
|
|
<li><em>osOK:</em> the message has been retrieved from the queue.</li>
|
|
<li><em>osErrorTimeout:</em> the message could not be retrieved from the queue in the given time.</li>
|
|
<li><em>osErrorResource:</em> nothing to get from the queue.</li>
|
|
<li><em>osErrorParameter:</em> the parameter <em>mq_id</em> is incorrect, non-zero timeout specified in an ISR.</li>
|
|
</ul>
|
|
<dl class="section note"><dt>Note</dt><dd>May be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a> if the parameter <em>timeout</em> is set to <span class="XML-Token">0</span>.</dd></dl>
|
|
<p><b>Code Example</b></p>
|
|
<p>Refer to <a class="el" href="group__CMSIS__RTOS__Message.html#gadd5c8996850d1213976ba89cda689acc">osMessageQueuePut</a> </p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gac24f87d4f395e9e9c900c320e45ade8a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint32_t osMessageQueueGetCapacity </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>maximum number of messages.</dd></dl>
|
|
<p>The function <b>osMessageQueueGetCapacity</b> returns the maximum number of messages in the message queue object specified by parameter <em>mq_id</em> or <span class="XML-Token">0</span> in case of an error.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>This function may be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga96d3d84069b20359de48109e28a1a89e"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint32_t osMessageQueueGetMsgSize </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>maximum message size in bytes.</dd></dl>
|
|
<p>The function <b>osMessageQueueGetMsgSize</b> returns the maximum message size in bytes for the message queue object specified by parameter <em>mq_id</em> or <span class="XML-Token">0</span> in case of an error.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>This function may be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ga6a32ac394fcff568b251c160cc3014b2"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint32_t osMessageQueueGetCount </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>number of queued messages.</dd></dl>
|
|
<p>The function <b>osMessageQueueGetCount</b> returns the number of queued messages in the message queue object specified by parameter <em>mq_id</em> or <span class="XML-Token">0</span> in case of an error.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>This function may be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaddf0904427436dd3880d46263c2dc9fa"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">uint32_t osMessageQueueGetSpace </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>number of available slots for messages.</dd></dl>
|
|
<p>The function <b>osMessageQueueGetSpace</b> returns the number available slots for messages in the message queue object specified by parameter <em>mq_id</em> or <span class="XML-Token">0</span> in case of an error.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>This function may be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gac6dce7f9ad132d266292c2e979d861b4"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> osMessageQueueReset </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>status code that indicates the execution status of the function.</dd></dl>
|
|
<p>The function <b>osMessageQueueReset</b> resets the message queue specified by the parameter <em>mq_id</em>.</p>
|
|
<p>Possible <a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> return values:</p>
|
|
<ul>
|
|
<li><em>osOK:</em> the message queue has been rest.</li>
|
|
<li><em>osErrorParameter:</em> parameter <em>mq_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
|
|
<li><em>osErrorResource:</em> the message queue specified by parameter <em>mq_id</em> is in an invalid message queue state.</li>
|
|
<li><em>osErrorISR:</em> <b>osMessageQueueReset</b> cannot be called from interrupt service routines.</li>
|
|
</ul>
|
|
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="gaba987f665444e0d83fa6a3a68bc72abe"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> osMessageQueueDelete </td>
|
|
<td>(</td>
|
|
<td class="paramtype"><a class="el" href="cmsis__os2_8h.html#a206dbc05367e03c39fc6d4d1ebcff317">osMessageQueueId_t</a> </td>
|
|
<td class="paramname"><em>mq_id</em></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramdir">[in]</td><td class="paramname">mq_id</td><td>message queue ID obtained by <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>status code that indicates the execution status of the function.</dd></dl>
|
|
<p>The function <b>osMessageQueueDelete</b> deletes a message queue object specified by parameter <em>mq_id</em>. It releases internal memory obtained for message queue handling. After this call, the <em>mq_id</em> is no longer valid and cannot be used. The message queue may be created again using the function <a class="el" href="group__CMSIS__RTOS__Message.html#ga24e895a00f9d484db33aaf784c57bfed">osMessageQueueNew</a>.</p>
|
|
<p>Possible <a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a> return values:</p>
|
|
<ul>
|
|
<li><em>osOK:</em> the message queue object has been deleted.</li>
|
|
<li><em>osErrorParameter:</em> parameter <em>mq_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
|
|
<li><em>osErrorResource:</em> the message queue specified by parameter <em>mq_id</em> is in an invalid message queue state.</li>
|
|
<li><em>osErrorISR:</em> <b>osMessageQueueDelete</b> cannot be called from interrupt service routines.</li>
|
|
</ul>
|
|
<dl class="section note"><dt>Note</dt><dd>This function <b>cannot</b> be called from <a class="el" href="theory_of_operation.html#CMSIS_RTOS_ISR_Calls">Interrupt Service Routines</a>. </dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">Generated on Wed Feb 8 2017 10:21:04 for CMSIS-RTOS2 by ARM Ltd. All rights reserved.
|
|
<!--
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6
|
|
-->
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|