summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnie Reynoso <ariner@ti.com>2013-09-25 08:50:34 -0700
committerChris Ring <cring@ti.com>2013-09-25 16:55:49 -0700
commit23f6cd94fe9a70cf5ffa279ea7f43cf04379b80e (patch)
tree87a6d50574872a2d0dcac186912c930a54adbb29
parentbebbebbd6c294f81ca89bad9131d5f93e187c3c7 (diff)
downloadipc-23f6cd94fe9a70cf5ffa279ea7f43cf04379b80e.tar.gz
Android: Added support for MessageQ
Support for MessageQ and related application(LAD) was added for Android. Android specific build files have been created/modified to build all user-side libraries (libmmrpc, libtiipc, libtiutils) and applications from within the Android filesystem. This include test apps (MesssageQ*). A few changes were also needed by the common source files that are shared across Linux and Android builds.
-rw-r--r--android/src/api/Android.mk54
-rw-r--r--android/src/daemon/Android.mk55
-rw-r--r--android/src/mm/Android.mk (renamed from Android.mk)9
-rw-r--r--android/src/tests/Android.mk109
-rw-r--r--android/src/utils/Android.mk78
-rw-r--r--linux/include/_lad.h6
-rw-r--r--linux/include/ti/ipc/Std.h4
-rw-r--r--linux/src/daemon/MessageQ_daemon.c4
-rw-r--r--linux/src/daemon/NameServer_daemon.c5
-rw-r--r--linux/src/utils/LAD_client.c6
10 files changed, 326 insertions, 4 deletions
diff --git a/android/src/api/Android.mk b/android/src/api/Android.mk
new file mode 100644
index 0000000..b14d836
--- /dev/null
+++ b/android/src/api/Android.mk
@@ -0,0 +1,54 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages \
+ $(LOCAL_PATH)/$(IPC_ROOT)/hlos_common/include
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/api/MultiProc.c \
+ $(IPC_ROOT)/linux/src/api/NameServer.c \
+ $(IPC_ROOT)/linux/src/api/Ipc.c \
+ $(IPC_ROOT)/linux/src/api/MessageQ.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog libtiipcutils
+
+LOCAL_MODULE:= libtiipc
+include $(BUILD_SHARED_LIBRARY)
diff --git a/android/src/daemon/Android.mk b/android/src/daemon/Android.mk
new file mode 100644
index 0000000..595f5e4
--- /dev/null
+++ b/android/src/daemon/Android.mk
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages \
+ $(LOCAL_PATH)/$(IPC_ROOT)/hlos_common/include
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/daemon/lad.c \
+ $(IPC_ROOT)/linux/src/daemon/MessageQ_daemon.c \
+ $(IPC_ROOT)/linux/src/daemon/MultiProc_daemon.c \
+ $(IPC_ROOT)/linux/src/daemon/NameServer_daemon.c \
+ $(IPC_ROOT)/linux/src/daemon/MultiProcCfg_dra7xx.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog libtiipcutils_lad libtiipc
+
+LOCAL_MODULE:= lad_dra7xx
+include $(BUILD_EXECUTABLE)
diff --git a/Android.mk b/android/src/mm/Android.mk
index c88c39b..7206df2 100644
--- a/Android.mk
+++ b/android/src/mm/Android.mk
@@ -33,12 +33,17 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT) \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages
+
LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
LOCAL_MODULE_TAGS:= optional
-LOCAL_SRC_FILES:= packages/ti/ipc/mm/MmRpc.c
+LOCAL_SRC_FILES:= $(IPC_ROOT)/packages/ti/ipc/mm/MmRpc.c
LOCAL_SHARED_LIBRARIES := \
liblog
-LOCAL_MODULE:= libipc
+LOCAL_MODULE:= libmmrpc
include $(BUILD_SHARED_LIBRARY)
diff --git a/android/src/tests/Android.mk b/android/src/tests/Android.mk
new file mode 100644
index 0000000..2cf11e4
--- /dev/null
+++ b/android/src/tests/Android.mk
@@ -0,0 +1,109 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+##### MessageQApp #####
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/tests/MessageQApp.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog libtiipcutils libtiipc
+
+LOCAL_MODULE:= messageQApp
+include $(BUILD_EXECUTABLE)
+
+##### MessageQBench #####
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/tests/MessageQBench.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog libtiipcutils libtiipc
+
+LOCAL_MODULE:= messageQBench
+include $(BUILD_EXECUTABLE)
+
+##### MessageQMulti #####
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/tests/MessageQMulti.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog libtiipcutils libtiipc
+
+LOCAL_MODULE:= messageQMulti
+include $(BUILD_EXECUTABLE)
+
+##### NameServerApp #####
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/hlos_common/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/tests/NameServerApp.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog libtiipcutils libtiipc
+
+LOCAL_MODULE:= nameServerApp
+include $(BUILD_EXECUTABLE)
diff --git a/android/src/utils/Android.mk b/android/src/utils/Android.mk
new file mode 100644
index 0000000..c2f896d
--- /dev/null
+++ b/android/src/utils/Android.mk
@@ -0,0 +1,78 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages \
+ $(LOCAL_PATH)/$(IPC_ROOT)/hlos_common/include
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/utils/LAD_client.c \
+ $(IPC_ROOT)/linux/src/utils/SocketFxns.c \
+ $(IPC_ROOT)/linux/src/utils/MultiProc_app.c \
+ $(IPC_ROOT)/hlos_common/src/utils/MultiProc.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog
+
+LOCAL_MODULE:= libtiipcutils
+include $(BUILD_SHARED_LIBRARY)
+
+##### libtiipcutils_lad #####
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages \
+ $(LOCAL_PATH)/$(IPC_ROOT)/hlos_common/include
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/utils/LAD_client.c \
+ $(IPC_ROOT)/linux/src/utils/SocketFxns.c \
+ $(IPC_ROOT)/hlos_common/src/utils/MultiProc.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog
+
+LOCAL_ALLOW_UNDEFINED_SYMBOLS:= true
+
+LOCAL_MODULE:= libtiipcutils_lad
+include $(BUILD_SHARED_LIBRARY)
diff --git a/linux/include/_lad.h b/linux/include/_lad.h
index 2756905..d184df4 100644
--- a/linux/include/_lad.h
+++ b/linux/include/_lad.h
@@ -76,8 +76,14 @@ extern FILE *logPtr;
/* LAD commmand FIFO strings: */
+#if defined (IPC_BUILDOS_ANDROID)
+#define LAD_COMMANDFIFO "/data/local/tmp/LAD/LADCMDS"
+#define LAD_WORKINGDIR "/data/local/tmp/LAD/"
+#else
#define LAD_COMMANDFIFO "/tmp/LAD/LADCMDS"
#define LAD_WORKINGDIR "/tmp/LAD/"
+#endif
+
#define LAD_RESPONSEFIFOPATH LAD_WORKINGDIR
#define LAD_PROTOCOLVERSION "03000000" /* MMSSRRRR */
diff --git a/linux/include/ti/ipc/Std.h b/linux/include/ti/ipc/Std.h
index 63adabf..4389196 100644
--- a/linux/include/ti/ipc/Std.h
+++ b/linux/include/ti/ipc/Std.h
@@ -94,6 +94,10 @@ typedef PVOID HANDLE; /* h */
#define FAIL -1
//#define NULL '\0'
+#if defined (IPC_BUILDOS_ANDROID)
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
#if defined (__cplusplus)
}
#endif
diff --git a/linux/src/daemon/MessageQ_daemon.c b/linux/src/daemon/MessageQ_daemon.c
index dad1d7c..d718f2d 100644
--- a/linux/src/daemon/MessageQ_daemon.c
+++ b/linux/src/daemon/MessageQ_daemon.c
@@ -143,7 +143,11 @@ static MessageQ_ModuleObject MessageQ_state =
.queues = NULL,
.numQueues = 2u,
.canFreeQueues = FALSE,
+#if defined(IPC_BUILDOS_ANDROID)
+ .gate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER,
+#else
.gate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
+#endif
.defaultCfg.traceFlag = FALSE,
.defaultCfg.maxRuntimeEntries = 32u,
.defaultCfg.maxNameLen = 32u,
diff --git a/linux/src/daemon/NameServer_daemon.c b/linux/src/daemon/NameServer_daemon.c
index f4dd2dd..bc644e5 100644
--- a/linux/src/daemon/NameServer_daemon.c
+++ b/linux/src/daemon/NameServer_daemon.c
@@ -168,9 +168,12 @@ static NameServer_ModuleObject NameServer_state = {
.defInstParams.checkExisting = TRUE,
.defInstParams.maxValueLen = 0u,
.defInstParams.maxNameLen = 16u,
+#if defined(IPC_BUILDOS_ANDROID)
+ .modGate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER,
+#else
// only _NP (non-portable) type available in CG tools which we're using
.modGate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
-// .modGate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER,
+#endif
.refCount = 0
};
diff --git a/linux/src/utils/LAD_client.c b/linux/src/utils/LAD_client.c
index 48ef3d3..6b90950 100644
--- a/linux/src/utils/LAD_client.c
+++ b/linux/src/utils/LAD_client.c
@@ -63,9 +63,13 @@ static _LAD_ClientInfo clientInfo[LAD_MAXNUMCLIENTS];
static LAD_Status initWrappers(Void);
static Bool openCommandFIFO(Void);
+
+#if defined(IPC_BUILDOS_ANDROID)
+static pthread_mutex_t modGate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
+#else
// only _NP (non-portable) type available in CG tools which we're using
static pthread_mutex_t modGate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-// static pthread_mutex_t modGate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
+#endif
/*