blob: b7c98273ecded1bb7c53435063921350af58c7d2 [file] [log] [blame]
<!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>Memory Pool</title>
<title>CMSIS-RTOS2: Memory Pool</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
&#160;<span id="projectnumber">Version 2.1.3</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&#160;Page</span></a></li>
<li><a href="pages.html"><span>Usage&#160;and&#160;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__PoolMgmt.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">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</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> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Memory Pool<div class="ingroups"><a class="el" href="group__CMSIS__RTOS.html">CMSIS-RTOS API v2</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Manage thread-safe fixed-size blocks of dynamic memory.
<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:structosMemoryPoolAttr__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#structosMemoryPoolAttr__t">osMemoryPoolAttr_t</a></td></tr>
<tr class="memdesc:structosMemoryPoolAttr__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">Attributes structure for memory pool. <a href="group__CMSIS__RTOS__PoolMgmt.html#structosMemoryPoolAttr__t">More...</a><br/></td></tr>
<tr class="separator:structosMemoryPoolAttr__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga2e44473caf338266f56800960294f960"><td class="memItemLeft" align="right" valign="top">typedef void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a></td></tr>
<tr class="separator:ga2e44473caf338266f56800960294f960"><td class="memSeparator" colspan="2">&#160;</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:ga497ced5d72dc5cd405c4c418516220dc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a> (uint32_t block_count, uint32_t block_size, const <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#structosMemoryPoolAttr__t">osMemoryPoolAttr_t</a> *attr)</td></tr>
<tr class="memdesc:ga497ced5d72dc5cd405c4c418516220dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create and Initialize a Memory Pool object. <a href="#ga497ced5d72dc5cd405c4c418516220dc">More...</a><br/></td></tr>
<tr class="separator:ga497ced5d72dc5cd405c4c418516220dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab414a1e138205a55820acfa277c8f386"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gab414a1e138205a55820acfa277c8f386">osMemoryPoolGetName</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id)</td></tr>
<tr class="memdesc:gab414a1e138205a55820acfa277c8f386"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get name of a Memory Pool object. <a href="#gab414a1e138205a55820acfa277c8f386">More...</a><br/></td></tr>
<tr class="separator:gab414a1e138205a55820acfa277c8f386"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8ead54e99ccb8f112356c88f99d38fbe"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga8ead54e99ccb8f112356c88f99d38fbe">osMemoryPoolAlloc</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id, uint32_t timeout)</td></tr>
<tr class="memdesc:ga8ead54e99ccb8f112356c88f99d38fbe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate a memory block from a Memory Pool. <a href="#ga8ead54e99ccb8f112356c88f99d38fbe">More...</a><br/></td></tr>
<tr class="separator:ga8ead54e99ccb8f112356c88f99d38fbe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabb4f4560daa6d1f8c8789082ee186d16"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gabb4f4560daa6d1f8c8789082ee186d16">osMemoryPoolFree</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id, void *block)</td></tr>
<tr class="memdesc:gabb4f4560daa6d1f8c8789082ee186d16"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return an allocated memory block back to a Memory Pool. <a href="#gabb4f4560daa6d1f8c8789082ee186d16">More...</a><br/></td></tr>
<tr class="separator:gabb4f4560daa6d1f8c8789082ee186d16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad696e94bfbe28f0b6613f9303fdf6a37"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gad696e94bfbe28f0b6613f9303fdf6a37">osMemoryPoolGetCapacity</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id)</td></tr>
<tr class="memdesc:gad696e94bfbe28f0b6613f9303fdf6a37"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get maximum number of memory blocks in a Memory Pool. <a href="#gad696e94bfbe28f0b6613f9303fdf6a37">More...</a><br/></td></tr>
<tr class="separator:gad696e94bfbe28f0b6613f9303fdf6a37"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab2bf059b7fa7679c3cccdaeec60b6c0e"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gab2bf059b7fa7679c3cccdaeec60b6c0e">osMemoryPoolGetBlockSize</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id)</td></tr>
<tr class="memdesc:gab2bf059b7fa7679c3cccdaeec60b6c0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get memory block size in a Memory Pool. <a href="#gab2bf059b7fa7679c3cccdaeec60b6c0e">More...</a><br/></td></tr>
<tr class="separator:gab2bf059b7fa7679c3cccdaeec60b6c0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga958a9449bff8c95ce213de98eef5739d"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga958a9449bff8c95ce213de98eef5739d">osMemoryPoolGetCount</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id)</td></tr>
<tr class="memdesc:ga958a9449bff8c95ce213de98eef5739d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get number of memory blocks used in a Memory Pool. <a href="#ga958a9449bff8c95ce213de98eef5739d">More...</a><br/></td></tr>
<tr class="separator:ga958a9449bff8c95ce213de98eef5739d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0394cffa9479a7994e3b03c79c1cb909"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga0394cffa9479a7994e3b03c79c1cb909">osMemoryPoolGetSpace</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id)</td></tr>
<tr class="memdesc:ga0394cffa9479a7994e3b03c79c1cb909"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get number of memory blocks available in a Memory Pool. <a href="#ga0394cffa9479a7994e3b03c79c1cb909">More...</a><br/></td></tr>
<tr class="separator:ga0394cffa9479a7994e3b03c79c1cb909"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8c39e7e5cd2b9eda907466808e59d62e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CMSIS__RTOS__Definitions.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813e">osStatus_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga8c39e7e5cd2b9eda907466808e59d62e">osMemoryPoolDelete</a> (<a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mp_id)</td></tr>
<tr class="memdesc:ga8c39e7e5cd2b9eda907466808e59d62e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete a Memory Pool object. <a href="#ga8c39e7e5cd2b9eda907466808e59d62e">More...</a><br/></td></tr>
<tr class="separator:ga8c39e7e5cd2b9eda907466808e59d62e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<p><b>Memory</b> <b>Pools</b> are fixed-size blocks of memory that are thread-safe. They operate much faster than the dynamically allocated heap and do not suffer from fragmentation. Being thread-safe, they can be accessed from threads and ISRs alike.</p>
<p>A Memory Pool can be seen as a linked list of available (unused) memory blocks of fixed and equal size. Allocating memory from a pool (using <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga8ead54e99ccb8f112356c88f99d38fbe">osMemoryPoolAlloc</a>) simply unchains a block from the list and hands over control to the user. Freeing memory to the pool (using <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gabb4f4560daa6d1f8c8789082ee186d16">osMemoryPoolFree</a>) simply rechains the block into the list.</p>
<div class="image">
<img src="mempool.png" alt="mempool.png"/>
<div class="caption">
CMSIS-RTOS Memory Pools</div></div>
<dl class="section note"><dt>Note</dt><dd>One must not write to freed block. It is up to the implementation to reuse the memory of unused blocks for internal control data, i.e. linked list pointers.</dd></dl>
<p><b>Shared</b> <b>memory</b> is one of the basic models to exchange information between threads. Using memory pools for exchanging data, you can share more complex objects between threads if compared to a <a class="el" href="group__CMSIS__RTOS__Message.html">Message Queue</a>. Memory pool management functions are used to define and manage such fixed-sized memory pools.</p>
<dl class="section note"><dt>Note</dt><dd>The functions <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga8ead54e99ccb8f112356c88f99d38fbe">osMemoryPoolAlloc</a>, <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gabb4f4560daa6d1f8c8789082ee186d16">osMemoryPoolFree</a>, <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gad696e94bfbe28f0b6613f9303fdf6a37">osMemoryPoolGetCapacity</a>, <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#gab2bf059b7fa7679c3cccdaeec60b6c0e">osMemoryPoolGetBlockSize</a>, <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga958a9449bff8c95ce213de98eef5739d">osMemoryPoolGetCount</a>, <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga0394cffa9479a7994e3b03c79c1cb909">osMemoryPoolGetSpace</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#memPoolConfig">Memory Pool Configuration</a> for RTX5 configuration options. </dd></dl>
<hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structosMemoryPoolAttr__t" id="structosMemoryPoolAttr__t"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct osMemoryPoolAttr_t</td>
</tr>
</table>
</div><div class="memdoc">
<div class="textblock"><p>Attributes to configure a memory pool.</p>
<p>Refer to <a class="el" href="group__CMSIS__RTOS__MemoryMgmt.html">Memory Management</a> for details about usage of</p>
<ul>
<li><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#a1e100dc33d403841ed3c344e3397868e" title="memory for control block ">osMemoryPoolAttr_t::cb_mem</a></li>
<li><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#aa55a4335d12dc2785dc00fdc292d1159" title="size of provided memory for control block ">osMemoryPoolAttr_t::cb_size</a></li>
<li><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#a5799465cca9c71c5587ceb0986f5b06a" title="memory for data storage ">osMemoryPoolAttr_t::mp_mem</a></li>
<li><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#a66c26015c0ac8e88a4ad907c120aee4f" title="size of provided memory for data storage ">osMemoryPoolAttr_t::mp_size</a> </li>
</ul>
</div><table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a class="anchor" id="ab74e6bf80237ddc4109968cedc58c151"></a>const char *</td>
<td class="fieldname">
name</td>
<td class="fielddoc">
name of the memory pool <p>Pointer to a string with a human readable name of the memory pool object.<br/>
Default: <span class="XML-Token">NULL</span>. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a6e93b49cb79c12f768d72580c7731f30"></a>uint32_t</td>
<td class="fieldname">
attr_bits</td>
<td class="fielddoc">
attribute bits <p>Reserved for future use (set to '0').<br/>
Default: <span class="XML-Token">0</span>. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a1e100dc33d403841ed3c344e3397868e"></a>void *</td>
<td class="fieldname">
cb_mem</td>
<td class="fielddoc">
memory for control block <p>Pointer to a memory location for the memory pool control block object. This can optionally be used for custom memory management systems.<br/>
Default: <span class="XML-Token">NULL</span> (uses kernel memory management). </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="aa55a4335d12dc2785dc00fdc292d1159"></a>uint32_t</td>
<td class="fieldname">
cb_size</td>
<td class="fielddoc">
size of provided memory for control block <p>The size of the memory block passed with <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#a1e100dc33d403841ed3c344e3397868e">cb_mem</a>. Must be the size of a memory pool control block object or larger. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a5799465cca9c71c5587ceb0986f5b06a"></a>void *</td>
<td class="fieldname">
mp_mem</td>
<td class="fielddoc">
memory for data storage <p>Pointer to a memory location for the data of the memory pool object.<br/>
Default: <span class="XML-Token">NULL</span>. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a66c26015c0ac8e88a4ad907c120aee4f"></a>uint32_t</td>
<td class="fieldname">
mp_size</td>
<td class="fielddoc">
size of provided memory for data storage <p>The size of the memory passed with <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#a5799465cca9c71c5587ceb0986f5b06a">mp_mem</a>. </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ga2e44473caf338266f56800960294f960"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Memory Pool ID identifies the memory pool.</p>
<p>Returned by:</p>
<ul>
<li><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a> </li>
</ul>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga497ced5d72dc5cd405c4c418516220dc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> osMemoryPoolNew </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>block_count</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>block_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#structosMemoryPoolAttr__t">osMemoryPoolAttr_t</a> *&#160;</td>
<td class="paramname"><em>attr</em>&#160;</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">block_count</td><td>maximum number of memory blocks in memory pool. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">block_size</td><td>memory block size in bytes. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">attr</td><td>memory pool attributes; NULL: default values. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>memory pool ID for reference by other functions or NULL in case of error.</dd></dl>
<p>The function <b>osMemoryPoolNew</b> creates and initializes a memory pool object and returns the pointer to the memory pool object identifier or <span class="XML-Token">NULL</span> in case of an error. It can be safely called before the RTOS is started (call to <a class="el" href="group__CMSIS__RTOS__KernelCtrl.html#ga9ae2cc00f0d89d7b6a307bba942b5221">osKernelStart</a>), but not before it is initialized (call to <a class="el" href="group__CMSIS__RTOS__KernelCtrl.html#gae818f6611d25ba3140bede410a52d659">osKernelInitialize</a>).</p>
<p>The total amount of memory needed is at least <code>block_count * block_size</code>. Memory from the pool can only be allocated/freed in fixed portions of <code>block_size</code>.</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</b> <b>Example</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="cmsis__os2_8h.html">cmsis_os2.h</a>&quot;</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"> * Memory Pool creation &amp; usage</span></div>
<div class="line"><span class="comment"> *---------------------------------------------------------------------------*/</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#define MEMPOOL_OBJECTS 16 // number of Memory Pool 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">} MEM_BLOCK_t;</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a> mpid_MemPool; <span class="comment">// memory pool id</span></div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#gaa6c32fe2a3e0a2e01f212d55b02e51c7">osThreadId_t</a> tid_Thread_MemPool; <span class="comment">// thread id</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> Thread_MemPool (<span class="keywordtype">void</span> *argument); <span class="comment">// thread function</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> Init_MemPool (<span class="keywordtype">void</span>) {</div>
<div class="line"> </div>
<div class="line"> mpid_MemPool = <a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>(MEMPOOL_OBJECTS, <span class="keyword">sizeof</span>(MEM_BLOCK_t), NULL);</div>
<div class="line"> <span class="keywordflow">if</span> (mpid_MemPool == NULL) {</div>
<div class="line"> ; <span class="comment">// MemPool object not created, handle failure</span></div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> tid_Thread_MemPool = <a class="code" href="group__CMSIS__RTOS__ThreadMgmt.html#ga48d68b8666d99d28fa646ee1d2182b8f">osThreadNew</a>(Thread_MemPool, NULL, NULL);</div>
<div class="line"> <span class="keywordflow">if</span> (tid_Thread_MemPool == NULL) {</div>
<div class="line"> <span class="keywordflow">return</span>(-1);</div>
<div class="line"> }</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_MemPool (<span class="keywordtype">void</span> *argument) {</div>
<div class="line"> MEM_BLOCK_t *pMem;</div>
<div class="line"> osStatus_t status;</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"> </div>
<div class="line"> pMem = (MEM_BLOCK_t *)<a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#ga8ead54e99ccb8f112356c88f99d38fbe">osMemoryPoolAlloc</a>(mpid_MemPool, 0U); <span class="comment">// get Mem Block</span></div>
<div class="line"> <span class="keywordflow">if</span> (pMem != NULL) { <span class="comment">// Mem Block was available</span></div>
<div class="line"> pMem-&gt;Buf[0] = 0x55U; <span class="comment">// do some work...</span></div>
<div class="line"> pMem-&gt;Idx = 0U;</div>
<div class="line"> </div>
<div class="line"> status = <a class="code" href="group__CMSIS__RTOS__PoolMgmt.html#gabb4f4560daa6d1f8c8789082ee186d16">osMemoryPoolFree</a>(mpid_MemPool, pMem); <span class="comment">// free mem block</span></div>
<div class="line"> <span class="keywordflow">switch</span> (status) {</div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813ea9e1c9e2550bb4de8969a935acffc968f">osOK</a>:</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813eac24adca6a5d072c9f01c32178ba0d109">osErrorParameter</a>:</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="cmsis__os2_8h.html#ga6c0dbe6069e4e7f47bb4cd32ae2b813eaf1fac0240218e51eb30a13da2f8aae81">osErrorNoMemory</a>:</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> <span class="keywordflow">default</span>:</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line"> }</div>
<div class="line"> </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><!-- fragment -->
</div>
</div>
<a class="anchor" id="gab414a1e138205a55820acfa277c8f386"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char * osMemoryPoolGetName </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</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>osMemoryPoolGetName</b> returns the pointer to the name string of the memory pool identified by parameter <em>mp_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="ga8ead54e99ccb8f112356c88f99d38fbe"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void * osMemoryPoolAlloc </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>timeout</em>&#160;</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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </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>address of the allocated memory block or NULL in case of no memory is available.</dd></dl>
<p>The blocking function <b>osMemoryPoolAlloc</b> allocates the memory pool parameter <em>mp_id</em> and returns a pointer to the address of the allocated memory or <span class="XML-Token">0</span> in case of an error.</p>
<p>The parameter <em>timeout</em> specifies how long the system waits to allocate the memory. While the system waits, the thread that is calling this function is put into the <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">BLOCKED</a> state. The thread will become <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">READY</a> as soon as at least one block of memory gets available.</p>
<p>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 (i.e. try semantics).</li>
<li>when <em>timeout</em> is set to <b>osWaitForever</b> the function will wait for an infinite time until the memory is allocated (i.e. wait semantics).</li>
<li>all other values specify a time in kernel ticks for a timeout (i.e. timed-wait semantics).</li>
</ul>
<p>The result is the pointer to the memory block allocated, or NULL if no memory is available.</p>
<dl class="section note"><dt>Note</dt><dd>It is in the responsibility of the user to respect the block size, i.e. not access memory beyond the blocks limit.</dd>
<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</b> <b>Example</b> </p>
<p>Refer to <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </p>
</div>
</div>
<a class="anchor" id="gabb4f4560daa6d1f8c8789082ee186d16"></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> osMemoryPoolFree </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>block</em>&#160;</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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">block</td><td>address of the allocated memory block to be returned to the memory pool. </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>osMemoryPoolFree</b> frees the memory pool block specified by the parameter <em>block</em> in the memory pool object specified by the parameter <em>mp_id</em>. The memory block is put back to the list of available blocks.</p>
<p>If another thread is waiting for memory to become available the thread is put to <a class="el" href="group__CMSIS__RTOS__ThreadMgmt.html#ThreadStates">READY</a> state.</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 memory has been freed.</li>
<li><em>osErrorParameter:</em> parameter <em>mp_id</em> is <span class="XML-Token">NULL</span> or invalid, <em>block</em> points to invalid memory.</li>
<li><em>osErrorResource:</em> the memory pool is in an invalid state.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd><b>osMemoryPoolFree</b> may perform certain checks on the <em>block</em> pointer given. But using <b>osMemoryPoolFree</b> with a pointer other than one received from <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga8ead54e99ccb8f112356c88f99d38fbe">osMemoryPoolAlloc</a> has <b>UNPREDICTED</b> behaviour.</dd>
<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>
<p><b>Code</b> <b>Example</b> </p>
<p>Refer to <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </p>
</div>
</div>
<a class="anchor" id="gad696e94bfbe28f0b6613f9303fdf6a37"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t osMemoryPoolGetCapacity </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>maximum number of memory blocks.</dd></dl>
<p>The function <b>osMemoryPoolGetCapacity</b> returns the maximum number of memory blocks in the memory pool object specified by parameter <em>mp_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="gab2bf059b7fa7679c3cccdaeec60b6c0e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t osMemoryPoolGetBlockSize </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>memory block size in bytes.</dd></dl>
<p>The function <b>osMemoryPoolGetBlockSize</b> returns the memory block size in bytes in the memory pool object specified by parameter <em>mp_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="ga958a9449bff8c95ce213de98eef5739d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t osMemoryPoolGetCount </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>number of memory blocks used.</dd></dl>
<p>The function <b>osMemoryPoolGetCount</b> returns the number of memory blocks used in the memory pool object specified by parameter <em>mp_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="ga0394cffa9479a7994e3b03c79c1cb909"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t osMemoryPoolGetSpace </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>number of memory blocks available.</dd></dl>
<p>The function <b>osMemoryPoolGetSpace</b> returns the number of memory blocks available in the memory pool object specified by parameter <em>mp_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="ga8c39e7e5cd2b9eda907466808e59d62e"></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> osMemoryPoolDelete </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga2e44473caf338266f56800960294f960">osMemoryPoolId_t</a>&#160;</td>
<td class="paramname"><em>mp_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">mp_id</td><td>memory pool ID obtained by <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</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>osMemoryPoolDelete</b> deletes a memory pool object specified by parameter <em>mp_id</em>. It releases internal memory obtained for memory pool handling. After this call, the <em>mp_id</em> is no longer valid and cannot be used. The memory pool may be created again using the function <a class="el" href="group__CMSIS__RTOS__PoolMgmt.html#ga497ced5d72dc5cd405c4c418516220dc">osMemoryPoolNew</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 memory pool object has been deleted.</li>
<li><em>osErrorParameter:</em> parameter <em>mp_id</em> is <span class="XML-Token">NULL</span> or invalid.</li>
<li><em>osErrorResource:</em> the memory pool is in an invalid state.</li>
<li><em>osErrorISR:</em> <b>osMemoryPoolDelete</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 Jul 10 2019 15:21:04 for CMSIS-RTOS2 Version 2.1.3 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>