diff options
Diffstat (limited to 'domx/mm_osal')
-rw-r--r-- | domx/mm_osal/Android.mk | 30 | ||||
-rw-r--r-- | domx/mm_osal/Makefile | 61 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_error.h | 175 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_events.h | 81 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_interfaces.h | 72 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_memory.h | 105 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_mutex.h | 71 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_osal.h | 68 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_pipes.h | 89 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_semaphores.h | 79 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_task.h | 89 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_trace.h | 217 | ||||
-rwxr-xr-x | domx/mm_osal/inc/timm_osal_types.h | 124 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal.c | 99 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal_events.c | 420 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal_memory.c | 250 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal_mutex.c | 244 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal_pipes.c | 415 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal_semaphores.c | 297 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal_task.c | 262 | ||||
-rwxr-xr-x | domx/mm_osal/src/timm_osal_trace.c | 174 |
21 files changed, 0 insertions, 3422 deletions
diff --git a/domx/mm_osal/Android.mk b/domx/mm_osal/Android.mk deleted file mode 100644 index ee4719a..0000000 --- a/domx/mm_osal/Android.mk +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - src/timm_osal.c \ - src/timm_osal_events.c \ - src/timm_osal_memory.c \ - src/timm_osal_mutex.c \ - src/timm_osal_pipes.c \ - src/timm_osal_semaphores.c \ - src/timm_osal_task.c \ - src/timm_osal_trace.c - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/inc - -LOCAL_SHARED_LIBRARIES := \ - libdl \ - liblog \ - libc \ - libcutils - -LOCAL_CFLAGS += -DOMAP_2430 -DOMX_DEBUG -D_Android -D_POSIX_VERSION_1_ -#LOCAL_CFLAGS += -DTIMM_OSAL_DEBUG_TRACE_DETAIL=1 # quiet - -LOCAL_MODULE := libmm_osal -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) diff --git a/domx/mm_osal/Makefile b/domx/mm_osal/Makefile deleted file mode 100644 index a83814f..0000000 --- a/domx/mm_osal/Makefile +++ /dev/null @@ -1,61 +0,0 @@ - -include $(PROJROOT)/make/start.mk - - - -# Target name and extension -# static library (ST_LIB): filename.a -# shared library soname (SH_LIB): filename.so.maj_ver.min_ver -# executable (EXEC) : filename.out - -TARGETNAME = libmm_osal - - -# TARGETTYPE must be EXEC, ST_LIB or SH_LIB in upper case. - -TARGETTYPE = SH_LIB - -# install directory relative to the HOSTTARGET directory -HOSTRELEASE = lib - -# install directory relative to the root filesystem -ROOTFSRELEASE = lib - -# Filename must not begin with '.', '/' or '\' - -SOURCES = \ - src/timm_osal.c \ - src/timm_osal_events.c \ - src/timm_osal_memory.c \ - src/timm_osal_mutex.c \ - src/timm_osal_pipes.c \ - src/timm_osal_semaphores.c \ - src/timm_osal_task.c \ - src/timm_osal_trace.c - - - -# Search path for include files - -INCLUDES = \ - inc/ \ - - - -ST_LIBS = -SH_LIBS = -#pthread -#pthread rt utils procmgr ipc rcm notify -#SH_LIBS += sysmgr sysmemmgr - - -# Search path for library (and linker command) files. -# Current folder and target folder are included by default. - -LIBINCLUDES = - - -# Do not change below "include" line(s) - -include $(PROJROOT)/make/build.mk - diff --git a/domx/mm_osal/inc/timm_osal_error.h b/domx/mm_osal/inc/timm_osal_error.h deleted file mode 100755 index 37b20e7..0000000 --- a/domx/mm_osal/inc/timm_osal_error.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_timm_osal_error.h -* The osal header file defines the error codes -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_ERROR_H_ -#define _TIMM_OSAL_ERROR_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "timm_osal_types.h" - -/** A unique ID for each component*/ - typedef TIMM_OSAL_U16 TIMM_OSAL_COMPID; - -/** TIMM_OSAL_ERROR is a 32 bits unsigned integer. - * Each error code can be broken up into three fields as given below: - * - Type of error (2 bits): NO_ERROR: 00, WARNING: 01, FATAL_ERROR: 10 - * - Component ID (14 bits): A unique ID which indicates which of the component generated the error - * - Error ID (16 bits): The specific error generated by a component - */ - typedef TIMM_OSAL_U32 TIMM_OSAL_ERRORTYPE; - -#define TIMM_OSAL_OK 0 -#define TIMM_OSAL_WAR 1 -#define TIMM_OSAL_ERR 2 - - -/* Macro to process TIMM_OSAL_ERROR */ - -/** This macro tests if the provided M4OSA_ERR is a warning or not*/ -#define TIMM_OSAL_IS_WARNING(error) ((((error)>>30) == TIMM_OSAL_WAR) ? 1:0) - -/** This macro tests if the provided M4OSA_ERR is a fatal error or not*/ -#define TIMM_OSAL_IS_ERROR(error) ((((error)>>30) == TIMM_OSAL_ERR) ? 1:0) - -/** This macro returns an error code accroding to the 3 provided fields: - * @arg Type: (IN) [TIMM_OSAL_U32] Type of error to put in the error code - * @arg compID: (IN) [TIMM_OSAL_U32] CompID to put in the error code - * @arg errorID: (IN) [TIMM_OSAL_U32] ErrorID to put in the error code*/ -#define TIMM_OSAL_ERR_CREATE(type, compID, errorID)\ - (((type)<<30)+(((compID)&0x003FFF)<<16)+((errorID)&0x00FFFF)) - -/** This macro extracts the 3 fields from the error: - * @arg error: (IN) [TIMM_OSAL_ERRORTYPE] Error code - * @arg type: (OUT) [TIMM_OSAL_U32] Type of error in the error code - * @arg compID: (OUT) [TIMM_OSAL_U32] CompID to put in the error code - * @arg errorID: (OUT) [TIMM_OSAL_U32] ErrorID to put in the error code*/ -#define TIMM_OSAL_ERR_SPLIT(error, type, compID, errorID)\ - { type=(TIMM_OSAL_U32)((error)>>30);\ - compID=(TIMM_OSAL_U32)(((error)>>16)&0x003FFF);\ - (TIMM_OSAL_U32)(errorID=(error)&0x00FFFF); } - -/* Component IDs */ -#define TIMM_OSAL_COMP_GENERAL 0x00 -#define TIMM_OSAL_COMP_MEMORY 0x01 -#define TIMM_OSAL_COMP_PIPES 0x02 -#define TIMM_OSAL_COMP_EVENTS 0x03 -#define TIMM_OSAL_COMP_SEMAPHORES 0x04 -#define TIMM_OSAL_COMP_TASK 0x05 - -/* Definition of common error codes */ -/** there is no error*/ -#define TIMM_OSAL_ERR_NONE ((TIMM_OSAL_ERRORTYPE) 0x00000000) - - -/** There is no more memory available*/ -#define TIMM_OSAL_ERR_ALLOC ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000001)) -#define TIMM_OSAL_ERR_OUT_OF_RESOURCE ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000002)) - -/** Time out */ -#define TIMM_OSAL_WAR_TIMEOUT ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_WAR,TIMM_OSAL_COMP_GENERAL,0x000003)) -#define TIMM_OSAL_ERR_PARAMETER ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000004)) -#define TIMM_OSAL_ERR_NOT_READY ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000005)) -#define TIMM_OSAL_ERR_OMX ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000006)) -#define TIMM_OSAL_ERR_PIPE_FULL ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000007)) -#define TIMM_OSAL_ERR_PIPE_EMPTY ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000008)) -#define TIMM_OSAL_ERR_PIPE_DELETED ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000009)) -#define TIMM_OSAL_ERR_PIPE_RESET ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x00000A)) -#define TIMM_OSAL_ERR_GROUP_DELETED ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x00000B)) -#define TIMM_OSAL_ERR_UNKNOWN ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x00000C)) - - -#define TIMM_OSAL_ERR_SEM_CREATE_FAILED ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_SEMAPHORE,0x000001)) - -/*Added during Linux Porting*/ -#define TIMM_OSAL_ERR_NO_PERMISSIONS ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x00000D)) -#define TIMM_OSAL_ERR_RESOURCE_EXISTS ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x00000E)) -#define TIMM_OSAL_ERR_RESOURCE_REMOVED ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x00000F)) -#define TIMM_OSAL_ERR_SYSTEM_LIMIT_EXCEEDED ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000010)) -#define TIMM_OSAL_ERR_NOT_SUPPORTED ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000011)) -#define TIMM_OSAL_ERR_SIGNAL_CAUGHT ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000012)) -#define TIMM_OSAL_ERR_TIMEOUT ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_GENERAL,0x000013)) - - - -#define TIMM_OSAL_COMP_MSG_Q 0x06 -#define TIMM_OSAL_ERR_MSG_SIZE_MISMATCH ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_MSG_Q,0x000001)) -#define TIMM_OSAL_ERR_MSG_TYPE_NOT_FOUND ((TIMM_OSAL_ERRORTYPE) TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR,TIMM_OSAL_COMP_MSG_Q,0x000002)) - - -/* -#define GOTO_EXIT_IF(_Cond,_ErrorCode) { \ - if ((_Cond)) { \ - status = _ErrorCode; \ - printf ("Error :: %s : %s : %d :: Exiting because : %s\n", \ - __FILE__, __FUNCTION__, __LINE__, #_Cond); \ - goto EXIT; \ - } \ -} -*/ - -#define SWITCH_CASE(_Case, _ErrCode, _ErrMsg)\ - case _Case:\ - TIMM_OSAL_Error(_ErrMsg);\ - bReturnStatus = _ErrCode;\ - break; - -#define SWITCH_DEFAULT_CASE(_ErrCode, _ErrMsg )\ - default:\ - TIMM_OSAL_Error(_ErrMsg);\ - bReturnStatus = _ErrCode;\ - break; - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /*_TIMM_OSAL_ERROR_H_*/ diff --git a/domx/mm_osal/inc/timm_osal_events.h b/domx/mm_osal/inc/timm_osal_events.h deleted file mode 100755 index 20a4d84..0000000 --- a/domx/mm_osal/inc/timm_osal_events.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_defines.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_EVENTS_H_ -#define _TIMM_OSAL_EVENTS_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "timm_osal_types.h" - - typedef enum TIMM_OSAL_EVENT_OPERATION - { - TIMM_OSAL_EVENT_AND, - TIMM_OSAL_EVENT_AND_CONSUME, - TIMM_OSAL_EVENT_OR, - TIMM_OSAL_EVENT_OR_CONSUME - } TIMM_OSAL_EVENT_OPERATION; - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventCreate(TIMM_OSAL_PTR * pEvents); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventDelete(TIMM_OSAL_PTR pEvents); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventSet(TIMM_OSAL_PTR pEvents, - TIMM_OSAL_U32 uEventFlag, TIMM_OSAL_EVENT_OPERATION eOperation); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventRetrieve(TIMM_OSAL_PTR pEvents, - TIMM_OSAL_U32 uRequestedEvents, - TIMM_OSAL_EVENT_OPERATION eOperation, - TIMM_OSAL_U32 * pRetrievedEvents, TIMM_OSAL_U32 uTimeOut); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_EVENTS_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_interfaces.h b/domx/mm_osal/inc/timm_osal_interfaces.h deleted file mode 100755 index dd3fd81..0000000 --- a/domx/mm_osal/inc/timm_osal_interfaces.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_memory.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_INTERFACES_H_ -#define _TIMM_OSAL_INTERFACES_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/******************************************************************************* -* External interface -*******************************************************************************/ -#include "timm_osal_types.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" -#include "timm_osal_pipes.h" -#include "timm_osal_events.h" -#include "timm_osal_semaphores.h" -#include "timm_osal_mutex.h" -#include "timm_osal_task.h" -#include "timm_osal_osal.h" - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_INTERFACES_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_memory.h b/domx/mm_osal/inc/timm_osal_memory.h deleted file mode 100755 index ed21636..0000000 --- a/domx/mm_osal/inc/timm_osal_memory.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_memory.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_MEMORY_H_ -#define _TIMM_OSAL_MEMORY_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/******************************************************************************* -* Includes -*******************************************************************************/ - -#include "timm_osal_types.h" -#include "timm_osal_error.h" - - -/* Enumeration Flag for Memory Segmenation Id */ - typedef enum TIMMOSAL_MEM_SEGMENTID - { - - TIMMOSAL_MEM_SEGMENT_EXT = 0, - TIMMOSAL_MEM_SEGMENT_INT, - TIMMOSAL_MEM_SEGMENT_UNCACHED - } TIMMOSAL_MEM_SEGMENTID; - - -/******************************************************************************* -* External interface -*******************************************************************************/ - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_CreateMemoryPool(void); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_DeleteMemoryPool(void); - - TIMM_OSAL_PTR TIMM_OSAL_Malloc(TIMM_OSAL_U32 size, - TIMM_OSAL_BOOL bBlockContiguous, TIMM_OSAL_U32 unBlockAlignment, - TIMMOSAL_MEM_SEGMENTID tMemSegId); - - void TIMM_OSAL_Free(TIMM_OSAL_PTR pData); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_Memset(TIMM_OSAL_PTR pBuffer, - TIMM_OSAL_U8 uValue, TIMM_OSAL_U32 uSize); - - TIMM_OSAL_S32 TIMM_OSAL_Memcmp(TIMM_OSAL_PTR pBuffer1, - TIMM_OSAL_PTR pBuffer2, TIMM_OSAL_U32 uSize); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_Memcpy(TIMM_OSAL_PTR pBufDst, - TIMM_OSAL_PTR pBufSrc, TIMM_OSAL_U32 uSize); - - TIMM_OSAL_U32 TIMM_OSAL_GetMemCounter(void); - -#define TIMM_OSAL_MallocExtn(size, bBlockContiguous, unBlockAlignment, tMemSegId, hHeap) \ - TIMM_OSAL_Malloc(size, bBlockContiguous, unBlockAlignment, tMemSegId ) - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_DEFINES_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_mutex.h b/domx/mm_osal/inc/timm_osal_mutex.h deleted file mode 100755 index 1d12c91..0000000 --- a/domx/mm_osal/inc/timm_osal_mutex.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_defines.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_MUTEX_H_ -#define _TIMM_OSAL_MUTEX_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/******************************************************************************* -* Includes -*******************************************************************************/ - -#include "timm_osal_types.h" - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexCreate(TIMM_OSAL_PTR * pMutex); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexDelete(TIMM_OSAL_PTR pMutex); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexObtain(TIMM_OSAL_PTR pMutex, - TIMM_OSAL_U32 uTimeOut); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexRelease(TIMM_OSAL_PTR pMutex); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_MUTEX_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_osal.h b/domx/mm_osal/inc/timm_osal_osal.h deleted file mode 100755 index a4e0e9e..0000000 --- a/domx/mm_osal/inc/timm_osal_osal.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_osal.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_OSAL_H_ -#define _TIMM_OSAL_OSAL_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/******************************************************************************* -* Includes -*******************************************************************************/ - -#include "timm_osal_types.h" - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_Init(void); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_Deinit(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_OSAL_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_pipes.h b/domx/mm_osal/inc/timm_osal_pipes.h deleted file mode 100755 index 79d7d61..0000000 --- a/domx/mm_osal/inc/timm_osal_pipes.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_defines.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_PIPES_H_ -#define _TIMM_OSAL_PIPES_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "timm_osal_types.h" - -/* -* Defined for Pipe timeout value -*/ - TIMM_OSAL_ERRORTYPE TIMM_OSAL_CreatePipe(TIMM_OSAL_PTR * pPipe, - TIMM_OSAL_U32 pipeSize, - TIMM_OSAL_U32 messageSize, TIMM_OSAL_U8 isFixedMessage); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_DeletePipe(TIMM_OSAL_PTR pPipe); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_WriteToPipe(TIMM_OSAL_PTR pPipe, - void *pMessage, TIMM_OSAL_U32 size, TIMM_OSAL_S32 timeout); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_WriteToFrontOfPipe(TIMM_OSAL_PTR pPipe, - void *pMessage, TIMM_OSAL_U32 size, TIMM_OSAL_S32 timeout); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_ReadFromPipe(TIMM_OSAL_PTR pPipe, - void *pMessage, - TIMM_OSAL_U32 size, - TIMM_OSAL_U32 * actualSize, TIMM_OSAL_S32 timeout); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_ClearPipe(TIMM_OSAL_PTR pPipe); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_IsPipeReady(TIMM_OSAL_PTR pPipe); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_GetPipeReadyMessageCount(TIMM_OSAL_PTR - pPipe, TIMM_OSAL_U32 * count); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_PIPES_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_semaphores.h b/domx/mm_osal/inc/timm_osal_semaphores.h deleted file mode 100755 index 86037d7..0000000 --- a/domx/mm_osal/inc/timm_osal_semaphores.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_defines.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_SEMAPHORE_H_ -#define _TIMM_OSAL_SEMAPHORE_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/******************************************************************************* -* Includes -*******************************************************************************/ - -#include "timm_osal_types.h" - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreCreate(TIMM_OSAL_PTR * - pSemaphore, TIMM_OSAL_U32 uInitCount); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreDelete(TIMM_OSAL_PTR - pSemaphore); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreObtain(TIMM_OSAL_PTR - pSemaphore, TIMM_OSAL_U32 uTimeOut); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreRelease(TIMM_OSAL_PTR - pSemaphore); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreReset(TIMM_OSAL_PTR pSemaphore, - TIMM_OSAL_U32 uInitCount); - TIMM_OSAL_ERRORTYPE TIMM_OSAL_GetSemaphoreCount(TIMM_OSAL_PTR - pSemaphore, TIMM_OSAL_U32 * count); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_SEMAPHORE_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_task.h b/domx/mm_osal/inc/timm_osal_task.h deleted file mode 100755 index 6f67a82..0000000 --- a/domx/mm_osal/inc/timm_osal_task.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_task.h -* The osal header file defines -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_TASK_H_ -#define _TIMM_OSAL_TASK_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/******************************************************************************* -* Includes -*******************************************************************************/ - -#include "timm_osal_types.h" - -/******************************************************************************* -* Tasks -*******************************************************************************/ - -/** -* prototype for the task function -*/ - /*typedef void (*TIMM_OSAL_TaskProc)(TIMM_OSAL_U32 argc, TIMM_OSAL_PTR argv);*//*Nucleus */ - - typedef void *(*TIMM_OSAL_TaskProc) (void *arg); /*Linux */ - - - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_CreateTask(TIMM_OSAL_PTR * pTask, - TIMM_OSAL_TaskProc pFunc, - TIMM_OSAL_U32 uArgc, - TIMM_OSAL_PTR pArgv, - TIMM_OSAL_U32 uStackSize, - TIMM_OSAL_U32 uPriority, TIMM_OSAL_S8 * pName); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_DeleteTask(TIMM_OSAL_PTR pTask); - - TIMM_OSAL_ERRORTYPE TIMM_OSAL_SleepTask(TIMM_OSAL_U32 mSec); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_TASK_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_trace.h b/domx/mm_osal/inc/timm_osal_trace.h deleted file mode 100755 index 412c5a9..0000000 --- a/domx/mm_osal/inc/timm_osal_trace.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_trace.h -* The timm_osal_types header file defines the primative osal type definitions. -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_TRACES_H_ -#define _TIMM_OSAL_TRACES_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/******************************************************************************* -* Traces -*******************************************************************************/ - - -/****************************************************************************** -* Debug Trace defines -******************************************************************************/ - - typedef enum TIMM_OSAL_TRACEGRP_TYPE - { - TIMM_OSAL_TRACEGRP_SYSTEM = 1, - TIMM_OSAL_TRACEGRP_OMXBASE = (1 << 1), - TIMM_OSAL_TRACEGRP_DOMX = (1 << 2), - TIMM_OSAL_TRACEGRP_OMXVIDEOENC = (1 << 3), - TIMM_OSAL_TRACEGRP_OMXVIDEODEC = (1 << 4), - TIMM_OSAL_TRACEGRP_OMXCAM = (1 << 5), - TIMM_OSAL_TRACEGRP_OMXIMGDEC = (1 << 6), - TIMM_OSAL_TRACEGRP_DRIVERS = (1 << 7), - TIMM_OSAL_TRACEGRP_SIMCOPALGOS = (1 << 8) - } TIMM_OSAL_TRACEGRP; - - typedef enum TIMM_OSAL_TRACE_LEVEL_TYPE - { - TIMM_OSAL_TRACE_LEVEL_ERROR = 1, - TIMM_OSAL_TRACE_LEVEL_WARNING = 2, - TIMM_OSAL_TRACE_LEVEL_PROFILING = 3, - TIMM_OSAL_TRACE_LEVEL_INFO = 4, - TIMM_OSAL_TRACE_LEVEL_DEBUG = 5, - TIMM_OSAL_TRACE_LEVEL_ENTERING = 6, - TIMM_OSAL_TRACE_LEVEL_EXITING = TIMM_OSAL_TRACE_LEVEL_ENTERING - } TIMM_OSAL_TRACE_LEVEL; - - -/** -* The OSAL debug trace level can be set at runtime by defining the environment -* variable TIMM_OSAL_DEBUG_TRACE_LEVEL=<Level>. The default level is 1 -* The debug levels are: -* Level 0 - No trace -* Level 1 - Error [Errors] -* Level 2 - Warning [Warnings that are useful to know about] -* Level 3 - Profiling [performance analysis trace that must not impact use case perf] -* Level 4 - Info [General information] -* Level 5 - Debug [most-commonly used statement for us developers] -* Level 6 - Trace ["ENTERING <function>" and "EXITING <function>" statements] -* -* Example: if TIMM_OSAL_DEBUG_TRACE_LEVEL=3, then level 1,2 and 3 traces messages -* are enabled. -*/ - -/** - * Information about the trace location/type, passed as a single pointer to - * internal trace function. Not part of the public API - */ - typedef struct - { - const char *file; - const char *function; - const int line; - const short level; - const short tracegrp; /* TIMM_OSAL_TRACEGRP */ - } __TIMM_OSAL_TRACE_LOCATION; - - -/** - * Trace level update function. Updates trace level if env variable - * or Android property is set. Env variable has precedence over it - */ - void TIMM_OSAL_UpdateTraceLevel(void); - -/** - * Trace implementation function. Not part of public API. Default - * implementation uses printf(), but you can use LD_PRELOAD to plug in - * alternative trace system at runtime. - */ - void __TIMM_OSAL_TraceFunction(const __TIMM_OSAL_TRACE_LOCATION * loc, - const char *fmt, ...); - -/** - * Internal trace macro. Not part of public API. - */ -#define __TIMM_OSAL_Trace(level, tracegrp, fmt, ...) \ - do { \ - static const __TIMM_OSAL_TRACE_LOCATION loc = { \ - __FILE__, __FUNCTION__, __LINE__, (level), (tracegrp) \ - }; \ - __TIMM_OSAL_TraceFunction(&loc, fmt "\n", ##__VA_ARGS__); \ - } while(0) - -/** -* TIMM_OSAL_Error() -- Fatal errors -*/ -#define TIMM_OSAL_Error(fmt,...) TIMM_OSAL_ErrorExt(TIMM_OSAL_TRACEGRP_SYSTEM, fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_Warning() -- Warnings that are useful to know about -*/ -#define TIMM_OSAL_Warning(fmt,...) TIMM_OSAL_WarningExt(TIMM_OSAL_TRACEGRP_SYSTEM, fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_Profiling() -- performance analysis trace that must not impact use case perf] -*/ -#define TIMM_OSAL_Profiling(fmt,...) TIMM_OSAL_ProfilingExt(TIMM_OSAL_TRACEGRP_SYSTEM, fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_Info() -- general information -*/ -#define TIMM_OSAL_Info(fmt,...) TIMM_OSAL_InfoExt(TIMM_OSAL_TRACEGRP_SYSTEM, fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_Debug() -- debug traces, most-commonly useful for developers -*/ -#define TIMM_OSAL_Debug(fmt,...) TIMM_OSAL_DebugExt(TIMM_OSAL_TRACEGRP_SYSTEM, fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_Entering() -- "ENTERING <function>" statements -* TIMM_OSAL_Exiting() -- "EXITING <function>" statements -*/ -#define TIMM_OSAL_Entering(fmt,...) TIMM_OSAL_EnteringExt(TIMM_OSAL_TRACEGRP_SYSTEM, fmt, ##__VA_ARGS__) -#define TIMM_OSAL_Exiting(fmt,...) TIMM_OSAL_ExitingExt(TIMM_OSAL_TRACEGRP_SYSTEM, fmt, ##__VA_ARGS__) - -/******************************************************************************* -** New Trace to be used by Applications -*******************************************************************************/ - -/** -* TIMM_OSAL_ErrorExt() -- Fatal errors -*/ -#define TIMM_OSAL_ErrorExt(tracegrp, fmt, ...) __TIMM_OSAL_Trace(TIMM_OSAL_TRACE_LEVEL_ERROR, tracegrp, "ERROR: " fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_WarningExt() -- Warnings that are useful to know about -*/ -#define TIMM_OSAL_WarningExt(tracegrp, fmt, ...) __TIMM_OSAL_Trace(TIMM_OSAL_TRACE_LEVEL_WARNING, tracegrp, "WARNING: " fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_ProfilingExt() -- performance analysis trace that must not impact use case perf] -*/ -#define TIMM_OSAL_ProfilingExt(tracegrp, fmt, ...) __TIMM_OSAL_Trace(TIMM_OSAL_TRACE_LEVEL_PROFILING, tracegrp, "PROFILING: " fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_InfoExt() -- general information -*/ -#define TIMM_OSAL_InfoExt(tracegrp, fmt, ...) __TIMM_OSAL_Trace(TIMM_OSAL_TRACE_LEVEL_INFO, tracegrp, "INFO: " fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_DebugExt() -- most-commonly used statement for us developers -*/ -#define TIMM_OSAL_DebugExt(tracegrp, fmt, ...) __TIMM_OSAL_Trace(TIMM_OSAL_TRACE_LEVEL_DEBUG, tracegrp, "TRACE: " fmt, ##__VA_ARGS__) - -/** -* TIMM_OSAL_EnteringExt() -- "ENTERING <function>" statements -* TIMM_OSAL_ExitingExt() -- "EXITING <function>" statements -*/ -#define TIMM_OSAL_EnteringExt(tracegrp, fmt, ...) __TIMM_OSAL_Trace(TIMM_OSAL_TRACE_LEVEL_ENTERING, tracegrp, "ENTER: " fmt, ##__VA_ARGS__) -#define TIMM_OSAL_ExitingExt(tracegrp, fmt, ...) __TIMM_OSAL_Trace(TIMM_OSAL_TRACE_LEVEL_EXITING, tracegrp, "EXIT: " fmt, ##__VA_ARGS__) - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_TRACES_H_ */ diff --git a/domx/mm_osal/inc/timm_osal_types.h b/domx/mm_osal/inc/timm_osal_types.h deleted file mode 100755 index 882148d..0000000 --- a/domx/mm_osal/inc/timm_osal_types.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_types.h -* The timm_osal_types header file defines the primative osal type definitions. -* @path -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -#ifndef _TIMM_OSAL_TYPES_H_ -#define _TIMM_OSAL_TYPES_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - - -#ifdef __KERNEL__ -#include <linux/types.h> -#else -#include <stdint.h> -#endif - - typedef int8_t TIMM_OSAL_S8; /*INT8 */ - typedef int16_t TIMM_OSAL_S16; /*INT16 */ - typedef int32_t TIMM_OSAL_S32; /*INT32 */ - -#define TIMM_OSAL_INT8_MIN 0xFF -#define TIMM_OSAL_INT8_MAX 0x7F - -#define TIMM_OSAL_INT16_MIN 0xFFFF -#define TIMM_OSAL_INT16_MAX 0x7FFF - -#define TIMM_OSAL_INT32_MIN 0xFFFFFFFF -#define TIMM_OSAL_INT32_MAX 0x7FFFFFFF - - typedef uint8_t TIMM_OSAL_U8; /*UINT8 */ - typedef uint16_t TIMM_OSAL_U16; /*UINT16 */ - typedef uint32_t TIMM_OSAL_U32; /*UINT32 */ - -#define TIMM_OSAL_UINT8_MIN 0 -#define TIMM_OSAL_UINT8_MAX 0xFF - -#define TIMM_OSAL_UINT16_MIN 0 -#define TIMM_OSAL_UINT16_MAX 0xFFFF - -#define TIMM_OSAL_UINT32_MIN 0 -#define TIMM_OSAL_UINT32_MAX 0xFFFFFFFF - - - typedef char TIMM_OSAL_CHAR; - /*CHAR*/ typedef void *TIMM_OSAL_HANDLE; - typedef void *TIMM_OSAL_PTR; - - typedef enum TIMM_OSAL_BOOL - { - TIMM_OSAL_FALSE = 0, - TIMM_OSAL_TRUE = !TIMM_OSAL_FALSE, - TIMM_OSAL_BOOL_MAX = 0x7FFFFFFF - } TIMM_OSAL_BOOL; - -#define TIMM_OSAL_SUSPEND 0xFFFFFFFFUL -#define TIMM_OSAL_NO_SUSPEND 0x0 -#define TIMM_OSAL_TIMED_OUT 0x7FFFFFFFUL - - -#define SUCCESS 0 -#define NO_SUCCESS -1 - -#define ERROR 1 -/* -#define TRUE 0 -#define FALSE 1 -*/ -#define URGENT_MESSAGE 2 -#define NORMAL_MESSAGE 1 - - -#define TIMM_OSAL_NULL 0 - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _TIMM_OSAL_TYPES_H_ */ diff --git a/domx/mm_osal/src/timm_osal.c b/domx/mm_osal/src/timm_osal.c deleted file mode 100755 index 85fdb66..0000000 --- a/domx/mm_osal/src/timm_osal.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file tiimm_osal.c -* This file contains methods that provides the functionality -* initializing/deinitializing the osal. -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 20-Oct-2008 Maiya ShreeHarsha:Linux specific changes - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ -#include "timm_osal_types.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" -/*#include "timm_osal_trace.h"*/ - - -/****************************************************************************** -* Function Prototypes -******************************************************************************/ - -/**************************************************************** -* PRIVATE DECLARATIONS : only used in this file -****************************************************************/ -/*--------data declarations -----------------------------------*/ - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_Init function initilize the osal with initial settings. -* -* @return TIMM_OSAL_ERR_NONE if successful -* !TIMM_OSAL_ERR_NONE if an error occurs -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_Init(void) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - return bReturnStatus; -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_Init function de-initilize the osal. -* -* @return TIMM_OSAL_ERR_NONE if successful -* !TIMM_OSAL_ERR_NONE if an error occurs -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_Deinit(void) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - return bReturnStatus; -} diff --git a/domx/mm_osal/src/timm_osal_events.c b/domx/mm_osal/src/timm_osal_events.c deleted file mode 100755 index 96f8e59..0000000 --- a/domx/mm_osal/src/timm_osal_events.c +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_events.c -* This file contains methods that provides the functionality -* for creating/using events. -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 06-Nov-2008 Maiya ShreeHarsha: Linux specific changes - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ -#include <stdio.h> -#include <pthread.h> /*for POSIX calls */ -#include <sys/time.h> -#include <errno.h> - -#include "timm_osal_types.h" -#include "timm_osal_trace.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" -#include "timm_osal_events.h" - - -typedef struct -{ - TIMM_OSAL_BOOL bSignaled; - TIMM_OSAL_U32 eFlags; - pthread_mutex_t mutex; - pthread_cond_t condition; -} TIMM_OSAL_THREAD_EVENT; - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_EventCreate function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventCreate(TIMM_OSAL_PTR * pEvents) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - TIMM_OSAL_THREAD_EVENT *plEvent = NULL; - - plEvent = - (TIMM_OSAL_THREAD_EVENT *) - TIMM_OSAL_Malloc(sizeof(TIMM_OSAL_THREAD_EVENT), 0, 0, 0); - - if (TIMM_OSAL_NULL == plEvent) - { - bReturnStatus = TIMM_OSAL_ERR_ALLOC; - goto EXIT; - } - plEvent->bSignaled = TIMM_OSAL_FALSE; - plEvent->eFlags = 0; - - if (SUCCESS != pthread_mutex_init(&(plEvent->mutex), NULL)) - { - TIMM_OSAL_Error("Event Create:Mutex Init failed !"); - goto EXIT; /*bReturnStatus = TIMM_OSAL_ERR_UNKNOWN */ - } - - if (SUCCESS != pthread_cond_init(&(plEvent->condition), NULL)) - { - TIMM_OSAL_Error - ("Event Create:Conditional Variable Init failed !"); - pthread_mutex_destroy(&(plEvent->mutex)); - /*TIMM_OSAL_Free(plEvent); */ - } else - { - *pEvents = (TIMM_OSAL_PTR) plEvent; - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - EXIT: - if ((TIMM_OSAL_ERR_NONE != bReturnStatus) && - (TIMM_OSAL_NULL != plEvent)) - { - TIMM_OSAL_Free(plEvent); - } - return bReturnStatus; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_EventDelete function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventDelete(TIMM_OSAL_PTR pEvents) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - TIMM_OSAL_THREAD_EVENT *plEvent = (TIMM_OSAL_THREAD_EVENT *) pEvents; - - if (TIMM_OSAL_NULL == plEvent) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - if (SUCCESS != pthread_mutex_lock(&(plEvent->mutex))) - { - TIMM_OSAL_Error("Event Delete: Mutex Lock failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - if (SUCCESS != pthread_cond_destroy(&(plEvent->condition))) - { - TIMM_OSAL_Error - ("Event Delete: Conditional Variable Destroy failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - - if (SUCCESS != pthread_mutex_unlock(&(plEvent->mutex))) - { - TIMM_OSAL_Error("Event Delete: Mutex Unlock failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - - if (SUCCESS != pthread_mutex_destroy(&(plEvent->mutex))) - { - TIMM_OSAL_Error("Event Delete: Mutex Destory failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - - TIMM_OSAL_Free(plEvent); - EXIT: - return bReturnStatus; -} - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_EventSet function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventSet(TIMM_OSAL_PTR pEvents, - TIMM_OSAL_U32 uEventFlags, TIMM_OSAL_EVENT_OPERATION eOperation) -{ - - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - TIMM_OSAL_THREAD_EVENT *plEvent = (TIMM_OSAL_THREAD_EVENT *) pEvents; - - if (TIMM_OSAL_NULL == plEvent) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - if (SUCCESS != pthread_mutex_lock(&(plEvent->mutex))) - { - TIMM_OSAL_Error("Event Set: Mutex Lock failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - goto EXIT; - } - - switch (eOperation) - { - case TIMM_OSAL_EVENT_AND: - plEvent->eFlags = plEvent->eFlags & uEventFlags; - break; - case TIMM_OSAL_EVENT_OR: - plEvent->eFlags = plEvent->eFlags | uEventFlags; - break; - default: - TIMM_OSAL_Error("Event Set: Bad eOperation !"); - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - pthread_mutex_unlock(&plEvent->mutex); - goto EXIT; - } - - plEvent->bSignaled = TIMM_OSAL_TRUE; - - if (SUCCESS != pthread_cond_signal(&plEvent->condition)) - { - TIMM_OSAL_Error - ("Event Set: Condition Variable Signal failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - pthread_mutex_unlock(&plEvent->mutex); - goto EXIT; - } - - if (SUCCESS != pthread_mutex_unlock(&plEvent->mutex)) - { - TIMM_OSAL_Error("Event Set: Mutex Unlock failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } else - bReturnStatus = TIMM_OSAL_ERR_NONE; - - EXIT: - return bReturnStatus; - - -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_EventRetrieve function -* -*Spurious wakeups from the pthread_cond_timedwait() or pthread_cond_wait() functions may occur. -* -*A representative sequence for using condition variables is shown below -* -*Thread A (Retrieve Events) |Thread B (Set Events) -*------------------------------------------------------------------------------------------------------------ -*1) Do work up to the point where a certain condition |1)Do work -* must occur (such as "count" must reach a specified |2)Lock associated mutex -* value) |3)Change the value of the global variable -*2) Lock associated mutex and check value of a global | that Thread-A is waiting upon. -* variable |4)Check value of the global Thread-A wait -*3) Call pthread_cond_wait() to perform a blocking wait | variable. If it fulfills the desired -* for signal from Thread-B. Note that a call to | condition, signal Thread-A. -* pthread_cond_wait() automatically and atomically |5)Unlock mutex. -* unlocks the associated mutex variable so that it can |6)Continue -* be used by Thread-B. | -*4) When signalled, wake up. Mutex is automatically and | -* atomically locked. | -*5) Explicitly unlock mutex | -*6) Continue | -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_EventRetrieve(TIMM_OSAL_PTR pEvents, - TIMM_OSAL_U32 uRequestedEvents, - TIMM_OSAL_EVENT_OPERATION eOperation, - TIMM_OSAL_U32 * pRetrievedEvents, TIMM_OSAL_U32 uTimeOutMsec) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - struct timespec timeout; - struct timeval now; - TIMM_OSAL_U32 timeout_us; - TIMM_OSAL_U32 isolatedFlags; - int status = -1; - int and_operation; - TIMM_OSAL_THREAD_EVENT *plEvent = (TIMM_OSAL_THREAD_EVENT *) pEvents; - - if (TIMM_OSAL_NULL == plEvent) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - /* Lock the mutex for access to the eFlags global variable */ - if (SUCCESS != pthread_mutex_lock(&(plEvent->mutex))) - { - TIMM_OSAL_Error("Event Retrieve: Mutex Lock failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - goto EXIT; - } - - /*Check the eOperation and put it in a variable */ - and_operation = ((TIMM_OSAL_EVENT_AND == eOperation) || - (TIMM_OSAL_EVENT_AND_CONSUME == eOperation)); - - /* Isolate the flags. The & operation is suffice for an TIMM_OSAL_EVENT_OR eOperation */ - isolatedFlags = plEvent->eFlags & uRequestedEvents; - - /*Check if it is the AND operation. If yes then, all the flags must match */ - if (and_operation) - { - isolatedFlags = (isolatedFlags == uRequestedEvents); - } - - - if (isolatedFlags) - { - - /*We have got required combination of the eFlags bits and will return it back */ - *pRetrievedEvents = plEvent->eFlags; - bReturnStatus = TIMM_OSAL_ERR_NONE; - } else - { - - /*Required combination of bits is not yet available */ - if (TIMM_OSAL_NO_SUSPEND == uTimeOutMsec) - { - *pRetrievedEvents = 0; - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - - else if (TIMM_OSAL_SUSPEND == uTimeOutMsec) - { - - /*Wait till we get the required combination of bits. We we get the required - *bits then we go out of the while loop - */ - while (!isolatedFlags) - { - - /*Wait on the conditional variable for another thread to set the eFlags and signal */ - pthread_cond_wait(&(plEvent->condition), - &(plEvent->mutex)); - - /* eFlags set by some thread. Now, isolate the flags. - * The & operation is suffice for an TIMM_OSAL_EVENT_OR eOperation - */ - isolatedFlags = - plEvent->eFlags & uRequestedEvents; - - /*Check if it is the AND operation. If yes then, all the flags must match */ - if (and_operation) - { - isolatedFlags = - (isolatedFlags == - uRequestedEvents); - } - } - - /* Obtained the requested combination of bits on eFlags */ - *pRetrievedEvents = plEvent->eFlags; - bReturnStatus = TIMM_OSAL_ERR_NONE; - - } else - { - - /* Calculate uTimeOutMsec in terms of the absolute time. uTimeOutMsec is in milliseconds */ - gettimeofday(&now, NULL); - timeout_us = now.tv_usec + 1000 * uTimeOutMsec; - timeout.tv_sec = now.tv_sec + timeout_us / 1000000; - timeout.tv_nsec = (timeout_us % 1000000) * 1000; - - while (!isolatedFlags) - { - - /* Wait till uTimeOutMsec for a thread to signal on the conditional variable */ - status = - pthread_cond_timedwait(&(plEvent-> - condition), &(plEvent->mutex), - &timeout); - - /*Timedout or error and returned without being signalled */ - if (SUCCESS != status) - { - if (ETIMEDOUT == status) - bReturnStatus = - TIMM_OSAL_ERR_NONE; - *pRetrievedEvents = 0; - break; - } - - /* eFlags set by some thread. Now, isolate the flags. - * The & operation is suffice for an TIMM_OSAL_EVENT_OR eOperation - */ - isolatedFlags = - plEvent->eFlags & uRequestedEvents; - - /*Check if it is the AND operation. If yes then, all the flags must match */ - if (and_operation) - { - isolatedFlags = - (isolatedFlags == - uRequestedEvents); - } - - } - } - } - - /*If we have got the required combination of bits, we will have to reset the eFlags if CONSUME is mentioned - *in the eOperations - */ - if (isolatedFlags && ((eOperation == TIMM_OSAL_EVENT_AND_CONSUME) || - (eOperation == TIMM_OSAL_EVENT_OR_CONSUME))) - { - plEvent->eFlags = 0; - } - - /*Manually unlock the mutex */ - if (SUCCESS != pthread_mutex_unlock(&(plEvent->mutex))) - { - TIMM_OSAL_Error("Event Retrieve: Mutex Unlock failed !"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - - EXIT: - return bReturnStatus; - -} diff --git a/domx/mm_osal/src/timm_osal_memory.c b/domx/mm_osal/src/timm_osal_memory.c deleted file mode 100755 index 22eb0a4..0000000 --- a/domx/mm_osal/src/timm_osal_memory.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_memory.c -* This file contains methods that provides the functionality -* for allocating/deallocating memory. -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *!23-Oct-2008 Maiya ShreeHarsha: Linux specific changes - *!0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ - -#include <string.h> -#include <malloc.h> - -#ifdef __KERNEL__ -#include <linux/types.h> -#else -#include <stdint.h> -#endif - - -#include "timm_osal_types.h" -#include "timm_osal_trace.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" - - - -static TIMM_OSAL_U32 gMallocCounter = 0; - -/****************************************************************************** -* Function Prototypes -******************************************************************************/ - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_createMemoryPool function -* -* @see -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_CreateMemoryPool(void) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - return bReturnStatus; -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_DeleteMemoryPool function -* -* @see -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_DeleteMemoryPool(void) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - return bReturnStatus; - -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_Malloc function -* -* @see -*/ -/* ========================================================================== */ -TIMM_OSAL_PTR TIMM_OSAL_Malloc(TIMM_OSAL_U32 size, - TIMM_OSAL_BOOL bBlockContiguous, - TIMM_OSAL_U32 unBlockAlignment, TIMMOSAL_MEM_SEGMENTID tMemSegId) -{ - - TIMM_OSAL_PTR pData = TIMM_OSAL_NULL; - -#ifdef HAVE_MEMALIGN - if (0 == unBlockAlignment) - { - pData = malloc((size_t) size); - } else - { - pData = memalign((size_t) unBlockAlignment, (size_t) size); - } -#else - if (0 != unBlockAlignment) - { - TIMM_OSAL_Warning - ("Memory Allocation:Not done for specified nBufferAlignment. Alignment of 0 will be used"); - - } - pData = malloc((size_t) size); /*size_t is long long */ -#endif - if (TIMM_OSAL_NULL == pData) - { - TIMM_OSAL_Error("Malloc failed!!!"); - } else - { - /* Memory Allocation was successfull */ - gMallocCounter++; - } - - - return pData; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_Free function .... -* -* @see -*/ -/* ========================================================================== */ - -void TIMM_OSAL_Free(TIMM_OSAL_PTR pData) -{ - if (TIMM_OSAL_NULL == pData) - { - /*TIMM_OSAL_Warning("TIMM_OSAL_Free called on NULL pointer"); */ - goto EXIT; - } - - free(pData); - pData = NULL; - gMallocCounter--; - EXIT: - return; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_Memset function .... -* -* @see -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_Memset(TIMM_OSAL_PTR pBuffer, - TIMM_OSAL_U8 uValue, TIMM_OSAL_U32 uSize) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - - memset((void *)pBuffer, (int)uValue, (size_t) uSize); - bReturnStatus = TIMM_OSAL_ERR_NONE; - - return bReturnStatus; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_Memcmp function .... -* -* @see -*/ -/* ========================================================================== */ - -TIMM_OSAL_S32 TIMM_OSAL_Memcmp(TIMM_OSAL_PTR pBuffer1, TIMM_OSAL_PTR pBuffer2, - TIMM_OSAL_U32 uSize) -{ - TIMM_OSAL_S32 result = memcmp(pBuffer1, pBuffer2, uSize); - - if (result > 0) - { - return 1; - } else if (result < 0) - { - return -1; - } - - return 0; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_Memcpy function .... -* -* @see -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_Memcpy(TIMM_OSAL_PTR pBufDst, - TIMM_OSAL_PTR pBufSrc, TIMM_OSAL_U32 uSize) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - - memcpy(pBufDst, pBufSrc, uSize); - bReturnStatus = TIMM_OSAL_ERR_NONE; - - return bReturnStatus; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_GetMemCounter function .... -* -* @see -*/ -/* ========================================================================== */ - -TIMM_OSAL_U32 TIMM_OSAL_GetMemCounter(void) -{ - - return gMallocCounter; -} diff --git a/domx/mm_osal/src/timm_osal_mutex.c b/domx/mm_osal/src/timm_osal_mutex.c deleted file mode 100755 index 5cfecf8..0000000 --- a/domx/mm_osal/src/timm_osal_mutex.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_Mutexs.c -* This file contains methods that provides the functionality -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 04-Nov-2008 Maiya ShreeHarsha: Linux specific changes - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ - - -#include "timm_osal_types.h" -#include "timm_osal_trace.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" -#include "timm_osal_semaphores.h" - -#include <errno.h> - -#include <pthread.h> -#include <sys/time.h> - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_MutexCreate function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexCreate(TIMM_OSAL_PTR * pMutex) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - pthread_mutex_t *plMutex = TIMM_OSAL_NULL; - - plMutex = - (pthread_mutex_t *) TIMM_OSAL_Malloc(sizeof(pthread_mutex_t), 0, - 0, 0); - if (TIMM_OSAL_NULL == plMutex) - { - bReturnStatus = TIMM_OSAL_ERR_ALLOC; - goto EXIT; - } - - /*if (SUCCESS != pthread_mutex_init(plMutex, pAttr)) */ - if (SUCCESS != pthread_mutex_init(plMutex, TIMM_OSAL_NULL)) - { - /*TIMM_OSAL_Error ("Mutex Create failed !"); */ - /*goto EXIT; */ - } else - { - /**pMutex = (TIMM_OSAL_PTR *)plMutex;*/ - *pMutex = (TIMM_OSAL_PTR) plMutex; - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - EXIT: - /*if((TIMM_OSAL_ERR_NONE != bReturnStatus)) { - TIMM_OSAL_Free(plMutex); - } */ - if ((TIMM_OSAL_ERR_NONE != bReturnStatus) && - (TIMM_OSAL_NULL != plMutex)) - { - TIMM_OSAL_Free(plMutex); - } - return bReturnStatus; - -/**********************************************************/ -/*return TIMM_OSAL_SemaphoreCreate(pMutex, 1);*/ -/**********************************************************/ -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_MutexDelete function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexDelete(TIMM_OSAL_PTR pMutex) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - pthread_mutex_t *plMutex = (pthread_mutex_t *) pMutex; - - if (plMutex == TIMM_OSAL_NULL) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - /*can we do away with if or with switch case */ - if (SUCCESS != pthread_mutex_destroy(plMutex)) - { - /*TIMM_OSAL_Error("Delete Mutex failed !"); */ - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN;; - } - - TIMM_OSAL_Free(plMutex); - EXIT: - return bReturnStatus; -/**********************************************************/ -/*return TIMM_OSAL_SemaphoreDelete(pMutex);*/ -/**********************************************************/ - -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_MutexObtain function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexObtain(TIMM_OSAL_PTR pMutex, - TIMM_OSAL_U32 uTimeOut) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - struct timespec abs_timeout; - struct timeval ltime_now; - TIMM_OSAL_U32 ltimenow_us; - pthread_mutex_t *plMutex = (pthread_mutex_t *) pMutex; - - if (plMutex == TIMM_OSAL_NULL) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - if (TIMM_OSAL_SUSPEND == uTimeOut) - { - if (SUCCESS != pthread_mutex_lock(plMutex)) - { - /*TIMM_OSAL_Error("Lock Mutex failed !"); */ - goto EXIT; - } - } else if (TIMM_OSAL_NO_SUSPEND == uTimeOut) - { - if (SUCCESS != pthread_mutex_trylock(plMutex)) - { - /*TIMM_OSAL_Error("Lock Mutex failed !"); */ - goto EXIT; - } - } else - { - gettimeofday(<ime_now, NULL); - /*uTimeOut is assumed to be in milliseconds */ - ltimenow_us = ltime_now.tv_usec + 1000 * uTimeOut; - abs_timeout.tv_sec = ltime_now.tv_sec + uTimeOut / 1000; - abs_timeout.tv_nsec = (ltimenow_us % 1000000) * 1000; - -#ifdef _POSIX_VERSION_1_ - if (SUCCESS != pthread_mutex_lock(plMutex)) - { //Some Posix versions dont support timeout -#else - if (SUCCESS != pthread_mutex_timedlock(plMutex, &abs_timeout)) - { -#endif - /*TIMM_OSAL_Error("Lock Mutex failed !"); */ - goto EXIT; - } - } - bReturnStatus = TIMM_OSAL_ERR_NONE; - - EXIT: - return bReturnStatus; -/**********************************************************/ -/*return TIMM_OSAL_SemaphoreObtain(pMutex, uTimeOut);*/ -/**********************************************************/ -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_MutexRelease function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_MutexRelease(TIMM_OSAL_PTR pMutex) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - pthread_mutex_t *plMutex = (pthread_mutex_t *) pMutex; - - if (TIMM_OSAL_NULL == plMutex) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - if (SUCCESS != pthread_mutex_unlock(plMutex)) - { - /*TIMM_OSAL_Error("Unlock Mutex failed !"); */ - } else - { - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - EXIT: - return bReturnStatus; -/**********************************************************/ -/*return TIMM_OSAL_SemaphoreRelease(pMutex);*/ -/**********************************************************/ -} diff --git a/domx/mm_osal/src/timm_osal_pipes.c b/domx/mm_osal/src/timm_osal_pipes.c deleted file mode 100755 index 1c38354..0000000 --- a/domx/mm_osal/src/timm_osal_pipes.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_pipes.c -* This file contains methods that provides the functionality -* for creating/using Nucleus pipes. -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 07-Nov-2008 Maiya ShreeHarsha: Linux specific changes - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ - -#include "timm_osal_types.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" -#include "timm_osal_trace.h" - -#include <unistd.h> -#include <stdio.h> -#include <unistd.h> -#include <errno.h> - -/** -* TIMM_OSAL_PIPE structure define the OSAL pipe -*/ -typedef struct TIMM_OSAL_PIPE -{ - int pfd[2]; - TIMM_OSAL_U32 pipeSize; - TIMM_OSAL_U32 messageSize; - TIMM_OSAL_U8 isFixedMessage; - int messageCount; - int totalBytesInPipe; -} TIMM_OSAL_PIPE; - - -/****************************************************************************** -* Function Prototypes -******************************************************************************/ - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_CreatePipe function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_CreatePipe(TIMM_OSAL_PTR * pPipe, - TIMM_OSAL_U32 pipeSize, - TIMM_OSAL_U32 messageSize, TIMM_OSAL_U8 isFixedMessage) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - TIMM_OSAL_PIPE *pHandle = TIMM_OSAL_NULL; - - pHandle = - (TIMM_OSAL_PIPE *) TIMM_OSAL_Malloc(sizeof(TIMM_OSAL_PIPE), 0, 0, - 0); - - if (TIMM_OSAL_NULL == pHandle) - { - bReturnStatus = TIMM_OSAL_ERR_ALLOC; - goto EXIT; - } - TIMM_OSAL_Memset(pHandle, 0x0, sizeof(TIMM_OSAL_PIPE)); - - pHandle->pfd[0] = -1; - pHandle->pfd[1] = -1; - if (SUCCESS != pipe(pHandle->pfd)) - { - TIMM_OSAL_Error("Pipe failed: %s!!!", strerror(errno)); - goto EXIT; - } - - pHandle->pipeSize = pipeSize; - pHandle->messageSize = messageSize; - pHandle->isFixedMessage = isFixedMessage; - pHandle->messageCount = 0; - pHandle->totalBytesInPipe = 0; - - *pPipe = (TIMM_OSAL_PTR) pHandle; - - bReturnStatus = TIMM_OSAL_ERR_NONE; - - - return bReturnStatus; -EXIT: - TIMM_OSAL_Free(pHandle); - return bReturnStatus; -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_DeletePipe function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_DeletePipe(TIMM_OSAL_PTR pPipe) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - - TIMM_OSAL_PIPE *pHandle = (TIMM_OSAL_PIPE *) pPipe; - - if (TIMM_OSAL_NULL == pHandle) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - if (SUCCESS != close(pHandle->pfd[0])) - { - TIMM_OSAL_Error("Delete_Pipe Read fd failed!!!"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - if (SUCCESS != close(pHandle->pfd[1])) - { - TIMM_OSAL_Error("Delete_Pipe Write fd failed!!!"); - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - - TIMM_OSAL_Free(pHandle); -EXIT: - return bReturnStatus; -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_WriteToPipe function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_WriteToPipe(TIMM_OSAL_PTR pPipe, - void *pMessage, TIMM_OSAL_U32 size, TIMM_OSAL_S32 timeout) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - TIMM_OSAL_U32 lSizeWritten = -1; - - TIMM_OSAL_PIPE *pHandle = (TIMM_OSAL_PIPE *) pPipe; - - if (size == 0) - { - TIMM_OSAL_Error("0 size!!!"); - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - lSizeWritten = write(pHandle->pfd[1], pMessage, size); - - if (lSizeWritten != size) - { - TIMM_OSAL_Error("Write of pipe failed!!!"); - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - /*Update message count and size */ - pHandle->messageCount++; - pHandle->totalBytesInPipe += size; - - bReturnStatus = TIMM_OSAL_ERR_NONE; - - EXIT: - return bReturnStatus; -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_WriteToFrontOfPipe function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_WriteToFrontOfPipe(TIMM_OSAL_PTR pPipe, - void *pMessage, TIMM_OSAL_U32 size, TIMM_OSAL_S32 timeout) -{ - - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - TIMM_OSAL_U32 lSizeWritten = -1; - TIMM_OSAL_U32 lSizeRead = -1; - TIMM_OSAL_PIPE *pHandle = (TIMM_OSAL_PIPE *) pPipe; - TIMM_OSAL_U8 *tempPtr = NULL; - - - /*First write to this pipe */ - if (size == 0) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - lSizeWritten = write(pHandle->pfd[1], pMessage, size); - - if (lSizeWritten != size) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - /*Update number of messages */ - pHandle->messageCount++; - - - if (pHandle->messageCount > 1) - { - /*First allocate memory */ - tempPtr = - (TIMM_OSAL_U8 *) TIMM_OSAL_Malloc(pHandle-> - totalBytesInPipe, 0, 0, 0); - - if (tempPtr == NULL) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - /*Read out of pipe */ - lSizeRead = - read(pHandle->pfd[0], tempPtr, pHandle->totalBytesInPipe); - - /*Write back to pipe */ - lSizeWritten = - write(pHandle->pfd[1], tempPtr, - pHandle->totalBytesInPipe); - - if (lSizeWritten != size) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - /*Update Total bytes in pipe */ - pHandle->totalBytesInPipe += size; - } - - - EXIT: - TIMM_OSAL_Free(tempPtr); - - return bReturnStatus; - -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_ReadFromPipe function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_ReadFromPipe(TIMM_OSAL_PTR pPipe, - void *pMessage, - TIMM_OSAL_U32 size, TIMM_OSAL_U32 * actualSize, TIMM_OSAL_S32 timeout) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - TIMM_OSAL_U32 lSizeRead = -1; - TIMM_OSAL_PIPE *pHandle = (TIMM_OSAL_PIPE *) pPipe; - - if (size == 0) - { - TIMM_OSAL_Error("nRead size has error!!!"); - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - if ((pHandle->messageCount == 0) && (timeout == TIMM_OSAL_NO_SUSPEND)) - { - /*If timeout is 0 and pipe is empty, return error */ - TIMM_OSAL_Error("Pipe is empty!!!"); - bReturnStatus = TIMM_OSAL_ERR_PIPE_EMPTY; - goto EXIT; - } - if ((timeout !=TIMM_OSAL_NO_SUSPEND) && - (timeout != (TIMM_OSAL_S32)TIMM_OSAL_SUSPEND)) - { - TIMM_OSAL_Warning("Only infinite or no timeouts \ - supported. Going to read with infinite timeout now"); - } - /*read blocks infinitely until message is available */ - *actualSize = lSizeRead = read(pHandle->pfd[0], pMessage, size); - if (0 == lSizeRead) - { - TIMM_OSAL_Error("EOF reached or no data in pipe!!!"); - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - bReturnStatus = TIMM_OSAL_ERR_NONE; - - pHandle->messageCount--; - pHandle->totalBytesInPipe -= size; - - EXIT: - return bReturnStatus; - -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_ClearPipe function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_ClearPipe(TIMM_OSAL_PTR pPipe) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR; - - TIMM_OSAL_Warning("This function is currently not implemented"); - - return bReturnStatus; -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_IsPipeReady function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_IsPipeReady(TIMM_OSAL_PTR pPipe) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR; - TIMM_OSAL_PIPE *pHandle = (TIMM_OSAL_PIPE *) pPipe; - - if (pHandle->messageCount <= 0) - { - bReturnStatus = TIMM_OSAL_ERR_NOT_READY; - } else - { - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - - return bReturnStatus; - -} - - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_GetPipeReadyMessageCount function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_GetPipeReadyMessageCount(TIMM_OSAL_PTR pPipe, - TIMM_OSAL_U32 * count) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - TIMM_OSAL_PIPE *pHandle = (TIMM_OSAL_PIPE *) pPipe; - - *count = pHandle->messageCount; - return bReturnStatus; - -} diff --git a/domx/mm_osal/src/timm_osal_semaphores.c b/domx/mm_osal/src/timm_osal_semaphores.c deleted file mode 100755 index b69ee3c..0000000 --- a/domx/mm_osal/src/timm_osal_semaphores.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_semaphores.c -* This file contains methods that provides the functionality -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 30-Oct-2008 Maiya ShreeHarsha: Linux specific changes - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ - -#include <stdio.h> - -#include <semaphore.h> -#include <sys/time.h> - - -#include "timm_osal_types.h" -#include "timm_osal_trace.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" - - -#define SEMNAME_MAX 7 - -/* -typedef struct TIMM_OSAL_SEMAPHORE { - sem_t sem; - CHAR name[SEMNAME_MAX]; -} TIMM_OSAL_SEMAPHORE; -*/ - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_SemaphoreCreate function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreCreate(TIMM_OSAL_PTR * pSemaphore, - TIMM_OSAL_U32 uInitCount) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - *pSemaphore = TIMM_OSAL_NULL; - - sem_t *psem = (sem_t *) TIMM_OSAL_Malloc(sizeof(sem_t), 0, 0, 0); - - if (TIMM_OSAL_NULL == psem) - { - bReturnStatus = TIMM_OSAL_ERR_ALLOC; - goto EXIT; - } - - /*Unnamed semaphore */ - if (SUCCESS != sem_init(psem, 0, uInitCount)) - { - /*TIMM_OSAL_Error("Semaphore Create failed !"); */ - /*goto EXIT; */ - } else - { - *pSemaphore = (TIMM_OSAL_PTR) psem; - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - EXIT: - if ((TIMM_OSAL_ERR_NONE != bReturnStatus) && (TIMM_OSAL_NULL != psem)) - { - TIMM_OSAL_Free(psem); - } - return bReturnStatus; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_SemaphoreDelete function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreDelete(TIMM_OSAL_PTR pSemaphore) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_NONE; - sem_t *psem = (sem_t *) pSemaphore; - - if (psem == TIMM_OSAL_NULL) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - /* Release the semaphore. */ - if (SUCCESS != sem_destroy(psem)) - { - /*TIMM_OSAL_Error("Semaphore Delete failed !"); */ - bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - } - - TIMM_OSAL_Free(psem); - EXIT: - return bReturnStatus; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_SemaphoreObtain function -* -* -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreObtain(TIMM_OSAL_PTR pSemaphore, - TIMM_OSAL_U32 uTimeOut) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - struct timeval ltime_now; - struct timespec abs_timeout; - sem_t *psem = (sem_t *) pSemaphore; - - if (psem == TIMM_OSAL_NULL) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - if (TIMM_OSAL_SUSPEND == uTimeOut) - { - if (SUCCESS != sem_wait(psem)) - { - /*TIMM_OSAL_Error("Semaphore Wait failed !"); */ - goto EXIT; - } - - } else if (TIMM_OSAL_NO_SUSPEND == uTimeOut) - { - if (SUCCESS != sem_trywait(psem)) - { - /*TIMM_OSAL_Error("Semaphore blocked !"); */ - goto EXIT; - } - } else - { - /*Some delay in calling gettimeofday and sem_timedwait - cant - be avoided. Possibility of thread switch after gettimeofday - in which case time out will be less than expected */ - gettimeofday(<ime_now, NULL); - /*uTimeOut is assumed to be in milliseconds */ - abs_timeout.tv_sec = ltime_now.tv_sec + (uTimeOut / 1000); - abs_timeout.tv_nsec = - 1000 * (ltime_now.tv_usec + ((uTimeOut % 1000) * 1000)); - - if (SUCCESS != sem_timedwait(psem, &abs_timeout)) - { - /*TIMM_OSAL_Error("Semaphore Timed Wait failed !"); */ - goto EXIT; - } - } - bReturnStatus = TIMM_OSAL_ERR_NONE; - - EXIT: - return bReturnStatus; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_SemaphoreRelease function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreRelease(TIMM_OSAL_PTR pSemaphore) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - sem_t *psem = (sem_t *) pSemaphore; - - if (TIMM_OSAL_NULL == psem) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - /* Release the semaphore. */ - if (SUCCESS != sem_post(psem)) - { - /*TIMM_OSAL_Error("Release failed !"); */ - } else - { - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - - EXIT: - return bReturnStatus; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_SemaphoreReset function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_SemaphoreReset(TIMM_OSAL_PTR pSemaphore, - TIMM_OSAL_U32 uInitCount) -{ - /* TIMM_OSAL_SEMAPHORE *pHandle = (TIMM_OSAL_SEMAPHORE *)pSemaphore; - STATUS status; - TIMM_OSAL_ERRORTYPE bReturnStatus; */ - - - /* Release the semaphore. */ - /*status = NU_Reset_Semaphore(&(pHandle->sem), - uInitCount); - */ - /* switch(status) - { - case NU_SUCCESS: - bReturnStatus = TIMM_OSAL_ERR_NONE; - break; - default: - bReturnStatus = TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR, TIMM_OSAL_COMP_SEMAPHORES, status); - break; - } - */ - /* return bReturnStatus; */ - return TIMM_OSAL_ERR_UNKNOWN; -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_GetSemaphoreCount function -* -* -*/ -/* ========================================================================== */ -TIMM_OSAL_ERRORTYPE TIMM_OSAL_GetSemaphoreCount(TIMM_OSAL_PTR pSemaphore, - TIMM_OSAL_U32 * count) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - int sval = -2; /*value that is not possible */ - sem_t *psem = (sem_t *) pSemaphore; - - if (TIMM_OSAL_NULL == psem) - { - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - - /* Release the semaphore. */ - if (SUCCESS != sem_getvalue(psem, &sval)) - { - /*TIMM_OSAL_Error("Get Semaphore Count failed !"); */ - } else - { - *count = sval; - bReturnStatus = TIMM_OSAL_ERR_NONE; - } - - EXIT: - return bReturnStatus; -} diff --git a/domx/mm_osal/src/timm_osal_task.c b/domx/mm_osal/src/timm_osal_task.c deleted file mode 100755 index 7a243a9..0000000 --- a/domx/mm_osal/src/timm_osal_task.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_task.c -* This file contains methods that provides the functionality -* for creating/destroying tasks. -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! 21-Oct-2008 Maiya ShreeHarsha: Linux specific changes - *! 0.1: Created the first draft version, ksrini@ti.com - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ - -#include <stdio.h> -#include <pthread.h> /*for POSIX calls */ -#include <sched.h> /*for sched structure */ -#include <unistd.h> - - - -#include "timm_osal_types.h" -#include "timm_osal_trace.h" -#include "timm_osal_error.h" -#include "timm_osal_memory.h" -#include "timm_osal_task.h" - - - - -/** -* TIMM_OSAL_TASK describe the different task information -*/ -typedef struct TIMM_OSAL_TASK -{ - pthread_t threadID; /*SHM check */ - /* To set the priority and stack size */ - pthread_attr_t ThreadAttr; /*For setting the priority and stack size */ - /** Name of the task */ - /* TIMM_OSAL_S8 name[8];*//* eight character plus null char */ - /** Pointer to the task stack memory */ -/* TIMM_OSAL_PTR stackPtr;*/ - /** Size of the task stack */ -/* TIMM_OSAL_S32 stackSize;*/ - /*parameters to the task */ - TIMM_OSAL_U32 uArgc; - TIMM_OSAL_PTR pArgv; - /** task priority */ -/* TIMM_OSAL_S32 priority;*/ - /** flag to check if task got created */ - TIMM_OSAL_BOOL isCreated; -} TIMM_OSAL_TASK; - - -/****************************************************************************** -* Function Prototypes -******************************************************************************/ - - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_CreateTask function -* -* @see -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_CreateTask(TIMM_OSAL_PTR * pTask, - TIMM_OSAL_TaskProc pFunc, - TIMM_OSAL_U32 uArgc, - TIMM_OSAL_PTR pArgv, - TIMM_OSAL_U32 uStackSize, TIMM_OSAL_U32 uPriority, TIMM_OSAL_S8 * pName) -{ - - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - TIMM_OSAL_TASK *pHandle = TIMM_OSAL_NULL; - struct sched_param sched; - size_t stackSize; - *pTask = TIMM_OSAL_NULL; - - - /*Task structure allocation */ - pHandle = - (TIMM_OSAL_TASK *) TIMM_OSAL_Malloc(sizeof(TIMM_OSAL_TASK), 0, 0, - 0); - if (pHandle == TIMM_OSAL_NULL) - { - bReturnStatus = TIMM_OSAL_ERR_ALLOC; - goto EXIT; - } - - /* Initial cleaning of the task structure */ - TIMM_OSAL_Memset((TIMM_OSAL_PTR) pHandle, 0, sizeof(TIMM_OSAL_TASK)); - - /*Arguments for task */ - pHandle->uArgc = uArgc; - pHandle->pArgv = pArgv; - - pHandle->isCreated = TIMM_OSAL_FALSE; - - - if (SUCCESS != pthread_attr_init(&pHandle->ThreadAttr)) - { - /*TIMM_OSAL_Error("Task Init Attr Init failed!"); */ - goto EXIT; - } - /* Updation of the priority and the stack size */ - - if (SUCCESS != pthread_attr_getschedparam(&pHandle->ThreadAttr, - &sched)) - { - /*TIMM_OSAL_Error("Task Init Get Sched Params failed!"); */ - goto EXIT; - } - - sched.sched_priority = uPriority; /* relative to the default priority */ - if (SUCCESS != pthread_attr_setschedparam(&pHandle->ThreadAttr, - &sched)) - { - /*TIMM_OSAL_Error("Task Init Set Sched Paramsfailed!"); */ - goto EXIT; - } - - /*First get the default stack size */ - if (SUCCESS != pthread_attr_getstacksize(&pHandle->ThreadAttr, - &stackSize)) - { - /*TIMM_OSAL_Error("Task Init Set Stack Size failed!"); */ - goto EXIT; - } - - /*Check if requested stack size is larger than the current default stack size */ - if (uStackSize > stackSize) - { - stackSize = uStackSize; - if (SUCCESS != pthread_attr_setstacksize(&pHandle->ThreadAttr, - stackSize)) - { - /*TIMM_OSAL_Error("Task Init Set Stack Size failed!"); */ - goto EXIT; - } - } - - - - if (SUCCESS != pthread_create(&pHandle->threadID, - &pHandle->ThreadAttr, pFunc, pArgv)) - { - /*TIMM_OSAL_Error ("Create_Task failed !"); */ - goto EXIT; - } - - - /* Task was successfully created */ - pHandle->isCreated = TIMM_OSAL_TRUE; - *pTask = (TIMM_OSAL_PTR) pHandle; - bReturnStatus = TIMM_OSAL_ERR_NONE; - /**pTask = (TIMM_OSAL_PTR *)pHandle;*/ - - EXIT: -/* if((TIMM_OSAL_ERR_NONE != bReturnStatus) && (TIMM_OSAL_NULL != pHandle)) { - TIMM_OSAL_Free (pHandle->stackPtr);*/ - if ((TIMM_OSAL_ERR_NONE != bReturnStatus)) - { - TIMM_OSAL_Free(pHandle); - } - return bReturnStatus; - -} - -/* ========================================================================== */ -/** -* @fn TIMM_OSAL_DeleteTask -* -* @see -*/ -/* ========================================================================== */ - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_DeleteTask(TIMM_OSAL_PTR pTask) -{ - TIMM_OSAL_ERRORTYPE bReturnStatus = TIMM_OSAL_ERR_UNKNOWN; - - TIMM_OSAL_TASK *pHandle = (TIMM_OSAL_TASK *) pTask; - void *retVal; - - if ((NULL == pHandle) || (TIMM_OSAL_TRUE != pHandle->isCreated)) - { - /* this task was never created */ - bReturnStatus = TIMM_OSAL_ERR_PARAMETER; - goto EXIT; - } - if (pthread_attr_destroy(&pHandle->ThreadAttr)) - { - /*TIMM_OSAL_Error("Delete_Task failed !"); */ - goto EXIT; - } - if (pthread_join(pHandle->threadID, &retVal)) - { - /*TIMM_OSAL_Error("Delete_Task failed !"); */ - goto EXIT; - /* bReturnStatus = TIMM_OSAL_ERR_CREATE(TIMM_OSAL_ERR, TIMM_OSAL_COMP_TASK, status);*//*shm to be done */ - } - bReturnStatus = TIMM_OSAL_ERR_NONE; - TIMM_OSAL_Free(pHandle); - EXIT: - return bReturnStatus; -} - - -TIMM_OSAL_ERRORTYPE TIMM_OSAL_SleepTask(TIMM_OSAL_U32 mSec) -{ - TIMM_OSAL_S32 nReturn = 0; - -#ifdef _POSIX_VERSION_1_ - usleep(1000 * mSec); -#else - nReturn = usleep(1000 * mSec); -#endif - if (nReturn == 0) - return TIMM_OSAL_ERR_NONE; - else - return TIMM_OSAL_ERR_UNKNOWN; -} diff --git a/domx/mm_osal/src/timm_osal_trace.c b/domx/mm_osal/src/timm_osal_trace.c deleted file mode 100755 index 498054f..0000000 --- a/domx/mm_osal/src/timm_osal_trace.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2010, Texas Instruments Incorporated - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of Texas Instruments Incorporated nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* -* @file timm_osal_trace.c -* This file contains methods that provides the functionality -* for logging errors/warings/information/etc. -* -* @path \ -* -*/ -/* -------------------------------------------------------------------------- */ -/* ========================================================================= - *! - *! Revision History - *! =================================== - *! - * ========================================================================= */ - -/****************************************************************************** -* Includes -******************************************************************************/ - -/*#include "typedefs.h"*/ -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include "timm_osal_trace.h" - -#ifdef _Android -#define LOG_TAG "DOMX" -#include <utils/Log.h> -#include <cutils/properties.h> -#endif - -/** -* The OSAL debug trace detail can be set at compile time by defining the flag -* TIMM_OSAL_DEBUG_TRACE_DETAIL=<Details> -* detail - 0 - no detail -* 1 - function name -* 2 - function name, line number -* Prefix is added to every debug trace message -*/ -#ifndef TIMM_OSAL_DEBUG_TRACE_DETAIL -#define TIMM_OSAL_DEBUG_TRACE_DETAIL 2 -#endif - -#define DEFAULT_TRACE_LEVEL TIMM_OSAL_TRACE_LEVEL_ERROR - -static int trace_level = -1; - -/* strip out leading ../ stuff that happens to __FILE__ for out-of-tree builds */ -static const char *simplify_path(const char *file) -{ - while (file) - { - char c = file[0]; - if ((c != '.') && (c != '/') && (c != '\\')) - break; - file++; - } - return file; -} - -void TIMM_OSAL_UpdateTraceLevel(void) -{ - char *val = getenv("TIMM_OSAL_DEBUG_TRACE_LEVEL"); - - if (val) - { - trace_level = strtol(val, NULL, 0); - } - else - { -#ifdef _Android - char value[PROPERTY_VALUE_MAX]; - int val; - - property_get("debug.domx.trace_level", value, "0"); - val = atoi(value); - if ( (!val) || (val < 0) ) - { - trace_level = DEFAULT_TRACE_LEVEL; - } - else - trace_level = val; -#else - trace_level = DEFAULT_TRACE_LEVEL; -#endif - } -} - -void __TIMM_OSAL_TraceFunction(const __TIMM_OSAL_TRACE_LOCATION * loc, - const char *fmt, ...) -{ - if (trace_level == -1) - { - char *val = getenv("TIMM_OSAL_DEBUG_TRACE_LEVEL"); - trace_level = - val ? strtol(val, NULL, 0) : DEFAULT_TRACE_LEVEL; - } - - if (trace_level >= loc->level) - { - va_list ap; - - va_start(ap, fmt); /* make ap point to first arg after 'fmt' */ - -#ifdef _Android - -#if 0 // Original for reference -#if ( TIMM_OSAL_DEBUG_TRACE_DETAIL > 1 ) - ALOGD("%s:%d\t%s()\t", simplify_path(loc->file), loc->line, - loc->function); -#endif -#else // Prints function_name for ERROR, WARNING and ENTRY/EXIT - if ( (loc->level == TIMM_OSAL_TRACE_LEVEL_ERROR) || (loc->level == TIMM_OSAL_TRACE_LEVEL_WARNING) || (loc->level == TIMM_OSAL_TRACE_LEVEL_ENTERING) ) - ALOGD("%s:%d\t%s()\t", simplify_path(loc->file), loc->line, - loc->function); -#endif - - char string[1000]; - vsprintf(string, fmt, ap); - ALOGD("%s",string); - -#else - -#if 0 // Original for reference -#if ( TIMM_OSAL_DEBUG_TRACE_DETAIL > 1 ) - printf("%s:%d\t%s()\t", simplify_path(loc->file), loc->line, - loc->function); -#endif -#else // Prints function_name for ERROR, WARNING and ENTRY/EXIT - if ( (loc->level == 1) || (loc->level == 2) || (loc->level == 5) ) - printf("%s:%d\t%s()\t", simplify_path(loc->file), loc->line, - loc->function); -#endif - - vprintf(fmt, ap); - -#endif - - va_end(ap); - } -} |