1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3
4<HEAD>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META http-equiv="Content-Style-Type" content="text/css">
7<META name="GENERATOR" content="Microsoft FrontPage 5.0">
8
9<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
10
11	<TITLE>MEMCreateUnitHeapEx</TITLE>
12
13</HEAD>
14
15
16<BODY>
17
18
19<H1>MEMCreateUnitHeapEx</H1>
20
21<H2>Syntax</H2>
22<DL><DD><PRE class="construction">#include &lt;revolution/mem.h&gt;
23
24MEMHeapHandle MEMCreateUnitHeapEx(
25                        void*       startAddress,
26                        u32         heapSize,
27                        u32         memBlockSize,
28                        u32         alignment,
29                        u16         optFlag );
30</PRE></DD></DL>
31
32<H2>Arguments</H2>
33<TABLE class="arguments" border="1">
34  <TR>
35<TH><STRONG><EM><CODE>startAddress</CODE></EM></STRONG></TH>
36<TD>Starting address of the memory region allocated to the heap.</TD>
37  </TR>
38  <TR>
39<TH><STRONG><EM><CODE>heapSize</CODE></EM></STRONG></TH>
40<TD>Size (in bytes) of the memory region allocated to the heap.</TD>
41  </TR>
42  <TR>
43<TH><STRONG><EM><CODE>memBlockSize</CODE></EM></STRONG></TH>
44<TD>Size (in bytes) of the memory block.</TD>
45  </TR>
46  <TR>
47<TH><STRONG><EM><CODE>alignment</CODE></EM></STRONG></TH>
48<TD>Memory block alignment. Can take any of the following values: 4, 8, 16, 32.</TD>
49  </TR>
50  <TR>
51<TH><STRONG><EM><CODE>optFlag</CODE></EM></STRONG></TH>
52<TD>Heap options (see details below).</TD>
53  </TR>
54</TABLE>
55
56<H2>Return Values</H2>
57<P>Returns the heap handle when a heap was successfully created. Returns <CODE>MEM_HEAP_INVALID_HANDLE</CODE> (a null value) if a heap could not be created.</P>
58
59<H2>Description</H2>
60<P>Creates the unit heap. The heap region is a memory region with size <SPAN class="argument">heapSize</SPAN> and a start address specified by <SPAN class="argument">startAddress</SPAN>.</P>
61<P>Each memory block has a fixed size specified by <SPAN class="argument">memBlockSize</SPAN>. Each memory block has an alignment specified by <SPAN class="argument">alignment</SPAN> with 4, 8, 16, and 32 as possible values.</P>
62<P>Heap options can be specified with <SPAN class="argument">optFlag</SPAN>.</P>
63<TABLE class="arguments" border="1">
64  <TBODY>
65    <TR>
66<TH><CODE>MEM_HEAP_OPT_0_CLEAR</CODE></TH>
67<TD>The allocated memory block is filled with zeroes upon allocation from the heap.</TD>
68    </TR>
69    <TR>
70<TH><CODE>MEM_HEAP_OPT_DEBUG_FILL</CODE></TH>
71<TD>Upon heap creation or whenever memory blocks are allocated or deallocated, each is filled with different 32-bit values in the memory region. This flag is used for debugging to find memory access bugs caused by either a failure to initialize memory or invalid memory regions. This option is not valid for the <code>FINALROM</code> version of the library.</TD>
72    </TR>
73    <TR>
74<TH><CODE>MEM_HEAP_OPT_THREAD_SAFE</CODE></TH>
75<TD>Enables exclusive processing between threads. <FONT color="red">(Note that this will not run safely if it is called during an interrupt.)</FONT>
76      </TD>
77    </TR>
78  </TBODY>
79</TABLE>
80
81<H2>See Also</H2>
82<P class="reference">
83<A href="MEMCreateUnitHeap.html">MEMCreateUnitHeap</A>
84</P>
85
86<H2>Revision History</H2>
87<P>
882007/08/20 Added a note regarding calling during interrupts.<BR>2006/03/01 Initial version.<BR>
89</P>
90
91<hr><p>CONFIDENTIAL</p></body>
92</HTML>