![]() |
![]() |
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 * */ 00100 #ifndef ti_ipc_HeapMultiBufMP__include 00101 #define ti_ipc_HeapMultiBufMP__include 00102 00103 #if defined (__cplusplus) 00104 extern "C" { 00105 #endif 00106 00107 #include <ti/ipc/GateMP.h> 00108 00109 /* ============================================================================= 00110 * All success and failure codes for the module 00111 * ============================================================================= 00112 */ 00113 00118 #define HeapMultiBufMP_S_BUSY 2 00119 00124 #define HeapMultiBufMP_S_ALREADYSETUP 1 00125 00130 #define HeapMultiBufMP_S_SUCCESS 0 00131 00136 #define HeapMultiBufMP_E_FAIL -1 00137 00142 #define HeapMultiBufMP_E_INVALIDARG -2 00143 00148 #define HeapMultiBufMP_E_MEMORY -3 00149 00154 #define HeapMultiBufMP_E_ALREADYEXISTS -4 00155 00160 #define HeapMultiBufMP_E_NOTFOUND -5 00161 00166 #define HeapMultiBufMP_E_TIMEOUT -6 00167 00172 #define HeapMultiBufMP_E_INVALIDSTATE -7 00173 00177 #define HeapMultiBufMP_E_OSFAILURE -8 00178 00182 #define HeapMultiBufMP_E_RESOURCE -9 00183 00187 #define HeapMultiBufMP_E_RESTART -10 00188 00189 /* ============================================================================= 00190 * Macros 00191 * ============================================================================= 00192 */ 00193 00198 #define HeapMultiBufMP_MAXBUCKETS ((UInt)8) 00199 00200 /* ============================================================================= 00201 * Structures & Enums 00202 * ============================================================================= 00203 */ 00204 00208 typedef struct HeapMultiBufMP_Object *HeapMultiBufMP_Handle; 00209 00219 typedef struct HeapMultiBufMP_Bucket { 00220 SizeT blockSize; 00221 UInt numBlocks; 00222 SizeT align; 00223 } HeapMultiBufMP_Bucket; 00224 00228 typedef struct HeapMultiBufMP_Params { 00229 GateMP_Handle gate; 00236 Bool exact; 00243 String name; 00251 Int numBuckets; 00257 HeapMultiBufMP_Bucket *bucketEntries; 00275 UInt16 regionId; 00283 Ptr sharedAddr; 00294 } HeapMultiBufMP_Params; 00295 00299 typedef struct HeapMultiBufMP_ExtendedStats { 00300 UInt numBuckets; 00303 UInt numBlocks [HeapMultiBufMP_MAXBUCKETS]; 00306 UInt blockSize [HeapMultiBufMP_MAXBUCKETS]; 00309 UInt align [HeapMultiBufMP_MAXBUCKETS]; 00312 UInt maxAllocatedBlocks [HeapMultiBufMP_MAXBUCKETS]; 00317 UInt numAllocatedBlocks [HeapMultiBufMP_MAXBUCKETS]; 00322 } HeapMultiBufMP_ExtendedStats; 00323 00324 /* ============================================================================= 00325 * HeapMultiBufMP Module-wide Functions 00326 * ============================================================================= 00327 */ 00328 00341 Int HeapMultiBufMP_close(HeapMultiBufMP_Handle *handlePtr); 00342 00350 HeapMultiBufMP_Handle HeapMultiBufMP_create(const HeapMultiBufMP_Params *params); 00351 00357 Int HeapMultiBufMP_delete(HeapMultiBufMP_Handle *handlePtr); 00358 00383 Int HeapMultiBufMP_open(String name, HeapMultiBufMP_Handle *handlePtr); 00384 00386 Int HeapMultiBufMP_openByAddr(Ptr sharedAddr, HeapMultiBufMP_Handle *handlePtr); 00387 00396 Void HeapMultiBufMP_Params_init(HeapMultiBufMP_Params *params); 00397 00407 SizeT HeapMultiBufMP_sharedMemReq(const HeapMultiBufMP_Params *params); 00408 00411 /* ============================================================================= 00412 * HeapMultiBufMP Per-instance Functions 00413 * ============================================================================= 00414 */ 00415 00425 Void *HeapMultiBufMP_alloc(HeapMultiBufMP_Handle handle, SizeT size, 00426 SizeT align); 00427 00437 Void HeapMultiBufMP_free(HeapMultiBufMP_Handle handle, Ptr block, SizeT size); 00438 00452 Void HeapMultiBufMP_getExtendedStats(HeapMultiBufMP_Handle handle, 00453 HeapMultiBufMP_ExtendedStats *stats); 00454 00463 Void HeapMultiBufMP_getStats(HeapMultiBufMP_Handle handle, Ptr stats); 00464 00465 #if defined (__cplusplus) 00466 } 00467 #endif /* defined (__cplusplus) */ 00468 #endif /* ti_ipc_HeapMultiBufMP__include */ 00469 00470 /* 00471 */ 00472 00473 /* 00474 * @(#) ti.ipc; 1, 0, 0, 0,83; 4-9-2010 18:37:32; /db/vtree/library/trees/ipc/ipc-d23x/src/ 00475 */ 00476