00001 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 00058 #ifndef MEMMGR_H 00059 #define MEMMGR_H 00060 00061 00062 #if defined (__cplusplus) 00063 extern "C" { 00064 #endif 00065 00066 #define MEMMGR_MAX_NAME_LENGTH 32u 00067 /* ============================================================================= 00068 * Structures & Enums 00069 * ============================================================================= 00070 */ 00071 00075 typedef enum { 00076 SyslinkMemMgr_AddrType_Virtual = 0u, 00080 SyslinkMemMgr_AddrType_Portable = 1u, 00084 SyslinkMemMgr_AddrType_EndValue = 2u 00086 } SyslinkMemMgr_AddrType; 00087 00091 typedef enum SyslinkMemMgr_Type_Type_tag { 00092 SyslinkMemMgr_TYPE_SHAREDMEM = 0x0, 00093 SyslinkMemMgr_TYPE_TILERMEM = 0x1 00094 }SyslinkMemMgr_Type; 00095 00096 00102 typedef struct SyslinkMemMgr_CreateParams_tag { 00103 UInt32 size; 00105 SyslinkMemMgr_Type memMgrType; 00107 UInt8 name[MEMMGR_MAX_NAME_LENGTH]; 00109 } SyslinkMemMgr_CreateParams; 00110 00111 #define SyslinkMemMgr_Params SyslinkMemMgr_CreateParams 00112 00113 typedef struct SyslinkMemMgr_freeParams_tag { 00114 Ptr ptr; 00115 UInt32 size; 00116 }SyslinkMemMgr_freeParams; 00121 typedef struct SyslinkMemMgr_Object SyslinkMemMgr_Object; 00122 00126 typedef struct SyslinkMemMgr_Object * SyslinkMemMgr_Handle; 00127 00128 /* ============================================================================= 00129 * APIs 00130 * ============================================================================= 00131 */ 00132 /* Function to setup the SyslinkMemMgr module */ 00133 Int32 00134 SyslinkMemMgr_setup (Void); 00135 00136 /* Function to setup the SyslinkMemMgr module */ 00137 Int32 00138 SyslinkMemMgr_destroy(Void); 00139 00140 /* Function to create a SyslinkMemMgr instance */ 00141 SyslinkMemMgr_Handle 00142 SyslinkMemMgr_create (Ptr params); 00143 00144 /* Function to delete the created Memory Manager instance*/ 00145 Int32 00146 SyslinkMemMgr_delete (SyslinkMemMgr_Handle * pHandle); 00147 00148 00149 /* Function to allocate memory from the SyslinkMemMgr */ 00150 Ptr 00151 SyslinkMemMgr_alloc (SyslinkMemMgr_Handle handle, UInt32 size, UInt32 align); 00152 00153 /* Function to allocate memory from the SyslinkMemMgr */ 00154 Int32 00155 SyslinkMemMgr_free (SyslinkMemMgr_Handle handle, Ptr ptr, UInt32 size); 00156 00157 /* Function to map. not used for shared memory*/ 00158 Ptr 00159 SyslinkMemMgr_map (SyslinkMemMgr_Handle handle, Ptr arg); 00160 00161 /* Function to do unmap */ 00162 Int32 00163 SyslinkMemMgr_unmap (SyslinkMemMgr_Handle handle, Ptr arg); 00164 00165 /* Function to translate source address to destination address type */ 00166 Ptr 00167 SyslinkMemMgr_translate (SyslinkMemMgr_Handle handle, 00168 Ptr srcAddr, 00169 SyslinkMemMgr_AddrType srcAddrType, 00170 SyslinkMemMgr_AddrType desAddrType); 00171 00172 /* Function to return the kernel space instance handle pointer when user space 00173 * instance handle is passed 00174 */ 00175 Ptr 00176 SyslinkMemMgr_getKnlHandle (SyslinkMemMgr_Handle handle); 00177 00178 #if defined (__cplusplus) 00179 } 00180 #endif /* defined (__cplusplus) */ 00181 00182 00183 #endif