<p>The Memory Pools APIs allow to allocate/free fixed size objects in <b>constant time</b> and reliably without memory fragmentation problems.<br/>
In order to use the memory pools APIs the <code>CH_USE_MEMPOOLS</code> option must be enabled in <code><aclass="el"href="chconf_8h.html"title="Configuration file template.">chconf.h</a></code>. </p>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Data part of a static memory pool initializer. <ahref="#gac180dea0bb5ebc413ff8c8cfdab7369f"></a><br/></td></tr>
<tr><tdclass="memItemLeft"align="right"valign="top">#define </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group__pools.html#ga498d53232821de6ce2e3e150c76202f2">MEMORYPOOL_DECL</a>(name, size, provider) <aclass="el"href="struct_memory_pool.html">MemoryPool</a> name = _MEMORYPOOL_DATA(name, size, provider)</td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Static memory pool initializer in hungry mode. <ahref="#ga498d53232821de6ce2e3e150c76202f2"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Initializes an empty memory pool. <ahref="#ga9c53c25a5ae60930534cde8620775781"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Allocates an object from a memory pool. <ahref="#ga152fb3460d6b7426f0b6803bb38a0070"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Allocates an object from a memory pool. <ahref="#gab86190d70893fe708c75570af6720bd5"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Releases (or adds) an object into (to) a memory pool. <ahref="#gab5c6c04fd14fbeee2183ca955371c515"></a><br/></td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Releases (or adds) an object into (to) a memory pool. <ahref="#ga978f8d038e8e981bf9e5a104b81c6cb6"></a><br/></td></tr>
<p>Data part of a static memory pool initializer. </p>
<p>This macro should be used when statically initializing a memory pool that is part of a bigger structure.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>name</em> </td><td>the name of the memory pool variable </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the memory pool contained objects </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>provider</em> </td><td>memory provider function for the memory pool </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chmempools_8h_source.html#l00068">68</a> of file <aclass="el"href="chmempools_8h_source.html">chmempools.h</a>.</p>
<p>Static memory pool initializer in hungry mode. </p>
<p>Statically initialized memory pools require no explicit initialization using <code><aclass="el"href="group__pools.html#ga9c53c25a5ae60930534cde8620775781"title="Initializes an empty memory pool.">chPoolInit()</a></code>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>name</em> </td><td>the name of the memory pool variable </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>size of the memory pool contained objects </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>provider</em> </td><td>memory provider function for the memory pool or <code>NULL</code> if the pool is not allowed to grow automatically </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chmempools_8h_source.html#l00081">81</a> of file <aclass="el"href="chmempools_8h_source.html">chmempools.h</a>.</p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The size is internally aligned to be a multiple of the <code>align_t</code> type size.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[out]</tt> </td><tdvalign="top"><em>mp</em> </td><td>pointer to a <code><aclass="el"href="struct_memory_pool.html"title="Memory pool descriptor.">MemoryPool</a></code> structure </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>size</em> </td><td>the size of the objects contained in this memory pool, the minimum accepted size is the size of a pointer to void. </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>provider</em> </td><td>memory provider function for the memory pool or <code>NULL</code> if the pool is not allowed to grow automatically </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chmempools_8c_source.html#l00058">58</a> of file <aclass="el"href="chmempools_8c_source.html">chmempools.c</a>.</p>
<p>References <aclass="el"href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, <aclass="el"href="group__memcore.html#ga216a7738be23e0caa9d18e510eb795eb">MEM_ALIGN_SIZE</a>, <aclass="el"href="struct_memory_pool.html#ac1cf32748cc712049b503c2b00f99167">MemoryPool::mp_next</a>, <aclass="el"href="struct_memory_pool.html#a962ca1e05036d54213b3a0eeaebb0ec6">MemoryPool::mp_object_size</a>, and <aclass="el"href="struct_memory_pool.html#aa4b7af734cdd6976445d3502d6914428">MemoryPool::mp_provider</a>.</p>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>mp</em> </td><td>pointer to a <code><aclass="el"href="struct_memory_pool.html"title="Memory pool descriptor.">MemoryPool</a></code> structure </td></tr>
</table>
</dd>
</dl>
<dlclass="return"><dt><b>Returns:</b></dt><dd>The pointer to the allocated object. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"></td><tdvalign="top"><em>NULL</em> </td><td>if pool is empty. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chmempools_8c_source.html#l00074">74</a> of file <aclass="el"href="chmempools_8c_source.html">chmempools.c</a>.</p>
<p>References <aclass="el"href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, <aclass="el"href="struct_memory_pool.html#ac1cf32748cc712049b503c2b00f99167">MemoryPool::mp_next</a>, <aclass="el"href="struct_memory_pool.html#a962ca1e05036d54213b3a0eeaebb0ec6">MemoryPool::mp_object_size</a>, <aclass="el"href="struct_memory_pool.html#aa4b7af734cdd6976445d3502d6914428">MemoryPool::mp_provider</a>, and <aclass="el"href="structpool__header.html#aac699414c648388563597a56e34adeb4">pool_header::ph_next</a>.</p>
<p>Referenced by <aclass="el"href="group__pools.html#gab86190d70893fe708c75570af6720bd5">chPoolAlloc()</a>.</p>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>mp</em> </td><td>pointer to a <code><aclass="el"href="struct_memory_pool.html"title="Memory pool descriptor.">MemoryPool</a></code> structure </td></tr>
</table>
</dd>
</dl>
<dlclass="return"><dt><b>Returns:</b></dt><dd>The pointer to the allocated object. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"></td><tdvalign="top"><em>NULL</em> </td><td>if pool is empty. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chmempools_8c_source.html#l00095">95</a> of file <aclass="el"href="chmempools_8c_source.html">chmempools.c</a>.</p>
<p>References <aclass="el"href="group__pools.html#ga152fb3460d6b7426f0b6803bb38a0070">chPoolAllocI()</a>, <aclass="el"href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, and <aclass="el"href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>.</p>
<p>Referenced by <aclass="el"href="group__threads.html#gad3ccc1a6f054c543258ed2fe97ed2f58">chThdCreateFromMemoryPool()</a>.</p>
<areashape="rect"id="node3"href="group__pools.html#ga152fb3460d6b7426f0b6803bb38a0070"title="Allocates an object from a memory pool."alt=""coords="133,5,213,32"/></map>
<p>Releases (or adds) an object into (to) a memory pool. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The object is assumed to be of the right size for the specified memory pool. </dd>
<dd>
The object is assumed to be memory aligned to the size of <code>align_t</code> type.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>mp</em> </td><td>pointer to a <code><aclass="el"href="struct_memory_pool.html"title="Memory pool descriptor.">MemoryPool</a></code> structure </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>objp</em> </td><td>the pointer to the object to be released or added </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chmempools_8c_source.html#l00114">114</a> of file <aclass="el"href="chmempools_8c_source.html">chmempools.c</a>.</p>
<p>References <aclass="el"href="group__debug.html#ga6bb6c0f97caab3a66332c8bfbf7a3844">chDbgCheck</a>, <aclass="el"href="group__memcore.html#gac38a64d9001b24d62f1c9ab79fbc328b">MEM_IS_ALIGNED</a>, <aclass="el"href="struct_memory_pool.html#ac1cf32748cc712049b503c2b00f99167">MemoryPool::mp_next</a>, and <aclass="el"href="structpool__header.html#aac699414c648388563597a56e34adeb4">pool_header::ph_next</a>.</p>
<p>Referenced by <aclass="el"href="group__pools.html#ga978f8d038e8e981bf9e5a104b81c6cb6">chPoolFree()</a>.</p>
<p>Releases (or adds) an object into (to) a memory pool. </p>
<dlclass="note"><dt><b>Note:</b></dt><dd>The object is assumed to be of the right size for the specified memory pool.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<tableborder="0"cellspacing="2"cellpadding="0">
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>mp</em> </td><td>pointer to a <code><aclass="el"href="struct_memory_pool.html"title="Memory pool descriptor.">MemoryPool</a></code> structure </td></tr>
<tr><tdvalign="top"><tt>[in]</tt> </td><tdvalign="top"><em>objp</em> </td><td>the pointer to the object to be released or added </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <aclass="el"href="chmempools_8c_source.html#l00132">132</a> of file <aclass="el"href="chmempools_8c_source.html">chmempools.c</a>.</p>
<p>References <aclass="el"href="group__pools.html#gab5c6c04fd14fbeee2183ca955371c515">chPoolFreeI()</a>, <aclass="el"href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, and <aclass="el"href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>.</p>
<p>Referenced by <aclass="el"href="group__threads.html#gaa22f80040cf192015be4607f31a0ac80">chThdRelease()</a>.</p>
<areashape="rect"id="node3"href="group__pools.html#gab5c6c04fd14fbeee2183ca955371c515"title="Releases (or adds) an object into (to) a memory pool."alt=""coords="132,5,209,32"/></map>
Generated on Sun Nov 28 2010 14:09:56 for ChibiOS/RT by <ahref="http://www.doxygen.org/index.html"><imgsrc="doxygen.png"alt="doxygen"align="middle"border="0"></a> 1.7.1</small></address>