00001 /* 00002 * Copyright (c) 2010, Texas Instruments Incorporated 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * * Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 00012 * * Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 00016 * * Neither the name of Texas Instruments Incorporated nor the names of 00017 * its contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00022 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00023 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00024 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00026 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00027 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00028 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00029 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00030 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 * */ 00072 #ifndef ti_ipc_HeapMemMP__include 00073 #define ti_ipc_HeapMemMP__include 00074 00075 #if defined (__cplusplus) 00076 extern "C" { 00077 #endif 00078 00079 #include <ti/ipc/GateMP.h> 00080 00081 /* ============================================================================= 00082 * All success and failure codes for the module 00083 * ============================================================================= 00084 */ 00085 00090 #define HeapMemMP_S_BUSY 2 00091 00096 #define HeapMemMP_S_ALREADYSETUP 1 00097 00102 #define HeapMemMP_S_SUCCESS 0 00103 00108 #define HeapMemMP_E_FAIL -1 00109 00114 #define HeapMemMP_E_INVALIDARG -2 00115 00120 #define HeapMemMP_E_MEMORY -3 00121 00126 #define HeapMemMP_E_ALREADYEXISTS -4 00127 00132 #define HeapMemMP_E_NOTFOUND -5 00133 00138 #define HeapMemMP_E_TIMEOUT -6 00139 00144 #define HeapMemMP_E_INVALIDSTATE -7 00145 00149 #define HeapMemMP_E_OSFAILURE -8 00150 00154 #define HeapMemMP_E_RESOURCE -9 00155 00159 #define HeapMemMP_E_RESTART -10 00160 00161 /* ============================================================================= 00162 * Structures & Enums 00163 * ============================================================================= 00164 */ 00165 00169 typedef struct HeapMemMP_Object *HeapMemMP_Handle; 00170 00174 typedef struct HeapMemMP_Params { 00175 String name; 00186 UInt16 regionId; 00194 Ptr sharedAddr; 00205 SizeT sharedBufSize; 00219 GateMP_Handle gate; 00226 } HeapMemMP_Params; 00227 00231 typedef struct HeapMemMP_ExtendedStats { 00232 Ptr buf; 00235 SizeT size; 00237 } HeapMemMP_ExtendedStats; 00238 00239 /* ============================================================================= 00240 * HeapMemMP Module-wide Functions 00241 * ============================================================================= 00242 */ 00243 00253 Int HeapMemMP_close(HeapMemMP_Handle *handlePtr); 00254 00262 HeapMemMP_Handle HeapMemMP_create(const HeapMemMP_Params *params); 00263 00269 Int HeapMemMP_delete(HeapMemMP_Handle *handlePtr); 00270 00295 Int HeapMemMP_open(String name, HeapMemMP_Handle *handlePtr); 00296 00298 Int HeapMemMP_openByAddr(Ptr sharedAddr, HeapMemMP_Handle *handlePtr); 00299 00308 Void HeapMemMP_Params_init(HeapMemMP_Params *params); 00309 00319 SizeT HeapMemMP_sharedMemReq(const HeapMemMP_Params *params); 00320 00323 /* ============================================================================= 00324 * HeapMemMP Per-instance Functions 00325 * ============================================================================= 00326 */ 00327 00353 Void *HeapMemMP_alloc(HeapMemMP_Handle handle, SizeT size, SizeT align); 00354 00372 Void HeapMemMP_free(HeapMemMP_Handle handle, Ptr block, SizeT size); 00373 00386 Void HeapMemMP_getExtendedStats(HeapMemMP_Handle handle, 00387 HeapMemMP_ExtendedStats *stats); 00388 00397 Void HeapMemMP_getStats(HeapMemMP_Handle handle, Ptr stats); 00398 00409 Void HeapMemMP_restore(HeapMemMP_Handle handle); 00410 00411 #if defined (__cplusplus) 00412 } 00413 #endif /* defined (__cplusplus) */ 00414 #endif /* ti_ipc_HeapMemMP__include */ 00415 00416 /* 00417 */ 00418 00419 /* 00420 * @(#) ti.ipc; 1, 0, 0, 0,53; 12-15-2010 12:00:54; /db/vtree/library/trees/ipc/ipc.git/src/ ipc-f21 00421 */ 00422