![]() |
![]() |
00001 00011 /* 00012 * ============================================================================ 00013 * 00014 * Copyright (c) 2008-2012, Texas Instruments Incorporated 00015 * 00016 * Redistribution and use in source and binary forms, with or without 00017 * modification, are permitted provided that the following conditions 00018 * are met: 00019 * 00020 * * Redistributions of source code must retain the above copyright 00021 * notice, this list of conditions and the following disclaimer. 00022 * 00023 * * Redistributions in binary form must reproduce the above copyright 00024 * notice, this list of conditions and the following disclaimer in the 00025 * documentation and/or other materials provided with the distribution. 00026 * 00027 * * Neither the name of Texas Instruments Incorporated nor the names of 00028 * its contributors may be used to endorse or promote products derived 00029 * from this software without specific prior written permission. 00030 * 00031 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00032 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00033 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00034 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00035 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00036 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00037 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00038 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00039 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00040 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00041 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00042 * Contact information for paper mail: 00043 * Texas Instruments 00044 * Post Office Box 655303 00045 * Dallas, Texas 75265 00046 * Contact information: 00047 * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? 00048 * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact 00049 * ============================================================================ 00050 * 00051 */ 00052 00053 00054 00055 #ifndef MEMMGR_H 00056 #define MEMMGR_H 00057 00058 00059 #if defined (__cplusplus) 00060 extern "C" { 00061 #endif 00062 00063 #define MEMMGR_MAX_NAME_LENGTH 32u 00064 00065 #define MEMMGR_MAX_TILER_BLOCKS 10u 00066 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_AllocBlock_tag { 00114 UInt16 pixelFormat; 00115 union { 00116 struct { 00117 UInt16 width; 00118 UInt16 height; 00119 } area; 00120 UInt16 len; 00121 } dim; 00122 UInt32 stride; 00123 } SyslinkMemMgr_AllocBlock; 00124 00125 00129 typedef struct SyslinkMemMgr_AllocParams_tag { 00130 UInt32 size; 00131 UInt32 align; 00132 SyslinkMemMgr_AllocBlock block[MEMMGR_MAX_TILER_BLOCKS]; 00133 UInt32 tilerBlocks; 00134 } SyslinkMemMgr_AllocParams; 00135 00136 00141 typedef struct SyslinkMemMgr_Object SyslinkMemMgr_Object; 00142 00146 typedef SyslinkMemMgr_Object * SyslinkMemMgr_Handle; 00147 00148 /* ============================================================================= 00149 * APIs 00150 * ============================================================================= 00151 */ 00152 /* Function to setup the SyslinkMemMgr module */ 00153 Int32 SyslinkMemMgr_setup(Void); 00154 00155 /* Function to setup the SyslinkMemMgr module */ 00156 Int32 SyslinkMemMgr_destroy(Void); 00157 00158 /* Function to create a SyslinkMemMgr instance */ 00159 SyslinkMemMgr_Handle SyslinkMemMgr_create(Ptr params); 00160 00161 /* Function to delete the created Memory Manager instance*/ 00162 Int32 SyslinkMemMgr_delete(SyslinkMemMgr_Handle * pHandle); 00163 00164 00165 /* Function to allocate memory from the SyslinkMemMgr */ 00166 Ptr SyslinkMemMgr_alloc(SyslinkMemMgr_Handle handle, 00167 SyslinkMemMgr_AllocParams *params); 00168 00169 /* Function to free memory from the SyslinkMemMgr */ 00170 Int32 SyslinkMemMgr_free(SyslinkMemMgr_Handle handle, Ptr ptr, UInt32 size); 00171 00172 /* Function to map. not used for shared memory*/ 00173 Ptr SyslinkMemMgr_map(SyslinkMemMgr_Handle handle, Ptr arg); 00174 00175 /* Function to do unmap */ 00176 Int32 SyslinkMemMgr_unmap(SyslinkMemMgr_Handle handle, Ptr arg); 00177 00178 /* Function to translate source address to destination address type */ 00179 Ptr SyslinkMemMgr_translate(SyslinkMemMgr_Handle handle, Ptr srcAddr, 00180 SyslinkMemMgr_AddrType srcAddrType, 00181 SyslinkMemMgr_AddrType desAddrType); 00182 00183 /* Function to return the kernel space instance handle pointer when user space 00184 * instance handle is passed 00185 */ 00186 Ptr SyslinkMemMgr_getKnlHandle(SyslinkMemMgr_Handle handle); 00187 00188 00189 #if defined (__cplusplus) 00190 } 00191 #endif 00192 00193 #endif