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 * */ 00105 #ifndef ti_ipc_HeapMultiBufMP__include 00106 #define ti_ipc_HeapMultiBufMP__include 00107 00108 #if defined (__cplusplus) 00109 extern "C" { 00110 #endif 00111 00112 #include <ti/ipc/GateMP.h> 00113 00114 /* ============================================================================= 00115 * All success and failure codes for the module 00116 * ============================================================================= 00117 */ 00118 00123 #define HeapMultiBufMP_S_BUSY 2 00124 00129 #define HeapMultiBufMP_S_ALREADYSETUP 1 00130 00135 #define HeapMultiBufMP_S_SUCCESS 0 00136 00141 #define HeapMultiBufMP_E_FAIL -1 00142 00147 #define HeapMultiBufMP_E_INVALIDARG -2 00148 00153 #define HeapMultiBufMP_E_MEMORY -3 00154 00159 #define HeapMultiBufMP_E_ALREADYEXISTS -4 00160 00165 #define HeapMultiBufMP_E_NOTFOUND -5 00166 00171 #define HeapMultiBufMP_E_TIMEOUT -6 00172 00177 #define HeapMultiBufMP_E_INVALIDSTATE -7 00178 00182 #define HeapMultiBufMP_E_OSFAILURE -8 00183 00187 #define HeapMultiBufMP_E_RESOURCE -9 00188 00192 #define HeapMultiBufMP_E_RESTART -10 00193 00194 /* ============================================================================= 00195 * Macros 00196 * ============================================================================= 00197 */ 00198 00203 #define HeapMultiBufMP_MAXBUCKETS ((UInt)8) 00204 00205 /* ============================================================================= 00206 * Structures & Enums 00207 * ============================================================================= 00208 */ 00209 00213 typedef struct HeapMultiBufMP_Object *HeapMultiBufMP_Handle; 00214 00224 typedef struct HeapMultiBufMP_Bucket { 00225 SizeT blockSize; 00226 UInt numBlocks; 00227 SizeT align; 00228 } HeapMultiBufMP_Bucket; 00229 00233 typedef struct HeapMultiBufMP_Params { 00234 GateMP_Handle gate; 00241 Bool exact; 00248 String name; 00259 Int numBuckets; 00265 HeapMultiBufMP_Bucket *bucketEntries; 00283 UInt16 regionId; 00291 Ptr sharedAddr; 00302 } HeapMultiBufMP_Params; 00303 00307 typedef struct HeapMultiBufMP_ExtendedStats { 00308 UInt numBuckets; 00311 UInt numBlocks [HeapMultiBufMP_MAXBUCKETS]; 00314 UInt blockSize [HeapMultiBufMP_MAXBUCKETS]; 00317 UInt align [HeapMultiBufMP_MAXBUCKETS]; 00320 UInt maxAllocatedBlocks [HeapMultiBufMP_MAXBUCKETS]; 00325 UInt numAllocatedBlocks [HeapMultiBufMP_MAXBUCKETS]; 00330 } HeapMultiBufMP_ExtendedStats; 00331 00332 /* ============================================================================= 00333 * HeapMultiBufMP Module-wide Functions 00334 * ============================================================================= 00335 */ 00336 00349 Int HeapMultiBufMP_close(HeapMultiBufMP_Handle *handlePtr); 00350 00358 HeapMultiBufMP_Handle HeapMultiBufMP_create(const HeapMultiBufMP_Params *params); 00359 00365 Int HeapMultiBufMP_delete(HeapMultiBufMP_Handle *handlePtr); 00366 00391 Int HeapMultiBufMP_open(String name, HeapMultiBufMP_Handle *handlePtr); 00392 00394 Int HeapMultiBufMP_openByAddr(Ptr sharedAddr, HeapMultiBufMP_Handle *handlePtr); 00395 00404 Void HeapMultiBufMP_Params_init(HeapMultiBufMP_Params *params); 00405 00415 SizeT HeapMultiBufMP_sharedMemReq(const HeapMultiBufMP_Params *params); 00416 00419 /* ============================================================================= 00420 * HeapMultiBufMP Per-instance Functions 00421 * ============================================================================= 00422 */ 00423 00433 Void *HeapMultiBufMP_alloc(HeapMultiBufMP_Handle handle, SizeT size, 00434 SizeT align); 00435 00445 Void HeapMultiBufMP_free(HeapMultiBufMP_Handle handle, Ptr block, SizeT size); 00446 00460 Void HeapMultiBufMP_getExtendedStats(HeapMultiBufMP_Handle handle, 00461 HeapMultiBufMP_ExtendedStats *stats); 00462 00471 Void HeapMultiBufMP_getStats(HeapMultiBufMP_Handle handle, Ptr stats); 00472 00473 #if defined (__cplusplus) 00474 } 00475 #endif /* defined (__cplusplus) */ 00476 #endif /* ti_ipc_HeapMultiBufMP__include */ 00477 00478 /* 00479 */ 00480 00481 /* 00482 * @(#) ti.ipc; 1, 0, 0, 0,1; 10-10-2011 13:56:00; /db/vtree/library/trees/ipc/ipc.git/src/ null 00483 */ 00484