summaryrefslogtreecommitdiffstats
path: root/exynos3/s5pc110/sec_mm/sec_omx/sec_osal
diff options
context:
space:
mode:
Diffstat (limited to 'exynos3/s5pc110/sec_mm/sec_omx/sec_osal')
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/Android.mk38
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp456
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h66
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.c144
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.h48
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.c217
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.h61
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.c54
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.h46
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.c53
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.h78
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.c71
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.h47
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.c91
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.h47
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c174
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h66
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c132
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.h49
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c153
-rw-r--r--exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h48
21 files changed, 2139 insertions, 0 deletions
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/Android.mk b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/Android.mk
new file mode 100644
index 0000000..a020149
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/Android.mk
@@ -0,0 +1,38 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+ SEC_OSAL_Event.c \
+ SEC_OSAL_Queue.c \
+ SEC_OSAL_ETC.c \
+ SEC_OSAL_Mutex.c \
+ SEC_OSAL_Thread.c \
+ SEC_OSAL_Memory.c \
+ SEC_OSAL_Semaphore.c \
+ SEC_OSAL_Library.c \
+ SEC_OSAL_Log.c \
+ SEC_OSAL_Buffer.cpp
+
+
+LOCAL_MODULE := libsecosal
+
+LOCAL_CFLAGS :=
+
+LOCAL_STATIC_LIBRARIES :=
+
+LOCAL_SHARED_LIBRARIES := libcutils \
+ libutils \
+ libui \
+ libhardware \
+ libandroid_runtime
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+ $(SEC_OMX_INC)/sec \
+ $(SEC_OMX_TOP)/sec_osal \
+ $(SEC_OMX_COMPONENT)/common \
+ $(SEC_OMX_TOP)/../../include \
+ $(TOP)/frameworks/native/include/media/hardware
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp
new file mode 100644
index 0000000..b28f702
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.cpp
@@ -0,0 +1,456 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Buffer.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * Jinsung Yang (jsgood.yang@samsung.com)
+ * @version 1.0.2
+ * @history
+ * 2011.5.15 : Create
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Def.h"
+#include "SEC_OMX_Macros.h"
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Buffer.h"
+#include "SEC_OMX_Basecomponent.h"
+
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <cutils/properties.h>
+#include <ui/GraphicBuffer.h>
+#include <ui/GraphicBufferMapper.h>
+#include <ui/Rect.h>
+#include <HardwareAPI.h>
+#include <hardware/hardware.h>
+#include <MetadataBufferType.h>
+#include "hal_public.h"
+
+#define HAL_PIXEL_FORMAT_C110_NV12 0x100
+
+using namespace android;
+
+
+struct AndroidNativeBuffersParams {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ OMX_U32 nPortIndex;
+};
+
+#ifdef USE_ANDROID_EXTENSION
+OMX_ERRORTYPE checkVersionANB(OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_VERSIONTYPE* version = NULL;
+
+
+ AndroidNativeBuffersParams *pANBP;
+ pANBP = (AndroidNativeBuffersParams *)ComponentParameterStructure;
+
+ version = (OMX_VERSIONTYPE*)((char*)pANBP + sizeof(OMX_U32));
+ if (*((OMX_U32*)pANBP) <= sizeof(AndroidNativeBuffersParams)) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (version->s.nVersionMajor != VERSIONMAJOR_NUMBER ||
+ version->s.nVersionMinor != VERSIONMINOR_NUMBER) {
+ ret = OMX_ErrorVersionMismatch;
+ goto EXIT;
+ }
+
+ ret = OMX_ErrorNone;
+
+EXIT:
+ return ret;
+}
+
+OMX_U32 checkPortIndexANB(OMX_PTR ComponentParameterStructure)
+{
+ AndroidNativeBuffersParams *pANBP;
+ pANBP = (AndroidNativeBuffersParams *)ComponentParameterStructure;
+
+ return pANBP->nPortIndex;
+}
+
+OMX_U32 getMetadataBufferType(const uint8_t *ptr)
+{
+ OMX_U32 type = *(OMX_U32 *) ptr;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "getMetadataBufferType: %ld", type);
+ return type;
+}
+
+OMX_U32 getVADDRfromANB(OMX_PTR pUnreadableBuffer, OMX_U32 Width, OMX_U32 Height, void *pVirAddrs[])
+{
+ OMX_U32 ret = 0;
+ android_native_buffer_t *buf;
+ void *readableBuffer;
+ GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+ Rect bounds(Width, Height);
+
+ FunctionIn();
+
+ buf = (android_native_buffer_t *)pUnreadableBuffer;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "pUnreadableBuffer:0x%x, buf:0x%x, buf->handle:0x%x",
+ pUnreadableBuffer, buf, buf->handle);
+
+ ret = mapper.lock(buf->handle, GRALLOC_USAGE_SW_WRITE_OFTEN, bounds, pVirAddrs);
+ if (ret != 0) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "mapper.lock Error, Error code:%d", ret);
+ }
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_U32 putVADDRtoANB(OMX_PTR pUnreadableBuffer)
+{
+ android_native_buffer_t *buf;
+ void *readableBuffer;
+ int ret = 0;
+ GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+
+ FunctionIn();
+
+ buf = (android_native_buffer_t *)pUnreadableBuffer;
+
+ FunctionOut();
+
+ return mapper.unlock(buf->handle);
+}
+
+OMX_ERRORTYPE enableAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+
+ EnableAndroidNativeBuffersParams *peanbp;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ peanbp = (EnableAndroidNativeBuffersParams *)ComponentParameterStructure;
+ pSECPort = &pSECComponent->pSECPort[peanbp->nPortIndex];
+
+ if (peanbp->enable == OMX_FALSE) {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "disable AndroidNativeBuffer");
+ pSECPort->bUseAndroidNativeBuffer = OMX_FALSE;
+ } else {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "enable AndroidNativeBuffer");
+ pSECPort->bUseAndroidNativeBuffer = OMX_TRUE;
+ pSECPort->portDefinition.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatANBYUV420SemiPlanar;
+ }
+
+ ret = OMX_ErrorNone;
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE getAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+
+ GetAndroidNativeBufferUsageParams *pganbp;
+
+ FunctionIn();
+
+ pganbp = (GetAndroidNativeBufferUsageParams *)ComponentParameterStructure;
+
+ pganbp->nUsage = GRALLOC_USAGE_SW_WRITE_OFTEN;
+
+ ret = OMX_ErrorNone;
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE UseBufferANB(
+ OMX_IN OMX_HANDLETYPE hComponent,
+ OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+ OMX_IN OMX_U32 nPortIndex,
+ OMX_IN OMX_PTR pAppPrivate,
+ OMX_IN OMX_U32 nSizeBytes,
+ OMX_IN OMX_U8 *pBuffer)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+ OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL;
+ int i = 0;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+ pSECPort = &pSECComponent->pSECPort[nPortIndex];
+ if (nPortIndex >= pSECComponent->portParam.nPorts) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+ if (pSECPort->portState != OMX_StateIdle) {
+ ret = OMX_ErrorIncorrectStateOperation;
+ goto EXIT;
+ }
+
+ if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+ ret = OMX_ErrorBadPortIndex;
+ goto EXIT;
+ }
+
+ temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+ if (temp_bufferHeader == NULL) {
+ ret = OMX_ErrorInsufficientResources;
+ goto EXIT;
+ }
+ SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+ for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+ if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+ pSECPort->bufferHeader[i] = temp_bufferHeader;
+ pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
+ INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+ temp_bufferHeader->pBuffer = pBuffer;
+ temp_bufferHeader->nAllocLen = nSizeBytes;
+ temp_bufferHeader->pAppPrivate = pAppPrivate;
+ if (nPortIndex == INPUT_PORT_INDEX)
+ temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+ else
+ temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+
+ pSECPort->assignedBufferNum++;
+ if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+ pSECPort->portDefinition.bPopulated = OMX_TRUE;
+ /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+ SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+ /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+ }
+ *ppBufferHdr = temp_bufferHeader;
+ ret = OMX_ErrorNone;
+ goto EXIT;
+ }
+ }
+
+ SEC_OSAL_Free(temp_bufferHeader);
+ ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE useAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+ OMX_U32 frameSize = 0;
+ OMX_U32 bufWidth, bufHeight;
+ UseAndroidNativeBufferParams *puanbp;
+
+ FunctionIn();
+
+ puanbp = (UseAndroidNativeBufferParams *)ComponentParameterStructure;
+
+ OMX_PTR buffer = (void *)puanbp->nativeBuffer.get();
+ android_native_buffer_t *buf = (android_native_buffer_t *)buffer;
+ bufWidth = ((buf->width + 15) / 16) * 16;
+ bufHeight = ((buf->height + 15) / 16) * 16;
+ frameSize = (bufWidth * bufHeight * 3) / 2;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "buffer:0x%x, buf:0x%x, buf->handle:0x%x", buffer, buf, buf->handle);
+
+ ret = UseBufferANB(hComponent, puanbp->bufferHeader, puanbp->nPortIndex,
+ puanbp->pAppPrivate, frameSize, (OMX_U8 *)buffer);
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE enableStoreMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+
+ StoreMetaDataInBuffersParams *pStoreMetaData;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pStoreMetaData = (StoreMetaDataInBuffersParams*)ComponentParameterStructure;
+ pSECPort = &pSECComponent->pSECPort[pStoreMetaData->nPortIndex];
+
+ if (pStoreMetaData->bStoreMetaData == OMX_FALSE) {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "disable StoreMetaDataInBuffers");
+ pSECPort->bStoreMetaDataInBuffer = OMX_FALSE;
+ } else {
+ SEC_OSAL_Log(SEC_LOG_TRACE, "enable StoreMetaDataInBuffers");
+ pSECPort->bStoreMetaDataInBuffer = OMX_TRUE;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_BOOL isMetadataBufferTypeGrallocSource(OMX_BYTE pInputDataBuffer)
+{
+ OMX_U32 type = getMetadataBufferType(pInputDataBuffer);
+
+ if (type == kMetadataBufferTypeGrallocSource)
+ return OMX_TRUE;
+ else
+ return OMX_FALSE;
+}
+
+OMX_ERRORTYPE preprocessMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_BYTE pInputDataBuffer, BUFFER_ADDRESS_INFO *pInputInfo)
+{
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ OMX_COMPONENTTYPE *pOMXComponent = NULL;
+ SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+ SEC_OMX_BASEPORT *pSECPort = NULL;
+ OMX_U32 type = 0;
+
+ FunctionIn();
+
+ if (hComponent == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+ if (pOMXComponent->pComponentPrivate == NULL) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+ pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+
+ type = getMetadataBufferType(pInputDataBuffer);
+ if (type == kMetadataBufferTypeCameraSource) {
+ SEC_OSAL_Memcpy(&pInputInfo->YPhyAddr, pInputDataBuffer + 4, sizeof(void *));
+ SEC_OSAL_Memcpy(&pInputInfo->CPhyAddr, pInputDataBuffer + 4 + sizeof(void *), sizeof(void *));
+ } else if (type == kMetadataBufferTypeGrallocSource){
+ IMG_gralloc_module_public_t *module = (IMG_gralloc_module_public_t *)pSECPort->pIMGGrallocModule;
+ OMX_PTR pUnreadableBuffer = NULL;
+ OMX_PTR pReadableBuffer = NULL;
+ OMX_PTR pVirAddrs[3];
+ int err = 0;
+
+ pVirAddrs[0] = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YVirAddr;
+ pVirAddrs[1] = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CVirAddr;
+ pVirAddrs[2] = NULL;
+
+ if (module == NULL) {
+ err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **)&module);
+ if(err) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "hw_get_module failed (err=%d)\n", err);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+ pSECPort->pIMGGrallocModule = (OMX_PTR)module;
+ }
+
+ /**************************************/
+ /* IMG CSC RGB to NV12 */
+ /**************************************/
+ buffer_handle_t buf = *((buffer_handle_t *) (pInputDataBuffer + 4));
+ SEC_OSAL_Log(SEC_LOG_TRACE, "buffer handle %p)\n", buf);
+ err = module->Blit(module, buf, pVirAddrs, HAL_PIXEL_FORMAT_C110_NV12);
+ if(err) {
+ SEC_OSAL_Log(SEC_LOG_ERROR, "module->Blit() failed (err=%d)\n", err);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ pInputInfo->YPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.YPhyAddr;
+ pInputInfo->CPhyAddr = pSECComponent->processData[INPUT_PORT_INDEX].specificBufferHeader.CPhyAddr;
+ } else {
+ ret = OMX_ErrorNotImplemented;
+ goto EXIT;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+int isTvOutEnabled() {
+ char value[PROPERTY_VALUE_MAX];
+ property_get("init.svc.tvouthack", value, "");
+ return (strcmp(value, "running") == 0);
+}
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h
new file mode 100644
index 0000000..a096bfe
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Buffer.h
@@ -0,0 +1,66 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Buffer.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * Jinsung Yang (jsgood.yang@samsung.com)
+ * @version 1.0.2
+ * @history
+ * 2011.5.15 : Create
+ */
+
+#ifndef SEC_OSAL_BUFFER
+#define SEC_OSAL_BUFFER
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "OMX_Types.h"
+
+typedef struct {
+ void *YPhyAddr; // [IN/OUT] physical address of Y
+ void *CPhyAddr; // [IN/OUT] physical address of CbCr
+ void *YVirAddr; // [IN/OUT] virtual address of Y
+ void *CVirAddr; // [IN/OUT] virtual address of CbCr
+ int YSize; // [IN/OUT] input size of Y data
+ int CSize; // [IN/OUT] input size of CbCr data
+} BUFFER_ADDRESS_INFO;
+
+
+OMX_ERRORTYPE checkVersionANB(OMX_PTR ComponentParameterStructure);
+OMX_U32 checkPortIndexANB(OMX_PTR ComponentParameterStructure);
+OMX_U32 getMetadataBufferType(const uint8_t *ptr);
+OMX_ERRORTYPE enableAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_ERRORTYPE getAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_ERRORTYPE useAndroidNativeBuffer(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_U32 getVADDRfromANB(OMX_PTR pUnreadableBuffer, OMX_U32 Width, OMX_U32 Height, void *vaddress[]);
+OMX_U32 putVADDRtoANB(OMX_PTR pUnreadableBuffer);
+OMX_ERRORTYPE enableStoreMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_PTR ComponentParameterStructure);
+OMX_BOOL isMetadataBufferTypeGrallocSource(OMX_BYTE pInputDataBuffer);
+OMX_ERRORTYPE preprocessMetaDataInBuffers(OMX_HANDLETYPE hComponent, OMX_BYTE pInputDataBuffer, BUFFER_ADDRESS_INFO *pInputInfo);
+
+int isTvOutEnabled();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.c
new file mode 100644
index 0000000..66f8355
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.c
@@ -0,0 +1,144 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_ETC.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+
+
+#ifndef HAVE_GETLINE
+ssize_t getline(char **ppLine, size_t *pLen, FILE *pStream)
+{
+ char *pCurrentPointer = NULL;
+ size_t const chunk = 512;
+
+ size_t defaultBufferSize = chunk + 1;
+ size_t retSize = 0;
+
+ if (*ppLine == NULL) {
+ *ppLine = (char *)malloc(defaultBufferSize);
+ if (*ppLine == NULL) {
+ retSize = -1;
+ goto EXIT;
+ }
+ *pLen = defaultBufferSize;
+ }
+ else {
+ if (*pLen < defaultBufferSize) {
+ *ppLine = (char *)realloc(*ppLine, defaultBufferSize);
+ if (*ppLine == NULL) {
+ retSize = -1;
+ goto EXIT;
+ }
+ *pLen = defaultBufferSize;
+ }
+ }
+
+ while (1) {
+ size_t i;
+ size_t j = 0;
+ size_t readByte = 0;
+
+ pCurrentPointer = *ppLine + readByte;
+
+ i = fread(pCurrentPointer, 1, chunk, pStream);
+ if (i < chunk && ferror(pStream)) {
+ retSize = -1;
+ goto EXIT;
+ }
+ while (j < i) {
+ ++j;
+ if (*pCurrentPointer++ == (char)'\n') {
+ *pCurrentPointer = '\0';
+ if (j != i) {
+ if (fseek(pStream, j - i, SEEK_CUR)) {
+ retSize = -1;
+ goto EXIT;
+ }
+ if (feof(pStream))
+ clearerr(pStream);
+ }
+ readByte += j;
+ retSize = readByte;
+ goto EXIT;
+ }
+ }
+
+ readByte += j;
+ if (feof(pStream)) {
+ if (readByte) {
+ retSize = readByte;
+ goto EXIT;
+ }
+ if (!i) {
+ retSize = -1;
+ goto EXIT;
+ }
+ }
+
+ i = ((readByte + (chunk * 2)) / chunk) * chunk;
+ if (i != *pLen) {
+ *ppLine = (char *)realloc(*ppLine, i);
+ if (*ppLine == NULL) {
+ retSize = -1;
+ goto EXIT;
+ }
+ *pLen = i;
+ }
+ }
+
+EXIT:
+ return retSize;
+}
+#endif /* HAVE_GETLINE */
+
+OMX_PTR SEC_OSAL_Strcpy(OMX_PTR dest, OMX_PTR src)
+{
+ return strcpy(dest, src);
+}
+
+OMX_PTR SEC_OSAL_Strncpy(OMX_PTR dest, OMX_PTR src, size_t num)
+{
+ return strncpy(dest, src, num);
+}
+
+OMX_S32 SEC_OSAL_Strcmp(OMX_PTR str1, OMX_PTR str2)
+{
+ return strcmp(str1, str2);
+}
+
+OMX_PTR SEC_OSAL_Strcat(OMX_PTR dest, OMX_PTR src)
+{
+ return strcat(dest, src);
+}
+
+size_t SEC_OSAL_Strlen(const char *str)
+{
+ return strlen(str);
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.h
new file mode 100644
index 0000000..6c6ede7
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_ETC.h
@@ -0,0 +1,48 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_ETC.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_ETC
+#define SEC_OSAL_ETC
+
+#include "OMX_Types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_PTR SEC_OSAL_Strcpy(OMX_PTR dest, OMX_PTR src);
+OMX_PTR SEC_OSAL_Strncpy(OMX_PTR dest, OMX_PTR src, size_t num);
+OMX_S32 SEC_OSAL_Strcmp(OMX_PTR str1, OMX_PTR str2);
+OMX_PTR SEC_OSAL_Strcat(OMX_PTR dest, OMX_PTR src);
+size_t SEC_OSAL_Strlen(const char *str);
+ssize_t getline(char **ppLine, size_t *len, FILE *stream);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.c
new file mode 100644
index 0000000..51b3ca2
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.c
@@ -0,0 +1,217 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/*
+ * @file SEC_OSAL_Event.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_Event.h"
+
+#undef SEC_LOG_TAG
+#define SEC_LOG_TAG "SEC_OSAL_EVENT"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_SignalCreate(OMX_HANDLETYPE *eventHandle)
+{
+ SEC_OSAL_THREADEVENT *event;
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+ event = (SEC_OSAL_THREADEVENT *)SEC_OSAL_Malloc(sizeof(SEC_OSAL_THREADEVENT));
+ if (!event) {
+ ret = OMX_ErrorInsufficientResources;
+ goto EXIT;
+ }
+
+ SEC_OSAL_Memset(event, 0, sizeof(SEC_OSAL_THREADEVENT));
+ event->signal = OMX_FALSE;
+
+ ret = SEC_OSAL_MutexCreate(&event->mutex);
+ if (ret != OMX_ErrorNone) {
+ SEC_OSAL_Free(event);
+ goto EXIT;
+ }
+
+ if (pthread_cond_init(&event->condition, NULL)) {
+ SEC_OSAL_MutexTerminate(event->mutex);
+ SEC_OSAL_Free(event);
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ *eventHandle = (OMX_HANDLETYPE)event;
+ ret = OMX_ErrorNone;
+
+EXIT:
+ return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalTerminate(OMX_HANDLETYPE eventHandle)
+{
+ SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+ if (!event) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ ret = SEC_OSAL_MutexLock(event->mutex);
+ if (ret != OMX_ErrorNone) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ if (pthread_cond_destroy(&event->condition)) {
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ ret = SEC_OSAL_MutexUnlock(event->mutex);
+ if (ret != OMX_ErrorNone) {
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ ret = SEC_OSAL_MutexTerminate(event->mutex);
+ if (ret != OMX_ErrorNone) {
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ SEC_OSAL_Free(event);
+
+EXIT:
+ return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalReset(OMX_HANDLETYPE eventHandle)
+{
+ SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+ if (!event) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ ret = SEC_OSAL_MutexLock(event->mutex);
+ if (ret != OMX_ErrorNone) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ event->signal = OMX_FALSE;
+
+ SEC_OSAL_MutexUnlock(event->mutex);
+
+EXIT:
+ return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalSet(OMX_HANDLETYPE eventHandle)
+{
+ SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+ if (!event) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ ret = SEC_OSAL_MutexLock(event->mutex);
+ if (ret != OMX_ErrorNone) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ event->signal = OMX_TRUE;
+ pthread_cond_signal(&event->condition);
+
+ SEC_OSAL_MutexUnlock(event->mutex);
+
+EXIT:
+ return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalWait(OMX_HANDLETYPE eventHandle, OMX_U32 ms)
+{
+ SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ struct timespec timeout;
+ struct timeval now;
+ int funcret = 0;
+ OMX_U32 tv_us;
+
+ FunctionIn();
+
+ if (!event) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ gettimeofday(&now, NULL);
+
+ tv_us = now.tv_usec + ms * 1000;
+ timeout.tv_sec = now.tv_sec + tv_us / 1000000;
+ timeout.tv_nsec = (tv_us % 1000000) * 1000;
+
+ ret = SEC_OSAL_MutexLock(event->mutex);
+ if (ret != OMX_ErrorNone) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+
+ if (ms == 0) {
+ if (!event->signal)
+ ret = OMX_ErrorTimeout;
+ } else if (ms == DEF_MAX_WAIT_TIME) {
+ while (!event->signal)
+ pthread_cond_wait(&event->condition, (pthread_mutex_t *)(event->mutex));
+ ret = OMX_ErrorNone;
+ } else {
+ while (!event->signal) {
+ funcret = pthread_cond_timedwait(&event->condition, (pthread_mutex_t *)(event->mutex), &timeout);
+ if ((!event->signal) && (funcret == ETIMEDOUT)) {
+ ret = OMX_ErrorTimeout;
+ break;
+ }
+ }
+ }
+
+ SEC_OSAL_MutexUnlock(event->mutex);
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.h
new file mode 100644
index 0000000..640d2cc
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Event.h
@@ -0,0 +1,61 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Event.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_EVENT
+#define SEC_OSAL_EVENT
+
+#include <pthread.h>
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#define DEF_MAX_WAIT_TIME 0xFFFFFFFF
+
+typedef struct _SEC_OSAL_THREADEVENT
+{
+ OMX_BOOL signal;
+ OMX_HANDLETYPE mutex;
+ pthread_cond_t condition;
+} SEC_OSAL_THREADEVENT;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+OMX_ERRORTYPE SEC_OSAL_SignalCreate(OMX_HANDLETYPE *eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalTerminate(OMX_HANDLETYPE eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalReset(OMX_HANDLETYPE eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalSet(OMX_HANDLETYPE eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalWait(OMX_HANDLETYPE eventHandle, OMX_U32 ms);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.c
new file mode 100644
index 0000000..06ac712
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.c
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Library.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Library.h"
+
+
+void *SEC_OSAL_dlopen(const char *filename, int flag)
+{
+ return dlopen(filename, flag);
+}
+
+void *SEC_OSAL_dlsym(void *handle, const char *symbol)
+{
+ return dlsym(handle, symbol);
+}
+
+int SEC_OSAL_dlclose(void *handle)
+{
+ return dlclose(handle);
+}
+
+const char *SEC_OSAL_dlerror(void)
+{
+ return dlerror();
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.h
new file mode 100644
index 0000000..687cecd
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Library.h
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Library.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_LIBRARY
+#define SEC_OSAL_LIBRARY
+
+#include "OMX_Types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *SEC_OSAL_dlopen(const char *filename, int flag);
+void *SEC_OSAL_dlsym(void *handle, const char *symbol);
+int SEC_OSAL_dlclose(void *handle);
+const char *SEC_OSAL_dlerror(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.c
new file mode 100644
index 0000000..bae4974
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.c
@@ -0,0 +1,53 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Log.c
+ * @brief
+ * @author Yunji Kim (yunji.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#include <utils/Log.h>
+
+#include "SEC_OSAL_Log.h"
+
+
+void _SEC_OSAL_Log(SEC_LOG_LEVEL logLevel, const char *tag, const char *msg, ...)
+{
+ va_list argptr;
+
+ va_start(argptr, msg);
+
+ switch (logLevel) {
+ case SEC_LOG_TRACE:
+ __android_log_vprint(ANDROID_LOG_DEBUG, tag, msg, argptr);
+ break;
+ case SEC_LOG_WARNING:
+ __android_log_vprint(ANDROID_LOG_WARN, tag, msg, argptr);
+ break;
+ case SEC_LOG_ERROR:
+ __android_log_vprint(ANDROID_LOG_ERROR, tag, msg, argptr);
+ break;
+ default:
+ __android_log_vprint(ANDROID_LOG_VERBOSE, tag, msg, argptr);
+ }
+
+ va_end(argptr);
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.h
new file mode 100644
index 0000000..2f8a6ce
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Log.h
@@ -0,0 +1,78 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Log.h
+ * @brief
+ * @author Yunji Kim (yunji.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ * 2010.8.27 : Add trace function
+ */
+
+#ifndef SEC_OSAL_LOG
+#define SEC_OSAL_LOG
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SEC_LOG_OFF
+#define SEC_LOG
+#endif
+
+#ifndef SEC_LOG_TAG
+#define SEC_LOG_TAG "SEC_LOG"
+#endif
+
+#ifdef SEC_TRACE_ON
+#define SEC_TRACE
+#endif
+
+typedef enum _LOG_LEVEL
+{
+ SEC_LOG_TRACE,
+ SEC_LOG_WARNING,
+ SEC_LOG_ERROR
+} SEC_LOG_LEVEL;
+
+#ifdef SEC_LOG
+#define SEC_OSAL_Log(a, ...) ((void)_SEC_OSAL_Log(a, SEC_LOG_TAG, __VA_ARGS__))
+#else
+#define SEC_OSAL_Log(a, ...) \
+ do { \
+ if (a == SEC_LOG_ERROR) \
+ ((void)_SEC_OSAL_Log(a, SEC_LOG_TAG, __VA_ARGS__)); \
+ } while (0)
+#endif
+
+#ifdef SEC_TRACE
+#define FunctionIn() _SEC_OSAL_Log(SEC_LOG_TRACE, SEC_LOG_TAG, "%s In , Line: %d", __FUNCTION__, __LINE__)
+#define FunctionOut() _SEC_OSAL_Log(SEC_LOG_TRACE, SEC_LOG_TAG, "%s Out , Line: %d", __FUNCTION__, __LINE__)
+#else
+#define FunctionIn() ((void *)0)
+#define FunctionOut() ((void *)0)
+#endif
+
+extern void _SEC_OSAL_Log(SEC_LOG_LEVEL logLevel, const char *tag, const char *msg, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.c
new file mode 100644
index 0000000..3579d92
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.c
@@ -0,0 +1,71 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Memory.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OSAL_Memory.h"
+
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+static int mem_cnt = 0;
+
+OMX_PTR SEC_OSAL_Malloc(OMX_U32 size)
+{
+ mem_cnt++;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "alloc count: %d", mem_cnt);
+
+ return (OMX_PTR)malloc(size);
+}
+
+void SEC_OSAL_Free(OMX_PTR addr)
+{
+ mem_cnt--;
+ SEC_OSAL_Log(SEC_LOG_TRACE, "free count: %d", mem_cnt);
+
+ if (addr)
+ free(addr);
+
+ return;
+}
+
+OMX_PTR SEC_OSAL_Memset(OMX_PTR dest, OMX_S32 c, OMX_S32 n)
+{
+ return memset(dest, c, n);
+}
+
+OMX_PTR SEC_OSAL_Memcpy(OMX_PTR dest, OMX_PTR src, OMX_S32 n)
+{
+ return memcpy(dest, src, n);
+}
+
+OMX_PTR SEC_OSAL_Memmove(OMX_PTR dest, OMX_PTR src, OMX_S32 n)
+{
+ return memmove(dest, src, n);
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.h
new file mode 100644
index 0000000..3a12838
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Memory.h
@@ -0,0 +1,47 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Memory.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_MEMORY
+#define SEC_OSAL_MEMORY
+
+#include "OMX_Types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_PTR SEC_OSAL_Malloc(OMX_U32 size);
+void SEC_OSAL_Free(OMX_PTR addr);
+OMX_PTR SEC_OSAL_Memset(OMX_PTR dest, OMX_S32 c, OMX_S32 n);
+OMX_PTR SEC_OSAL_Memcpy(OMX_PTR dest, OMX_PTR src, OMX_S32 n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.c
new file mode 100644
index 0000000..146809c
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.c
@@ -0,0 +1,91 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Mutex.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_MutexCreate(OMX_HANDLETYPE *mutexHandle)
+{
+ pthread_mutex_t *mutex;
+
+ mutex = (pthread_mutex_t *)SEC_OSAL_Malloc(sizeof(pthread_mutex_t));
+ if (!mutex)
+ return OMX_ErrorInsufficientResources;
+
+ if (pthread_mutex_init(mutex, NULL) != 0)
+ return OMX_ErrorUndefined;
+
+ *mutexHandle = (OMX_HANDLETYPE)mutex;
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_MutexTerminate(OMX_HANDLETYPE mutexHandle)
+{
+ pthread_mutex_t *mutex = (pthread_mutex_t *)mutexHandle;
+
+ if (mutex == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (pthread_mutex_destroy(mutex) != 0)
+ return OMX_ErrorUndefined;
+
+ SEC_OSAL_Free(mutex);
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_MutexLock(OMX_HANDLETYPE mutexHandle)
+{
+ pthread_mutex_t *mutex = (pthread_mutex_t *)mutexHandle;
+ int result;
+
+ if (mutex == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (pthread_mutex_lock(mutex) != 0)
+ return OMX_ErrorUndefined;
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_MutexUnlock(OMX_HANDLETYPE mutexHandle)
+{
+ pthread_mutex_t *mutex = (pthread_mutex_t *)mutexHandle;
+ int result;
+
+ if (mutex == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (pthread_mutex_unlock(mutex) != 0)
+ return OMX_ErrorUndefined;
+
+ return OMX_ErrorNone;
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.h
new file mode 100644
index 0000000..70dcd9d
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Mutex.h
@@ -0,0 +1,47 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Mutex.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+*/
+
+#ifndef SEC_OSAL_MUTEX
+#define SEC_OSAL_MUTEX
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_MutexCreate(OMX_HANDLETYPE *mutexHandle);
+OMX_ERRORTYPE SEC_OSAL_MutexTerminate(OMX_HANDLETYPE mutexHandle);
+OMX_ERRORTYPE SEC_OSAL_MutexLock(OMX_HANDLETYPE mutexHandle);
+OMX_ERRORTYPE SEC_OSAL_MutexUnlock(OMX_HANDLETYPE mutexHandle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c
new file mode 100644
index 0000000..7a6c024
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.c
@@ -0,0 +1,174 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Queue.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_Queue.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_QueueCreate(SEC_QUEUE *queueHandle)
+{
+ int i = 0;
+ SEC_QElem *newqelem = NULL;
+ SEC_QElem *currentqelem = NULL;
+ SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+ if (!queue)
+ return OMX_ErrorBadParameter;
+
+ ret = SEC_OSAL_MutexCreate(&queue->qMutex);
+ if (ret != OMX_ErrorNone)
+ return ret;
+
+ queue->first = (SEC_QElem *)SEC_OSAL_Malloc(sizeof(SEC_QElem));
+ if (queue->first == NULL)
+ return OMX_ErrorInsufficientResources;
+
+ SEC_OSAL_Memset(queue->first, 0, sizeof(SEC_QElem));
+ currentqelem = queue->last = queue->first;
+ queue->numElem = 0;
+
+ for (i = 0; i < (MAX_QUEUE_ELEMENTS - 2); i++) {
+ newqelem = (SEC_QElem *)SEC_OSAL_Malloc(sizeof(SEC_QElem));
+ if (newqelem == NULL) {
+ while (queue->first != NULL) {
+ currentqelem = queue->first->qNext;
+ SEC_OSAL_Free((OMX_PTR)queue->first);
+ queue->first = currentqelem;
+ }
+ return OMX_ErrorInsufficientResources;
+ } else {
+ SEC_OSAL_Memset(newqelem, 0, sizeof(SEC_QElem));
+ currentqelem->qNext = newqelem;
+ currentqelem = newqelem;
+ }
+ }
+
+ currentqelem->qNext = queue->first;
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_QueueTerminate(SEC_QUEUE *queueHandle)
+{
+ int i = 0;
+ SEC_QElem *currentqelem = NULL;
+ SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+ if (!queue)
+ return OMX_ErrorBadParameter;
+
+ for ( i = 0; i < (MAX_QUEUE_ELEMENTS - 2); i++) {
+ currentqelem = queue->first->qNext;
+ SEC_OSAL_Free(queue->first);
+ queue->first = currentqelem;
+ }
+
+ if(queue->first) {
+ SEC_OSAL_Free(queue->first);
+ queue->first = NULL;
+ }
+
+ ret = SEC_OSAL_MutexTerminate(queue->qMutex);
+
+ return ret;
+}
+
+int SEC_OSAL_Queue(SEC_QUEUE *queueHandle, void *data)
+{
+ SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+ if (queue == NULL)
+ return -1;
+
+ SEC_OSAL_MutexLock(queue->qMutex);
+
+ if ((queue->last->data != NULL) || (queue->numElem >= MAX_QUEUE_ELEMENTS)) {
+ SEC_OSAL_MutexUnlock(queue->qMutex);
+ return -1;
+ }
+ queue->last->data = data;
+ queue->last = queue->last->qNext;
+ queue->numElem++;
+
+ SEC_OSAL_MutexUnlock(queue->qMutex);
+ return 0;
+}
+
+void *SEC_OSAL_Dequeue(SEC_QUEUE *queueHandle)
+{
+ void *data = NULL;
+ SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+ if (queue == NULL)
+ return NULL;
+
+ SEC_OSAL_MutexLock(queue->qMutex);
+
+ if ((queue->first->data == NULL) || (queue->numElem <= 0)) {
+ SEC_OSAL_MutexUnlock(queue->qMutex);
+ return NULL;
+ }
+ data = queue->first->data;
+ queue->first->data = NULL;
+ queue->first = queue->first->qNext;
+ queue->numElem--;
+
+ SEC_OSAL_MutexUnlock(queue->qMutex);
+ return data;
+}
+
+int SEC_OSAL_GetElemNum(SEC_QUEUE *queueHandle)
+{
+ int ElemNum = 0;
+ SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+ if (queue == NULL)
+ return -1;
+
+ SEC_OSAL_MutexLock(queue->qMutex);
+ ElemNum = queue->numElem;
+ SEC_OSAL_MutexUnlock(queue->qMutex);
+ return ElemNum;
+}
+
+int SEC_OSAL_SetElemNum(SEC_QUEUE *queueHandle, int ElemNum)
+{
+ SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+ if (queue == NULL)
+ return -1;
+
+ SEC_OSAL_MutexLock(queue->qMutex);
+ queue->numElem = ElemNum;
+ SEC_OSAL_MutexUnlock(queue->qMutex);
+ return ElemNum;
+}
+
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
new file mode 100644
index 0000000..3f0938f
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Queue.h
@@ -0,0 +1,66 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Queue.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_QUEUE
+#define SEC_OSAL_QUEUE
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#define MAX_QUEUE_ELEMENTS 10
+
+typedef struct _SEC_QElem
+{
+ void *data;
+ struct _SEC_QElem *qNext;
+} SEC_QElem;
+
+typedef struct _SEC_QUEUE
+{
+ SEC_QElem *first;
+ SEC_QElem *last;
+ int numElem;
+ OMX_HANDLETYPE qMutex;
+} SEC_QUEUE;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_QueueCreate(SEC_QUEUE *queueHandle);
+OMX_ERRORTYPE SEC_OSAL_QueueTerminate(SEC_QUEUE *queueHandle);
+int SEC_OSAL_Queue(SEC_QUEUE *queueHandle, void *data);
+void *SEC_OSAL_Dequeue(SEC_QUEUE *queueHandle);
+int SEC_OSAL_GetElemNum(SEC_QUEUE *queueHandle);
+int SEC_OSAL_SetElemNum(SEC_QUEUE *queueHandle, int ElemNum);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c
new file mode 100644
index 0000000..94bc9c8
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.c
@@ -0,0 +1,132 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Semaphore.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <semaphore.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Semaphore.h"
+
+#undef SEC_LOG_TAG
+#define SEC_LOG_TAG "SEC_LOG_SEMA"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreCreate(OMX_HANDLETYPE *semaphoreHandle)
+{
+ sem_t *sema;
+
+ sema = (sem_t *)SEC_OSAL_Malloc(sizeof(sem_t));
+ if (!sema)
+ return OMX_ErrorInsufficientResources;
+
+ if (sem_init(sema, 0, 0) != 0)
+ return OMX_ErrorUndefined;
+
+ *semaphoreHandle = (OMX_HANDLETYPE)sema;
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreTerminate(OMX_HANDLETYPE semaphoreHandle)
+{
+ sem_t *sema = (sem_t *)semaphoreHandle;
+
+ if (sema == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (sem_destroy(sema) != 0)
+ return OMX_ErrorUndefined;
+
+ SEC_OSAL_Free(sema);
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreWait(OMX_HANDLETYPE semaphoreHandle)
+{
+ sem_t *sema = (sem_t *)semaphoreHandle;
+
+ FunctionIn();
+
+ if (sema == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (sem_wait(sema) != 0)
+ return OMX_ErrorUndefined;
+
+ FunctionOut();
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SemaphorePost(OMX_HANDLETYPE semaphoreHandle)
+{
+ sem_t *sema = (sem_t *)semaphoreHandle;
+
+ FunctionIn();
+
+ if (sema == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (sem_post(sema) != 0)
+ return OMX_ErrorUndefined;
+
+ FunctionOut();
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_Set_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 val)
+{
+ sem_t *sema = (sem_t *)semaphoreHandle;
+
+ if (sema == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (sem_init(sema, 0, val) != 0)
+ return OMX_ErrorUndefined;
+
+ return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_Get_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 *val)
+{
+ sem_t *sema = (sem_t *)semaphoreHandle;
+ OMX_U32 semaVal = 0;
+
+ if (sema == NULL)
+ return OMX_ErrorBadParameter;
+
+ if (sem_getvalue(sema, &semaVal) != 0)
+ return OMX_ErrorUndefined;
+
+ *val = semaVal;
+
+ return OMX_ErrorNone;
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.h
new file mode 100644
index 0000000..f23d3d6
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Semaphore.h
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Semaphore.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_SEMAPHORE
+#define SEC_OSAL_SEMAPHORE
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreCreate(OMX_HANDLETYPE *semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_SemaphoreTerminate(OMX_HANDLETYPE semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_SemaphoreWait(OMX_HANDLETYPE semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_SemaphorePost(OMX_HANDLETYPE semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_Set_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 val);
+OMX_ERRORTYPE SEC_OSAL_Get_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 *val);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c
new file mode 100644
index 0000000..3b69d30
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.c
@@ -0,0 +1,153 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Thread.c
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <errno.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Thread.h"
+
+#undef SEC_LOG_TAG
+#define SEC_LOG_TAG "SEC_LOG_THREAD"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+typedef struct _SEC_THREAD_HANDLE_TYPE
+{
+ pthread_t pthread;
+ pthread_attr_t attr;
+ struct sched_param schedparam;
+ int stack_size;
+} SEC_THREAD_HANDLE_TYPE;
+
+
+OMX_ERRORTYPE SEC_OSAL_ThreadCreate(OMX_HANDLETYPE *threadHandle, OMX_PTR function_name, OMX_PTR argument)
+{
+ FunctionIn();
+
+ int result = 0;
+ int detach_ret = 0;
+ SEC_THREAD_HANDLE_TYPE *thread;
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+ thread = SEC_OSAL_Malloc(sizeof(SEC_THREAD_HANDLE_TYPE));
+ SEC_OSAL_Memset(thread, 0, sizeof(SEC_THREAD_HANDLE_TYPE));
+
+ pthread_attr_init(&thread->attr);
+ if (thread->stack_size != 0)
+ pthread_attr_setstacksize(&thread->attr, thread->stack_size);
+
+ /* set priority */
+ if (thread->schedparam.sched_priority != 0)
+ pthread_attr_setschedparam(&thread->attr, &thread->schedparam);
+
+ detach_ret = pthread_attr_setdetachstate(&thread->attr, PTHREAD_CREATE_JOINABLE);
+ if (detach_ret != 0) {
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ result = pthread_create(&thread->pthread, &thread->attr, function_name, (void *)argument);
+ /* pthread_setschedparam(thread->pthread, SCHED_RR, &thread->schedparam); */
+
+ switch (result) {
+ case 0:
+ *threadHandle = (OMX_HANDLETYPE)thread;
+ ret = OMX_ErrorNone;
+ break;
+ case EAGAIN:
+ *threadHandle = NULL;
+ ret = OMX_ErrorInsufficientResources;
+ break;
+ default:
+ *threadHandle = NULL;
+ ret = OMX_ErrorUndefined;
+ break;
+ }
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_ThreadTerminate(OMX_HANDLETYPE threadHandle)
+{
+ FunctionIn();
+
+ OMX_ERRORTYPE ret = OMX_ErrorNone;
+ SEC_THREAD_HANDLE_TYPE *thread = (SEC_THREAD_HANDLE_TYPE *)threadHandle;
+
+ if (!thread) {
+ ret = OMX_ErrorBadParameter;
+ goto EXIT;
+ }
+ if (pthread_join(thread->pthread, NULL) != 0) {
+ ret = OMX_ErrorUndefined;
+ goto EXIT;
+ }
+
+ SEC_OSAL_Free(thread);
+ ret = OMX_ErrorNone;
+
+EXIT:
+ FunctionOut();
+
+ return ret;
+
+}
+
+OMX_ERRORTYPE SEC_OSAL_ThreadCancel(OMX_HANDLETYPE threadHandle)
+{
+ SEC_THREAD_HANDLE_TYPE *thread = (SEC_THREAD_HANDLE_TYPE *)threadHandle;
+
+ if (!thread)
+ return OMX_ErrorBadParameter;
+
+ /* thread_cancel(thread->pthread); */
+ pthread_exit(thread->pthread);
+ pthread_join(thread->pthread, NULL);
+
+ SEC_OSAL_Free(thread);
+ return OMX_ErrorNone;
+}
+
+void SEC_OSAL_ThreadExit(void *value_ptr)
+{
+ pthread_exit(value_ptr);
+ return;
+}
+
+void SEC_OSAL_SleepMillisec(OMX_U32 ms)
+{
+ usleep(ms * 1000);
+ return;
+}
diff --git a/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h
new file mode 100644
index 0000000..ccd2609
--- /dev/null
+++ b/exynos3/s5pc110/sec_mm/sec_omx/sec_osal/SEC_OSAL_Thread.h
@@ -0,0 +1,48 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file SEC_OSAL_Thread.h
+ * @brief
+ * @author SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version 1.0
+ * @history
+ * 2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_THREAD
+#define SEC_OSAL_THREAD
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_ThreadCreate(OMX_HANDLETYPE *threadHandle, OMX_PTR function_name, OMX_PTR argument);
+OMX_ERRORTYPE SEC_OSAL_ThreadTerminate(OMX_HANDLETYPE threadHandle);
+OMX_ERRORTYPE SEC_OSAL_ThreadCancel(OMX_HANDLETYPE threadHandle);
+void SEC_OSAL_ThreadExit(void *value_ptr);
+void SEC_OSAL_SleepMillisec(OMX_U32 ms);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif