IPC API  3.40.00.06
HeapMemMP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
69 #ifndef ti_ipc_HeapMemMP__include
70 #define ti_ipc_HeapMemMP__include
71 
72 #if defined (__cplusplus)
73 extern "C" {
74 #endif
75 
76 #include <ti/ipc/GateMP.h>
77 
78 /* =============================================================================
79  * All success and failure codes for the module
80  * =============================================================================
81  */
82 
86 #define HeapMemMP_S_BUSY 2
87 
91 #define HeapMemMP_S_ALREADYSETUP 1
92 
96 #define HeapMemMP_S_SUCCESS 0
97 
101 #define HeapMemMP_E_FAIL -1
102 
106 #define HeapMemMP_E_INVALIDARG -2
107 
111 #define HeapMemMP_E_MEMORY -3
112 
116 #define HeapMemMP_E_ALREADYEXISTS -4
117 
121 #define HeapMemMP_E_NOTFOUND -5
122 
126 #define HeapMemMP_E_TIMEOUT -6
127 
131 #define HeapMemMP_E_INVALIDSTATE -7
132 
135 #define HeapMemMP_E_OSFAILURE -8
136 
139 #define HeapMemMP_E_RESOURCE -9
140 
143 #define HeapMemMP_E_RESTART -10
144 
145 /* =============================================================================
146  * Structures & Enums
147  * =============================================================================
148  */
149 
153 typedef struct HeapMemMP_Object *HeapMemMP_Handle;
154 
160 typedef struct HeapMemMP_Params {
161  String name;
172  UInt16 regionId;
180  Ptr sharedAddr;
212 
218 typedef struct HeapMemMP_ExtendedStats {
219  Ptr buf;
222  SizeT size;
225 
226 /* =============================================================================
227  * HeapMemMP Module-wide Functions
228  * =============================================================================
229  */
230 
246 Int HeapMemMP_close(HeapMemMP_Handle *handlePtr);
247 
257 HeapMemMP_Handle HeapMemMP_create(const HeapMemMP_Params *params);
258 
269 Int HeapMemMP_delete(HeapMemMP_Handle *handlePtr);
270 
295 Int HeapMemMP_open(String name, HeapMemMP_Handle *handlePtr);
296 
298 Int HeapMemMP_openByAddr(Ptr sharedAddr, HeapMemMP_Handle *handlePtr);
299 
310 
320 SizeT HeapMemMP_sharedMemReq(const HeapMemMP_Params *params);
321 
324 /* =============================================================================
325  * HeapMemMP Per-instance Functions
326  * =============================================================================
327  */
328 
354 Void *HeapMemMP_alloc(HeapMemMP_Handle handle, SizeT size, SizeT align);
355 
373 Void HeapMemMP_free(HeapMemMP_Handle handle, Ptr block, SizeT size);
374 
387 Void HeapMemMP_getExtendedStats(HeapMemMP_Handle handle,
388  HeapMemMP_ExtendedStats *stats);
389 
398 Void HeapMemMP_getStats(HeapMemMP_Handle handle, Ptr stats);
399 
410 Void HeapMemMP_restore(HeapMemMP_Handle handle);
411 
412 #if defined (__cplusplus)
413 }
414 #endif /* defined (__cplusplus) */
415 #endif /* ti_ipc_HeapMemMP__include */
Void HeapMemMP_free(HeapMemMP_Handle handle, Ptr block, SizeT size)
Frees a block of memory.
Int HeapMemMP_close(HeapMemMP_Handle *handlePtr)
Close a HeapMemMP instance.
Stats structure for HeapMemMP_getExtendedStats()
Definition: HeapMemMP.h:218
struct GateMP_Object * GateMP_Handle
GateMP_Handle type.
Definition: GateMP.h:222
Void * HeapMemMP_alloc(HeapMemMP_Handle handle, SizeT size, SizeT align)
Allocate a block of memory of specified size and alignment.
Void HeapMemMP_restore(HeapMemMP_Handle handle)
Restore an instance to it's original created state.
GateMP_Handle gate
Definition: HeapMemMP.h:204
struct HeapMemMP_Params HeapMemMP_Params
Structure defining parameters for the HeapMemMP module.
String name
Definition: HeapMemMP.h:161
Void HeapMemMP_getExtendedStats(HeapMemMP_Handle handle, HeapMemMP_ExtendedStats *stats)
Get extended memory statistics.
struct HeapMemMP_ExtendedStats HeapMemMP_ExtendedStats
Stats structure for HeapMemMP_getExtendedStats()
Multiple processor gate that provides local and remote context protection.
SizeT sharedBufSize
Definition: HeapMemMP.h:190
Int HeapMemMP_delete(HeapMemMP_Handle *handlePtr)
Delete a created HeapMemMP instance.
Void HeapMemMP_getStats(HeapMemMP_Handle handle, Ptr stats)
Get memory statistics.
struct HeapMemMP_Object * HeapMemMP_Handle
HeapMemMP_Handle type.
Definition: HeapMemMP.h:153
Structure defining parameters for the HeapMemMP module.
Definition: HeapMemMP.h:160
HeapMemMP_Handle HeapMemMP_create(const HeapMemMP_Params *params)
Create a HeapMemMP instance.
Ptr buf
Definition: HeapMemMP.h:219
UInt16 regionId
Definition: HeapMemMP.h:172
SizeT size
Definition: HeapMemMP.h:222
Int HeapMemMP_open(String name, HeapMemMP_Handle *handlePtr)
Open a created HeapMemMP instance.
Void HeapMemMP_Params_init(HeapMemMP_Params *params)
Initialize a HeapMemMP parameters struct.
Copyright 2015, Texas Instruments Incorporated