![]() |
![]() |
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 * */ 00066 #ifndef ti_ipc_HeapBufMP__include 00067 #define ti_ipc_HeapBufMP__include 00068 00069 #if defined (__cplusplus) 00070 extern "C" { 00071 #endif 00072 00073 #include <ti/ipc/GateMP.h> 00074 00075 /* ============================================================================= 00076 * All success and failure codes for the module 00077 * ============================================================================= 00078 */ 00079 00084 #define HeapBufMP_S_BUSY 2 00085 00090 #define HeapBufMP_S_ALREADYSETUP 1 00091 00096 #define HeapBufMP_S_SUCCESS 0 00097 00102 #define HeapBufMP_E_FAIL -1 00103 00108 #define HeapBufMP_E_INVALIDARG -2 00109 00114 #define HeapBufMP_E_MEMORY -3 00115 00120 #define HeapBufMP_E_ALREADYEXISTS -4 00121 00126 #define HeapBufMP_E_NOTFOUND -5 00127 00132 #define HeapBufMP_E_TIMEOUT -6 00133 00138 #define HeapBufMP_E_INVALIDSTATE -7 00139 00143 #define HeapBufMP_E_OSFAILURE -8 00144 00148 #define HeapBufMP_E_RESOURCE -9 00149 00153 #define HeapBufMP_E_RESTART -10 00154 00155 /* ============================================================================= 00156 * Structures & Enums 00157 * ============================================================================= 00158 */ 00159 00163 typedef struct HeapBufMP_Object *HeapBufMP_Handle; 00164 00168 typedef struct HeapBufMP_Params { 00169 String name; 00177 UInt16 regionId; 00185 Ptr sharedAddr; 00195 SizeT blockSize; 00208 UInt numBlocks; 00214 SizeT align; 00225 Bool exact; 00233 GateMP_Handle gate; 00240 } HeapBufMP_Params; 00241 00245 typedef struct HeapBufMP_ExtendedStats { 00246 UInt maxAllocatedBlocks; 00251 UInt numAllocatedBlocks; 00255 } HeapBufMP_ExtendedStats; 00256 00257 /* ============================================================================= 00258 * HeapBufMP Module-wide Functions 00259 * ============================================================================= 00260 */ 00261 00273 Int HeapBufMP_close(HeapBufMP_Handle *handlePtr); 00274 00282 HeapBufMP_Handle HeapBufMP_create(const HeapBufMP_Params *params); 00283 00289 Int HeapBufMP_delete(HeapBufMP_Handle *handlePtr); 00290 00315 Int HeapBufMP_open(String name, HeapBufMP_Handle *handlePtr); 00316 00318 Int HeapBufMP_openByAddr(Ptr sharedAddr, HeapBufMP_Handle *handlePtr); 00319 00328 Void HeapBufMP_Params_init(HeapBufMP_Params *params); 00329 00339 SizeT HeapBufMP_sharedMemReq(const HeapBufMP_Params *params); 00340 00343 /* ============================================================================= 00344 * HeapBufMP Per-instance Functions 00345 * ============================================================================= 00346 */ 00347 00373 Void *HeapBufMP_alloc(HeapBufMP_Handle handle, SizeT size, SizeT align); 00374 00392 Void HeapBufMP_free(HeapBufMP_Handle handle, Ptr block, SizeT size); 00393 00407 Void HeapBufMP_getExtendedStats(HeapBufMP_Handle handle, 00408 HeapBufMP_ExtendedStats *stats); 00409 00418 Void HeapBufMP_getStats(HeapBufMP_Handle handle, Ptr stats); 00419 00420 #if defined (__cplusplus) 00421 } 00422 #endif /* defined (__cplusplus) */ 00423 #endif /* ti_ipc_HeapBufMP__include */ 00424 00425 /* 00426 */ 00427 00428 /* 00429 * @(#) ti.ipc; 1, 0, 0, 0,83; 4-9-2010 18:37:32; /db/vtree/library/trees/ipc/ipc-d23x/src/ 00430 */ 00431