Home | History | Annotate | Download | only in sec
      1 /*
      2  *
      3  * Copyright 2010 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    SEC_OMX_Macros.h
     20  * @brief    Macros
     21  * @author    SeungBeom Kim (sbcrux.kim (at) samsung.com)
     22  * @version    1.0
     23  * @history
     24  *   2010.7.15 : Create
     25  */
     26 
     27 #ifndef SEC_OMX_MACROS
     28 #define SEC_OMX_MACROS
     29 
     30 #include "SEC_OMX_Def.h"
     31 #include "SEC_OSAL_Memory.h"
     32 
     33 
     34 /*
     35  * MACROS
     36  */
     37 #define ALIGN_TO_32B(x)   ((((x) + (1 <<  5) - 1) >>  5) <<  5)
     38 #define ALIGN_TO_128B(x)  ((((x) + (1 <<  7) - 1) >>  7) <<  7)
     39 #define ALIGN_TO_8KB(x)   ((((x) + (1 << 13) - 1) >> 13) << 13)
     40 
     41 #define INIT_SET_SIZE_VERSION(_struct_, _structType_)               \
     42     do {                                                            \
     43         SEC_OSAL_Memset((_struct_), 0, sizeof(_structType_));       \
     44         (_struct_)->nSize = sizeof(_structType_);                   \
     45         (_struct_)->nVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; \
     46         (_struct_)->nVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; \
     47         (_struct_)->nVersion.s.nRevision = REVISION_NUMBER;         \
     48         (_struct_)->nVersion.s.nStep = STEP_NUMBER;                 \
     49     } while (0)
     50 
     51 /*
     52  * Port Specific
     53  */
     54 #define SEC_TUNNEL_ESTABLISHED 0x0001
     55 #define SEC_TUNNEL_IS_SUPPLIER 0x0002
     56 
     57 #define CHECK_PORT_BEING_FLUSHED(port)                 (port->bIsPortFlushed == OMX_TRUE)
     58 #define CHECK_PORT_BEING_DISABLED(port)                (port->bIsPortDisabled == OMX_TRUE)
     59 #define CHECK_PORT_ENABLED(port)                       (port->portDefinition.bEnabled == OMX_TRUE)
     60 #define CHECK_PORT_POPULATED(port)                     (port->portDefinition.bPopulated == OMX_TRUE)
     61 #define CHECK_PORT_TUNNELED(port)                      (port->tunnelFlags & SEC_TUNNEL_ESTABLISHED)
     62 #define CHECK_PORT_BUFFER_SUPPLIER(port)               (port->tunnelFlags & SEC_TUNNEL_IS_SUPPLIER)
     63 
     64 #endif
     65