author | Chris Ring <cring@ti.com> | |
Mon, 9 Dec 2013 20:46:10 +0000 (12:46 -0800) | ||
committer | Chris Ring <cring@ti.com> | |
Mon, 9 Dec 2013 20:46:10 +0000 (12:46 -0800) |
Conflicts:
linux/src/tests/Makefile.am
linux/src/tests/Makefile.in
linux/src/tests/Makefile.am
linux/src/tests/Makefile.in
167 files changed:
diff --git a/.gitignore b/.gitignore
index 43e7a411a2d2550ea9c231b1438c7c105854f031..6a407071ae86111fd9631569fecf8eb070a4f940 100644 (file)
--- a/.gitignore
+++ b/.gitignore
+# General
+*.patch
+
# BIOS stuff
package/
lib/
/linux/src/tests/MessageQApp
/linux/src/tests/MessageQBench
/linux/src/tests/MessageQMulti
+/linux/src/tests/Msgq100
/linux/src/tests/NameServerApp
/linux/src/tests/nano_test_*
/linux/src/tests/ping_rpmsg
/qnx/src/tests/*/arm/o.g.le.v7/*.o
/qnx/src/tests/*/arm/o.g.le.v7/*.map
/qnx/src/tests/*/arm/o.g.le.v7/*.pinfo
+/qnx/src/tests/*/arm/o.g.le.v7/GateMPApp_g
/qnx/src/tests/*/arm/o.g.le.v7/MessageQApp_g
/qnx/src/tests/*/arm/o.g.le.v7/MessageQBench_g
/qnx/src/tests/*/arm/o.g.le.v7/MessageQMulti_g
/qnx/src/tests/*/arm/o.le.v7/*.o
/qnx/src/tests/*/arm/o.le.v7/*.map
/qnx/src/tests/*/arm/o.le.v7/*.pinfo
+/qnx/src/tests/*/arm/o.le.v7/GateMPApp
/qnx/src/tests/*/arm/o.le.v7/MessageQApp
/qnx/src/tests/*/arm/o.le.v7/MessageQBench
/qnx/src/tests/*/arm/o.le.v7/MessageQMulti
diff --git a/Makefile.am b/Makefile.am
index 49c49ad9e8a606e5f397f0f1d615d9226b20da96..997f8fe1c19d70008a939e38c30b4d6e1b1c3e99 100644 (file)
--- a/Makefile.am
+++ b/Makefile.am
SUBDIRS = linux/etc linux/src/utils linux/src/api \
linux/src/mm linux/src/daemon linux/src/tests
-# hook to remove libtools library extention files (.la)
-install-exec-hook:
- rm -f $(DESTDIR)$(libdir)/*.la
-
# where to install common headers on the system
ipcincludedir = $(includedir)/ti/ipc
diff --git a/Makefile.in b/Makefile.in
index 71849d7fc08aea50eda2ecafa01f851858f1eebe..e67de2b9b77c65fd76faabe86fd093070454de79 100644 (file)
--- a/Makefile.in
+++ b/Makefile.in
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DRA7XX_FALSE = @DRA7XX_FALSE@
+DRA7XX_TRUE = @DRA7XX_TRUE@
+DRM_FALSE = @DRM_FALSE@
+DRM_PREFIX = @DRM_PREFIX@
+DRM_TRUE = @DRM_TRUE@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
install-data-am: install-ipcincludeHEADERS
install-exec-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-info: install-info-recursive
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
- install-exec-hook install-info install-info-am \
- install-ipcincludeHEADERS install-man install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic \
- maintainer-clean-recursive mostlyclean mostlyclean-generic \
- mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
- tags tags-recursive uninstall uninstall-am uninstall-info-am \
+ install-info install-info-am install-ipcincludeHEADERS \
+ install-man install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am \
uninstall-ipcincludeHEADERS
-
-# hook to remove libtools library extention files (.la)
-install-exec-hook:
- rm -f $(DESTDIR)$(libdir)/*.la
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
similarity index 64%
rename from qnx/src/ipc3x_dev/ti/syslink/headers/Makefile
rename to android/src/api/Android.mk
index a9197c8b49fb1530241b33925cd39c07e7fa40f8..b14d8360579cd292f34d7834ebeeffd1c8c48ed2 100644 (file)
rename from qnx/src/ipc3x_dev/ti/syslink/headers/Makefile
rename to android/src/api/Android.mk
index a9197c8b49fb1530241b33925cd39c07e7fa40f8..b14d8360579cd292f34d7834ebeeffd1c8c48ed2 100644 (file)
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-ifndef QCONFIG
-QCONFIG=qconfig.mk
-endif
-include $(QCONFIG)
-
-#include $(MKFILES_ROOT)/qmacros.mk
-
-hinstall:
-install:
- $(CP_HOST) -Rv $(PROJECT_ROOT)../inc/ti/ipc/rpmsg_omx.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/rpmsg_omx.h
- $(CP_HOST) -Rv $(PROJECT_ROOT)../inc/ti/ipc/rpmsg_dce.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/rpmsg_dce.h
- $(CP_HOST) -Rv $(PROJECT_ROOT)../inc/ti/ipc/ti_ipc.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/ti_ipc.h
- $(CP_HOST) -Rv $(PROJECT_ROOT)../inc/ti/ipc/rpmsg_rpc.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/rpmsg_rpc.h
- $(CP_HOST) -Rv $(PROJECT_ROOT)../inc/ti/ipc/HwSpinLockUsr.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/HwSpinLockUsr.h
- $(CP_HOST) -Rv $(PROJECT_ROOT)../inc/GateHWSpinlock.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/GateHWSpinlock.h
- $(CP_HOST) -Rv $(PROJECT_ROOT)../Std.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/ti/ipc/Std.h
-clean:
- true
+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
--- /dev/null
@@ -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/src/mm/Android.mk b/android/src/mm/Android.mk
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# 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) \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/packages/ti/ipc/mm/MmRpc.c
+LOCAL_SHARED_LIBRARIES := \
+ liblog
+
+LOCAL_MODULE:= libmmrpc
+include $(BUILD_SHARED_LIBRARY)
diff --git a/android/src/tests/Android.mk b/android/src/tests/Android.mk
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# 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)
+
+##### ping_rpmsg #####
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/linux/src/tests/ping_rpmsg.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog
+
+LOCAL_MODULE:= ping_rpmsg
+include $(BUILD_EXECUTABLE)
diff --git a/android/src/utils/Android.mk b/android/src/utils/Android.mk
--- /dev/null
@@ -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/configure b/configure
index 133b96a036430a855bedd76092c5179d55ad1e1f..4d3aa7f32253c18eca329045649db7864e0bf52f 100755 (executable)
--- a/configure
+++ b/configure
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP LIBTOOL AM_CFLAGS AM_LDFLAGS PLATFORM CMEM_INSTALL_DIR KERNEL_INSTALL_DIR OMAPL138_TRUE OMAPL138_FALSE TCI6614_TRUE TCI6614_FALSE TCI6636_TRUE TCI6636_FALSE TCI6638_TRUE TCI6638_FALSE OMAP54XX_SMP_TRUE OMAP54XX_SMP_FALSE CMEM_TRUE CMEM_FALSE KDIR_TRUE KDIR_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP LIBTOOL AM_CFLAGS AM_LDFLAGS PLATFORM CMEM_INSTALL_DIR KERNEL_INSTALL_DIR DRM_PREFIX OMAPL138_TRUE OMAPL138_FALSE TCI6614_TRUE TCI6614_FALSE TCI6636_TRUE TCI6636_FALSE TCI6638_TRUE TCI6638_FALSE OMAP54XX_SMP_TRUE OMAP54XX_SMP_FALSE DRA7XX_TRUE DRA7XX_FALSE CMEM_TRUE CMEM_FALSE KDIR_TRUE KDIR_FALSE DRM_TRUE DRM_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
ac_env_KERNEL_INSTALL_DIR_value=$KERNEL_INSTALL_DIR
ac_cv_env_KERNEL_INSTALL_DIR_set=${KERNEL_INSTALL_DIR+set}
ac_cv_env_KERNEL_INSTALL_DIR_value=$KERNEL_INSTALL_DIR
+ac_env_DRM_PREFIX_set=${DRM_PREFIX+set}
+ac_env_DRM_PREFIX_value=$DRM_PREFIX
+ac_cv_env_DRM_PREFIX_set=${DRM_PREFIX+set}
+ac_cv_env_DRM_PREFIX_value=$DRM_PREFIX
#
# Report the --help message.
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
PLATFORM Platform to build. Options are: 'omapl138' 'omap54xx_smp'
- 'tci6636' and 'tci6638'. If not defined all platforms will be
- built.
+ 'tci6636' 'tci6638' and 'dra7xx'. If not defined all platforms
+ will be built.
CMEM_INSTALL_DIR
Installation path directory to the CMEM libraries
KERNEL_INSTALL_DIR
Installation path to the Linux kernel.
+ DRM_PREFIX Installation location to the DRM library.
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 3714 "configure"' > conftest.$ac_ext
+ echo '#line 3719 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6139: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6144: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6143: \$? = $ac_status" >&5
+ echo "$as_me:6148: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6407: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6412: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6411: \$? = $ac_status" >&5
+ echo "$as_me:6416: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6511: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6516: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6515: \$? = $ac_status" >&5
+ echo "$as_me:6520: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8856 "configure"
+#line 8861 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8956 "configure"
+#line 8961 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11296: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11301: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11300: \$? = $ac_status" >&5
+ echo "$as_me:11305: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11400: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11405: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11404: \$? = $ac_status" >&5
+ echo "$as_me:11409: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12707: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12712: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12711: \$? = $ac_status" >&5
+ echo "$as_me:12716: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12975: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12980: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12979: \$? = $ac_status" >&5
+ echo "$as_me:12984: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13079: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13084: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13083: \$? = $ac_status" >&5
+ echo "$as_me:13088: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
+
# Test platform variable for setting
if test "x$PLATFORM" = "xomapl138"; then
{ echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
if test "x$PLATFORM" = "xomap54xx_smp"; then
{ echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
echo "$as_me: PLATFORM is set to ${PLATFORM}" >&6;}
+else
+ if test "x$PLATFORM" = "xdra7xx"; then
+ { echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
+echo "$as_me: PLATFORM is set to ${PLATFORM}" >&6;}
else
if test "x$PLATFORM" = "x"; then
{ echo "$as_me:$LINENO: PLATFORM is not set. All supported platforms will be built ...." >&5
fi
-
-# Test platform for omap5 variable and require a KERNEL path
-if test "x$PLATFORM" = "xomap54xx_smp"; then
- if test "x$KERNEL_INSTALL_DIR" = "x"; then
- { { echo "$as_me:$LINENO: error: Kernel path for ${PLATFORM} is not set" >&5
-echo "$as_me: error: Kernel path for ${PLATFORM} is not set" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
fi
KERNEL_INSTALL_DIR=
fi
+if test "x$PLATFORM" = "x"; then
+ DRM_PREFIX=
+fi
+
+if test "x$PLATFORM" = "x"; then
+ CMEM_INSTALL_DIR=
+fi
+
# Export optional user variable to Makefile(s)
+
# Define specific variables to be used in Makefile.am
+if test "x$PLATFORM" = "xdra7xx"; then
+ DRA7XX_TRUE=
+ DRA7XX_FALSE='#'
+else
+ DRA7XX_TRUE='#'
+ DRA7XX_FALSE=
+fi
+
+
+
if test "x$CMEM_INSTALL_DIR" != "x"; then
CMEM_TRUE=
CMEM_FALSE='#'
fi
+
+if test "x$DRM_PREFIX" != "x"; then
+ DRM_TRUE=
+ DRM_FALSE='#'
+else
+ DRM_TRUE='#'
+ DRM_FALSE=
+fi
+
+
# Generate Makefile(s)
ac_config_files="$ac_config_files Makefile"
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${DRA7XX_TRUE}" && test -z "${DRA7XX_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"DRA7XX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"DRA7XX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${CMEM_TRUE}" && test -z "${CMEM_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CMEM\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${DRM_TRUE}" && test -z "${DRM_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"DRM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"DRM\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
s,@PLATFORM@,$PLATFORM,;t t
s,@CMEM_INSTALL_DIR@,$CMEM_INSTALL_DIR,;t t
s,@KERNEL_INSTALL_DIR@,$KERNEL_INSTALL_DIR,;t t
+s,@DRM_PREFIX@,$DRM_PREFIX,;t t
s,@OMAPL138_TRUE@,$OMAPL138_TRUE,;t t
s,@OMAPL138_FALSE@,$OMAPL138_FALSE,;t t
s,@TCI6614_TRUE@,$TCI6614_TRUE,;t t
s,@TCI6638_FALSE@,$TCI6638_FALSE,;t t
s,@OMAP54XX_SMP_TRUE@,$OMAP54XX_SMP_TRUE,;t t
s,@OMAP54XX_SMP_FALSE@,$OMAP54XX_SMP_FALSE,;t t
+s,@DRA7XX_TRUE@,$DRA7XX_TRUE,;t t
+s,@DRA7XX_FALSE@,$DRA7XX_FALSE,;t t
s,@CMEM_TRUE@,$CMEM_TRUE,;t t
s,@CMEM_FALSE@,$CMEM_FALSE,;t t
s,@KDIR_TRUE@,$KDIR_TRUE,;t t
s,@KDIR_FALSE@,$KDIR_FALSE,;t t
+s,@DRM_TRUE@,$DRM_TRUE,;t t
+s,@DRM_FALSE@,$DRM_FALSE,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
Your KERNEL installation directory is set to:
'${KERNEL_INSTALL_DIR}'
+Your DRM installation directory is set to:
+ '${DRM_PREFIX}'
+
Your CMEM installation directory is set to:
'${CMEM_INSTALL_DIR}'
diff --git a/configure.ac b/configure.ac
index 03f8430610eb75f785adbf9ec92d5d76d004cc43..69454178995c7eb56498a4ae3fb30bfe5cefef4e 100644 (file)
--- a/configure.ac
+++ b/configure.ac
# Add config variables/options and check them
# Note that 6614 isn't documented and, though it may work, is planned for removal
-AC_ARG_VAR(PLATFORM, Platform to build. Options are: 'omapl138' 'omap54xx_smp' 'tci6636' and 'tci6638'. If not defined all platforms will be built.)
+AC_ARG_VAR(PLATFORM, Platform to build. Options are: 'omapl138' 'omap54xx_smp' 'tci6636' 'tci6638' and 'dra7xx'. If not defined all platforms will be built.)
AC_ARG_VAR(CMEM_INSTALL_DIR, Installation path directory to the CMEM libraries)
AC_ARG_VAR(KERNEL_INSTALL_DIR, Installation path to the Linux kernel.)
+AC_ARG_VAR(DRM_PREFIX, Installation location to the DRM library.)
# Test platform variable for setting
AS_IF([test "x$PLATFORM" = "xomapl138"],
[AC_MSG_NOTICE([PLATFORM is set to ${PLATFORM}])],
[AS_IF([test "x$PLATFORM" = "xomap54xx_smp"],
[AC_MSG_NOTICE([PLATFORM is set to ${PLATFORM}])],
+ [AS_IF([test "x$PLATFORM" = "xdra7xx"],
+ [AC_MSG_NOTICE([PLATFORM is set to ${PLATFORM}])],
[AS_IF([test "x$PLATFORM" = "x"],
[AC_MSG_NOTICE([PLATFORM is not set. All supported platforms will be built ....])],
- [AC_MSG_ERROR([PLATFORM is set to "${PLATFORM}": run ./configure --help for available PLATFORM options])])])])])])])
-
-# Test platform for omap5 variable and require a KERNEL path
-AS_IF([test "x$PLATFORM" = "xomap54xx_smp"],
- [AS_IF([test "x$KERNEL_INSTALL_DIR" = "x"],
- [AC_MSG_ERROR([Kernel path for ${PLATFORM} is not set])])])
+ [AC_MSG_ERROR([PLATFORM is set to "${PLATFORM}": run ./configure --help for available PLATFORM options])])])])])])])])
# Test for required KERNEL path
AS_IF([test "x$KERNEL_INSTALL_DIR" = "x"],
# Ignore KERNEL path when no platform is set
AS_IF([test "x$PLATFORM" = "x"], [KERNEL_INSTALL_DIR=])
+AS_IF([test "x$PLATFORM" = "x"], [DRM_PREFIX=])
+AS_IF([test "x$PLATFORM" = "x"], [CMEM_INSTALL_DIR=])
# Export optional user variable to Makefile(s)
AC_SUBST([PLATFORM])
AC_SUBST([CMEM_INSTALL_DIR])
AC_SUBST([KERNEL_INSTALL_DIR])
+AC_SUBST([DRM_PREFIX])
# Define specific variables to be used in Makefile.am
AM_CONDITIONAL([OMAPL138], [test "x$PLATFORM" = "xomapl138"])
AM_CONDITIONAL([TCI6636], [test "x$PLATFORM" = "xtci6636"])
AM_CONDITIONAL([TCI6638], [test "x$PLATFORM" = "xtci6638"])
AM_CONDITIONAL([OMAP54XX_SMP], [test "x$PLATFORM" = "xomap54xx_smp"])
+AM_CONDITIONAL([DRA7XX], [test "x$PLATFORM" = "xdra7xx"])
AM_CONDITIONAL([CMEM], [test "x$CMEM_INSTALL_DIR" != "x"])
AM_CONDITIONAL([KDIR], [test "x$KERNEL_INSTALL_DIR" != "x"])
+AM_CONDITIONAL([DRM], [test "x$DRM_PREFIX" != "x"])
# Generate Makefile(s)
AC_CONFIG_FILES([Makefile])
Your KERNEL installation directory is set to:
'${KERNEL_INSTALL_DIR}'
+Your DRM installation directory is set to:
+ '${DRM_PREFIX}'
+
Your CMEM installation directory is set to:
'${CMEM_INSTALL_DIR}'
diff --git a/hlos_common/include/_NameServerRemoteRpmsg.h b/hlos_common/include/_NameServerRemoteRpmsg.h
index b168bd021c6294322ed39cd00d5fb0ed45243fa8..70238f9e8af4996640b29cfb903147518928f488 100644 (file)
#define MAXNAMEINCHAR 80
#define NAMEARRAYSZIE (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
+#define MAXVALUELEN 75
-#define NAMESERVER_GET_TIMEOUT 10 /* Seconds */
+#define NAMESERVER_GET_TIMEOUT 20000 /* microseconds */
#define NAMESERVER_MSG_TOKEN 0x5678abcd
Bits32 instanceName[NAMEARRAYSZIE];
/* name of NameServer entry */
Bits32 name[NAMEARRAYSZIE];
+ Bits32 valueLen; /* len of value */
+ Bits32 valueBuf[MAXVALUELEN]; /* value buffer */
} NameServerMsg;
diff --git a/ipc-bios.bld b/ipc-bios.bld
index 7e4cc755d8a1b37340ae0a7add5bab66c2aa648d..b2e455f19c6c1bc86f7f7e7abc7cac45f6eab30b 100644 (file)
--- a/ipc-bios.bld
+++ b/ipc-bios.bld
*
* These settings may be a function of the following global variables:
*
- * environment a hash table of environment strings
+ * environment a hash table of environment strings
*
- * arguments an array of string arguments to the _config.bld script
- * initialized as follows:
- * arguments[0] - the file name of the _config.bld script
- * arguments[1] - the first argument specified in XDCARGS
- * :
- * arguments[n] - the n'th argument in XDCARGS
+ * arguments an array of string arguments to the script
+ * initialized as follows:
+ * arguments[0] - the file name of the script
+ * arguments[1] - the first argument specified in XDCARGS
+ * :
+ * arguments[n] - the n'th argument in XDCARGS
*
- * Build an alias for xdc.om.xdc.bld.BuildEnvironment
+ * Build an alias for xdc.om.xdc.bld.BuildEnvironment
*/
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
/* Common ccopts suffix used for all C6x targets */
var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g ";
"ti.targets.elf.C64P" : c6xOpts,
"ti.targets.elf.C64P_big_endian" : c6xOpts,
- "ti.targets.elf.C64T" : " -mi10 -mo -pds=71",
+ "ti.targets.elf.C64T" : c6xOpts,
"ti.targets.elf.C66" : c6xOpts,
"ti.targets.elf.C66_big_endian" : c6xOpts,
"ti.targets.elf.C674" : c6xOpts,
"gnu.targets.arm.A15F" : " -g "
};
-/* Enable building SMP-BIOS enabled libraries for targets that support it */
-if (Pkg.name.match(/^ti\.sdo\.(ipc|utils)/)) {
- xdc.module("ti.targets.arm.elf.M3").profiles["smp"] =
- xdc.module("ti.targets.arm.elf.M3").profiles["debug"];
- xdc.module("ti.targets.arm.elf.M4").profiles["smp"] =
- xdc.module("ti.targets.arm.elf.M4").profiles["debug"];
-}
+var lnkOpts = {
+ "ti.targets.elf.C66" : " --cinit_compression=off",
+ "ti.targets.arm.elf.M4" : " --retain=.resource_table" +
+ " --cinit_compression=off"
+};
+
+var platform = "";
+var smpEnabled = true;
/* initialize local vars with those set in xdcpaths.mak (via XDCARGS) */
for (arg = 0; arg < arguments.length; arg++) {
+ /* split each arg into its '+' separated parts */
+ var configParts = arguments[arg].split(";");
+ // print("arg " + arg + " has " + configParts.length + " parts");
+
+ /* if "known args come in, filter them... else they're targets */
+ if (configParts[0].split("=")[0] == "PLATFORM") {
+ // print("FOUND PLATFORM ARG - " + configParts[0]);
+ platform = configParts[0].split("=")[1];
+ continue;
+ }
+ else if (configParts[0].split("=")[0] == "BIOS_SMPENABLED") {
+ // print("FOUND SMP_ENABLED ARG - " + configParts[0]);
+ smpEnabled = configParts[0].split("=")[1].match(/^1$/);
+ continue;
+ }
/*
* Get the compiler's installation directory.
* For "ti.targets.elf.C674=/vendors/c6x/7.2.0", we get "/vendors/c6x/7.2.0"
*/
- var targetName = arguments[arg].split("=")[0];
- var rootDir = arguments[arg].split("=")[1];
+ var targetName = configParts[0].split("=")[0];
+ var rootDir = configParts[0].split("=")[1];
/* only build for the specified compilers */
if (rootDir == "" || rootDir == undefined) {
continue;
}
+// print("Building '" + targetName + "' using '" + rootDir + "' ...");
+
var target = xdc.useModule(targetName);
target.rootDir = rootDir;
- target.ccOpts.suffix += ccOpts[targetName];
+ if (ccOpts[targetName] != undefined) {
+ target.ccOpts.suffix += ccOpts[targetName];
+ }
+ if (lnkOpts[targetName] != undefined) {
+ target.lnkOpts.suffix += lnkOpts[targetName];
+ }
+
+ /* for all the other parts, assign target.<left> = <right> */
+ for (var i = 1; i < configParts.length; i++) {
+ var modCfgParam = configParts[i].split("=")[0];
+ var modCfgValue = configParts[i].split("=")[1];
+ var modCfgIndex = modCfgParam.split(".");
+ var element = target;
+
+// print("Configuring target." + modCfgParam + " = " + modCfgValue);
+
+ for (j = 0; j < (modCfgIndex.length -1); j++) {
+ element = element[modCfgIndex[j]];
+ }
+ element[modCfgIndex[j]] = modCfgValue;
+ }
/* Add appropriate platforms to build for based on target name */
if (targetName.match(/elf\.C674/)) {
- target.platforms = [ "ti.platforms.evmOMAPL138:DSP" ];
+ if (platform == 'omapl138') {
+ target.platforms.$add("ti.platforms.evmOMAPL138:DSP");
+ }
}
if (targetName.match(/elf\.C66$/)) {
- target.lnkOpts.prefix += " -e=ti_sysbios_family_c64p_Hwi0";
- target.lnkOpts.prefix += " --cinit_compression=off";
- target.platforms = [
- //"ti.platforms.simKepler"
- //"ti.platforms.evm6614:DSP"
- "ti.platforms.evmTCI6636K2H",
- "ti.platforms.evmTCI6638K2K",
- "ti.platforms.evmDRA7XX:dsp1",
- ];
+ switch (platform) {
+ case 'tci6636':
+ target.platforms.$add("ti.platforms.evmTCI6636K2H");
+ break;
+
+ case 'tci6638':
+ target.platforms.$add("ti.platforms.evmTCI6638K2K");
+ break;
+
+ case 'dra7xx':
+ target.platforms.$add("ti.platforms.evmDRA7XX:dsp1");
+ target.platforms.$add("ti.platforms.evmDRA7XX:dsp2");
+ break;
+
+ default:
+ print("Unknown platform, skipping " + platform);
+ break;
+ }
}
if (targetName.match(/elf\.C64T/)) {
- target.lnkOpts.prefix += " -e=ti_sysbios_family_c64p_Hwi0";
-
- target.platforms = [
- "ti.platforms.sdp5430:DSP",
- ];
+ if (platform == 'omap54xx_smp') {
+ target.platforms.$add("ti.platforms.sdp5430:DSP");
+ }
}
if (targetName.match(/elf\.M4$/)) {
- target.lnkOpts.prefix += " --retain=.resource_table";
- target.lnkOpts.prefix += " --cinit_compression=off";
+ switch (platform) {
+ case 'omap54xx_smp':
+ target.platforms.$add("ti.platforms.sdp5430:IPU");
+ break;
- target.platforms = [
- "ti.platforms.sdp5430:IPU",
- "ti.platforms.evmDRA7XX:ipu2",
- ];
+ case 'dra7xx':
+ target.platforms.$add("ti.platforms.evmDRA7XX:ipu2");
+ target.platforms.$add("ti.platforms.evmDRA7XX:ipu1");
+ break;
+
+ default:
+ print("Unknown platform, skipping " + platform);
+ break;
+ }
}
Build.targets.$add(target);
}
+if (smpEnabled) {
+ /* Enable building SMP-BIOS enabled libraries for targets that support it */
+ if (Pkg.name.match(/^ti\.sdo\.(ipc|utils)/)) {
+ xdc.module("ti.targets.arm.elf.M3").profiles["smp"] =
+ xdc.module("ti.targets.arm.elf.M3").profiles["debug"];
+ xdc.module("ti.targets.arm.elf.M4").profiles["smp"] =
+ xdc.module("ti.targets.arm.elf.M4").profiles["debug"];
+ }
+}
/* lib/ is a generated directory that 'xdc clean' should remove */
-var Pkg = xdc.useModule('xdc.bld.PackageContents');
Pkg.generatedFiles.$add("lib/");
/*
diff --git a/ipc-bios.mak b/ipc-bios.mak
index 7c211646b80f97cc05d7f2842cd46a16e5d86f67..de0628e20244c1aa0b6860e66ac69a85cdb4a626 100644 (file)
--- a/ipc-bios.mak
+++ b/ipc-bios.mak
# http://rtsc.eclipse.org/docs-tip/Command_-_xdc#Environment_Variables
#
XDCARGS= \
+ PLATFORM=\"$(PLATFORM)\" \
+ BIOS_SMPENABLED=\"$(BIOS_SMPENABLED)\" \
ti.targets.C28_large=\"$(ti.targets.C28_large)\" \
ti.targets.C28_float=\"$(ti.targets.C28_float)\" \
ti.targets.C64P=\"$(ti.targets.C64P)\" \
diff --git a/ipc-linux.mak b/ipc-linux.mak
index 53028276acd8fe507cc5f545e4de7edddb9d25a8..b0813e779a16ecd7e06ff0081e1a008a65c76d2b 100644 (file)
--- a/ipc-linux.mak
+++ b/ipc-linux.mak
CC=$(TOOLCHAIN_PREFIX)gcc \
PLATFORM=$(PLATFORM) \
CMEM_INSTALL_DIR=$(CMEM_INSTALL_DIR) \
- KERNEL_INSTALL_DIR=$(KERNEL_INSTALL_DIR)
+ KERNEL_INSTALL_DIR=$(KERNEL_INSTALL_DIR) \
+ DRM_PREFIX=$(DRM_PREFIX)
+
config-static:
@echo "Configuring Linux Ipc static only libaries ..."
CC=$(TOOLCHAIN_PREFIX)gcc \
PLATFORM=$(PLATFORM) \
CMEM_INSTALL_DIR=$(CMEM_INSTALL_DIR) \
- KERNEL_INSTALL_DIR=$(KERNEL_INSTALL_DIR)
+ KERNEL_INSTALL_DIR=$(KERNEL_INSTALL_DIR) \
+ DRM_PREFIX=$(DRM_PREFIX)
config-shared:
CC=$(TOOLCHAIN_PREFIX)gcc \
PLATFORM=$(PLATFORM) \
CMEM_INSTALL_DIR=$(CMEM_INSTALL_DIR) \
- KERNEL_INSTALL_DIR=$(KERNEL_INSTALL_DIR)
+ KERNEL_INSTALL_DIR=$(KERNEL_INSTALL_DIR) \
+ DRM_PREFIX=$(DRM_PREFIX)
diff --git a/linux/etc/Makefile.in b/linux/etc/Makefile.in
index 7b88b866ecfd04973274639457ae9fa6821d7359..38b6aec786e1f495bb17c1cde80500c5b6106dc2 100644 (file)
--- a/linux/etc/Makefile.in
+++ b/linux/etc/Makefile.in
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DRA7XX_FALSE = @DRA7XX_FALSE@
+DRA7XX_TRUE = @DRA7XX_TRUE@
+DRM_FALSE = @DRM_FALSE@
+DRM_PREFIX = @DRM_PREFIX@
+DRM_TRUE = @DRM_TRUE@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
index 39ed3858e654c9455f5f5d4389acf2057775a1fe..4d3a031b5782f6f7f6be244a1a3a197b88b5854a 100644 (file)
/*!< Max number of procs for particular system */
Char nameList [MultiProc_MAXPROCESSORS][MultiProc_MAXNAMELENGTH];
/*!< Name List for processors in the system */
+ Int32 rprocList[MultiProc_MAXPROCESSORS];
+ /*!< Linux "remoteproc index" for processors in the system */
UInt16 id;
/*!< Local Proc ID. This needs to be set before calling any other APIs */
} MultiProc_Config;
*/
Void MultiProc_getConfig (MultiProc_Config * cfg);
+/*!
+ * @brief Initialize the configuration for the MultiProc module.
+ *
+ * This function is called to initialize the configuration for
+ * MultiProc.
+ *
+ * @param cfg Pointer to a populated MultiProc configuration
+ * structure.
+ */
+Void _MultiProc_initCfg(MultiProc_Config * cfg);
+
/* This exported from daemon/MultiProcCfg_<PLATFORM>.c: */
extern MultiProc_Config _MultiProc_cfg;
diff --git a/linux/include/_lad.h b/linux/include/_lad.h
index 275690585b668aee328565b4b22d78fe5457aedf..d184df4f073b39f72c9e0a4c2f945cc973871970 100644 (file)
--- a/linux/include/_lad.h
+++ b/linux/include/_lad.h
/* 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 */
index 63adabf7ac3fd0482d3fcc4060fe58785d6f791f..43891966439c27c3f8587f17df82030cd513816b 100644 (file)
#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/api/Ipc.c b/linux/src/api/Ipc.c
index ebd6c470f46ae483d12dc0e30f1cc439b185583e..214c6264612627943c5e500607488ba11093372d 100644 (file)
--- a/linux/src/api/Ipc.c
+++ b/linux/src/api/Ipc.c
/* IPC startup/shutdown stuff: */
#include <ti/ipc/MultiProc.h>
+#include <_MultiProc.h>
#include <_MessageQ.h>
#include <_NameServer.h>
-MultiProc_Config _MultiProc_cfg;
-
static LAD_ClientHandle ladHandle;
static void cleanup(int arg);
{
MessageQ_Config msgqCfg;
MultiProc_Config mpCfg;
- Int32 status = Ipc_S_SUCCESS;
+ Int32 status;
LAD_Status ladStatus;
UInt16 rprocId;
+ Int32 attachedAny = 0;
/* Catch ctrl-C, and cleanup: */
(void) signal(SIGINT, cleanup);
goto exit;
}
- /* Setup and get MultiProc configuration from LAD */
+ /*
+ * Get MultiProc configuration from LAD and initialize local MultiProc
+ * config structure.
+ */
MultiProc_getConfig(&mpCfg);
- _MultiProc_cfg = mpCfg;
+ _MultiProc_initCfg(&mpCfg);
status = NameServer_setup();
if (status >= 0) {
MessageQ_setup(&msgqCfg);
/* Now attach to all remote processors, assuming they are up. */
- for (rprocId = 0;
- (rprocId < MultiProc_getNumProcessors()) && (status >= 0);
- rprocId++) {
- if (0 == rprocId) {
- /* Skip host, which should always be 0th entry. */
- continue;
- }
- status = MessageQ_attach (rprocId, NULL);
- if (status < 0) {
- printf("Ipc_start: MessageQ_attach(%d) failed: %d\n",
- rprocId, status);
- status = Ipc_E_FAIL;
- }
+ for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) {
+ if (0 == rprocId) {
+ /* Skip host, which should always be 0th entry. */
+ continue;
+ }
+ status = MessageQ_attach(rprocId, NULL);
+ if (status == MessageQ_E_RESOURCE) {
+ continue;
+ }
+ if (status < 0) {
+ printf("Ipc_start: MessageQ_attach(%d) failed: %d\n",
+ rprocId, status);
+ status = Ipc_E_FAIL;
+
+ break;
+ }
+ else {
+ attachedAny = 1;
+ }
+ }
+ if (attachedAny) {
+ status = Ipc_S_SUCCESS;
}
}
else {
index 228f3035301293cfbc75e0952582083ce05ffb9b..82e9d943655ad79ba26bc9c6e9ab450e152f8211 100644 (file)
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DRA7XX_FALSE = @DRA7XX_FALSE@
+DRA7XX_TRUE = @DRA7XX_TRUE@
+DRM_FALSE = @DRM_FALSE@
+DRM_PREFIX = @DRM_PREFIX@
+DRM_TRUE = @DRM_TRUE@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
index 5921fe78325111b341ea28621cdc463a342bd9c5..c2930ad44c1b351fe4163ef298f93518142f524a 100644 (file)
--- a/linux/src/api/MessageQ.c
+++ b/linux/src/api/MessageQ.c
}
/* Function to setup the MessageQ module. */
-Int MessageQ_setup (const MessageQ_Config * cfg)
+Int MessageQ_setup(const MessageQ_Config * cfg)
{
Int status;
LAD_ClientHandle handle;
/* Clear sockets array. */
for (i = 0; i < MultiProc_MAXPROCESSORS; i++) {
- MessageQ_module->sock[i] = Transport_INVALIDSOCKET;
+ MessageQ_module->sock[i] = Transport_INVALIDSOCKET;
}
-
return status;
}
*/
MessageQ_Handle MessageQ_create (String name, const MessageQ_Params * params)
{
- Int status = MessageQ_S_SUCCESS;
+ Int status;
MessageQ_Object * obj = NULL;
UInt16 queueIndex = 0u;
UInt16 procId;
status = transportCreateEndpoint(&obj->fd[rprocId], rprocId,
queueIndex);
if (status < 0) {
- goto cleanup;
+ obj->fd[rprocId] = Transport_INVALIDSOCKET;
}
}
if (obj->unblockFd == -1) {
printf ("MessageQ_create: eventfd creation failed: %d, %s\n",
errno, strerror(errno));
- status = MessageQ_E_FAIL;
+ MessageQ_delete((MessageQ_Handle *)&obj);
}
+ else {
+ int endpointFound = 0;
-cleanup:
- /* Cleanup if fail: */
- if (status < 0) {
- MessageQ_delete((MessageQ_Handle *)&obj);
+ for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) {
+ if (obj->fd[rprocId] != Transport_INVALIDSOCKET) {
+ endpointFound = 1;
+ }
+ }
+ if (!endpointFound) {
+ printf("MessageQ_create: no transport endpoints found, deleting\n");
+ MessageQ_delete((MessageQ_Handle *)&obj);
+ }
}
return ((MessageQ_Handle) obj);
*/
Int MessageQ_get (MessageQ_Handle handle, MessageQ_Msg * msg ,UInt timeout)
{
+ static int last = 0;
Int status = MessageQ_S_SUCCESS;
Int tmpStatus;
MessageQ_Object * obj = (MessageQ_Object *) handle;
void *timevalPtr;
UInt16 rprocId;
int maxfd = 0;
+ int selfId;
+ int nProcessors;
/* Wait (with timeout) and retreive message from socket: */
FD_ZERO(&rfds);
for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) {
- if (rprocId == MultiProc_self()) {
+ if (rprocId == MultiProc_self() ||
+ obj->fd[rprocId] == Transport_INVALIDSOCKET) {
continue;
}
maxfd = MAX(maxfd, obj->fd[rprocId]);
status = MessageQ_E_UNBLOCKED;
}
else {
- for (rprocId = 0; rprocId < MultiProc_getNumProcessors();
- rprocId++) {
- if (rprocId == MultiProc_self()) {
- continue;
- }
- if (FD_ISSET(obj->fd[rprocId], &rfds)) {
- /* Our transport's fd was signalled: Get the message: */
- tmpStatus = transportGet(obj->fd[rprocId], msg);
- if (tmpStatus < 0) {
- printf ("MessageQ_get: tranposrtshm_get failed.");
- status = MessageQ_E_FAIL;
- }
+ /* start where we last left off */
+ rprocId = last;
+
+ selfId = MultiProc_self();
+ nProcessors = MultiProc_getNumProcessors();
+
+ do {
+ if (rprocId != selfId &&
+ obj->fd[rprocId] != Transport_INVALIDSOCKET) {
+
+ if (FD_ISSET(obj->fd[rprocId], &rfds)) {
+ /* Our transport's fd was signalled: Get the message */
+ tmpStatus = transportGet(obj->fd[rprocId], msg);
+ if (tmpStatus < 0) {
+ printf ("MessageQ_get: tranposrtshm_get failed.");
+ status = MessageQ_E_FAIL;
+ }
+
+ last = (rprocId + 1) % nProcessors;
+ break;
+ }
}
- }
+ rprocId = (rprocId + 1) % nProcessors;
+ } while (rprocId != last);
}
}
else if (retval == 0) {
PRINTVERBOSE1("MessageQ_attach: created send socket: %d\n", sock)
MessageQ_module->sock[remoteProcId] = sock;
/* Attempt to connect: */
- ConnectSocket(sock, remoteProcId, MESSAGEQ_RPMSG_PORT);
+ status = ConnectSocket(sock, remoteProcId, MESSAGEQ_RPMSG_PORT);
+ if (status < 0) {
+ status = MessageQ_E_RESOURCE;
+ /* don't hard-printf since this is no longer fatal */
+ PRINTVERBOSE1("MessageQ_attach: ConnectSocket(remoteProcId:%d) failed\n",
+ remoteProcId);
+ }
}
}
else {
pthread_mutex_unlock (&(MessageQ_module->gate));
+ if (status == MessageQ_E_RESOURCE) {
+ MessageQ_detach(remoteProcId);
+ }
+
exit:
return (status);
}
pthread_mutex_lock (&(MessageQ_module->gate));
sock = MessageQ_module->sock[remoteProcId];
- if (close (sock)) {
- status = MessageQ_E_OSFAILURE;
- printf ("MessageQ_detach: close failed: %d, %s\n",
- errno, strerror(errno));
- }
- else {
- PRINTVERBOSE1("MessageQ_detach: closed socket: %d\n", sock)
- MessageQ_module->sock[remoteProcId] = Transport_INVALIDSOCKET;
+ if (sock != Transport_INVALIDSOCKET) {
+ if (close(sock)) {
+ status = MessageQ_E_OSFAILURE;
+ printf("MessageQ_detach: close failed: %d, %s\n",
+ errno, strerror(errno));
+ }
+ else {
+ PRINTVERBOSE1("MessageQ_detach: closed socket: %d\n", sock)
+ MessageQ_module->sock[remoteProcId] = Transport_INVALIDSOCKET;
+ }
}
pthread_mutex_unlock (&(MessageQ_module->gate));
handle = LAD_findHandle();
if (handle == LAD_MAXNUMCLIENTS) {
PRINTVERBOSE1(
- "MessageQ_setup: can't find connection to daemon for pid %d\n",
+ "MessageQ_msgInit: can't find connection to daemon for pid %d\n",
getpid())
return;
@@ -969,8 +1001,9 @@ static Int transportCreateEndpoint(int * fd, UInt16 rprocId, UInt16 queueIndex)
err = SocketBindAddr(*fd, rprocId, (UInt32)queueIndex);
if (err < 0) {
status = MessageQ_E_FAIL;
- printf ("transportCreateEndpoint: bind failed: %d, %s\n",
- errno, strerror(errno));
+ /* don't hard-printf since this is no longer fatal */
+ PRINTVERBOSE2("transportCreateEndpoint: bind failed: %d, %s\n",
+ errno, strerror(errno));
}
exit:
index f011b70448a0e71fdcc9ae76aea203600704eb42..4634d64b8a73a2149e15b42efeda4e2c39b46322 100644 (file)
if OMAP54XX_SMP
bin_PROGRAMS += lad_omap54xx_smp
else
+if DRA7XX
+ bin_PROGRAMS += lad_dra7xx
+else
if OMAPL138
bin_PROGRAMS += lad_omapl138
else
if TCI6636
bin_PROGRAMS += lad_tci6636
else
- bin_PROGRAMS += lad_omap54xx_smp lad_omapl138 lad_tci6614 lad_tci6636 lad_tci6638
+ bin_PROGRAMS += lad_omap54xx_smp lad_dra7xx lad_omapl138 lad_tci6614 lad_tci6636 lad_tci6638
+endif
endif
endif
endif
# NOTE: 6636_SOURCES using 6638.c is not a typo! 6636 has the same
# MultiProc config as 6638, so we reuse that source file.
lad_omap54xx_smp_SOURCES = $(common_sources) MultiProcCfg_omap54xx_smp.c
+lad_dra7xx_SOURCES = $(common_sources) MultiProcCfg_dra7xx.c
lad_omapl138_SOURCES = $(common_sources) MultiProcCfg_omapl138.c
lad_tci6614_SOURCES = $(common_sources) MultiProcCfg_tci6614.c
lad_tci6636_SOURCES = $(common_sources) MultiProcCfg_tci6638.c
lad_tci6638_SOURCES = $(common_sources) MultiProcCfg_tci6638.c
-common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
- $(top_builddir)/linux/src/utils/libtiipcutils.la
+common_libraries = -lpthread \
+ $(top_builddir)/linux/src/utils/libtiipcutils_lad.la
# the additional libraries needed to link program
lad_omap54xx_smp_LDADD = $(common_libraries) \
$(AM_LDFLAGS)
+lad_dra7xx_LDADD = $(common_libraries) \
+ $(AM_LDFLAGS)
lad_omapl138_LDADD = $(common_libraries) \
$(AM_LDFLAGS)
lad_tci6614_LDADD = $(common_libraries) \
index 858b1a64eceeb69e0189280dfa4ed2f10d366f08..440ae4ec2255b05e1e5562c152c64453c43c0177 100644 (file)
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
- $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6)
+ $(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
+ $(am__EXEEXT_7)
@OMAP54XX_SMP_TRUE@am__append_1 = lad_omap54xx_smp
-@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__append_2 = lad_omapl138
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__append_3 = lad_tci6614
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__append_4 = lad_tci6638
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_TRUE@@TCI6638_FALSE@am__append_5 = lad_tci6636
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__append_6 = lad_omap54xx_smp lad_omapl138 lad_tci6614 lad_tci6636 lad_tci6638
+@DRA7XX_TRUE@@OMAP54XX_SMP_FALSE@am__append_2 = lad_dra7xx
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__append_3 = lad_omapl138
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__append_4 = lad_tci6614
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__append_5 = lad_tci6638
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_TRUE@@TCI6638_FALSE@am__append_6 = lad_tci6636
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__append_7 = lad_omap54xx_smp lad_dra7xx lad_omapl138 lad_tci6614 lad_tci6636 lad_tci6638
subdir = linux/src/daemon
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
@OMAP54XX_SMP_TRUE@am__EXEEXT_1 = lad_omap54xx_smp$(EXEEXT)
-@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__EXEEXT_2 = \
-@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@ lad_omapl138$(EXEEXT)
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__EXEEXT_3 = lad_tci6614$(EXEEXT)
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__EXEEXT_4 = lad_tci6638$(EXEEXT)
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_TRUE@@TCI6638_FALSE@am__EXEEXT_5 = lad_tci6636$(EXEEXT)
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__EXEEXT_6 = lad_omap54xx_smp$(EXEEXT) \
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_omapl138$(EXEEXT) \
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_tci6614$(EXEEXT) \
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_tci6636$(EXEEXT) \
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_tci6638$(EXEEXT)
+@DRA7XX_TRUE@@OMAP54XX_SMP_FALSE@am__EXEEXT_2 = lad_dra7xx$(EXEEXT)
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__EXEEXT_3 = lad_omapl138$(EXEEXT)
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__EXEEXT_4 = lad_tci6614$(EXEEXT)
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6638_TRUE@am__EXEEXT_5 = lad_tci6638$(EXEEXT)
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_TRUE@@TCI6638_FALSE@am__EXEEXT_6 = lad_tci6636$(EXEEXT)
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__EXEEXT_7 = lad_omap54xx_smp$(EXEEXT) \
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_dra7xx$(EXEEXT) \
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_omapl138$(EXEEXT) \
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_tci6614$(EXEEXT) \
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_tci6636$(EXEEXT) \
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@ lad_tci6638$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am__objects_1 = lad.$(OBJEXT) MessageQ_daemon.$(OBJEXT) \
MultiProc_daemon.$(OBJEXT) NameServer_daemon.$(OBJEXT)
+am_lad_dra7xx_OBJECTS = $(am__objects_1) MultiProcCfg_dra7xx.$(OBJEXT)
+lad_dra7xx_OBJECTS = $(am_lad_dra7xx_OBJECTS)
+am__DEPENDENCIES_1 = \
+ $(top_builddir)/linux/src/utils/libtiipcutils_lad.la
+am__DEPENDENCIES_2 =
+lad_dra7xx_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_lad_omap54xx_smp_OBJECTS = $(am__objects_1) \
MultiProcCfg_omap54xx_smp.$(OBJEXT)
lad_omap54xx_smp_OBJECTS = $(am_lad_omap54xx_smp_OBJECTS)
-am__DEPENDENCIES_1 = $(top_builddir)/linux/src/api/libtiipc.la \
- $(top_builddir)/linux/src/utils/libtiipcutils.la
-am__DEPENDENCIES_2 =
lad_omap54xx_smp_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_2)
am_lad_omapl138_OBJECTS = $(am__objects_1) \
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(lad_omap54xx_smp_SOURCES) $(lad_omapl138_SOURCES) \
- $(lad_tci6614_SOURCES) $(lad_tci6636_SOURCES) \
- $(lad_tci6638_SOURCES)
-DIST_SOURCES = $(lad_omap54xx_smp_SOURCES) $(lad_omapl138_SOURCES) \
- $(lad_tci6614_SOURCES) $(lad_tci6636_SOURCES) \
- $(lad_tci6638_SOURCES)
+SOURCES = $(lad_dra7xx_SOURCES) $(lad_omap54xx_smp_SOURCES) \
+ $(lad_omapl138_SOURCES) $(lad_tci6614_SOURCES) \
+ $(lad_tci6636_SOURCES) $(lad_tci6638_SOURCES)
+DIST_SOURCES = $(lad_dra7xx_SOURCES) $(lad_omap54xx_smp_SOURCES) \
+ $(lad_omapl138_SOURCES) $(lad_tci6614_SOURCES) \
+ $(lad_tci6636_SOURCES) $(lad_tci6638_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DRA7XX_FALSE = @DRA7XX_FALSE@
+DRA7XX_TRUE = @DRA7XX_TRUE@
+DRM_FALSE = @DRM_FALSE@
+DRM_PREFIX = @DRM_PREFIX@
+DRM_TRUE = @DRM_TRUE@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
# NOTE: 6636_SOURCES using 6638.c is not a typo! 6636 has the same
# MultiProc config as 6638, so we reuse that source file.
lad_omap54xx_smp_SOURCES = $(common_sources) MultiProcCfg_omap54xx_smp.c
+lad_dra7xx_SOURCES = $(common_sources) MultiProcCfg_dra7xx.c
lad_omapl138_SOURCES = $(common_sources) MultiProcCfg_omapl138.c
lad_tci6614_SOURCES = $(common_sources) MultiProcCfg_tci6614.c
lad_tci6636_SOURCES = $(common_sources) MultiProcCfg_tci6638.c
lad_tci6638_SOURCES = $(common_sources) MultiProcCfg_tci6638.c
-common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
- $(top_builddir)/linux/src/utils/libtiipcutils.la
+common_libraries = -lpthread \
+ $(top_builddir)/linux/src/utils/libtiipcutils_lad.la
# the additional libraries needed to link program
lad_omap54xx_smp_LDADD = $(common_libraries) \
$(AM_LDFLAGS)
+lad_dra7xx_LDADD = $(common_libraries) \
+ $(AM_LDFLAGS)
+
lad_omapl138_LDADD = $(common_libraries) \
$(AM_LDFLAGS)
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
+lad_dra7xx$(EXEEXT): $(lad_dra7xx_OBJECTS) $(lad_dra7xx_DEPENDENCIES)
+ @rm -f lad_dra7xx$(EXEEXT)
+ $(LINK) $(lad_dra7xx_LDFLAGS) $(lad_dra7xx_OBJECTS) $(lad_dra7xx_LDADD) $(LIBS)
lad_omap54xx_smp$(EXEEXT): $(lad_omap54xx_smp_OBJECTS) $(lad_omap54xx_smp_DEPENDENCIES)
@rm -f lad_omap54xx_smp$(EXEEXT)
$(LINK) $(lad_omap54xx_smp_LDFLAGS) $(lad_omap54xx_smp_OBJECTS) $(lad_omap54xx_smp_LDADD) $(LIBS)
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQ_daemon.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiProcCfg_dra7xx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiProcCfg_omap54xx_smp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiProcCfg_omapl138.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiProcCfg_tci6614.Po@am__quote@
index dad1d7cefeb10ef44ca8a23b32ad62bb7b5babd0..d718f2d8249508aaaa6eb7513d40f777b325dd92 100644 (file)
.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,
similarity index 69%
rename from packages/ti/platform/vayu/dsp1/Platform.xs
rename to linux/src/daemon/MultiProcCfg_dra7xx.c
index 18b7b1b1b6934c6b7ba79865bcdf6ce0e259ebf5..10c88ccfc50071580679162594fc8c6b872117f7 100644 (file)
rename from packages/ti/platform/vayu/dsp1/Platform.xs
rename to linux/src/daemon/MultiProcCfg_dra7xx.c
index 18b7b1b1b6934c6b7ba79865bcdf6ce0e259ebf5..10c88ccfc50071580679162594fc8c6b872117f7 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*!
- * File generated by platform wizard.
- *
+/*
+ * ======== MultiProcCfg.c ========
+ * System-wide MultiProc configuration
*/
-function getCpuDataSheet(cpuId)
-{
- return this.$module.plat.getCpuDataSheet(cpuId);
-}
-
-function getCreateArgs()
-{
- return this.$module.plat.getCreateArgs();
-}
-
-function getExeContext(prog)
-{
- return this.$module.plat.getExeContext(prog);
-}
+/* Standard IPC headers */
+#include <ti/ipc/Std.h>
-function getExecCmd(prog)
-{
- return this.$module.plat.getExecCmd(prog);
-}
+/* For Backplane IPC startup/shutdown stuff: */
+#include <_MultiProc.h>
-function getLinkTemplate(prog)
-{
- return this.$module.plat.getLinkTemplate(prog);
-}
+/* This must match BIOS side MultiProc configuration for given platform!: */
+MultiProc_Config _MultiProc_cfg = {
+ .numProcessors = 5,
+ .nameList[0] = "HOST",
+ .nameList[1] = "IPU2",
+ .nameList[2] = "IPU1",
+ .nameList[3] = "DSP2",
+ .nameList[4] = "DSP1",
+ .rprocList[0] = -1,
+ .rprocList[1] = 1,
+ .rprocList[2] = 3,
+ .rprocList[3] = 2,
+ .rprocList[4] = 0,
+ .id = 0, /* The host is always zero */
+};
diff --git a/linux/src/daemon/MultiProcCfg_omap54xx_smp.c b/linux/src/daemon/MultiProcCfg_omap54xx_smp.c
index 1a48ffb71c2755d5c55caaaae9b5e29b0ed557ab..3cabbac980572a261d9fa9141e9594620e6ff28b 100644 (file)
.nameList[0] = "HOST",
.nameList[1] = "IPU",
.nameList[2] = "DSP",
+ .rprocList[0] = -1,
+ .rprocList[1] = 1,
+ .rprocList[2] = 0,
.id = 0, /* The host is always zero */
};
index d114aff3301bd294ff00bb0888431add6edaf593..d7508e8eedefe7554f9f8c35d96b231fea4428eb 100644 (file)
.numProcessors = 2,
.nameList[0] = "HOST",
.nameList[1] = "DSP",
+ .rprocList[0] = -1,
+ .rprocList[1] = 0,
.id = 0, /* The host is always zero */
};
index 08b84b2666ec34c336db6c92985f352a0bc02b9d..1528b25099ba8b994ad46e384738ace9ae44bc5d 100644 (file)
.nameList[2] = "CORE1",
.nameList[3] = "CORE2",
.nameList[4] = "CORE3",
+ .rprocList[0] = -1,
+ .rprocList[1] = 0,
+ .rprocList[2] = 1,
+ .rprocList[3] = 2,
+ .rprocList[4] = 3,
.id = 0, /* The host is always zero */
};
index 3490732f0779625e2016b216a2dc6f3beefe3d36..18b338a8d5fa3730e7b161d68f1c90dec87eb215 100644 (file)
.nameList[6] = "CORE5",
.nameList[7] = "CORE6",
.nameList[8] = "CORE7",
+ .rprocList[0] = -1,
+ .rprocList[1] = 0,
+ .rprocList[2] = 1,
+ .rprocList[3] = 2,
+ .rprocList[4] = 3,
+ .rprocList[5] = 4,
+ .rprocList[6] = 5,
+ .rprocList[7] = 6,
+ .rprocList[8] = 7,
.id = 0, /* The host is always zero */
};
index b8aec85925c25a7f3082bac48719d1f181c0228f..bc644e5b5d83ed78c257554044cb3b9cdb95daad 100644 (file)
String name; /* name of the instance */
NameServer_Params params; /* the parameter structure */
UInt32 count; /* count of entries */
+ UInt32 refCount; /* reference count to this object */
pthread_mutex_t gate; /* crit sect gate */
} NameServer_Object;
.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
};
err = SocketBindAddr(sock, procId, NAME_SERVER_RPMSG_ADDR);
if (err < 0) {
- status = NameServer_E_FAIL;
- LOG2("NameServer_setup: bind failed: %d, %s\n",
+ status = NameServer_E_FAIL;
+ LOG2("NameServer_setup: bind failed: %d, %s\n",
errno, strerror(errno))
LOG1(" closing recv socket: %d\n", sock)
close(sock);
}
else {
- NameServer_module->recvSock[procId] = sock;
+ NameServer_module->recvSock[procId] = sock;
}
}
}
status = NameServer_E_FAIL;
}
+ else {
+ /* look for at least one good send/recv pair to indicate success */
+ for (procId = 0; procId < numProcs; procId++) {
+ if (NameServer_module->sendSock[procId] != INVALIDSOCKET &&
+ NameServer_module->recvSock[procId] != INVALIDSOCKET) {
+ status = NameServer_S_SUCCESS;
+
+ break;
+ }
+ }
+ }
exit:
LOG1("NameServer_setup: exiting, refCount=%d\n", NameServer_module->refCount)
}
/* check if the name is already created or not */
- if (NameServer_getHandle(name)) {
- LOG0("NameServer_create NameServer_E_INVALIDARG Name is in use!\n")
- handle = NULL;
+ handle = NameServer_getHandle(name);
+ if (handle != NULL) {
+ if (memcmp((Ptr)&handle->params, (Ptr)params,
+ sizeof(NameServer_Params)) == 0) {
+ handle->refCount++;
+ }
+ else {
+ LOG0("NameServer_create: NameServer params mismatch\n")
+ handle = NULL;
+ }
goto leave;
}
else {
goto leave;
}
+ handle->refCount = 1;
handle->name = (String)malloc(strlen(name) + 1u);
if (!handle->name) {
LOG0("NameServer_create: instance name alloc failed\n")
pthread_mutex_lock(&NameServer_module->modGate);
+ (*handle)->refCount--;
+ if ((*handle)->refCount != 0) {
+ goto leave;
+ }
+
if ((*handle)->count == 0) {
CIRCLEQ_REMOVE(&NameServer_module->objList, *handle, elem);
(*handle) = NULL;
}
+leave:
pthread_mutex_unlock(&NameServer_module->modGate);
return (status);
int err;
/* Set Timeout to wait: */
- tv.tv_sec = NAMESERVER_GET_TIMEOUT;
- tv.tv_usec = 0;
+ tv.tv_sec = 0;
+ tv.tv_usec = NAMESERVER_GET_TIMEOUT;
/* Create request message and send to remote: */
sock = NameServer_module->sendSock[procId];
+ if (sock == INVALIDSOCKET) {
+ LOG1("NameServer_getRemote: no socket connection to processor %d\n",
+ procId);
+ status = NameServer_E_RESOURCE;
+ goto exit;
+ }
+
LOG1("NameServer_getRemote: Sending request via sock: %d\n", sock)
/* Create request message and send to remote processor: */
nsMsg.reserved = NAMESERVER_MSG_TOKEN;
nsMsg.request = NAMESERVER_REQUEST;
nsMsg.requestStatus = 0;
+ nsMsg.valueLen = *len;
strncpy((char *)nsMsg.instanceName, obj->name, strlen(obj->name) + 1);
strncpy((char *)nsMsg.name, name, strlen(name) + 1);
status = NameServer_getRemote(handle, name, value, len, i);
if ((status >= 0) ||
- ((status < 0) && (status != NameServer_E_NOTFOUND))) {
+ ((status < 0) && (status != NameServer_E_NOTFOUND) &&
+ (status != NameServer_E_RESOURCE))) {
break;
}
}
}
if ((status >= 0) ||
- ((status < 0) && (status != NameServer_E_NOTFOUND))) {
+ ((status < 0) && (status != NameServer_E_NOTFOUND) &&
+ (status != NameServer_E_RESOURCE))) {
break;
}
}
}
+ if (status == NameServer_E_RESOURCE) {
+ status = NameServer_E_NOTFOUND;
+ }
+
return (status);
}
index ea801a63e58f8fd02df619c533fefe3abf1b1cff..96dfa17e072dd1009ddfce7ee1672a7479011fb9 100644 (file)
--- a/linux/src/mm/Makefile.am
+++ b/linux/src/mm/Makefile.am
endif
endif
+if DRA7XX
+if KDIR
+lib_LTLIBRARIES += libmmrpc.la
+
+# where to install the headers on the system
+libmmrpc_ladir = $(includedir)/ti/ipc/mm
+
+# the list of header files that belong to the library (to be installed later)
+libmmrpc_la_HEADERS = $(top_srcdir)/packages/ti/ipc/mm/MmRpc.h
+endif
+endif
+
# the sources to add to the library and to add to the source distribution
libmmrpc_la_SOURCES = \
$(libmmrpc_la_HEADERS) \
index 6a5ca152bce63231884ba50a6412778a979469f0..f4ed0f9e5122f1a58c16832bd6c54d3c438165bc 100644 (file)
--- a/linux/src/mm/Makefile.in
+++ b/linux/src/mm/Makefile.in
build_triplet = @build@
host_triplet = @host@
@KDIR_TRUE@@OMAP54XX_SMP_TRUE@am__append_1 = libmmrpc.la
+@DRA7XX_TRUE@@KDIR_TRUE@am__append_2 = libmmrpc.la
subdir = linux/src/mm
DIST_COMMON = $(am__libmmrpc_la_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
am__objects_1 =
am_libmmrpc_la_OBJECTS = $(am__objects_1) MmRpc.lo
libmmrpc_la_OBJECTS = $(am_libmmrpc_la_OBJECTS)
+@DRA7XX_TRUE@@KDIR_TRUE@am_libmmrpc_la_rpath = -rpath $(libdir)
@KDIR_TRUE@@OMAP54XX_SMP_TRUE@am_libmmrpc_la_rpath = -rpath $(libdir)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/linux/build-aux/depcomp
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DRA7XX_FALSE = @DRA7XX_FALSE@
+DRA7XX_TRUE = @DRA7XX_TRUE@
+DRM_FALSE = @DRM_FALSE@
+DRM_PREFIX = @DRM_PREFIX@
+DRM_TRUE = @DRM_TRUE@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
###############################################################################
# the library names to build (note we are building shared libs)
-lib_LTLIBRARIES = $(am__append_1)
+lib_LTLIBRARIES = $(am__append_1) $(am__append_2)
+
+# where to install the headers on the system
+@DRA7XX_TRUE@@KDIR_TRUE@libmmrpc_ladir = $(includedir)/ti/ipc/mm
# where to install the headers on the system
@KDIR_TRUE@@OMAP54XX_SMP_TRUE@libmmrpc_ladir = $(includedir)/ti/ipc/mm
+# the list of header files that belong to the library (to be installed later)
+@DRA7XX_TRUE@@KDIR_TRUE@libmmrpc_la_HEADERS = $(top_srcdir)/packages/ti/ipc/mm/MmRpc.h
+
# the list of header files that belong to the library (to be installed later)
@KDIR_TRUE@@OMAP54XX_SMP_TRUE@libmmrpc_la_HEADERS = $(top_srcdir)/packages/ti/ipc/mm/MmRpc.h
index ce996bc89878cd9540a4f1437052464ac3ff22c1..b064b6b846b3aca203989540f4fab4c792ba994b 100644 (file)
AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/hlos_common/include \
-I$(top_srcdir)/packages -I$(CMEM_INSTALL_DIR)/include \
-I$(KERNEL_INSTALL_DIR)/include/generated/uapi \
+ -I$(DRM_PREFIX)/usr/include \
+ -I$(DRM_PREFIX)/usr/include/libdrm \
+ -I$(DRM_PREFIX)/usr/include/omap \
-D_GNU_SOURCE -Wall @AM_CFLAGS@
VPATH = ../../../packages/ti/ipc/tests
# the program to build (the names of the final binaries)
bin_PROGRAMS = ping_rpmsg MessageQApp MessageQBench MessageQMulti \
- NameServerApp
+ NameServerApp Msgq100
if OMAP54XX_SMP
# Add platform specific bin application's here
bin_PROGRAMS +=
if KDIR
+if DRM
bin_PROGRAMS += mmrpc_test
endif
+endif
+else
+if DRA7XX
+# Add platform specific bin application's here
+ bin_PROGRAMS +=
+if KDIR
+if DRM
+ bin_PROGRAMS += mmrpc_test
+endif
+endif
else
if OMAPL138
# Add platform specific bin application's here
bin_PROGRAMS += nano_test
endif
if KDIR
+if DRM
bin_PROGRAMS += mmrpc_test
endif
endif
endif
endif
endif
+endif
+endif
common_sources = \
$(top_srcdir)/linux/include/ti/ipc/Std.h \
# list of sources for the 'nano_test' binary
nano_test_SOURCES = $(common_sources) nano_test.c
+# list of sources for the 'Msgq100' binary
+Msgq100_SOURCES = $(common_sources) Msgq100.c
+
common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
$(top_builddir)/linux/src/utils/libtiipcutils.la
# the additional libraries to link mmrpc_test
mmrpc_test_LDADD = $(common_libraries) \
- $(top_builddir)/linux/src/mm/libmmrpc.la
+ $(top_builddir)/linux/src/mm/libmmrpc.la \
+ $(DRM_PREFIX)/usr/lib/libdrm.la \
+ $(DRM_PREFIX)/usr/lib/libdrm_omap.la
# the additional libraries needed to link MessageQApp
MessageQApp_LDADD = $(common_libraries) \
$(CMEM_INSTALL_DIR)/src/cmem/api/.libs/libticmem.a \
$(AM_LDFLAGS)
+# the additional libraries needed to link Msgq100
+Msgq100_LDADD = $(common_libraries) \
+ $(AM_LDFLAGS)
+
###############################################################################
index ba98296345017001e18211647add53fbb0bb8971..ab106ae019b9724493e4aa97312f4c0a07a8fae1 100644 (file)
host_triplet = @host@
bin_PROGRAMS = ping_rpmsg$(EXEEXT) MessageQApp$(EXEEXT) \
MessageQBench$(EXEEXT) MessageQMulti$(EXEEXT) \
- NameServerApp$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
- $(am__EXEEXT_1) $(am__EXEEXT_3) $(am__EXEEXT_1) \
- $(am__EXEEXT_1) $(am__EXEEXT_1) $(am__EXEEXT_4) \
- $(am__EXEEXT_5)
+ NameServerApp$(EXEEXT) Msgq100$(EXEEXT) $(am__EXEEXT_1) \
+ $(am__EXEEXT_2) $(am__EXEEXT_1) $(am__EXEEXT_3) \
+ $(am__EXEEXT_1) $(am__EXEEXT_4) $(am__EXEEXT_1) \
+ $(am__EXEEXT_1) $(am__EXEEXT_1) $(am__EXEEXT_5) \
+ $(am__EXEEXT_6)
# Add platform specific bin application's here
@OMAP54XX_SMP_TRUE@am__append_1 =
-@KDIR_TRUE@@OMAP54XX_SMP_TRUE@am__append_2 = mmrpc_test
+@DRM_TRUE@@KDIR_TRUE@@OMAP54XX_SMP_TRUE@am__append_2 = mmrpc_test
# Add platform specific bin application's here
-@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__append_3 =
-@CMEM_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__append_4 = nano_test
+@DRA7XX_TRUE@@OMAP54XX_SMP_FALSE@am__append_3 =
+@DRA7XX_TRUE@@DRM_TRUE@@KDIR_TRUE@@OMAP54XX_SMP_FALSE@am__append_4 = mmrpc_test
# Add platform specific bin application's here
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__append_5 =
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__append_5 =
+@CMEM_TRUE@@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__append_6 = nano_test
# Add platform specific bin application's here
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_TRUE@am__append_6 =
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_TRUE@am__append_7 =
# Add platform specific bin application's here
-@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_TRUE@am__append_7 =
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_TRUE@am__append_8 =
+# Add platform specific bin application's here
+@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_TRUE@am__append_9 =
# Add platform independent apps here or above in bin_PROGRAMS
-@CMEM_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__append_8 = nano_test
-@KDIR_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__append_9 = mmrpc_test
+@CMEM_TRUE@@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__append_10 = nano_test
+@DRA7XX_FALSE@@DRM_TRUE@@KDIR_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__append_11 = mmrpc_test
subdir = linux/src/tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__EXEEXT_1 =
-@KDIR_TRUE@@OMAP54XX_SMP_TRUE@am__EXEEXT_2 = mmrpc_test$(EXEEXT)
-@CMEM_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__EXEEXT_3 = nano_test$(EXEEXT)
-@CMEM_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__EXEEXT_4 = nano_test$(EXEEXT)
-@KDIR_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__EXEEXT_5 = mmrpc_test$(EXEEXT)
+@DRM_TRUE@@KDIR_TRUE@@OMAP54XX_SMP_TRUE@am__EXEEXT_2 = \
+@DRM_TRUE@@KDIR_TRUE@@OMAP54XX_SMP_TRUE@ mmrpc_test$(EXEEXT)
+@DRA7XX_TRUE@@DRM_TRUE@@KDIR_TRUE@@OMAP54XX_SMP_FALSE@am__EXEEXT_3 = mmrpc_test$(EXEEXT)
+@CMEM_TRUE@@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_TRUE@am__EXEEXT_4 = nano_test$(EXEEXT)
+@CMEM_TRUE@@DRA7XX_FALSE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__EXEEXT_5 = nano_test$(EXEEXT)
+@DRA7XX_FALSE@@DRM_TRUE@@KDIR_TRUE@@OMAP54XX_SMP_FALSE@@OMAPL138_FALSE@@TCI6614_FALSE@@TCI6636_FALSE@@TCI6638_FALSE@am__EXEEXT_6 = mmrpc_test$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
MessageQMulti_OBJECTS = $(am_MessageQMulti_OBJECTS)
MessageQMulti_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_2)
+am_Msgq100_OBJECTS = $(am__objects_1) Msgq100.$(OBJEXT)
+Msgq100_OBJECTS = $(am_Msgq100_OBJECTS)
+Msgq100_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am__objects_2 = NameServerApp.$(OBJEXT)
am_NameServerApp_OBJECTS = $(am__objects_2)
NameServerApp_OBJECTS = $(am_NameServerApp_OBJECTS)
am_mmrpc_test_OBJECTS = Mx.$(OBJEXT) mmrpc_test.$(OBJEXT)
mmrpc_test_OBJECTS = $(am_mmrpc_test_OBJECTS)
mmrpc_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- $(top_builddir)/linux/src/mm/libmmrpc.la
+ $(top_builddir)/linux/src/mm/libmmrpc.la \
+ $(DRM_PREFIX)/usr/lib/libdrm.la \
+ $(DRM_PREFIX)/usr/lib/libdrm_omap.la
am_nano_test_OBJECTS = $(am__objects_1) nano_test.$(OBJEXT)
nano_test_OBJECTS = $(am_nano_test_OBJECTS)
nano_test_DEPENDENCIES = $(am__DEPENDENCIES_1) \
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(MessageQApp_SOURCES) $(MessageQBench_SOURCES) \
- $(MessageQMulti_SOURCES) $(NameServerApp_SOURCES) \
- $(mmrpc_test_SOURCES) $(nano_test_SOURCES) \
- $(ping_rpmsg_SOURCES)
+ $(MessageQMulti_SOURCES) $(Msgq100_SOURCES) \
+ $(NameServerApp_SOURCES) $(mmrpc_test_SOURCES) \
+ $(nano_test_SOURCES) $(ping_rpmsg_SOURCES)
DIST_SOURCES = $(MessageQApp_SOURCES) $(MessageQBench_SOURCES) \
- $(MessageQMulti_SOURCES) $(NameServerApp_SOURCES) \
- $(mmrpc_test_SOURCES) $(nano_test_SOURCES) \
- $(ping_rpmsg_SOURCES)
+ $(MessageQMulti_SOURCES) $(Msgq100_SOURCES) \
+ $(NameServerApp_SOURCES) $(mmrpc_test_SOURCES) \
+ $(nano_test_SOURCES) $(ping_rpmsg_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
AM_CFLAGS = -I$(top_srcdir)/linux/include -I$(top_srcdir)/hlos_common/include \
-I$(top_srcdir)/packages -I$(CMEM_INSTALL_DIR)/include \
-I$(KERNEL_INSTALL_DIR)/include/generated/uapi \
+ -I$(DRM_PREFIX)/usr/include \
+ -I$(DRM_PREFIX)/usr/include/libdrm \
+ -I$(DRM_PREFIX)/usr/include/omap \
-D_GNU_SOURCE -Wall @AM_CFLAGS@
AM_LDFLAGS = @AM_LDFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DRA7XX_FALSE = @DRA7XX_FALSE@
+DRA7XX_TRUE = @DRA7XX_TRUE@
+DRM_FALSE = @DRM_FALSE@
+DRM_PREFIX = @DRM_PREFIX@
+DRM_TRUE = @DRM_TRUE@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
# list of sources for the 'nano_test' binary
nano_test_SOURCES = $(common_sources) nano_test.c
+
+# list of sources for the 'Msgq100' binary
+Msgq100_SOURCES = $(common_sources) Msgq100.c
common_libraries = -lpthread $(top_builddir)/linux/src/api/libtiipc.la \
$(top_builddir)/linux/src/utils/libtiipcutils.la
# the additional libraries to link mmrpc_test
mmrpc_test_LDADD = $(common_libraries) \
- $(top_builddir)/linux/src/mm/libmmrpc.la
+ $(top_builddir)/linux/src/mm/libmmrpc.la \
+ $(DRM_PREFIX)/usr/lib/libdrm.la \
+ $(DRM_PREFIX)/usr/lib/libdrm_omap.la
# the additional libraries needed to link MessageQApp
$(CMEM_INSTALL_DIR)/src/cmem/api/.libs/libticmem.a \
$(AM_LDFLAGS)
+
+# the additional libraries needed to link Msgq100
+Msgq100_LDADD = $(common_libraries) \
+ $(AM_LDFLAGS)
+
all: all-am
.SUFFIXES:
MessageQMulti$(EXEEXT): $(MessageQMulti_OBJECTS) $(MessageQMulti_DEPENDENCIES)
@rm -f MessageQMulti$(EXEEXT)
$(LINK) $(MessageQMulti_LDFLAGS) $(MessageQMulti_OBJECTS) $(MessageQMulti_LDADD) $(LIBS)
+Msgq100$(EXEEXT): $(Msgq100_OBJECTS) $(Msgq100_DEPENDENCIES)
+ @rm -f Msgq100$(EXEEXT)
+ $(LINK) $(Msgq100_LDFLAGS) $(Msgq100_OBJECTS) $(Msgq100_LDADD) $(LIBS)
NameServerApp$(EXEEXT): $(NameServerApp_OBJECTS) $(NameServerApp_DEPENDENCIES)
@rm -f NameServerApp$(EXEEXT)
$(LINK) $(NameServerApp_LDFLAGS) $(NameServerApp_OBJECTS) $(NameServerApp_LDADD) $(LIBS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQApp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQBench.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageQMulti.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Msgq100.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NameServerApp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmrpc_test.Po@am__quote@
index 942f8ac105695ed29555617633ec07a081b9963a..dc3444c0934b979e212dc109083fa16e58123a5b 100644 (file)
typedef struct SyncMsg {
MessageQ_MsgHeader header;
- unsigned long numLoops;
- unsigned long print;
+ UInt32 numLoops; /* also used for msgId */
+ UInt32 print;
} SyncMsg ;
Int MessageQApp_execute(UInt32 numLoops, UInt16 procId)
Int32 status = 0;
MessageQ_Msg msg = NULL;
MessageQ_Params msgParams;
- UInt16 i;
+ UInt32 i;
MessageQ_QueueId queueId = MessageQ_INVALIDMESSAGEQ;
MessageQ_Handle msgqHandle;
char remoteQueueName[64];
+ UInt32 msgId;
printf("Entered MessageQApp_execute\n");
/* handshake with remote to set the number of loops */
MessageQ_setReplyQueue(msgqHandle, msg);
((SyncMsg *)msg)->numLoops = numLoops;
- ((SyncMsg *)msg)->print = TRUE;
+ ((SyncMsg *)msg)->print = FALSE;
MessageQ_put(queueId, msg);
MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
printf("Exchanging %d messages with remote processor %s...\n",
numLoops, MultiProc_getName(procId));
- for (i = 0 ; i < numLoops; i++) {
- MessageQ_setMsgId(msg, i);
+ for (i = 1 ; i <= numLoops; i++) {
+ ((SyncMsg *)msg)->numLoops = i;
/* Have the remote proc reply to this message queue */
MessageQ_setReplyQueue(msgqHandle, msg);
}
status = MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+
if (status < 0) {
printf("Error in MessageQ_get [%d]\n", status);
break;
}
else {
- printf("MessageQ_get #%d Msg = 0x%x\n", i, (UInt)msg);
-
- /* Validate the returned message. */
- if ((msg != NULL) && (MessageQ_getMsgId (msg) != i)) {
+ /* validate the returned message */
+ msgId = ((SyncMsg *)msg)->numLoops;
+ if ((msg != NULL) && (msgId != i)) {
printf("Data integrity failure!\n"
" Expected %d\n"
" Received %d\n",
- i, MessageQ_getMsgId(msg));
+ i, msgId);
break;
}
}
- printf("Exchanged %d messages with remote processor %s\n",
- (i+1), MultiProc_getName(procId));
+ if (numLoops <= 200) {
+ printf("MessageQ_get #%d Msg = 0x%x\n", i, (UInt)msg);
+ }
+ else if ((i % 1000) == 0) {
+ printf("MessageQ_get #%d Msg = 0x%x\n", i, (UInt)msg);
+ }
}
+ printf("Exchanged %d messages with remote processor %s\n",
+ (i-1), MultiProc_getName(procId));
+
if (status >= 0) {
printf("Sample application successfully completed!\n");
}
index 990128706ec311b7e6054b1834cfe94a22b96e50..63175953c5353c8439e3c85761ad5119145698c2 100644 (file)
* ============================================================================
*/
-/*
- * opkg --tmp-dir ~/tmp install util-linux-ng
- * chrt -f ./MessageQBench
- */
+/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/param.h>
+/* IPC Headers */
#include <ti/ipc/Std.h>
#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
-#define MessageQ_payload(m) ((void *)((char *)(m) + sizeof(MessageQ_MsgHeader)))
#define MINPAYLOADSIZE (2 * sizeof(UInt32))
-/* App defines: Must match on remote proc side: */
-#define NUM_LOOPS_DFLT 1000 /* Number of transfers to be tested. */
+/* App defines: Must match on remote proc side: */
#define HEAPID 0u
-#define PROC_ID_DFLT 1 /* Host is zero, remote cores start at 1 */
#define SLAVE_MESSAGEQNAME "SLAVE"
#define MPU_MESSAGEQNAME "HOST"
+#define PROC_ID_DFLT 1 /* Host is zero, remote cores start at 1 */
+#define NUM_LOOPS_DFLT 1000 /* Number of transfers to be tested. */
+
+typedef struct SyncMsg {
+ MessageQ_MsgHeader header;
+ UInt32 numLoops; /* also used for msgId */
+ UInt32 print;
+} SyncMsg ;
long diff(struct timespec start, struct timespec end)
{
Int32 status = 0;
MessageQ_Msg msg = NULL;
MessageQ_Params msgParams;
- UInt16 i;
+ UInt32 i;
MessageQ_QueueId queueId = MessageQ_INVALIDMESSAGEQ;
MessageQ_Handle msgqHandle;
char remoteQueueName[64];
struct timespec start, end;
long elapsed;
- UInt32 *params;
+ UInt32 msgId;
- printf ("Entered MessageQApp_execute\n");
+ printf("Entered MessageQApp_execute\n");
/* Create the local Message Queue for receiving. */
MessageQ_Params_init(&msgParams);
msgqHandle = MessageQ_create(MPU_MESSAGEQNAME, &msgParams);
if (msgqHandle == NULL) {
- printf ("Error in MessageQ_create\n");
+ printf("Error in MessageQ_create\n");
goto exit;
}
else {
- printf ("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
+ printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
}
sprintf(remoteQueueName, "%s_%s", SLAVE_MESSAGEQNAME,
printf("Error in MessageQ_open [%d]\n", status);
goto cleanup;
}
+ else {
+ printf("Remote queueId [0x%x]\n", queueId);
+ }
- printf("Remote queueId [0x%x]\n", queueId);
-
- msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader) + payloadSize);
+ msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg) + payloadSize);
if (msg == NULL) {
printf("Error in MessageQ_alloc\n");
MessageQ_close(&queueId);
/* handshake with remote to set the number of loops */
MessageQ_setReplyQueue(msgqHandle, msg);
- params = MessageQ_payload(msg);
- params[0] = numLoops;
- params[1] = FALSE;
+ ((SyncMsg *)msg)->numLoops = numLoops;
+ ((SyncMsg *)msg)->print = FALSE;
MessageQ_put(queueId, msg);
MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
clock_gettime(CLOCK_REALTIME, &start);
- for (i = 0; i < numLoops; i++) {
- MessageQ_setMsgId(msg, i);
+ for (i = 1 ; i <= numLoops; i++) {
+ ((SyncMsg *)msg)->numLoops = i;
/* Have the remote proc reply to this message queue */
MessageQ_setReplyQueue(msgqHandle, msg);
}
status = MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+
if (status < 0) {
printf("Error in MessageQ_get [%d]\n", status);
break;
}
else {
- /* Validate the returned message. */
- if ((msg != NULL) && (MessageQ_getMsgId(msg) != i)) {
- printf ("Data integrity failure!\n"
+ /* Validate the returned message */
+ msgId = ((SyncMsg *)msg)->numLoops;
+ if ((msg != NULL) && (msgId != i)) {
+ printf("Data integrity failure!\n"
" Expected %d\n"
" Received %d\n",
- i, MessageQ_getMsgId (msg));
+ i, msgId);
break;
}
}
Ipc_stop();
}
else {
- fprintf(stderr, "Ipc_start failed: status = %d\n", status);
+ printf("Ipc_start failed: status = %d\n", status);
}
return (status);
diff --git a/linux/src/tests/Msgq100.c b/linux/src/tests/Msgq100.c
--- /dev/null
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2012-2013, 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 Msgq100.c
+ *
+ * @brief Bug validation test: ####
+ *
+ * ============================================================================
+ */
+
+/* standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* ipc headers */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+
+#define HEAPID 0 /* not actually used */
+#define SLAVE_MSGQNAME "SLAVE"
+#define MPU_MESSAGEQNAME "HOST"
+#define Main_MAXQUE 10
+#define NUM_LOOPS_DFLT 4
+
+#define Main_USAGE "\
+Usage:\n\
+ Msgq100 [options] procId ...\n\
+\n\
+Arguments:\n\
+ procId: remote processor id\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+ l : list the available remote processors\n\
+\n\
+Examples:\n\
+ Msgq100 1\n\
+ Msgq100 1 4\n\
+ Msgq100 -h\n\
+\n"
+
+typedef struct SyncMsg {
+ MessageQ_MsgHeader header;
+ UInt32 numLoops;
+ UInt32 print;
+} SyncMsg;
+
+/* private functions */
+static int Main_main(Void);
+
+static int Main_procCount = 0;
+static UInt16 Main_procAry[Main_MAXQUE];
+static MessageQ_QueueId Main_msgQueAry[Main_MAXQUE];
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ Int32 status = 0;
+ int arg, opt;
+ int p;
+ UInt16 procId;
+ UInt16 numProcs;
+ String name;
+
+ /* parse the command line options (e.g. -h) */
+ for (arg = 1; (arg < argc) && (argv[arg][0] == '-'); arg++) {
+
+ /* convert option into numeric value */
+ opt = (int)argv[arg][1];
+
+ switch (opt) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ case 'l': /* -l */
+ printf("Processor List\n");
+ status = Ipc_start();
+ if (status >= 0) {
+ numProcs = MultiProc_getNumProcessors();
+ for (p = 0; p < numProcs; p++) {
+ name = MultiProc_getName(p);
+ printf(" procId=%d, procName=%s\n", p, name);
+ }
+ Ipc_stop();
+ }
+ else {
+ printf(
+ "Error: %s, line %d: Ipc_start failed\n",
+ __FILE__, __LINE__);
+ goto leave;
+ }
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (Char)opt);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ while (arg < argc) {
+
+ if (Main_procCount == Main_MAXQUE) {
+ printf("Error: too many procIds (max=%d)\n", Main_MAXQUE);
+ status = -1;
+ goto leave;
+ }
+
+ /* remaining arguments is a list of procId's */
+ Main_procAry[Main_procCount++] = atoi(argv[arg]);
+
+ arg++;
+ }
+
+ /* ipc initialization */
+ status = Ipc_start();
+
+ if (status < 0) {
+ printf("Error: Ipc_start failed: status = %d\n", status);
+ status = -1;
+ goto leave;
+ }
+
+ /* validate procId list, must do this after Ipc_start() */
+ for (p = 0; p < Main_procCount; p++) {
+ procId = Main_procAry[p];
+
+ if (procId >= MultiProc_getNumProcessors()) {
+ printf("Error: procId must be less than %d\n",
+ MultiProc_getNumProcessors());
+ status = -1;
+ goto stop;
+ }
+ }
+
+ /* execute main body of test */
+ status = Main_main();
+
+ if (status == 0) {
+ printf("Test PASSED\n");
+ }
+
+stop:
+ /* ipc finalization */
+ Ipc_stop();
+
+leave:
+ return(status);
+}
+
+/*
+ * ======== Main_main ========
+ */
+int Main_main(Void)
+{
+ int status = 0;
+ MessageQ_Msg msg = NULL;
+ MessageQ_Params msgParams;
+ int p, j;
+ UInt16 procId;
+ MessageQ_Handle hostQ;
+ char queueName[64];
+ String procName;
+
+ printf("Entered Main_main\n");
+
+ /* create local message queue for receiving messages */
+ MessageQ_Params_init(&msgParams);
+
+ hostQ = MessageQ_create(MPU_MESSAGEQNAME, &msgParams);
+
+ if (hostQ == NULL) {
+ printf("Error: MessageQ_create() failed\n");
+ goto leave;
+ }
+ printf("HOST MessageQId: 0x%x\n", MessageQ_getQueueId(hostQ));
+
+ /* open remote message queues */
+ for (p = 0; p < Main_procCount; p++) {
+
+ /* compute remote queue name */
+ procId = Main_procAry[p];
+ procName = MultiProc_getName(procId);
+ sprintf(queueName, "%s_%s", SLAVE_MSGQNAME, procName);
+
+ /* open the remote message queue, loop until queue is available */
+ do {
+ status = MessageQ_open(queueName, &Main_msgQueAry[p]);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ sleep(1);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("Error: MessageQ_open(\"%s\") failed, status=%d\n",
+ queueName, status);
+ status = -1;
+ goto cleanup;
+ }
+ printf("Remote queueId[%d]=0x%x\n", p, Main_msgQueAry[p]);
+ }
+
+ /* allocate handshake message */
+ msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg));
+
+ if (msg == NULL) {
+ printf("Error: MessageQ_alloc() failed\n");
+ status = -1;
+ goto cleanup;
+ }
+
+ /* handshake with each remote processor to set the number of loops */
+ for (p = 0; p < Main_procCount; p++) {
+ MessageQ_setReplyQueue(hostQ, msg);
+ ((SyncMsg *)msg)->numLoops = NUM_LOOPS_DFLT;
+ ((SyncMsg *)msg)->print = TRUE;
+ MessageQ_put(Main_msgQueAry[p], msg);
+ MessageQ_get(hostQ, &msg, MessageQ_FOREVER);
+
+ procId = Main_procAry[p];
+ procName = MultiProc_getName(procId);
+ printf("Exchanging %d messages with remote processor %s...\n",
+ NUM_LOOPS_DFLT, procName);
+ }
+
+ /* free handshake message */
+ MessageQ_free(msg);
+
+ /* allocate and send all messages */
+ for (p = 0; p < Main_procCount; p++) {
+ for (j = 1; j <= NUM_LOOPS_DFLT; j++) {
+
+ /* allocate message */
+ msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg));
+
+ if (msg == NULL) {
+ printf("Error: MessageQ_alloc() failed\n");
+ status = -1;
+ goto cleanup;
+ }
+
+ /* fill in message */
+ MessageQ_setReplyQueue(hostQ, msg);
+ ((SyncMsg *)msg)->numLoops = j;
+
+ /* send the messages */
+ status = MessageQ_put(Main_msgQueAry[p], msg);
+
+ if (status < 0) {
+ printf("Error: MessageQ_put() failed, procId=%d, status=%d\n",
+ Main_procAry[p], status);
+ status = -1;
+ goto cleanup;
+ }
+ }
+ }
+
+ /* delay here to allow for return message deliver */
+ printf("Waiting...");
+ sleep(3);
+ printf("done.\n");
+
+ /* receive and free all messages */
+ for (p = 0; p < Main_procCount; p++) {
+ for (j = 1; j <= NUM_LOOPS_DFLT; j++) {
+
+ /* receive message, timeout 2 sec */
+ status = MessageQ_get(hostQ, &msg, 2000);
+
+ if (status == MessageQ_E_TIMEOUT) {
+ printf("Error: detected dropped message\n");
+ status = -1;
+ goto cleanup;
+ }
+ else if (status < 0) {
+ printf("Error: MessageQ_get() failed, status=%d\n", status);
+ status = -1;
+ goto cleanup;
+ }
+ }
+
+ procId = Main_procAry[p];
+ printf("ProcId %d, received %d messages\n", procId, NUM_LOOPS_DFLT);
+ }
+
+ /* getting here implies success */
+ printf("All messages received\n");
+
+cleanup:
+ /* close remote message queues */
+ for (p = 0; p < Main_procCount; p++) {
+ MessageQ_close(&Main_msgQueAry[p]);
+ }
+
+ /* delete local message queue */
+ MessageQ_delete(&hostQ);
+
+leave:
+ printf("Leaving Main_main(), status=%d\n", status);
+
+ return(status);
+}
index 45830ab7eb1005d8caafb4e0d4dc5e5ce3d419c0..1cb6e555a0c1698afba320e31114e5725960a2a1 100644 (file)
Int32 status = 0;
NameServer_Params params;
NameServer_Handle nsHandle;
+ NameServer_Handle nsHandleAlias;
NameServer_Handle nsHandle2;
Int iteration = 0;
#ifdef USE_NSD
again:
NameServer_Params_init(¶ms);
+
+ params.maxValueLen = sizeof(UInt32);
+ params.maxNameLen = 32;
+
printf("params.maxValueLen=%d\n", params.maxValueLen);
printf("params.maxNameLen=%d\n", params.maxNameLen);
printf("params.checkExisting=%d\n", params.checkExisting);
- params.maxValueLen = sizeof(UInt32);
- params.maxNameLen = 32;
nsHandle = NameServer_create(NSNAME, ¶ms);
if (nsHandle == NULL) {
printf("Failed to create NameServer '%s'\n", NSNAME);
printf("Created NameServer '%s'\n", NSNAME);
}
+ nsHandleAlias = NameServer_create(NSNAME, ¶ms);
+ if (nsHandleAlias == NULL) {
+ printf("Failed to get handle to NameServer '%s'\n", NSNAME);
+ return -1;
+ }
+ else {
+ printf("Got another handle to NameServer '%s'\n", NSNAME);
+ }
+
NameServer_Params_init(¶ms);
params.maxValueLen = sizeof(UInt32);
printf("Created NameServer '%s'\n", NSNAME2);
}
+ printf("Testing nsHandle\n");
status = testNS(nsHandle, "Key");
+ if (status != 0) {
+ printf("test failed on nsHandle\n");
+ return status;
+ }
+ printf("Testing nsHandle2\n");
status = testNS(nsHandle2, "Key");
+ if (status != 0) {
+ printf("test failed on nsHandle2\n");
+ return status;
+ }
printf("Deleting nsHandle and nsHandle2...\n");
NameServer_delete(&nsHandle);
NameServer_delete(&nsHandle2);
+ /*
+ * Verify that we can still use the alias handle after deleting the
+ * initial handle
+ */
+ printf("Testing nsHandleAlias\n");
+ status = testNS(nsHandleAlias, "Key");
+ if (status != 0) {
+ printf("test failed on nsHandleAlias\n");
+ return status;
+ }
+ printf("Deleting nsHandleAlias...\n");
+ NameServer_delete(&nsHandleAlias);
+
iteration++;
if (iteration < 2) {
goto again;
index bc1962b0875f1885b064d3d9115843108b6be881..740f614bb579f812243b70b53543566c06450ee4 100644 (file)
/* Ipc Socket Protocol Family */
#include <net/rpmsg.h>
-#define CORE0 (0) /* This should be MultiProc_getId("CORE0") - 1 */
-
-#define NUMLOOPS 100
+#define NUM_LOOPS_DFLT 100
+#define CORE_ID_DFLT 0 /* CORE ID should be (MultiProc ID - 1) */
long diff(struct timespec start, struct timespec end)
{
return (temp.tv_sec * 1000000UL + temp.tv_nsec / 1000);
}
-int main(void)
+int main (int argc, char ** argv)
{
+ int status = 0;
+ unsigned int numLoops = NUM_LOOPS_DFLT;
+ short coreId = CORE_ID_DFLT;
int sock, err;
struct sockaddr_rpmsg src_addr, dst_addr;
socklen_t len;
long elapsed=0,delta;
int i;
+ /* Parse Args: */
+ switch (argc) {
+ case 1:
+ /* use defaults */
+ break;
+ case 2:
+ numLoops = atoi(argv[1]);
+ break;
+ case 3:
+ numLoops = atoi(argv[1]);
+ coreId = atoi(argv[2]);
+ break;
+ default:
+ printf("Usage: %s [<numLoops>] [<CoreId>]\n", argv[0]);
+ printf("\tDefaults: numLoops: %d; CoreId: %d\n",
+ NUM_LOOPS_DFLT, CORE_ID_DFLT);
+ exit(0);
+ }
+
/* create an RPMSG socket */
- /* QNX PORTING NOTE: call fd = open("/dev/????", ...); */
sock = socket(AF_RPMSG, SOCK_SEQPACKET, 0);
if (sock < 0) {
printf("socket failed: %s (%d)\n", strerror(errno), errno);
/* connect to remote service */
memset(&dst_addr, 0, sizeof(dst_addr));
dst_addr.family = AF_RPMSG;
- dst_addr.vproc_id = CORE0;
+ dst_addr.vproc_id = coreId;
dst_addr.addr = 51; // use 51 for ping_tasks;
//dst_addr.addr = 61; // use 61 for messageQ transport;
dst_addr.addr, dst_addr.vproc_id);
len = sizeof(struct sockaddr_rpmsg);
- /* QNX PORTING NOTE: call ioctl(fd, CONNECT_IOTL, *args)*/
err = connect(sock, (struct sockaddr *)&dst_addr, len);
if (err < 0) {
printf("connect failed: %s (%d)\n", strerror(errno), errno);
}
/* let's see what local address we got */
- /* QNX PORTING NOTE: call ioctl(fd, GETLOCALENDPOINT_IOTL, *args)*/
err = getsockname(sock, (struct sockaddr *)&src_addr, &len);
if (err < 0) {
printf("getpeername failed: %s (%d)\n", strerror(errno), errno);
printf("Sending \"%s\" in a loop.\n", msg);
- for (i = 0; i < NUMLOOPS; i++) {
+ for (i = 0; i < numLoops; i++) {
clock_gettime(CLOCK_REALTIME, &start);
- /* QNX PORTING NOTE: call write(fd, msg,len); */
err = send(sock, msg, strlen(msg) + 1, 0);
if (err < 0) {
printf("sendto failed: %s (%d)\n", strerror(errno), errno);
len = sizeof(src_addr);
- /* QNX PORTING NOTE: len = read(fd, buf, len); */
err = recvfrom(sock, buf, sizeof(buf), 0,
(struct sockaddr *)&src_addr, &len);
}
printf ("Avg time: %ld usecs over %d iterations\n", elapsed / i, i);
- /* QNX PORTING NOTE: close(fd); */
close(sock);
return 0;
index 48ef3d3e382de50975b5466095952325dda11543..6b909508a84ac60bff99b52fb18e1864a140af6e 100644 (file)
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
/*
index 78d0f0e7b6bc979236f2aa23eaf75327d3bc76f3..3c14ffc598bbab4212f3d3f5fd407739fab0e08c 100644 (file)
###############################################################################
# the library names to build (note we are building shared libs)
-lib_LTLIBRARIES = libtiipcutils.la
+lib_LTLIBRARIES = libtiipcutils.la libtiipcutils_lad.la
# where to install the headers on the system
libtiipcutils_ladir = $(includedir)
+libtiipcutils_lad_ladir = $(includedir)
# the list of header files that belong to the library (to be installed later)
libtiipcutils_la_HEADERS =
+libtiipcutils_lad_la_HEADERS =
# the sources to add to the library and to add to the source distribution
libtiipcutils_la_SOURCES = \
$(top_srcdir)/packages/ti/ipc/MultiProc.h \
LAD_client.c \
$(top_srcdir)/hlos_common/src/utils/MultiProc.c \
+ MultiProc_app.c \
SocketFxns.c
+libtiipcutils_lad_la_SOURCES = \
+ $(libtiipcutils_la_HEADERS) \
+ $(top_srcdir)/linux/include/ladclient.h \
+ $(top_srcdir)/linux/include/_lad.h \
+ $(top_srcdir)/linux/include/_MultiProc.h \
+ $(top_srcdir)/linux/include/net/rpmsg.h \
+ $(top_srcdir)/linux/include/ti/ipc/Std.h \
+ $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+ LAD_client.c \
+ $(top_srcdir)/hlos_common/src/utils/MultiProc.c \
+ SocketFxns.c
+
+
# Add version info to the shared library
libtiipcutils_la_LDFLAGS = -version-info 1:0:0
+libtiipcutils_lad_la_LDFLAGS = -version-info 1:0:0
###############################################################################
index bba0429ba5129574d129dd33b5643cb2cf49f45e..8df54c9447a3b424522e72d7a3a4eea69ca3e2f2 100644 (file)
build_triplet = @build@
host_triplet = @host@
subdir = linux/src/utils
-DIST_COMMON = $(libtiipcutils_la_HEADERS) $(srcdir)/Makefile.am \
+DIST_COMMON = $(libtiipcutils_la_HEADERS) \
+ $(libtiipcutils_lad_la_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" \
- "$(DESTDIR)$(libtiipcutils_ladir)"
+ "$(DESTDIR)$(libtiipcutils_ladir)" \
+ "$(DESTDIR)$(libtiipcutils_lad_ladir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libtiipcutils_la_LIBADD =
am__objects_1 =
am_libtiipcutils_la_OBJECTS = $(am__objects_1) LAD_client.lo \
- MultiProc.lo SocketFxns.lo
+ MultiProc.lo MultiProc_app.lo SocketFxns.lo
libtiipcutils_la_OBJECTS = $(am_libtiipcutils_la_OBJECTS)
+libtiipcutils_lad_la_LIBADD =
+am_libtiipcutils_lad_la_OBJECTS = $(am__objects_1) LAD_client.lo \
+ MultiProc.lo SocketFxns.lo
+libtiipcutils_lad_la_OBJECTS = $(am_libtiipcutils_lad_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/linux/build-aux/depcomp
am__depfiles_maybe = depfiles
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libtiipcutils_la_SOURCES)
-DIST_SOURCES = $(libtiipcutils_la_SOURCES)
+SOURCES = $(libtiipcutils_la_SOURCES) $(libtiipcutils_lad_la_SOURCES)
+DIST_SOURCES = $(libtiipcutils_la_SOURCES) \
+ $(libtiipcutils_lad_la_SOURCES)
libtiipcutils_laHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(libtiipcutils_la_HEADERS)
+libtiipcutils_lad_laHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(libtiipcutils_la_HEADERS) $(libtiipcutils_lad_la_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DRA7XX_FALSE = @DRA7XX_FALSE@
+DRA7XX_TRUE = @DRA7XX_TRUE@
+DRM_FALSE = @DRM_FALSE@
+DRM_PREFIX = @DRM_PREFIX@
+DRM_TRUE = @DRM_TRUE@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
###############################################################################
# the library names to build (note we are building shared libs)
-lib_LTLIBRARIES = libtiipcutils.la
+lib_LTLIBRARIES = libtiipcutils.la libtiipcutils_lad.la
# where to install the headers on the system
libtiipcutils_ladir = $(includedir)
+libtiipcutils_lad_ladir = $(includedir)
# the list of header files that belong to the library (to be installed later)
libtiipcutils_la_HEADERS =
+libtiipcutils_lad_la_HEADERS =
# the sources to add to the library and to add to the source distribution
libtiipcutils_la_SOURCES = \
+ $(libtiipcutils_la_HEADERS) \
+ $(top_srcdir)/linux/include/ladclient.h \
+ $(top_srcdir)/linux/include/_lad.h \
+ $(top_srcdir)/linux/include/_MultiProc.h \
+ $(top_srcdir)/linux/include/net/rpmsg.h \
+ $(top_srcdir)/linux/include/ti/ipc/Std.h \
+ $(top_srcdir)/packages/ti/ipc/MultiProc.h \
+ LAD_client.c \
+ $(top_srcdir)/hlos_common/src/utils/MultiProc.c \
+ MultiProc_app.c \
+ SocketFxns.c
+
+libtiipcutils_lad_la_SOURCES = \
$(libtiipcutils_la_HEADERS) \
$(top_srcdir)/linux/include/ladclient.h \
$(top_srcdir)/linux/include/_lad.h \
# Add version info to the shared library
libtiipcutils_la_LDFLAGS = -version-info 1:0:0
+libtiipcutils_lad_la_LDFLAGS = -version-info 1:0:0
all: all-am
.SUFFIXES:
done
libtiipcutils.la: $(libtiipcutils_la_OBJECTS) $(libtiipcutils_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libtiipcutils_la_LDFLAGS) $(libtiipcutils_la_OBJECTS) $(libtiipcutils_la_LIBADD) $(LIBS)
+libtiipcutils_lad.la: $(libtiipcutils_lad_la_OBJECTS) $(libtiipcutils_lad_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libtiipcutils_lad_la_LDFLAGS) $(libtiipcutils_lad_la_OBJECTS) $(libtiipcutils_lad_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LAD_client.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiProc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiProc_app.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SocketFxns.Plo@am__quote@
.c.o:
echo " rm -f '$(DESTDIR)$(libtiipcutils_ladir)/$$f'"; \
rm -f "$(DESTDIR)$(libtiipcutils_ladir)/$$f"; \
done
+install-libtiipcutils_lad_laHEADERS: $(libtiipcutils_lad_la_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(libtiipcutils_lad_ladir)" || $(mkdir_p) "$(DESTDIR)$(libtiipcutils_lad_ladir)"
+ @list='$(libtiipcutils_lad_la_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(libtiipcutils_lad_laHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libtiipcutils_lad_ladir)/$$f'"; \
+ $(libtiipcutils_lad_laHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libtiipcutils_lad_ladir)/$$f"; \
+ done
+
+uninstall-libtiipcutils_lad_laHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libtiipcutils_lad_la_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(libtiipcutils_lad_ladir)/$$f'"; \
+ rm -f "$(DESTDIR)$(libtiipcutils_lad_ladir)/$$f"; \
+ done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libtiipcutils_ladir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libtiipcutils_ladir)" "$(DESTDIR)$(libtiipcutils_lad_ladir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
info-am:
-install-data-am: install-libtiipcutils_laHEADERS
+install-data-am: install-libtiipcutils_laHEADERS \
+ install-libtiipcutils_lad_laHEADERS
install-exec-am: install-libLTLIBRARIES
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \
- uninstall-libtiipcutils_laHEADERS
+ uninstall-libtiipcutils_laHEADERS \
+ uninstall-libtiipcutils_lad_laHEADERS
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am \
install-libLTLIBRARIES install-libtiipcutils_laHEADERS \
- install-man install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
- uninstall-am uninstall-info-am uninstall-libLTLIBRARIES \
- uninstall-libtiipcutils_laHEADERS
+ install-libtiipcutils_lad_laHEADERS install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES uninstall-libtiipcutils_laHEADERS \
+ uninstall-libtiipcutils_lad_laHEADERS
###############################################################################
similarity index 78%
rename from packages/ti/platform/vayu/dsp1/package.xdc
rename to linux/src/utils/MultiProc_app.c
index 971b69d1245cc7dec1d9e682d8b6b99f6e3c4f85..55a9e5d9eb57d3280449dfe1b8b2542396a367c6 100644 (file)
rename from packages/ti/platform/vayu/dsp1/package.xdc
rename to linux/src/utils/MultiProc_app.c
index 971b69d1245cc7dec1d9e682d8b6b99f6e3c4f85..55a9e5d9eb57d3280449dfe1b8b2542396a367c6 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*!
- * File generated by platform wizard.
+/*
+ * ======== MultiProc_app.c ========
*
+ * Internal function to initialized the MultiProc configuration
*/
-package ti.platform.vayu.dsp1 {
- module Platform;
+#include <ti/ipc/Std.h>
+
+#include <_MultiProc.h>
+
+MultiProc_Config _MultiProc_cfg;
+
+/*
+ * ===== MultiProc_initCfg =====
+ */
+Void _MultiProc_initCfg(MultiProc_Config * cfg)
+{
+ /* Initialize _MultiProc_cfg struct */
+ memcpy (&_MultiProc_cfg, cfg, sizeof(*cfg));
}
index 5666beb713662174aac7bbccbf4a869b21a9a6de..8aa9ab167d20a2e31a5e916303b98b8a3a66eb99 100644 (file)
/*
- * Copyright (c) 2012, Texas Instruments Incorporated
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* For PRINTVERBOSE* */
#include <_lad.h>
+/* For MultiProc id to remoteproc index map */
+#include <_MultiProc.h>
+
static Bool verbose = FALSE;
int ConnectSocket(int sock, UInt16 procId, int dst)
/* connect to remote service */
memset(&dstAddr, 0, sizeof(dstAddr));
dstAddr.family = AF_RPMSG;
- /* rpmsg "vproc_id" is one less than the MultiProc ID: */
- dstAddr.vproc_id = procId - 1;
+ /* convert MultiProc 'procId' to remoteproc index */
+ dstAddr.vproc_id = _MultiProc_cfg.rprocList[procId];
dstAddr.addr = dst;
len = sizeof(struct sockaddr_rpmsg);
err = connect(sock, (struct sockaddr *)&dstAddr, len);
if (err < 0) {
- printf("connect failed: %s (%d)\n", strerror(errno), errno);
- return (-1);
+ /* don't hard-printf since this is no longer fatal */
+ PRINTVERBOSE2("connect failed: %s (%d)\n", strerror(errno), errno);
+ return (-1);
}
/* let's see what local address we got */
err = getsockname(sock, (struct sockaddr *)&srcAddr, &len);
if (err < 0) {
- printf("getpeername failed: %s (%d)\n", strerror(errno), errno);
- return (-1);
+ printf("getpeername failed: %s (%d)\n", strerror(errno), errno);
+ return (-1);
}
PRINTVERBOSE3("Connected over sock: %d\n\tdst vproc_id: %d, dst addr: %d\n",
memset(&srcAddr, 0, sizeof(srcAddr));
srcAddr.family = AF_RPMSG;
/* We bind the remote proc ID, but local address! */
- srcAddr.vproc_id = (rprocId - 1);
+ srcAddr.vproc_id = _MultiProc_cfg.rprocList[rprocId];
srcAddr.addr = localAddr;
len = sizeof(struct sockaddr_rpmsg);
diff --git a/packages/ti/configs/vayu/Dsp2.cfg b/packages/ti/configs/vayu/Dsp2.cfg
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2012-2013, 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.
+ */
+
+/*
+ * The SysMin is used here instead of StdMin, as trace buffer address is
+ * required for Linux trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+/* Define default memory heap properties */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapSize = 0x20000;
+
+/* Modules used in the virtqueue/MessageQCopy/ServiceMgr libraries: */
+var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(0xa0000000, 0x02000000, Cache.Mar_DISABLE);
+var L1cache = new Cache.Size();
+L1cache.l1dSize = Cache.L1Size_0K;
+
+/* Reduces code size, by only pulling in modules explicitly referenced: */
+//BIOS.libType = BIOS.LibType_Custom;
+
+/* Use LibType_Debug option for now to avoid linking error due to bug in BIOS */
+BIOS.libType = BIOS.LibType_Debug;
+
+xdc.loadPackage('ti.sdo.ipc.family.vayu');
+xdc.useModule('ti.sdo.ipc.family.vayu.InterruptDsp');
+xdc.loadPackage('ti.ipc.rpmsg');
+xdc.loadPackage('ti.ipc.family.vayu');
+
+/* TBD: Not yet taken in from omapzoom:
+xdc.loadPackage('ti.srvmgr');
+xdc.useModule('ti.srvmgr.omx.OmxSrvMgr');
+xdc.loadPackage('ti.resmgr');
+*/
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = "EXT_CODE"
+
+/* Modules used in Power Management */
+xdc.loadPackage('ti.pm');
+/*
+var Power = xdc.useModule('ti.sysbios.family.c64p.tesla.Power');
+Power.loadSegment = "PM_DATA";
+*/
+
+/* Idle function that periodically flushes the unicache */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+//TBD: Idle.addFunc('&ti_deh_Deh_idleBegin'); /* Must be placed before pwr mgmt */
+//TBD: Idle.addFunc('&IpcPower_idle'); /* IpcPower_idle must be at the end */
+
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var List = xdc.useModule('ti.sdo.utils.List');
+
+/* ti.grcm Configuration */
+/* TBD:
+var rcmSettings = xdc.useModule('ti.grcm.Settings');
+rcmSettings.ipc = rcmSettings.IpcSupport_ti_sdo_ipc;
+xdc.useModule('ti.grcm.RcmServer');
+*/
+xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
+var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+var Assert = xdc.useModule('xdc.runtime.Assert');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+
+/* Enable Logger: */
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
+var Text = xdc.useModule('xdc.runtime.Text');
+Text.isLoaded = true;
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.ALWAYS_ON;
+Registry.common$.diags_INFO = Diags.ALWAYS_ON;
+Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
+Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
+Diags.setMaskEnabled = true;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+//TBD: var Deh = xdc.useModule('ti.deh.Deh');
+Hwi.enableException = true;
+
+/* -------------------------------- DSP ----------------------------------*/
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig("DSP2", ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);
+
+/* --------------------------- TICK --------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_NULL;
+//Clock.tickSource = Clock.TickSource_USER;
+/* Configure BIOS clock source as GPTimer5 */
+//Clock.timerId = 0;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+
+/* Skip the Timer frequency verification check. Need to remove this later */
+Timer.checkFrequency = false;
+
+/* Match this to the SYS_CLK frequency sourcing the dmTimers.
+ * Not needed once the SYS/BIOS family settings is updated. */
+Timer.intFreq.hi = 0;
+Timer.intFreq.lo = 19200000;
+
+//var timerParams = new Timer.Params();
+//timerParams.period = Clock.tickPeriod;
+//timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Switch off Software Reset to make the below settings effective */
+//timerParams.tiocpCfg.softreset = 0x0;
+/* Smart-idle wake-up-capable mode */
+//timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+//timerParams.twer.ovf_wup_ena = 0x1;
+//Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+/* Version module */
+/* ???
+xdc.useModule('ti.utils.Version');
+*/
index 3b0c0d1919f05e508088d20cb5e00825da04b180..95b77652f97f095f9846230b90f8e0a0abbe226e 100644 (file)
*/
var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
-/* dmTimer 0 mapped to GPT3 */
+/* dmTimer 0 mapped to GPT1 */
+dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
+/* dmTimer 1 mapped to GPT2 */
+dmTimer.timerSettings[1].baseAddr = 0x68032000;
+/* dmTimer 2 mapped to GPT3 */
dmTimer.timerSettings[2].baseAddr = 0x68034000;
-/* dmTimer 1 mapped to GPT4 */
+/* dmTimer 3 mapped to GPT4 */
dmTimer.timerSettings[3].baseAddr = 0x68036000;
-/* dmTimer 2 mapped to GPT9 */
+/* dmTimer 4 mapped to GPT5 */
+dmTimer.timerSettings[4].baseAddr = 0x68820000;
+/* dmTimer 5 mapped to GPT6 */
+dmTimer.timerSettings[5].baseAddr = 0x68822000;
+/* dmTimer 6 mapped to GPT7 */
+dmTimer.timerSettings[6].baseAddr = 0x68034000;
+/* dmTimer 7 mapped to GPT8 */
+dmTimer.timerSettings[7].baseAddr = 0x68036000;
+/* dmTimer 8 mapped to GPT9 */
dmTimer.timerSettings[8].baseAddr = 0x6803E000;
-/* dmTimer 3 mapped to GPT11 */
+/* dmTimer 9 mapped to GPT10 */
+dmTimer.timerSettings[9].baseAddr = 0x68086000;
+/* dmTimer 10 mapped to GPT11 */
dmTimer.timerSettings[10].baseAddr = 0x68088000;
+/* dmTimer 11 mapped to GPT12 */
+dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
+/* dmTimer 12 mapped to GPT13 */
+dmTimer.timerSettings[12].baseAddr = 0x68828000;
+/* dmTimer 13 mapped to GPT14 */
+dmTimer.timerSettings[13].baseAddr = 0x6882A000;
+/* dmTimer 14 mapped to GPT15 */
+dmTimer.timerSettings[14].baseAddr = 0x6882C000;
+/* dmTimer 15 mapped to GPT16 */
+dmTimer.timerSettings[15].baseAddr = 0x6882E000;
/* Skip the Timer frequency verification check. Need to remove this later */
dmTimer.checkFrequency = false;
diff --git a/packages/ti/configs/vayu/Ipu1Smp.cfg b/packages/ti/configs/vayu/Ipu1Smp.cfg
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012-2013, 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.
+ */
+
+/* Configure BIOS for SMP-mode */
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.smpEnabled = true;
+
+/* -------------------------------- CORE0 ----------------------------------*/
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig("IPU1", ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);
+
+/* We are IPU1 */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.ipuId = 1;
+
+/* ----------------------------- TICK ---------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+/* Configure GPTimer11 as BIOS clock source */
+Clock.timerId = 10;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Smart-idle wake-up-capable mode */
+timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+timerParams.twer.ovf_wup_ena = 0x1;
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* Modules used in Power Management */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.arm.ducati.smp.Power');
+Power.loadSegment = "PM_DATA";
+
+/* Idle functions - PM functions should be last */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+/* Function to flush unicache in each core */
+Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
+Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
+
+/* Watchdog detection functions in each core */
+/* TBD: DEH not taken from omapzoom yet:
+Idle.addCoreFunc('&ti_deh_Deh_idleBegin', 0);
+Idle.addCoreFunc('&ti_deh_Deh_idleBegin', 1);
+*/
+
+/* Idle Power Management functions for each core */
+Idle.addCoreFunc('&IpcPower_idle', 0);
+Idle.addCoreFunc('&IpcPower_idle', 1);
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
index 6feff19a58ba1b75fa233692ffd733ab00867a46..356ee9b3573073f8948b573cbc2c03eb4631342a 100644 (file)
--- a/packages/ti/ipc/GateMP.h
+++ b/packages/ti/ipc/GateMP.h
/*!
* @brief The resource is still in use
*/
-#define GateMP_S_BUSY 2
+#define GateMP_S_BUSY (2)
/*!
* @brief The module has been already setup
*/
-#define GateMP_S_ALREADYSETUP 1
+#define GateMP_S_ALREADYSETUP (1)
/*!
* @brief Operation is successful.
*/
-#define GateMP_S_SUCCESS 0
+#define GateMP_S_SUCCESS (0)
/*!
* @brief Generic failure.
*/
-#define GateMP_E_FAIL -1
+#define GateMP_E_FAIL (-1)
/*!
* @brief Argument passed to function is invalid.
*/
-#define GateMP_E_INVALIDARG -2
+#define GateMP_E_INVALIDARG (-2)
/*!
* @brief Operation resulted in memory failure.
*/
-#define GateMP_E_MEMORY -3
+#define GateMP_E_MEMORY (-3)
/*!
* @brief The specified entity already exists.
*/
-#define GateMP_E_ALREADYEXISTS -4
+#define GateMP_E_ALREADYEXISTS (-4)
/*!
* @brief Unable to find the specified entity.
*/
-#define GateMP_E_NOTFOUND -5
+#define GateMP_E_NOTFOUND (-5)
/*!
* @brief Operation timed out.
*/
-#define GateMP_E_TIMEOUT -6
+#define GateMP_E_TIMEOUT (-6)
/*!
* @brief Module is not initialized.
*/
-#define GateMP_E_INVALIDSTATE -7
+#define GateMP_E_INVALIDSTATE (-7)
/*!
* @brief A failure occurred in an OS-specific call */
-#define GateMP_E_OSFAILURE -8
+#define GateMP_E_OSFAILURE (-8)
/*!
* @brief Specified resource is not available */
-#define GateMP_E_RESOURCE -9
+#define GateMP_E_RESOURCE (-9)
/*!
* @brief Operation was interrupted. Please restart the operation */
-#define GateMP_E_RESTART -10
+#define GateMP_E_RESTART (-10)
/* =============================================================================
* Structures & Enums
diff --git a/packages/ti/ipc/Ipc.h b/packages/ti/ipc/Ipc.h
index 4d2aee88470ae4df4c9601bcaa7bc35729753daf..445a7476764a488418a56a30ee9990c2b211bb6e 100644 (file)
--- a/packages/ti/ipc/Ipc.h
+++ b/packages/ti/ipc/Ipc.h
/*!
* @brief The resource is still in use
*/
-#define Ipc_S_BUSY 2
+#define Ipc_S_BUSY (2)
/*!
* @brief The module has been already setup
*/
-#define Ipc_S_ALREADYSETUP 1
+#define Ipc_S_ALREADYSETUP (1)
/*!
* @brief Operation is successful.
*/
-#define Ipc_S_SUCCESS 0
+#define Ipc_S_SUCCESS (0)
/*!
* @brief Generic failure.
*/
-#define Ipc_E_FAIL -1
+#define Ipc_E_FAIL (-1)
/*!
* @brief Argument passed to function is invalid.
*/
-#define Ipc_E_INVALIDARG -2
+#define Ipc_E_INVALIDARG (-2)
/*!
* @brief Operation resulted in memory failure.
*/
-#define Ipc_E_MEMORY -3
+#define Ipc_E_MEMORY (-3)
/*!
* @brief The specified entity already exists.
*/
-#define Ipc_E_ALREADYEXISTS -4
+#define Ipc_E_ALREADYEXISTS (-4)
/*!
* @brief Unable to find the specified entity.
*/
-#define Ipc_E_NOTFOUND -5
+#define Ipc_E_NOTFOUND (-5)
/*!
* @brief Operation timed out.
*/
-#define Ipc_E_TIMEOUT -6
+#define Ipc_E_TIMEOUT (-6)
/*!
* @brief Module is not initialized or in an invalid state.
*/
-#define Ipc_E_INVALIDSTATE -7
+#define Ipc_E_INVALIDSTATE (-7)
/*!
* @brief A failure occurred in an OS-specific call
*/
-#define Ipc_E_OSFAILURE -8
+#define Ipc_E_OSFAILURE (-8)
/*!
* @brief Specified resource is not available
*/
-#define Ipc_E_RESOURCE -9
+#define Ipc_E_RESOURCE (-9)
/*!
* @brief Operation was interrupted. Please restart the operation
*/
-#define Ipc_E_RESTART -10
+#define Ipc_E_RESTART (-10)
/*!
* @brief Operation was not ready.
*/
-#define Ipc_E_NOTREADY -11
+#define Ipc_E_NOTREADY (-11)
/* =============================================================================
index 820713ca19d915848b5803cab03fbba9eb67fa9b..7a1becd16954a13b6e4cc144eb90773ac65e05dc 100644 (file)
/*!
* @brief The resource is still in use
*/
-#define MessageQ_S_BUSY 2
+#define MessageQ_S_BUSY (2)
/*!
* @brief The module has been already setup
*/
-#define MessageQ_S_ALREADYSETUP 1
+#define MessageQ_S_ALREADYSETUP (1)
/*!
* @brief Operation is successful.
*/
-#define MessageQ_S_SUCCESS 0
+#define MessageQ_S_SUCCESS (0)
/*!
* @brief Operation is not successful.
*/
-#define MessageQ_E_FAIL -1
+#define MessageQ_E_FAIL (-1)
/*!
* @brief There is an invalid argument.
*/
-#define MessageQ_E_INVALIDARG -2
+#define MessageQ_E_INVALIDARG (-2)
/*!
* @brief Operation resulted in memory failure.
*/
-#define MessageQ_E_MEMORY -3
+#define MessageQ_E_MEMORY (-3)
/*!
* @brief The specified entity already exists.
*/
-#define MessageQ_E_ALREADYEXISTS -4
+#define MessageQ_E_ALREADYEXISTS (-4)
/*!
* @brief Unable to find the specified entity.
*/
-#define MessageQ_E_NOTFOUND -5
+#define MessageQ_E_NOTFOUND (-5)
/*!
* @brief Operation timed out.
*/
-#define MessageQ_E_TIMEOUT -6
+#define MessageQ_E_TIMEOUT (-6)
/*!
* @brief Module is not initialized.
*/
-#define MessageQ_E_INVALIDSTATE -7
+#define MessageQ_E_INVALIDSTATE (-7)
/*!
* @brief A failure occurred in an OS-specific call
*/
-#define MessageQ_E_OSFAILURE -8
+#define MessageQ_E_OSFAILURE (-8)
/*!
* @brief Specified resource is not available
*/
-#define MessageQ_E_RESOURCE -9
+#define MessageQ_E_RESOURCE (-9)
/*!
* @brief Operation was interrupted. Please restart the operation
*/
-#define MessageQ_E_RESTART -10
+#define MessageQ_E_RESTART (-10)
/*!
* @brief An invalid message was encountered
*/
-#define MessageQ_E_INVALIDMSG -11
+#define MessageQ_E_INVALIDMSG (-11)
/*!
* @brief Not the owner
*/
-#define MessageQ_E_NOTOWNER -12
+#define MessageQ_E_NOTOWNER (-12)
/*!
* @brief Operation resulted in error
*/
-#define MessageQ_E_REMOTEACTIVE -13
+#define MessageQ_E_REMOTEACTIVE (-13)
/*!
* @brief An invalid heap id was encountered
*/
-#define MessageQ_E_INVALIDHEAPID -14
+#define MessageQ_E_INVALIDHEAPID (-14)
/*!
* @brief An invalid MultiProc id was encountered
*/
-#define MessageQ_E_INVALIDPROCID -15
+#define MessageQ_E_INVALIDPROCID (-15)
/*!
* @brief The max has been reached.
*/
-#define MessageQ_E_MAXREACHED -16
+#define MessageQ_E_MAXREACHED (-16)
/*!
* @brief Attempting to use an unregistered heap id.
*/
-#define MessageQ_E_UNREGISTEREDHEAPID -17
+#define MessageQ_E_UNREGISTEREDHEAPID (-17)
/*!
* @brief Trying to free a statically initialized message
*/
-#define MessageQ_E_CANNOTFREESTATICMSG -18
+#define MessageQ_E_CANNOTFREESTATICMSG (-18)
/*!
* @brief MessageQ was unblocked
*/
-#define MessageQ_E_UNBLOCKED -19
+#define MessageQ_E_UNBLOCKED (-19)
/* =============================================================================
* Macros
/*!
* @brief Used as the timeout value to specify wait forever
*/
-#define MessageQ_FOREVER ~(0)
+#define MessageQ_FOREVER (~(0))
/*!
* @brief Invalid message id
*/
-#define MessageQ_INVALIDMSGID 0xffff
+#define MessageQ_INVALIDMSGID (0xffff)
/*!
* @brief Invalid message queue
*/
-#define MessageQ_INVALIDMESSAGEQ 0xffff
+#define MessageQ_INVALIDMESSAGEQ (0xffff)
/*!
* @brief Mask to extract priority setting
*/
-#define MessageQ_PRIORITYMASK 0x3
+#define MessageQ_PRIORITYMASK (0x3)
/*!
* @brief Extract the destination queue ID from a message.
typedef struct MessageQ_Object *MessageQ_Handle;
/*!
- * @brief Structure defining parameters for the MessageQ module.
+ * @brief Structure defining parameters for MessageQ_create().
*/
typedef struct {
Void *synchronizer;
} MessageQ_Params;
+/*!
+ * @brief Structure defining parameters for MessageQ_create2().
+ *
+ * MessageQ_Params2 is a superset of MessageQ_Params. It is used
+ * with MessageQ_create2().
+ */
+typedef struct {
+ Void *synchronizer;
+ /*!< Synchronizer instance used to signal IO completion
+ *
+ * The synchronizer is used in MessageQ_put() and MessageQ_get().
+ * The synchronizer signal is called as part of MessageQ_put().
+ * The synchronizer waits in MessageQ_get() if there are no messages
+ * present.
+ */
+
+ MessageQ_QueueIndex queueIndex;
+ /*!< Value used to specify the index in the MessageQ array
+ *
+ * This parameter allows an application to specify a queueIndex to
+ * be used for a message queue. To use this functionality, the
+ * MessageQ.numReservedEntries static configuration parameter must be
+ * set to one more than the highest requested queueIndex. The
+ * MessageQ.numReservedEntries parameter reserves that number of
+ * message queue slots starting at 0 and proceeding to
+ * (MessageQ.numReservedEntries - 1).
+ *
+ * The default is MessageQ_ANY, which means it is not taken from the
+ * reserved slots.
+ */
+
+} MessageQ_Params2;
+
/*!
* @brief Required first field in every message
*/
typedef enum {
MessageQ_NORMALPRI = 0, /*!< Normal Priority */
MessageQ_HIGHPRI = 1, /*!< High Priority */
- MessageQ_RESERVEDPRI = 2, /*!< Reserved Priority */
+ MessageQ_RESERVEDPRI = 2, /*!< Reserved Priority */
MessageQ_URGENTPRI = 3 /*!< Urgent Priority */
} MessageQ_Priority;
+/*!
+ * @brief Denotes any queueId is acceptable.
+ *
+ * This constant is the default for the queueId in the MessageQ_Params2
+ * structure.
+ */
+#define MessageQ_ANY (Bits16)~(0)
+
+/*!
+ * @brief Free hook prototype
+ *
+ * @param[in] heapId heapId of message that was freed
+ * @param[in] msgId msgId of message that was freed
+ */
+typedef Void (*MessageQ_FreeHookFxn)(Bits16 heapId, Bits16 msgId);
/* =============================================================================
* MessageQ Module-wide Functions
*/
Void MessageQ_Params_init(MessageQ_Params *params);
+/*!
+ * @brief Initialize MessageQ_Params2
+ *
+ * @param[in] params Parameters required to create a MessageQ
+ */
+Void MessageQ_Params2_init(MessageQ_Params2 *params);
+
/*!
* @brief Create a MessageQ instance
*
* The name supplied here does not have to be in persistent memory. The
- * maximum length of the string supplied here, including the '\\0' terminator
+ * maximum length of the string supplied here, including the '\\0' terminator,
* is '32' by default.
*
* There are no verifications to ensure that the name supplied in
*/
MessageQ_Handle MessageQ_create(String name, const MessageQ_Params *params);
+/*!
+ * @brief Create a MessageQ instance with the MessageQ_Params2 structure
+ *
+ * The name supplied here does not have to be in persistent memory. The
+ * maximum length of the string supplied here, including the '\\0' terminator,
+ * is '32' by default.
+ *
+ * There are no verifications to ensure that the name supplied in
+ * MessageQ_create2() is unique across all processors. Caution must be exercised
+ * to ensure that each processor uses a unique name.
+ *
+ * @param[in] name Name of the queue
+ * @param[in] params Initialized MessageQ_Params2
+ *
+ * @return MessageQ Handle
+ */
+MessageQ_Handle MessageQ_create2(String name, const MessageQ_Params2 *params);
+
/*!
* @brief Delete a created MessageQ instance
*
*/
Int MessageQ_open(String name, MessageQ_QueueId *queueId);
+/*!
+ * @brief Opens a MessageQ given the queue index and remote processor id
+ *
+ * This function can be used instead of MessageQ_open() if the queue was created
+ * with a specified QueueIndex.
+ *
+ * @code
+ * #define SERVERQUEUEINDEX 1
+ * #define SERVERMULTIPROCID 2
+ *
+ * serverFxn() {
+ * MessageQ_Params2 params2;
+ *
+ * MessageQ_Params2_init(¶ms2);
+ * params2.queueIndex = SERVERQUEUEINDEX;
+ * messageQ = MessageQ_create2("server", ¶ms2);
+ * ...
+ *
+ * clientFxn() {
+ * MessageQ_QueueId serverQueue;
+ * serverQueue = MessageQ_openQueueId(SERVERQUEUEINDEX, SERVERMULTIPROCID);
+ * @endcode
+ *
+ * It is up to the application to guarantee that the queue that is being opened
+ * has already been created. MessageQ_openQueueId() does not validate that
+ * the queue has been created (unlike the MessageQ_open() function).
+ *
+ * @param[in] queueIndex QueueIndex specified in MessageQ_Params2
+ * @param[in] remoteProcId Multiproc_Id of where the created queue resides
+ *
+ * @return The MessageQ_QueueId associated with the queueIndex
+ * and remoteProcId
+ */
+MessageQ_QueueId MessageQ_openQueueId(UInt16 queueIndex, UInt16 remoteProcId);
+
/*!
* @brief Close the opened handle
*
*/
Void MessageQ_staticMsgInit(MessageQ_Msg msg, UInt32 size);
+/*!
+ * @brief Sets MessageQ's free hook function.
+ *
+ * This API allows a user to specify a hook function which is called within
+ * MessageQ_free(). The hook is called after a message is freed back to the
+ * associated heap. The two parameters to the hook function are the heapId
+ * and the msgId of the freed message.
+ *
+ * The function is called within MessageQ_free(), so care must be taken to
+ * minimize any performance or calling context impact.
+ *
+ * MessageQ_setFreeHookFxn() is not thread safe. It should only
+ * be called when no MessageQ_free()'s are happening.
+ *
+ * To disable the hook function, call MessageQ_setFreeHookFxn() with NULL.
+ *
+ * @param[in] freeHookFxn function to be called within MessageQ_free()
+ */
+Void MessageQ_setFreeHookFxn(MessageQ_FreeHookFxn freeHookFxn);
+
/* =============================================================================
* MessageQ Per-instance Functions
* =============================================================================
index cda9a74182234c7d971f775304f78a52b6aed134..3b2d2425203f070ade2729383a072ec11f0b4eb3 100644 (file)
/*!
* @brief The resource is still in use
*/
-#define MultiProc_S_BUSY 2
+#define MultiProc_S_BUSY (2)
/*!
* @brief The module has been already setup
*/
-#define MultiProc_S_ALREADYSETUP 1
+#define MultiProc_S_ALREADYSETUP (1)
/*!
* @brief Operation is successful.
*/
-#define MultiProc_S_SUCCESS 0
+#define MultiProc_S_SUCCESS (0)
/*!
* @brief Generic failure.
*/
-#define MultiProc_E_FAIL -1
+#define MultiProc_E_FAIL (-1)
/*!
* @brief Argument passed to function is invalid.
*/
-#define MultiProc_E_INVALIDARG -2
+#define MultiProc_E_INVALIDARG (-2)
/*!
* @brief Operation resulted in memory failure.
*/
-#define MultiProc_E_MEMORY -3
+#define MultiProc_E_MEMORY (-3)
/*!
* @brief The specified entity already exists.
*/
-#define MultiProc_E_ALREADYEXISTS -4
+#define MultiProc_E_ALREADYEXISTS (-4)
/*!
* @brief Unable to find the specified entity.
*/
-#define MultiProc_E_NOTFOUND -5
+#define MultiProc_E_NOTFOUND (-5)
/*!
* @brief Operation timed out.
*/
-#define MultiProc_E_TIMEOUT -6
+#define MultiProc_E_TIMEOUT (-6)
/*!
* @brief Module is not initialized.
*/
-#define MultiProc_E_INVALIDSTATE -7
+#define MultiProc_E_INVALIDSTATE (-7)
/*!
* @brief A failure occurred in an OS-specific call
*/
-#define MultiProc_E_OSFAILURE -8
+#define MultiProc_E_OSFAILURE (-8)
/*!
* @brief Specified resource is not available
*/
-#define MultiProc_E_RESOURCE -9
+#define MultiProc_E_RESOURCE (-9)
/*!
* @brief Operation was interrupted. Please restart the operation
*/
-#define MultiProc_E_RESTART -10
+#define MultiProc_E_RESTART (-10)
/* =============================================================================
* Macros
index 7e8666c93a12ce3f14ade9825f11c83cc8bf7605..b77929e6d99a19c40794a9701844314b6f6ab1b6 100644 (file)
/*!
* @brief The resource is still in use
*/
-#define NameServer_S_BUSY 2
+#define NameServer_S_BUSY (2)
/*!
* @brief The module has been already setup
*/
-#define NameServer_S_ALREADYSETUP 1
+#define NameServer_S_ALREADYSETUP (1)
/*!
* @brief Operation is successful.
*/
-#define NameServer_S_SUCCESS 0
+#define NameServer_S_SUCCESS (0)
/*!
* @brief Generic failure.
*/
-#define NameServer_E_FAIL -1
+#define NameServer_E_FAIL (-1)
/*!
* @brief Argument passed to function is invalid.
*/
-#define NameServer_E_INVALIDARG -2
+#define NameServer_E_INVALIDARG (-2)
/*!
* @brief Operation resulted in memory failure.
*/
-#define NameServer_E_MEMORY -3
+#define NameServer_E_MEMORY (-3)
/*!
* @brief The specified entity already exists.
*/
-#define NameServer_E_ALREADYEXISTS -4
+#define NameServer_E_ALREADYEXISTS (-4)
/*!
* @brief Unable to find the specified entity.
*/
-#define NameServer_E_NOTFOUND -5
+#define NameServer_E_NOTFOUND (-5)
/*!
* @brief Operation timed out.
*/
-#define NameServer_E_TIMEOUT -6
+#define NameServer_E_TIMEOUT (-6)
/*!
* @brief Module is not initialized.
*/
-#define NameServer_E_INVALIDSTATE -7
+#define NameServer_E_INVALIDSTATE (-7)
/*!
* @brief A failure occurred in an OS-specific call
*/
-#define NameServer_E_OSFAILURE -8
+#define NameServer_E_OSFAILURE (-8)
/*!
* @brief Specified resource is not available
*/
-#define NameServer_E_RESOURCE -9
+#define NameServer_E_RESOURCE (-9)
/*!
* @brief Operation was interrupted. Please restart the operation
*/
-#define NameServer_E_RESTART -10
+#define NameServer_E_RESTART (-10)
/* =============================================================================
* Macros
/*!
* @brief The default maximum length of the name for the name/value pair
*/
-#define NameServer_Params_MAXNAMELEN 16
+#define NameServer_Params_MAXNAMELEN (16)
/* =============================================================================
* Structures & Enums
/*!
* @brief Creates a NameServer instance
*
+ * If NameServer_create() was previously called to create an instance with the
+ * same name, subsequent calls to NameServer_create() on the same name will
+ * simply return a valid handle to the existing NameServer instance, similar
+ * to what is done by NameServer_getHandle().
+ *
* @param name Instance name
* @param params Instance param structure
*
* If the instance is not empty, the contents is freed back to the
* heap it was allocated from.
*
+ * If NameServer_create() was called multiple times on the same name,
+ * a matching number of calls to NameServer_delete() is necessary in
+ * order to fully deallocate the instance.
+ *
* @param handlePtr Pointer to a NameServer handle
*
* @return Status
index e629aa275e7711270911baa91445ed89480e43fe..dca17a3e8acc7f53f650bd93883280a2c95cf67e 100644 (file)
--- a/packages/ti/ipc/Notify.h
+++ b/packages/ti/ipc/Notify.h
/*!
* @brief The resource is still in use
*/
-#define Notify_S_BUSY 2
+#define Notify_S_BUSY (2)
/*!
* @brief Module already set up
*/
-#define Notify_S_ALREADYSETUP 1
+#define Notify_S_ALREADYSETUP (1)
/*!
* @brief Operation is successful.
*/
-#define Notify_S_SUCCESS 0
+#define Notify_S_SUCCESS (0)
/*!
* @brief Generic failure.
*/
-#define Notify_E_FAIL -1
+#define Notify_E_FAIL (-1)
/*!
* @brief Argument passed to function is invalid.
*/
-#define Notify_E_INVALIDARG -2
+#define Notify_E_INVALIDARG (-2)
/*!
* @brief Operation resulted in memory failure.
*/
-#define Notify_E_MEMORY -3
+#define Notify_E_MEMORY (-3)
/*!
* @brief The specified entity already exists.
*/
-#define Notify_E_ALREADYEXISTS -4
+#define Notify_E_ALREADYEXISTS (-4)
/*!
* @brief Unable to find the specified entity.
*/
-#define Notify_E_NOTFOUND -5
+#define Notify_E_NOTFOUND (-5)
/*!
* @brief Operation timed out.
*/
-#define Notify_E_TIMEOUT -6
+#define Notify_E_TIMEOUT (-6)
/*!
* @brief Module is not initialized.
*/
-#define Notify_E_INVALIDSTATE -7
+#define Notify_E_INVALIDSTATE (-7)
/*!
* @brief A failure occurred in an OS-specific call
*/
-#define Notify_E_OSFAILURE -8
+#define Notify_E_OSFAILURE (-8)
/*!
* @brief The module has been already setup
*/
-#define Notify_E_ALREADYSETUP -9
+#define Notify_E_ALREADYSETUP (-9)
/*!
* @brief Specified resource is not available
*/
-#define Notify_E_RESOURCE -10
+#define Notify_E_RESOURCE (-10)
/*!
* @brief Operation was interrupted. Please restart the operation
*/
-#define Notify_E_RESTART -11
+#define Notify_E_RESTART (-11)
/*!
* @brief The resource is still in use
*/
-#define Notify_E_BUSY -12
+#define Notify_E_BUSY (-12)
/*!
* @brief Driver corresponding to the specified eventId is not registered
*/
-#define Notify_E_DRIVERNOTREGISTERED -13
+#define Notify_E_DRIVERNOTREGISTERED (-13)
/*!
* @brief Event not registered
*/
-#define Notify_E_EVTNOTREGISTERED -14
+#define Notify_E_EVTNOTREGISTERED (-14)
/*!
* @brief Event is disabled
*/
-#define Notify_E_EVTDISABLED -15
+#define Notify_E_EVTDISABLED (-15)
/*!
* @brief Remote notification is not initialized
*/
-#define Notify_E_NOTINITIALIZED -16
+#define Notify_E_NOTINITIALIZED (-16)
/*!
* @brief Trying to illegally use a reserved event
*/
-#define Notify_E_EVTRESERVED -17
+#define Notify_E_EVTRESERVED (-17)
/* =============================================================================
* Macros
diff --git a/packages/ti/ipc/family/omap54xx/InterruptIpu.h b/packages/ti/ipc/family/omap54xx/InterruptIpu.h
index cfd56de8c3790bdff53c7ceb2ef7414b2b3a1e08..2327ead185aab085421745776ac412df5cd3de75 100644 (file)
*/
/*
* ======== InterruptIpu.h ========
- * OMAP4430/Ducati Interrupt Manger
+ * OMAP54xx IPU Interrupt Manger
*/
+#ifndef ti_ipc_family_omap54xx_InterruptIpu__include
+#define ti_ipc_family_omap54xx_InterruptIpu__include
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
#include <ti/sysbios/hal/Hwi.h>
#define INVALIDPAYLOAD (0xFFFFFFFF)
* Clear interrupt
*/
UInt InterruptIpu_intClear();
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* ti_ipc_family_omap54xx_InterruptIpu__include */
diff --git a/packages/ti/ipc/family/omap54xx/VirtQueue.c b/packages/ti/ipc/family/omap54xx/VirtQueue.c
index 6c2220427e66e40e3071d8ec476f7218bda28688..0c9a25043aab0dc203f6b0efb904bf0360ba0a13 100644 (file)
*
*/
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC ti_ipc_family_vayu__Desc
+#define MODULE_NAME "ti.ipc.family.omap54xx.VirtQueue"
+
#include <xdc/std.h>
#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Registry.h>
#include <xdc/runtime/Log.h>
#include <xdc/runtime/Diags.h>
#include <ti/pm/IpcPower.h>
#include <string.h>
+#include <ti/ipc/remoteproc/Resource.h>
+#include <ti/ipc/remoteproc/rsc_types.h>
#include <ti/ipc/rpmsg/_VirtQueue.h>
#include "InterruptProxy.h"
#include "VirtQueue.h"
+/*
+ * The following three VIRTIO_* defines must match those in
+ * <Linux_kernel>/include/uapi/linux/virtio_config.h
+ */
+#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
+#define VIRTIO_CONFIG_S_DRIVER 2
+#define VIRTIO_CONFIG_S_DRIVER_OK 4
+
+#define VRING_BUFS_PRIMED (VIRTIO_CONFIG_S_ACKNOWLEDGE | \
+ VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK)
+
/* Used for defining the size of the virtqueue registry */
#define NUM_QUEUES 4
GateHwi_Handle gateH;
} VirtQueue_Object;
+/* module diags mask */
+Registry_Desc Registry_CURDESC;
+
static struct VirtQueue_Object *queueRegistry[NUM_QUEUES] = {NULL};
static UInt16 hostProcId;
extern Int OffloadM3_processSysM3Tasks(UArg msg);
#endif
+/*!
+ * ======== _VirtQueue_init ========
+ *
+ * This function adds the VirtQueue "module" to the Registry so that
+ * DIAGS will work with this non-XDC module.
+ * Since VirtQueue_init is not called by XDC-VirtQueue module clients, this
+ * function is called in the first VirtQueue fxn called: VirtQueue_create.
+ */
+static Void _VirtQueue_init()
+{
+ static int initialized = 0;
+
+ if (!initialized) {
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ initialized = 1;
+ }
+}
+
static inline Void * mapPAtoVA(UInt pa)
{
return (Void *)((pa & 0x000fffffU) | IPC_MEM_VRING0);
(IArg)vq, vq->last_avail_idx, vq->vring.avail->idx, vq->vring.num,
(IArg)&vq->vring.avail, (IArg)vq->vring.avail);
+ /* Clear flag here to avoid race condition with remote processor.
+ * This is a negative flag, clearing it means that we want to
+ * receive an interrupt when a buffer has been added to the pool.
+ */
+ vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
+
/* There's nothing available? */
if (vq->last_avail_idx == vq->vring.avail->idx) {
- /* We need to know about added buffers */
- vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
head = (-1);
}
else {
+ /* No need to be kicked about added buffers anymore */
+ vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
+
/*
* Grab the next descriptor number they're advertising, and increment
* the index we've seen.
@@ -489,6 +541,9 @@ VirtQueue_Handle VirtQueue_create(UInt16 remoteProcId, VirtQueue_Params *params,
VirtQueue_Object *vq;
Void *vringAddr;
+ /* Perform initialization we can't do in Instance_init (being non-XDC): */
+ _VirtQueue_init();
+
vq = Memory_alloc(NULL, sizeof(VirtQueue_Object), 0, eb);
if (NULL == vq) {
return (NULL);
}
#endif
+ /*
+ * Wait for HLOS (Virtio device) to indicate that priming of host's receive
+ * buffers is complete, indicating that host is ready to send.
+ *
+ * Though this is a Linux Virtio configuration status, it must be
+ * implemented by each non-Linux HLOS as well.
+ */
+ Log_print1(Diags_USER1, "VirtQueue_startup: VDEV status: 0x%x\n",
+ Resource_getVdevStatus(VIRTIO_ID_RPMSG));
+ Log_print0(Diags_USER1, "VirtQueue_startup: Polling VDEV status...\n");
+ while (Resource_getVdevStatus(VIRTIO_ID_RPMSG) != VRING_BUFS_PRIMED);
+ Log_print1(Diags_USER1, "VirtQueue_startup: VDEV status: 0x%x\n",
+ Resource_getVdevStatus(VIRTIO_ID_RPMSG));
+
InterruptProxy_intRegister(VirtQueue_isr);
+ Log_print0(Diags_USER1, "Passed VirtQueue_startup\n");
}
/*!
diff --git a/packages/ti/ipc/family/omapl138/VirtQueue.c b/packages/ti/ipc/family/omapl138/VirtQueue.c
index e5637bb1320f66948992bc9090f01a12ba922dc7..1e75db236d8ad469c69f10f71423aaeae6daedd6 100644 (file)
vq->last_avail_idx, vring->avail->idx, vring->num,
(IArg)&vring->avail, (IArg)vring->avail);
+ /* Clear flag here to avoid race condition with remote processor.
+ * This is a negative flag, clearing it means that we want to
+ * receive an interrupt when a buffer has been added to the pool.
+ */
+ vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
+
/* There's nothing available? */
if (vq->last_avail_idx == vring->avail->idx) {
- /* We need to know about added buffers */
- vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
head = (-1);
}
else {
diff --git a/packages/ti/ipc/family/tci6614/VirtQueue.c b/packages/ti/ipc/family/tci6614/VirtQueue.c
index e88c245035c1c5bba6f8797b8dd1d142e8338be5..ccd89e1a96c100c9b7db66a74c6248adf2539525 100644 (file)
vq->last_avail_idx, vring->avail->idx, vring->num,
(IArg)&vring->avail, (IArg)vring->avail);
+ /* Clear flag here to avoid race condition with remote processor.
+ * This is a negative flag, clearing it means that we want to
+ * receive an interrupt when a buffer has been added to the pool.
+ */
+ vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
+
/* There's nothing available? */
if (vq->last_avail_idx == vring->avail->idx) {
- /* We need to know about added buffers */
- vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
head = (-1);
}
else {
diff --git a/packages/ti/ipc/family/tci6638/VirtQueue.c b/packages/ti/ipc/family/tci6638/VirtQueue.c
index 6d7de0d31827682422f885f7e7019d0325e438a5..ab8d90062729501c5a568cb2727f28261ab0a57d 100644 (file)
vq->last_avail_idx, vring->avail->idx, vring->num,
(IArg)&vring->avail, (IArg)vring->avail);
+ /* Clear flag here to avoid race condition with remote processor.
+ * This is a negative flag, clearing it means that we want to
+ * receive an interrupt when a buffer has been added to the pool.
+ */
+ vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
+
/* There's nothing available? */
if (vq->last_avail_idx == vring->avail->idx) {
- /* We need to know about added buffers */
- vring->used->flags &= ~VRING_USED_F_NO_NOTIFY;
head = (-1);
}
else {
diff --git a/packages/ti/ipc/family/vayu/InterruptProxy.h b/packages/ti/ipc/family/vayu/InterruptProxy.h
index 21dff80431836dd7538beb965a9fd201f25c7451..e32bdbd185fd0b5fe782dd189d2d57c48532d527 100644 (file)
* Proxy Interrupt Manager
*/
-#ifndef ti_ipc_rpmsg_InterruptProxy__include
-#define ti_ipc_rpmsg_InterruptProxy__include
+#ifndef ti_ipc_family_vayu_InterruptProxy__include
+#define ti_ipc_family_vayu_InterruptProxy__include
#if defined(__cplusplus)
extern "C" {
}
#endif /* defined (__cplusplus) */
-#endif /* ti_ipc_rpmsg_InterruptProxy__include */
+#endif /* ti_ipc_family_vayu_InterruptProxy__include */
index 781179773b06fa92ed94ae37848e34c1f17e527d..4ca8f1db5fb509ece75d2775b567f6da05cb13fe 100644 (file)
*
*/
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC ti_ipc_family_vayu__Desc
+#define MODULE_NAME "ti.ipc.family.vayu.VirtQueue"
+
#include <xdc/std.h>
#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Registry.h>
#include <xdc/runtime/Log.h>
#include <xdc/runtime/Diags.h>
#endif
#include <string.h>
+#include <ti/ipc/remoteproc/Resource.h>
+#include <ti/ipc/remoteproc/rsc_types.h>
#include <ti/ipc/rpmsg/_VirtQueue.h>
#include <ti/sdo/ipc/notifyDrivers/IInterrupt.h>
GateHwi_Handle gateH;
} VirtQueue_Object;
+/* module diags mask */
+Registry_Desc Registry_CURDESC;
+
static struct VirtQueue_Object *queueRegistry[NUM_QUEUES] = {NULL};
static UInt16 hostProcId;
extern Int OffloadM3_processSysM3Tasks(UArg msg);
#endif
+/*!
+ * ======== _VirtQueue_init ========
+ *
+ * This function adds the VirtQueue "module" to the Registry so that
+ * DIAGS will work with this non-XDC module.
+ * Since VirtQueue_init is not called by XDC-VirtQueue module clients, this
+ * function is called in the first VirtQueue fxn called: VirtQueue_create.
+ */
+static Void _VirtQueue_init()
+{
+ static int initialized = 0;
+
+ if (!initialized) {
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ initialized = 1;
+ }
+}
+
static inline Void * mapPAtoVA(UInt pa)
{
return (Void *)((pa & 0x000fffffU) | IPC_MEM_VRING0);
(IArg)vq, vq->last_avail_idx, vq->vring.avail->idx, vq->vring.num,
(IArg)&vq->vring.avail, (IArg)vq->vring.avail);
+ /* Clear flag here to avoid race condition with remote processor.
+ * This is a negative flag, clearing it means that we want to
+ * receive an interrupt when a buffer has been added to the pool.
+ */
+ vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
+
/* There's nothing available? */
if (vq->last_avail_idx == vq->vring.avail->idx) {
- /* We need to know about added buffers */
- vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
head = (-1);
}
else {
+ /* No need to be kicked about added buffers anymore */
+ vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
+
/*
* Grab the next descriptor number they're advertising, and increment
* the index we've seen.
@@ -498,6 +539,9 @@ VirtQueue_Handle VirtQueue_create(UInt16 remoteProcId, VirtQueue_Params *params,
VirtQueue_Object *vq;
Void *vringAddr;
+ /* Perform initialization we can't do in Instance_init (being non-XDC): */
+ _VirtQueue_init();
+
vq = Memory_alloc(NULL, sizeof(VirtQueue_Object), 0, eb);
if (NULL == vq) {
return (NULL);
@@ -571,6 +615,17 @@ VirtQueue_Handle VirtQueue_create(UInt16 remoteProcId, VirtQueue_Params *params,
return (vq);
}
+/*
+ * The following three VIRTIO_* defines must match those in
+ * <Linux_kernel>/include/uapi/linux/virtio_config.h
+ */
+#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
+#define VIRTIO_CONFIG_S_DRIVER 2
+#define VIRTIO_CONFIG_S_DRIVER_OK 4
+
+#define VRING_BUFS_PRIMED (VIRTIO_CONFIG_S_ACKNOWLEDGE | \
+ VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK)
+
/*!
* ======== VirtQueue_startup ========
*/
IpcPower_init();
#endif
+ /*
+ * Wait for HLOS (Virtio device) to indicate that priming of host's receive
+ * buffers is complete, indicating that host is ready to send.
+ *
+ * Though this is a Linux Virtio configuration status, it must be
+ * implemented by each non-Linux HLOS as well.
+ */
+ Log_print1(Diags_USER1, "VirtQueue_startup: VDEV status: 0x%x\n",
+ Resource_getVdevStatus(VIRTIO_ID_RPMSG));
+ Log_print0(Diags_USER1, "VirtQueue_startup: Polling VDEV status...\n");
+ while (Resource_getVdevStatus(VIRTIO_ID_RPMSG) != VRING_BUFS_PRIMED);
+ Log_print1(Diags_USER1, "VirtQueue_startup: VDEV status: 0x%x\n",
+ Resource_getVdevStatus(VIRTIO_ID_RPMSG));
+
InterruptProxy_intRegister(hostProcId, &intInfo, (Fxn)VirtQueue_isr, NULL);
+ Log_print0(Diags_USER1, "Passed VirtQueue_startup\n");
}
/*!
index 2442218fcba484dba20f42dc29835dae8f1f3418..d33a13b84b6eb6cfc299b93d0435297b5b9ff3b8 100644 (file)
#include <ti/ipc/rpmsg_rpc.h>
+#elif defined(IPC_BUILDOS_ANDROID)
+#include <linux/rpmsg_rpc.h>
+
#else
#error Unsupported Operating System
#endif
#include "MmRpc.h"
+#if defined(KERNEL_INSTALL_DIR) || defined(IPC_BUILDOS_ANDROID)
+static int MmRpc_bufHandle(MmRpc_Handle handle, int cmd, int num,
+ MmRpc_BufDesc *desc);
+#endif
+
/*
* ======== MmRpc_Object ========
int len;
int i;
- /* Combine function parameters and translation array into one contiguous
- * message. TODO, modify driver to accept two separate buffers in order
- * to eliminate this step. */
+ /* combine params and translation array into one contiguous message */
len = sizeof(struct rppc_function) +
(ctx->num_xlts * sizeof(struct rppc_param_translation));
msg = (void *)calloc(len, sizeof(char));
rpfxn->params[i].size = param->param.scalar.size;
rpfxn->params[i].data = param->param.scalar.data;
rpfxn->params[i].base = 0;
- rpfxn->params[i].reserved = 0;
+ rpfxn->params[i].fd = 0;
break;
case MmRpc_ParamType_Ptr:
rpfxn->params[i].size = param->param.ptr.size;
rpfxn->params[i].data = param->param.ptr.addr;
rpfxn->params[i].base = param->param.ptr.addr;
- rpfxn->params[i].reserved = param->param.ptr.handle;
+ rpfxn->params[i].fd = (size_t)param->param.ptr.handle;
break;
-#if 0 /* TBD */
- case MmRpc_ParamType_Elem:
+ case MmRpc_ParamType_OffPtr:
rpfxn->params[i].type = RPPC_PARAM_TYPE_PTR;
- rpfxn->params[i].size = param->param.elem.size;
- rpfxn->params[i].data = param->param.elem.offset;
- rpfxn->params[i].base = param->param.elem.base;
- rpfxn->params[i].reserved = param->param.elem.handle;
+ rpfxn->params[i].size = param->param.offPtr.size;
+ rpfxn->params[i].data = param->param.offPtr.base +
+ param->param.offPtr.offset;
+ rpfxn->params[i].base = param->param.offPtr.base;
+ rpfxn->params[i].fd = (size_t)param->param.offPtr.handle;
break;
-#endif
+
default:
printf("MmRpc_call: Error: invalid parameter type\n");
status = MmRpc_E_INVALIDPARAM;
rpfxn->num_translations = ctx->num_xlts;
for (i = 0; i < ctx->num_xlts; i++) {
- uint32_t index;
- size_t ptr;
-
- /* compute base value */
- index = ctx->xltAry[i].index;
- ptr = rpfxn->params[index].base + ctx->xltAry[i].offset;
-
/* pack the pointer translation entry */
- rpfxn->translations[i].index = index;
- rpfxn->translations[i].offset = ctx->xltAry[i].offset;
- rpfxn->translations[i].base = (size_t)(*(void **)ptr);
- rpfxn->translations[i].reserved = ctx->xltAry[i].handle;
+ rpfxn->translations[i].index = ctx->xltAry[i].index;
+ rpfxn->translations[i].offset = ctx->xltAry[i].offset;
+ rpfxn->translations[i].base = ctx->xltAry[i].base;
+ rpfxn->translations[i].fd = (int32_t)ctx->xltAry[i].handle;
}
/* send message for remote execution */
return(status);
}
+
+/*
+ * ======== MmRcp_release ========
+ */
+int MmRpc_release(MmRpc_Handle handle, MmRpc_BufType type, int num,
+ MmRpc_BufDesc *desc)
+{
+ int stat = MmRpc_S_SUCCESS;
+
+ switch (type) {
+
+#if defined(KERNEL_INSTALL_DIR) || defined(IPC_BUILDOS_ANDROID)
+ case MmRpc_BufType_Handle:
+ stat = MmRpc_bufHandle(handle, RPPC_IOC_BUFUNREGISTER, num, desc);
+ break;
+
+#elif defined(SYSLINK_BUILDOS_QNX)
+ case MmRpc_BufType_Ptr:
+ break;
+#endif
+ default:
+ printf("MmRpc_release: Error: unsupported type value: %d\n", type);
+ stat = MmRpc_E_INVALIDPARAM;
+ break;
+ }
+
+ if (stat < 0) {
+ printf("MmRpc_release: Error: unable to release buffer\n");
+ }
+
+ return(stat);
+}
+
+/*
+ * ======== MmRcp_use ========
+ */
+int MmRpc_use(MmRpc_Handle handle, MmRpc_BufType type, int num,
+ MmRpc_BufDesc *desc)
+{
+ int stat = MmRpc_S_SUCCESS;
+
+ switch (type) {
+
+#if defined(KERNEL_INSTALL_DIR) || defined(IPC_BUILDOS_ANDROID)
+ case MmRpc_BufType_Handle:
+ stat = MmRpc_bufHandle(handle, RPPC_IOC_BUFREGISTER, num, desc);
+ break;
+
+#elif defined(SYSLINK_BUILDOS_QNX)
+ case MmRpc_BufType_Ptr:
+ break;
+#endif
+ default:
+ printf("MmRpc_use: Error: unsupported type value: %d\n", type);
+ stat = MmRpc_E_INVALIDPARAM;
+ break;
+ }
+
+ if (stat < 0) {
+ printf("MmRpc_use: Error: unable to declare buffer use\n");
+ }
+
+ return(stat);
+}
+
+#if defined(KERNEL_INSTALL_DIR) || defined(IPC_BUILDOS_ANDROID)
+/*
+ * ======== MmRpc_bufHandle ========
+ */
+int MmRpc_bufHandle(MmRpc_Handle handle, int cmd, int num, MmRpc_BufDesc *desc)
+{
+ int stat = MmRpc_S_SUCCESS;
+ MmRpc_Object *obj = (MmRpc_Object *)handle;
+ int i;
+ struct rppc_buf_fds reg = { num, NULL };
+
+ reg.fds = (int32_t *)malloc(num * sizeof(int32_t));
+
+ if (reg.fds == NULL) {
+ stat = MmRpc_E_NOMEM;
+ goto leave;
+ }
+
+ for (i = 0; i < num; i++) {
+ reg.fds[i] = desc[i].handle;
+ }
+
+ stat = ioctl(obj->fd, cmd, ®);
+
+ if (stat < 0) {
+ stat = MmRpc_E_SYS;
+ }
+
+leave:
+ if (reg.fds != NULL) {
+ free(reg.fds);
+ }
+
+ return(stat);
+}
+#endif
index 013cad56320332cc5a65ce4d38177a9deecd77c2..14b36a6cd172916a848fc61ee1cae5da1dd0ddc9 100644 (file)
*/
#define MmRpc_E_INVALIDPARAM (-2)
+/*!
+ * @brief Memory allocation failed
+ */
+#define MmRpc_E_NOMEM (-3)
+
+/*!
+ * @brief A system call failed
+ */
+#define MmRpc_E_SYS (-4)
+
/*!
* @brief Size of parameter array in function context structure
*/
typedef enum {
MmRpc_ParamType_Scalar = 1, /*!< pass by value */
MmRpc_ParamType_Ptr, /*!< data pointer */
+ MmRpc_ParamType_OffPtr, /*!< buffer at offset in memory block */
MmRpc_ParamType_Elem /*!< array element */
} MmRpc_ParamType;
size_t handle; /*!< memory allocator handle */
} ptr;
-#if 0 /* TBD */
struct {
- size_t size; /*!< size of the array element */
- size_t offset; /*!< offset to current array element */
- size_t base; /*!< base address of array */
+ size_t size; /*!< size (bytes) of param structure */
+ size_t base; /*!< param address */
+ size_t offset; /*!< offset within param */
size_t handle; /*!< memory allocator handle */
- } elem;
-#endif
+ } offPtr;
+
} param;
} MmRpc_Param;
typedef struct {
uint32_t index; /*!< parameter index to base pointer */
- ptrdiff_t offset; /*!< offset from the base address to pointer */
+ ptrdiff_t offset; /*!< offset to embedded pointer
+ *
+ * If param type is MmRpc_ParamType_Ptr, offset
+ * to embedded pointer from addr. If param type
+ * is MmRpc_ParamType_OffPtr, offset to embedded
+ * pointer from base+offset.
+ */
+ size_t base; /*!< addr or file descriptor [+ data offset]
+ *
+ * If param type is MmRpc_ParamType_Ptr, the
+ * value of the embedded pointer. If param type
+ * is MmRpc_ParamType_OffPtr, the file descriptor
+ * of the block referenced by the embedded pointer
+ * plus an optional data offset.
+ */
size_t handle; /*!< memory allocator handle */
} MmRpc_Xlt;
MmRpc_Xlt * xltAry; /*!< array of translations */
} MmRpc_FxnCtx;
+/*!
+ * @brief Memory buffer types
+ *
+ * @remark Not all operating systems support all buffer types.
+ */
+typedef enum {
+ MmRpc_BufType_Handle, /*!< memory allocator handle */
+ MmRpc_BufType_Ptr /*!< buffer address */
+} MmRpc_BufType;
+
+/*!
+ * @brief Memory buffer descriptor
+ */
+typedef union {
+ size_t handle; /*!< file descriptor or handle */
+
+ struct {
+ size_t addr; /*!< address of memory buffer */
+ size_t size; /*!< size (bytes) of memory buffer */
+ } ptr;
+
+} MmRpc_BufDesc;
+
/*!
* @brief Instance create parameters
*/
*/
int MmRpc_delete(MmRpc_Handle *handlePtr);
+/*!
+ * @brief Release buffers which were declared in use
+ *
+ * @param[in] type buffer descriptor type
+ *
+ * @param[in] num number of elements in @c desc array
+ *
+ * @param[in] desc pointer to array of buffer descriptors
+ *
+ * @remark When the remote processor no longer needs a reference
+ * to a buffer, calling MmRpc_release() will release the
+ * buffer and any associated resources.
+ *
+ * @retval MmRpc_S_SUCCESS
+ * @retval MmRpc_E_INVALIDPARAM
+ * @retval MmRpc_E_NOMEM
+ * @retval MmRpc_E_SYS
+ *
+ * @sa MmRpc_use()
+ */
+int MmRpc_release(MmRpc_Handle handle, MmRpc_BufType type, int num,
+ MmRpc_BufDesc *desc);
+
+/*!
+ * @brief Declare the use of the given buffers
+ *
+ * @param[in] type buffer descriptor type
+ *
+ * @param[in] num number of elements in @c desc array
+ *
+ * @param[in] desc pointer to array of buffer descriptors
+ *
+ * @remark When using MmRpc_call() to invoke remote function calls,
+ * any referenced buffers will be made available to the
+ * remote processor only for the duration of the remote
+ * function call. If the remote processor maintains a
+ * reference to the buffer across multiple invocations of
+ * MmRpc_call(), then the application must declare the buffer
+ * "in use". This will make the buffer persistent.
+ *
+ * @remark The application must release the buffer when it is no
+ * longer needed.
+ *
+ * @code
+ * #include <ti/ipc/mm/MmRpc.h>
+ *
+ * MmRpc_BufDesc desc[2];
+ *
+ * desc[0].handle = fd1;
+ * desc[1].handle = fd2;
+ *
+ * MmRpc_use(h, MmRpc_BufType_Handle, 2, desc);
+ * @endcode
+ *
+ * @retval MmRpc_S_SUCCESS
+ * @retval MmRpc_E_INVALIDPARAM
+ * @retval MmRpc_E_NOMEM
+ * @retval MmRpc_E_SYS
+ *
+ * @sa MmRpc_release()
+ */
+int MmRpc_use(MmRpc_Handle handle, MmRpc_BufType type, int num,
+ MmRpc_BufDesc *desc);
+
/*!
* @brief Initialize the instance create parameter structure
*
void MmRpc_Params_init(MmRpc_Params *params);
-
#if defined(__cplusplus)
}
#endif
index b60e866c797f17eda898f6d87f69ac581104cb82..5b9d583801e60921a60e87ca21c604fd73b7706b 100644 (file)
* The given array must be the actual array buffer,
* not a pointer to it.
*/
-#define MmType_NumElem(x) (sizeof(x)/sizeof(x[0]))
+#define MmType_NumElem(x) (sizeof(x)/sizeof((x)[0]))
/*!
* @brief Parameter Direction
MmType_Param_MAX
} MmType_ParamType;
-#define MmType_PtrType(type) (type | MmType_Param_PTR)
+#define MmType_PtrType(type) ((type) | MmType_Param_PTR)
/*!
* @brief Parameter Signature
diff --git a/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.c b/packages/ti/ipc/namesrv/NameServerRemoteRpmsg.c
index 5f895f2f885738dad4bd7e2775f573b84fc8bc0d..a005e51631e0dc85bf0f4c22e1ff9d1f4ec0b1bd 100644 (file)
/* Create request message and send to remote processor: */
msg.request = NameServerRemoteRpmsg_REQUEST;
msg.requestStatus = 0;
+ msg.valueLen = *valueLen;
len = strlen(instanceName);
Assert_isTrue(len < MAXNAMEINCHAR, NameServerRemoteRpmsg_A_nameIsTooLong);
/* name is found */
/* set length to amount of data that was copied */
- *valueLen = sizeof(Bits32);
+ *valueLen = replyMsg->valueLen;
/* set the contents of value */
- memcpy(value, &(replyMsg->value), sizeof(Bits32));
+ if (*valueLen <= sizeof (Bits32)) {
+ memcpy(value, &(replyMsg->value), sizeof(Bits32));
+ }
+ else {
+ memcpy(value, replyMsg->valueBuf, *valueLen);
+ }
/* set the status to success */
status = NameServer_S_SUCCESS;
UInt16 dstProc = MultiProc_getId("HOST");
Assert_isTrue(msg != NULL, NULL);
+ Assert_isTrue(msg->valueLen <= MAXVALUELEN, NULL);
if (msg->request == NameServerRemoteRpmsg_REQUEST) {
Log_print1(Diags_INFO, FXNN": Request from procId %d.\n", dstProc);
if (handle != NULL) {
/* Search for the NameServer entry */
- status = NameServer_getLocalUInt32(handle,
+ if (msg->valueLen <= sizeof (Bits32)) {
+ status = NameServer_getLocalUInt32(handle,
(String)msg->name, &msg->value);
+ }
+ else {
+ status = NameServer_getLocal(handle, (String)msg->name,
+ (Ptr)msg->valueBuf, &msg->valueLen);
+ }
}
/* set the request status */
diff --git a/packages/ti/ipc/namesrv/_NameServerRemoteRpmsg.h b/packages/ti/ipc/namesrv/_NameServerRemoteRpmsg.h
index 074f2699ce9f1c49095dacee200a9948f900c512..84412283c1f3b6ed18f1cfcdc8fba041940dbfe1 100644 (file)
#define MAXNAMEINCHAR 80
#define NAMEARRAYSZIE (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
+#define MAXVALUELEN 75
/* message sent to remote procId */
typedef struct NameServerRemote_Msg {
Bits32 reserved; /* reserved field: must be first! */
- Bits32 value; /* holds value */
+ Bits32 value; /* holds value if len <= 4 */
Bits32 request; /* whether its a request/response */
Bits32 requestStatus; /* status of request */
/* name of NameServer instance */
Bits32 instanceName[NAMEARRAYSZIE];
/* name of NameServer entry */
Bits32 name[NAMEARRAYSZIE];
+ Bits32 valueLen; /* len of value */
+ Bits32 valueBuf[MAXVALUELEN]; /* value buffer */
} NameServerRemote_Msg;
#define NAME_SERVER_RPMSG_ADDR 0
index 3f23a52ee57f70683c6906e99205af41ddfc09e5..34603fc1d7f333afbb60ab4028908d39ab04c675 100644 (file)
#include <xdc/runtime/System.h>
#include <xdc/runtime/Startup.h>
+#include <ti/sysbios/hal/Cache.h>
#include "rsc_types.h"
#include "package/internal/Resource.xdc.h"
return (NULL);
}
+/*
+ * ======== getVdevStatus ========
+ */
+Char Resource_getVdevStatus(UInt32 id)
+{
+ UInt32 i;
+ UInt32 offset;
+ UInt32 type;
+ Char status = 0;
+ struct fw_rsc_vdev *vdev= NULL;
+ Resource_RscTable *table = (Resource_RscTable *)
+ (Resource_module->pTable);
+
+ for (i = 0; i < module->pTable->num; i++) {
+ offset = (UInt32)((Char *)table + table->offset[i]);
+ type = *(UInt32 *)offset;
+ if (type == TYPE_VDEV) {
+ vdev = (struct fw_rsc_vdev *)offset;
+ if (vdev->id == id) {
+ /* invalidate memory as host will update the status field */
+ Cache_inv(vdev, sizeof(*vdev), Cache_Type_ALL, TRUE);
+ status = vdev->status;
+ break;
+ }
+ }
+ }
+
+ return (status);
+}
+
/*
* ======== Resource_getVringDA ========
*/
index 1ef430461544a69f009052324034a3bd980067ef..8051cfc29bcb5cebb506536e4d5da2eeb90a2a42 100644 (file)
@DirectCall
Ptr getTraceBufPtr();
+ /*!
+ * @brief Get the status field of the VDEV, given the fw_rsc_vdev id.
+ *
+ * @return status value which is set by Virtio device on HLOS.
+ */
+ @DirectCall
+ Char getVdevStatus(UInt32 id);
+
/*!
* @brief Get the nth (vqId) vring address from the VDEV struct.
*
index 8c4f805d4f40c6b3edb1535d701ae700b50bafe2..0f87a88c04bf9d9e8f39ad145cbcb3d847b40f61 100644 (file)
% }
% else if (prog.cpu.deviceName.match(/Vayu/) ||
% prog.cpu.deviceName.match(/DRA7XX/)) {
-% if (prog.cpu.attrs.cpuCore.match(/CM4/) &&
-% (xdc.om["ti.sysbios.family.arm.ducati.Core"].ipuId == 2)) {
-#define OMAP5
+% if (prog.cpu.attrs.cpuCore.match(/CM4/)) {
+% if (xdc.om["ti.sysbios.family.arm.ducati.Core"].ipuId == 1) {
+#define VAYU_IPU_1
+% //print("ti.ipc.remoteproc.Resource.xdt : VAYU_IPU_1");
+% }
+% if (xdc.om["ti.sysbios.family.arm.ducati.Core"].ipuId == 2) {
+#define VAYU_IPU_2
+% //print("ti.ipc.remoteproc.Resource.xdt : VAYU_IPU_2");
+% }
#include <ti/ipc/remoteproc/rsc_table_vayu_ipu.h>
% }
% else if (prog.cpu.attrs.cpuCore.match(/6600/)) {
-#define OMAP5
+% if (prog.platformName.match(/DRA7XX:dsp1$/)) {
+#define VAYU_DSP_1
+% //print("ti.ipc.remoteproc.Resource.xdt : VAYU_DSP_1");
+% }
+% if (prog.platformName.match(/DRA7XX:dsp2$/)) {
+#define VAYU_DSP_2
+% //print("ti.ipc.remoteproc.Resource.xdt : VAYU_DSP_2");
+% }
#include <ti/ipc/remoteproc/rsc_table_vayu_dsp.h>
% }
% else {
diff --git a/packages/ti/ipc/remoteproc/linkcmd.xdt b/packages/ti/ipc/remoteproc/linkcmd.xdt
--- /dev/null
@@ -0,0 +1,57 @@
+%%{
+/*
+ * Copyright (c) 2008-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.
+ */
+%%}
+
+%if (xdc.module('ti.sysbios.BIOS').$used) {
+ /*
+ * Set entry point to the HWI reset vector 0 to automatically satisfy
+ * any alignment constraints for the boot vector.
+ */
+%if ((Program.build.target.$name.match(/C64P/)) ||
+% (Program.build.target.$name.match(/C674/)) ||
+% (Program.build.target.$name.match(/C64T/)) ||
+% (Program.build.target.$name.match(/C66/)) ||
+% (Program.build.target.$name.match(/C67P/))) {
+% if (Program.build.target.$name.match(/elf/)) {
+ -eti_sysbios_family_c64p_Hwi0
+% }
+% else {
+ -e_ti_sysbios_family_c64p_Hwi0
+% }
+%}
+
+ /*
+ * We just modified the entry point, so suppress "entry point symbol other
+ * than _c_int00 specified" warning.
+ */
+ --diag_suppress=10063
+%}
\ No newline at end of file
index 6d0372c7a0e74b610a93e7afc3cf9ff1d119db95..aceab31801a848ac70a0b6af30d9655db720741e 100644 (file)
Pkg.attrs.exportSrc = true;
Pkg.otherFiles = ["package.bld", "rsc_types.h",
+ "linkcmd.xdt",
"rsc_table_omapl138.h",
"rsc_table_tci6614.h",
"rsc_table_tci6614_v3.3.h",
index 42a355a62f72c6387c32700a22fb2aa0745a9e33..63343199353ef9f9339eaf6430bd811e16dbf09a 100644 (file)
/*
- * Copyright (c) 2011-2012, Texas Instruments Incorporated
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
return (lib);
}
+
+/*
+ * ======== Package.getSects ========
+ */
+function getSects()
+{
+ return "ti/ipc/remoteproc/linkcmd.xdt";
+}
diff --git a/packages/ti/ipc/remoteproc/rsc_table_omap5_ipu.h b/packages/ti/ipc/remoteproc/rsc_table_omap5_ipu.h
index 3a9050e2e61eabf72e37c8a90b2d76e194dac171..80588a9fa2eb31213bfc4334fa468da3c8cda05f 100644 (file)
{
TYPE_CARVEOUT,
IPU_MEM_TEXT, 0,
- IPU_MEM_TEXT_SIZE, 0, RPROC_MEMREGION_CODE, "IPU_MEM_TEXT",
+ IPU_MEM_TEXT_SIZE, 0, 0, "IPU_MEM_TEXT",
},
{
TYPE_CARVEOUT,
IPU_MEM_DATA, 0,
- IPU_MEM_DATA_SIZE, 0, RPROC_MEMREGION_DATA, "IPU_MEM_DATA",
+ IPU_MEM_DATA_SIZE, 0, 0, "IPU_MEM_DATA",
},
{
TYPE_CARVEOUT,
IPU_MEM_IPC_DATA, 0,
- IPU_MEM_IPC_DATA_SIZE, 0, RPROC_MEMREGION_SMEM, "IPU_MEM_IPC_DATA",
+ IPU_MEM_IPC_DATA_SIZE, 0, 0, "IPU_MEM_IPC_DATA",
},
{
{
TYPE_DEVMEM,
IPU_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
- IPU_MEM_IPC_VRING_SIZE, 0, RPROC_MEMREGION_VRING, "IPU_MEM_IPC_VRING",
+ IPU_MEM_IPC_VRING_SIZE, 0, 0, "IPU_MEM_IPC_VRING",
},
{
TYPE_DEVMEM,
IPU_MEM_IOBUFS, PHYS_MEM_IOBUFS,
- IPU_MEM_IOBUFS_SIZE, 0, RPROC_MEMREGION_1D, "IPU_MEM_IOBUFS",
+ IPU_MEM_IOBUFS_SIZE, 0, 0, "IPU_MEM_IOBUFS",
},
{
diff --git a/packages/ti/ipc/remoteproc/rsc_table_vayu_dsp.h b/packages/ti/ipc/remoteproc/rsc_table_vayu_dsp.h
index 84608b6040051c110b177a961e6e553ce6e6a1fc..328aee1260d3ce13ff0cfac94f5cb15992d9b02f 100644 (file)
#include "rsc_types.h"
/* DSP Memory Map */
-#define L4_44XX_BASE 0x4A000000
+#define L4_DRA7XX_BASE 0x4A000000
-#define L4_PERIPHERAL_L4CFG (L4_44XX_BASE)
+#define L4_PERIPHERAL_L4CFG (L4_DRA7XX_BASE)
#define DSP_PERIPHERAL_L4CFG 0x4A000000
-#define L4_PERIPHERAL_L4PER 0x48000000
-#define DSP_PERIPHERAL_L4PER 0x48000000
+#define L4_PERIPHERAL_L4PER1 0x48000000
+#define DSP_PERIPHERAL_L4PER1 0x48000000
+
+#define L4_PERIPHERAL_L4PER2 0x48400000
+#define DSP_PERIPHERAL_L4PER2 0x48400000
+
+#define L4_PERIPHERAL_L4PER3 0x48800000
+#define DSP_PERIPHERAL_L4PER3 0x48800000
#define L4_PERIPHERAL_L4EMU 0x54000000
#define DSP_PERIPHERAL_L4EMU 0x54000000
/*
* Assign fixed RAM addresses to facilitate a fixed MMU table.
*/
-/* This address is derived from current IPU & ION carveouts */
+/* See CMA BASE addresses in Linux side: arch/arm/mach-omap2/remoteproc.c */
#ifdef OMAP5
#define PHYS_MEM_IPC_VRING 0x95000000
+#elif defined (VAYU_DSP_1)
+#define PHYS_MEM_IPC_VRING 0x95000000
+#elif defined (VAYU_DSP_2)
+#define PHYS_MEM_IPC_VRING 0x94800000
#else
#define PHYS_MEM_IPC_VRING 0x98800000
#endif
struct my_resource_table {
struct resource_table base;
- UInt32 offset[16]; /* Should match 'num' in actual definition */
+ UInt32 offset[18]; /* Should match 'num' in actual definition */
/* rpmsg vdev entry */
struct fw_rsc_vdev rpmsg_vdev;
/* devmem entry */
struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem11;
};
#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
1, /* we're the first version that implements this */
- 16, /* number of entries in the table */
+ 18, /* number of entries in the table */
0, 0, /* reserved, must be zero */
/* offsets to entries */
{
offsetof(struct my_resource_table, devmem7),
offsetof(struct my_resource_table, devmem8),
offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, devmem11),
},
/* rpmsg vdev entry */
{
TYPE_DEVMEM,
- DSP_PERIPHERAL_L4PER, L4_PERIPHERAL_L4PER,
- SZ_16M, 0, 0, "DSP_PERIPHERAL_L4PER",
+ DSP_PERIPHERAL_L4PER1, L4_PERIPHERAL_L4PER1,
+ SZ_2M, 0, 0, "DSP_PERIPHERAL_L4PER1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER2, L4_PERIPHERAL_L4PER2,
+ SZ_4M, 0, 0, "DSP_PERIPHERAL_L4PER2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER3, L4_PERIPHERAL_L4PER3,
+ SZ_8M, 0, 0, "DSP_PERIPHERAL_L4PER3",
},
{
diff --git a/packages/ti/ipc/remoteproc/rsc_table_vayu_ipu.h b/packages/ti/ipc/remoteproc/rsc_table_vayu_ipu.h
index 1b3a3fdd0c79e277d823716ef2da1e32911fd969..fb9ce9623cfbf441b954e0e8176b14f474b1f939 100644 (file)
#include "rsc_types.h"
/* IPU Memory Map */
-#define L4_44XX_BASE 0x4a000000
+#define L4_DRA7XX_BASE 0x4A000000
-#define L4_PERIPHERAL_L4CFG (L4_44XX_BASE)
+/* L4_CFG & L4_WKUP */
+#define L4_PERIPHERAL_L4CFG (L4_DRA7XX_BASE)
#define IPU_PERIPHERAL_L4CFG 0x6A000000
-#define L4_PERIPHERAL_L4PER 0x48000000
-#define IPU_PERIPHERAL_L4PER 0x68000000
+#define L4_PERIPHERAL_L4PER1 0x48000000
+#define IPU_PERIPHERAL_L4PER1 0x68000000
+
+#define L4_PERIPHERAL_L4PER2 0x48400000
+#define IPU_PERIPHERAL_L4PER2 0x68400000
+
+#define L4_PERIPHERAL_L4PER3 0x48800000
+#define IPU_PERIPHERAL_L4PER3 0x68800000
#define L4_PERIPHERAL_L4EMU 0x54000000
#define IPU_PERIPHERAL_L4EMU 0x74000000
#define IPU_MEM_TEXT 0x0
#define IPU_MEM_DATA 0x80000000
-#ifdef OMAP5
+#if defined(OMAP5) || defined(VAYU_IPU_1) || defined(VAYU_IPU_2)
#define IPU_MEM_IOBUFS 0x90000000
#else
#define IPU_MEM_IOBUFS 0x88000000
#define IPU_MEM_IPC_VRING_SIZE SZ_1M
#define IPU_MEM_IPC_DATA_SIZE SZ_1M
+
+#ifdef VAYU_IPU_1
+#define IPU_MEM_TEXT_SIZE (SZ_1M)
+#else
#define IPU_MEM_TEXT_SIZE (SZ_1M * 6)
-#ifdef OMAP5
+#endif
+
+#if defined(OMAP5) || defined(VAYU_IPU_2)
#define IPU_MEM_DATA_SIZE (SZ_1M * 156)
+#elif defined(VAYU_IPU_1)
+#define IPU_MEM_DATA_SIZE (SZ_1M * 5)
#else
#define IPU_MEM_DATA_SIZE (SZ_1M * 100)
#endif
+
#define IPU_MEM_IOBUFS_SIZE (SZ_1M * 90)
/*
* Assign fixed RAM addresses to facilitate a fixed MMU table.
* PHYS_MEM_IPC_VRING & PHYS_MEM_IPC_DATA MUST be together.
*/
+/* See CMA BASE addresses in Linux side: arch/arm/mach-omap2/remoteproc.c */
#ifdef OMAP5
#define PHYS_MEM_IPC_VRING 0x95800000
+#elif defined(VAYU_IPU_1)
+#define PHYS_MEM_IPC_VRING 0x94000000
+#elif defined (VAYU_IPU_2)
+#define PHYS_MEM_IPC_VRING 0x95800000
#else
#define PHYS_MEM_IPC_VRING 0x99000000
#endif
struct my_resource_table {
struct resource_table base;
- UInt32 offset[16]; /* Should match 'num' in actual definition */
+ UInt32 offset[18]; /* Should match 'num' in actual definition */
/* rpmsg vdev entry */
struct fw_rsc_vdev rpmsg_vdev;
/* devmem entry */
struct fw_rsc_devmem devmem10;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem11;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem12;
};
#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
1, /* we're the first version that implements this */
- 16, /* number of entries in the table */
+ 18, /* number of entries in the table */
0, 0, /* reserved, must be zero */
/* offsets to entries */
{
offsetof(struct my_resource_table, devmem8),
offsetof(struct my_resource_table, devmem9),
offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, devmem11),
+ offsetof(struct my_resource_table, devmem12),
},
/* rpmsg vdev entry */
{
TYPE_CARVEOUT,
IPU_MEM_TEXT, 0,
- IPU_MEM_TEXT_SIZE, 0, RPROC_MEMREGION_CODE, "IPU_MEM_TEXT",
+ IPU_MEM_TEXT_SIZE, 0, 0, "IPU_MEM_TEXT",
},
{
TYPE_CARVEOUT,
IPU_MEM_DATA, 0,
- IPU_MEM_DATA_SIZE, 0, RPROC_MEMREGION_DATA, "IPU_MEM_DATA",
+ IPU_MEM_DATA_SIZE, 0, 0, "IPU_MEM_DATA",
},
{
TYPE_CARVEOUT,
IPU_MEM_IPC_DATA, 0,
- IPU_MEM_IPC_DATA_SIZE, 0, RPROC_MEMREGION_SMEM, "IPU_MEM_IPC_DATA",
+ IPU_MEM_IPC_DATA_SIZE, 0, 0, "IPU_MEM_IPC_DATA",
},
{
{
TYPE_DEVMEM,
IPU_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
- IPU_MEM_IPC_VRING_SIZE, 0, RPROC_MEMREGION_VRING, "IPU_MEM_IPC_VRING",
+ IPU_MEM_IPC_VRING_SIZE, 0, 0, "IPU_MEM_IPC_VRING",
},
{
TYPE_DEVMEM,
IPU_MEM_IOBUFS, PHYS_MEM_IOBUFS,
- IPU_MEM_IOBUFS_SIZE, 0, RPROC_MEMREGION_1D, "IPU_MEM_IOBUFS",
+ IPU_MEM_IOBUFS_SIZE, 0, 0, "IPU_MEM_IOBUFS",
},
{
{
TYPE_DEVMEM,
- IPU_PERIPHERAL_L4PER, L4_PERIPHERAL_L4PER,
- SZ_16M, 0, 0, "IPU_PERIPHERAL_L4PER",
+ IPU_PERIPHERAL_L4PER1, L4_PERIPHERAL_L4PER1,
+ SZ_2M, 0, 0, "IPU_PERIPHERAL_L4PER1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER2, L4_PERIPHERAL_L4PER2,
+ SZ_4M, 0, 0, "IPU_PERIPHERAL_L4PER2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER3, L4_PERIPHERAL_L4PER3,
+ SZ_8M, 0, 0, "IPU_PERIPHERAL_L4PER3",
},
{
index a29746691be8b7cea30bdac0bdce643271cd5153..661c02934a94b69b76e3a3c44735dcec78171976 100644 (file)
#define TYPE_VDEV 3
#define TYPE_CRASHDUMP 4
-/*
- * Use flags to define memory access for each resource
- * Must match include/linux/rproc_drm.h
- */
-enum rproc_memregion {
- RPROC_MEMREGION_UNKNOWN,
- RPROC_MEMREGION_2D,
- RPROC_MEMREGION_SMEM,
- RPROC_MEMREGION_CODE,
- RPROC_MEMREGION_DATA,
- RPROC_MEMREGION_1D,
- RPROC_MEMREGION_VRING
-};
-
/* Common Resource Structure Types */
struct resource_table {
UInt32 ver;
UInt32 pa;
UInt32 len;
UInt32 flags;
- UInt32 memregion;
+ UInt32 reserved;
Char name[32];
};
index aa7008c87a574210a21dad11d43d4f57fc02893c..94fbc1bc0a8e3f3079c64cc15f000c63545d399a 100644 (file)
{
GateHwi_Params gatePrms;
HeapBuf_Params prms;
+ Semaphore_Params semParams;
int i;
Registry_Result result;
Bool isHost;
if (module.heap == 0) {
System_abort("RPMessage_init: HeapBuf_create returned 0\n");
}
- transport.semHandle_toHost = Semaphore_create(0, NULL, NULL);
+
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_BINARY;
+ transport.semHandle_toHost = Semaphore_create(0, &semParams, NULL);
isHost = (MultiProc_self() == MultiProc_getId("HOST"));
index 660aed01121e54520a14043e6e8a706e36bcbd35..068df2ca4929ae44b5d0766b959c68c06c3536c2 100644 (file)
/*!
* @brief Used as the timeout value to specify wait forever
*/
-#define RPMessage_FOREVER ~(0)
+#define RPMessage_FOREVER (~(0))
/*!
* @def RPMessage_S_SUCCESS
* @brief Operation is successful.
*/
-#define RPMessage_S_SUCCESS 0
+#define RPMessage_S_SUCCESS (0)
/*!
* @def RPMessage_E_FAIL
* @brief Operation is not successful.
*/
-#define RPMessage_E_FAIL -1
+#define RPMessage_E_FAIL (-1)
/*!
* @def RPMessage_E_MEMORY
* @brief Operation resulted in memory failure.
*/
-#define RPMessage_E_MEMORY -3
+#define RPMessage_E_MEMORY (-3)
/*!
* @def RPMessage_E_TIMEOUT
* @brief Operation timed out.
*/
-#define RPMessage_E_TIMEOUT -6
+#define RPMessage_E_TIMEOUT (-6)
/*!
* @def RPMessage_E_NOENDPT
* @brief No endpoint for a message.
*/
-#define RPMessage_E_NOENDPT -7
+#define RPMessage_E_NOENDPT (-7)
/*!
* @def MessageQ_E_UNBLOCKED
* @brief RPMessage was unblocked
*/
-#define RPMessage_E_UNBLOCKED -19
+#define RPMessage_E_UNBLOCKED (-19)
/*!
* @def RPMessage_MAX_RESERVED_ENDPOINT
* @brief Maximum Value for System Reserved Endpoints.
*/
-#define RPMessage_MAX_RESERVED_ENDPOINT 100
+#define RPMessage_MAX_RESERVED_ENDPOINT (100)
/*!
* @def RPMessage_MAX_RESERVED_ENDPOINT
* @brief Maximum Value for System Reserved Endpoints.
*/
-#define RPMessage_ASSIGN_ANY 0xFFFFFFFF
+#define RPMessage_ASSIGN_ANY (0xFFFFFFFF)
/*!
* @brief RPMessage_Handle type
*/
similarity index 52%
rename from packages/ti/platform/vayu/dsp1/Platform.xdc
rename to packages/ti/ipc/tests/GateMPAppCommon.h
index d8ce60efba92bb349254e72e295b4758221b4a43..a1bb77ca83151c2474ed08f5480b61b6dc847b42 100644 (file)
rename from packages/ti/platform/vayu/dsp1/Platform.xdc
rename to packages/ti/ipc/tests/GateMPAppCommon.h
index d8ce60efba92bb349254e72e295b4758221b4a43..a1bb77ca83151c2474ed08f5480b61b6dc847b42 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*!
- * File generated by platform wizard.
+
+/*
+ * ======== GateMPAppCommon.h ========
*
*/
-metaonly module Platform inherits xdc.platform.IPlatform {
-
- config ti.platforms.generic.Platform.Instance plat =
- ti.platforms.generic.Platform.create("plat", {
- clockRate: 1000,
- catalogName: "ti.catalog.c6000",
- deviceName: "Vayu",
- externalMemoryMap: [
- ["EXT_CODE", {name: "EXT_CODE", base: 0x95000000, len: 0x00100000, space: "code", access: "RWX"}],
- ["EXT_DATA", {name: "EXT_DATA", base: 0x95100000, len: 0x00100000, space: "data", access: "RW"}],
- ["EXT_HEAP", {name: "EXT_HEAP", base: 0x95200000, len: 0x00300000, space: "data", access: "RW"}],
- ["TRACE_BUF", {name: "TRACE_BUF", base: 0x9F000000, len: 0x00060000, space: "data", access: "RW"}],
- ["EXC_DATA", {name: "EXC_DATA", base: 0x9F060000, len: 0x00010000, space: "data", access: "RW"}],
- ["PM_DATA", {name: "PM_DATA", base: 0x9F070000, len: 0x00020000, space: "data", access: "RWX"}],
- ],
- });
-
-instance :
-
- override config string codeMemory = "EXT_CODE";
- override config string dataMemory = "EXT_DATA";
- override config string stackMemory = "EXT_DATA";
+#ifndef GateMPAppCommon__include
+#define GateMPAppCommon__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*
+ * ======== Application Configuration ========
+ */
+
+/* notify commands 00 - FF */
+#define GATEMPAPP_CMD_MASK 0xFF000000
+
+/* used by host and remote device to synchronize states with each other*/
+#define GATEMPAPP_CMD_SPTR_ADDR 0x10000000
+#define GATEMPAPP_CMD_SPTR_ADDR_ACK 0x12000000
+#define GATEMPAPP_CMD_SHUTDOWN_ACK 0x20000000
+#define GATEMPAPP_CMD_SHUTDOWN 0x21000000
+#define GATEMPAPP_CMD_SYNC 0x30000000
+
+/* GateMP instance created on host */
+#define GATEMP_HOST_NAME "GATE_MP1"
+/* GateMP instance created on slave */
+#define GATEMP_SLAVE_NAME "GATE_MP2"
+
+/* queue error message*/
+#define GATEMPAPP_E_FAILURE 0xF0000000
+#define GATEMPAPP_E_UNEXPECTEDMSG 0xF2000000
+
+/* Number of times to lock/unlock */
+#define LOOP_ITR 300
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ UInt32 cmd;
+ UInt32 payload;
+} GateMPApp_Msg;
+
+#define GateMPApp_MsgHeapId 0
+#define GateMPApp_HostMsgQueName "HOST:MsgQ:01"
+#define GateMPApp_SlaveMsgQueName "SLAVE:MsgQ:01"
+
+#if defined (__cplusplus)
}
+#endif /* defined (__cplusplus) */
+#endif /* GateMPAppCommon__include */
index 38f95e65c506b74eb93c266603bc797719855e3e..83062a641cbe5951f824670694dc08cd7f74ab2e 100644 (file)
/*
* ======== Mx_compute ========
*/
-int32_t Mx_compute(Mx_Compute *compute)
+#if defined(SYSLINK_BUILDOS_QNX)
+int32_t Mx_compute_QnX(Mx_Compute *compute)
+#else
+int32_t Mx_compute_Linux(Mx_Compute *compute, int fd, int fdIn, int fdOut)
+#endif
{
MmRpc_FxnCtx *fxnCtx;
MmRpc_Xlt xltAry[2];
int32_t fxnRet;
char send_buf[512] = {0};
int status;
+ MmRpc_BufDesc desc[1];
+ int num = 0;
+
+ /* make the output buffer persistent */
+#if defined(SYSLINK_BUILDOS_QNX)
+ desc[0].ptr.addr = (size_t)compute->outBuf;
+ desc[0].ptr.size = compute->size * sizeof(uint32_t);
+ num = 1;
+
+ status = MmRpc_use(Mx_rpcIpu, MmRpc_BufType_Ptr, num, desc);
+#else
+ desc[0].handle = fdOut;
+ num = 1;
+
+ status = MmRpc_use(Mx_rpcIpu, MmRpc_BufType_Handle, num, desc);
+#endif
+
+ if (status < 0) {
+ printf("mmrpc_test: Error: MmRpc_use failed\n");
+ num = 0;
+ fxnRet = -1;
+ goto leave;
+ }
/* marshall function arguments into the send buffer */
fxnCtx = (MmRpc_FxnCtx *)send_buf;
#if defined(SYSLINK_BUILDOS_QNX)
fxnCtx->params[0].param.ptr.handle = NULL;
#else
-/* fxnCtx->params[0].param.ptr.handle = ...; */
+ fxnCtx->params[0].param.ptr.handle = fd;
#endif
fxnCtx->num_xlts = 2;
fxnCtx->xltAry[0].index = 0;
fxnCtx->xltAry[0].offset = MmRpc_OFFSET(compute, &compute->inBuf);
+ fxnCtx->xltAry[0].base = (size_t)compute->inBuf;
#if defined(SYSLINK_BUILDOS_QNX)
fxnCtx->xltAry[0].handle = NULL;
#else
-/* fxnCtx->xltAry[0].handle = ...; */
+ fxnCtx->xltAry[0].handle = fdIn;
#endif
fxnCtx->xltAry[1].index = 0;
fxnCtx->xltAry[1].offset = MmRpc_OFFSET(compute, &compute->outBuf);
+ fxnCtx->xltAry[1].base = (size_t)compute->outBuf;
#if defined(SYSLINK_BUILDOS_QNX)
fxnCtx->xltAry[1].handle = NULL;
#else
-/* fxnCtx->xltAry[1].handle = ...; */
+ fxnCtx->xltAry[1].handle = fdOut;
#endif
/* invoke the remote function call */
if (status < 0) {
printf("mmrpc_test: Error: MmRpc_call failed\n");
fxnRet = -1;
+ goto leave;
+ }
+
+leave:
+ /* release the output buffer */
+ if (num > 0) {
+#if defined(SYSLINK_BUILDOS_QNX)
+ status = MmRpc_release(Mx_rpcIpu, MmRpc_BufType_Ptr, num, desc);
+#else
+ status = MmRpc_release(Mx_rpcIpu, MmRpc_BufType_Handle, num, desc);
+#endif
+
+ if (status < 0) {
+ printf("mmrpc_test: Error: MmRpc_release failed\n");
+ fxnRet = -1;
+ }
}
return(fxnRet);
index e14048772c8762509a4596d8b2bbd46b069ba70d..532d923e2c9e6883f9efd70f29c3ef274b7fc261 100644 (file)
*/
int32_t Mx_add(int32_t a, int32_t b);
+#if defined(SYSLINK_BUILDOS_QNX)
/*!
* @brief Sample function which has pointer parameter to
* a structure with two embedded pointers.
+ * QnX version.
*/
-int32_t Mx_compute(Mx_Compute *compute);
+int32_t Mx_compute_QnX(Mx_Compute *compute);
+#else /* Linux */
+
+/*!
+ * @brief Sample function which has pointer parameter (DMA_BUF) to
+ * a structure with two embedded pointers.
+ * Linux version.
+ */
+int32_t Mx_compute_Linux(Mx_Compute *compute, int fd, int fdIn, int fdOut);
+
+#endif
#if defined(__cplusplus)
}
diff --git a/packages/ti/ipc/tests/NameServerApp.c b/packages/ti/ipc/tests/NameServerApp.c
--- /dev/null
@@ -0,0 +1,400 @@
+/*
+ * Copyright (c) 2013, 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 NameServerApp.c
+ *
+ * @brief Sample application for NameServer module between MPU and Remote Proc
+ *
+ * ============================================================================
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* Standard headers */
+#include <stdio.h>
+
+/* Ipc Standard header */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Registry.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/Ipc.h>
+//#include <_NameServer.h>
+
+/* Module level headers */
+#include <ti/ipc/NameServer.h>
+
+
+/** ============================================================================
+ * Macros and types
+ * ============================================================================
+ */
+#define NSNAME "MyNS"
+#define NSNAME2 "MyNS2"
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+
+Void smain (UArg arg0, UArg arg1);
+
+/** ============================================================================
+ * Globals
+ * ============================================================================
+ */
+
+Int testNS(NameServer_Handle nsHandle, String name)
+{
+ Int32 status = 0;
+ Ptr ptr;
+ UInt32 val;
+ char key[16];
+ Int i;
+
+ ptr = NameServer_addUInt32(nsHandle, name, 0xdeadbeef);
+ if (ptr == NULL) {
+ Log_print0(Diags_INFO, "Failed to NameServer_addUInt32()\n");
+ return -1;
+ }
+ else {
+ Log_print1(Diags_INFO, "NameServer_addUInt32() returned %p\n", (IArg)ptr);
+ }
+
+ Log_print0(Diags_INFO, "Trying to add same key (should fail)...\n");
+ ptr = NameServer_addUInt32(nsHandle, name, 0xdeadc0de);
+ if (ptr == NULL) {
+ Log_print0(Diags_INFO, " ...got expected Failure from NameServer_addUInt32()\n");
+ }
+ else {
+ Log_print1(Diags_INFO, " Error: NameServer_addUInt32() returned non-NULL %p (but was expected to fail)\n", (IArg)ptr);
+ return -1;
+ }
+
+ val = 0x00c0ffee;
+ status = NameServer_getUInt32(nsHandle, name, &val, NULL);
+ Log_print2(Diags_INFO, "NameServer_getUInt32() returned %d, val=0x%x (was 0x00c0ffee)\n", status, val);
+
+ Log_print0(Diags_INFO, "Removing 0xdeadbeef w/ NameServer_remove()...\n");
+ status = NameServer_remove(nsHandle, name);
+ if (status < 0) {
+ Log_print1(Diags_INFO, "NameServer_remove() failed: %d\n", status);
+ return -1;
+ }
+
+ ptr = NameServer_addUInt32(nsHandle, name, 0xdeadc0de);
+ if (ptr == NULL) {
+ Log_print0(Diags_INFO, "Error: NameServer_addUInt32() failed\n");
+ return -1;
+ }
+ else {
+ Log_print0(Diags_INFO, "NameServer_addUInt32(0xdeadc0de) succeeded\n");
+ }
+
+ val = 0x00c0ffee;
+ status = NameServer_getUInt32(nsHandle, name, &val, NULL);
+ Log_print2(Diags_INFO, "NameServer_getUInt32() returned %d, val=0x%x (was 0x00c0ffee)\n", status, val);
+
+ Log_print0(Diags_INFO, "Removing 0xdeadc0de w/ NameServer_removeEntry()...\n");
+ status = NameServer_removeEntry(nsHandle, ptr);
+ if (status < 0) {
+ Log_print1(Diags_INFO, "NameServer_remove() failed: %d\n", status);
+ return -1;
+ }
+
+ ptr = NameServer_addUInt32(nsHandle, name, 0x0badc0de);
+ if (ptr == NULL) {
+ Log_print0(Diags_INFO, "Error: NameServer_addUInt32() failed\n");
+ return -1;
+ }
+ else {
+ Log_print0(Diags_INFO, "NameServer_addUInt32(0x0badc0de) succeeded\n");
+ }
+
+ val = 0x00c0ffee;
+ status = NameServer_getUInt32(nsHandle, name, &val, NULL);
+ Log_print2(Diags_INFO, "NameServer_getUInt32() returned %d, val=0x%x (was 0x00c0ffee)\n", status, val);
+
+ status = NameServer_remove(nsHandle, name);
+ if (status < 0) {
+ Log_print0(Diags_INFO, "Error: NameServer_remove() failed\n");
+ return -1;
+ }
+ else {
+ Log_print1(Diags_INFO, "NameServer_remove(%s) succeeded\n", (IArg)name);
+ }
+
+ for (i = 0; i < 10; i++) {
+ sprintf(key, "foobar%d", i);
+
+ ptr = NameServer_addUInt32(nsHandle, key, 0x0badc0de + i);
+ if (ptr == NULL) {
+ Log_print0(Diags_INFO, "Error: NameServer_addUInt32() failed\n");
+ return -1;
+ }
+ else {
+ Log_print2(Diags_INFO, "NameServer_addUInt32(%s, 0x%x) succeeded\n", (IArg)key, 0x0badc0de + i);
+ }
+
+ val = 0x00c0ffee;
+ status = NameServer_getUInt32(nsHandle, key, &val, NULL);
+ Log_print3(Diags_INFO, "NameServer_getUInt32(%s) returned %d, val=0x%x (was 0x00c0ffee)\n", (IArg)key, status, val);
+
+ if (val != (0x0badc0de + i)) {
+ Log_print2(Diags_INFO, "get val (0x%x) != add val (0x%x)!\n", val, 0x0badc0de + i);
+ }
+ }
+
+ for (i = 0; i < 10; i++) {
+ sprintf(key, "foobar%d", i);
+
+ status = NameServer_remove(nsHandle, key);
+ if (status < 0) {
+ Log_print0(Diags_INFO, "Error: NameServer_remove() failed\n");
+ return -1;
+ }
+ else {
+ Log_print1(Diags_INFO, "NameServer_remove(%s) succeeded\n", (IArg)key);
+ }
+ }
+
+ return 0;
+}
+
+/** ============================================================================
+ * Functions
+ * ============================================================================
+ */
+Int
+NameServerApp_startup()
+{
+ Int32 status = 0;
+ NameServer_Params params;
+ NameServer_Handle nsHandle;
+ NameServer_Handle nsHandleAlias;
+ NameServer_Handle nsHandle2;
+ Int iteration = 0;
+
+ Log_print0(Diags_INFO, "Entered NameServerApp_startup\n");
+
+/* status = Ipc_start();
+
+ if (status < 0) {
+ Log_print1(Diags_INFO, "Ipc_start failed: status = %d\n", status);
+ return -1;
+ }
+*/
+// Log_print0(Diags_INFO, "Calling NameServer_setup()...\n");
+// NameServer_setup();
+
+again:
+ NameServer_Params_init(¶ms);
+
+ params.maxValueLen = sizeof(UInt32);
+ params.maxNameLen = 32;
+
+ Log_print1(Diags_INFO, "params.maxValueLen=%d\n", params.maxValueLen);
+ Log_print1(Diags_INFO, "params.maxNameLen=%d\n", params.maxNameLen);
+ Log_print1(Diags_INFO, "params.checkExisting=%d\n", params.checkExisting);
+
+ nsHandle = NameServer_create(NSNAME, ¶ms);
+ if (nsHandle == NULL) {
+ Log_print1(Diags_INFO, "Failed to create NameServer '%s'\n", (IArg)NSNAME);
+ return -1;
+ }
+ else {
+ Log_print1(Diags_INFO, "Created NameServer '%s'\n", (IArg)NSNAME);
+ }
+
+ nsHandleAlias = NameServer_create(NSNAME, ¶ms);
+ if (nsHandleAlias == NULL) {
+ Log_print1(Diags_INFO, "Failed to get handle to NameServer '%s'\n", (IArg)NSNAME);
+ return -1;
+ }
+ else {
+ Log_print1(Diags_INFO, "Got another handle to NameServer '%s'\n", (IArg)NSNAME);
+ }
+
+ NameServer_Params_init(¶ms);
+
+ params.maxValueLen = sizeof(UInt32);
+ params.maxNameLen = 32;
+ nsHandle2 = NameServer_create(NSNAME2, ¶ms);
+ if (nsHandle2 == NULL) {
+ Log_print1(Diags_INFO, "Failed to create NameServer '%s'\n", (IArg)NSNAME2);
+ return -1;
+ }
+ else {
+ Log_print1(Diags_INFO, "Created NameServer '%s'\n", (IArg)NSNAME2);
+ }
+
+ Log_print0(Diags_INFO, "Testing nsHandle\n");
+ status = testNS(nsHandle, "Key");
+ if (status != 0) {
+ Log_print0(Diags_INFO, "test failed on nsHandle\n");
+ return status;
+ }
+ Log_print0(Diags_INFO, "Testing nsHandle2\n");
+ status = testNS(nsHandle2, "Key");
+ if (status != 0) {
+ Log_print0(Diags_INFO, "test failed on nsHandle2\n");
+ return status;
+ }
+
+ Log_print0(Diags_INFO, "Deleting nsHandle and nsHandle2...\n");
+ NameServer_delete(&nsHandle);
+ NameServer_delete(&nsHandle2);
+
+ /*
+ * Verify that we can still use the alias handle after deleting the
+ * initial handle
+ */
+ Log_print0(Diags_INFO, "Testing nsHandleAlias\n");
+ status = testNS(nsHandleAlias, "Key");
+ if (status != 0) {
+ Log_print0(Diags_INFO, "test failed on nsHandleAlias\n");
+ return status;
+ }
+ Log_print0(Diags_INFO, "Deleting nsHandleAlias...\n");
+ NameServer_delete(&nsHandleAlias);
+
+ iteration++;
+ if (iteration < 2) {
+ goto again;
+ }
+
+// Log_print0(Diags_INFO, "Calling NameServer_destroy()...\n");
+// NameServer_destroy();
+
+ Log_print1(Diags_INFO, "Leaving NameServerApp_startup: status = 0x%x\n", status);
+
+ return status;
+}
+
+
+Int
+NameServerApp_execute()
+{
+ Int32 status = 0;
+
+ Log_print0(Diags_INFO, "Entered NameServerApp_execute\n");
+
+ Log_print0(Diags_INFO, "Leaving NameServerApp_execute\n\n");
+
+ return status;
+}
+
+Int
+NameServerApp_shutdown()
+{
+ Int32 status = 0;
+
+ Log_print0(Diags_INFO, "Entered NameServerApp_shutdown()\n");
+
+/* status = Ipc_stop();
+ if (status < 0) {
+ Log_print1(Diags_INFO, "Ipc_stop failed: status = %d\n", status);
+ }
+*/
+ Log_print0(Diags_INFO, "Leave NameServerApp_shutdown()\n");
+
+ return status;
+}
+
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+ Registry_Result result;
+
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "smain";
+ taskParams.stackSize = 0x1000;
+ Task_create(smain, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
+
+Void smain (UArg arg0, UArg arg1)
+{
+ int status = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");
+
+ /* turn on Diags_INFO trace */
+ Diags_setMask("Server+F");
+
+ status = NameServerApp_startup();
+ if (status < 0) {
+ goto leave;
+ }
+
+ status = NameServerApp_execute();
+ if (status < 0) {
+ goto leave;
+ }
+
+ status = NameServerApp_shutdown();
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
+ return;
+}
diff --git a/packages/ti/ipc/tests/gatempapp.c b/packages/ti/ipc/tests/gatempapp.c
--- /dev/null
@@ -0,0 +1,457 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * ======== gatempapp.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Registry.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/GateMP.h>
+
+/* sytem header files */
+#include <stdlib.h>
+
+/* local header files */
+#include "gatempapp_rsc_table_vayu_dsp.h"
+#include "GateMPAppCommon.h"
+
+#define PHYSICAL_OFFSET 0xBA300000 /* base physical address of shared mem */
+#define VIRTUAL_OFFSET 0x80000000 /* base virtual address of shared mem */
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; /* host processor id */
+ MessageQ_Handle slaveQue; /* created locally */
+ GateMP_Handle hostGateMPHandle; /* host created gate */
+ GateMP_Handle slaveGateMPHandle; /* slave created gate */
+} Server_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+
+/* private functions */
+static Void smain(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+ Module.slaveQue = NULL;
+ Module.hostGateMPHandle = NULL;
+ Module.slaveGateMPHandle = NULL;
+}
+
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ GateMP_Params gateParams;
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+ /* create GateMP */
+ GateMP_Params_init(&gateParams);
+
+ gateParams.name = GATEMP_SLAVE_NAME;
+ gateParams.localProtect = GateMP_LocalProtect_PROCESS;
+ gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+
+ Module.slaveGateMPHandle = GateMP_create (&gateParams);
+
+ if (Module.slaveGateMPHandle == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ Log_print0(Diags_INFO, "Server_create: Failed to create GateMP");
+ goto leave;
+ }
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.slaveQue = MessageQ_create(GateMPApp_SlaveMsgQueName, &msgqParams);
+
+ if (Module.slaveQue == NULL) {
+ status = -1;
+ Log_print0(Diags_INFO, "Server_create: Failed to create MessageQ");
+ GateMP_delete(&Module.slaveGateMPHandle);
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: Slave is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
+ return (status);
+}
+
+
+
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ GateMPApp_Msg * msg;
+ MessageQ_QueueId queId;
+ UInt32 physAddr;
+ volatile UInt32 * intPtr = 0;
+ Int num = 0;
+ UInt i = 0;
+ IArg gateKey = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SPTR_ADDR) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* Get physical address of shared memory */
+ physAddr = msg->payload;
+
+ /* translate the physical address to slave virtual addr */
+ intPtr = (volatile UInt32 *)(physAddr - PHYSICAL_OFFSET + VIRTUAL_OFFSET);
+
+ /* process the message */
+ //Log_print1(Diags_INFO, "Server_exec: processed cmd=0x%x", msg->cmd);
+ /* send message back */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ msg->cmd = GATEMPAPP_CMD_SPTR_ADDR_ACK;
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+
+ Log_print0(Diags_INFO,"Server_exec: Modifying shared variable "
+ "value");
+
+ /* open host-created GateMP */
+ do {
+ status = GateMP_open(GATEMP_HOST_NAME, &Module.hostGateMPHandle);
+ } while (status == GateMP_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("Server_exec: Failed to open host-created GateMP");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_exec: Opened GateMP successfully");
+
+ Log_print0(Diags_INFO,"Server_exec: Using host-created gate");
+ for (i = 0;i < LOOP_ITR; i++) {
+
+ /* modify the shared variable as long as no one else is currently
+ * accessing it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.hostGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if ( rand() % 2) {
+ *intPtr -= 1;
+ }
+ else {
+ *intPtr += 1;
+ }
+
+ /* copy shared variable value */
+ num = *intPtr;
+
+ Log_print2(Diags_INFO, "Server_exec: Current shared variable "
+ "value %d, read value=%d", *intPtr, num);
+
+ if (*intPtr != num) {
+ Log_print0(Diags_INFO, "Server_exec: mismatch in variable value." \
+ "Test failed.");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* leave Gate */
+ GateMP_leave(Module.hostGateMPHandle, gateKey);
+ }
+
+ /* wait for sync message before we switch gates */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SYNC) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ queId = MessageQ_getReplyQueue(msg);
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+
+ Log_print0(Diags_INFO,"Server_exec: Using slave-created gate");
+
+ for (i = 0;i < LOOP_ITR; i++) {
+
+ /* modify the shared variable as long as no one else is currently
+ * accessing it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.slaveGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if ( rand() % 2) {
+ *intPtr -= 1;
+ }
+ else {
+ *intPtr += 1;
+ }
+
+ /* copy shared variable value */
+ num = *intPtr;
+
+ Log_print2(Diags_INFO, "Server_exec: Current "
+ "value=%d, read value=%d", *intPtr, num);
+
+ if (*intPtr != num) {
+ Log_print0(Diags_INFO, "Server_exec: mismatch in variable value." \
+ "Test failed.");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* leave Gate */
+ GateMP_leave(Module.slaveGateMPHandle, gateKey);
+ }
+
+leave:
+ if (Module.hostGateMPHandle) {
+ GateMP_close(&Module.hostGateMPHandle);
+ }
+
+ Log_print1(Diags_EXIT, "<-- Server_exec: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Server_delete ========
+ */
+Int Server_delete()
+{
+ Int status;
+ GateMPApp_Msg * msg;
+ MessageQ_QueueId queId;
+
+ Log_print0(Diags_ENTRY, "--> Server_delete:");
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+ Log_print0(Diags_ENTRY, "--> Server_delete: got msg");
+ if (msg->cmd != GATEMPAPP_CMD_SHUTDOWN) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* close host GateMP */
+ GateMP_close(&Module.hostGateMPHandle);
+ Log_print0(Diags_ENTRY, "Server_delete: host GateMP closed");
+
+ /* send message back to say that GateMP has been cleaned up */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ msg->cmd = GATEMPAPP_CMD_SHUTDOWN_ACK;
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+
+ /* delete the video message queue */
+ status = MessageQ_delete(&Module.slaveQue);
+ if (status < 0) {
+ Log_print0(Diags_ENTRY, "Server_delete: MessageQ_delete failed");
+ goto leave;
+ }
+
+ Log_print0(Diags_ENTRY, "Server_delete: MessageQ deleted");
+
+ /* delete slave GateMP */
+ status = GateMP_delete(&Module.slaveGateMPHandle);
+ if (status < 0) {
+ Log_print0(Diags_ENTRY, "Server_delete: GateMP_delete failed");
+ goto leave;
+ }
+
+ Log_print0(Diags_ENTRY, "Server_delete: slave GateMP deleted");
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_delete: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- Server_delete: %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+/*
+ * ======== Server_exit ========
+ */
+
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "smain";
+ taskParams.stackSize = 0x1000;
+ Task_create(smain, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
+
+
+/*
+ * ======== smain ========
+ */
+Void smain(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");
+
+ /* initialize modules */
+ Server_init();
+
+ /* turn on Diags_INFO trace */
+ Diags_setMask("Server+F");
+
+ /* server setup phase */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* finalize modules */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
+ return;
+}
diff --git a/packages/ti/ipc/tests/gatempapp.cfg b/packages/ti/ipc/tests/gatempapp.cfg
--- /dev/null
@@ -0,0 +1,194 @@
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+xdc.loadPackage('ti.sdo.ipc.family.vayu');
+xdc.useModule('ti.sdo.ipc.family.vayu.InterruptDsp');
+xdc.loadPackage('ti.ipc.rpmsg');
+xdc.loadPackage('ti.ipc.family.vayu');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.loadPackage('ti.ipc.ipcmgr');
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+BIOS.addUserStartupFunction('&IpcMgr_callIpcStart');
+
+/* describe the processors in the system */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig("DSP1", ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);
+
+/* GateMP host support */
+var GateMP = xdc.useModule('ti.sdo.ipc.GateMP');
+GateMP.hostSupport = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: MultiProc.getIdMeta("DSP1"),
+ cacheEnable: true,
+ isValid: true
+ })
+);
+
+/* Override the default resource table with my own to add SR0 */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.customTable = true;
+
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(0xa0000000, 0x02000000, Cache.Mar_DISABLE);
+var L1cache = new Cache.Size();
+L1cache.l1dSize = Cache.L1Size_0K;
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+
+
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
+var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapSize = 0x20000;
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+//MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = "EXT_CODE"
+
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x10000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_NULL;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+
+/* Skip the Timer frequency verification check. Need to remove this later */
+Timer.checkFrequency = false;
+
+/* Match this to the SYS_CLK frequency sourcing the dmTimers.
+ * Not needed once the SYS/BIOS family settings is updated. */
+Timer.intFreq.hi = 0;
+Timer.intFreq.lo = 19200000;
+
+
+/*
+ * ======== Power Management Configuration ========
+ */
+/* Modules used in Power Management */
+xdc.loadPackage('ti.pm');
+
+/* Idle function that periodically flushes the unicache */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+/* Enable Logger: */
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
+var Text = xdc.useModule('xdc.runtime.Text');
+Text.isLoaded = true;
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+ Diags.INFO|Diags.USER1|Diags.STATUS, Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg",
+ Diags.INFO, Diags.ALWAYS_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.ALWAYS_ON;
+Registry.common$.diags_USER1 = Diags.ALWAYS_ON;
+Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
+Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
+
+VirtioSetup.common$.diags_INFO = Diags.ALWAYS_ON;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+/* enable exception callstack backtrace */
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+if (Program.build.profile == "debug") {
+ Hwi.enableException = true;
+}
diff --git a/packages/ti/ipc/tests/gatempapp_rsc_table_vayu_dsp.h b/packages/ti/ipc/tests/gatempapp_rsc_table_vayu_dsp.h
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * ======== gatempapp_rsc_table_vayu_dsp.h ========
+ *
+ * Define the resource table entries for all DSP cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_DSP_H_
+#define _RSC_TABLE_DSP_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* DSP Memory Map */
+#define L4_44XX_BASE 0x4A000000
+
+#define L4_PERIPHERAL_L4CFG (L4_44XX_BASE)
+#define DSP_PERIPHERAL_L4CFG 0x4A000000
+
+#define L4_PERIPHERAL_L4PER 0x48000000
+#define DSP_PERIPHERAL_L4PER 0x48000000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define DSP_PERIPHERAL_L4EMU 0x54000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define DSP_PERIPHERAL_DMM 0x4E000000
+
+#define L3_PERIPHERAL_ISS 0x52000000
+#define DSP_PERIPHERAL_ISS 0x52000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define DSP_TILER_MODE_0_1 0x60000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define DSP_TILER_MODE_2 0x70000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define DSP_TILER_MODE_3 0x78000000
+
+#define DSP_MEM_TEXT 0x95000000
+/* Co-locate alongside TILER region for easier flushing */
+#define DSP_MEM_IOBUFS 0x80000000
+#define DSP_MEM_DATA 0x95100000
+#define DSP_MEM_HEAP 0x95200000
+
+//0x85900000
+#define DSP_SR0_VIRT 0xBFC00000
+#define DSP_SR0 0xBFC00000
+
+#define DSP_MEM_IPC_DATA 0x9F000000
+#define DSP_MEM_IPC_VRING 0xA0000000
+#define DSP_MEM_RPMSG_VRING0 0xA0000000
+#define DSP_MEM_RPMSG_VRING1 0xA0004000
+#define DSP_MEM_VRING_BUFS0 0xA0040000
+#define DSP_MEM_VRING_BUFS1 0xA0080000
+
+#define DSP_MEM_IPC_VRING_SIZE SZ_1M
+#define DSP_MEM_IPC_DATA_SIZE SZ_1M
+#define DSP_MEM_TEXT_SIZE SZ_1M
+#define DSP_MEM_DATA_SIZE SZ_1M
+#define DSP_MEM_HEAP_SIZE (SZ_1M * 3)
+#define DSP_MEM_IOBUFS_SIZE (SZ_1M * 89)
+#define DSP_SR0_SIZE (SZ_1M * 1)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ */
+/* This address is derived from current IPU & ION carveouts */
+#ifdef OMAP5
+#define PHYS_MEM_IPC_VRING 0x95000000
+#else
+#define PHYS_MEM_IPC_VRING 0x98800000
+#endif
+
+/* Need to be identical to that of IPU */
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define DSP_RPMSG_VQ0_SIZE 256
+#define DSP_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_DSP_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[17]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* heap carveout entry */
+ struct fw_rsc_carveout heap_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 17, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, heap_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_DSP_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { DSP_MEM_RPMSG_VRING0, 4096, DSP_RPMSG_VQ0_SIZE, 1, 0 },
+ { DSP_MEM_RPMSG_VRING1, 4096, DSP_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_TEXT, 0,
+ DSP_MEM_TEXT_SIZE, 0, 0, "DSP_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_DATA, 0,
+ DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_HEAP, 0,
+ DSP_MEM_HEAP_SIZE, 0, 0, "DSP_MEM_HEAP",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_IPC_DATA, 0,
+ DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:dsp",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ DSP_MEM_IPC_VRING_SIZE, 0, 0, "DSP_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ DSP_MEM_IOBUFS_SIZE, 0, 0, "DSP_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "DSP_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER, L4_PERIPHERAL_L4PER,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4PER",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "DSP_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_ISS, L3_PERIPHERAL_ISS,
+ SZ_256K, 0, 0, "DSP_PERIPHERAL_ISS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_SR0_VIRT, DSP_SR0,
+ DSP_SR0_SIZE, 0, 0, "DSP_SR0",
+ },
+
+};
+
+#endif /* _RSC_TABLE_DSP_H_ */
index 9e229deed8e892ea1414520036a7a1b6b39dcde2..c86c4e7391e3499cab723e05525901bc57245ad2 100644 (file)
Char localQueueName[64];
UInt16 procId;
Int status;
- UInt16 msgId;
+ UInt32 i;
+ UInt32 msgId;
UInt32 start;
UInt32 end;
Uint32 numLoops;
MessageQ_put(remoteQueueId, msg);
start = Clock_getTicks();
- for (msgId = 0; msgId < numLoops; msgId++) {
+
+ for (i = 1; i <= numLoops; i++) {
status = MessageQ_get(messageQ, &msg, MessageQ_FOREVER);
Assert_isTrue(status == MessageQ_S_SUCCESS, NULL);
+ params = MessageQ_payload(msg);
+ msgId = params[0];
+
if (print) {
System_printf("Got msg #%d (%d bytes) from procId %d\n",
- MessageQ_getMsgId(msg), MessageQ_getMsgSize(msg), procId);
+ msgId, MessageQ_getMsgSize(msg), procId);
}
- Assert_isTrue(MessageQ_getMsgId(msg) == msgId, NULL);
+ Assert_isTrue(msgId == i, NULL);
if (print) {
- System_printf("Sending msg Id #%d to procId %d\n", msgId,
- procId);
+ System_printf("Sending msg Id #%d to procId %d\n", i, procId);
}
status = MessageQ_put(remoteQueueId, msg);
Assert_isTrue(status == MessageQ_S_SUCCESS, NULL);
}
+
end = Clock_getTicks();
if (!print) {
System_printf("%d iterations took %d ticks or %d usecs/msg\n",
- numLoops,
- end - start, ((end - start) * Clock_tickPeriod) / numLoops);
+ numLoops, end - start,
+ ((end - start) * Clock_tickPeriod) / numLoops);
}
}
}
index b22135c4c0e9c186769030cab028746d74d606ad..605446b0dd1b911838560663d32f2d5a33e1ce07 100644 (file)
/* IPC Headers */
#include <ti/ipc/Std.h>
-#include <ti/ipc/Ipc.h>
#if defined(SYSLINK_BUILDOS_QNX)
+#include <ti/ipc/Ipc.h>
#include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
+#else /* Linux HLOS */
+#include <omap/omap_drm.h>
+#include <libdrm/omap_drmif.h>
+#include <errno.h>
+#include <string.h>
#endif
#include "Mx.h"
#define PROC_ID_DFLT 1
/*
- * ======== main ========
+ * These callCompute() functions separated per HLOS due to very different
+ * HLOS specific shared memory buffer allocation methods.
*/
-int main(int argc, char **argv)
+
+#if defined(SYSLINK_BUILDOS_QNX)
+
+static int callCompute_QnX()
{
- int status;
- int i;
- int32_t ret;
- uint32_t val;
- UInt16 procId = PROC_ID_DFLT;
Mx_Compute *compute;
-#if defined(SYSLINK_BUILDOS_QNX)
shm_buf shmCompute, shmInBuf, shmOutBuf;
-#endif
+ int status = 0;
+ int size;
+ int32_t ret;
+ uint32_t val;
+ int i;
- printf("mmrpc_test: --> main\n");
+ /* allocate a compute structure in shared memory */
+ SHM_alloc(sizeof(Mx_Compute), &shmCompute);
+ compute = (Mx_Compute *)(shmCompute.vir_addr);
- /* Parse Args: */
- switch (argc) {
- case 1:
- /* use defaults */
- break;
- case 2:
- procId = atoi(argv[1]);
- break;
- default:
- printf("Usage: %s [<ProcId>]\n", argv[0]);
- printf("\tDefaults: ProcId: %d\n", PROC_ID_DFLT);
- exit(0);
+ if (compute == NULL) {
+ /* temporary: memory alloc not implemented on Linux */
+ fprintf(stderr, "failed to map omap_bo to user space\n");
+ goto leave;
}
- /* Need to start IPC for MultiProc */
- status = Ipc_start();
- if (status < 0) {
- printf("Ipc_start failed: status = %d\n", status);
- return (0);
- }
+ /* initialize compute structure */
+ compute->coef = 0x80400000;
+ compute->key = 0xABA0;
+ compute->size = 0x1000;
+ compute->inBuf = NULL;
+ compute->outBuf = NULL;
- /* initialize Mx module (setup rpc connection) */
- status = Mx_initialize(procId);
+ /* allocate an input buffer in shared memory */
+ size = compute->size * sizeof(uint32_t);
+ SHM_alloc(size, &shmInBuf);
+ compute->inBuf = (uint32_t *)(shmInBuf.vir_addr);
- if (status < 0) {
+ if (compute->inBuf == NULL) {
+ printf("mmrpc_test: Error: compute->inBuf == NULL\n");
+ status = -1;
goto leave;
}
- /* invoke Mx functions */
- ret = Mx_triple(11);
- printf("mmrpc_test: Mx_triple(11), ret=%d\n", ret);
+ /* fill input buffer with seed value */
+ for (i = 0; i < compute->size; i++) {
+ compute->inBuf[i] = 0x2010;
+ }
- if (ret < 0) {
+ /* allocate an output buffer in shared memory */
+ SHM_alloc(size, &shmOutBuf);
+ compute->outBuf = (uint32_t *)(shmOutBuf.vir_addr);
+
+ if (compute->outBuf == NULL) {
+ printf("mmrpc_test: Error: compute->outBuf == NULL\n");
status = -1;
goto leave;
}
- ret = Mx_triple(111);
- printf("mmrpc_test: Mx_triple(111), ret=%d\n", ret);
+ /* clear output buffer */
+ for (i = 0; i < compute->size; i++) {
+ compute->outBuf[i] = 0;
+ }
+
+ /* print some debug info */
+ printf("mmrpc_test: calling Mx_compute(0x%x)\n", (unsigned int)compute);
+ printf("mmrpc_test: compute->coef=0x%x\n", compute->coef);
+ printf("mmrpc_test: compute->key=0x%x\n", compute->key);
+ printf("mmrpc_test: compute->size=0x%x\n", compute->size);
+ printf("mmrpc_test: compute->inBuf=0x%x\n", (unsigned int)compute->inBuf);
+ printf("mmrpc_test: compute->outBuf=0x%x\n", (unsigned int)compute->outBuf);
+
+ /* process the buffer */
+ ret = Mx_compute_QnX(compute);
if (ret < 0) {
status = -1;
+ printf("mmrpc_test: Error: Mx_Compute() failed\n");
goto leave;
}
- ret = Mx_add(44, 66);
- printf("mmrpc_test: Mx_add(44, 66), ret=%d\n", ret);
+ printf("mmrpc_test: after Mx_compute(0x%x)\n", (unsigned int)compute);
+ printf("mmrpc_test: compute->coef=0x%x\n", compute->coef);
+ printf("mmrpc_test: compute->key=0x%x\n", compute->key);
+ printf("mmrpc_test: compute->size=0x%x\n", compute->size);
+ printf("mmrpc_test: compute->inBuf=0x%x\n", (unsigned int)compute->inBuf);
+ printf("mmrpc_test: compute->outBuf=0x%x\n", (unsigned int)compute->outBuf);
+ printf("mmrpc_test: compute->inBuf[0]=0x%x\n",
+ (unsigned int)compute->inBuf[0]);
+ printf("mmrpc_test: compute->outBuf[0]=0x%x\n",
+ (unsigned int)compute->outBuf[0]);
- if (ret < 0) {
- status = -1;
+ /* check the output buffer */
+ for (i = 0; i < compute->size; i++) {
+ val = compute->outBuf[i] | compute->coef;
+ if (compute->outBuf[i] != val) {
+ status = -1;
+ printf("mmrpc_test: Error: incorrect outBuf\n");
+ break;
+ }
+ }
+
+leave:
+ SHM_release(&shmOutBuf);
+ SHM_release(&shmInBuf);
+ SHM_release(&shmCompute);
+
+ return (status);
+}
+
+#else /* Linux */
+
+static int callCompute_Linux()
+{
+ Mx_Compute *compute = NULL;
+ int drmFd = 0;
+ struct omap_device *dev = NULL;
+ struct omap_bo *compute_bo = NULL;
+ struct omap_bo *inBuf_bo = NULL;
+ struct omap_bo *outBuf_bo = NULL;
+ uint32_t * inBufPtr = NULL;
+ uint32_t * outBufPtr = NULL;
+ int status = 0;
+ int size;
+ uint32_t val;
+ int i;
+ int32_t ret;
+
+ /* On Linux, use omapdrm driver to get a Tiler buffer for shared memory */
+ drmFd = drmOpen("omapdrm", NULL);
+
+ if (drmFd < 0) {
+ fprintf(stderr, "could not open omapdrm device: %d: %s\n",
+ errno, strerror(errno));
+ return 1;
+ }
+
+ dev = omap_device_new(drmFd);
+ if (!dev) {
+ fprintf(stderr, "could not get device from fd\n");
goto leave;
}
- /* allocate a compute structure in shared memory */
-#if defined(SYSLINK_BUILDOS_QNX)
- SHM_alloc(sizeof(Mx_Compute), &shmCompute);
- compute = (Mx_Compute *)(shmCompute.vir_addr);
-#else
- compute = NULL;
-#endif
+ /* allocate a compute structure in shared memory and get a pointer */
+ compute_bo = omap_bo_new(dev, sizeof(Mx_Compute), OMAP_BO_CACHED);
+ if (compute_bo) {
+ compute = (Mx_Compute *)omap_bo_map(compute_bo);
+ }
+ else {
+ fprintf(stderr, "failed to allocate omap_bo\n");
+ }
if (compute == NULL) {
- /* temporary: memory alloc not implemented on Linux */
+ fprintf(stderr, "failed to map omap_bo to user space\n");
goto leave;
}
compute->outBuf = NULL;
/* allocate an input buffer in shared memory */
-#if defined(SYSLINK_BUILDOS_QNX)
- SHM_alloc(compute->size * sizeof(uint32_t), &shmInBuf);
- compute->inBuf = (uint32_t *)(shmInBuf.vir_addr);
-#else
-/* compute->inBuf = ...; */
-#endif
+ size = compute->size * sizeof(uint32_t);
+ inBuf_bo = omap_bo_new(dev, size, OMAP_BO_CACHED);
+ if (inBuf_bo) {
+ inBufPtr = (uint32_t *)omap_bo_map(inBuf_bo);
+ }
+ else {
+ fprintf(stderr, "failed to allocate inBuf_bo\n");
+ }
- if (compute->inBuf == NULL) {
- printf("mmrpc_test: Error: inBuf == NULL\n");
+ if (inBufPtr == NULL) {
+ printf("mmrpc_test: Error: inBufPtr == NULL\n");
status = -1;
goto leave;
}
/* fill input buffer with seed value */
for (i = 0; i < compute->size; i++) {
- compute->inBuf[i] = 0x2010;
+ inBufPtr[i] = 0x2010;
}
/* allocate an output buffer in shared memory */
-#if defined(SYSLINK_BUILDOS_QNX)
- SHM_alloc(compute->size * sizeof(uint32_t), &shmOutBuf);
- compute->outBuf = (uint32_t *)(shmOutBuf.vir_addr);
-#else
-/* compute->outBuf = ...; */
-#endif
+ outBuf_bo = omap_bo_new(dev, size, OMAP_BO_CACHED);
+ if (outBuf_bo) {
+ outBufPtr = (uint32_t *)omap_bo_map(outBuf_bo);
+ }
+ else {
+ fprintf(stderr, "failed to allocate outBuf_bo handle\n");
+ }
- if (compute->outBuf == NULL) {
- printf("mmrpc_test: Error: outBuf == NULL\n");
+ if (outBufPtr == NULL) {
+ printf("mmrpc_test: Error: outBufPtr == NULL\n");
status = -1;
goto leave;
}
/* clear output buffer */
for (i = 0; i < compute->size; i++) {
- compute->outBuf[i] = 0;
+ outBufPtr[i] = 0;
}
+ compute->inBuf = (uint32_t *)inBufPtr;
+ compute->outBuf = (uint32_t *)outBufPtr;
+
/* print some debug info */
printf("mmrpc_test: calling Mx_compute(0x%x)\n", (unsigned int)compute);
printf("mmrpc_test: compute->coef=0x%x\n", compute->coef);
printf("mmrpc_test: compute->outBuf=0x%x\n", (unsigned int)compute->outBuf);
/* process the buffer */
- ret = Mx_compute(compute);
+ ret = Mx_compute_Linux(compute, omap_bo_dmabuf(compute_bo),
+ omap_bo_dmabuf(inBuf_bo),
+ omap_bo_dmabuf(outBuf_bo));
if (ret < 0) {
status = -1;
/* check the output buffer */
for (i = 0; i < compute->size; i++) {
- val = compute->outBuf[i] | compute->coef;
- if (compute->outBuf[i] != val) {
+ val = outBufPtr[i] | compute->coef;
+ if (outBufPtr[i] != val) {
status = -1;
printf("mmrpc_test: Error: incorrect outBuf\n");
break;
}
}
- /* free resources */
+leave:
+ if (outBuf_bo) {
+ omap_bo_del(outBuf_bo);
+ }
+ if (inBuf_bo) {
+ omap_bo_del(inBuf_bo);
+ }
+ if (compute_bo) {
+ omap_bo_del(compute_bo);
+ }
+ if (dev) {
+ omap_device_del(dev);
+ }
+ if (drmFd) {
+ close(drmFd);
+ }
+
+ return (status);
+}
+#endif
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char **argv)
+{
+ int status;
+ int32_t ret;
+ UInt16 procId = PROC_ID_DFLT;
+
+ printf("mmrpc_test: --> main\n");
+
+ /* Parse Args: */
+ switch (argc) {
+ case 1:
+ /* use defaults */
+ break;
+ case 2:
+ procId = atoi(argv[1]);
+ break;
+ default:
+ printf("Usage: %s [<ProcId>]\n", argv[0]);
+ printf("\tDefaults: ProcId: %d\n", PROC_ID_DFLT);
+ exit(0);
+ }
+
#if defined(SYSLINK_BUILDOS_QNX)
- SHM_release(&shmOutBuf);
- SHM_release(&shmInBuf);
- SHM_release(&shmCompute);
+ /* Need to start IPC for MultiProc */
+ status = Ipc_start();
+ if (status < 0) {
+ printf("Ipc_start failed: status = %d\n", status);
+ return (0);
+ }
+#endif
+
+ /* initialize Mx module (setup rpc connection) */
+ status = Mx_initialize(procId);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* invoke Mx functions */
+ ret = Mx_triple(11);
+ printf("mmrpc_test: Mx_triple(11), ret=%d\n", ret);
+
+ if (ret < 0) {
+ status = -1;
+ goto leave;
+ }
+
+ ret = Mx_triple(111);
+ printf("mmrpc_test: Mx_triple(111), ret=%d\n", ret);
+
+ if (ret < 0) {
+ status = -1;
+ goto leave;
+ }
+
+ ret = Mx_add(44, 66);
+ printf("mmrpc_test: Mx_add(44, 66), ret=%d\n", ret);
+
+ if (ret < 0) {
+ status = -1;
+ goto leave;
+ }
+
+#if defined(SYSLINK_BUILDOS_QNX)
+ ret = callCompute_QnX();
#else
-/* ... */
+ ret = callCompute_Linux();
#endif
+ if (ret < 0) {
+ status = -1;
+ }
leave:
+
/* finalize Mx module (destroy rpc connection) */
Mx_finalize();
+#if defined(SYSLINK_BUILDOS_QNX)
Ipc_stop();
+#endif
if (status < 0) {
printf("mmrpc_test: FAILED\n");
index 707c3b0feedb66a0ae71529f664a2913b6acac65..9abc3d07c891c4851fc626d5a28b675929c218b4 100644 (file)
stackMemory: "EXT_DATA",
};
-/* Memory Map for ti.platforms.evmDRA7XX:dsp1
+/* Shared region definition used in GateMP app */
+var evmDRA7XX_SR_0 = {
+ name: "SR_0", space: "data", access: "RWX",
+ base: 0xBFC00000, len: 0x100000,
+ comment: "SR#0 Memory (1 MB)"
+};
+
+/* Memory Map for ti.platforms.evmDRA7XX:dsp1 and ti.platforms.evmDRA7XX:dsp2
*
* --- External Memory ---
* Virtual Physical Size Comment
* ------------------------------------------------------------------------
- * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
- * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
- * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9500_4000 ????_???? 10_0000 ( ~1 MB) EXT_CODE
+ * 9510_0000 ????_???? 10_0000 ( 1 MB) EXT_DATA
+ * 9520_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
* 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
* 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
* 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
*/
-var evmDRA7XX_ExtMemMapDsp1 = {
+var evmDRA7XX_ExtMemMapDsp = {
EXT_CODE: {
name: "EXT_CODE",
base: 0x95000000,
len: 0x00020000,
space: "data",
access: "RWX" /* should this have execute perm? */
+ },
+ SR_0: {
+ name: evmDRA7XX_SR_0.name,
+ base: evmDRA7XX_SR_0.base,
+ len: evmDRA7XX_SR_0.len,
+ space: "data",
+ access: "RW"
}
};
Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
externalMemoryMap: [
- [ "EXT_CODE", evmDRA7XX_ExtMemMapDsp1.EXT_CODE ],
- [ "EXT_DATA", evmDRA7XX_ExtMemMapDsp1.EXT_DATA ],
- [ "EXT_HEAP", evmDRA7XX_ExtMemMapDsp1.EXT_HEAP ],
- [ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp1.TRACE_BUF ],
- [ "EXC_DATA", evmDRA7XX_ExtMemMapDsp1.EXC_DATA ],
- [ "PM_DATA", evmDRA7XX_ExtMemMapDsp1.PM_DATA ]
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ],
+ [ evmDRA7XX_SR_0.name, evmDRA7XX_ExtMemMapDsp.SR_0 ],
],
codeMemory: "EXT_CODE",
dataMemory: "EXT_DATA",
stackMemory: "EXT_DATA",
};
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] =
+ Build.platformTable["ti.platforms.evmDRA7XX:dsp1"];
+
/* Memory Map for ti.platforms.evmDRA7XX:ipu2
stackMemory: "EXT_DATA",
};
+/* Memory Map for ti.platforms.evmDRA7XX:ipu1
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? F_C000 ( ~1 MB) EXT_CODE
+ * 8000_0000 ????_???? 20_0000 ( 2 MB) EXT_DATA
+ * 8020_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu1 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x000FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00200000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu1.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu1.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu1.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu1.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu1.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu1.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
for (var i = 0; i < Build.targets.length; i++) {
var targ = Build.targets[i];
defs: extraDefs
}).addObjects(["ping_rpmsg.c"]);
+ /* gatempapp */
+ if (platform.match(/^ti\.platform\.vayu\.dsp1/) ||
+ platform.match(/^ti\.platforms\.evmDRA7XX:dsp1$/)) {
+ Pkg.addExecutable(name + "/gatempapp", targ, platform, {
+ cfgScript: "gatempapp",
+ }).addObjects(["gatempapp.c"]);
+ }
+
/* messageq_multicore - only for our homogeneous multicore platforms */
if (platform.match(/^ti\.platforms\.simKepler/) ||
(platform.match(/^ti.platforms.evmTCI6638K2K/)) ||
defs: "-D BENCHMARK " + extraDefs
}).addObjects(["messageq_single.c"]);
+ /* NameServerApp */
+ Pkg.addExecutable(name + "/NameServerApp", targ, platform, {
+ cfgScript: "rpmsg_transport",
+ }).addObjects(["NameServerApp.c"]);
+
/* nano_test - demonstrates passing ptrs using CMEM */
if (platform.match(/^ti\.platforms\.evmOMAPL138\:DSP/)) {
Pkg.addExecutable(name + "/nano_test", targ, platform, {
}).addObjects(test_omx_SRCS);
}
+ if (platform.match(/^ti\.platform\.vayu\.ipu1/) ||
+ platform.match(/^ti\.platforms\.evmDRA7XX:ipu1$/)) {
+ Pkg.addExecutable(name + "/test_omx_ipu1_vayu", targ, platform, {
+ cfgScript: "test_omx_ipu_vayu",
+ defs: "-D IPU -D VAYU -DRPMSG_NS_2_0"
+ }).addObjects(test_omx_SRCS);
+ }
if (platform.match(/^ti\.platform\.vayu\.ipu2/) ||
platform.match(/^ti\.platforms\.evmDRA7XX:ipu2$/)) {
Pkg.addExecutable(name + "/test_omx_ipu2_vayu", targ, platform, {
}).addObjects(test_omx_SRCS);
}
- if (platform.match(/^ti\.platform\.vayu\.dsp1/) ||
+ if (platform.match(/^ti\.platform\.vayu/) ||
platform.match(/^ti\.platforms\.evmDRA7XX:dsp1$/)) {
Pkg.addExecutable(name + "/test_omx_dsp1_vayu", targ, platform, {
cfgScript: "test_omx_dsp_vayu",
defs: "-D DSP -D VAYU -DRPMSG_NS_2_0"
}).addObjects(test_omx_SRCS);
}
+ if (platform.match(/^ti\.platform\.vayu/) ||
+ platform.match(/^ti\.platforms\.evmDRA7XX:dsp2$/)) {
+ Pkg.addExecutable(name + "/test_omx_dsp2_vayu", targ, platform, {
+ cfgScript: "test_omx_dsp_vayu",
+ defs: "-D DSP -D VAYU -DRPMSG_NS_2_0"
+ }).addObjects(test_omx_SRCS);
+ }
}
}
index cc0ccbc0df65bb3b5b45817da9e566e23f4a6ac2..473675056365a67ec5069e992d28d2650155382d 100644 (file)
xdc.includeFile("ti/configs/omap54xx/Dsp.cfg");
xdc.includeFile("ti/configs/omap54xx/DspAmmu.cfg");
}
-else if (Program.platformName.match(/^ti\.platform\.vayu\.ipu2/) ||
- (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
- Program.cpu.attrs.cpuCore.match(/^CM4$/))) {
+else if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
+ Program.cpu.attrs.cpuCore.match(/^CM4$/)) {
var Task = xdc.useModule('ti.sysbios.knl.Task');
var params = new Task.Params;
params.instance.name = "ping";
BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
xdc.loadCapsule("ti/configs/vayu/IpcCommon.cfg.xs");
- xdc.includeFile("ti/configs/vayu/Ipu2Smp.cfg");
+ if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX\:ipu1/)) {
+ xdc.includeFile("ti/configs/vayu/Ipu1Smp.cfg");
+ }
+ else {
+ xdc.includeFile("ti/configs/vayu/Ipu2Smp.cfg");
+ }
xdc.includeFile("ti/configs/vayu/IpuAmmu.cfg");
}
-else if (Program.platformName.match(/^ti\.platform\.vayu\.dsp1/) ||
- (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
- Program.cpu.attrs.cpuCore.match(/^6600$/))) {
+else if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
+ Program.cpu.attrs.cpuCore.match(/^6600$/)) {
var Task = xdc.useModule('ti.sysbios.knl.Task');
var params = new Task.Params;
params.instance.name = "ping";
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
- xdc.includeFile("ti/configs/vayu/Dsp1.cfg");
+ if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX\:dsp1/)) {
+ xdc.includeFile("ti/configs/vayu/Dsp1.cfg");
+ }
+ else {
+ xdc.includeFile("ti/configs/vayu/Dsp2.cfg");
+ }
}
else {
xdc.loadCapsule("ping_rpmsg_common.cfg.xs");
index c06cf0a168cc105fe62008a76c149951f28a0734..767dd7afc049e0959a6813ccfe455eb90bb44ddf 100644 (file)
{ MmType_Dir_In, MmType_PtrType(MmType_Param_U32), 1 }
}
},
- { "MxServer_compute", 1,
+ { "MxServer_compute", 2,
{
{ MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
{ MmType_Dir_In, MmType_PtrType(MmType_Param_VOID), 1 }
payload = (MmType_Param *)data;
compute = (MxServer_Compute *)payload[0].data;
+ Cache_inv(compute, sizeof(MxServer_Compute), Cache_Type_ALL, TRUE);
+
#if CHATTER
System_printf("skel_compute: compute=0x%x\n", compute);
System_printf("skel_compute: compute size=%d\n", (Int)payload[0].size);
Cache_inv(compute->outBuf, compute->size * sizeof(uint32_t),
Cache_Type_ALL, TRUE);
+#if CHATTER
+ System_printf("skel_compute: outBuf[0]=0x%x\n", compute->outBuf[0]);
+ System_printf("skel_compute: inBuf[0]=0x%x\n", compute->inBuf[0]);
+#endif
+
/* invoke the implementation function */
result = MxServer_compute(compute);
index 6809b3282b78a51c6f75d91a973855663eba38f0..bbe2fc7f13b6c79e1c58fbfffb15d48497f1a4e7 100644 (file)
xdc.includeFile("ti/configs/omap54xx/Dsp.cfg");
xdc.includeFile("ti/configs/omap54xx/DspAmmu.cfg");
}
-else if ((Program.platformName.match(/^ti\.platform\.vayu\.ipu2/)) ||
- (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
- Program.cpu.attrs.cpuCore.match(/^CM4$/))) {
+else if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
+ Program.cpu.attrs.cpuCore.match(/^CM4$/)) {
/* This initializes the MessageQ Transport RPMSG stack: */
xdc.loadPackage('ti.ipc.ipcmgr');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
VirtioSetup.common$.diags_INFO = Diags.ALWAYS_ON;
xdc.loadCapsule("ti/configs/vayu/IpcCommon.cfg.xs");
- xdc.includeFile("ti/configs/vayu/Ipu2Smp.cfg");
+ if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX\:ipu1/)) {
+ xdc.includeFile("ti/configs/vayu/Ipu1Smp.cfg");
+ }
+ else {
+ xdc.includeFile("ti/configs/vayu/Ipu2Smp.cfg");
+ }
xdc.includeFile("ti/configs/vayu/IpuAmmu.cfg");
}
-else if (Program.platformName.match(/^ti\.platform\.vayu\.dsp1/) ||
- (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
- Program.cpu.attrs.cpuCore.match(/^6600$/))) {
+else if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX/) &&
+ Program.cpu.attrs.cpuCore.match(/^6600$/)) {
/* This initializes the MessageQ Transport RPMSG stack: */
xdc.loadPackage('ti.ipc.ipcmgr');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
VirtioSetup.common$.diags_INFO = Diags.ALWAYS_ON;
- xdc.includeFile("ti/configs/vayu/Dsp1.cfg");
+ if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX\:dsp1/)) {
+ xdc.includeFile("ti/configs/vayu/Dsp1.cfg");
+ }
+ else {
+ xdc.includeFile("ti/configs/vayu/Dsp2.cfg");
+ }
}
else {
xdc.loadCapsule("messageq_common.cfg.xs");
diff --git a/packages/ti/ipc/tests/test_omx_dsp_vayu.cfg b/packages/ti/ipc/tests/test_omx_dsp_vayu.cfg
index 491f96c0110e1061e832c84262b3679f840a4146..4795b6ef36609984d8cb16392ff45b2add82438b 100644 (file)
rcmSettings.ipc = rcmSettings.IpcSupport_ti_sdo_ipc;
xdc.useModule('ti.grcm.RcmServer');
-xdc.includeFile("ti/configs/vayu/Dsp1.cfg");
+if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX\:dsp1/)) {
+ xdc.includeFile("ti/configs/vayu/Dsp1.cfg");
+}
+else {
+ xdc.includeFile("ti/configs/vayu/Dsp2.cfg");
+}
var Task = xdc.useModule('ti.sysbios.knl.Task');
Task.defaultStackSize = 12 * 0x400;
diff --git a/packages/ti/ipc/tests/test_omx_ipu_vayu.cfg b/packages/ti/ipc/tests/test_omx_ipu_vayu.cfg
index 844e2605d3a68cbbb424f22eb0026838adf86ba2..fd50568cb75f20ae8824a928459cae567bd112d7 100644 (file)
xdc.useModule('ti.grcm.RcmServer');
xdc.loadCapsule("ti/configs/vayu/IpcCommon.cfg.xs");
-xdc.loadCapsule("ti/configs/vayu/Ipu2Smp.cfg");
+if (Program.platformName.match(/^ti\.platforms\.evmDRA7XX\:ipu1/)) {
+ xdc.includeFile("ti/configs/vayu/Ipu1Smp.cfg");
+}
+else {
+ xdc.includeFile("ti/configs/vayu/Ipu2Smp.cfg");
+}
xdc.loadCapsule("ti/configs/vayu/IpuAmmu.cfg");
var Task = xdc.useModule('ti.sysbios.knl.Task');
diff --git a/packages/ti/platform/vayu/dsp1/package.bld b/packages/ti/platform/vayu/dsp1/package.bld
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012-2013, 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 generated by platform wizard.
- *
- */
-
-Pkg.attrs.exportAll = true;
index f52d873dafeedf22fb08ab12a7da6bde3d273f8d..325ad1bc1d294b1e31d9ae65aca57530ffb78f80 100644 (file)
#include <ti/pm/IpcPower.h>
#include "_IpcPower.h"
-#define MASTERCORE 1
-#define NO_MASTERCORE 0
-#define CPU_COPY -1
+#define MASTERCORE (1)
+#define NO_MASTERCORE (0)
+#define CPU_COPY (-1)
#define REG32(A) (*(volatile UInt32 *) (A))
#define SET_DEEPSLEEP (REG32(M3_SCR_REG) | (1 << DEEPSLEEP_BIT))
index 2b0043613fdb8a9c979fd998f1ebf1fb9fe3a743..bf3cd8553b903b21840a372393f1f430bf09f56d 100644 (file)
* @def IpcPower_S_SUCCESS
* @brief Operation is successful.
*/
-#define IpcPower_S_SUCCESS 0
+#define IpcPower_S_SUCCESS (0)
/*!
* @def IpcPower_E_FAIL
* @brief Operation is not successful.
*/
-#define IpcPower_E_FAIL -1
+#define IpcPower_E_FAIL (-1)
/*!
* @def IpcPower_E_MEMORY
* @brief Operation resulted in memory failure.
*/
-#define IpcPower_E_MEMORY -2
+#define IpcPower_E_MEMORY (-2)
/*!
* @brief Event types for power management callbacks
index f53e84554239450acac0cede8d6988a8b79eb43b..e4bb004ba0612e2a2dec6e9aca453e3ddaaf298b 100644 (file)
{
SharedRegion_SRPtr sharedShmBase;
Int status;
+ ti_sdo_ipc_GateMP_Object *obj;
+ ti_sdo_ipc_GateMP_Params params;
+ Error_Block eb;
+ UInt key;
UInt32 len;
+ UInt32 mask;
+ UInt32 resourceId;
Ptr sharedAddr;
- UInt32 nsValue[2];
+ UInt32 nsValue[4];
+
+ Error_init(&eb);
/* Assert that a pointer has been supplied */
Assert_isTrue(handlePtr != NULL, ti_sdo_ipc_Ipc_A_nullArgument);
* from a local heap so don't do SharedRegion Ptr conversion.
*/
sharedAddr = (Ptr)nsValue[0];
+ status = GateMP_openByAddr(sharedAddr, handlePtr);
}
- else {
+ else if (GateMP_module->hostSupport == FALSE) {
/* Opening a remote GateMP. Need to do SharedRegion Ptr conversion. */
sharedShmBase = (SharedRegion_SRPtr)nsValue[0];
sharedAddr = SharedRegion_getPtr(sharedShmBase);
+ status = GateMP_openByAddr(sharedAddr, handlePtr);
}
+ else {
+ /* need to track number of opens atomically */
+ key = Hwi_disable();
+ resourceId = nsValue[2];
+ mask = nsValue[3];
+
+ /* Remote case */
+ switch (GETREMOTE(mask)) {
+ case GateMP_RemoteProtect_SYSTEM:
+ obj = GateMP_module->remoteSystemGates[resourceId];
+ break;
+
+ case GateMP_RemoteProtect_CUSTOM1:
+ obj = GateMP_module->remoteCustom1Gates[resourceId];
+ break;
+
+ case GateMP_RemoteProtect_CUSTOM2:
+ obj = GateMP_module->remoteCustom2Gates[resourceId];
+ break;
- status = GateMP_openByAddr(sharedAddr, handlePtr);
+ default:
+ obj = NULL;
+ status = GateMP_E_FAIL;
+ break;
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ /*
+ * If the object is NULL, then it must have been created on a
+ * remote processor. Need to create a local object. This is
+ * accomplished by setting the openFlag to TRUE.
+ */
+ if (obj == NULL) {
+ /* Create a GateMP object with the openFlag set to true */
+ ti_sdo_ipc_GateMP_Params_init(¶ms);
+ params.openFlag = TRUE;
+ params.sharedAddr = NULL;
+ params.resourceId = resourceId;
+ params.localProtect = GETLOCAL(mask);
+ params.remoteProtect = GETREMOTE(mask);
+
+ obj = ti_sdo_ipc_GateMP_create(¶ms, &eb);
+ if (obj == NULL) {
+ status = GateMP_E_FAIL;
+ }
+ }
+ else {
+ obj->numOpens++;
+ }
+ }
+
+ /* Return the GateMP instance */
+ *handlePtr = (GateMP_Handle)obj;
+
+ /* restore hwi mask */
+ Hwi_restore(key);
+ }
return (status);
}
SizeT minAlign, offset;
UInt i;
Bits32 *delegateReservedMask;
+ UInt32 nsValue[6];
minAlign = Memory_getMaxDefaultTypeAlign();
if (SharedRegion_getCacheLineSize(0) > minAlign) {
GateMP_module->remoteCustom2InUse = GateMP_module->remoteSystemInUse;
GateMP_module->remoteCustom2Gates = GateMP_module->remoteSystemGates;
}
+
+ if (GateMP_module->hostSupport == TRUE) {
+ /* Add special entry to store inuse arrays' location and size */
+ nsValue[0] = (UInt32)GateMP_module->remoteSystemInUse;
+ nsValue[1] = (UInt32)GateMP_module->remoteCustom1InUse;
+ nsValue[2] = (UInt32)GateMP_module->remoteCustom2InUse;
+ nsValue[3] = GateMP_module->numRemoteSystem;
+ nsValue[4] = GateMP_module->numRemoteCustom1;
+ nsValue[5] = GateMP_module->numRemoteCustom2;
+ GateMP_module->nsKey = NameServer_add((NameServer_Handle)
+ GateMP_module->nameServer, "_GateMP_TI_info", &nsValue,
+ sizeof(nsValue));
+ }
}
/*
gateMPParams.sharedAddr = (Ptr)((UInt32)sharedAddr +
ti_sdo_ipc_GateMP_getRegion0ReservedSize());
gateMPParams.localProtect = ti_sdo_ipc_GateMP_LocalProtect_TASKLET;
+ gateMPParams.name = "_GateMP_TI_dGate";
if (ti_sdo_utils_MultiProc_numProcessors > 1) {
gateMPParams.remoteProtect = ti_sdo_ipc_GateMP_RemoteProtect_SYSTEM;
/* delete the default GateMP */
status = GateMP_delete(&gate);
}
+
+ /* Remove global info entry from NameServer */
+ if ((GateMP_module->hostSupport == TRUE) &&
+ (GateMP_module->nsKey != 0)) {
+ NameServer_removeEntry((NameServer_Handle)GateMP_module->nameServer,
+ GateMP_module->nsKey);
+ }
}
return (status);
SizeT minAlign, offset;
SharedRegion_SRPtr sharedShmBase;
GateMP_Params sparams;
- UInt32 nsValue[2];
+ UInt32 nsValue[4];
+ UInt32 sizeNsValue;
IHeap_Handle regionHeap;
/* Initialize resourceId to an invalid value */
obj->nsKey = 0;
obj->numOpens = 0; /* Will be set to 1 after init() complete */
obj->attrs = (ti_sdo_ipc_GateMP_Attrs *)params->sharedAddr;
- obj->regionId = SharedRegion_getId((Ptr)obj->attrs);
- obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
-
- /* Assert that the buffer is in a valid shared region */
- Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
+ if (obj->attrs != NULL) {
+ obj->regionId = SharedRegion_getId((Ptr)obj->attrs);
+ obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
+ /* Assert that the buffer is in a valid shared region */
+ Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
+ }
obj->allocSize = 0;
obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
minAlign = Memory_getMaxDefaultTypeAlign();
- if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
+ if ((obj->attrs != NULL) &&
+ (SharedRegion_getCacheLineSize(obj->regionId) > minAlign)) {
minAlign = SharedRegion_getCacheLineSize(obj->regionId);
}
offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Attrs), minAlign);
- obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+ /* TODO: host side created gates cannot have proxy memory */
+ if (obj->attrs != NULL) {
+ obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+ }
+ else {
+ obj->proxyAttrs = NULL;
+ }
}
/* Create GateMP instance */
else {
* Bottom 16 bits = '0' if local, '1' otherwise
*/
nsValue[1] = ((UInt32)MultiProc_self()) << 16;
+
+ if (GateMP_module->hostSupport == TRUE) {
+ nsValue[2] = obj->attrs->arg;
+ nsValue[3] = obj->attrs->mask;
+ sizeNsValue = sizeof(nsValue);
+ }
+ else {
+ sizeNsValue = 2 * sizeof(UInt32);
+ }
+
obj->nsKey = NameServer_add((NameServer_Handle)
GateMP_module->nameServer, params->name, &nsValue,
- 2 * sizeof(UInt32));
+ sizeNsValue);
if (obj->nsKey == NULL) {
Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name,
return (5);
}
- /* Finish filling in the object */
- obj->gateHandle = IGateMPSupport_Handle_upCast(remoteHandle);
-
/* Fill in the local array because it is cooked */
key = Hwi_disable();
GateMP_module->remoteSystemGates[obj->resourceId] = obj;
* Bottom 16 bits = '0' if local, '1' otherwise
*/
nsValue[1] = ((UInt32)MultiProc_self() << 16) | 1;
- obj->nsKey = NameServer_add(
- (NameServer_Handle)GateMP_module->nameServer, params->name,
- &nsValue, 2 * sizeof(UInt32));
+
+ if (GateMP_module->hostSupport == TRUE) {
+ /* Making a copy of these for host processor */
+ nsValue[2] = obj->attrs->arg;
+ nsValue[3] = obj->attrs->mask;
+ sizeNsValue = sizeof(nsValue);
+ }
+ else {
+ sizeNsValue = 2 * sizeof(UInt32);
+ }
+
+ obj->nsKey = NameServer_add((NameServer_Handle)
+ GateMP_module->nameServer, params->name, &nsValue,
+ sizeNsValue);
if (obj->nsKey == NULL) {
Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name, 0);
{
SharedRegion_SRPtr srPtr;
- srPtr = SharedRegion_getSRPtr(obj->attrs, obj->regionId);
+ if (obj->attrs != NULL) {
+ srPtr = SharedRegion_getSRPtr(obj->attrs, obj->regionId);
+ }
+ else {
+ srPtr = NULL;
+ }
return (srPtr);
}
index dd7a5d2d0cfdb1f6784770cc1cd162652e6bf8c3..e41982905cfb3596b2f44b30dbffc8005cdee227 100644 (file)
*/
config UInt maxNameLen = 32;
+ /*!
+ * ======== hostSupport ========
+ * Support for host processor
+ */
+ metaonly config Bool hostSupport = false;
+
/*!
* ======== tableSection ========
* Section name is used to place the names table
IGateProvider.Handle gateMutexPri;
IGateProvider.Handle gateNull;
Handle defaultGate;
+ Ptr nsKey;
+ Bool hostSupport;
Int proxyMap[ProxyOrder_NUM];
};
}
index 2bbb4da4f31cb8816ec5dd9a86cbeeefec86844e..add8db1547e0495d129dba8e8a3a03664fbf4794 100644 (file)
var Program = xdc.module('xdc.cfg.Program');
var target = Program.build.target;
- /*
- * Need 2 words:
- * 1 word for the SharedRegion Ptr.
- * 1 word for the proc id of creator and if remote is allowed.
- */
- GateMP.nameSrvPrms.maxValueLen = 2 * target.stdTypes["t_Int32"].size;
+ if (params.hostSupport) {
+ /*
+ * Need 6 words for info entry, which is larger than other entries
+ */
+ GateMP.nameSrvPrms.maxValueLen = 6 * target.stdTypes["t_Int32"].size;
+ if (params.maxNameLen < 16) {
+ GateMP.nameSrvPrms.maxNameLen = 16; /* min 16 chars for def gate */
+ }
+ mod.hostSupport = true;
+ }
+ else {
+ /*
+ * Need 2 words:
+ * 1 word for the SharedRegion Ptr.
+ * 1 word for the proc id of creator and if remote is allowed.
+ */
+ GateMP.nameSrvPrms.maxValueLen = 2 * target.stdTypes["t_Int32"].size;
+ mod.hostSupport = false;
+ }
/*
* Get the current number of created static instances of this module.
}
mod.defaultGate = null;
-
+ mod.nsKey = 0;
mod.remoteSystemGates[0] = mod.defaultGate;
/* Initialize the rest of the proxy gate arrays */
index cbc1a600cd255fce2fe246cb4ff6245406714921..a92456c9deec8aac23c04d6eb80340cfaee6b812 100644 (file)
#ifdef __ti__
#pragma FUNC_EXT_CALLED(MessageQ_Params_init);
+ #pragma FUNC_EXT_CALLED(MessageQ_Params2_init);
#pragma FUNC_EXT_CALLED(MessageQ_alloc);
#pragma FUNC_EXT_CALLED(MessageQ_close);
#pragma FUNC_EXT_CALLED(MessageQ_count);
#pragma FUNC_EXT_CALLED(MessageQ_create);
+ #pragma FUNC_EXT_CALLED(MessageQ_create2);
#pragma FUNC_EXT_CALLED(MessageQ_delete);
#pragma FUNC_EXT_CALLED(MessageQ_open);
+ #pragma FUNC_EXT_CALLED(MessageQ_openQueueId);
#pragma FUNC_EXT_CALLED(MessageQ_free);
#pragma FUNC_EXT_CALLED(MessageQ_get);
#pragma FUNC_EXT_CALLED(MessageQ_getQueueId);
#pragma FUNC_EXT_CALLED(MessageQ_put);
#pragma FUNC_EXT_CALLED(MessageQ_registerHeap);
+ #pragma FUNC_EXT_CALLED(MessageQ_setFreeHookFxn);
#pragma FUNC_EXT_CALLED(MessageQ_setReplyQueue);
#pragma FUNC_EXT_CALLED(MessageQ_setMsgTrace);
#pragma FUNC_EXT_CALLED(MessageQ_staticMsgInit);
params->synchronizer = NULL;
}
+/*
+ * ======== MessageQ_Params2_init ========
+ */
+Void MessageQ_Params2_init(MessageQ_Params2 *params)
+{
+ params->synchronizer = NULL;
+ params->queueIndex = MessageQ_ANY;
+}
+
/*
* ======== MessageQ_alloc ========
* Allocate a message and initial the needed fields (note some
* ======== MessageQ_create ========
*/
MessageQ_Handle MessageQ_create(String name, const MessageQ_Params *params)
+{
+ MessageQ_Handle handle;
+ MessageQ_Params2 params2;
+
+ MessageQ_Params2_init(¶ms2);
+
+ /* Use the MessageQ_Params fields if not NULL */
+ if (params != NULL) {
+ params2.synchronizer = params->synchronizer;
+ }
+
+ handle = MessageQ_create2(name, ¶ms2);
+
+ return ((MessageQ_Handle)handle);
+}
+
+/*
+ * ======== MessageQ_create2 ========
+ */
+MessageQ_Handle MessageQ_create2(String name, const MessageQ_Params2 *params)
{
ti_sdo_ipc_MessageQ_Handle handle;
ti_sdo_ipc_MessageQ_Params prms;
ti_sdo_ipc_MessageQ_Params_init(&prms);
prms.synchronizer = params->synchronizer;
+ prms.queueIndex = params->queueIndex;
handle = ti_sdo_ipc_MessageQ_create(name, &prms, &eb);
}
Int MessageQ_free(MessageQ_Msg msg)
{
IHeap_Handle heap;
+ Bits16 msgId;
+ Bits16 heapId;
/* make sure msg is not NULL */
Assert_isTrue((msg != NULL), ti_sdo_ipc_MessageQ_A_invalidMsg);
heap = MessageQ_module->heaps[msg->heapId];
if (heap != NULL) {
+ msgId = MessageQ_getMsgId(msg);
+ heapId = msg->heapId;
Memory_free(heap, msg, msg->msgSize);
+ if (MessageQ_module->freeHookFxn != NULL) {
+ MessageQ_module->freeHookFxn(heapId, msgId);
+ }
}
else {
return (MessageQ_E_FAIL);
}
}
+/*
+ * ======== MessageQ_openQueueId ========
+ */
+MessageQ_QueueId MessageQ_openQueueId(UInt16 queueIndex, UInt16 remoteProcId)
+{
+ MessageQ_QueueId queueId;
+
+ queueId = ((MessageQ_QueueId)(remoteProcId) << 16) | queueIndex;
+
+ return (queueId);
+}
+
/*
* ======== MessageQ_put ========
*/
return (status);
}
+/*
+ * ======== MessageQ_setFreeHookFxn ========
+ */
+Void MessageQ_setFreeHookFxn(MessageQ_FreeHookFxn freeHookFxn)
+{
+ MessageQ_module->freeHookFxn = freeHookFxn;
+}
+
/*
* ======== MessageQ_setMsgTrace ========
*/
@@ -703,15 +764,31 @@ Int ti_sdo_ipc_MessageQ_Instance_init(ti_sdo_ipc_MessageQ_Object *obj, String na
/* lock */
key = IGateProvider_enter(MessageQ_module->gate);
- start = ti_sdo_ipc_MessageQ_Object_count();
- count = MessageQ_module->numQueues;
+ if (params->queueIndex != MessageQ_ANY) {
+ queueIndex = params->queueIndex;
+
+ if ((queueIndex >= ti_sdo_ipc_MessageQ_numReservedEntries) ||
+ (MessageQ_module->queues[queueIndex] != NULL)) {
+ IGateProvider_leave(MessageQ_module->gate, key);
+ Error_raise(eb, ti_sdo_ipc_MessageQ_E_indexNotAvailable,
+ queueIndex, 0);
+ return (5);
+ }
+ MessageQ_module->queues[queueIndex] = obj;
+ found = TRUE;
+ }
+ else {
+
+ start = ti_sdo_ipc_MessageQ_numReservedEntries;
+ count = MessageQ_module->numQueues;
- /* Search the dynamic array for any holes */
- for (i = start; (i < count) && (found == FALSE); i++) {
- if (MessageQ_module->queues[i] == NULL) {
- MessageQ_module->queues[i] = obj;
- queueIndex = i;
- found = TRUE;
+ /* Search the dynamic array for any holes */
+ for (i = start; (i < count) && (found == FALSE); i++) {
+ if (MessageQ_module->queues[i] == NULL) {
+ MessageQ_module->queues[i] = obj;
+ queueIndex = i;
+ found = TRUE;
+ }
}
}
MessageQ_QueueIndex index = (MessageQ_QueueIndex)(obj->queue);
List_Handle listHandle;
+ /* Requested queueId was not available. Nothing was done in the init */
+ if (status == 5) {
+ return;
+ }
+
if (obj->syncSemHandle != NULL) {
SyncSem_delete(&obj->syncSemHandle);
}
index 0b8e105844067fcc4b8de4dd18dd8d35d23ffece..d822f7bb797a4fde0f687f4581d9d1244ce09a16 100644 (file)
String heaps[];
String gate;
UInt16 nextSeqNum;
+ String freeHookFxn[];
}
/*!
msg: "LM_get: Message 0x%x (seqNum = %d, srcProc = %d) was received by queue 0x%x"
};
+ /*!
+ * ======== FreeHookFxn ========
+ * Function prototype for the MessageQ_free callback
+ *
+ * @param(Bits16) heapId of message that was freed
+ * @param(Bits16) msgId of message that was freed
+ */
+ typedef Void (*FreeHookFxn)(Bits16, Bits16);
+
/*! MessageQ ID */
typedef UInt32 QueueId;
const UInt RESERVEDPRI = 2;
const UInt URGENTPRI = 3;
+ /*!
+ * Denotes any queueId is acceptable
+ *
+ * This constant is the default for the {@link #queueId} parameter.
+ * This value must match ti/ipc/MessageQ.h but is needed to initialize
+ * queueId.
+ */
+ const Bits16 ANY = ~(0);
+
/*!
* Assert raised when calling API with wrong handle
*
msg: "E_nameFailed: '%s' name failed to be added to NameServer"
};
+ /*!
+ * Error raised if the requested queueIndex is not available
+ */
+ config Error.Id E_indexNotAvailable = {
+ msg: "E_indexNotAvailable: queueIndex %d not available"
+ };
+
/*!
* Trace setting
*
*/
config UInt maxRuntimeEntries = NameServer.ALLOWGROWTH;
+ /*!
+ * Number of reserved MessageQ indexes
+ *
+ * An application can request the first N message queue indexes be
+ * reserved to be used by MessageQ_create2. MessageQ_create will
+ * not use these slots. The application can use any index less than
+ * the value of numReservedEntries for the queueIndex field in the
+ * MessageQ_Params2 structure.
+ *
+ * numReservedEntries must be equal or less than
+ * {@link #maxRuntimeEntries}.
+ */
+ config UInt numReservedEntries = 0;
+
/*!
* Gate used to make the name table thread safe
*
*/
metaonly config String tableSection = null;
+ /*!
+ * ======== freeHookFxn ========
+ * Free function in MessageQ_free after message was freed back to the heap
+ */
+ config FreeHookFxn freeHookFxn = null;
+
/*!
* ======== registerHeapMeta ========
* Statically register a heap with MessageQ
*/
config ISync.Handle synchronizer = null;
+ /*!
+ * Requested MessageQ_QueueIndex
+ *
+ * This parameter allows an application to specify the queueIndex to
+ * be used for a message queue. To use this functionality, the
+ * MessageQ.numReservedEntries static configuration parameter must be set to
+ * a specific value.
+ *
+ * The default is {@link #ANY}. This means do that you are not asking for
+ * an explicit index. MessageQ will find the first available one which is
+ * equal or greater than MessageQ.numReservedEntries.
+ */
+ config UInt16 queueIndex = ANY;
+
/*! @_nodoc
* ======== create ========
* Create a message queue
UInt16 numQueues;
UInt16 numHeaps;
NameServer.Handle nameServer;
+ FreeHookFxn freeHookFxn;
Bool canFreeQueues;
UInt16 seqNum;
};
index 2f1854a05bedd8f7ecf633fa033f7f2d51e12bd8..6e760bd070e85d2667c2259e55851df3df97ff58 100644 (file)
/*
* If no growth allowed, pre-allocate the max length
+ * Also pre-allocate if numReservedEntries is not zero.
+ * maxRuntimeEntries < numReservedEntries is caught in validate.
*/
mod.numQueues = this.$instances.length;
if (params.maxRuntimeEntries != NameServer.ALLOWGROWTH) {
mod.numQueues += params.maxRuntimeEntries;
}
+ else if (params.numReservedEntries != 0){
+ mod.numQueues += params.numReservedEntries;
+ }
+
mod.queues.length = mod.numQueues;
mod.canFreeQueues = false;
+ mod.freeHookFxn = params.freeHookFxn;
if (params.nameTableGate == null) {
mod.gate = null;
* that will be used.
*/
view.nextSeqNum = mod.seqNum;
+
+ /* Display the freeHookFxn if there is one. */
+ if (Number(mod.freeHookFxn) != 0 ) {
+ view.freeHookFxn = Program.lookupFuncName(Number(mod.freeHookFxn));
+ }
+}
+
+function module$validate()
+{
+ if ((MessageQ.maxRuntimeEntries != NameServer.ALLOWGROWTH) &&
+ (MessageQ.maxRuntimeEntries < MessageQ.numReservedEntries)) {
+ MessageQ.$logFatal(
+ "If MessageQ.maxRuntimeEntries is not NameServer.ALLOWGROWTH, " +
+ "it cannot be less than MessageQ.numReservedEntries.",
+ MessageQ);
+ }
}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.c b/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.c
index 3edbe7cb94b3dc9041293aab7bd962fe3179c4e5..2d83f26e6e8dd19fdc24b4e85efb1f5fc59fb79e 100644 (file)
{
#ifdef xdc_target__isaCompatible_v7M
volatile UInt32 *set = (volatile UInt32 *)MTOCIPCSET;
+ volatile UInt32 *clear = (volatile UInt32 *)MTOCIPCCLR;
#else
volatile UInt16 *set = (volatile UInt16 *)CTOMIPCSET;
+ volatile UInt32 *clear = (volatile UInt32 *)CTOMIPCCLR;
#endif
+ UInt hwiKey;
+
+ /* Make sure multiple threads are not hitting this at the same time */
+ hwiKey = Hwi_disable();
+ /* Make sure we get a leading edge... */
+ *clear = 1 << IpcMgr_ipcSetFlag;
+
+ /* Signal the other side */
*set = 1 << IpcMgr_ipcSetFlag;
+
+ /* Restore the interrupt line */
+ Hwi_restore(hwiKey);
}
/*
/* Make sure the NotifyDriverCirc_Object is not NULL */
Assert_isTrue(obj != NULL, IpcMgr_A_internal);
- /* Clear the remote interrupt */
- NotifyDriverCirc_intClear();
-
/* get the writeIndex and readIndex */
writeIndex = obj->getWriteIndex[0];
readIndex = obj->getReadIndex[0];
diff --git a/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xs b/packages/ti/sdo/ipc/family/f28m35x/NotifyDriverCirc.xs
index 61cf07d2a21374b44aaa27be5a8b135c5e69298b..7d2b41005e0e97d3861f5d598346f0b0f45126fa 100644 (file)
function viewInitBasic(view, obj)
{
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+ var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
var modCfg =
Program.getModuleConfig('ti.sdo.ipc.family.f28m35x.NotifyDriverCirc');
/* view.remoteProcName */
try {
- view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+ view.remoteProcName = MultiProc.getName$view(obj.remoteProcId -
+ MultiProcCfg.baseIdOfCluster);
}
catch(e) {
Program.displayError(view, 'remoteProcName',
view.elements.$add(elem);
i++;
+ if ((i % modCfg.numMsgs) == 0) {
+ i = 0;
+ }
}
}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.c b/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.c
index bbbc7fd626ceaec66e7233e8a49043fa22df061c..b42d25d807962bd9ee3c16a42f2aeee466436c43 100644 (file)
#include <ti/sysbios/hal/Hwi.h>
#include <ti/sysbios/knl/Swi.h>
+#include <ti/sdo/ipc/interfaces/IMessageQTransport.h>
#include <ti/sdo/ipc/family/f28m35x/IpcMgr.h>
/* construct the swi with lowest priority */
Swi_Params_init(&swiParams);
swiParams.arg0 = (UArg)obj;
+ swiParams.priority = TransportCirc_swiPriority;
Swi_construct(Swi_struct(swiHandle),
(Swi_FuncPtr)TransportCirc_swiFxn,
&swiParams, eb);
buf = MessageQ_alloc(msg->heapId, msgSize);
/* Make sure buf is not NULL */
- Assert_isTrue(buf != NULL, IpcMgr_A_internal);
+ if (buf == NULL) {
+ TransportCirc_module->errFxn(TransportCirc_Reason_FAILEDALLOC,
+ ti_sdo_ipc_family_f28m35x_TransportCirc_Handle_upCast(obj),
+ NULL,
+ (UArg)msg);
+
+ return;
+ }
/* copy the message to the buffer allocated, set the heap id */
memcpy((Ptr)buf, (Ptr)msg, msgSize);
return (memReq);
}
+/*
+ * ======== TransportCirc_defaultErrFxn ========
+ */
+Void TransportCirc_defaultErrFxn(IMessageQTransport_Reason reason,
+ IMessageQTransport_Handle handle,
+ Ptr ptr,
+ UArg arg)
+{
+}
+
/*
* ======== TransportCirc_setErrFxn ========
*/
Void TransportCirc_setErrFxn(TransportCirc_ErrFxn errFxn)
{
- /* Ignore the errFxn */
+ TransportCirc_module->errFxn = errFxn;
}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xdc b/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xdc
index 57f02f339e63769f83b5080c580364821a66e6f3..eed0ae2c76f8cae502cd5389ad7db814f05a9042 100644 (file)
*/
import ti.sysbios.knl.Swi;
+import ti.sdo.ipc.interfaces.IMessageQTransport;
import xdc.rov.ViewInfo;
* NOTE: Processor '0' corresponds to the M3 and '1' corresponds to the C28
*
* sharedAddr -> --------------------------- bytes
- * | entry0 (0) [Put] | 4
- * | entry1 (0) | 4
+ * | entry0 (0) [Put] | msgSize
+ * | entry1 (0) | msgSize
* | ... |
- * | entryN (0) | 4
+ * | entryN (0) | msgSize
* | |
* |-------------------------|
* | putWriteIndex (0) | 4
* | getReadIndex (1) | 4
* | |
* |-------------------------|
- * | entry0 (1) [Get] | 4
- * | entry1 (1) | 4
+ * | entry0 (1) [Get] | msgSize
+ * | entry1 (1) | msgSize
* | ... |
- * | entryN (1) | 4
+ * | entryN (1) | msgSize
* | |
* |-------------------------|
* | putWriteIndex (1) | 4
@InstanceFinalize
@InstanceInitError
-module TransportCirc inherits ti.sdo.ipc.interfaces.IMessageQTransport
+module TransportCirc inherits IMessageQTransport
{
/*! @_nodoc */
metaonly struct BasicView {
metaonly struct EventDataView {
UInt index;
String buffer;
- Ptr addr;
Ptr message;
}
*/
config UInt maxMsgSizeInBytes = 128;
+ /*!
+ * ======== swiPriority ========
+ * The priority of the Transport Swi object created
+ */
+ config UInt swiPriority = 1;
+
/*! @_nodoc
* ======== sharedMemReq ========
* Amount of shared memory required for creation of each instance
*/
config UInt msgSize;
+ /*!
+ * ======== defaultErrFxn ========
+ * This is the default error function.
+ *
+ * This function is an empty function that does nothing.
+ *
+ * @param(reason) reason for error function
+ * @param(handle) handle of transport that had error
+ * @param(ptr) pointer to the message
+ * @param(arg) argument passed to error function
+ */
+ Void defaultErrFxn(IMessageQTransport.Reason reason,
+ IMessageQTransport.Handle handle, Ptr ptr, UArg arg);
+
/*!
* ======== swiFxn ========
* This function takes the messages from the transport ListMP and
UInt16 remoteProcId; /* dst proc id */
UInt16 priority; /* priority to register */
};
+
+ struct Module_State {
+ ErrFxn errFxn; /* error function */
+ };
}
diff --git a/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xs b/packages/ti/sdo/ipc/family/f28m35x/TransportCirc.xs
index 462e29310e93b9bf6a2bfcb828fa9132ef5a30f6..48b1d9ae5f98cce5baca4690109ecc9d13616f12 100644 (file)
TransportCirc.numMsgs +
" is not a power of 2", TransportCirc);
}
+
+ if (params.errFxn != null) {
+ mod.errFxn = params.errFxn;
+ }
+ else {
+ mod.errFxn = TransportCirc.defaultErrFxn;
+ }
}
/*
function viewInitBasic(view, obj)
{
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+ var MultiProcCfg = Program.getModuleConfig('ti.sdo.utils.MultiProc');
/* view.remoteProcName */
try {
- view.remoteProcName = MultiProc.getName$view(obj.remoteProcId);
+ view.remoteProcName = MultiProc.getName$view(obj.remoteProcId -
+ MultiProcCfg.baseIdOfCluster);
}
catch(e) {
Program.displayError(view, 'remoteProcName',
}
try {
- var putBuffer = Program.fetchArray(TransportCirc.msgSize$fetchDesc,
+ var putBuffer = Program.fetchArray(ScalarStructs.S_Bits32$fetchDesc,
bufferPtr,
modCfg.numMsgs);
}
elem.index = i;
elem.buffer = bufferName;
- elem.addr = utils.toHex(putBuffer[i].$addr);
- elem.message = utils.toHex(putBuffer[i].elem);
+ elem.message = utils.toHex(Number(bufferPtr) + (i * modCfg.msgSize));
/* Create a new row in the instance data view */
view.elements.$add(elem);
i++;
+ if ((i % modCfg.numMsgs) == 0) {
+ i = 0;
+ }
}
}
diff --git a/packages/ti/sdo/ipc/family/vayu/NotifySetup.xdc b/packages/ti/sdo/ipc/family/vayu/NotifySetup.xdc
index 8aeefe10c24c435386eee56de38d5cd0f2d3f94c..f63369db1381151c24b41fd4ca019f7a357c70e7 100644 (file)
internal:
+ /* note: IPU intentionally omitted, nothing to setup */
config UInt eve1ProcId = MultiProc.INVALIDID;
config UInt eve2ProcId = MultiProc.INVALIDID;
config UInt eve3ProcId = MultiProc.INVALIDID;
config UInt eve4ProcId = MultiProc.INVALIDID;
config UInt dsp1ProcId = MultiProc.INVALIDID;
config UInt dsp2ProcId = MultiProc.INVALIDID;
- config UInt ipu1ProcId = MultiProc.INVALIDID;
- config UInt ipu2ProcId = MultiProc.INVALIDID;
config UInt hostProcId = MultiProc.INVALIDID;
}
diff --git a/packages/ti/sdo/ipc/family/vayu/NotifySetup.xs b/packages/ti/sdo/ipc/family/vayu/NotifySetup.xs
index f4e1e8629414f8182b04ba2f4e55d8eb71300cb1..3a2d36db24faf7caed06d3e4c346c972b994a837 100644 (file)
this.procIdTable[loopIdx] = -1;
}
+ /* note: IPU intentionally omitted, nothing to setup */
this.eve1ProcId = MultiProc.getIdMeta("EVE1");
this.eve2ProcId = MultiProc.getIdMeta("EVE2");
this.eve3ProcId = MultiProc.getIdMeta("EVE3");
this.eve4ProcId = MultiProc.getIdMeta("EVE4");
this.dsp1ProcId = MultiProc.getIdMeta("DSP1");
this.dsp2ProcId = MultiProc.getIdMeta("DSP2");
- this.ipu1ProcId = MultiProc.getIdMeta("IPU1");
- this.ipu2ProcId = MultiProc.getIdMeta("IPU2");
this.hostProcId = MultiProc.getIdMeta("HOST");
if (this.eve1ProcId != MultiProc.INVALIDID) {
if (this.dsp2ProcId != MultiProc.INVALIDID) {
this.procIdTable[this.dsp2ProcId] = 5;
}
- if (this.ipu1ProcId != MultiProc.INVALIDID) {
- this.procIdTable[this.ipu1ProcId] = 6;
- }
- if (this.ipu2ProcId != MultiProc.INVALIDID) {
- this.procIdTable[this.ipu2ProcId] = 7;
- }
if (this.hostProcId != MultiProc.INVALIDID) {
this.procIdTable[this.hostProcId] = 8;
}
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.c b/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.c
index 156310be09419ece0053d20f0625eba6b1a90d2d..b4007658110dc2e7ab932736a7d75be08bc27179 100644 (file)
(xdc_target__bitsPerChar / 8))
#define NAMEARRAYSZIE (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
+#define MESSAGEQ_INDEX 0
+
/* message sent to remote procId */
typedef struct NameServerMsg {
MessageQ_MsgHeader header; /* message header */
*/
Int NameServerMessageQ_Module_startup(Int phase)
{
- MessageQ_Params messageQParams;
+ MessageQ_Params2 messageQParams;
/* Ensure MessageQ and SyncSwi Module_startup() have completed */
if ((ti_sdo_ipc_MessageQ_Module_startupDone() == FALSE) ||
}
/* Create the message queue for NameServer using SyncSwi */
- MessageQ_Params_init(&messageQParams);
+ MessageQ_Params2_init(&messageQParams);
messageQParams.synchronizer = NameServerMessageQ_module->syncSwiHandle;
+ messageQParams.queueIndex = MESSAGEQ_INDEX;
NameServerMessageQ_module->msgHandle =
- (ti_sdo_ipc_MessageQ_Handle)MessageQ_create(NULL, &messageQParams);
+ (ti_sdo_ipc_MessageQ_Handle)MessageQ_create2(NULL, &messageQParams);
/* assert msgHandle is not null */
Assert_isTrue(NameServerMessageQ_module->msgHandle != NULL,
/* assert this is the first MessageQ created */
Assert_isTrue((MessageQ_getQueueId((MessageQ_Handle)
- NameServerMessageQ_module->msgHandle) & 0xffff) == 0,
+ NameServerMessageQ_module->msgHandle) & 0xffff) == MESSAGEQ_INDEX,
NameServerMessageQ_A_reservedMsgQueueId);
return (Startup_DONE);
strncpy((Char *)msg->name, name, len);
/* determine the queueId based upon the processor */
- queueId = (UInt32)obj->remoteProcId << 16;
+ queueId = MessageQ_openQueueId(MESSAGEQ_INDEX, obj->remoteProcId);
/* set the reply procId */
MessageQ_setReplyQueue(
diff --git a/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xs b/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.xs
index f05e66a1955d2752da4babbc2cbc930fd8e62f56..0af0896415f96b8b15b189fc5bd74fa318bcb43d 100644 (file)
var Ipc = null;
var SyncSwi = null;
var GateMutex = null;
+var MessageQ = null;
/*
* ======== module$use ========
Ipc = xdc.useModule("ti.sdo.ipc.Ipc");
SyncSwi = xdc.useModule("ti.sysbios.syncs.SyncSwi");
GateMutex = xdc.useModule("ti.sysbios.gates.GateMutex");
+ MessageQ = xdc.useModule("ti.sdo.ipc.MessageQ");
}
/*
/* create GateMutex */
mod.gateMutex = GateMutex.create();
}
+
+function module$validate()
+{
+ if (MessageQ.numReservedEntries == 0) {
+ NameServerMessageQ.$logFatal(
+ "NameServerMessageQ is using MessageQ_create2 and requesting " +
+ "queueIndex 0. However MessageQ.numReservedEntries is zero. " +
+ "MessageQ.numReservedEntries must be increased to at least 1",
+ NameServerMessageQ);
+ }
+}
index 2f176a23efb7075f55e1040d976571bf0d4a543f..f99fc3249999603503b355e74ac468436d677b6d 100644 (file)
@@ -274,24 +274,43 @@ NameServer_Handle NameServer_create(String name, const NameServer_Params *params
ti_sdo_utils_NameServer_Params nsParams;
ti_sdo_utils_NameServer_Object *obj;
Error_Block eb;
+ NameServer_Handle handle = NULL;
Error_init(&eb);
- if (params != NULL) {
- /* init the module params struct */
- ti_sdo_utils_NameServer_Params_init(&nsParams);
- nsParams.maxRuntimeEntries = params->maxRuntimeEntries;
- nsParams.tableHeap = params->tableHeap;
- nsParams.checkExisting = params->checkExisting;
- nsParams.maxValueLen = params->maxValueLen;
- nsParams.maxNameLen = params->maxNameLen;
-
- /* call the module create */
- obj = ti_sdo_utils_NameServer_create(name, &nsParams, &eb);
+ /* check if the name is already created or not */
+ handle = NameServer_getHandle(name);
+ if (handle != NULL) {
+ obj = (ti_sdo_utils_NameServer_Object *)handle;
+ if ((obj->numDynamic == params->maxRuntimeEntries) &&
+ (obj->tableHeap == params->tableHeap) &&
+ (obj->checkExisting == params->checkExisting) &&
+ (obj->maxValueLen == params->maxValueLen) &&
+ (obj->maxNameLen == params->maxNameLen)) {
+ obj->refCount++;
+ }
+ else {
+ Error_raise(&eb, ti_sdo_utils_NameServer_E_paramMismatch, name, 0);
+ handle = NULL;
+ }
}
else {
- /* passing in NULL uses the default params */
- obj = ti_sdo_utils_NameServer_create(name, NULL, &eb);
+ if (params != NULL) {
+ /* init the module params struct */
+ ti_sdo_utils_NameServer_Params_init(&nsParams);
+ nsParams.maxRuntimeEntries = params->maxRuntimeEntries;
+ nsParams.tableHeap = params->tableHeap;
+ nsParams.checkExisting = params->checkExisting;
+ nsParams.maxValueLen = params->maxValueLen;
+ nsParams.maxNameLen = params->maxNameLen;
+
+ /* call the module create */
+ obj = ti_sdo_utils_NameServer_create(name, &nsParams, &eb);
+ }
+ else {
+ /* passing in NULL uses the default params */
+ obj = ti_sdo_utils_NameServer_create(name, NULL, &eb);
+ }
}
return ((NameServer_Handle)obj);
@@ -302,8 +321,14 @@ NameServer_Handle NameServer_create(String name, const NameServer_Params *params
*/
Int NameServer_delete(NameServer_Handle *handlePtr)
{
- ti_sdo_utils_NameServer_delete(
- (ti_sdo_utils_NameServer_Handle *)handlePtr);
+ ti_sdo_utils_NameServer_Object * obj =
+ (ti_sdo_utils_NameServer_Object *)*handlePtr;
+
+ obj->refCount--;
+ if (obj->refCount == 0) {
+ ti_sdo_utils_NameServer_delete(
+ (ti_sdo_utils_NameServer_Handle *)handlePtr);
+ }
return (NameServer_S_SUCCESS);
}
obj->table = NULL;
obj->values = NULL;
obj->names = NULL;
+ obj->refCount = 1;
if (params->tableHeap == NULL) {
obj->tableHeap = ti_sdo_utils_NameServer_Object_heap();
index 4d891b70c99b7741a994ef092dc516f5cc9d481c..cb90ed8d5d24a8931c474d2bef6e44a857071ccd 100644 (file)
msg: "E_entryExists: %s name already in table "
};
+ /*!
+ * Error raised when creation parameters do not match those of an
+ * existing NameServer
+ */
+ config Error.Id E_paramMismatch = {
+ msg: "E_paramMismatch: parameters do not match existing NameServer %s "
+ };
+
/*!
* Allow dynamic growth of the NameServer instance table
*
UInt8 values[]; /* Buffer for values */
IHeap.Handle tableHeap; /* Heap used to alloc table */
Bool checkExisting; /* check ig name already exists */
+ UInt32 refCount; /* reference count to this instance */
};
struct Module_State {
index c35933720e352c186cbf67a94db3b6f22d7f24cb..ccdcdebc98589a6d22d003909fc3361ec028230d 100644 (file)
obj.numDynamic = params.maxRuntimeEntries;
obj.checkExisting = params.checkExisting;
obj.numStatic = numStatic;
+ obj.refCount = 1;
obj.table.length = numStatic;
if (params.tableHeap == null) {
obj.tableHeap = NameServer.common$.instanceHeap;
index e7b1ab0029a5098369d4dc48cfe4209e46d0da49..41e1fa7d8362067445313330c1332ba22f95e327 100644 (file)
#include <ti/grcm/RcmTypes.h>
#include <ti/grcm/RcmServer.h>
-#include <stdio.h>
#include <string.h>
#include <stdlib.h>
index b5b241d56a1d078ed26a0a200c126c7c9e393ca6..c39a1e74f17fcaced1465adfbad7b5ea938129eb 100644 (file)
* @def OmapRpc_S_SUCCESS
* @brief Operation is successful.
*/
-#define OmapRpc_S_SUCCESS 0
+#define OmapRpc_S_SUCCESS (0)
/*!
* @def OmapRpc_E_FAIL
* @brief Operation is not successful.
*/
-#define OmapRpc_E_FAIL -1
+#define OmapRpc_E_FAIL (-1)
#define OmapRpc_NUM_PARAMETERS(size) \
- (size/sizeof(struct OmapRpc_Parameter))
+ ((size)/sizeof(struct OmapRpc_Parameter))
#define OmapRpc_PAYLOAD(ptr, type) \
((struct type *)&(ptr)[sizeof(struct OmapRpc_MsgHeader)])
-#define OmapRpc_PARAM(param, type) (param.size == sizeof(type) ? (type)param.data : 0)
+#define OmapRpc_PARAM(param, type) ((param).size == sizeof(type) ? (type)(param).data : 0)
#define OmapRpc_Stringerize(func) #func
-#define OmapRpc_dimof(x) (sizeof(x)/sizeof(x[0]))
+#define OmapRpc_dimof(x) (sizeof(x)/sizeof((x)[0]))
#define OmapRpc_DESC_EXEC_SYNC (0x0100)
#define OmapRpc_DESC_EXEC_ASYNC (0x0200)
#define OmapRpc_JOBID_DISCRETE (0)
#define OmapRpc_POOLID_DEFAULT (0x8000)
-#define OmapRpc_SET_FXN_IDX(idx) (idx | 0x80000000)
-#define OmapRpc_FXN_MASK(idx) (idx & 0x7FFFFFFF)
+#define OmapRpc_SET_FXN_IDX(idx) ((idx) | 0x80000000)
+#define OmapRpc_FXN_MASK(idx) ((idx) & 0x7FFFFFFF)
#define OMAPRPC_MAX_CHANNEL_NAMELEN (64)
#define OMAPRPC_MAX_FUNC_NAMELEN (64)
OmapRpc_Param_MAX
} OmapRpc_Param_Type;
-#define OmapRpc_PtrType(type) (type | OmapRpc_Param_PTR)
+#define OmapRpc_PtrType(type) ((type) | OmapRpc_Param_PTR)
typedef struct OmapRpc_ParamSignature {
UInt32 direction; /**< @see OmapRpc_Direction */
index 7bc0f06b13540bcae51742bb61fb39a72e0b2834..383bbd6042f819dd59109e31efa7272bae49fe1d 100644 (file)
System_printf("OmxSrvMgr: started on port: %d\n", OMX_MGR_PORT);
#ifdef SMP
- NameMap_register("rpmsg-omx", "rpmsg-omx1", OMX_MGR_PORT);
+ if (MultiProc_self() == MultiProc_getId("IPU1")) {
+ NameMap_register("rpmsg-omx", "rpmsg-omx3", OMX_MGR_PORT);
+ }
+ else {
+ NameMap_register("rpmsg-omx", "rpmsg-omx1", OMX_MGR_PORT);
+ }
System_printf("OmxSrvMgr: Proc#%d sending BOOTINIT_DONE\n",
MultiProc_self());
#else
MultiProc_self() == MultiProc_getId("DSP1")) {
NameMap_register("rpmsg-omx", "rpmsg-omx2", OMX_MGR_PORT);
}
+ if (MultiProc_self() == MultiProc_getId("DSP2")) {
+ NameMap_register("rpmsg-omx", "rpmsg-omx4", OMX_MGR_PORT);
+ }
#endif
while (1) {
diff --git a/qnx/Makefile b/qnx/Makefile
index 4a4c14d20636a98b5ef32c9c485919e99ccd359d..bdfddc573b4ba91e524d2a46e3af6e9a01a6ec52 100644 (file)
--- a/qnx/Makefile
+++ b/qnx/Makefile
all: utils ipc3x_dev libs tests
libs: ipc3x_dev
- @cd src/api; make
+ @cd src/api; make SYSLINK_PLATFORM=$(SYSLINK_PLATFORM)
@cd src/mm; make
utils:
INSTALL_ROOT_nto=$(DESTDIR) install
@cd src/mm; make USE_INSTALL_ROOT=1 DESTDIR=$(DESTDIR) \
INSTALL_ROOT_nto=$(DESTDIR) install
+ @cd src/api; make USE_INSTALL_ROOT=1 DESTDIR=$(DESTDIR) \
+ INSTALL_ROOT_nto=$(DESTDIR) install
+ @cd src/utils; make USE_INSTALL_ROOT=1 DESTDIR=$(DESTDIR) \
+ INSTALL_ROOT_nto=$(DESTDIR) install
@cd src/tests; make USE_INSTALL_ROOT=1 DESTDIR=$(DESTDIR) \
+ SYSLINK_PLATFORM=$(SYSLINK_PLATFORM) \
INSTALL_ROOT_nto=$(DESTDIR) install
+
clean:
@cd src/api; make clean
@cd src/mm; make clean
diff --git a/qnx/include/GateMP_config.h b/qnx/include/GateMP_config.h
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * ======== GateMP_config.h ========
+ *
+ * Define the configuration of parameters used in GateMP. This file also
+ * configures the various proxies.
+ *
+ */
+
+#ifndef GATEMP_CONFIG
+#define GATEMP_CONFIG
+
+#include <ti/syslink/inc/GateHWSpinlock.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define MAX_RUNTIME_ENTRIES 128 /* Max number of GateMP instances + 1 */
+#define MAX_NAME_LEN 16 /* Max name length of GateMP instances */
+
+/* Proxy functions and data structures */
+#define GateMP_RemoteSystemProxy_Params_init(x) GateHWSpinlock_Params_init(x)
+#define GateMP_RemoteSystemProxy_create GateHWSpinlock_create
+#define GateMP_RemoteSystemProxy_delete GateHWSpinlock_delete
+#define GateMP_RemoteSystemProxy_Params GateHWSpinlock_Params
+#define GateMP_RemoteSystemProxy_Handle GateHWSpinlock_Handle
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+#endif /* GATEMP_CONFIG */
similarity index 53%
rename from packages/ti/platform/vayu/ipu2/Platform.xdc
rename to qnx/include/_GateMP.h
index 7b90ee0e3d4115ab975bfc1546ef5730ca3faf56..ff09d282109c25625cf861e52e275c8ca2c64a9f 100644 (file)
rename from packages/ti/platform/vayu/ipu2/Platform.xdc
rename to qnx/include/_GateMP.h
index 7b90ee0e3d4115ab975bfc1546ef5730ca3faf56..ff09d282109c25625cf861e52e275c8ca2c64a9f 100644 (file)
+++ b/qnx/include/_GateMP.h
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*!
- * File generated by platform wizard.
+
+/*
+ * ======== _GateMP.h ========
+ *
+ * Internal header
*
*/
+#ifndef _GATEMP_H
+#define _GATEMP_H
-metaonly module Platform inherits xdc.platform.IPlatform {
-
- config ti.platforms.generic.Platform.Instance plat =
- ti.platforms.generic.Platform.create("plat", {
- clockRate: 266.0,
- catalogName: "ti.catalog.arm.cortexm4",
- deviceName: "Vayu",
- externalMemoryMap: [
- ["EXT_CODE", {name: "EXT_CODE", base: 0x00004000, len: 0x005FC000, space: "code", access: "RWX"}],
- ["EXT_DATA", {name: "EXT_DATA", base: 0x80000000, len: 0x00600000, space: "data", access: "RW"}],
- ["EXT_HEAP", {name: "EXT_HEAP", base: 0x80600000, len: 0x09600000, space: "data", access: "RW"}],
- ["TRACE_BUF", {name: "TRACE_BUF", base: 0x9F000000, len: 0x00060000, space: "data", access: "RW"}],
- ["EXC_DATA", {name: "EXC_DATA", base: 0x9F060000, len: 0x00010000, space: "data", access: "RW"}],
- ["PM_DATA", {name: "PM_DATA", base: 0x9F070000, len: 0x00020000, space: "data", access: "RWX"}],
- ],
- });
-
-instance :
-
- override config string codeMemory = "EXT_CODE";
- override config string dataMemory = "EXT_DATA";
- override config string stackMemory = "EXT_DATA";
+#include <ti/ipc/GateMP.h>
+#include <ti/syslink/inc/IObject.h>
+#include <ti/syslink/utils/IGateProvider.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* Helper macros */
+#define GETREMOTE(mask) ((GateMP_RemoteProtect)(mask >> 8))
+#define GETLOCAL(mask) ((GateMP_LocalProtect)(mask & 0xFF))
+#define SETMASK(remoteProtect, localProtect) \
+ ((Bits32)(remoteProtect << 8 | localProtect))
+
+/*!
+ * @brief Structure for the Handle for the GateMP.
+ */
+typedef struct {
+ GateMP_Params params;
+ /*!< Instance specific creation parameters */
+ GateMP_RemoteProtect remoteProtect;
+ GateMP_LocalProtect localProtect;
+ Ptr nsKey;
+ Int numOpens;
+
+ Bits16 mask;
+ Bits16 creatorProcId;
+ Bits32 arg;
+
+ IGateProvider_Handle gateHandle; /* remote gate handle */
+ Ipc_ObjType objType;
+ IGateProvider_Handle localGate; /* local gate handle */
+
+ UInt resourceId;
+ /*!< Resource id of GateMP proxy */
+} GateMP_Object;
+
+/* Has GateMP been setup */
+Bool GateMP_isSetup(Void);
+
+#if defined (__cplusplus)
}
+#endif /* defined (__cplusplus) */
+
+#endif /* _GATEMP_H */
similarity index 77%
rename from packages/ti/platform/vayu/ipu2/package.bld
rename to qnx/include/_GateMP_usr.h
index f6f67549bcc20ef5f1cbddee81196ed7ff404c41..5fc21d12602820c8a4940e691aa6003a5f990a57 100644 (file)
rename from packages/ti/platform/vayu/ipu2/package.bld
rename to qnx/include/_GateMP_usr.h
index f6f67549bcc20ef5f1cbddee81196ed7ff404c41..5fc21d12602820c8a4940e691aa6003a5f990a57 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*!
- * File generated by platform wizard.
+
+/*
+ * ======== _GateMP_usr.h ========
+ *
+ * Internal header
*
*/
+#ifndef _GATEMP_USR_H
+#define _GATEMP_USR_H
+
+#include <ti/ipc/GateMP.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ * Start the GateMP module.
+ */
+Int GateMP_start(Void);
+
+/*!
+ * Function to stop the GateMP module.
+ */
+Int GateMP_stop(Void);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
-Pkg.attrs.exportAll = true;
+#endif /* _GATEMP_USR_H */
diff --git a/qnx/src/api/Ipc.c b/qnx/src/api/Ipc.c
index d24423b9b6ac2172ea6963ace168759c3fdff65a..23d50dbf035c0177d52a986db96886d8cb2519bd 100644 (file)
--- a/qnx/src/api/Ipc.c
+++ b/qnx/src/api/Ipc.c
#include <ti/ipc/NameServer.h>
#include <_MessageQ.h>
#include <_NameServer.h>
+#include <_GateMP.h>
+#include <_GateMP_usr.h>
+#include <ti/syslink/inc/GateHWSpinlock.h>
#include <ti/syslink/inc/_MultiProc.h>
MultiProc_Config _MultiProc_cfg;
printf("Ipc_start: MessageQ_attach(%d) failed: %d\n",
rprocId, status);
status = Ipc_E_FAIL;
+ goto messageqattach_fail;
}
}
}
else {
printf("Ipc_start: NameServer_setup() failed: %d\n", status);
status = Ipc_E_FAIL;
+ goto nameserversetup_fail;
}
+ /* Start GateMP only if it is setup in the resource manager */
+#if defined(GATEMP_SUPPORT)
+ if (GateMP_isSetup()) {
+ status = GateHWSpinlock_start();
+ if (status < 0) {
+ printf("Ipc_start: GateHWSpinlock_start failed: %d\n",
+ status);
+ status = Ipc_E_FAIL;
+ goto gatehwspinlockstart_fail;
+ }
+ else {
+ status = GateMP_start();
+ if (status < 0) {
+ printf("Ipc_start: GateMP_start failed: %d\n",
+ status);
+ status = Ipc_E_FAIL;
+ goto gatempstart_fail;
+ }
+ }
+ }
+#endif
+ /* Success */
+ goto exit;
+#if defined(GATEMP_SUPPORT)
+gatempstart_fail:
+ GateHWSpinlock_stop();
+gatehwspinlockstart_fail:
+ for (rprocId = rprocId - 1; (rprocId > 0) && (status >= 0); rprocId--) {
+ MessageQ_detach(rprocId);
+ }
+#endif
+messageqattach_fail:
+ MessageQ_destroy();
+ NameServer_destroy();
+nameserversetup_fail:
+ IpcDrv_close();
+
exit:
return (status);
}
{
Int32 status = Ipc_S_SUCCESS;
UInt16 rprocId;
+#if defined(GATEMP_SUPPORT)
+ if (GateMP_isSetup()) {
+ /* Stop GateMP */
+ status = GateMP_stop();
+ if (status < 0) {
+ printf("Ipc_stop: GateMP_stop() failed: %d\n", status);
+ status = Ipc_E_FAIL;
+ goto exit;
+ }
+ /* Finalize GateHWSpinlock */
+ status = GateHWSpinlock_stop();
+ if (status < 0) {
+ printf("Ipc_stop: GateHWSpinlock_stop() failed: %d\n", status);
+ status = Ipc_E_FAIL;
+ goto exit;
+ }
+ }
+#endif
/* Now detach from all remote processors, assuming they are up. */
for (rprocId = 0;
(rprocId < MultiProc_getNumProcessors()) && (status >= 0);
index 3dac43a424a53105aab4e2aca1fe8a954130e085..b6429608a0701ac258afc4c69bbc72d381b38157 100644 (file)
--- a/qnx/src/api/NameServer.c
+++ b/qnx/src/api/NameServer.c
#include <time.h>
#include <ti/ipc/NameServer.h>
+#include <ti/ipc/MultiProc.h>
+
#include <_IpcLog.h>
#include <ti/syslink/inc/_MultiProc.h>
#include <ti/syslink/inc/IoctlDefs.h>
return cmdArgs.args.create.handle;
}
+Ptr NameServer_add(NameServer_Handle nsHandle, String name, Ptr buf,
+ UInt32 len)
+{
+ Int status;
+ NameServerDrv_CmdArgs cmdArgs;
+
+ cmdArgs.args.add.handle = nsHandle;
+ cmdArgs.args.add.name = name;
+ cmdArgs.args.add.nameLen = strlen(name) + 1;
+ cmdArgs.args.add.buf = buf;
+ cmdArgs.args.add.len = len;
+
+ status = NameServerDrv_ioctl(CMD_NAMESERVER_ADD, &cmdArgs);
+
+ if (status < 0) {
+ PRINTVERBOSE1("NameServer_add: API (through IOCTL) failed, \
+ status=%d\n", status)
+ return NULL;
+ }
+
+ return cmdArgs.args.add.entry;
+}
+
+Int NameServer_get(NameServer_Handle handle, String name, Ptr buf,
+ UInt32 * len, UInt16 procId[])
+{
+ Int status;
+ UInt32 procLen = 0;
+ NameServerDrv_CmdArgs cmdArgs;
+
+ cmdArgs.args.get.name = name;
+ cmdArgs.args.get.handle = handle;
+ cmdArgs.args.get.procId = procId;
+ if (procId != NULL) {
+ while (procId[procLen] != MultiProc_INVALIDID) {
+ procLen++;
+ }
+ }
+ cmdArgs.args.get.procLen = procLen;
+ cmdArgs.args.get.buf = buf;
+ cmdArgs.args.get.len = *len;
+ cmdArgs.args.get.nameLen = strlen(name) + 1;
+
+ status = NameServerDrv_ioctl (CMD_NAMESERVER_GET, &cmdArgs);
+
+ if (status < 0) {
+ PRINTVERBOSE1("NameServer_get: API (through IOCTL) failed, \
+ status=%d\n", status)
+ return status;
+ }
+
+ *len = cmdArgs.args.get.len;
+
+ return status;
+}
+
+
Ptr NameServer_addUInt32(NameServer_Handle nsHandle, String name, UInt32 value)
{
Int status;
diff --git a/qnx/src/api/common.mk b/qnx/src/api/common.mk
index a89e2032af205e49ae1cd979f0d2376b8d4cb21c..03f1fd5c809d1e1691ea4e1480139ad137f4f68f 100644 (file)
--- a/qnx/src/api/common.mk
+++ b/qnx/src/api/common.mk
PINFO DESCRIPTION=IPC QNX User library
endef
-# don't install the binaries, they are copied in base makefile
-INSTALLDIR = /dev/null
+INSTALLDIR = /usr/lib
CCOPTS += -DSYSLINK_BUILDOS_QNX
+ifeq ("$(SYSLINK_PLATFORM)", "vayu")
+CCOPTS += -DGATEMP_SUPPORT
+endif
+
# source path
EXTRA_SRCVPATH += \
$(IPC_REPO)/qnx/src/api \
+ $(IPC_REPO)/qnx/src/api/gates
EXCLUDE_OBJS =
include $(MKFILES_ROOT)/qtargets.mk
OPTIMIZE__gcc=$(OPTIMIZE_NONE_gcc)
+
+# install the headers
+POST_INSTALL += \
+ $(CP_HOST) -Rv $(IPC_REPO)/packages/ti/ipc/MessageQ.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/MessageQ.h; \
+ $(CP_HOST) -Rv $(IPC_REPO)/packages/ti/ipc/NameServer.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/NameServer.h; \
+ $(CP_HOST) -Rv $(IPC_REPO)/packages/ti/ipc/GateMP.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/GateMP.h; \
+ $(CP_HOST) -Rv $(IPC_REPO)/packages/ti/ipc/Ipc.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/Ipc.h; \
+ $(CP_HOST) -Rv $(IPC_REPO)/qnx/include/ti/ipc/Std.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/Std.h
diff --git a/qnx/src/api/gates/GateHWSpinlock.c b/qnx/src/api/gates/GateHWSpinlock.c
--- /dev/null
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * ======== GateHWSpinlock.c ========
+ */
+
+/* Standard headers */
+#include <ti/ipc/Std.h>
+
+/* Utilities & OSAL headers */
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/GateMP.h>
+
+#include <ti/syslink/inc/GateHWSpinlock.h>
+
+#include <ti/syslink/utils/IGateProvider.h>
+
+/*
+ * TODO: does this belong in ti/ipc/Std.h? We should consider getting rid of
+ * error blocks from the GateMutex.h interface.
+ */
+typedef UInt32 Error_Block;
+#include <ti/syslink/utils/GateMutex.h>
+
+/* Module level headers */
+#include <ti/syslink/utils/String.h>
+
+#include <_IpcLog.h>
+
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+/*
+ * TODO: Hardcoding these for now. In daemon, we should ideally pass these in
+ * through config in GateHWSpinlock_setup and user lib can query the daemon.
+ */
+#define HWSPINLOCK_BASE 0x4A0F6000
+#define HWSPINLOCK_SIZE 0x1000
+#define HWSPINLOCK_OFFSET 0x800
+
+
+/* =============================================================================
+ * Structures & Enums
+ * =============================================================================
+ */
+/* GateHWSpinlock Module Local State */
+typedef struct {
+ UInt32 * baseAddr; /* base addr lock registers */
+ GateMutex_Handle gmHandle; /* handle to gate mutex */
+} GateHWSpinlock_Module_State;
+
+/* GateHWSpinlock instance object */
+struct GateHWSpinlock_Object {
+ IGateProvider_SuperObject; /* For inheritance from IGateProvider */
+ UInt lockNum;
+ UInt nested;
+ IGateProvider_Handle localGate;
+ int token; /* HWSpinlock token */
+};
+
+
+/* =============================================================================
+ * Globals
+ * =============================================================================
+ */
+static GateHWSpinlock_Module_State GateHWSpinlock_state =
+{
+ .baseAddr = NULL,
+ .gmHandle = NULL
+};
+
+static GateHWSpinlock_Module_State *Mod = &GateHWSpinlock_state;
+
+static GateHWSpinlock_Params GateHWSpinlock_defInstParams =
+{
+ .resourceId = 0,
+ .openFlag = FALSE,
+ .regionId = 0,
+ .sharedAddr = NULL
+};
+
+static Bool verbose = FALSE;
+
+/* =============================================================================
+ * APIS
+ * =============================================================================
+ */
+/*
+ * Function to start the GateHWSpinlock module.
+ */
+Int32 GateHWSpinlock_start(Void)
+{
+ Int32 status = GateHWSpinlock_S_SUCCESS;
+ UInt32 dst;
+
+ /* map the hardware lock registers into the local address space */
+ if (status == GateHWSpinlock_S_SUCCESS) {
+ dst = (UInt32)mmap(NULL, HWSPINLOCK_SIZE,
+ (PROT_READ | PROT_WRITE | PROT_NOCACHE),
+ (MAP_PHYS|MAP_SHARED), NOFD,
+ (off_t)HWSPINLOCK_BASE);
+
+ if (dst == (UInt32)MAP_FAILED) {
+ PRINTVERBOSE0("GateHWSpinlock_start: Memory map failed")
+ status = GateHWSpinlock_E_OSFAILURE;
+ }
+ else {
+ Mod->baseAddr = (UInt32 *)(dst + HWSPINLOCK_OFFSET);
+ status = GateHWSpinlock_S_SUCCESS;
+ }
+ }
+
+ /* create GateMutex for local protection*/
+ if (status == GateHWSpinlock_S_SUCCESS) {
+ Mod->gmHandle = GateMutex_create(NULL, NULL);
+
+ if (Mod->gmHandle == NULL) {
+ PRINTVERBOSE0("GateHWSpinlock_start: GateMutex create failed")
+ status = GateHWSpinlock_E_FAIL;
+ GateHWSpinlock_stop();
+ }
+ }
+
+ return (status);
+}
+
+/*
+ * Function to stop the GateHWSpinlock module.
+ */
+Int GateHWSpinlock_stop(Void)
+{
+ Int32 status = GateHWSpinlock_S_SUCCESS;
+
+ /* delete GateMutex */
+ if (Mod->gmHandle != NULL) {
+ status = GateMutex_delete(&Mod->gmHandle);
+ }
+
+ /* release lock register mapping */
+ if (Mod->baseAddr != NULL) {
+ munmap((void *)HWSPINLOCK_BASE, HWSPINLOCK_SIZE);
+ }
+
+ return(status);
+}
+
+/*
+ * Initialize parameter structure
+ */
+Void GateHWSpinlock_Params_init(GateHWSpinlock_Params *params)
+{
+ assert(params != NULL);
+
+ memcpy(params, &GateHWSpinlock_defInstParams,
+ sizeof(GateHWSpinlock_Params));
+}
+
+/*
+ * Create a GateHWSpinlock instance
+ */
+/* TODO: change the function to accept a local gate. Do this on all platforms */
+GateHWSpinlock_Handle GateHWSpinlock_create(GateHWSpinlock_LocalProtect
+ localProtect, const GateHWSpinlock_Params * params)
+{
+ GateHWSpinlock_Object * obj = (GateHWSpinlock_Object *)calloc(1,
+ sizeof (GateHWSpinlock_Object));
+
+ if (!obj) {
+ PRINTVERBOSE0("GateHWSpinlock_create: memory allocation failure")
+ return NULL;
+ }
+
+ IGateProvider_ObjectInitializer(obj, GateHWSpinlock);
+ /* TODO: handle more local protection types */
+ obj->localGate = (IGateProvider_Handle)Mod->gmHandle;
+ obj->lockNum = params->resourceId;
+ obj->nested = 0;
+
+ return (GateHWSpinlock_Handle)obj;
+}
+
+/*
+ * Delete a GateHWSpinlock instance
+ */
+Int GateHWSpinlock_delete (GateHWSpinlock_Handle * handle)
+{
+ GateHWSpinlock_Object * obj;
+ Int status = GateHWSpinlock_S_SUCCESS;
+
+ if (handle == NULL) {
+ return GateHWSpinlock_E_INVALIDARG;
+ }
+ if (*handle == NULL) {
+ return GateHWSpinlock_E_INVALIDARG;
+ }
+
+ obj = (GateHWSpinlock_Object *)(*handle);
+
+ free(obj);
+ *handle = NULL;
+
+ return (status);
+}
+
+/*
+ * Enter a GateHWSpinlock instance
+ */
+IArg GateHWSpinlock_enter(GateHWSpinlock_Object *obj)
+{
+ volatile UInt32 *baseAddr = Mod->baseAddr;
+ IArg key;
+
+ key = IGateProvider_enter(obj->localGate);
+
+ /* if gate already entered, just return with current key */
+ obj->nested++;
+ if (obj->nested > 1) {
+ return(key);
+ }
+
+ /* enter the spinlock */
+ while (1) {
+ /* read the spinlock, returns non-zero when we get it */
+ if (baseAddr[obj->lockNum] == 0) {
+ break;
+ }
+ obj->nested--;
+ IGateProvider_leave(obj->localGate, key);
+ key = IGateProvider_enter(obj->localGate);
+ obj->nested++; /* re-nest the gate */
+ }
+
+ return (key);
+}
+
+/*
+ * Leave a GateHWSpinlock instance
+ */
+Int GateHWSpinlock_leave(GateHWSpinlock_Object *obj, IArg key)
+{
+ volatile UInt32 *baseAddr = Mod->baseAddr;
+
+ obj->nested--;
+
+ /* release the spinlock if not nested */
+ if (obj->nested == 0) {
+ baseAddr[obj->lockNum] = 0;
+ }
+
+ IGateProvider_leave(obj->localGate, key);
+
+ return GateHWSpinlock_S_SUCCESS;
+}
diff --git a/qnx/src/api/gates/GateMP.c b/qnx/src/api/gates/GateMP.c
--- /dev/null
@@ -0,0 +1,727 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+/*
+ * ======== GateMP.c ========
+ */
+#include <ti/ipc/Std.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <pthread.h>
+#include <assert.h>
+
+#include <ti/ipc/GateMP.h>
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <GateMP_config.h>
+
+#include <_GateMP.h>
+#include <_IpcLog.h>
+
+#include <_GateMP_usr.h>
+
+#include <ti/syslink/inc/IoctlDefs.h>
+#include <ti/syslink/inc/usr/Qnx/GateMPDrv.h>
+#include <ti/syslink/inc/GateMPDrvDefs.h>
+
+/* structure for GateMP module state */
+typedef struct {
+ GateMP_Params defaultInstParams;
+ /* Default instance creation parameters */
+ GateMP_Handle defaultGate;
+ /* Handle to default gate */
+ NameServer_Handle nameServer;
+ /* NameServer for GateMP instances */
+ Bool isStarted;
+ /* Has GateMP been started */
+ pthread_mutex_t mutex;
+ /* Mutex for use on local process to serialize access to gate obj */
+ GateMP_Object ** remoteSystemGates;
+ /* Remote system gates */
+ Int numRemoteSystem;
+ /* Number of remote system gates */
+} GateMP_ModuleObject;
+
+
+static Bool verbose = FALSE;
+
+/* Internal structure defining parameters for GateMP_Instance_init */
+typedef struct {
+ String name; /* Name of instance */
+ UInt16 regionId; /* not used on host*/
+ Ptr sharedAddr; /* not used on host*/
+ GateMP_LocalProtect localProtect; /* Local protection level */
+ GateMP_RemoteProtect remoteProtect; /* Remote protection level */
+ UInt32 resourceId; /* resource id */
+ Bool openFlag; /* Is this open or create? */
+} _GateMP_Params;
+
+static Int GateMP_getNumResources(GateMP_RemoteProtect type);
+static Int GateMP_getFreeResource(GateMP_RemoteProtect type);
+static Int GateMP_releaseResource(UInt id, GateMP_RemoteProtect type);
+static GateMP_Handle _GateMP_create (const _GateMP_Params * params);
+static Int GateMP_Instance_init(GateMP_Object *obj,
+ const _GateMP_Params *params);
+static Void GateMP_Instance_finalize(GateMP_Object *obj, Int status);
+
+/* -----------------------------------------------------------------------------
+ * Globals
+ * -----------------------------------------------------------------------------
+ */
+static GateMP_ModuleObject GateMP_state =
+{
+ .remoteSystemGates = NULL,
+ .defaultGate = NULL,
+ .nameServer = NULL,
+ .mutex = PTHREAD_MUTEX_INITIALIZER,
+// .gateMutex = NULL,
+// .gateProcess = NULL
+};
+
+static GateMP_ModuleObject *GateMP_module = &GateMP_state;
+
+static GateMP_Params GateMP_defInstParams =
+{
+ .name = NULL,
+ .regionId = 0,
+ .sharedAddr = NULL,
+ .localProtect = GateMP_LocalProtect_PROCESS,
+ .remoteProtect = GateMP_RemoteProtect_SYSTEM
+};
+
+Int GateMP_start(Void)
+{
+ Int status;
+ GateMPDrv_CmdArgs cmdArgs;
+
+ status = GateMPDrv_ioctl(CMD_GATEMP_START, &cmdArgs);
+ if (status < 0) {
+ PRINTVERBOSE1("GateMP_start: API (through IOCTL) failed, \
+ status=%d\n", status)
+ }
+ else {
+ /*
+ * Initialize module state. Note that Nameserver handles are compatible
+ * across processes.
+ */
+ GateMP_module->nameServer = cmdArgs.args.start.nameServerHandle;
+ }
+
+ /* allocate memory for remote system gate handles */
+ if (status == GateMP_S_SUCCESS) {
+ GateMP_module->numRemoteSystem =
+ GateMP_getNumResources(GateMP_RemoteProtect_SYSTEM);
+ if (GateMP_module->numRemoteSystem > 0) {
+ GateMP_module->remoteSystemGates = calloc(1,
+ GateMP_module->numRemoteSystem *
+ sizeof(IGateProvider_Handle));
+
+ if (GateMP_module->remoteSystemGates == NULL) {
+ status = GateMP_E_MEMORY;
+ PRINTVERBOSE0("GateMP_start: memory allocation failed")
+ }
+ }
+ else {
+ GateMP_module->remoteSystemGates = NULL;
+ }
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ /* Open default gate */
+ status = GateMP_open("_GateMP_TI_dGate", &GateMP_module->defaultGate);
+ if (status < 0) {
+ PRINTVERBOSE1("GateMP_start: could not open default gate, \
+ status=%d\n", status)
+ }
+ }
+
+ /* in failure case, release acquired resources in reverse order */
+ if (status < 0) {
+ GateMP_stop();
+ }
+
+ GateMP_module->isStarted = TRUE;
+
+ return status;
+}
+
+Int GateMP_stop(Void)
+{
+ Int status = GateMP_S_SUCCESS;
+
+ PRINTVERBOSE0("GateMP_stop: entered\n")
+
+ /* close the default gate */
+ if (GateMP_module->defaultGate) {
+ GateMP_close(&GateMP_module->defaultGate);
+ GateMP_module->defaultGate = NULL;
+ }
+
+ /* free system gate array */
+ if (GateMP_module->remoteSystemGates != NULL) {
+ free(GateMP_module->remoteSystemGates);
+ GateMP_module->remoteSystemGates = NULL;
+ }
+
+ GateMP_module->isStarted = FALSE;
+
+ return status;
+}
+
+Void GateMP_Params_init(GateMP_Params *params)
+{
+ if (params != NULL) {
+ memcpy(params, &GateMP_defInstParams, sizeof(GateMP_Params));
+ }
+ else {
+ PRINTVERBOSE0("GateMP_Params_init: Params argument cannot be NULL")
+ }
+
+ return;
+}
+
+GateMP_Handle GateMP_create(const GateMP_Params *params)
+{
+ _GateMP_Params _params;
+ GateMP_Handle handle = NULL;
+
+ if (GateMP_module->isStarted == FALSE) {
+ PRINTVERBOSE0("GateMP_create: GateMP module has not been started!")
+ }
+ else {
+ memset(&_params, 0, sizeof(_GateMP_Params));
+ memcpy(&_params, params, sizeof(GateMP_Params));
+
+ handle = _GateMP_create(&_params);
+ }
+
+ return(handle);
+}
+
+static GateMP_Handle _GateMP_create(const _GateMP_Params *params)
+{
+ GateMP_Handle handle = NULL;
+ GateMP_Object * obj = NULL;
+ Int status;
+
+ /* allocate the instance object */
+ obj = (GateMP_Object *)calloc(1, sizeof(GateMP_Object));
+
+ if (obj != NULL) {
+ status = GateMP_Instance_init(obj, params);
+ if (status < 0) {
+ free(obj);
+ }
+ else {
+ handle = (GateMP_Handle)obj;
+ }
+ }
+ else {
+ PRINTVERBOSE0("GateMP_create: Memory allocation failed")
+ }
+
+ return(handle);
+}
+
+Int GateMP_open(String name, GateMP_Handle *handle)
+{
+ Int status = GateMP_S_SUCCESS;
+ UInt32 len;
+ UInt32 nsValue[4];
+ GateMP_Object * obj = NULL;
+ UInt32 arg;
+ UInt32 mask;
+ UInt32 creatorProcId;
+ _GateMP_Params params;
+
+ /* assert that a valid pointer has been supplied */
+ if (handle == NULL) {
+ PRINTVERBOSE0("GateMP_open: handle cannot be null")
+ status = GateMP_E_INVALIDARG;
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ len = sizeof(nsValue);
+
+ status = NameServer_get(GateMP_module->nameServer, name, &nsValue,
+ &len, NULL);
+
+ if (status < 0) {
+ *handle = NULL;
+ status = GateMP_E_NOTFOUND;
+ }
+ else {
+ arg = nsValue[2];
+ mask = nsValue[3];
+ creatorProcId = nsValue[1] >> 16;
+ }
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ /*
+ * The least significant bit of nsValue[1] == 0 means its a
+ * local (private) GateMP, otherwise its a remote (shared) GateMP.
+ */
+ if ((nsValue[1] & 0x1) == 0) {
+ if ((nsValue[1] >> 16) != MultiProc_self()) {
+ /* error: trying to open another processor's private gate */
+ *handle = NULL;
+ PRINTVERBOSE0("GateMP_open: cannot open private gate from \
+ another processor")
+ status = GateMP_E_FAIL;
+ }
+ else if (nsValue[0] != getpid()) {
+ /* error: trying to open another process's private gate */
+ *handle = NULL;
+ PRINTVERBOSE0("GateMP_open: cannot open private gate from \
+ another process")
+ status = GateMP_E_FAIL;
+ }
+ }
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ /* local gate */
+ if (GETREMOTE(mask) == GateMP_RemoteProtect_NONE) {
+ if (creatorProcId != MultiProc_self()) {
+ status = GateMP_E_FAIL;
+ }
+ else {
+ *handle = (GateMP_Handle)arg;
+ obj = (GateMP_Object *)(*handle);
+ pthread_mutex_lock(&GateMP_module->mutex);
+ obj->numOpens++;
+ pthread_mutex_unlock(&GateMP_module->mutex);
+ }
+ }
+ else {
+ /* remote case */
+ switch (GETREMOTE(mask)) {
+ case GateMP_RemoteProtect_SYSTEM:
+ case GateMP_RemoteProtect_CUSTOM1:
+ case GateMP_RemoteProtect_CUSTOM2:
+ obj = GateMP_module->remoteSystemGates[arg];
+ break;
+
+ default:
+ status = GateMP_E_FAIL;
+ PRINTVERBOSE0("GateMP_open: unsupported remote protection \
+ type")
+ break;
+ }
+
+ /* If the object is NULL, then it must have been created
+ * on a remote processor or in another process on the
+ * local processor. Need to create a local object. This is
+ * accomplished by setting the openFlag to TRUE.
+ */
+ if (status == GateMP_S_SUCCESS) {
+ if (obj == NULL) {
+ /* create a GateMP object with the openFlag set to true */
+ params.name = NULL;
+ params.openFlag = TRUE;
+ params.sharedAddr = NULL;
+ params.resourceId = arg;
+ params.localProtect = GETLOCAL(mask);
+ params.remoteProtect = GETREMOTE(mask);
+
+ obj = (GateMP_Object *)_GateMP_create(¶ms);
+
+ if (obj == NULL) {
+ status = GateMP_E_FAIL;
+ }
+ }
+ else {
+ pthread_mutex_lock(&GateMP_module->mutex);
+ obj->numOpens++;
+ pthread_mutex_unlock(&GateMP_module->mutex);
+ }
+ }
+
+ /* Return the "opened" GateMP instance */
+ *handle = (GateMP_Handle)obj;
+ }
+ }
+
+ return status;
+}
+
+GateMP_Handle GateMP_getDefaultRemote()
+{
+ return(GateMP_module->defaultGate);
+}
+
+GateMP_LocalProtect GateMP_getLocalProtect(GateMP_Handle handle)
+{
+ GateMP_Object *obj;
+
+ obj = (GateMP_Object *)handle;
+ return(obj->localProtect);
+}
+
+GateMP_RemoteProtect GateMP_getRemoteProtect(GateMP_Handle handle)
+{
+ GateMP_Object *obj;
+
+ obj = (GateMP_Object *)handle;
+ return (obj->remoteProtect);
+}
+
+static Int GateMP_getNumResources(GateMP_RemoteProtect type)
+{
+ Int status;
+ GateMPDrv_CmdArgs cmdArgs;
+
+ cmdArgs.args.getNumResources.type = type;
+ status = GateMPDrv_ioctl(CMD_GATEMP_GETNUMRES, &cmdArgs);
+
+ if (status < 0) {
+ PRINTVERBOSE1("GateMP_getNumResources: API (through IOCTL) failed, \
+ status=%d\n", status)
+ return -1;
+ }
+
+ return (cmdArgs.args.getNumResources.value);
+}
+
+static Int GateMP_getFreeResource(GateMP_RemoteProtect type)
+{
+ Int status;
+ GateMPDrv_CmdArgs cmdArgs;
+
+ cmdArgs.args.getFreeResource.type = type;
+ status = GateMPDrv_ioctl(CMD_GATEMP_GETFREERES, &cmdArgs);
+
+ if (status < 0) {
+ PRINTVERBOSE1("GateMP_getFreeResource: API (through IOCTL) failed, \
+ status=%d\n", status)
+ return -1;
+ }
+
+ return (cmdArgs.args.getFreeResource.id);
+}
+
+static Int GateMP_releaseResource(UInt id, GateMP_RemoteProtect type)
+{
+ Int status;
+ GateMPDrv_CmdArgs cmdArgs;
+
+ cmdArgs.args.releaseResource.type = type;
+ cmdArgs.args.releaseResource.id = id;
+ status = GateMPDrv_ioctl(CMD_GATEMP_RELRES, &cmdArgs);
+
+ if (status < 0) {
+ PRINTVERBOSE1("GateMP_releaseResource: API (through IOCTL) failed, \
+ status=%d\n", status)
+ }
+
+ return (status);
+}
+
+Bool GateMP_isSetup(Void)
+{
+ Int status;
+ GateMPDrv_CmdArgs cmdArgs;
+
+ cmdArgs.args.isSetup.result = FALSE;
+ status = GateMPDrv_ioctl(CMD_GATEMP_ISSETUP, &cmdArgs);
+
+ if (status < 0) {
+ PRINTVERBOSE1("GateMP_isSetup: API (through IOCTL) failed, \
+ status=%d\n", status)
+ }
+
+ assert(status == GateMP_S_SUCCESS);
+
+ return (cmdArgs.args.isSetup.result);
+}
+
+Int GateMP_close(GateMP_Handle *handle)
+{
+ GateMP_Object * obj;
+ Int status = GateMP_S_SUCCESS;
+
+ obj = (GateMP_Object *)(*handle);
+
+ pthread_mutex_lock(&GateMP_module->mutex);
+
+ /* Cannot call with the numOpens equal to zero. This is either
+ * a created handle or been closed already.
+ */
+ if (obj->numOpens == 0) {
+ status = GateMP_E_INVALIDSTATE;
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ obj->numOpens--;
+
+ /* If the count is zero and the gate is opened, then this
+ * object was created in the open (i.e. the create happened
+ * on a remote processor or another process).
+ */
+ if ((obj->numOpens == 0) && (obj->objType == Ipc_ObjType_OPENDYNAMIC)) {
+ GateMP_delete(handle);
+ }
+ else {
+ *handle = NULL;
+ }
+ }
+
+ pthread_mutex_unlock(&GateMP_module->mutex);
+
+ return(status);
+}
+
+Int GateMP_delete(GateMP_Handle *handlePtr)
+{
+ Int status = GateMP_S_SUCCESS;
+
+ if ((handlePtr == NULL) || (*handlePtr == NULL)) {
+ status = GateMP_E_INVALIDARG;
+ }
+ else {
+ GateMP_Instance_finalize((GateMP_Object *)(*handlePtr), 0);
+ free(*handlePtr);
+ *handlePtr = NULL;
+ }
+
+ return status;
+}
+
+static Int GateMP_Instance_init(GateMP_Object *obj,
+ const _GateMP_Params *params)
+{
+ GateMP_RemoteSystemProxy_Params systemParams;
+ UInt32 nsValue[4];
+ Int status;
+
+ status = 0;
+
+ obj->resourceId = (UInt)-1;
+
+ /* TODO: create/open the local gate instance */
+ obj->localGate = NULL;
+
+ /* open GateMP instance */
+ if (params->openFlag == TRUE) {
+ /* all open work done here except for remote gateHandle */
+ obj->localProtect = params->localProtect;
+ obj->remoteProtect = params->remoteProtect;
+ obj->nsKey = 0;
+ obj->numOpens = 1;
+
+ obj->objType = Ipc_ObjType_OPENDYNAMIC;
+ }
+
+ /* create GateMP instance */
+ else {
+ obj->localProtect = params->localProtect;
+ obj->remoteProtect = params->remoteProtect;
+ obj->nsKey = 0;
+ obj->numOpens = 0;
+
+ if (obj->remoteProtect == GateMP_RemoteProtect_NONE) {
+ /* TODO: create a local gate */
+ obj->gateHandle = obj->localGate;
+
+ /* create a local gate allocating from the local heap */
+ obj->objType = Ipc_ObjType_LOCAL;
+ obj->arg = (Bits32)obj;
+ obj->mask = SETMASK(obj->remoteProtect, obj->localProtect);
+ obj->creatorProcId = MultiProc_self();
+
+ if (params->name != NULL) {
+ /* nsv[0] : creator process id
+ * nsv[1](31:16): creator procId
+ * nsv[1](15:0) : 0 = local gate, 1 = remote gate
+ * nsv[2] : local gate object
+ * nsv[3] : protection mask
+ */
+ nsValue[0] = getpid();
+ nsValue[1] = MultiProc_self() << 16;
+ nsValue[2] = obj->arg;
+ nsValue[3] = obj->mask;
+ obj->nsKey = NameServer_add(GateMP_module->nameServer,
+ params->name, &nsValue, sizeof(nsValue));
+ if (obj->nsKey == NULL) {
+ PRINTVERBOSE0("GateMP_Instance_init: NameServer_add failed")
+ return (GateMP_E_FAIL);
+ }
+ }
+
+ /* nothing else to do for local gates */
+ return(0);
+ }
+
+ obj->objType = Ipc_ObjType_CREATEDYNAMIC;
+ }
+
+ /* proxy work for open and create done here */
+ switch (obj->remoteProtect) {
+ /* TODO: implement other types of remote protection */
+ case GateMP_RemoteProtect_SYSTEM:
+ case GateMP_RemoteProtect_CUSTOM1:
+ case GateMP_RemoteProtect_CUSTOM2:
+ if (obj->objType == Ipc_ObjType_OPENDYNAMIC) {
+ /* resourceId set by open call */
+ obj->resourceId = params->resourceId;
+ }
+ else {
+ /* created instance */
+ obj->resourceId = GateMP_getFreeResource(obj->remoteProtect);
+ if (obj->resourceId == -1) {
+ return (GateMP_E_RESOURCE);
+ }
+ }
+
+ /* create the proxy object */
+ GateMP_RemoteSystemProxy_Params_init(&systemParams);
+ systemParams.resourceId = obj->resourceId;
+ systemParams.openFlag = (obj->objType == Ipc_ObjType_OPENDYNAMIC);
+ //systemParams.sharedAddr = obj->proxyAttrs;
+
+ /*
+ * TODO: Currently passing in localProtect instead of localGate,
+ * since existing GateHWSpinlock.h defines it this way
+ */
+ obj->gateHandle = (IGateProvider_Handle)
+ GateMP_RemoteSystemProxy_create(obj->localProtect,
+ &systemParams);
+
+ if (obj->gateHandle == NULL) {
+ PRINTVERBOSE0("GateMP_Instance_init: failed to create proxy\n");
+ return(GateMP_E_FAIL);
+ }
+
+ /* store the object handle in the gate array */
+ GateMP_module->remoteSystemGates[obj->resourceId] = obj;
+ break;
+
+ default:
+ break;
+ }
+
+ /* add name/attrs to NameServer table */
+ if (obj->objType != Ipc_ObjType_OPENDYNAMIC) {
+ obj->arg = obj->resourceId;
+ obj->mask = SETMASK(obj->remoteProtect, obj->localProtect);
+
+ if (params->name != NULL) {
+ /* nsv[0] : creator pid
+ * nsv[1](31:16): creator procId
+ * nsv[1](15:0) : 0 = local gate, 1 = remote gate
+ * nsv[2] : resource id
+ * nsv[3] : protection mask
+ */
+ nsValue[0] = getpid();
+ nsValue[1] = MultiProc_self() << 16 | 1;
+ nsValue[2] = obj->resourceId;
+ nsValue[3] = obj->mask;
+ obj->nsKey = NameServer_add(GateMP_module->nameServer,
+ params->name, &nsValue, sizeof(nsValue));
+
+ if (obj->nsKey == NULL) {
+ PRINTVERBOSE0("GateMP_Instance_init: NameServer_add failed")
+ return (GateMP_E_FAIL);
+ }
+ }
+ }
+
+ return (GateMP_S_SUCCESS);
+}
+
+static Void GateMP_Instance_finalize(GateMP_Object *obj, Int status)
+{
+ GateMP_Object ** remoteGates = NULL;
+
+ /* remove from NameServer */
+ if (obj->nsKey != 0) {
+ NameServer_removeEntry(GateMP_module->nameServer, obj->nsKey);
+ obj->nsKey = 0;
+ }
+
+ /* delete the remote gate */
+ switch (obj->remoteProtect) {
+
+ case GateMP_RemoteProtect_SYSTEM:
+ case GateMP_RemoteProtect_CUSTOM1:
+ case GateMP_RemoteProtect_CUSTOM2:
+ if (obj->gateHandle != NULL) {
+ GateMP_RemoteSystemProxy_delete(
+ (GateMP_RemoteSystemProxy_Handle *)&obj->gateHandle);
+ }
+ remoteGates = GateMP_module->remoteSystemGates;
+ break;
+
+ case GateMP_RemoteProtect_NONE:
+ /* nothing else to finalize */
+ return;
+
+ default:
+ /* Nothing to do */
+ break;
+ }
+
+ /* TODO: close/delete local gate */
+
+ /* clear the handle array entry in local memory */
+ if (obj->resourceId != (UInt)-1) {
+ remoteGates[obj->resourceId] = NULL;
+ }
+
+ if ((obj->objType != Ipc_ObjType_OPENDYNAMIC)
+ && (obj->resourceId != (UInt)-1)) {
+ GateMP_releaseResource(obj->resourceId, obj->remoteProtect);
+ }
+
+}
+
+IArg GateMP_enter(GateMP_Handle handle)
+{
+ GateMP_Object * obj;
+ IArg key;
+
+ obj = (GateMP_Object *)handle;
+ key = IGateProvider_enter(obj->gateHandle);
+
+ return(key);
+}
+
+Void GateMP_leave(GateMP_Handle handle, IArg key)
+{
+ GateMP_Object *obj;
+
+ obj = (GateMP_Object *)handle;
+ IGateProvider_leave(obj->gateHandle, key);
+}
diff --git a/qnx/src/api/gates/GateMutex.c b/qnx/src/api/gates/GateMutex.c
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+/*
+ * ======== GateMutex.c ========
+ */
+
+
+/* Standard headers */
+#include <ti/ipc/Std.h>
+
+/* QNX headers */
+#include <stdlib.h>
+#include <pthread.h>
+#include <string.h>
+#include <assert.h>
+
+#include <ti/syslink/utils/IGateProvider.h>
+
+/*
+ * TODO: does this belong in ti/ipc/Std.h? We should consider getting rid of
+ * error blocks from the GateMutex.h interface.
+ */
+typedef UInt32 Error_Block;
+#include <ti/syslink/utils/GateMutex.h>
+
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * Structs & Enums
+ * -----------------------------------------------------------------------------
+ */
+struct GateMutex_Object {
+ IGateProvider_SuperObject; /* For inheritance from IGateProvider */
+ pthread_mutex_t mutex; /* Mutex lock */
+};
+
+
+/* -----------------------------------------------------------------------------
+ * Forward declarations
+ * -----------------------------------------------------------------------------
+ */
+IArg GateMutex_enter(GateMutex_Handle gmhandle);
+Void GateMutex_leave(GateMutex_Handle gmhandle, IArg key);
+
+
+/* -----------------------------------------------------------------------------
+ * APIs
+ * -----------------------------------------------------------------------------
+ */
+GateMutex_Handle GateMutex_create(const GateMutex_Params * params,
+ Error_Block *eb)
+{
+ pthread_mutexattr_t attr;
+
+ GateMutex_Object * obj = (GateMutex_Object *)calloc(1,
+ sizeof(GateMutex_Object));
+ if (obj == NULL) {
+ return NULL;
+ }
+
+ memset(obj, 0, sizeof(GateMutex_Object));
+ IGateProvider_ObjectInitializer(obj, GateMutex);
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_setrecursive(&attr, PTHREAD_RECURSIVE_ENABLE);
+ pthread_mutex_init(&(obj->mutex), &attr);
+
+ return (GateMutex_Handle)obj;
+}
+
+Int GateMutex_delete(GateMutex_Handle * handle)
+{
+ if (handle == NULL) {
+ return GateMutex_E_INVALIDARG;
+ }
+ if (*handle == NULL) {
+ return GateMutex_E_INVALIDARG;
+ }
+ free(*handle);
+ *handle = NULL;
+
+ return GateMutex_S_SUCCESS;
+}
+
+IArg GateMutex_enter (GateMutex_Handle gmHandle)
+{
+ GateMutex_Object * obj = (GateMutex_Object *)gmHandle;
+ int ret;
+
+ ret = pthread_mutex_lock(&(obj->mutex));
+ assert(ret == 0);
+
+ return (IArg)ret;
+}
+
+Void GateMutex_leave (GateMutex_Handle gmHandle, IArg key)
+{
+ GateMutex_Object * obj = (GateMutex_Object *)gmHandle;
+ int ret;
+
+ ret = pthread_mutex_unlock(&(obj->mutex));
+ assert(ret == 0);
+}
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
diff --git a/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7/Makefile b/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7/Makefile
--- /dev/null
@@ -0,0 +1,32 @@
+#
+# 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.
+#
+
+include ../../common.mk
diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/common.mk b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/common.mk
index 3b64f2e114fb437f2477ed054c2979baf225ea46..3adc25bcbc7ec0e4feb76de7a65a99f3d20339d2 100644 (file)
ifeq ("$(SYSLINK_PLATFORM)", "omap5430")
EXTRA_SRCVPATH+=$(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM) \
$(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM)/ipu
+
+EXCLUDE_OBJS = GateMP_daemon.o gatemp_devctl.o
endif
ifeq ("$(SYSLINK_PLATFORM)", "ti81xx")
$(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM) \
$(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM)/$(SYSLINK_PLATFORM)dsp \
$(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM)/$(SYSLINK_PLATFORM)ipu \
- $(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM)/$(SYSLINK_PLATFORM)ipu/$(SYSLINK_PLATFORM)core1
+ $(SYSLINK_ROOT)/ti/syslink/family/$(SYSLINK_PLATFORM)/$(SYSLINK_PLATFORM)ipu/$(SYSLINK_PLATFORM)core1 \
+ $(IPC_REPO)/qnx/src/api/gates
+
+EXCLUDE_OBJS = GateMP.o
endif
include $(MKFILES_ROOT)/qtargets.mk
diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/dcmd_syslink.h b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/dcmd_syslink.h
index f13e7cb20095f3b0d2d712ba9a6b13fe266e5b7d..5cfbff3d6ac1f9c97c4206b3e96b130875cb7ba9 100644 (file)
typedef enum {
_DCMD_SYSLINK_NAMESERVER = 0x2A,
_DCMD_SYSLINK_MESSAGEQ,
- _DCMD_SYSLINK_MULTIPROC
+ _DCMD_SYSLINK_MULTIPROC,
+ _DCMD_SYSLINK_GATEMP
} dcmd_class_t_val;
/* ----------------------------------------------------------------------------
#define DCMD_NAMESERVER_GETUINT32 __DIOTF(_DCMD_SYSLINK_NAMESERVER,\
10, \
NameServerDrv_CmdArgs)
+/*!
+ * @brief Command for NameServer_add
+ */
+#define DCMD_NAMESERVER_ADD __DIOTF(_DCMD_SYSLINK_NAMESERVER,\
+ 11,\
+ NameServerDrv_CmdArgs)
+/*!
+ * @brief Command for NameServer_get
+ */
+#define DCMD_NAMESERVER_GET __DIOTF(_DCMD_SYSLINK_NAMESERVER,\
+ 12, \
+ NameServerDrv_CmdArgs)
/* ----------------------------------------------------------------------------
1,\
MultiProcDrv_CmdArgs)
+/* ----------------------------------------------------------------------------
+* IOCTL command IDs for GateMP
+* ----------------------------------------------------------------------------
+*/
+
+/*!
+ * @brief Command for GateMP_getFreeResource
+ */
+#define DCMD_GATEMP_GETFREERES __DIOTF(_DCMD_SYSLINK_GATEMP,\
+ 1,\
+ GateMPDrv_CmdArgs)
+
+/*!
+ * @brief Command for GateMP_releaseResource
+ */
+#define DCMD_GATEMP_RELRES __DIOTF(_DCMD_SYSLINK_GATEMP,\
+ 2,\
+ GateMPDrv_CmdArgs)
+
+/*!
+ * @brief Command for GateMP_getNumResources
+ */
+#define DCMD_GATEMP_GETNUMRES __DIOTF(_DCMD_SYSLINK_GATEMP,\
+ 3,\
+ GateMPDrv_CmdArgs)
+
+/*!
+ * @brief Command for GateMP_start
+ */
+#define DCMD_GATEMP_START __DIOTF(_DCMD_SYSLINK_GATEMP,\
+ 4,\
+ GateMPDrv_CmdArgs)
+
+/*!
+ * @brief Command for GateMP_isSetup
+ */
+#define DCMD_GATEMP_ISSETUP __DIOTF(_DCMD_SYSLINK_GATEMP,\
+ 5,\
+ GateMPDrv_CmdArgs)
+
#if defined (__cplusplus)
}
#endif
diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/ipc.use b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/ipc.use
index ded50909bd6d3e5e3520115210c873b1d6c5295e..642cfbc7ea5df85498fe9625f8ef665668492532 100644 (file)
ipc - IPC Resource Manager
-ipc [-fHT]
+ipc: [-HTg] <core_id1> <executable1> [<core_id2> <executable2> ...]
+
+ <core_id#> should be set to a core name
+ followed by the path to the executable to load on that core.
Options:
- -f <file_name> Name of the Ducati firmware file to load. *Must be specified*
-H <option> Enable/Disable Ducati hibernation. Default: 1
where <option> is:
0: OFF
1: ON
+ Supported on: OMAP54xx
-T <timeout> Set the timeout value of the Ducati hibernation in ms.
- Default: 5000 ms
\ No newline at end of file
+ Default: 5000 ms
+ Supported on: OMAP54xx
+ -g Enable GateMP support on host
+ Supported on: DRA7xx
diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_devctl.c b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_devctl.c
index 359604d64cb09d9286b1aa4a6c89d85effa6f3e1..b66cdb749870461134b281e76ad73dab3473e594 100644 (file)
syslink_ocb_t * ocb);
extern int syslink_multiproc_devctl(resmgr_context_t *ctp, io_devctl_t *msg,
syslink_ocb_t * ocb);
+extern int syslink_gatemp_devctl(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t * ocb);
/**
* Handler for devctl() messages.
@@ -118,9 +120,11 @@ int syslink_devctl(resmgr_context_t *ctp, io_devctl_t *msg, syslink_ocb_t *ocb)
case MESSAGEQCOPY_BASE_CMD:
status = MessageQCopyDrv_devctl( ctp, msg, ocb);
break;
+#ifndef SYSLINK_PLATFORM_VAYU
case HWSPINLOCKDRV_BASE_CMD:
status = GateHWSpinlockDrv_devctl(ctp, msg, ocb);
break;
+#endif
case _DCMD_SYSLINK_NAMESERVER:
status = syslink_nameserver_devctl(ctp, msg, ocb);
break;
@@ -130,6 +134,11 @@ int syslink_devctl(resmgr_context_t *ctp, io_devctl_t *msg, syslink_ocb_t *ocb)
case _DCMD_SYSLINK_MULTIPROC:
status = syslink_multiproc_devctl(ctp, msg, ocb);
break;
+#ifdef SYSLINK_PLATFORM_VAYU
+ case _DCMD_SYSLINK_GATEMP:
+ status = syslink_gatemp_devctl(ctp, msg, ocb);
+ break;
+#endif
default:
status = _RESMGR_ERRNO(ENOSYS);
GT_1trace( curTrace, GT_3CLASS,
diff --git a/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_main.c b/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/resmgr/syslink_main.c
index 6314f59e3d6e5f986049d112f89f07cd612f44d0..0cf0b509784d59c745b647db5e021f96bb9cbdf8 100644 (file)
#include <ti/syslink/utils/List.h>
#include <ti/syslink/utils/MemoryOS.h>
#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/NameServer.h>
#include <_MultiProc.h>
+#include <_NameServer.h>
+#include <_GateMP_daemon.h>
#include <OsalSemaphore.h>
#include <ti/syslink/utils/OsalPrint.h>
#if defined(SYSLINK_PLATFORM_OMAP4430) || defined(SYSLINK_PLATFORM_OMAP5430)
#else
static int verbosity = 2;
#endif
+
+#if defined(SYSLINK_PLATFORM_VAYU)
+static bool gatempEnabled = false;
+#endif
static char trace_buffer[TRACE_BUFFER_SIZE];
static pthread_mutex_t trace_mutex = PTHREAD_MUTEX_INITIALIZER;
static Bool trace_active;
syslink_ocb_t * ocb = (syslink_ocb_t *)i_ocb;
if (ocb) {
+#ifndef SYSLINK_PLATFORM_VAYU
GateHWSpinlock_LeaveLockForPID(ocb->pid);
+#endif
free (ocb);
}
}
@@ -714,7 +723,13 @@ int init_ipc(syslink_dev_t * dev, syslink_firmware_info * firmware, bool recover
for (i = 0; i < syslink_num_cores; i++) {
procId = firmware[i].proc_id = MultiProc_getId(firmware[i].proc);
- if (procId >= MultiProc_MAXPROCESSORS || procH[procId]) {
+ if (procId >= MultiProc_MAXPROCESSORS) {
+ status = -1;
+ fprintf(stderr, "Invalid processor name specified\n");
+ break;
+ }
+
+ if (procH[procId]) {
GT_setFailureReason (curTrace,
GT_4CLASS,
"init_ipc",
if (status < 0)
goto rpcsetup_fail;
+#if defined(SYSLINK_PLATFORM_VAYU)
+ if (gatempEnabled) {
+ /* Set up NameServer for resource manager process */
+ status = NameServer_setup();
+ if (status < 0) {
+ goto nameserversetup_fail;
+ }
+
+ /* Set up GateMP */
+ status = GateMP_setup();
+ if (status < 0) {
+ goto gatempsetup_fail;
+ }
+ }
+#endif
+
goto exit;
}
+#if defined(SYSLINK_PLATFORM_VAYU)
+gatempsetup_fail:
+ NameServer_destroy();
+nameserversetup_fail:
+ rpmsg_rpc_destroy();
+#endif
rpcsetup_fail:
ti_ipc_destroy(recover);
tiipcsetup_fail:
for (i-=1; i >= 0; i--) {
procId = firmware[i].proc_id;
+ if (procId >= MultiProc_MAXPROCESSORS) {
+ continue;
+ }
ProcMgr_unregisterNotify(procH[procId], syslink_error_cb,
(Ptr)dev, errStates);
ProcMgr_stop(procH[procId]);
}
}
+#if defined(SYSLINK_PLATFORM_VAYU)
+ if (gatempEnabled) {
+ GateMP_destroy();
+
+ NameServer_destroy();
+ }
+#endif
+
rpmsg_rpc_destroy();
ti_ipc_destroy(recover);
/** print usage */
static Void printUsage (Char * app)
{
- printf ("\n%s: [-fHT]\n", app);
- printf (" -f specify the binary file to load to the remote cores)\n");
+ printf("\n\nUsage:\n");
#if defined(SYSLINK_PLATFORM_OMAP5430)
- printf (" -d specify the binary file to load to the dsp)\n");
+ printf("\n%s: [-HT] <core_id1> <executable1> [<core_id2> <executable2> ...]\n",
+ app);
+ printf(" <core_id#> should be set to a core name (e.g. IPU, DSP)\n");
+ printf(" followed by the path to the executable to load on that core.\n");
+ printf("Options:\n");
+ printf(" -H enable/disable hibernation, 1: ON, 0: OFF, Default: 1)\n");
+ printf(" -T specify the hibernation timeout in ms, Default: 5000 ms)\n");
+#else
+ printf("\n%s: [-g] <core_id1> <executable1> [<core_id2> <executable2> ...]\n",
+ app);
+ printf(" <core_id#> should be set to a core name (e.g. DSP1, IPU2)\n");
+ printf(" followed by the path to the executable to load on that core.\n");
+ printf("Options:\n");
+ printf(" -g enable GateMP support on host\n");
#endif
- printf (" -H enable/disable hibernation, 1: ON, 0: OFF, Default: 1)\n");
- printf (" -T specify the hibernation timeout in ms, Default: 5000 ms)\n");
-
exit (EXIT_SUCCESS);
}
/* Parse the input args */
while (1)
{
- c = getopt (argc, argv, "f:d:H:T:U:v:");
+ c = getopt (argc, argv, "H:T:U:gv:");
if (c == -1)
break;
switch (c)
{
- case 'f':
- /* for backward compatibility, "-f" option loaded Ducati/Benelli */
- syslink_firmware[syslink_num_cores].firmware = optarg;
-#if defined(SYSLINK_PLATFORM_OMAP4430)
- syslink_firmware[syslink_num_cores].proc = "SYSM3";
-#else
-#ifndef SYSLINK_SYSBIOS_SMP
- syslink_firmware[syslink_num_cores].proc = "CORE0";
-#else
- syslink_firmware[syslink_num_cores].proc = "IPU";
-#endif
-#endif
- syslink_num_cores++;
-#ifndef SYSLINK_SYSBIOS_SMP
- syslink_firmware[syslink_num_cores].firmware = NULL;
-#if defined(SYSLINK_PLATFORM_OMAP4430)
- syslink_firmware[syslink_num_cores].proc = "APPM3";
-#else
- syslink_firmware[syslink_num_cores].proc = "CORE1";
-#endif
- syslink_num_cores++;
-#endif
- break;
#if defined(SYSLINK_PLATFORM_OMAP5430)
- case 'd':
- syslink_firmware[syslink_num_cores].firmware = optarg;
- syslink_firmware[syslink_num_cores].proc = "DSP";
- syslink_num_cores++;
- break;
-#endif
case 'H':
hib_enable = atoi(optarg);
if (hib_enable != 0 && hib_enable != 1) {
case 'T':
hib_timeout = atoi(optarg);
break;
+#endif
case 'U':
user_parm = optarg;
break;
case 'v':
verbosity++;
break;
+#if defined(SYSLINK_PLATFORM_VAYU)
+ case 'g':
+ printf("GateMP support enabled on host\n");
+ gatempEnabled = true;
+ break;
+#endif
default:
fprintf (stderr, "Unrecognized argument\n");
}
/* Get the name of the binary from the input args */
if (!syslink_num_cores) {
- fprintf(stderr, "-f or -d or <core_id> option must be specified");
+ fprintf(stderr, "At least one core_id and executable must be "\
+ "specified");
printUsage(argv[0]);
return (error);
}
return -1;
}
if (NULL == realpath(syslink_firmware[i].firmware, abs_path)) {
- fprintf (stderr, "realpath failed\n");
+ fprintf (stderr, "invalid path to executable\n");
return -1;
}
syslink_firmware[i].firmware = abs_path;
diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/vayu/Platform.c b/qnx/src/ipc3x_dev/ti/syslink/family/vayu/Platform.c
index e2b337e3578abb093c2ee403e3e77f206a9106d2..187b4606e81d5282bc74b921bfb379ebfaf9dc09 100644 (file)
#include <_MultiProc.h>
#include <IpcKnl.h>
#include <sys/mman.h>
+#include <GateHWSpinlock.h>
#if defined (__cplusplus)
extern "C" {
* Macros.
* ============================================================================
*/
+/* Hardware spinlocks info */
+#define HWSPINLOCK_BASE 0x4A0F6000
+#define HWSPINLOCK_SIZE 0x1000
+#define HWSPINLOCK_OFFSET 0x800
/** ============================================================================
* Application specific configuration, please change these value according to
ElfLoader_Config elfLoaderConfig;
/*!< Elf loader config parameter */
+
+ GateHWSpinlock_Config gateHWSpinlockConfig;
+ /*!< GateHWSpinlock config parameter */
} Platform_Config;
/*! @brief structure for platform instance */
/*!< IpcInt Initialize flag */
Bool platformInitFlag;
/*!< Flag to indicate platform initialization status */
+ Bool gateHWSpinlockInitFlag;
+ /*!< GateHWSpinlock Initialize flag */
+ Ptr gateHWSpinlockVAddr;
+ /*!< GateHWSpinlock Virtual Address */
} Platform_Module_State;
/* Get the ElfLoader default config */
ElfLoader_getConfig (&config->elfLoaderConfig);
+
+ /* Get the HWSpinlock default config */
+ GateHWSpinlock_getConfig (&config->gateHWSpinlockConfig);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
}
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
Platform_Config _config;
Platform_Config * config;
VAYUIpcInt_Config VAYUcfg;
+ Memory_MapInfo minfo;
Platform_getConfig (&_config);
config = &_config;
}
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
}
+ if (status >= 0) {
+ minfo.src = HWSPINLOCK_BASE;
+ minfo.size = HWSPINLOCK_SIZE;
+ minfo.isCached = FALSE;
+ status = Memory_map (&minfo);
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_setup",
+ status,
+ "Memory_map failed!");
+ }
+ else {
+ Platform_module->gateHWSpinlockVAddr = (Ptr)minfo.dst;
+ config->gateHWSpinlockConfig.numLocks = 32;
+ config->gateHWSpinlockConfig.baseAddr = minfo.dst + HWSPINLOCK_OFFSET;
+ status = GateHWSpinlock_setup (&config->gateHWSpinlockConfig);
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_setup",
+ status,
+ "GateHWSpinlock_setup failed!");
+ }
+ else {
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ status = GateHWSpinlock_start();
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_setup",
+ status,
+ "GateHWSpinlock_start failed!");
+ }
+ else {
+ Platform_module->gateHWSpinlockInitFlag = TRUE;
+ }
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ }
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+ }
if (status < 0) {
Platform_destroy();
Platform_destroy (void)
{
Int32 status = Platform_S_SUCCESS;
+ Memory_UnmapInfo minfo;
GT_0trace (curTrace, GT_ENTER, "Platform_destroy");
(sizeof (Platform_Object) * MultiProc_getNumProcessors()));
}
+ if (Platform_module->gateHWSpinlockInitFlag == TRUE) {
+ status = GateHWSpinlock_stop();
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_destroy",
+ status,
+ "GateHWSpinlock_stop failed!");
+ }
+ else {
+ status = GateHWSpinlock_destroy();
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_destroy",
+ status,
+ "GateHWSpinlock_destroy failed!");
+ }
+ else {
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ Platform_module->gateHWSpinlockInitFlag = FALSE;
+ }
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ }
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ }
+
+ if (Platform_module->gateHWSpinlockVAddr) {
+ minfo.addr = (UInt32)Platform_module->gateHWSpinlockVAddr;
+ minfo.size = HWSPINLOCK_SIZE;
+ minfo.isCached = FALSE;
+ status = Memory_unmap(&minfo);
+#if !defined(SYSLINK_BUILD_OPTIMIZE)
+ if (status < 0) {
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "Platform_destroy",
+ status,
+ "Memory_unmap failed!");
+ }
+#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+ Platform_module->gateHWSpinlockVAddr = NULL;
+ }
+
GT_1trace (curTrace, GT_LEAVE, "Platform_destroy", status);
/*! @retval Platform_S_SUCCESS Operation successful */
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/GateHWSpinlock.h b/qnx/src/ipc3x_dev/ti/syslink/inc/GateHWSpinlock.h
index 80fa35b6f31030b9bdf0e771e1879b419843197f..0aa76a9a008970b0c3992f5af2ad50b63c957762 100644 (file)
-/**
- * @file GateHWSpinlock.h
+/*
+ * Copyright (c) 2008-2013, Texas Instruments Incorporated
+ * All rights reserved.
*
- * @brief Defines for Gate based on Hardware SpinLock.
+ * 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.
*
- * @ver 02.00.00.46_alpha1
+ * * 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.
*
- * ============================================================================
- *
- * Copyright (c) 2008-20012, 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.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
+ * * 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.
+ */
+/*
+ * ======== GateHWSpinlock.h ========
*/
-
#ifndef GATEHWSPINLOCK_H_0xF416
#define GATEHWSPINLOCK_H_0xF416
/* Utilities & Osal headers */
#include <ti/syslink/Std.h>
+#include <ti/ipc/GateMP.h>
+
#if defined (__cplusplus)
extern "C" {
#endif
*/
#define GateHWSpinlock_MODULEID (0xc43d)
-typedef enum GateMP_LocalProtect {
- GateMP_LocalProtect_NONE = 0,
- /*!< Use no local protection */
-
- GateMP_LocalProtect_INTERRUPT = 1,
- /*!< Use the INTERRUPT local protection level */
-
- GateMP_LocalProtect_TASKLET = 2,
- /*!< Use the TASKLET local protection level */
-
- GateMP_LocalProtect_THREAD = 3,
- /*!< Use the THREAD local protection level */
-
- GateMP_LocalProtect_PROCESS = 4
- /*!< Use the PROCESS local protection level */
-
-} GateMP_LocalProtect;
-
/* =============================================================================
* Module Success and Failure codes
* =============================================================================
Int
GateHWSpinlock_destroy (Void);
+/* Initialize parameter structure */
+Void GateHWSpinlock_Params_init(GateHWSpinlock_Params *params);
+
+/* Function to start GateHWSpinlock module */
+Int32 GateHWSpinlock_start(Void);
+
+/* Funciton to stop GateHWSpinlock module */
+Int GateHWSpinlock_stop(Void);
+
/* Function to create an instance of GateHWSpinlock */
GateHWSpinlock_Handle
GateHWSpinlock_create ( GateHWSpinlock_LocalProtect localProtect,
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/GateMPDrvDefs.h b/qnx/src/ipc3x_dev/ti/syslink/inc/GateMPDrvDefs.h
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2013, 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 GateMPDrvDefs.h
+ *
+ * @brief Definitions of GateMPDrv types and structures.
+ *
+ */
+
+
+#ifndef GATEMP_DRVDEFS_H
+#define GATEMP_DRVDEFS_H
+
+
+#include <ti/ipc/GateMP.h>
+#include <ti/ipc/NameServer.h>
+
+#include "UtilsCmdBase.h"
+#include "_GateMP.h"
+#include "_MultiProc.h"
+#include <ti/syslink/inc/IoctlDefs.h>
+
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* ----------------------------------------------------------------------------
+ * IOCTL command IDs for GateMP
+ * ----------------------------------------------------------------------------
+ */
+/*!
+ * @brief Base command ID for GateMP
+ */
+#define GATEMP_BASE_CMD (0x160)
+
+/*!
+ * @brief Command for GateMP_getFreeResource
+ */
+#define CMD_GATEMP_GETFREERES _IOWR(UTILSCMDBASE,\
+ GATEMP_BASE_CMD + 1u,\
+ GateMPDrv_CmdArgs)
+/*!
+ * @brief Command for GateMP_releaseResource
+ */
+#define CMD_GATEMP_RELRES _IOWR(UTILSCMDBASE,\
+ GATEMP_BASE_CMD + 2u,\
+ GateMPDrv_CmdArgs)
+/*!
+ * @brief Command for GateMP_getNumResource
+ */
+#define CMD_GATEMP_GETNUMRES _IOWR(UTILSCMDBASE,\
+ GATEMP_BASE_CMD + 3u,\
+ GateMPDrv_CmdArgs)
+/*!
+ * @brief Command for GateMP_start
+ */
+#define CMD_GATEMP_START _IOWR(UTILSCMDBASE,\
+ GATEMP_BASE_CMD + 4u,\
+ GateMPDrv_CmdArgs)
+/*!
+ * @brief Command for GateMP_isSetup
+ */
+#define CMD_GATEMP_ISSETUP _IOWR(UTILSCMDBASE,\
+ GATEMP_BASE_CMD + 5u,\
+ GateMPDrv_CmdArgs)
+
+
+
+/* ----------------------------------------------------------------------------
+ * Command arguments for GateMP
+ * ----------------------------------------------------------------------------
+ */
+/*!
+ * @brief Command arguments for GateMP
+ */
+typedef struct GateMPDrv_CmdArgs {
+ union {
+ struct {
+ GateMP_RemoteProtect type;
+ Int32 id;
+ } getFreeResource;
+
+ struct {
+ GateMP_RemoteProtect type;
+ Int32 id;
+ } releaseResource;
+
+ struct {
+ GateMP_RemoteProtect type;
+ Int32 value;
+ } getNumResources;
+
+ struct {
+ NameServer_Handle nameServerHandle;
+ } start;
+
+ struct {
+ Bool result;
+ } isSetup;
+ } args;
+
+ Int32 apiStatus;
+} GateMPDrv_CmdArgs;
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+
+#endif /* GateMP_DrvDefs_H */
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/NameServerDrvDefs.h b/qnx/src/ipc3x_dev/ti/syslink/inc/NameServerDrvDefs.h
index 675484dc39d042bcaf95cd069e9a74da9627b8d2..f3358aa84bbc7fc6c66fb2c4162356352e5a28a1 100644 (file)
NAMESERVER_BASE_CMD + 9u,\
NameServerDrv_CmdArgs)
/*!
- * @brief Command for NameServer_close
+ * @brief Command for NameServer_getUInt32
*/
#define CMD_NAMESERVER_GETUINT32 _IOWR(UTILSCMDBASE,\
NAMESERVER_BASE_CMD + 10u,\
NameServerDrv_CmdArgs)
+/*!
+ * @brief Command for NameServer_add
+ */
+#define CMD_NAMESERVER_ADD _IOWR(UTILSCMDBASE,\
+ NAMESERVER_BASE_CMD + 11u,\
+ NameServerDrv_CmdArgs)
+
+/*!
+ * @brief Command for NameServer_get
+ */
+#define CMD_NAMESERVER_GET _IOWR(UTILSCMDBASE,\
+ NAMESERVER_BASE_CMD + 12u,\
+ NameServerDrv_CmdArgs)
/* ----------------------------------------------------------------------------
* Command arguments for NameServer
NameServer_Handle handle;
} delete;
+ struct {
+ NameServer_Handle handle;
+ String name;
+ UInt32 nameLen;
+ Ptr buf;
+ UInt32 len;
+ Ptr entry;
+ } add;
+
+ struct {
+ NameServer_Handle handle;
+ String name;
+ UInt32 nameLen;
+ Ptr buf;
+ UInt32 len;
+ UInt16 * procId;
+ UInt32 procLen;
+ } get;
+
struct {
NameServer_Handle handle;
String name;
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/_GateMP_daemon.h b/qnx/src/ipc3x_dev/ti/syslink/inc/_GateMP_daemon.h
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * ======== _GateMP_daemon.h ========
+ *
+ * Internal header
+ *
+ */
+
+#ifndef _GATEMP_DAEMON_H
+#define _GATEMP_DAEMON_H
+
+#include <ti/ipc/GateMP.h>
+#include <ti/ipc/NameServer.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ * Setup the GateMP module.
+ */
+Int GateMP_setup(Void);
+
+/*!
+ * Function to destroy the GateMP module.
+ */
+Void GateMP_destroy(Void);
+
+/*!
+ * Find a free resource id for a particular protection type.
+ */
+Int GateMP_getFreeResource(GateMP_RemoteProtect type);
+
+/*!
+ * Release a resource id for a particular protection type.
+ */
+Int GateMP_releaseResource(UInt id, GateMP_RemoteProtect type);
+
+/*!
+ * Get the total number of resources for a particular protection type.
+ */
+Int GateMP_getNumResources(GateMP_RemoteProtect type);
+
+/*!
+ * Get the NameServer handle for GateMP.
+ */
+NameServer_Handle GateMP_getNameServer(Void);
+
+/*!
+ * Find out whether GateMP is setup
+ */
+Bool GateMP_isSetup(Void);
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+#endif /* _GATEMP_DAEMONH */
diff --git a/packages/ti/platform/vayu/ipu2/Platform.xs b/qnx/src/ipc3x_dev/ti/syslink/inc/_NameServer_daemon.h
similarity index 75%
rename from packages/ti/platform/vayu/ipu2/Platform.xs
rename to qnx/src/ipc3x_dev/ti/syslink/inc/_NameServer_daemon.h
index 18b7b1b1b6934c6b7ba79865bcdf6ce0e259ebf5..b58baa0aa7d5642e7e23a49ceda756481a468265 100644 (file)
rename from packages/ti/platform/vayu/ipu2/Platform.xs
rename to qnx/src/ipc3x_dev/ti/syslink/inc/_NameServer_daemon.h
index 18b7b1b1b6934c6b7ba79865bcdf6ce0e259ebf5..b58baa0aa7d5642e7e23a49ceda756481a468265 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*!
- * File generated by platform wizard.
+
+/*
+ * ======== _NameServer_daemon.h ========
+ *
+ * Internal header
*
*/
-function getCpuDataSheet(cpuId)
-{
- return this.$module.plat.getCpuDataSheet(cpuId);
-}
+#ifndef _NAMESERVER_DAEMON_H
+#define _NAMESERVER_DAEMON_H
-function getCreateArgs()
-{
- return this.$module.plat.getCreateArgs();
-}
+#include <ti/ipc/NameServer.h>
-function getExeContext(prog)
-{
- return this.$module.plat.getExeContext(prog);
-}
+#if defined (__cplusplus)
+extern "C" {
+#endif
-function getExecCmd(prog)
-{
- return this.$module.plat.getExecCmd(prog);
-}
+/*!
+ * Setup the NameServer module.
+ */
+Int NameServer_setup(Void);
-function getLinkTemplate(prog)
-{
- return this.$module.plat.getLinkTemplate(prog);
+/*!
+ * Function to destroy the NameServer module.
+ */
+Void NameServer_destroy(Void);
+
+#if defined (__cplusplus)
}
+#endif /* defined (__cplusplus) */
+
+#endif /* _NAMESERVER_DAEMON_H */
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/ti/ipc/rpmsg_rpc.h b/qnx/src/ipc3x_dev/ti/syslink/inc/ti/ipc/rpmsg_rpc.h
index 3fef5a84e8d80e930e4068eed3d4f12623fb6ba0..e37c74f0ab0817c8498c1cfcbe43ee42e5792987 100644 (file)
#define __packed __attribute__ ((packed))
+/**
+ * struct rppc_buf_fds - rppc buffer registration/deregistration
+ * @num: number of file descriptors
+ * @fds: pointer to the array holding the file descriptors
+ */
+struct rppc_buf_fds {
+ uint32_t num;
+ int32_t *fds;
+};
+
+/*
+ * ioctl definitions
+ */
#define RPPC_IOC_MAGIC 'r'
#define RPPC_IOC_CREATE _IOW(RPPC_IOC_MAGIC, 1, struct rppc_create_instance)
-/* TODO: these may not be needed */
-#define RPPC_IOC_BUFREGISTER _IOW(RPPC_IOC_MAGIC, 2, int)
-#define RPPC_IOC_BUFUNREGISTER _IOW(RPPC_IOC_MAGIC, 3, int)
+#define RPPC_IOC_BUFREGISTER _IOW(RPPC_IOC_MAGIC, 2, struct rppc_buf_fds)
+#define RPPC_IOC_BUFUNREGISTER _IOW(RPPC_IOC_MAGIC, 3, struct rppc_buf_fds)
#define RPPC_IOC_MAXNR (4)
#define RPPC_MAX_PARAMETERS (10)
#define RPPC_MAX_TRANSLATIONS (1024)
+#define RPPC_MAX_INST_NAMELEN (48)
+/**
+ * enum rppc_param_type - RPC function parameter type
+ * @RPPC_PARAM_TYPE_UNKNOWN: unrecognized parameter
+ * @RPPC_PARAM_TYPE_ATOMIC: an atomic data type, 1 byte to architecture limit
+ * sized bytes
+ * @RPPC_PARAM_TYPE_PTR: a pointer to shared memory. The fd field in the
+ * structures rppc_param and rppc_param_translation must
+ * contain the file descriptor of the associated dma_buf
+ * @RPPC_PARAM_TYPE_STRUCT: (unsupported) a structure type. Will be architecture
+ * width aligned in memory
+ *
+ * These enum values are used to identify the parameter type for every
+ * parameter argument of the remote function.
+ */
enum rppc_param_type {
RPPC_PARAM_TYPE_UNKNOWN = 0,
- /* An atomic data type, 1 byte to architecture limit sized bytes */
RPPC_PARAM_TYPE_ATOMIC,
- /*
- * A pointer to shared memory. The reserved field must contain
- * the handle to the memory
- */
RPPC_PARAM_TYPE_PTR,
- /*
- * (Unsupported) A structure type. Will be architecure width
- * aligned in memory.
- */
RPPC_PARAM_TYPE_STRUCT,
};
+/**
+ * struct rppc_param_translation - pointer translation helper structure
+ * @index: index of the parameter where the translation needs to be done in.
+ * used for computing the primary offset and mapping into kernel
+ * the page from the buffer referred to in the correspoding parameter
+ * @offset: offset from the primary base pointer to the pointer to translate.
+ * This is the secondary offset, and used either for mentioning the
+ * offset from an structure array element base, or within a single
+ * structure which itself is at an offset in an allocated buffer
+ * @base: the base user virtual address of the pointer to translate (used to
+ * calculate translated pointer offset)
+ * @fd: dma_buf file descriptor of the allocated buffer pointer within which
+ * the translated pointer is present
+ */
struct rppc_param_translation {
- /* The parameter index which indicates which is the base pointer */
- uint32_t index;
- /* The offset from the base address to the pointer to translate */
+ uint32_t index;
ptrdiff_t offset;
- /*
- * The base user virtual address of the pointer to translate
- * (used to calculate translated pointer offset).
- */
size_t base;
- /* reserved field */
- size_t reserved;
+ int32_t fd;
};
+/**
+ * struct rppc_param - descriptor structure for each parameter
+ * @type: type of the parameter, as dictated by enum rppc_param_type
+ * @size: size of the data (for atomic types) or size of the containing
+ * structure in which translations are performed
+ * @data: either the parameter value itself (for atomic type) or
+ * the actual user space pointer address to the data (for pointer type)
+ * @base: the base user space pointer address of the original allocated buffer,
+ * providing a reference if data has the pointer that is at an offset
+ * from the original pointer
+ * @fd: file descriptor of the exported allocation (will be used to
+ * import the associated dma_buf within the driver).
+ */
struct rppc_param {
- uint32_t type; /* rppc_param_type */
- size_t size; /* The size of the data */
- size_t data; /* Either the pointer to the data or
- the data itself */
- size_t base; /* If a pointer is in data, this is the base
- pointer (if data has an offset from base). */
- size_t reserved; /* Shared Memory Handle (used only with ptrs) */
+ uint32_t type;
+ size_t size;
+ size_t data;
+ size_t base;
+ int32_t fd;
};
+/**
+ * struct rppc_function - descriptor structure for the remote function
+ * @fxn_id: index of the function to invoke on the opened rppc device
+ * @num_params: number of parameters filled in the params field
+ * @params: array of parameter descriptor structures
+ * @num_translations: number of in-place translations to be performed within
+ * the arguments.
+ * @translations: an open array of the translation descriptor structures, whose
+ * length is given in @num_translations. Used for translating
+ * the pointers within the function data.
+ *
+ * This is the primary descriptor structure passed down from the userspace,
+ * describing the function, its parameter arguments and the needed translations.
+ */
struct rppc_function {
- /* The function to call */
uint32_t fxn_id;
- /* The number of parameters in the array. */
uint32_t num_params;
- /* The array of parameters */
struct rppc_param params[RPPC_MAX_PARAMETERS];
- /* The number of translations needed in the offsets array */
uint32_t num_translations;
- /*
- * An indeterminate length array of offsets within
- * payload_data to pointers which need translation
- */
struct rppc_param_translation translations[0];
};
+/**
+ * struct rppc_function_return - function return status descriptor structure
+ * @fxn_id: index of the function invoked on the opened rppc device
+ * @status: return value of the executed function
+ */
struct rppc_function_return {
uint32_t fxn_id;
uint32_t status;
};
+/*
+ * helper macros for manipulating the function index in the marshalled packet
+ */
#define RPPC_DESC_EXEC_SYNC (0x0100)
#define RPPC_DESC_TYPE_MASK (0x0F00)
-/* TODO: Remove the relative offset */
-/** The remote functions are offset by one relative to the client */
+/*
+ * helper macros for manipulating the function index in the marshalled packet.
+ * The remote functions are offset by one relative to the client
+ * XXX: Remove the relative offset
+ */
#define RPPC_SET_FXN_IDX(idx) (((idx) + 1) | 0x80000000)
-
-/** The remote functions are offset by one relative to the client */
#define RPPC_FXN_MASK(idx) (((idx) - 1) & 0x7FFFFFFF)
-/* TODO: remove or mask unneeded fields for RFC */
-/** This is actually a frankensteined structure of RCM */
+/**
+ * struct rppc_packet - the actual marshalled packet
+ * @desc: type of function execution, currently only synchronous function
+ * invocations are supported
+ * @msg_id: an incremental message index identifier
+ * @flags: a combination of job id and pool id of the worker threads
+ * of the server
+ * @fxn_id: id of the function to execute
+ * @result: result of the remotely executed function
+ * @data_size: size of the payload packet
+ * @data: variable payload, containing the marshalled function data.
+ *
+ * This is actually a condensed structure of the Remote Command Messaging
+ * (RCM) structure. The initial fields of the structure are used by the
+ * remote-side server to schedule the execution of the function. The actual
+ * variable payload data starts from the .data field. This marshalled packet
+ * is the payload for a rpmsg message.
+ *
+ * XXX: remove or mask unneeded fields, some fields can be stripped down
+ */
struct rppc_packet {
- uint16_t desc; /* RcmClient_Packet.desc */
- uint16_t msg_id; /* RcmClient_Packet.msgId */
- uint32_t flags; /* RcmClient_Message.jobId & poolId */
- uint32_t fxn_id; /* RcmClient_Message.fxnIdx */
- int32_t result; /* RcmClient_Message.result */
- uint32_t data_size; /* RcmClient_Message.data_size */
- uint8_t data[0]; /* RcmClient_Message.data pointer */
+ uint16_t desc;
+ uint16_t msg_id;
+ uint32_t flags;
+ uint32_t fxn_id;
+ int32_t result;
+ uint32_t data_size;
+ uint8_t data[0];
} __packed;
char name[RPPC_MAX_CHANNEL_NAMELEN];
};
-/** The parameter direction as relative to the function it describes */
+/**
+ * enum rppc_param_direction - direction of the function parameter
+ * @RPPC_PARAMDIR_IN: input argument
+ * @RPPC_PARAMDIR_OUT: output argument
+ * @RPPC_PARAMDIR_BI: an in and out argument
+ * @RPPC_PARAMDIR_MAX: limit value for the direction type
+ *
+ * The parameter direction is described as relative to the function.
+ */
enum rppc_param_direction {
RPPC_PARAMDIR_IN = 0,
RPPC_PARAMDIR_OUT,
RPPC_PARAMDIR_MAX
};
+/**
+ * enum rppc_param_datatype - parameter data type and descriptor flags
+ * @RPPC_PARAM_VOID: parameter is of type 'void'
+ * @RPPC_PARAM_S08: parameter is of type 's8'
+ * @RPPC_PARAM_U08: parameter is of type 'u8'
+ * @RPPC_PARAM_S16: parameter is of type 's16'
+ * @RPPC_PARAM_U16: parameter is of type 'u16'
+ * @RPPC_PARAM_S32: parameter is of type 's32'
+ * @RPPC_PARAM_U32: parameter is of type 'u32'
+ * @RPPC_PARAM_S64: parameter is of type 's64'
+ * @RPPC_PARAM_U64: parameter is of type 'u64'
+ * @RPPC_PARAM_ATOMIC_MAX: limit value for scalar data types
+ * @RPPC_PARAM_MASK: mask field for retrieving the scalar data type
+ * @RPPC_PARAM_PTR: flag to indicate the data type is a pointer
+ * @RPPC_PARAM_MAX: max limit value used as a marker
+ *
+ * This enum is used to describe the data type for the parameters.
+ * A pointer of a data type is reflected by using an additional bit
+ * mask field.
+ */
enum rppc_param_datatype {
RPPC_PARAM_VOID = 0,
RPPC_PARAM_S08,
RPPC_PARAM_ATOMIC_MAX,
RPPC_PARAM_MASK = 0x7F,
- RPPC_PARAM_PTR = 0x80, /**< Logically OR'd with lower type to make a
- pointer to the correct type */
+ RPPC_PARAM_PTR = 0x80,
+
RPPC_PARAM_MAX
};
-#define RPPC_PTR_TYPE(type) (type | RPPC_PARAM_PTR)
-#define RPPC_IS_PTR(type) (type & RPPC_PARAM_PTR)
-#define RPPC_IS_ATOMIC(type) ((type > RPPC_PARAM_VOID) && \
- (type < RPPC_PARAM_ATOMIC_MAX))
+/*
+ * helper macros to deal with parameter types
+ */
+#define RPPC_PTR_TYPE(type) ((type) | RPPC_PARAM_PTR)
+#define RPPC_IS_PTR(type) ((type) & RPPC_PARAM_PTR)
+#define RPPC_IS_ATOMIC(type) (((type) > RPPC_PARAM_VOID) && \
+ ((type) < RPPC_PARAM_ATOMIC_MAX))
//#endif /* __KERNEL__ */
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/usr/Qnx/GateMPDrv.h b/qnx/src/ipc3x_dev/ti/syslink/inc/usr/Qnx/GateMPDrv.h
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * 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.
+ */
+
+/*
+ * ======== GateMPDrv.h ========
+ *
+ */
+
+#ifndef GateMPDrv_H
+#define GateMPDrv_H
+
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* =============================================================================
+ * APIs
+ * =============================================================================
+ */
+
+/* Function to invoke the APIs through ioctl. */
+Int GateMPDrv_ioctl (UInt32 cmd, Ptr args);
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+
+
+#endif /* GateMPDrv_H */
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateHWSpinlock.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateHWSpinlock_daemon.c
similarity index 90%
rename from qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateHWSpinlock.c
rename to qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateHWSpinlock_daemon.c
index fbac920574981aa7e0e16a195096051dfe401ce2..cdfed4dcce7917a69abf98165727cdd79a6f5f17 100644 (file)
rename from qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateHWSpinlock.c
rename to qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateHWSpinlock_daemon.c
index fbac920574981aa7e0e16a195096051dfe401ce2..cdfed4dcce7917a69abf98165727cdd79a6f5f17 100644 (file)
/*
- * @file GateHWSpinlock.c
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
*
- * @brief Gate based on Hardware SpinLock.
+ * 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.
*
- * @ver 02.00.00.46_alpha1
+ * * 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.
*
- * ============================================================================
- *
- * Copyright (c) 2008-2009, 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.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
+ * * 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.
+ */
+/*
+ * ======== GateHWSpinlock_daemon.c ========
*/
/* Standard headers */
extern "C" {
#endif
+#ifdef SYSLINK_PLATFORM_VAYU
+/* TODO: implement these to handle config passed in through Platform.c */
+Void GateHWSpinlock_getConfig (GateHWSpinlock_Config * cfgParams)
+{
+ return;
+}
+
+Int32 GateHWSpinlock_setup(const GateHWSpinlock_Config * cfg)
+{
+ return GateHWSpinlock_S_SUCCESS;
+}
+
+Int GateHWSpinlock_destroy(Void)
+{
+ return GateHWSpinlock_S_SUCCESS;
+}
+#else
/* =============================================================================
* Macros
* =============================================================================
return GateHWSpinlock_S_SUCCESS;
}
+#endif /* SYSLINK_PLATFORM_VAYU */
#if defined (__cplusplus)
}
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateMP_daemon.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/GateMP_daemon.c
--- /dev/null
@@ -0,0 +1,501 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * ======== GateMP_daemon.c ========
+ */
+
+
+/* Standard headers */
+#include <ti/ipc/Std.h>
+
+/* Qnx specific header files */
+#include <pthread.h>
+
+/* System headers */
+#include <sys/mman.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/* Module level headers */
+#include <ti/ipc/GateMP.h>
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/MultiProc.h>
+#include <_MultiProc.h>
+#include <GateMP_config.h>
+#include <_GateMP.h>
+
+#include <ti/syslink/utils/IGateProvider.h>
+#include <ti/syslink/inc/_GateMP_daemon.h>
+#include <_IpcLog.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define NUM_INFO_FIELDS 6 /* Number of fields in info entry */
+
+/* Values used to populate the resource 'inUse' arrays */
+#define UNUSED ((UInt8)0)
+#define USED ((UInt8)1)
+#define RESERVED ((UInt8)-1)
+
+/* Name of GateMP's nameserver */
+#define GateMP_NAMESERVER "GateMP"
+
+/* =============================================================================
+ * Structures & Enums
+ * =============================================================================
+ */
+
+/* structure for GateMP module state */
+typedef struct {
+ Int numRemoteSystem;
+ Int numRemoteCustom1;
+ Int numRemoteCustom2;
+ UInt8 * remoteSystemInUse;
+ UInt8 * remoteCustom1InUse;
+ UInt8 * remoteCustom2InUse;
+ GateMP_Handle defaultGate;
+ NameServer_Handle nameServer;
+ Bool isSetup;
+} GateMP_ModuleObject;
+
+/* Internal functions */
+static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr);
+static Int GateMP_closeDefaultGate(GateMP_Handle *handlePtr);
+
+/* =============================================================================
+ * Globals
+ * =============================================================================
+ */
+/*
+ * GateMP_state
+ */
+static GateMP_ModuleObject GateMP_state = {
+ .numRemoteSystem = 0,
+ .numRemoteCustom1 = 0,
+ .numRemoteCustom2 = 0,
+ .remoteSystemInUse = NULL,
+ .remoteCustom1InUse = NULL,
+ .remoteCustom2InUse = NULL,
+ .defaultGate = NULL,
+ .nameServer = NULL,
+ .isSetup = FALSE
+};
+
+static GateMP_ModuleObject * GateMP_module = &GateMP_state;
+
+/* =============================================================================
+ * APIS
+ * =============================================================================
+ */
+
+/* Function to setup the gatemp module. */
+Int GateMP_setup(Void)
+{
+ Int status = GateMP_S_SUCCESS;
+ NameServer_Params params;
+ UInt32 nsValue[NUM_INFO_FIELDS];
+ UInt32 len;
+
+ NameServer_Params_init(¶ms);
+ params.maxRuntimeEntries = MAX_RUNTIME_ENTRIES;
+ params.maxNameLen = MAX_NAME_LEN;
+
+ /* Assume info entry has more fields than other entries */
+ params.maxValueLen = NUM_INFO_FIELDS * sizeof(UInt32);
+
+ GateMP_module->nameServer =
+ NameServer_create(GateMP_NAMESERVER, ¶ms);
+
+ if (GateMP_module->nameServer == NULL) {
+ status = GateMP_E_FAIL;
+ LOG0("GateMP_setup: NameServer_create failed\n");
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ do {
+ sleep(1); /* Give the slaves some time to get NameServer ready */
+ status = GateMP_openDefaultGate(&GateMP_module->defaultGate);
+ } while (status == GateMP_E_NOTFOUND);
+
+
+ if (status < 0) {
+ LOG0("GateMP_setup: failed to open default gate\n");
+ status = GateMP_E_FAIL;
+ }
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ /* Process global info NameServer entry */
+ len = sizeof(nsValue);
+
+ status = NameServer_get(GateMP_module->nameServer, "_GateMP_TI_info",
+ &nsValue, &len, NULL);
+
+ if (status < 0) {
+ LOG0("GateMP_setup: failed to find info entry\n");
+ status = GateMP_E_NOTFOUND;
+ }
+ else {
+ GateMP_module->numRemoteSystem = nsValue[3];
+ GateMP_module->numRemoteCustom1 = nsValue[4];
+ GateMP_module->numRemoteCustom2 = nsValue[5];
+
+ /* Map InUse arrays to daemon's address space */
+ GateMP_module->remoteSystemInUse = mmap(NULL,
+ GateMP_module->numRemoteSystem * sizeof (UInt8),
+ (PROT_READ|PROT_WRITE|PROT_NOCACHE),
+ (MAP_PHYS|MAP_SHARED), NOFD, (off_t)nsValue[0]);
+ if (GateMP_module->remoteSystemInUse == MAP_FAILED) {
+ GateMP_module->remoteSystemInUse = NULL;
+ status = GateMP_E_MEMORY;
+ LOG0("Failed to map remoteSystemInUse to host address space!");
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ GateMP_module->remoteCustom1InUse = mmap(NULL,
+ GateMP_module->numRemoteCustom1 * sizeof (UInt8),
+ (PROT_READ|PROT_WRITE|PROT_NOCACHE),
+ (MAP_PHYS|MAP_SHARED), NOFD, (off_t)nsValue[1]);
+ if (GateMP_module->remoteCustom1InUse == MAP_FAILED) {
+ GateMP_module->remoteCustom1InUse = NULL;
+ status = GateMP_E_MEMORY;
+ LOG0("Failed to map remoteSystemInUse to host address" \
+ " space!");
+ }
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ GateMP_module->remoteCustom2InUse = mmap(NULL,
+ GateMP_module->numRemoteCustom2 * sizeof (UInt8),
+ (PROT_READ|PROT_WRITE|PROT_NOCACHE),
+ (MAP_PHYS|MAP_SHARED), NOFD, (off_t)nsValue[2]);
+ if (GateMP_module->remoteCustom2InUse == MAP_FAILED) {
+ GateMP_module->remoteCustom2InUse = NULL;
+ status = GateMP_E_MEMORY;
+ LOG0("Failed to map remoteSystemInUse to host address" \
+ " space!");
+ }
+ }
+ }
+ }
+
+ /* TODO: setup the proxy map */
+
+ /* clean up if error */
+ if (status < 0) {
+ GateMP_destroy();
+ }
+
+ GateMP_module->isSetup = TRUE;
+
+ return (status);
+}
+
+Void GateMP_destroy(Void)
+{
+ if (GateMP_module->remoteSystemInUse) {
+ munmap((unsigned int *)GateMP_module->remoteSystemInUse,
+ GateMP_module->numRemoteSystem * sizeof (UInt8));
+ GateMP_module->remoteSystemInUse = NULL;
+ }
+
+ if (GateMP_module->remoteCustom1InUse) {
+ munmap((unsigned int *)GateMP_module->remoteCustom1InUse,
+ GateMP_module->numRemoteCustom1 * sizeof (UInt8));
+ GateMP_module->remoteCustom1InUse = NULL;
+ }
+
+ if (GateMP_module->remoteCustom2InUse) {
+ munmap((unsigned int *)GateMP_module->remoteCustom2InUse,
+ GateMP_module->numRemoteCustom2 * sizeof (UInt8));
+ GateMP_module->remoteCustom2InUse = NULL;
+ }
+
+ if (GateMP_module->defaultGate) {
+ GateMP_closeDefaultGate(&GateMP_module->defaultGate);
+ }
+
+ if (GateMP_module->nameServer) {
+ NameServer_delete(&GateMP_module->nameServer);
+ GateMP_module->nameServer = NULL;
+ }
+
+ GateMP_module->isSetup = FALSE;
+
+ return;
+}
+
+/* Open default gate during GateMP_setup. Should only be called once */
+static Int GateMP_openDefaultGate(GateMP_Handle *handlePtr)
+{
+ Int status = GateMP_S_SUCCESS;
+ UInt32 len;
+ UInt32 nsValue[4];
+ GateMP_Object * obj = NULL;
+ UInt32 arg;
+ UInt32 mask;
+ UInt32 creatorProcId;
+
+ GateMP_RemoteSystemProxy_Params systemParams;
+
+ /* assert that a valid pointer has been supplied */
+ if (handlePtr == NULL) {
+ LOG0("GateMP_open: argument cannot be null\n");
+ status = GateMP_E_INVALIDARG;
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ len = sizeof(nsValue);
+
+ status = NameServer_get(GateMP_module->nameServer, "_GateMP_TI_dGate",
+ &nsValue, &len, NULL);
+
+ if (status < 0) {
+ *handlePtr = NULL;
+ status = GateMP_E_NOTFOUND;
+ }
+ else {
+ arg = nsValue[2];
+ mask = nsValue[3];
+ creatorProcId = nsValue[1] >> 16;
+ }
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ /* allocate the instance object */
+ obj = (GateMP_Object *)calloc(1, sizeof (GateMP_Object));
+ if (obj != NULL) {
+ obj->localGate = NULL; /* TODO: create the local gate instance */
+ obj->localProtect = GETLOCAL(mask);
+ obj->remoteProtect = GETREMOTE(mask);
+ obj->nsKey = 0;
+ obj->numOpens = 1;
+ obj->objType = Ipc_ObjType_OPENDYNAMIC;
+ obj->resourceId = arg;
+
+ assert(obj->remoteProtect == GateMP_RemoteProtect_SYSTEM);
+
+ /* create the proxy object */
+ GateMP_RemoteSystemProxy_Params_init(&systemParams);
+ systemParams.resourceId = obj->resourceId;
+ systemParams.openFlag = TRUE;
+
+ /*
+ * TODO: Currently passing in localProtect instead of localGate,
+ * since GateHWSpinlock owns the local gate
+ */
+ obj->gateHandle = (IGateProvider_Handle)
+ GateMP_RemoteSystemProxy_create(obj->localProtect,
+ &systemParams);
+
+ if (obj->gateHandle == NULL) {
+ LOG0("GateMP_openDefaultGate: failed to create proxy\n");
+ free(obj);
+ obj = NULL;
+ }
+ }
+ else {
+ LOG0("GateMP_openDefaultGate: Memory allocation failed")
+ }
+
+ if (obj == NULL) {
+ status = GateMP_E_FAIL;
+ }
+ }
+
+ /* Return the "opened" GateMP instance */
+ *handlePtr = (GateMP_Handle)obj;
+
+ return status;
+}
+
+static Int GateMP_closeDefaultGate(GateMP_Handle *handlePtr)
+{
+ Int status = GateMP_S_SUCCESS;
+ GateMP_Object * obj = *(GateMP_Object **)handlePtr;
+
+ if (obj->gateHandle != NULL) {
+ /* Default gate is always of type System when more than 1 processor */
+ GateMP_RemoteSystemProxy_delete(
+ (GateMP_RemoteSystemProxy_Handle *)&obj->gateHandle);
+ }
+
+ free(*handlePtr);
+ *handlePtr = NULL;
+
+ return(status);
+}
+
+Int GateMP_getFreeResource(GateMP_RemoteProtect type)
+{
+ IArg key;
+ Bool flag = FALSE;
+ Int resourceId = -1;
+ UInt8* inUse = NULL;
+ Int num = 0;
+
+ /* Remote case */
+ switch (type) {
+ /* TODO: currently only support System proxy */
+ case GateMP_RemoteProtect_SYSTEM:
+ case GateMP_RemoteProtect_CUSTOM1:
+ case GateMP_RemoteProtect_CUSTOM2:
+ inUse = GateMP_module->remoteSystemInUse;
+ num = GateMP_module->numRemoteSystem;
+ break;
+
+ default:
+ LOG0("GateMP_getFreeResource: Invalid remote protection type\n");
+ break;
+ }
+
+ if (inUse != NULL) {
+ assert(GateMP_module->defaultGate != NULL);
+ key = GateMP_enter(GateMP_module->defaultGate);
+
+ /*
+ * Find a free resource id. Note: zero is reserved on the
+ * system proxy for the default gate.
+ */
+ for (resourceId = 0; resourceId < num; resourceId++) {
+ /*
+ * If not in-use, set the inUse to TRUE to prevent other
+ * creates from getting this one.
+ */
+ if (inUse[resourceId] == UNUSED) {
+ flag = TRUE;
+
+ /* Denote in shared memory that the resource is used */
+ inUse[resourceId] = USED;
+ break;
+ }
+ }
+
+ GateMP_leave(GateMP_module->defaultGate, key);
+ }
+
+ if (flag == FALSE) {
+ resourceId = -1;
+ }
+
+ return (resourceId);
+}
+
+Int GateMP_releaseResource(UInt id, GateMP_RemoteProtect type)
+{
+ Int status = GateMP_S_SUCCESS;
+ IArg key;
+ UInt8* inUse = NULL;
+ Int num = 0;
+
+ /* Remote case */
+ switch (type) {
+ /* TODO: currently only support System proxy */
+ case GateMP_RemoteProtect_SYSTEM:
+ case GateMP_RemoteProtect_CUSTOM1:
+ case GateMP_RemoteProtect_CUSTOM2:
+ inUse = GateMP_module->remoteSystemInUse;
+ num = GateMP_module->numRemoteSystem;
+ break;
+
+ default:
+ LOG0("GateMP_releaseResource: Invalid remote protection type\n");
+ status = GateMP_E_FAIL;
+ break;
+ }
+
+ if ((inUse != NULL) && (id < num)) {
+ assert(GateMP_module->defaultGate != NULL);
+ key = GateMP_enter(GateMP_module->defaultGate);
+ inUse[id] = UNUSED;
+ GateMP_leave(GateMP_module->defaultGate, key);
+ }
+ else {
+ /* Should not happen if module is properly setup */
+ status = GateMP_E_FAIL;
+ }
+
+ return (status);
+}
+
+Int GateMP_getNumResources(GateMP_RemoteProtect type)
+{
+ Int num = -1;
+
+ /* Remote case */
+ switch (type) {
+ /* TODO: currently only support System proxy */
+ case GateMP_RemoteProtect_SYSTEM:
+ case GateMP_RemoteProtect_CUSTOM1:
+ case GateMP_RemoteProtect_CUSTOM2:
+ num = GateMP_module->numRemoteSystem;
+ break;
+
+ default:
+ LOG0("GateMP_getNumResources: Invalid remote protection type\n");
+ break;
+ }
+
+ return (num);
+}
+
+NameServer_Handle GateMP_getNameServer(Void)
+{
+ return (GateMP_module->nameServer);
+}
+
+Bool GateMP_isSetup(Void)
+{
+ return (GateMP_module->isSetup);
+}
+
+IArg GateMP_enter(GateMP_Handle handle)
+{
+ GateMP_Object * obj;
+ IArg key;
+
+ obj = (GateMP_Object *)handle;
+ key = IGateProvider_enter(obj->gateHandle);
+
+ return(key);
+}
+
+Void GateMP_leave(GateMP_Handle handle, IArg key)
+{
+ GateMP_Object *obj;
+
+ obj = (GateMP_Object *)handle;
+ IGateProvider_leave(obj->gateHandle, key);
+}
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/Ipc.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/Ipc.c
index 5ec71b82dcc9dd664367dd3c3a9a6ac3f797ca9d..3723e27eee5eb081022c8036c047afc8d7a61772 100644 (file)
/*
- * @file Ipc.c
- *
- * @brief This module is primarily used to configure IPC-wide settings and
- * initialize IPC at runtime
- *
- *
- * @ver 02.00.00.46_alpha1
- *
- * ============================================================================
- *
- * Copyright (c) 2008-2009, Texas Instruments Incorporated
+ * Copyright (c) 2008-2013, Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
- *
*/
#include <RscTable.h>
#include <_MessageQCopy.h>
#include <ti/ipc/MessageQCopy.h>
-#include <_MessageQCopyDefs.h>
/* ----------------------------------- SysLink utils Headers */
-#include <_MultiProc.h>
+#include <ti/syslink/inc/_MultiProc.h>
#include <ti/ipc/MultiProc.h>
#include <ti/syslink/utils/Gate.h>
#include <ti/syslink/utils/Trace.h>
#include <ti/syslink/utils/Cache.h>
#include <ti/syslink/utils/Memory.h>
+#if defined(SYSLINK_USE_IPU_PM)
#include <ipu_pm.h>
+#endif
#if defined (__cplusplus)
extern "C" {
status = ProcMgr_open(&procHandle, remoteProcId);
if (status >= 0) {
- status = RscTable_update(remoteProcId, procHandle);
+ /* get IPC VRING information */
+ status = RscTable_getInfo(remoteProcId, TYPE_VDEV, 0, NULL,
+ NULL, &numVrings);
if (status >= 0) {
- /* get IPC VRING information */
- status = RscTable_getInfo(remoteProcId, TYPE_VDEV, 0, NULL,
- NULL,&numVrings);
+ status = RscTable_getInfo(remoteProcId, TYPE_VDEV, 1,
+ &vringAddr, NULL, NULL);
if (status >= 0) {
- status = RscTable_getInfo(remoteProcId, TYPE_VDEV, 1,
- &vringAddr, NULL, NULL);
+ status = MessageQCopy_attach(remoteProcId,
+ (Ptr)vringAddr, 0);
if (status >= 0) {
- status = MessageQCopy_attach(remoteProcId,
- (Ptr)vringAddr, 0);
+ status = RscTable_setStatus(remoteProcId, 7);
}
}
}
+
+ if (status >= 0) {
+ status = RscTable_update(remoteProcId, procHandle);
+ }
ProcMgr_close(&procHandle);
}
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */
-
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/MessageQCopy.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/MessageQCopy.c
index 199c0664bd5bca4a0f2f2367c68abb9af7bac958..02355bbefbd41dfd33e9e3d13be1df3def659d65 100644 (file)
/*
- * @file MessageqCopy.c
- *
- * @brief Implementation of MessageQCopy module.
- *
- * ============================================================================
- *
- * Copyright (c) 2011, Texas Instruments Incorporated
+ * Copyright (c) 2011-2013, Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
- *
*/
#include <ti/syslink/utils/GateSpinlock.h>
#include <ti/syslink/utils/Memory.h>
#include <ti/syslink/utils/List.h>
+#include <ti/syslink/inc/Bitops.h>
#include <ti/ipc/MultiProc.h>
#include <OsalSemaphore.h>
-#ifdef SYSLINK_BUILDOS_LINUX
-#include <atomic_linux.h>
-#elif SYSLINK_BUILDOS_QNX
#include <atomic_qnx.h>
-#endif
/* Module headers */
+#include <ti/syslink/ProcMgr.h>
#include <ti/ipc/MessageQCopy.h>
#include <_MessageQCopyDefs.h>
#include <_MessageQCopy.h>
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */
-
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/Qnx/gatemp_devctl.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/Qnx/gatemp_devctl.c
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2013 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * 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.
+ */
+
+/*
+ * ======== gatemp_devctl.c ========
+ *
+ */
+
+/* Standard headers */
+#include <ti/syslink/Std.h>
+
+/* QNX specific header include */
+#include <ti/syslink/build/Qnx/resmgr/proto.h>
+#include <ti/syslink/build/Qnx/resmgr/dcmd_syslink.h>
+
+/* Module specific header files */
+#include <ti/ipc/GateMP.h>
+#include <ti/syslink/inc/_GateMP_daemon.h>
+#include <ti/syslink/inc/GateMPDrvDefs.h>
+
+/* Function prototypes */
+int syslink_gatemp_getFreeResource(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb);
+int syslink_gatemp_releaseResource(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb);
+int syslink_gatemp_getNumResources(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb);
+int syslink_gatemp_start(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb);
+int syslink_gatemp_isSetup(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb);
+
+/**
+ * Handler for devctl() messages for GateMP module.
+ *
+ * Handles special devctl() messages that we export for control.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_gatemp_devctl(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+
+ switch (msg->i.dcmd)
+ {
+ case DCMD_GATEMP_GETFREERES:
+ {
+ return syslink_gatemp_getFreeResource(ctp, msg, ocb);
+ }
+ break;
+
+ case DCMD_GATEMP_RELRES:
+ {
+ return syslink_gatemp_releaseResource(ctp, msg, ocb);
+ }
+ break;
+
+ case DCMD_GATEMP_GETNUMRES:
+ {
+ return syslink_gatemp_getNumResources(ctp, msg, ocb);
+ }
+ break;
+
+ case DCMD_GATEMP_START:
+ {
+ return syslink_gatemp_start(ctp, msg, ocb);
+ }
+ break;
+
+ case DCMD_GATEMP_ISSETUP:
+ {
+ return syslink_gatemp_isSetup(ctp, msg, ocb);
+ }
+ break;
+
+ default:
+ fprintf(stderr, "Invalid DEVCTL for gatemp 0x%x\n", msg->i.dcmd);
+ break;
+
+ }
+
+ return (_RESMGR_PTR (ctp, &msg->o, sizeof(msg->o) +
+ sizeof(GateMPDrv_CmdArgs)));
+}
+
+
+/**
+ * Handler for gatemp getFreeResource API.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_gatemp_getFreeResource(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+ GateMPDrv_CmdArgs * cargs = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->i));
+ GateMPDrv_CmdArgs * out = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->o));
+
+ out->apiStatus = GateMP_getFreeResource(cargs->args.getFreeResource.type);
+ out->args.getFreeResource.id = out->apiStatus;
+
+ return (_RESMGR_PTR (ctp, &msg->o, sizeof(msg->o) +
+ sizeof(GateMPDrv_CmdArgs)));
+}
+
+/**
+ * Handler for gatemp releaseResource API.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_gatemp_releaseResource(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+ GateMPDrv_CmdArgs * cargs = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->i));
+ GateMPDrv_CmdArgs * out = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->o));
+
+ out->apiStatus = GateMP_releaseResource(cargs->args.releaseResource.id,
+ cargs->args.releaseResource.type);
+
+ return (_RESMGR_PTR (ctp, &msg->o, sizeof(msg->o) +
+ sizeof(GateMPDrv_CmdArgs)));
+}
+
+/**
+ * Handler for gatemp getNumResources API.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_gatemp_getNumResources(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+ GateMPDrv_CmdArgs * cargs = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->i));
+ GateMPDrv_CmdArgs * out = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->o));
+
+ out->apiStatus = GateMP_getNumResources(cargs->args.getNumResources.type);
+ cargs->args.getNumResources.value = out->apiStatus;
+
+ return (_RESMGR_PTR (ctp, &msg->o, sizeof(msg->o) +
+ sizeof(GateMPDrv_CmdArgs)));
+}
+
+/**
+ * Handler for gatemp start API.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_gatemp_start(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+ GateMPDrv_CmdArgs * cargs = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->i));
+ GateMPDrv_CmdArgs * out = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->o));
+
+ cargs->args.start.nameServerHandle = GateMP_getNameServer();
+ out->apiStatus = GateMP_S_SUCCESS;
+
+ return (_RESMGR_PTR (ctp, &msg->o, sizeof(msg->o) +
+ sizeof(GateMPDrv_CmdArgs)));
+}
+
+/**
+ * Handler for gatemp isSetup API.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_gatemp_isSetup(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+ GateMPDrv_CmdArgs * cargs = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->i));
+ GateMPDrv_CmdArgs * out = (GateMPDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->o));
+
+ cargs->args.isSetup.result = GateMP_isSetup();
+ out->apiStatus = GateMP_S_SUCCESS;
+
+ return (_RESMGR_PTR (ctp, &msg->o, sizeof(msg->o) +
+ sizeof(GateMPDrv_CmdArgs)));
+}
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/_MessageQCopyDefs.h b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/_MessageQCopyDefs.h
index 83c0454f4aef14c198d68006ae87355bd1899544..971c87ce5c89dc217c295c92505e320abbf07e5e 100644 (file)
/*
- * MessageQCopy messaging defs
- *
- * Copyright (c) 2011-2013 Texas Instruments. All rights reserved.
+ * Copyright (c) 2011-2013 Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-
#if !defined (_MESSAGEQCOPYDEFS_H_0x5f84)
#define _MESSAGEQCOPYDEFS_H_0x5f84
-
-/* Osal And Utils headers */
-#include <ti/syslink/utils/List.h>
-#include <Bitops.h>
-
/* Module headers */
-#include <ti/syslink/ProcMgr.h>
-#include <_MultiProc.h>
#include <VirtQueue.h>
#include "virtio_ring.h"
#include <rpmsg.h>
diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/usr/Qnx/GateMPDrv.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/usr/Qnx/GateMPDrv.c
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2013 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * 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.
+ */
+
+/*
+ * ======== GateMPDrv.c ========
+ *
+ */
+
+/* Standard headers */
+#include <ti/syslink/Std.h>
+
+/* OSAL & Utils headers */
+#include <ti/syslink/utils/Trace.h>
+#include <ti/ipc/GateMP.h>
+#include <_MultiProc.h>
+#include <ti/syslink/inc/GateMPDrvDefs.h>
+
+#include <ti/syslink/build/Qnx/resmgr/dcmd_syslink.h>
+
+/** ============================================================================
+ * Globals
+ * ============================================================================
+ */
+
+extern Int32 IpcDrv_handle;
+
+
+/** ============================================================================
+ * Functions
+ * ============================================================================
+ */
+/*!
+ * @brief Function to open the GateMP driver.
+ *
+ * @sa GateMPDrv_close
+ */
+Int GateMPDrv_open (Void)
+{
+ Int status = GateMP_S_SUCCESS;
+
+ return status;
+}
+
+
+/*!
+ * @brief Function to close the GateMP driver.
+ *
+ * @sa GateMPDrv_open
+ */
+Int GateMPDrv_close (Void)
+{
+ Int status = GateMP_S_SUCCESS;
+
+ return status;
+}
+
+
+/*!
+ * @brief Function to invoke the APIs through ioctl.
+ *
+ * @param cmd Command for driver ioctl
+ * @param args Arguments for the ioctl command
+ *
+ * @sa
+ */
+Int GateMPDrv_ioctl(UInt32 cmd, Ptr args)
+{
+ Int status = GateMP_S_SUCCESS;
+ Int osStatus = 0;
+ GateMPDrv_CmdArgs * cargs = (GateMPDrv_CmdArgs *)args;
+
+ GT_2trace (curTrace, GT_ENTER, "GateMPDrv_ioctl", cmd, args);
+
+ switch (cmd) {
+
+ case CMD_GATEMP_GETFREERES:
+ {
+ osStatus = devctl(IpcDrv_handle, DCMD_GATEMP_GETFREERES, cargs,
+ sizeof(GateMPDrv_CmdArgs), NULL);
+
+ if (osStatus != 0) {
+ status = GateMP_E_OSFAILURE;
+ }
+ }
+ break;
+
+ case CMD_GATEMP_RELRES:
+ {
+ osStatus = devctl(IpcDrv_handle, DCMD_GATEMP_RELRES, cargs,
+ sizeof(GateMPDrv_CmdArgs), NULL);
+
+ if (osStatus != 0) {
+ status = GateMP_E_OSFAILURE;
+ }
+ }
+ break;
+
+ case CMD_GATEMP_GETNUMRES:
+ {
+ osStatus = devctl(IpcDrv_handle, DCMD_GATEMP_GETNUMRES, cargs,
+ sizeof(GateMPDrv_CmdArgs), NULL);
+
+ if (osStatus != 0) {
+ status = GateMP_E_OSFAILURE;
+ }
+ }
+ break;
+
+ case CMD_GATEMP_START:
+ {
+ osStatus = devctl(IpcDrv_handle, DCMD_GATEMP_START, cargs,
+ sizeof(GateMPDrv_CmdArgs), NULL);
+
+ if (osStatus != 0) {
+ status = GateMP_E_OSFAILURE;
+ }
+ }
+ break;
+
+ case CMD_GATEMP_ISSETUP:
+ {
+ osStatus = devctl(IpcDrv_handle, DCMD_GATEMP_ISSETUP, cargs,
+ sizeof(GateMPDrv_CmdArgs), NULL);
+
+ if (osStatus != 0) {
+ status = GateMP_E_OSFAILURE;
+ }
+ }
+ break;
+
+ default:
+ {
+ status = GateMP_E_INVALIDARG;
+ GT_setFailureReason (curTrace,
+ GT_4CLASS,
+ "GateMPDrv_ioctl",
+ status,
+ "Unsupported ioctl command specified");
+ }
+ break;
+ }
+
+ if (status == GateMP_S_SUCCESS) {
+ status = cargs->apiStatus;
+ }
+
+ GT_1trace(curTrace, GT_LEAVE, "GateMPDrv_ioctl", status);
+
+ return (status);
+}
diff --git a/qnx/src/ipc3x_dev/ti/syslink/resources/RscTable.c b/qnx/src/ipc3x_dev/ti/syslink/resources/RscTable.c
index c17f203cc2ecfb63890e4ce43bb4a3a627bb8ed4..af4255c322617b240a33419b66f41037b301a823 100644 (file)
return status;
}
+Int RscTable_setStatus(UInt16 procId, UInt32 value)
+{
+ Int i;
+ Int status = 0;
+
+ RscTable_Object * obj = (RscTable_Object *)RscTable_state.handles[procId];
+ RscTable_Header * table = (RscTable_Header *)obj->rscTable;
+
+ /* Look for the vdev entry and update the status */
+ for (i = 0; i < table->num; i++) {
+ RscTable_MemEntry * entry =
+ (RscTable_MemEntry *)((UInt32)table + table->offset[i]);
+ if (entry->type == TYPE_VDEV) {
+ struct fw_rsc_vdev *vdev = (struct fw_rsc_vdev *)entry;
+ vdev->status = value;
+ break;
+ }
+ }
+
+ if (i == table->num) {
+ status = RSCTABLE_E_FAIL;
+ }
+
+ return status;
+}
+
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */
diff --git a/qnx/src/ipc3x_dev/ti/syslink/resources/RscTable.h b/qnx/src/ipc3x_dev/ti/syslink/resources/RscTable.h
index a806699dd3323115af999dc098ac1e6fff50d937..18df3d200c7d1516fce89bfaebd2adc647af2065 100644 (file)
Int RscTable_free (RscTable_Handle * handle);
+Int RscTable_setStatus (UInt16 procId, UInt32 value);
+
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */
diff --git a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c
index e7ea7fe0a005311d3354cbd9ed17a68d36df72f7..28432a8b8a31aa122bb5976b0512d453bc903e36 100644 (file)
/*
- * @file rpmsg-rpc.c
- *
- * @brief devctl handler for RPC component.
- *
- * ============================================================================
- *
* Copyright (c) 2013, Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* 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.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
- *
*/
#include <devctl.h>
/* Module headers */
+#include <ti/syslink/ProcMgr.h>
#include <ti/ipc/rpmsg_rpc.h>
#include <ti/ipc/MessageQCopy.h>
#include <_MessageQCopy.h>
@@ -1689,7 +1675,6 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, pid_t pid, bool reverse)
uintptr_t ptr;
void * vptr[RPPC_MAX_PARAMETERS];
uint32_t idx = 0;
- uint32_t param_offset = 0;
function = (struct rppc_function *)data;
memset(vptr, 0, sizeof(void *) * RPPC_MAX_PARAMETERS);
@@ -1702,15 +1687,14 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, pid_t pid, bool reverse)
status = -EINVAL;
break;
}
- param_offset = function->params[idx].data - function->params[idx].base;
- if (translation[i].offset - param_offset + sizeof(uint32_t) > function->params[idx].size) {
+ if (translation[i].offset + sizeof(uint32_t) > function->params[idx].size) {
status = -EINVAL;
break;
}
if (!vptr[idx]) {
/* get the physical address of ptr */
status = mem_offset64_peer(pid,
- function->params[idx].data,
+ reverse ? function->params[idx].base : function->params[idx].data,
function->params[idx].size,
&paddr[idx], &phys_len);
if (status >= 0 && phys_len == function->params[idx].size) {
@@ -1730,7 +1714,7 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, pid_t pid, bool reverse)
}
}
/* Get physical address of the contents */
- ptr = (uint32_t)vptr[idx] + translation[i].offset - param_offset;
+ ptr = (uint32_t)vptr[idx] + translation[i].offset;
if (reverse) {
*(uint32_t *)ptr = translation[i].base;
}
@@ -1771,8 +1755,10 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, pid_t pid, bool reverse)
}
if (status >= 0) {
if ((ipu_addr =
- _rpmsg_rpc_pa2da(handle, (uint32_t)phys_addr)) != 0)
+ _rpmsg_rpc_pa2da(handle, (uint32_t)phys_addr)) != 0) {
+ function->params[i].base = function->params[i].data;
function->params[i].data = ipu_addr;
+ }
else {
status = -EINVAL;
break;
Memory_copy (&(fxn_info->func), function,
RPPC_PARAM_SIZE(function->num_translations));
- status = _rpmsg_rpc_translate(rpc->conn->procH, (char *)function,
+ status = _rpmsg_rpc_translate(rpc->conn->procH, (char *)&(fxn_info->func),
ctp->info.pid, false);
if (status < 0) {
Memory_free(NULL, fxn_info, sizeof(rpmsg_rpc_FxnInfo) +\
for (i = 0; i < function->num_params; i++) {
((UInt32 *)(packet->data))[i*2] = function->params[i].size;
- ((UInt32 *)(packet->data))[(i*2)+1] = function->params[i].data;
+ ((UInt32 *)(packet->data))[(i*2)+1] = fxn_info->func.params[i].data;
packet->data_size += (sizeof(UInt32) * 2);
}
msg_hdr->msg_len += packet->data_size;
diff --git a/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/hwspinlock/usr/common.mk b/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/hwspinlock/usr/common.mk
index 391c340acdcf6b080a27847e5583865daa21dc98..bebe4a2f660b1ea79db65a381a2422e6344d13cb 100644 (file)
#Add extra include path
EXTRA_INCVPATH+=$(SYSLINK_ROOT)/inc \
$(SYSLINK_ROOT)/inc/ti/ipc \
+ $(IPC_REPO)/packages \
$(SYSLINK_ROOT)/../..
diff --git a/qnx/src/ipc3x_dev/ti/syslink/utils/hlos/knl/NameServer_daemon.c b/qnx/src/ipc3x_dev/ti/syslink/utils/hlos/knl/NameServer_daemon.c
index 0cb83b3110bf63342e91c66e455a2d0028d9d4f9..c9db723b2b95791cfdfa62b6a32115a8d835a851 100644 (file)
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*!
- * @file NameServer.c
+ * @file NameServer_daemon.c
*
* @brief NameServer Manager
*
/* Internal stuff: */
#include <_MessageQCopy.h>
-#include <_MessageQCopyDefs.h>
#include <_NameServer.h>
#include <_NameServerRemoteRpmsg.h>
#include <_IpcLog.h>
String name; /* name of the instance */
NameServer_Params params; /* the parameter structure */
UInt32 count; /* count of entries */
+ UInt32 refCount; /* reference count to this object */
pthread_mutex_t gate; /* crit sect gate */
} NameServer_Object;
LOG2("NameServer Request: instanceName: %s, name: %s\n",
(String)msg->instanceName, (String)msg->name)
+ assert(msg->valueLen <= MAXVALUELEN);
+
/*
* Message is a request. Lookup name in NameServer table.
* Send a response message back to source processor.
@@ -254,9 +256,16 @@ static void NameServerRemote_processMessage(NameServerMsg * msg, UInt16 procId)
if (handle != NULL) {
/* Search for the NameServer entry */
- LOG0("Calling NameServer_getLocalUInt32...\n")
- status = NameServer_getLocalUInt32(handle,
+ if (msg->valueLen <= sizeof (Bits32)) {
+ LOG0("Calling NameServer_getLocalUInt32...\n")
+ status = NameServer_getLocalUInt32(handle,
(String)msg->name, &msg->value);
+ }
+ else {
+ LOG0("Calling NameServer_getLocal...\n")
+ status = NameServer_getLocal(handle,
+ (String)msg->name, (Ptr)msg->valueBuf, &msg->valueLen);
+ }
}
LOG2("NameServer Response: instanceName: %s, name: %s,",
LOG0("listener_cb: Entered Listener thread.\n")
LOG1("NameServer: Listener got NameServer message "
- "from MessageQCopy: 0x%x!\n", handle);
+ "from MessageQCopy: 0x%p!\n", handle);
/* Get NameServer message and process: */
memcpy(&msg, data, len);
len)
}
else {
- LOG1("listener_cb: read from MessageQCopy 0x%x\n", handle)
+ LOG1("listener_cb: read from MessageQCopy 0x%p\n", handle)
LOG2("\tReceived ns msg: byte count: %d, from addr: %d, ",
len, src)
LOG1("from vproc: %d\n", srcProc)
pthread_mutex_lock(&NameServer_module->modGate);
- if (params->maxValueLen > sizeof(UInt32)) {
- LOG1("NameServer_create: params->maxValueLen (%d) too big for now\n", params->maxValueLen)
- /* Can't handle more than UInt32 at this time: */
- goto leave;
- }
-
/* check if the name is already created or not */
- if (NameServer_getHandle(name)) {
- LOG0("NameServer_create NameServer_E_INVALIDARG Name is in use!\n")
- handle = NULL;
+ handle = NameServer_getHandle(name);
+ if (handle != NULL) {
+ if (memcmp((Ptr)&handle->params, (Ptr)params,
+ sizeof(NameServer_Params)) == 0) {
+ handle->refCount++;
+ }
+ else {
+ LOG0("NameServer_create: NameServer params mismatch\n")
+ handle = NULL;
+ }
goto leave;
}
else {
goto leave;
}
+ handle->refCount = 1;
handle->name = (String)malloc(strlen(name) + 1u);
if (!handle->name) {
LOG0("NameServer_create: instance name alloc failed\n")
strncpy(handle->name, name, strlen (name) + 1u);
memcpy((Ptr) &handle->params, (Ptr) params, sizeof(NameServer_Params));
+ assert(params.maxValueLen <= MAXVALUELEN);
+
if (params->maxValueLen < sizeof(UInt32)) {
handle->params.maxValueLen = sizeof(UInt32);
}
pthread_mutex_lock(&NameServer_module->modGate);
+ (*handle)->refCount--;
+ if ((*handle)->refCount != 0) {
+ goto leave;
+ }
+
if ((*handle)->count == 0) {
CIRCLEQ_REMOVE(&NameServer_module->objList, *handle, elem);
(*handle) = NULL;
}
+leave:
pthread_mutex_unlock(&NameServer_module->modGate);
return (status);
/* Calculate the hash */
hash = stringHash(name);
+ if (len > handle->params.maxValueLen) {
+ status = NameServer_E_INVALIDARG;
+ LOG0("NameServer_add: value length exceeded maximum!\n")
+ new_node = NULL;
+ goto exit;
+ }
+
pthread_mutex_lock(&handle->gate);
/* Traverse the list to find duplicate check */
pthread_mutex_lock(&NameServer_module->modGate);
/* Set Timeout to wait: */
- tv.tv_sec = NAMESERVER_GET_TIMEOUT;
- tv.tv_usec = 0;
+ tv.tv_sec = 0;
+ tv.tv_usec = NAMESERVER_GET_TIMEOUT;
/* Create request message and send to remote processor: */
nsMsg.reserved = NAMESERVER_MSG_TOKEN;
nsMsg.request = NAMESERVER_REQUEST;
nsMsg.requestStatus = 0;
+ nsMsg.valueLen = *len;
strncpy((char *)nsMsg.instanceName, obj->name, strlen(obj->name) + 1);
strncpy((char *)nsMsg.name, name, strlen(name) + 1);
if (replyMsg->requestStatus) {
/* name is found */
+
+ /* set length to amount of data that was copied */
+ *len = replyMsg->valueLen;
+
/* set the contents of value */
- *(UInt32 *)value = (UInt32)replyMsg->value;
+ if (*len <= sizeof (Bits32)) {
+ *(UInt32 *)value = (UInt32)replyMsg->value;
+ LOG2("NameServer_getRemote: Reply from: %d, %s:",
+ procId, (String)replyMsg->instanceName)
+ LOG2("%s, value: 0x%x...\n",
+ (String)replyMsg->name, *(UInt32 *)value)
+ }
+ else {
+ memcpy(value, replyMsg->valueBuf, *len);
+ LOG2("NameServer_getRemote: Reply from: %d, %s:",
+ procId, (String)replyMsg->instanceName)
+ LOG2("%s, value buffer at address: 0x%p...\n",
+ (String)replyMsg->name, value)
+ }
- LOG2("NameServer_getRemote: Reply from: %d, %s:",
- procId, (String)replyMsg->instanceName)
- LOG2("%s, value: 0x%x...\n",
- (String)replyMsg->name, *(UInt32 *)value)
goto exit;
}
else {
status = NameServer_getRemote(handle, name, value, len, i);
if ((status >= 0) ||
- ((status < 0) && (status != NameServer_E_NOTFOUND))) {
+ ((status < 0) && (status != NameServer_E_NOTFOUND) &&
+ (status != NameServer_E_TIMEOUT))) {
break;
}
}
diff --git a/qnx/src/ipc3x_dev/ti/syslink/utils/hlos/knl/Qnx/Nameserver_devctl.c b/qnx/src/ipc3x_dev/ti/syslink/utils/hlos/knl/Qnx/Nameserver_devctl.c
index 98f4e92595b99eba287bc31383b1e32d0d8f17eb..a59c035c1b8142ee6601362e03fa283843ceedbb 100644 (file)
#include <ti/syslink/inc/NameServerDrvDefs.h>
/* Function prototypes */
+int syslink_nameserver_add(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb);
+int syslink_nameserver_get(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb);
int syslink_nameserver_adduint32(resmgr_context_t *ctp, io_devctl_t *msg,
syslink_ocb_t *ocb);
int syslink_nameserver_getuint32(resmgr_context_t *ctp, io_devctl_t *msg,
switch (msg->i.dcmd)
{
+ case DCMD_NAMESERVER_ADD:
+ {
+ return syslink_nameserver_add( ctp, msg, ocb);
+ }
+ break;
+
+ case DCMD_NAMESERVER_GET:
+ {
+ return syslink_nameserver_get( ctp, msg, ocb);
+ }
+ break;
case DCMD_NAMESERVER_ADDUINT32:
{
return syslink_nameserver_adduint32( ctp, msg, ocb);
sizeof(NameServerDrv_CmdArgs)));
}
+/**
+ * Handler for nameserver add API.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_nameserver_add(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+ NameServerDrv_CmdArgs * cargs = (NameServerDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->i));
+ NameServerDrv_CmdArgs * out = (NameServerDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->o));
+ String name = (String)(cargs+1);
+ Ptr buf = (Ptr)((sizeof(char) * cargs->args.add.nameLen) + (char *)(name));
+ Ptr entry;
+
+ GT_assert (curTrace, (name != NULL));
+
+ entry = NameServer_add(cargs->args.add.handle,
+ name,
+ buf,
+ cargs->args.add.len);
+ GT_assert (curTrace, (entry != NULL));
+
+ out->args.add.entry = entry;
+
+ return (_RESMGR_PTR (ctp, &msg->o, sizeof(msg->o) +
+ sizeof(NameServerDrv_CmdArgs)));
+}
+
+/**
+ * Handler for nameserver get API.
+ *
+ * \param ctp Thread's associated context information.
+ * \param msg The actual devctl() message.
+ * \param ocb OCB associated with client's session.
+ *
+ * \return POSIX errno value.
+ *
+ * \retval EOK Success.
+ * \retval ENOTSUP Unsupported devctl().
+ */
+int syslink_nameserver_get(resmgr_context_t *ctp, io_devctl_t *msg,
+ syslink_ocb_t *ocb)
+{
+ NameServerDrv_CmdArgs * cargs = (NameServerDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->i));
+ NameServerDrv_CmdArgs * out = (NameServerDrv_CmdArgs *)
+ (_DEVCTL_DATA (msg->o));
+
+ char * buf = (char *)(cargs + 1);
+ char * name = (char *)(buf + (sizeof(char) * cargs->args.get.len));
+ UInt16 * procId = NULL;
+
+ if (cargs->args.get.procLen > 0) {
+ procId = (UInt16 *)(name + (sizeof(char) * cargs->args.get.nameLen));
+ }
+
+ out->apiStatus = NameServer_get(cargs->args.get.handle,
+ (String)name,
+ (Ptr)buf,
+ &cargs->args.get.len,
+ procId);
+
+ SETIOV(&ctp->iov[0], &msg->o, sizeof(msg->o) +
+ sizeof(NameServerDrv_CmdArgs));
+ SETIOV(&ctp->iov[1], (Ptr)buf, cargs->args.get.len);
+
+ return _RESMGR_NPARTS(2);
+}
+
/**
* Handler for nameserver addunit32 API.
*
diff --git a/qnx/src/ipc3x_dev/ti/syslink/utils/hlos/usr/Qnx/NameServerDrv.c b/qnx/src/ipc3x_dev/ti/syslink/utils/hlos/usr/Qnx/NameServerDrv.c
index d138b4b2d44115c91ebb29fd39c3569d6422d95d..91b8dfcc091d11078bfd926dc4717f9ed4294618 100644 (file)
switch (cmd) {
+ case CMD_NAMESERVER_ADD:
+ {
+ iov_t nameserver_add_iov[3];
+
+ SETIOV(&nameserver_add_iov[0], cargs, sizeof(NameServerDrv_CmdArgs));
+ SETIOV(&nameserver_add_iov[1], cargs->args.add.name,
+ cargs->args.add.nameLen);
+ SETIOV( &nameserver_add_iov[2], cargs->args.add.buf,
+ cargs->args.add.len);
+
+ osStatus = devctlv(IpcDrv_handle, DCMD_NAMESERVER_ADD, 3, 3,
+ nameserver_add_iov, nameserver_add_iov, NULL);
+
+ if ( osStatus != 0 ){
+ status = NameServer_E_OSFAILURE;
+ }
+ }
+ break;
+
+ case CMD_NAMESERVER_GET:
+ {
+ iov_t nameserver_get_iov[4];
+ unsigned char count = 0;
+
+ SETIOV(&nameserver_get_iov[count], cargs,
+ sizeof(NameServerDrv_CmdArgs));
+ count++;
+ SETIOV( &nameserver_get_iov[count], cargs->args.get.buf,
+ cargs->args.get.len);
+ count++;
+ SETIOV( &nameserver_get_iov[count], cargs->args.get.name,
+ cargs->args.get.nameLen);
+ count++;
+
+ if (cargs->args.get.procId != NULL) {
+ SETIOV(&nameserver_get_iov[count], cargs->args.get.procId,
+ cargs->args.get.procLen);
+ count++;
+ }
+
+ osStatus = devctlv(IpcDrv_handle, DCMD_NAMESERVER_GET, count,
+ 2, nameserver_get_iov, nameserver_get_iov, NULL);
+ if (osStatus != 0) {
+ status = NameServer_E_OSFAILURE;
+ }
+ }
+ break;
+
case CMD_NAMESERVER_ADDUINT32:
{
iov_t nameserver_add_iov[2];
diff --git a/qnx/src/tests/GateMPApp/GateMPApp.c b/qnx/src/tests/GateMPApp/GateMPApp.c
--- /dev/null
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * ======== GateMPApp.c ========
+ *
+ */
+
+/* host header files */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/GateMP.h>
+
+/* local header files */
+#include "GateMPApp.h"
+
+#include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
+#include <ti/ipc/tests/GateMPAppCommon.h>
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; /* created locally */
+ MessageQ_QueueId slaveQue; /* opened remotely */
+ UInt16 heapId; /* MessageQ heapId */
+ UInt32 msgSize; /* Size of messages */
+ volatile UInt32 * intPtr; /* Integer pointer */
+ UInt32 physAddr; /* Physical address of shared memory */
+ GateMP_Handle hostGateMPHandle; /* handle to host-created gate */
+ GateMP_Handle slaveGateMPHandle; /* handle to slave-created gate */
+ shm_buf buf; /* shared memory buffer */
+} GateMPApp_Module;
+
+/* private data */
+static GateMPApp_Module Module;
+
+
+/*
+ * ======== GateMPApp_create ========
+ */
+
+Int GateMPApp_create()
+{
+ Int status =0;
+ MessageQ_Params msgqParams;
+ GateMP_Params gateParams;
+
+ printf("--> GateMPApp_create:\n");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = GateMPApp_MsgHeapId;
+ Module.intPtr = NULL;
+ Module.physAddr = 0;
+ Module.hostGateMPHandle = NULL;
+ Module.slaveGateMPHandle = NULL;
+ Module.msgSize = sizeof(GateMPApp_Msg);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(GateMPApp_HostMsgQueName, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ printf("GateMPApp_create: Failed creating MessageQ\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* open the remote message queue */
+ do {
+ status = MessageQ_open(GateMPApp_SlaveMsgQueName, &Module.slaveQue);
+ sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("GateMPApp_create: Failed opening MessageQ\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* allocate space from shared memory for an integer */
+ status = SHM_alloc_aligned(sizeof(UInt32), sizeof(UInt32), &Module.buf);
+ if (status < 0) {
+ printf("GateMPApp_create: Could not allocate shared memory\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+ Module.intPtr = (UInt32 *)Module.buf.vir_addr;
+ Module.physAddr = (UInt32)Module.buf.phy_addr;
+
+ if ((Module.intPtr == NULL) || (Module.physAddr == NULL)) {
+ printf("GateMPApp_create: Failed to get buffer address\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* create GateMP */
+ GateMP_Params_init(&gateParams);
+
+ gateParams.name = GATEMP_HOST_NAME;
+ gateParams.localProtect = GateMP_LocalProtect_PROCESS;
+ gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+
+ Module.hostGateMPHandle = GateMP_create (&gateParams);
+
+ if (Module.hostGateMPHandle == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ printf("GateMPApp_create: Failed to create GateMP\n");
+ goto leave;
+ }
+ printf("GateMPApp_create: Host is ready\n");
+
+leave:
+ printf("<-- GateMPApp_create:\n");
+ return(status);
+}
+
+
+/*
+ * ======== GateMPApp_delete ========
+ */
+Int GateMPApp_delete(Void)
+{
+ Int status;
+ GateMPApp_Msg * msg;
+
+ printf("--> GateMPApp_delete:\n");
+
+ /* allocate message */
+ msg = (GateMPApp_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* sending shutdown command */
+ msg->cmd = GATEMPAPP_CMD_SHUTDOWN;
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+
+ /* wait for acknowledgement message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SHUTDOWN_ACK) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ /* delete GateMP */
+ GateMP_delete(&Module.hostGateMPHandle);
+
+ /* free shared memory buffer */
+ status = SHM_release(&Module.buf);
+ if(status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue);
+
+ if (status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+leave:
+ printf("<-- GateMPApp_delete:\n");
+ return(status);
+}
+
+
+/*
+ * ======== GateMPApp_exec ========
+ */
+Int GateMPApp_exec(Void)
+{
+ Int status;
+ Int i;
+ GateMPApp_Msg * msg;
+ IArg gateKey = 0;
+ UInt32 num;
+
+ printf("--> GateMPApp_exec:\n");
+
+ /* set shared variable initial value */
+ *Module.intPtr = 500;
+
+ /* allocate message */
+ msg = (GateMPApp_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+ if (msg == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = GATEMPAPP_CMD_SPTR_ADDR;
+ msg->payload = Module.physAddr;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SPTR_ADDR_ACK)
+ {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ /* open slave-created GateMP */
+ do {
+ status = GateMP_open(GATEMP_SLAVE_NAME, &Module.slaveGateMPHandle);
+ } while (status == GateMP_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("GateMPApp_exec: Failed to open slave-created GateMP");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ printf("GateMPApp_exec: Using host-created gate\n");
+ for (i = 0; i < LOOP_ITR; i++) {
+ /* read the shared variable as long as no one is currently modifying
+ * it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.hostGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if (rand() % 2) {
+ *Module.intPtr -= 1;
+ }
+ else {
+ *Module.intPtr += 1;
+ }
+
+ /* read shared variable value */
+ num = *Module.intPtr;
+ printf("GateMPApp_exec: Current value: %d, " \
+ "previously read=%d\n", *Module.intPtr, num);
+
+ if (*Module.intPtr != num) {
+ printf("GateMPApp_exec: mismatch in variable value." \
+ "Test failed.\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* exit GateMP */
+ GateMP_leave(Module.hostGateMPHandle, gateKey);
+ }
+
+ /* allocate message */
+ msg = (GateMPApp_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+ if (msg == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = GATEMPAPP_CMD_SYNC;
+
+ /* send sync message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+
+ /* wait for return sync message before we switch gates */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SYNC)
+ {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ printf("GateMPApp_exec: Using slave-created gate\n");
+ for (i = 0; i < LOOP_ITR; i++) {
+ /* read the shared variable as long as no one is currently modifying
+ * it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.slaveGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if (rand() % 2) {
+ *Module.intPtr -= 1;
+ }
+ else {
+ *Module.intPtr += 1;
+ }
+
+ /* read shared variable value */
+ num = *Module.intPtr;
+ printf("GateMPApp_exec: Current value: %d, " \
+ "previously read=%d\n", *Module.intPtr, num);
+
+ if (*Module.intPtr != num) {
+ printf("GateMPApp_exec: mismatch in variable value." \
+ "Test failed.\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* exit GateMP */
+ GateMP_leave(Module.slaveGateMPHandle, gateKey);
+ }
+
+leave:
+ if (Module.slaveGateMPHandle) {
+ GateMP_close(&Module.slaveGateMPHandle);
+ }
+
+ printf("<-- GateMPApp_exec: %d\n", status);
+ return(status);
+}
similarity index 81%
rename from packages/ti/platform/vayu/ipu2/package.xdc
rename to qnx/src/tests/GateMPApp/GateMPApp.h
index 0ab0605b4d3476b4cb8503f40e00f240c6c5b227..e796793c9fa47e8ac0e9074278a98e6559ab3613 100644 (file)
rename from packages/ti/platform/vayu/ipu2/package.xdc
rename to qnx/src/tests/GateMPApp/GateMPApp.h
index 0ab0605b4d3476b4cb8503f40e00f240c6c5b227..e796793c9fa47e8ac0e9074278a98e6559ab3613 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2013, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*!
- * File generated by platform wizard.
+
+/*
+ * ======== GateMPApp.h ========
*
*/
-package ti.platform.vayu.ipu2 {
- module Platform;
+#ifndef GateMPApp__include
+#define GateMPApp__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Int GateMPApp_create();
+Int GateMPApp_delete();
+Int GateMPApp_exec();
+
+
+#if defined (__cplusplus)
}
+#endif /* defined (__cplusplus) */
+#endif /* GateMPApp__include */
diff --git a/qnx/src/tests/GateMPApp/GateMPApp.use b/qnx/src/tests/GateMPApp/GateMPApp.use
--- /dev/null
@@ -0,0 +1,7 @@
+GateMPApp Test
+
+Syntax:
+ GateMPApp
+
+Examples:
+ GateMPApp Run the app with the slave processor that has been loaded
diff --git a/qnx/src/tests/GateMPApp/Makefile b/qnx/src/tests/GateMPApp/Makefile
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2013, 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.
+#
+LIST=CPU
+include recurse.mk
diff --git a/qnx/src/tests/GateMPApp/arm/Makefile b/qnx/src/tests/GateMPApp/arm/Makefile
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2013, 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.
+#
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
diff --git a/qnx/src/tests/GateMPApp/arm/o.g.le.v7/Makefile b/qnx/src/tests/GateMPApp/arm/o.g.le.v7/Makefile
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2013, 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.
+#
+include ../../common.mk
+
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/api/arm/a.g.le.v7/libipc_g.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/utils/arm/a.g.le.v7/libutils_g.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7/libsharedmemallocator.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc_g = -Bstatic
+LIBPOST_ipc_g = -Bdynamic
+LIBPREF_utils_g = -Bstatic
+LIBPOST_utils_g = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+LIBPREF_sharedmemallocator = -Bstatic
+LIBPOST_sharedmemallocator = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/api/arm/a.g.le.v7
+LIBS += ipc_g
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/utils/arm/a.g.le.v7
+LIBS += utils_g
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7
+LIBS += sharedmemallocator
diff --git a/qnx/src/tests/GateMPApp/arm/o.le.v7/Makefile b/qnx/src/tests/GateMPApp/arm/o.le.v7/Makefile
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (c) 2013, 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.
+#
+include ../../common.mk
+
+CCFLAGS += -O3
+
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/api/arm/a.le.v7/libipc.a
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/utils/arm/a.le.v7/libutils.a
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7/libsharedmemallocator.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc = -Bstatic
+LIBPOST_ipc = -Bdynamic
+LIBPREF_utils = -Bstatic
+LIBPOST_utils = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+LIBPREF_sharedmemallocator = -Bstatic
+LIBPOST_sharedmemallocator = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/api/arm/a.le.v7
+LIBS += ipc
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/utils/arm/a.le.v7
+LIBS += utils
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7
+LIBS += sharedmemallocator
diff --git a/qnx/src/tests/GateMPApp/common.mk b/qnx/src/tests/GateMPApp/common.mk
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2013, 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.
+#
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME = GateMPApp
+
+define PINFO
+PINFO DESCRIPTION=IPC QNX GATEMP SAMPLE
+endef
+
+ifeq ("$(SYSLINK_PLATFORM)", "vayu")
+INSTALLDIR = bin/tests
+else
+INSTALLDIR = /dev/null
+endif
+
+CCOPTS += -DSYSLINK_BUILDOS_QNX
+
+# source path
+EXTRA_SRCVPATH += \
+ $(IPC_REPO)/qnx/src/tests/GateMPApp \
+
+EXCLUDE_OBJS =
+
+# include path
+EXTRA_INCVPATH += \
+ $(IPC_REPO)/packages \
+ $(IPC_REPO)/qnx/include \
+ $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+ $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
+
+include $(MKFILES_ROOT)/qtargets.mk
+
+LDFLAGS += -M
diff --git a/qnx/src/tests/GateMPApp/main_host.c b/qnx/src/tests/GateMPApp/main_host.c
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2013 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * 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.
+ */
+
+/*
+ * ======== main_host.c ========
+ *
+ */
+
+/* cstdlib header files */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "GateMPApp.h"
+
+/* private functions */
+static Int Main_main(Void);
+static Int Main_parseArgs(Int argc, Char *argv[]);
+
+
+#define Main_USAGE "\
+Usage:\n\
+ GateMPApp [options]\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+\n\
+Examples:\n\
+ GateMPApp\n\
+ GateMPApp -h\n\
+\n"
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Int status;
+
+ printf("--> main:\n");
+
+ /* parse command line */
+ status = Main_parseArgs(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* Ipc initialization */
+ status = Ipc_start();
+
+ if (status >= 0) {
+ /* application create, exec, delete */
+ status = Main_main();
+
+ /* Ipc finalization */
+ Ipc_stop();
+ }
+ else {
+ printf("Ipc_start failed: status = %d\n", status);
+ goto leave;
+ }
+
+leave:
+ printf("<-- main:\n");
+ status = (status >= 0 ? 0 : status);
+
+ return (status);
+}
+
+
+/*
+ * ======== Main_main ========
+ */
+Int Main_main(Void)
+{
+ Int status = 0;
+
+ printf("--> Main_main:\n");
+
+ /* BEGIN application phase */
+
+ /* application create phase */
+ status = GateMPApp_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = GateMPApp_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = GateMPApp_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- Main_main:\n");
+
+ status = (status >= 0 ? 0 : status);
+ return (status);
+}
+
+
+/*
+ * ======== Main_parseArgs ========
+ */
+Int Main_parseArgs(Int argc, Char *argv[])
+{
+ Int x, cp, opt;
+ Int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (Char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ if (opt < argc) {
+ printf(
+ "Error: %s, line %d: too many arguments\n",
+ __FILE__, __LINE__);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ return(status);
+}
index d18939ff7106021ec5315aa0be03b1e0308ab2f2..dc3444c0934b979e212dc109083fa16e58123a5b 100644 (file)
typedef struct SyncMsg {
MessageQ_MsgHeader header;
- unsigned long numLoops;
- unsigned long print;
+ UInt32 numLoops; /* also used for msgId */
+ UInt32 print;
} SyncMsg ;
Int MessageQApp_execute(UInt32 numLoops, UInt16 procId)
Int32 status = 0;
MessageQ_Msg msg = NULL;
MessageQ_Params msgParams;
- UInt16 i;
+ UInt32 i;
MessageQ_QueueId queueId = MessageQ_INVALIDMESSAGEQ;
MessageQ_Handle msgqHandle;
char remoteQueueName[64];
+ UInt32 msgId;
printf("Entered MessageQApp_execute\n");
/* handshake with remote to set the number of loops */
MessageQ_setReplyQueue(msgqHandle, msg);
((SyncMsg *)msg)->numLoops = numLoops;
- ((SyncMsg *)msg)->print = TRUE;
+ ((SyncMsg *)msg)->print = FALSE;
MessageQ_put(queueId, msg);
MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
printf("Exchanging %d messages with remote processor %s...\n",
numLoops, MultiProc_getName(procId));
- for (i = 0 ; i < numLoops; i++) {
- MessageQ_setMsgId(msg, i);
+ for (i = 1 ; i <= numLoops; i++) {
+ ((SyncMsg *)msg)->numLoops = i;
/* Have the remote proc reply to this message queue */
MessageQ_setReplyQueue(msgqHandle, msg);
}
status = MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+
if (status < 0) {
printf("Error in MessageQ_get [%d]\n", status);
break;
}
else {
- printf("MessageQ_get #%d Msg = 0x%x\n", i, (UInt)msg);
-
- /* Validate the returned message. */
- if ((msg != NULL) && (MessageQ_getMsgId (msg) != i)) {
+ /* validate the returned message */
+ msgId = ((SyncMsg *)msg)->numLoops;
+ if ((msg != NULL) && (msgId != i)) {
printf("Data integrity failure!\n"
" Expected %d\n"
" Received %d\n",
- i, MessageQ_getMsgId(msg));
+ i, msgId);
break;
}
}
- printf("Exchanged %d messages with remote processor %s\n",
- (i+1), MultiProc_getName(procId));
+ if (numLoops <= 200) {
+ printf("MessageQ_get #%d Msg = 0x%x\n", i, (UInt)msg);
+ }
+ else if ((i % 1000) == 0) {
+ printf("MessageQ_get #%d Msg = 0x%x\n", i, (UInt)msg);
+ }
}
+ printf("Exchanged %d messages with remote processor %s\n",
+ (i-1), MultiProc_getName(procId));
+
if (status >= 0) {
printf("Sample application successfully completed!\n");
}
status = Ipc_start();
- if (status >= 0) {
- if (procId >= MultiProc_getNumProcessors()) {
- printf("ProcId must be less than %d\n",
- MultiProc_getNumProcessors());
- Ipc_stop();
- exit(0);
- }
- printf("Using numLoops: %d; procId : %d\n", numLoops, procId);
+ if (procId >= MultiProc_getNumProcessors()) {
+ printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
+ Ipc_stop();
+ exit(0);
+ }
+ printf("Using numLoops: %d; procId : %d\n", numLoops, procId);
+ if (status >= 0) {
MessageQApp_execute(numLoops, procId);
Ipc_stop();
}
diff --git a/qnx/src/tests/MessageQBench/MessageQBench.c b/qnx/src/tests/MessageQBench/MessageQBench.c
index 19b23871f98eec3a9c13d6aceb7e660ba0abfc64..41f0e7fcbf7a85a49a2acc2a138031a81795d49f 100644 (file)
* ============================================================================
*/
-/*
- * opkg --tmp-dir ~/tmp install util-linux-ng
- * chrt -f ./MessageQBench
- */
+/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/param.h>
+/* IPC Headers */
#include <ti/ipc/Std.h>
#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
-#define MessageQ_payload(m) ((void *)((char *)(m) + sizeof(MessageQ_MsgHeader)))
#define MINPAYLOADSIZE (2 * sizeof(UInt32))
-/* App defines: Must match on remote proc side: */
-#define NUM_LOOPS_DFLT 1000 /* Number of transfers to be tested. */
+/* App defines: Must match on remote proc side: */
#define HEAPID 0u
-#define PROC_ID_DFLT 1 /* Host is zero, remote cores start at 1 */
#define SLAVE_MESSAGEQNAME "SLAVE"
#define MPU_MESSAGEQNAME "HOST"
+#define PROC_ID_DFLT 1 /* Host is zero, remote cores start at 1 */
+#define NUM_LOOPS_DFLT 1000 /* Number of transfers to be tested. */
+
+typedef struct SyncMsg {
+ MessageQ_MsgHeader header;
+ UInt32 numLoops; /* also used for msgId */
+ UInt32 print;
+} SyncMsg ;
long diff(struct timespec start, struct timespec end)
{
Int32 status = 0;
MessageQ_Msg msg = NULL;
MessageQ_Params msgParams;
- UInt16 i;
+ UInt32 i;
MessageQ_QueueId queueId = MessageQ_INVALIDMESSAGEQ;
MessageQ_Handle msgqHandle;
char remoteQueueName[64];
struct timespec start, end;
long elapsed;
- UInt32 *params;
+ UInt32 msgId;
- printf ("Entered MessageQApp_execute\n");
+ printf("Entered MessageQApp_execute\n");
/* Create the local Message Queue for receiving. */
MessageQ_Params_init(&msgParams);
msgqHandle = MessageQ_create(MPU_MESSAGEQNAME, &msgParams);
if (msgqHandle == NULL) {
- printf ("Error in MessageQ_create\n");
+ printf("Error in MessageQ_create\n");
goto exit;
}
else {
- printf ("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
+ printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
}
sprintf(remoteQueueName, "%s_%s", SLAVE_MESSAGEQNAME,
MultiProc_getName(procId));
- /* Poll until remote side has its messageQ created before we send: */
+ /* Poll until remote side has it's messageQ created before we send: */
do {
status = MessageQ_open(remoteQueueName, &queueId);
sleep (1);
printf("Error in MessageQ_open [%d]\n", status);
goto cleanup;
}
+ else {
+ printf("Remote queueId [0x%x]\n", queueId);
+ }
- printf("Remote queueId [0x%x]\n", queueId);
-
- msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader) + payloadSize);
+ msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg) + payloadSize);
if (msg == NULL) {
printf("Error in MessageQ_alloc\n");
MessageQ_close(&queueId);
/* handshake with remote to set the number of loops */
MessageQ_setReplyQueue(msgqHandle, msg);
- params = MessageQ_payload(msg);
- params[0] = numLoops;
- params[1] = FALSE;
+ ((SyncMsg *)msg)->numLoops = numLoops;
+ ((SyncMsg *)msg)->print = FALSE;
MessageQ_put(queueId, msg);
MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
clock_gettime(CLOCK_REALTIME, &start);
- for (i = 0; i < numLoops; i++) {
- MessageQ_setMsgId(msg, i);
+ for (i = 1 ; i <= numLoops; i++) {
+ ((SyncMsg *)msg)->numLoops = i;
/* Have the remote proc reply to this message queue */
MessageQ_setReplyQueue(msgqHandle, msg);
}
status = MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+
if (status < 0) {
printf("Error in MessageQ_get [%d]\n", status);
break;
}
else {
- /* Validate the returned message. */
- if ((msg != NULL) && (MessageQ_getMsgId(msg) != i)) {
- printf ("Data integrity failure!\n"
+ /* Validate the returned message */
+ msgId = ((SyncMsg *)msg)->numLoops;
+ if ((msg != NULL) && (msgId != i)) {
+ printf("Data integrity failure!\n"
" Expected %d\n"
" Received %d\n",
- i, MessageQ_getMsgId (msg));
+ i, msgId);
break;
}
}
status = Ipc_start();
- if (status >= 0) {
- if (procId >= MultiProc_getNumProcessors()) {
- printf("ProcId must be less than %d\n",
- MultiProc_getNumProcessors());
- Ipc_stop();
- exit(0);
- }
- printf("Using numLoops: %d; payloadSize: %d, procId : %d\n",
+ if (procId >= MultiProc_getNumProcessors()) {
+ printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
+ Ipc_stop();
+ exit(0);
+ }
+ printf("Using numLoops: %d; payloadSize: %d, procId : %d\n",
numLoops, payloadSize, procId);
+ if (status >= 0) {
MessageQApp_execute(numLoops, payloadSize, procId);
Ipc_stop();
}
else {
- fprintf(stderr, "Ipc_start failed: status = %d\n", status);
+ printf("Ipc_start failed: status = %d\n", status);
}
return (status);
diff --git a/qnx/src/tests/NameServerApp/NameServerApp.c b/qnx/src/tests/NameServerApp/NameServerApp.c
index ff05ea47a5b1c1a74a70a4b0a9ab90208aedd655..288251b633681125a4644eda3e2ffb9f01c40dad 100644 (file)
Int32 status = 0;
NameServer_Params params;
NameServer_Handle nsHandle;
+ NameServer_Handle nsHandleAlias;
NameServer_Handle nsHandle2;
Int iteration = 0;
again:
NameServer_Params_init(¶ms);
+
+ params.maxValueLen = sizeof(UInt32);
+ params.maxNameLen = 32;
+
printf("params.maxValueLen=%d\n", params.maxValueLen);
printf("params.maxNameLen=%d\n", params.maxNameLen);
printf("params.checkExisting=%d\n", params.checkExisting);
- params.maxValueLen = sizeof(UInt32);
- params.maxNameLen = 32;
nsHandle = NameServer_create(NSNAME, ¶ms);
if (nsHandle == NULL) {
printf("Failed to create NameServer '%s'\n", NSNAME);
printf("Created NameServer '%s'\n", NSNAME);
}
+ nsHandleAlias = NameServer_create(NSNAME, ¶ms);
+ if (nsHandleAlias == NULL) {
+ printf("Failed to get handle to NameServer '%s'\n", NSNAME);
+ return -1;
+ }
+ else {
+ printf("Got another handle to NameServer '%s'\n", NSNAME);
+ }
+
NameServer_Params_init(¶ms);
params.maxValueLen = sizeof(UInt32);
printf("Created NameServer '%s'\n", NSNAME2);
}
+ printf("Testing nsHandle\n");
status = testNS(nsHandle, "Key");
+ if (status != 0) {
+ printf("test failed on nsHandle\n");
+ return status;
+ }
+ printf("Testing nsHandle2\n");
status = testNS(nsHandle2, "Key");
+ if (status != 0) {
+ printf("test failed on nsHandle2\n");
+ return status;
+ }
printf("Deleting nsHandle and nsHandle2...\n");
NameServer_delete(&nsHandle);
NameServer_delete(&nsHandle2);
+ /*
+ * Verify that we can still use the alias handle after deleting the
+ * initial handle
+ */
+ printf("Testing nsHandleAlias\n");
+ status = testNS(nsHandleAlias, "Key");
+ if (status != 0) {
+ printf("test failed on nsHandleAlias\n");
+ return status;
+ }
+ printf("Deleting nsHandleAlias...\n");
+ NameServer_delete(&nsHandleAlias);
+
iteration++;
if (iteration < 2) {
goto again;
index d78398d14c97c049bb31c95434b0278290615049..a37b38f047604d5cee58b336f15ec1f18c0819a7 100644 (file)
--- a/qnx/src/utils/common.mk
+++ b/qnx/src/utils/common.mk
PINFO DESCRIPTION=IPC QNX UTIILIES USER LIBRARY
endef
-# don't install the binaries, they are copied in base makefile
-INSTALLDIR = /dev/null
+INSTALLDIR = usr/lib
# source path
EXTRA_SRCVPATH += \
$(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/inc
include $(MKFILES_ROOT)/qtargets.mk
-OPTIMIZE__gcc=$(OPTIMIZE_NONE_gcc)
\ No newline at end of file
+OPTIMIZE__gcc=$(OPTIMIZE_NONE_gcc)
+
+# install the headers
+POST_INSTALL += \
+ $(CP_HOST) -Rv $(IPC_REPO)/packages/ti/ipc/MultiProc.h $(INSTALL_ROOT_nto)/usr/include/ti/ipc/MultiProc.h