1 2 /* 3 * Copyright (C) Texas Instruments - http://www.ti.com/ 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 /* ============================================================================= 22 * Texas Instruments OMAP(TM) Platform Software 23 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved. 24 * 25 * Use of this software is controlled by the terms and conditions found 26 * in the license agreement under which this software has been supplied. 27 * =========================================================================== */ 28 /** OMX_TI_Common.h 29 * The LCML header file contains the definitions used by both the 30 * application and the component to access common items. 31 */ 32 33 #ifndef __OMX_TI_COMMON_H__ 34 #define __OMX_TI_COMMON_H__ 35 36 #include "OMX_Component.h" 37 #include "OMX_TI_Debug.h" 38 39 /* OMX_TI_SEVERITYTYPE enumeration is used to indicate severity level of errors 40 returned by TI OpenMax components. 41 Critical Requires reboot/reset DSP 42 Severe Have to unload components and free memory and try again 43 Major Can be handled without unloading the component 44 Minor Essentially informational 45 */ 46 typedef enum OMX_TI_SEVERITYTYPE { 47 OMX_TI_ErrorCritical = 1, 48 OMX_TI_ErrorSevere, 49 OMX_TI_ErrorMajor, 50 OMX_TI_ErrorMinor 51 } OMX_TI_SEVERITYTYPE; 52 53 /* ======================================================================= */ 54 /** 55 * @def EXTRA_BYTES For Cache alignment 56 DSP_CACHE_ALIGNMENT For Cache alignment 57 * 58 */ 59 /* ======================================================================= */ 60 #define EXTRA_BYTES 256 61 #define DSP_CACHE_ALIGNMENT 128 62 63 /* ======================================================================= */ 64 /** 65 * @def OMX_MALLOC_GENERIC Macro to allocate Memory 66 */ 67 /* ======================================================================= */ 68 #define OMX_MALLOC_GENERIC(_pStruct_, _sName_) \ 69 OMX_MALLOC_SIZE(_pStruct_,sizeof(_sName_),_sName_) 70 71 /* ======================================================================= */ 72 /** 73 * @def OMX_MALLOC_SIZE Macro to allocate Memory 74 */ 75 /* ======================================================================= */ 76 #define OMX_MALLOC_SIZE(_ptr_, _size_,_name_) \ 77 _ptr_ = (_name_*)newmalloc(_size_); \ 78 if(_ptr_ == NULL){ \ 79 OMXDBG_PRINT(stderr, ERROR, 4, 0, "***********************************\n"); \ 80 OMXDBG_PRINT(stderr, ERROR, 4, 0, "%d :: Malloc Failed\n",__LINE__); \ 81 OMXDBG_PRINT(stderr, ERROR, 4, 0, "***********************************\n"); \ 82 eError = OMX_ErrorInsufficientResources; \ 83 goto EXIT; \ 84 } \ 85 memset(_ptr_,0,_size_); \ 86 OMXDBG_PRINT(stderr, BUFFER, 2, OMX_DBG_BASEMASK, "%d :: Malloced = %p\n",__LINE__,_ptr_); 87 88 /* ======================================================================= */ 89 /** 90 * @def OMX_MALLOC_SIZE_DSPALIGN Macro to allocate Memory with cache alignment protection 91 */ 92 /* ======================================================================= */ 93 #define OMX_MALLOC_SIZE_DSPALIGN(_ptr_, _size_,_name_) \ 94 OMX_MALLOC_SIZE(_ptr_, _size_ + EXTRA_BYTES, _name_); \ 95 _ptr_ = (_name_*)(((OMX_U8*)_ptr_ + DSP_CACHE_ALIGNMENT)); 96 97 /* ======================================================================= */ 98 /** 99 * M A C R O FOR MEMORY FREE 100 */ 101 /* ======================================================================= */ 102 #define OMX_MEMFREE_STRUCT(_pStruct_)\ 103 OMXDBG_PRINT(stderr, BUFFER, 2, OMX_DBG_BASEMASK, "%d :: [FREE] %p\n",__LINE__,_pStruct_); \ 104 if(_pStruct_ != NULL){\ 105 newfree(_pStruct_);\ 106 _pStruct_ = NULL;\ 107 } 108 109 /* ======================================================================= */ 110 /** 111 * M A C R O FOR MEMORY FREE 112 */ 113 /* ======================================================================= */ 114 #define OMX_MEMFREE_STRUCT_DSPALIGN(_pStruct_,_name_)\ 115 if(_pStruct_ != NULL){\ 116 _pStruct_ = (_name_*)(((OMX_U8*)_pStruct_ - DSP_CACHE_ALIGNMENT));\ 117 OMX_MEMFREE_STRUCT(_pStruct_);\ 118 } 119 120 #endif /* end of #ifndef __OMX_TI_COMMON_H__ */ 121 /* File EOF */ 122