Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

SyslinkMemMgr.h

Go to the documentation of this file.
00001 /** 
00002  *  @file   SyslinkMemMgr.h
00003  *
00004  *  @brief  Header file implementing Memory manager . It is a wrapper
00005  *          implementation to support Shared memory allocation  using heap
00006  *          address translations  using shared region. or Tiler buffer
00007  *          allocation using tiler buffer manager and address translations.
00008  *
00009  *          Currently supports only shared Memory allocation using heap and
00010  *          shared region address translations.
00011  *
00012  *
00013  *  @ver        02.00.00.68_beta1
00014  *  
00015  *  ============================================================================
00016  *  
00017  *  Copyright (c) 2008-2009, Texas Instruments Incorporated
00018  *
00019  *  Redistribution and use in source and binary forms, with or without
00020  *  modification, are permitted provided that the following conditions
00021  *  are met:
00022  *  
00023  *  *  Redistributions of source code must retain the above copyright
00024  *     notice, this list of conditions and the following disclaimer.
00025  *  
00026  *  *  Redistributions in binary form must reproduce the above copyright
00027  *     notice, this list of conditions and the following disclaimer in the
00028  *     documentation and/or other materials provided with the distribution.
00029  *  
00030  *  *  Neither the name of Texas Instruments Incorporated nor the names of
00031  *     its contributors may be used to endorse or promote products derived
00032  *     from this software without specific prior written permission.
00033  *  
00034  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00035  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00036  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00037  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00038  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00039  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00040  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00041  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00042  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00043  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00044  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00045  *  Contact information for paper mail:
00046  *  Texas Instruments
00047  *  Post Office Box 655303
00048  *  Dallas, Texas 75265
00049  *  Contact information: 
00050  *  http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
00051  *  DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
00052  *  ============================================================================
00053  *  
00054  */
00055 
00056 
00057 #ifndef MEMMGR_H
00058 #define MEMMGR_H
00059 
00060 
00061 #if defined (__cplusplus)
00062 extern "C" {
00063 #endif
00064 
00065 #define MEMMGR_MAX_NAME_LENGTH               32u
00066 /* =============================================================================
00067  * Structures & Enums
00068  * =============================================================================
00069  */
00070 
00071 /*!
00072  *  @brief  Enumerations to indicate address types used for translation
00073  */
00074 typedef enum {
00075     SyslinkMemMgr_AddrType_Virtual = 0u,
00076     /*!< Virtual address on calling process on DSP where MMU is not configured
00077      *   it could be physical address.
00078      */
00079     SyslinkMemMgr_AddrType_Portable = 1u,
00080     /*!< This is the shared region address incase sharedmemory manager plugged
00081      *in to  frameQbufMgr. In case of tiler it could be the tiler specific
00082      *portable address*/
00083     SyslinkMemMgr_AddrType_EndValue = 2u
00084     /*!< End delimiter indicating start of invalid values for this enum */
00085 } SyslinkMemMgr_AddrType;
00086 
00087 /*!
00088  *  @brief  enum for denoting the different types of SyslinkMemMgr implementations.
00089  */
00090 typedef enum SyslinkMemMgr_Type_Type_tag {
00091     SyslinkMemMgr_TYPE_SHAREDMEM = 0x0,
00092     SyslinkMemMgr_TYPE_TILERMEM  = 0x1
00093 }SyslinkMemMgr_Type;
00094 
00095 
00096 /*!
00097  *  @brief  Structure defining common  create parameters for the Memory manager
00098  *          module.Should be the first element in implementation specific create
00099  *          params.
00100  */
00101 typedef struct SyslinkMemMgr_CreateParams_tag {
00102     UInt32          size;
00103      /*!< Size of the param structure  */
00104     SyslinkMemMgr_Type     memMgrType;
00105     /*!< type of implementation.*/
00106     UInt8           name[MEMMGR_MAX_NAME_LENGTH];
00107      /*!< Name of the instance */
00108 } SyslinkMemMgr_CreateParams;
00109 
00110 #define SyslinkMemMgr_Params SyslinkMemMgr_CreateParams
00111 
00112 typedef struct SyslinkMemMgr_freeParams_tag {
00113         Ptr    ptr;
00114         UInt32 size;
00115 }SyslinkMemMgr_freeParams;
00116 /*!
00117  *  @brief  Forward declaration of structure defining object for the
00118  *          MemoryManger.
00119  */
00120 typedef struct SyslinkMemMgr_Object SyslinkMemMgr_Object;
00121 
00122 /*!
00123  *  @brief  Handle for the MemoryManager instance.
00124  */
00125 typedef struct SyslinkMemMgr_Object * SyslinkMemMgr_Handle;
00126 
00127 /* =============================================================================
00128  * APIs
00129  * =============================================================================
00130  */
00131 /* Function to setup the SyslinkMemMgr module */
00132 Int32
00133 SyslinkMemMgr_setup (Void);
00134 
00135 /* Function to setup the SyslinkMemMgr module */
00136 Int32
00137 SyslinkMemMgr_destroy(Void);
00138 
00139 /* Function to create a SyslinkMemMgr instance */
00140 SyslinkMemMgr_Handle
00141 SyslinkMemMgr_create (Ptr params);
00142 
00143 /* Function to delete the created Memory Manager  instance*/
00144 Int32
00145 SyslinkMemMgr_delete (SyslinkMemMgr_Handle * pHandle);
00146 
00147 
00148 /* Function to allocate memory from the SyslinkMemMgr */
00149 Ptr
00150 SyslinkMemMgr_alloc (SyslinkMemMgr_Handle handle, UInt32 size, UInt32 align);
00151 
00152 /* Function to allocate memory from the SyslinkMemMgr */
00153 Int32
00154 SyslinkMemMgr_free (SyslinkMemMgr_Handle handle, Ptr ptr, UInt32 size);
00155 
00156 /* Function to map. not used for shared memory*/
00157 Ptr
00158 SyslinkMemMgr_map (SyslinkMemMgr_Handle handle, Ptr arg);
00159 
00160 /* Function to do unmap */
00161 Int32
00162 SyslinkMemMgr_unmap (SyslinkMemMgr_Handle handle, Ptr arg);
00163 
00164 /* Function to translate source address to destination address type */
00165 Ptr
00166 SyslinkMemMgr_translate (SyslinkMemMgr_Handle   handle,
00167                   Ptr             srcAddr,
00168                   SyslinkMemMgr_AddrType srcAddrType,
00169                   SyslinkMemMgr_AddrType desAddrType);
00170 
00171 /* Function to return the kernel space instance handle pointer when user space
00172  * instance handle is passed
00173  */
00174 Ptr
00175 SyslinkMemMgr_getKnlHandle (SyslinkMemMgr_Handle handle);
00176 
00177 #if defined (__cplusplus)
00178 }
00179 #endif /* defined (__cplusplus) */
00180 
00181 
00182 #endif /**/

Generated on Mon Mar 14 11:59:45 2011 for Syslink by  doxygen 1.4.4