00001 /* 00002 * Copyright (c) 2011, 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 * */ 00071 #ifndef ti_ipc_HeapBufMP__include 00072 #define ti_ipc_HeapBufMP__include 00073 00074 #if defined (__cplusplus) 00075 extern "C" { 00076 #endif 00077 00078 #include <ti/ipc/GateMP.h> 00079 00080 /* ============================================================================= 00081 * All success and failure codes for the module 00082 * ============================================================================= 00083 */ 00084 00089 #define HeapBufMP_S_BUSY 2 00090 00095 #define HeapBufMP_S_ALREADYSETUP 1 00096 00101 #define HeapBufMP_S_SUCCESS 0 00102 00107 #define HeapBufMP_E_FAIL -1 00108 00113 #define HeapBufMP_E_INVALIDARG -2 00114 00119 #define HeapBufMP_E_MEMORY -3 00120 00125 #define HeapBufMP_E_ALREADYEXISTS -4 00126 00131 #define HeapBufMP_E_NOTFOUND -5 00132 00137 #define HeapBufMP_E_TIMEOUT -6 00138 00143 #define HeapBufMP_E_INVALIDSTATE -7 00144 00148 #define HeapBufMP_E_OSFAILURE -8 00149 00153 #define HeapBufMP_E_RESOURCE -9 00154 00158 #define HeapBufMP_E_RESTART -10 00159 00160 /* ============================================================================= 00161 * Structures & Enums 00162 * ============================================================================= 00163 */ 00164 00168 typedef struct HeapBufMP_Object *HeapBufMP_Handle; 00169 00173 typedef struct HeapBufMP_Params { 00174 String name; 00185 UInt16 regionId; 00193 Ptr sharedAddr; 00203 SizeT blockSize; 00216 UInt numBlocks; 00222 SizeT align; 00233 Bool exact; 00241 GateMP_Handle gate; 00248 } HeapBufMP_Params; 00249 00253 typedef struct HeapBufMP_ExtendedStats { 00254 UInt maxAllocatedBlocks; 00259 UInt numAllocatedBlocks; 00263 } HeapBufMP_ExtendedStats; 00264 00265 /* ============================================================================= 00266 * HeapBufMP Module-wide Functions 00267 * ============================================================================= 00268 */ 00269 00281 Int HeapBufMP_close(HeapBufMP_Handle *handlePtr); 00282 00290 HeapBufMP_Handle HeapBufMP_create(const HeapBufMP_Params *params); 00291 00297 Int HeapBufMP_delete(HeapBufMP_Handle *handlePtr); 00298 00323 Int HeapBufMP_open(String name, HeapBufMP_Handle *handlePtr); 00324 00326 Int HeapBufMP_openByAddr(Ptr sharedAddr, HeapBufMP_Handle *handlePtr); 00327 00336 Void HeapBufMP_Params_init(HeapBufMP_Params *params); 00337 00347 SizeT HeapBufMP_sharedMemReq(const HeapBufMP_Params *params); 00348 00351 /* ============================================================================= 00352 * HeapBufMP Per-instance Functions 00353 * ============================================================================= 00354 */ 00355 00381 Void *HeapBufMP_alloc(HeapBufMP_Handle handle, SizeT size, SizeT align); 00382 00400 Void HeapBufMP_free(HeapBufMP_Handle handle, Ptr block, SizeT size); 00401 00415 Void HeapBufMP_getExtendedStats(HeapBufMP_Handle handle, 00416 HeapBufMP_ExtendedStats *stats); 00417 00426 Void HeapBufMP_getStats(HeapBufMP_Handle handle, Ptr stats); 00427 00428 #if defined (__cplusplus) 00429 } 00430 #endif /* defined (__cplusplus) */ 00431 #endif /* ti_ipc_HeapBufMP__include */ 00432 00433 /* 00434 */ 00435 00436 /* 00437 * @(#) ti.ipc; 1, 0, 0, 0,70; 2-11-2011 19:18:12; /db/vtree/library/trees/ipc/ipc.git/src/ ipc-f25 00438 */ 00439