Memory.h

Go to the documentation of this file.
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  * 
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 
00383 
00384 /*
00385  *  ======== Memory_free ========
00386  */
00412 extern Bool ti_sdo_ce_osal_Memory_free(Ptr addr, UInt size,
00413         ti_sdo_ce_osal_Memory_AllocParams *params);
00414 
00415 
00416 /*
00417  *  ======== Memory_getBufferPhysicalAddress ========
00418  */
00457 extern UInt32 ti_sdo_ce_osal_Memory_getBufferPhysicalAddress(Ptr virtualAddress,
00458     Int sizeInBytes, Bool *isContiguous);
00459 
00460 /*
00461  *  ======== Memory_getBufferVirtualAddress ========
00462  */
00498 extern Ptr ti_sdo_ce_osal_Memory_getBufferVirtualAddress(UInt32 physicalAddress,
00499     Int sizeInBytes);
00500 
00503 /*
00504  *  ======== Memory_init ========
00505  */
00506 extern Bool ti_sdo_ce_osal_Memory_init(Void);
00507 
00508 
00509 /*
00510  *  ======== Memory_exit ========
00511  */
00512 extern Void ti_sdo_ce_osal_Memory_exit(Void);
00513 
00519 /*
00520  *  ======== Memory_segAlloc ========
00521  */
00542 extern Ptr ti_sdo_ce_osal_Memory_segAlloc(Int segId, UInt size, UInt align);
00543 
00544 
00545 /*
00546  *  ======== Memory_segFree ========
00547  */
00576 extern Bool ti_sdo_ce_osal_Memory_segFree(Int segId, Ptr addr, UInt size);
00577 
00578 
00579 /*
00580  *  ======== Memory_segStat ========
00581  */
00603 extern Bool ti_sdo_ce_osal_Memory_segStat(Int segId,
00604         ti_sdo_ce_osal_Memory_Stat *statbuf);
00605 
00610 /*
00611  * ======== PREFIX ALIASES ========
00612  * Same strategy as XDC uses
00613  */
00614 #if !defined(__nested__) && !defined(ti_sdo_ce_osal_Memory__nolocalnames)
00615 
00616 /* module prefix */
00617 #define Memory_DEFAULTALIGNMENT ti_sdo_ce_osal_Memory_DEFAULTALIGNMENT
00618 #define Memory_GTNAME ti_sdo_ce_osal_Memory_GTNAME
00619 #define Memory_Stat ti_sdo_ce_osal_Memory_Stat
00620 #define Memory_type ti_sdo_ce_osal_Memory_type
00621 #define Memory_MALLOC ti_sdo_ce_osal_Memory_MALLOC
00622 #define Memory_SEG ti_sdo_ce_osal_Memory_SEG
00623 #define Memory_CONTIGPOOL ti_sdo_ce_osal_Memory_CONTIGPOOL
00624 #define Memory_CONTIGHEAP ti_sdo_ce_osal_Memory_CONTIGHEAP
00625 #define Memory_AllocParams ti_sdo_ce_osal_Memory_AllocParams
00626 #define Memory_CACHED ti_sdo_ce_osal_Memory_CACHED
00627 #define Memory_NONCACHED ti_sdo_ce_osal_Memory_NONCACHED
00628 #define Memory_CACHEDMASK ti_sdo_ce_osal_Memory_CACHEDMASK
00629 #define Memory_DEFAULTPARAMS ti_sdo_ce_osal_Memory_DEFAULTPARAMS
00630 
00631 #define Memory_alloc ti_sdo_ce_osal_Memory_alloc
00632 #define Memory_cacheInv ti_sdo_ce_osal_Memory_cacheInv
00633 #define Memory_cacheWb ti_sdo_ce_osal_Memory_cacheWb
00634 #define Memory_cacheWbInv ti_sdo_ce_osal_Memory_cacheWbInv
00635 #define Memory_cacheWbInvAll ti_sdo_ce_osal_Memory_cacheWbInvAll
00636 #define Memory_contigAlloc ti_sdo_ce_osal_Memory_contigAlloc
00637 #define Memory_contigFree ti_sdo_ce_osal_Memory_contigFree
00638 #define Memory_free ti_sdo_ce_osal_Memory_free
00639 #define Memory_getBufferPhysicalAddress ti_sdo_ce_osal_Memory_getBufferPhysicalAddress
00640 #define Memory_getBufferVirtualAddress ti_sdo_ce_osal_Memory_getBufferVirtualAddress
00641 #define Memory_init ti_sdo_ce_osal_Memory_init
00642 #define Memory_exit ti_sdo_ce_osal_Memory_exit
00643 #define Memory_segAlloc ti_sdo_ce_osal_Memory_segAlloc
00644 #define Memory_segFree ti_sdo_ce_osal_Memory_segFree
00645 #define Memory_segStat ti_sdo_ce_osal_Memory_segStat
00646 #endif
00647 
00651 
00652 #ifdef __cplusplus
00653 }
00654 #endif
00655 
00656 #endif
00657 /*
00658  *  @(#) ti.sdo.ce.osal; 2, 0, 2,421; 11-3-2010 22:20:35; /db/atree/library/trees/ce/ce-q16x/src/ xlibrary
00659 
00660  */
00661 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2010, Texas Instruments Incorporated