1 /* 2 * 3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /* 19 * @file Exynos_OMX_Macros.h 20 * @brief Macros 21 * @author SeungBeom Kim (sbcrux.kim (at) samsung.com) 22 * @version 2.0.0 23 * @history 24 * 2012.02.20 : Create 25 */ 26 27 #ifndef EXYNOS_OMX_MACROS 28 #define EXYNOS_OMX_MACROS 29 30 #include "Exynos_OMX_Def.h" 31 #include "Exynos_OSAL_Memory.h" 32 33 34 /* 35 * MACROS 36 */ 37 #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) 38 #define ALIGN_TO_16B(x) ((((x) + (1 << 4) - 1) >> 4) << 4) 39 #define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5) 40 #define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7) 41 #define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13) 42 43 #define INIT_SET_SIZE_VERSION(_struct_, _structType_) \ 44 do { \ 45 Exynos_OSAL_Memset((_struct_), 0, sizeof(_structType_)); \ 46 (_struct_)->nSize = sizeof(_structType_); \ 47 (_struct_)->nVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; \ 48 (_struct_)->nVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; \ 49 (_struct_)->nVersion.s.nRevision = REVISION_NUMBER; \ 50 (_struct_)->nVersion.s.nStep = STEP_NUMBER; \ 51 } while (0) 52 53 /* 54 * Port Specific 55 */ 56 #define EXYNOS_TUNNEL_ESTABLISHED 0x0001 57 #define EXYNOS_TUNNEL_IS_SUPPLIER 0x0002 58 59 #define CHECK_PORT_BEING_FLUSHED(port) (port->bIsPortFlushed == OMX_TRUE) 60 #define CHECK_PORT_BEING_DISABLED(port) (port->bIsPortDisabled == OMX_TRUE) 61 #define CHECK_PORT_BEING_FLUSHED_OR_DISABLED(port) ((port->bIsPortFlushed == OMX_TRUE) || (port->bIsPortDisabled == OMX_TRUE)) 62 #define CHECK_PORT_ENABLED(port) (port->portDefinition.bEnabled == OMX_TRUE) 63 #define CHECK_PORT_POPULATED(port) (port->portDefinition.bPopulated == OMX_TRUE) 64 #define CHECK_PORT_TUNNELED(port) (port->tunnelFlags & EXYNOS_TUNNEL_ESTABLISHED) 65 #define CHECK_PORT_BUFFER_SUPPLIER(port) (port->tunnelFlags & EXYNOS_TUNNEL_IS_SUPPLIER) 66 67 #endif 68