<p>Core Memory Manager related APIs and services. </p>
<h2>Operation mode</h2>
<p>The core memory manager is a simplified allocator that only allows to allocate memory blocks without the possibility to free them.<br/>
This allocator is meant as a memory blocks provider for the other allocators such as:</p>
<ul>
<li>C-Runtime allocator (through a compiler specific adapter module).</li>
<li>Heap allocator (see <aclass="el"href="group__heaps.html">Heaps</a>).</li>
<li>Memory pools allocator (see <aclass="el"href="group__pools.html">Memory Pools</a>).</li>
</ul>
<p>By having a centralized memory provider the various allocators can coexist and share the main memory.<br/>
This allocator, alone, is also useful for very simple applications that just require a simple way to get memory blocks.<br/>
In order to use the core memory manager APIs the <code>CH_USE_MEMCORE</code> option must be enabled in <code><aclass="el"href="chconf_8h.html"title="Configuration file template.">chconf.h</a></code>. </p>
<tr><tdclass="memItemLeft"align="right"valign="top">#define </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group__memcore.html#ga216a7738be23e0caa9d18e510eb795eb">MEM_ALIGN_SIZE</a>(p) (((size_t)(p) + MEM_ALIGN_MASK) & ~MEM_ALIGN_MASK)</td></tr>
<tr><tdclass="memItemLeft"align="right"valign="top">#define </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="group__memcore.html#gac38a64d9001b24d62f1c9ab79fbc328b">MEM_IS_ALIGNED</a>(p) (((size_t)(p) & MEM_ALIGN_MASK) == 0)</td></tr>
<tr><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns whatever a pointer or memory size is aligned to the type <code>align_t</code>. <ahref="#gac38a64d9001b24d62f1c9ab79fbc328b"></a><br/></td></tr>
<p>Definition at line <aclass="el"href="chmemcore_8h_source.html#l00048">48</a> of file <aclass="el"href="chmemcore_8h_source.html">chmemcore.h</a>.</p>
<td> (((size_t)(p) + MEM_ALIGN_MASK) & ~MEM_ALIGN_MASK)</td>
</tr>
</table>
</div>
<divclass="memdoc">
<p>Alignment helper macro. </p>
<p>Definition at line <aclass="el"href="chmemcore_8h_source.html#l00053">53</a> of file <aclass="el"href="chmemcore_8h_source.html">chmemcore.h</a>.</p>
<p>Referenced by <aclass="el"href="group__memcore.html#ga30a45ff539c9ed5f2f4b1e87e72eb767">chCoreAllocI()</a>, <aclass="el"href="group__heaps.html#ga3d364eec0bef8b1986f63b3288ebbd5f">chHeapAlloc()</a>, <aclass="el"href="group__pools.html#ga9c53c25a5ae60930534cde8620775781">chPoolInit()</a>, and <aclass="el"href="group__memcore.html#ga4dc59d68e345710573420dca5daa241c">core_init()</a>.</p>
<td> (((size_t)(p) & MEM_ALIGN_MASK) == 0)</td>
</tr>
</table>
</div>
<divclass="memdoc">
<p>Returns whatever a pointer or memory size is aligned to the type <code>align_t</code>. </p>
<p>Definition at line <aclass="el"href="chmemcore_8h_source.html#l00059">59</a> of file <aclass="el"href="chmemcore_8h_source.html">chmemcore.h</a>.</p>
<p>Referenced by <aclass="el"href="group__heaps.html#ga7135c9ddbd1402a4a36ce44df948f4e4">chHeapInit()</a>, and <aclass="el"href="group__pools.html#gab5c6c04fd14fbeee2183ca955371c515">chPoolFreeI()</a>.</p>
<dlclass="note"><dt><b>Note:</b></dt><dd>This type must be assignment compatible with the <code>chMemAlloc()</code> function. </dd></dl>
<p>Definition at line <aclass="el"href="chmemcore_8h_source.html#l00043">43</a> of file <aclass="el"href="chmemcore_8h_source.html">chmemcore.h</a>.</p>
<dlclass="note"><dt><b>Note:</b></dt><dd>Internal use only. </dd></dl>
<p>Definition at line <aclass="el"href="chmemcore_8c_source.html#l00062">62</a> of file <aclass="el"href="chmemcore_8c_source.html">chmemcore.c</a>.</p>
<p>References <aclass="el"href="group__config.html#gac73902e3c40b375483f9dde71e83253d">CH_MEMCORE_SIZE</a>, and <aclass="el"href="group__memcore.html#ga216a7738be23e0caa9d18e510eb795eb">MEM_ALIGN_SIZE</a>.</p>
<p>Referenced by <aclass="el"href="group__system.html#gafe2c7de6567e98e487e009e81e3be10b">chSysInit()</a>.</p>
<p>The size of the returned block is aligned to the alignment type <code><aclass="el"href="structstkalign__t.html"title="Base type for stack and memory alignment.">stkalign_t</a></code> so it is not possible to allocate less than <code>sizeof(stkalign_t)</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>size</em> </td><td>the size of the block to be allocated </td></tr>
</table>
</dd>
</dl>
<dlclass="return"><dt><b>Returns:</b></dt><dd>A pointer to the allocated memory block. </dd></dl>
<p>Definition at line <aclass="el"href="chmemcore_8c_source.html#l00088">88</a> of file <aclass="el"href="chmemcore_8c_source.html">chmemcore.c</a>.</p>
<p>References <aclass="el"href="group__memcore.html#ga30a45ff539c9ed5f2f4b1e87e72eb767">chCoreAllocI()</a>, <aclass="el"href="group__system.html#ga9f6573c0763d1e4e97c63c62edad6e42">chSysLock</a>, and <aclass="el"href="group__system.html#ga5a257fa58a09815eb64a45e2dfbdc22e">chSysUnlock</a>.</p>
<areashape="rect"id="node3"href="group__memcore.html#ga30a45ff539c9ed5f2f4b1e87e72eb767"title="Allocates a memory block."alt=""coords="136,5,219,32"/></map>
<p>The size of the returned block is aligned to the alignment type <code>align_t</code> so it is not possible to allocate less than <code>sizeof(align_t)</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>size</em> </td><td>the size of the block to be allocated. </td></tr>
</table>
</dd>
</dl>
<dlclass="return"><dt><b>Returns:</b></dt><dd>A pointer to the allocated memory block. </dd></dl>
<p>Definition at line <aclass="el"href="chmemcore_8c_source.html#l00107">107</a> of file <aclass="el"href="chmemcore_8c_source.html">chmemcore.c</a>.</p>
<dlclass="return"><dt><b>Returns:</b></dt><dd>The size, in bytes, of the free core memory. </dd></dl>
<p>Definition at line <aclass="el"href="chmemcore_8c_source.html#l00123">123</a> of file <aclass="el"href="chmemcore_8c_source.html">chmemcore.c</a>.</p>
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>