packages/ti/sdo/ce/osal/Memory.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2012, 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  * 
00032  */
00033 /*
00034  *  ======== Memory.h ========
00035  */
00051 #ifndef ti_sdo_ce_osal_Memory_
00052 #define ti_sdo_ce_osal_Memory_
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00060 
00068 #define ti_sdo_ce_osal_Memory_DEFAULTALIGNMENT ((UInt)(-1))
00069 
00078 #define Memory_MODNAME "ti.sdo.ce.osal.Memory"
00079 
00085 #define ti_sdo_ce_osal_Memory_GTNAME "OM"
00086 
00096 typedef struct ti_sdo_ce_osal_Memory_Stat {
00097     String name;     
00098     Uint32 base;     
00099     UInt size;       
00100     UInt used;       
00101     UInt length;     
00102 } ti_sdo_ce_osal_Memory_Stat;
00103 
00113 typedef enum {
00114     ti_sdo_ce_osal_Memory_MALLOC = 0,   
00118     ti_sdo_ce_osal_Memory_SEG = 1,      
00122     ti_sdo_ce_osal_Memory_CONTIGPOOL = 2, 
00126     ti_sdo_ce_osal_Memory_CONTIGHEAP =3 
00130 } ti_sdo_ce_osal_Memory_type;
00131 
00140 typedef struct ti_sdo_ce_osal_Memory_AllocParams {
00141     ti_sdo_ce_osal_Memory_type type;    
00145     UInt flags;         
00161     UInt align;         
00162     UInt seg;           
00163 } ti_sdo_ce_osal_Memory_AllocParams;
00164 
00165 
00173 #define ti_sdo_ce_osal_Memory_CACHED    0x00000000
00174 
00182 #define ti_sdo_ce_osal_Memory_NONCACHED 0x00000001
00183 
00191 #define ti_sdo_ce_osal_Memory_CACHEDMASK 0x00000001
00192 
00217 extern ti_sdo_ce_osal_Memory_AllocParams ti_sdo_ce_osal_Memory_DEFAULTPARAMS;
00218 
00219 /*
00220  *  ======== Memory_alloc ========
00221  */
00237 extern Ptr ti_sdo_ce_osal_Memory_alloc(UInt size,
00238         ti_sdo_ce_osal_Memory_AllocParams *params);
00239 
00240 /*
00241  *  ======== Memory_cacheInv ========
00242  */
00261 extern Void ti_sdo_ce_osal_Memory_cacheInv(Ptr addr, Int sizeInBytes);
00262 
00263 
00264 /*
00265  *  ======== Memory_cacheWb ========
00266  */
00279 extern Void ti_sdo_ce_osal_Memory_cacheWb(Ptr addr, Int sizeInBytes);
00280 
00281 
00282 /*
00283  *  ======== Memory_cacheWbInv ========
00284  */
00297 extern Void ti_sdo_ce_osal_Memory_cacheWbInv(Ptr addr, Int sizeInBytes);
00298 
00299 
00300 /*
00301  *  ======== Memory_cacheWbInvAll ========
00302  */
00313 extern Void ti_sdo_ce_osal_Memory_cacheWbInvAll();
00314 
00315 
00316 /*
00317  *  ======== Memory_contigAlloc ========
00318  */
00353 extern Ptr ti_sdo_ce_osal_Memory_contigAlloc(UInt size, UInt align);
00354 
00355 
00356 /*
00357  *  ======== Memory_contigFree ========
00358  */
00380 extern Bool ti_sdo_ce_osal_Memory_contigFree(Ptr addr, UInt size);
00381 
00382 
00385 /*
00386  *  ======== Memory_contigStat ========
00387  */
00406 extern Bool ti_sdo_ce_osal_Memory_contigStat(ti_sdo_ce_osal_Memory_Stat *stat);
00407 
00411 /*
00412  *  ======== Memory_free ========
00413  */
00439 extern Bool ti_sdo_ce_osal_Memory_free(Ptr addr, UInt size,
00440         ti_sdo_ce_osal_Memory_AllocParams *params);
00441 
00442 
00443 /*
00444  *  ======== Memory_dumpKnownContigBufs ========
00445  */
00461 extern Void ti_sdo_ce_osal_Memory_dumpKnownContigBufsList(Void);
00462 
00463 
00464 /*
00465  *  ======== Memory_getBufferPhysicalAddress ========
00466  */
00505 extern UInt32 ti_sdo_ce_osal_Memory_getBufferPhysicalAddress(Ptr virtualAddress,
00506     Int sizeInBytes, Bool *isContiguous);
00507 
00508 /*
00509  *  ======== Memory_getHeapId ========
00510  */
00525 extern Int ti_sdo_ce_osal_Memory_getHeapId(String name);
00526 
00527 /*
00528  *  ======== Memory_getNumHeaps ========
00529  */
00538 extern Int ti_sdo_ce_osal_Memory_getNumHeaps();
00539 
00540 
00541 /*
00542  *  ======== Memory_getBufferVirtualAddress ========
00543  */
00579 extern Ptr ti_sdo_ce_osal_Memory_getBufferVirtualAddress(UInt32 physicalAddress,
00580     Int sizeInBytes);
00581 
00584 /*
00585  *  ======== Memory_init ========
00586  */
00587 extern Bool ti_sdo_ce_osal_Memory_init(Void);
00588 
00589 
00590 /*
00591  *  ======== Memory_exit ========
00592  */
00593 extern Void ti_sdo_ce_osal_Memory_exit(Void);
00594 
00595 
00598 /*
00599  *  ======== Memory_registerContigBuf ========
00600  */
00630 extern Void ti_sdo_ce_osal_Memory_registerContigBuf(UInt32 virtualAddress,
00631         UInt32 sizeInBytes, UInt32 physicalAddress);
00632 
00635 #define Memory_redefine ti_sdo_ce_osal_Memory_redefine
00636 /*
00637  *  ======== Memory_redefine ========
00638  */
00655 extern Bool ti_sdo_ce_osal_Memory_redefine(Int segId, Uint32 base, Uint32 size);
00656 
00657 /*
00658  *  ======== Memory_restoreHeap ========
00659  */
00673 extern Bool ti_sdo_ce_osal_Memory_restoreHeap(Int segId);
00674 
00675 /*
00676  *  ======== Memory_segAlloc ========
00677  */
00698 extern Ptr ti_sdo_ce_osal_Memory_segAlloc(Int segId, UInt size, UInt align);
00699 
00700 
00701 /*
00702  *  ======== Memory_segFree ========
00703  */
00732 extern Bool ti_sdo_ce_osal_Memory_segFree(Int segId, Ptr addr, UInt size);
00733 
00734 
00735 /*
00736  *  ======== Memory_segStat ========
00737  */
00759 extern Bool ti_sdo_ce_osal_Memory_segStat(Int segId,
00760         ti_sdo_ce_osal_Memory_Stat *statbuf);
00761 
00764 /*
00765  *  ======== Memory_unregisterContigBuf ========
00766  */
00783 extern Void ti_sdo_ce_osal_Memory_unregisterContigBuf(UInt32 virtualAddress,
00784     UInt32 sizeInBytes);
00785 
00788 /*
00789  * ======== PREFIX ALIASES ========
00790  * Same strategy as XDC uses
00791  */
00792 #if !defined(__nested__) && !defined(ti_sdo_ce_osal_Memory__nolocalnames)
00793 
00794 /* module prefix */
00795 #define Memory_DEFAULTALIGNMENT ti_sdo_ce_osal_Memory_DEFAULTALIGNMENT
00796 #define Memory_GTNAME ti_sdo_ce_osal_Memory_GTNAME
00797 #define Memory_Stat ti_sdo_ce_osal_Memory_Stat
00798 #define Memory_type ti_sdo_ce_osal_Memory_type
00799 #define Memory_MALLOC ti_sdo_ce_osal_Memory_MALLOC
00800 #define Memory_SEG ti_sdo_ce_osal_Memory_SEG
00801 #define Memory_CONTIGPOOL ti_sdo_ce_osal_Memory_CONTIGPOOL
00802 #define Memory_CONTIGHEAP ti_sdo_ce_osal_Memory_CONTIGHEAP
00803 #define Memory_AllocParams ti_sdo_ce_osal_Memory_AllocParams
00804 #define Memory_CACHED ti_sdo_ce_osal_Memory_CACHED
00805 #define Memory_NONCACHED ti_sdo_ce_osal_Memory_NONCACHED
00806 #define Memory_CACHEDMASK ti_sdo_ce_osal_Memory_CACHEDMASK
00807 #define Memory_DEFAULTPARAMS ti_sdo_ce_osal_Memory_DEFAULTPARAMS
00808 
00809 #define Memory_alloc ti_sdo_ce_osal_Memory_alloc
00810 #define Memory_cacheInv ti_sdo_ce_osal_Memory_cacheInv
00811 #define Memory_cacheWb ti_sdo_ce_osal_Memory_cacheWb
00812 #define Memory_cacheWbInv ti_sdo_ce_osal_Memory_cacheWbInv
00813 #define Memory_cacheWbInvAll ti_sdo_ce_osal_Memory_cacheWbInvAll
00814 #define Memory_contigAlloc ti_sdo_ce_osal_Memory_contigAlloc
00815 #define Memory_contigFree ti_sdo_ce_osal_Memory_contigFree
00816 #define Memory_free ti_sdo_ce_osal_Memory_free
00817 #define Memory_getBufferPhysicalAddress ti_sdo_ce_osal_Memory_getBufferPhysicalAddress
00818 #define Memory_getBufferVirtualAddress ti_sdo_ce_osal_Memory_getBufferVirtualAddress
00819 #define Memory_getHeapId ti_sdo_ce_osal_Memory_getHeapId
00820 #define Memory_getNumHeaps ti_sdo_ce_osal_Memory_getNumHeaps
00821 #define Memory_init ti_sdo_ce_osal_Memory_init
00822 #define Memory_exit ti_sdo_ce_osal_Memory_exit
00823 #define Memory_redefine ti_sdo_ce_osal_Memory_redefine
00824 #define Memory_restoreHeap ti_sdo_ce_osal_Memory_restoreHeap
00825 #define Memory_segAlloc ti_sdo_ce_osal_Memory_segAlloc
00826 #define Memory_segFree ti_sdo_ce_osal_Memory_segFree
00827 #define Memory_segStat ti_sdo_ce_osal_Memory_segStat
00828 #endif
00829 
00833 
00834 #ifdef __cplusplus
00835 }
00836 #endif
00837 
00838 #endif
00839 /*
00840  *  @(#) ti.sdo.ce.osal; 2, 0, 2,1; 1-17-2012 23:15:26; /db/atree/library/trees/ce/ce-t03/src/ xlibrary
00841 
00842  */
00843 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2012, Texas Instruments Incorporated