SysLink API Reference  2.21.03.11
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IpcMemMgr.h
Go to the documentation of this file.
1 
16 /*
17  * ============================================================================
18  *
19  * Copyright (c) 2008-2012, Texas Instruments Incorporated
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions
23  * are met:
24  *
25  * * Redistributions of source code must retain the above copyright
26  * notice, this list of conditions and the following disclaimer.
27  *
28  * * Redistributions in binary form must reproduce the above copyright
29  * notice, this list of conditions and the following disclaimer in the
30  * documentation and/or other materials provided with the distribution.
31  *
32  * * Neither the name of Texas Instruments Incorporated nor the names of
33  * its contributors may be used to endorse or promote products derived
34  * from this software without specific prior written permission.
35  *
36  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
38  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
40  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
41  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
42  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
43  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47  * Contact information for paper mail:
48  * Texas Instruments
49  * Post Office Box 655303
50  * Dallas, Texas 75265
51  * Contact information:
52  * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
53  * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
54  * ============================================================================
55  *
56  */
57 
58 
59 #ifndef ti_syslink_utils_IpcMemMgr__include
60 #define ti_syslink_utils_IpcMemMgr__include
61 
62 #include <ti/syslink/osal/OsalTypes.h>
63 
64 #if defined (__cplusplus)
65 extern "C" {
66 #endif
67 
68 
69 /* =============================================================================
70  * Macros
71  * =============================================================================
72  */
76 #define IpcMemMgr_MODULEID (0x434D)
77 
78 #define IpcMemMgr_S_NOTLAST 2
79 #define IpcMemMgr_S_ALREADYSETUP 1
80 #define IpcMemMgr_S_SUCCESS 0
81 #define IpcMemMgr_E_FAIL -1
82 #define IpcMemMgr_E_INVALIDSTATE -2
83 #define IpcMemMgr_E_INVALIDARG -3
84 #define IpcMemMgr_E_MEMORY -4
85 #define IpcMemMgr_E_OSFAILURE -5
86 #define IpcMemMgr_E_TOOMANYNAMEDALLOCS -6
87 #define IpcMemMgr_E_NOTFOUND -7
88 #define IpcMemMgr_E_WRONGSIZE -8
89 
90 #define IpcMemMgr_SHAREDMEMNAME "/syslink_shm"
91 #define IpcMemMgr_MAXNAMEDBUFFERS 256 /* max named buffers */
92 #define IpcMemMgr_MAX_NAMELEN 63 /* max name length */
93 
94 
95 /* =============================================================================
96  * Struct & Enums
97  * =============================================================================
98  */
99 /* Memory type */
100 typedef enum {
106 
110 typedef struct IpcMemMgr_Config_t {
111  UInt32 size;
114  /* minimum alignement for the buffer allocations */
116  /* shared memory offset for the process gate */
118 
123 
124 /* =============================================================================
125  * APIs
126  * =============================================================================
127  */
128 /* Function to setup the system memory maanger */
130 
131 /* setup the ipc memory manager module */
133 
134 /* destroy the ipc memory manager module */
136 
137 /* allocate anonymous shared memory */
138 // Ptr IpcMemMgr_alloc(UInt32 size, UInt32 reqAlign, IpcMemMgr_MemType memType);
140 
141 /* allocate memory by name */
142 //Int IpcMemMgr_allocByName(String name, SizeT size, Ptr *addr, Bool *newAlloc);
143 Int IpcMemMgr_acquire(String name, SizeT size, Ptr *addr, Bool *newAlloc);
144 
145 /* free memory anonymous memory */
146 Void IpcMemMgr_free(Ptr adr, SizeT size);
147 
148 /* free memory by name */
149 // Int IpcMemMgr_freeByName(String name);
151 
152 /* map memory based on kernel virtual address */
153 /* Ptr IpcMemMgr_map(Ptr hint, Ptr buf, UInt32 size); */
154 
155 /* unmap memory */
156 /* Int IpcMemMgr_unmap(Ptr buf, UInt32 size); */
157 
158 /*
159  * ======== IpcMemMgr_getPtr ========
160  * Convert the given shared memory offset into a local address pointer.
161  */
162 Ptr IpcMemMgr_getPtr(UInt32 offset);
163 
164 /*
165  * ======== IpcMemMgr_getOffset ========
166  * Convert the given local address pointer into an offset from the
167  * shared memory base address.
168  */
170 
171 /* allocate inter-process shared memory */
172 Ptr IpcMemMgr_allocShmemHeap(String name, UInt32 size, UInt32 align);
173 
174 /* free inter-process shared memory */
176 
177 /* free inter-process shared memory by name */
179 
181 
183 
184 
185 #if defined (__cplusplus)
186 }
187 #endif
188 
189 #endif /* ti_syslink_utils_IpcMemMgr__include */
Copyright 2014, Texas Instruments Incorporated