1 #include <xdc\std.h>
2 #include <xdc\runtime\IHeap.h>
4 #include "paf_heapMgr.h"
6 Int gPafHeapIdInt = PAF_HEAP_ID_INT;
7 Int gPafHeapIdInt1 = PAF_HEAP_ID_INT1;
8 Int gPafHeapIdExt = PAF_HEAP_ID_EXT;
9 Int gPafHeapIdInt1Shm = PAF_HEAP_ID_INT1_SHM;
10 Int gPafHeapIdExtShm = PAF_HEAP_ID_EXT_SHM;
12 // heap handle array
13 //static IHeap_Handle gHeapIdToHandle[PAF_NUM_HEAPS] =
14 IHeap_Handle gHeapIdToHandle[PAF_NUM_HEAPS] =
15 {
16 NULL,
17 NULL,
18 NULL,
19 NULL,
20 NULL
21 };
23 /* Initialize PAF heap manager */
24 Void pafHeapMgr_init(
25 IHeap_Handle hIntHeap,
26 IHeap_Handle hIntHeap1,
27 IHeap_Handle hExtHeap,
28 IHeap_Handle hIntHeap1Shm,
29 IHeap_Handle hExtHeapShm
30 )
31 {
32 gHeapIdToHandle[PAF_HEAP_ID_INT] = hIntHeap;
33 gHeapIdToHandle[PAF_HEAP_ID_INT1] = hIntHeap1;
34 gHeapIdToHandle[PAF_HEAP_ID_EXT] = hExtHeap;
35 gHeapIdToHandle[PAF_HEAP_ID_INT1_SHM] = hIntHeap1Shm;
36 gHeapIdToHandle[PAF_HEAP_ID_EXT_SHM] = hExtHeapShm;
37 }
39 /* Write heap handle to PAF heap manager for provided index */
40 Void pafHeapMgr_writeHeapHandle(
41 Int heapId,
42 IHeap_Handle hHeap
43 )
44 {
45 if (heapId < PAF_NUM_HEAPS)
46 {
47 gHeapIdToHandle[heapId] = hHeap;
48 }
49 }
51 /* Read heap handle from PAF heap manager for provided index */
52 IHeap_Handle pafHeapMgr_readHeapHandle(
53 Int heapId
54 )
55 {
56 IHeap_Handle hHeap;
58 if (heapId < PAF_NUM_HEAPS)
59 {
60 hHeap = gHeapIdToHandle[heapId];
61 }
62 else
63 {
64 hHeap = NULL;
65 }
67 return hHeap;
68 }