]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
Merge remote-tracking branch 'vincent-ext/3.00.00.14_eng' into 14_eng
authorChris Ring <cring@ti.com>
Fri, 22 Mar 2013 21:20:03 +0000 (14:20 -0700)
committerChris Ring <cring@ti.com>
Fri, 22 Mar 2013 21:20:03 +0000 (14:20 -0700)
44 files changed:
Makefile.in
configure
ipc-bios.mak
linux/etc/Makefile.in
linux/src/api/Makefile.in
linux/src/daemon/Makefile.in
linux/src/family/Makefile.in
linux/src/mm/Makefile.in
linux/src/tests/Makefile.am
linux/src/tests/Makefile.in
linux/src/utils/Makefile.in
packages/ti/ipc/mm/MmRpc.c
packages/ti/ipc/mm/MmRpc.h
packages/ti/ipc/mm/MmServiceMgr.c [new file with mode: 0644]
packages/ti/ipc/mm/MmServiceMgr.h [new file with mode: 0644]
packages/ti/ipc/mm/MmType.h [new file with mode: 0644]
packages/ti/ipc/mm/package.bld [new file with mode: 0644]
packages/ti/ipc/mm/package.xdc [new file with mode: 0644]
packages/ti/ipc/mm/package.xs [new file with mode: 0644]
packages/ti/ipc/package.bld
packages/ti/ipc/tests/Mx.c [new file with mode: 0644]
packages/ti/ipc/tests/Mx.h [new file with mode: 0644]
packages/ti/ipc/tests/MxServer.c [new file with mode: 0644]
packages/ti/ipc/tests/MxServer.h [new file with mode: 0644]
packages/ti/ipc/tests/mmrpc_test.c
packages/ti/ipc/tests/package.bld
packages/ti/ipc/tests/rpc_task.c
packages/ti/ipc/tests/test_omx_ipu_omap5.cfg
packages/ti/srvmgr/ServiceMgr.c
packages/ti/srvmgr/ServiceMgr.h
packages/ti/srvmgr/omaprpc/OmapRpc.c
packages/ti/srvmgr/omaprpc/OmapRpc.h
products.mak
qnx/.gitignore [new file with mode: 0644]
qnx/src/ipc3x_dev/sharedmemallocator/resmgr/SharedMemoryAllocator.c
qnx/src/ipc3x_dev/ti/syslink/family/omap5430/Platform.c
qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c
qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.h
qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/common.mk
qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/rpmsg-rpc-stress.use
qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/tests_rpc_stress.c
qnx/src/tests/mmrpc_test/arm/o.g.le.v7/Makefile
qnx/src/tests/mmrpc_test/arm/o.le.v7/Makefile
qnx/src/tests/mmrpc_test/common.mk

index e44aa2d519ff916d1268627db02570c3d9bb5515..8f0f928b9e523b251917206953fbab723fe960e5 100644 (file)
@@ -118,6 +118,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
index 00a9561f3dde91b23cdb596c6a1d78c797f209a4..cf8e3db93f39f8b88b9b7ff1d76ea7bd83b1b2e2 100755 (executable)
--- a/configure
+++ b/configure
@@ -461,7 +461,7 @@ ac_includes_default="\
 # 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 OMAPL138_TRUE OMAPL138_FALSE TCI6614_TRUE TCI6614_FALSE TCI6638_TRUE TCI6638_FALSE OMAP54XX_SMP_TRUE OMAP54XX_SMP_FALSE CMEM_TRUE CMEM_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 OMAPL138_TRUE OMAPL138_FALSE TCI6614_TRUE TCI6614_FALSE TCI6638_TRUE TCI6638_FALSE OMAP54XX_SMP_TRUE OMAP54XX_SMP_FALSE CMEM_TRUE CMEM_FALSE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -942,6 +942,10 @@ ac_env_CMEM_INSTALL_DIR_set=${CMEM_INSTALL_DIR+set}
 ac_env_CMEM_INSTALL_DIR_value=$CMEM_INSTALL_DIR
 ac_cv_env_CMEM_INSTALL_DIR_set=${CMEM_INSTALL_DIR+set}
 ac_cv_env_CMEM_INSTALL_DIR_value=$CMEM_INSTALL_DIR
+ac_env_KERNEL_INSTALL_DIR_set=${KERNEL_INSTALL_DIR+set}
+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
 
 #
 # Report the --help message.
@@ -1060,6 +1064,8 @@ Some influential environment variables:
               built.
   CMEM_INSTALL_DIR
               Installation path directory to the CMEM libraries
+  KERNEL_INSTALL_DIR
+              Installation path to the Linux kernel.
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -3705,7 +3711,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 3708 "configure"' > conftest.$ac_ext
+  echo '#line 3714 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6130,11 +6136,11 @@ else
    -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:6133: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6139: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6137: \$? = $ac_status" >&5
+   echo "$as_me:6143: \$? = $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.
@@ -6398,11 +6404,11 @@ else
    -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:6401: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6407: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6405: \$? = $ac_status" >&5
+   echo "$as_me:6411: \$? = $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.
@@ -6502,11 +6508,11 @@ else
    -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:6505: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6511: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:6509: \$? = $ac_status" >&5
+   echo "$as_me:6515: \$? = $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
@@ -8847,7 +8853,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8850 "configure"
+#line 8856 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -8947,7 +8953,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8950 "configure"
+#line 8956 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11287,11 +11293,11 @@ else
    -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:11290: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11296: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11294: \$? = $ac_status" >&5
+   echo "$as_me:11300: \$? = $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.
@@ -11391,11 +11397,11 @@ else
    -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:11394: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11400: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11398: \$? = $ac_status" >&5
+   echo "$as_me:11404: \$? = $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
@@ -12698,11 +12704,11 @@ else
    -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:12701: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12707: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12705: \$? = $ac_status" >&5
+   echo "$as_me:12711: \$? = $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.
@@ -12966,11 +12972,11 @@ else
    -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:12969: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12975: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12973: \$? = $ac_status" >&5
+   echo "$as_me:12979: \$? = $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.
@@ -13070,11 +13076,11 @@ else
    -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:13073: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13079: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13077: \$? = $ac_status" >&5
+   echo "$as_me:13083: \$? = $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
@@ -16767,6 +16773,7 @@ done
 
 
 
+
 # Test platform variable for setting
 if test "x$PLATFORM" = "xomapl138"; then
   { echo "$as_me:$LINENO: PLATFORM is set to ${PLATFORM}" >&5
 fi
 
 
+if test "x$KERNEL_INSTALL_DIR" = "x"; then
+  { { echo "$as_me:$LINENO: error: Kernel path is not set" >&5
+echo "$as_me: error: Kernel path is not set" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
 # Export optional user variable to Makefile(s)
 
 
 
+
 # Define specific variables to be used in Makefile.am
 
 
@@ -17668,6 +17683,7 @@ s,@AM_CFLAGS@,$AM_CFLAGS,;t t
 s,@AM_LDFLAGS@,$AM_LDFLAGS,;t t
 s,@PLATFORM@,$PLATFORM,;t t
 s,@CMEM_INSTALL_DIR@,$CMEM_INSTALL_DIR,;t t
+s,@KERNEL_INSTALL_DIR@,$KERNEL_INSTALL_DIR,;t t
 s,@OMAPL138_TRUE@,$OMAPL138_TRUE,;t t
 s,@OMAPL138_FALSE@,$OMAPL138_FALSE,;t t
 s,@TCI6614_TRUE@,$TCI6614_TRUE,;t t
index a6fc8c2788edbdadc991f375b0fae03efbe7f0f8..121f65e39b80f54bcbcff996f9ba8409ae73031d 100644 (file)
@@ -140,9 +140,9 @@ all:
        @ $(XDC) -P $(LIST)
 
 libs:
-       @ echo #
-       @ echo # Making $@ ...
-       @ $(XDC) -P $(LIST) .libraries
+       @echo "#"
+       @echo "# Making $@ ..."
+       $(XDC) .libraries -P $(LIST)
 
 release:
        @ echo building ipc packages ...
index ad29aba5a4b8b5deafcc0ce14d883b9853fac875..6dc9f92f38c8078f37099b4188b4c981813b689c 100644 (file)
@@ -84,6 +84,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
index 3abb39e321d6fab44206e048b5c318c655d811ed..05f6fce7f2fb77737a0b917bcf30e30ef759c2c1 100644 (file)
@@ -118,6 +118,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
index 16123457dce36da1980071dd908d28390ea29604..0f767e201962199fdc99007f47939a08f442bb51 100644 (file)
@@ -146,6 +146,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
index 0a785a2baa92e7eece18636c5ee3823cba806b2c..fee196091d55fca0e72770fc189164fd7cec750e 100644 (file)
@@ -175,6 +175,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
index b2267c1c50c3a201f401df1c59f33bbb7ea8e4ab..d078969cdeb0b29b00d1ccb9af5337419daa9906 100644 (file)
@@ -83,7 +83,7 @@ AMDEP_TRUE = @AMDEP_TRUE@
 AMTAR = @AMTAR@
 
 # additional include paths necessary to compile the library
-AM_CFLAGS = -Wall @AM_CFLAGS@
+AM_CFLAGS = -Wall @AM_CFLAGS@ -DKERNEL_INSTALL_DIR="$(KERNEL_INSTALL_DIR)"
 AM_LDFLAGS = @AM_LDFLAGS@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
@@ -115,6 +115,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
index d24dbd596fabca8e0d83f2928c47cb377f19f0c2..43ec32e532e7a12051bd52eb8058bc8456e8ccfe 100644 (file)
@@ -94,7 +94,7 @@ nameServer_common_sources = \
 ping_rpmsg_SOURCES = ping_rpmsg.c
 
 # list of sources for the 'mmrpc_test' binary
-mmrpc_test_SOURCES = mmrpc_test.c
+mmrpc_test_SOURCES = Mx.c mmrpc_test.c
 
 # list of sources for the 'MessageQApp' binary
 MessageQApp_omap54xx_smp_SOURCES = $(common_sources) MessageQApp.c
index 9cfb97793f606768363413f0d4563211875e72fb..bdf6caeaefd87fa544759b468ba198f518156a1b 100644 (file)
@@ -16,7 +16,6 @@
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
-VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
@@ -208,7 +207,7 @@ NameServerApp_tci6638_OBJECTS = $(am_NameServerApp_tci6638_OBJECTS)
 NameServerApp_tci6638_DEPENDENCIES = $(am__DEPENDENCIES_1) \
        $(top_builddir)/linux/src/family/libtiipccfg_tci6638.la \
        $(am__DEPENDENCIES_2)
-am_mmrpc_test_OBJECTS = mmrpc_test.$(OBJEXT)
+am_mmrpc_test_OBJECTS = Mx.$(OBJEXT) mmrpc_test.$(OBJEXT)
 mmrpc_test_OBJECTS = $(am_mmrpc_test_OBJECTS)
 mmrpc_test_DEPENDENCIES = $(top_builddir)/linux/src/mm/libmmrpc.la
 am_nano_test_omapl138_OBJECTS = $(am__objects_1) nano_test.$(OBJEXT)
@@ -266,6 +265,7 @@ DIST_SOURCES = $(MessageQApp_omap54xx_smp_SOURCES) \
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+VPATH = ../../../packages/ti/ipc/tests
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -306,6 +306,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -397,7 +398,7 @@ nameServer_common_sources = \
 ping_rpmsg_SOURCES = ping_rpmsg.c
 
 # list of sources for the 'mmrpc_test' binary
-mmrpc_test_SOURCES = mmrpc_test.c
+mmrpc_test_SOURCES = Mx.c mmrpc_test.c
 
 # list of sources for the 'MessageQApp' binary
 MessageQApp_omap54xx_smp_SOURCES = $(common_sources) MessageQApp.c
@@ -641,6 +642,7 @@ distclean-compile:
 @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)/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@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nano_test.Po@am__quote@
index 20b753aaec346a6429e13aa58f616c22c9e6d216..f39e83ca8211f8c755fb2de67a64825b2301eb75 100644 (file)
@@ -119,6 +119,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KERNEL_INSTALL_DIR = @KERNEL_INSTALL_DIR@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
index a240d54deac7143e23e2272c7fb506e32fb13022..52ba15d6ab0541210c17ddb1b65b5399d4db95f5 100644 (file)
@@ -98,13 +98,12 @@ void MmRpc_Params_init(MmRpc_Params *params)
 /*
  *  ======== MmRpc_create ========
  */
-int MmRpc_create(const char *proc, const char *service,
-        const MmRpc_Params *params, MmRpc_Handle *handlePtr)
+int MmRpc_create(const char *service, const MmRpc_Params *params,
+        MmRpc_Handle *handlePtr)
 {
     int             status = MmRpc_S_SUCCESS;
     MmRpc_Object *  obj;
-
-    printf("MmRpc_create: -->\n");
+    char            cbuf[RPPC_MAX_INST_NAMELEN+16];
 
     /* allocate the instance object */
     obj = (MmRpc_Object *)calloc(1, sizeof(MmRpc_Object));
@@ -115,8 +114,8 @@ int MmRpc_create(const char *proc, const char *service,
     }
 
     /* open the driver */
-    printf("MmRpc_create: open driver\n");
-    obj->fd = open("/dev/rpc_example", O_RDWR);
+    sprintf(cbuf, "/dev/%s", service);
+    obj->fd = open(cbuf, O_RDWR);
 
     if (obj->fd < 0) {
         printf("MmRpc_create: Error: open failed\n");
@@ -124,11 +123,10 @@ int MmRpc_create(const char *proc, const char *service,
         goto leave;
     }
 
-    strncpy(obj->connect.name, "rpc_example", (RPPC_MAX_INST_NAMELEN - 1));
+    strncpy(obj->connect.name, service, (RPPC_MAX_INST_NAMELEN - 1));
     obj->connect.name[RPPC_MAX_INST_NAMELEN - 1] = '\0';
 
     /* create a server instance, rebind its address to this file descriptor */
-    printf("MmRpc_create: create server instance\n");
     status = ioctl(obj->fd, RPPC_IOC_CREATE, &obj->connect);
 
     if (status < 0) {
@@ -151,7 +149,6 @@ leave:
         *handlePtr = (MmRpc_Handle)obj;
     }
 
-    printf("MmRpc_create: <--\n");
     return(status);
 }
 
@@ -163,7 +160,6 @@ int MmRpc_delete(MmRpc_Handle *handlePtr)
     int status = MmRpc_S_SUCCESS;
     MmRpc_Object *obj;
 
-    printf("MmRpc_delete: -->\n");
     obj = (MmRpc_Object *)(*handlePtr);
 
     /* close the device */
@@ -175,7 +171,6 @@ int MmRpc_delete(MmRpc_Handle *handlePtr)
     free((void *)(*handlePtr));
     *handlePtr = NULL;
 
-    printf("MmRpc_delete: <--\n");
     return(status);
 }
 
@@ -188,18 +183,16 @@ int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret)
     MmRpc_Object *obj = (MmRpc_Object *)handle;
     struct rppc_function *rpfxn;
     struct rppc_function_return reply_msg;
-    MmRpc_Param *arg;
+    MmRpc_Param *param;
     void *msg;
     int len;
     int i;
 
-    printf("MmRpc_call: -->\n");
-
     /* Combine function parameters and translation array into one contiguous
      * message. TODO, modify driver to accept two separate buffers in order
      * to eliminate this step. */
     len = sizeof(struct rppc_function) +
-                (ctx->num_translations * sizeof(struct rppc_param_translation));
+                (ctx->num_xlts * sizeof(struct rppc_param_translation));
     msg = (void *)calloc(len, sizeof(char));
 
     if (msg == NULL) {
@@ -208,47 +201,56 @@ int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret)
         goto leave;
     }
 
-    /* copy function arguments into message */
+    /* copy function parameters into message */
     rpfxn = (struct rppc_function *)msg;
     rpfxn->fxn_id = ctx->fxn_id;
     rpfxn->num_params = ctx->num_params;
 
     for (i = 0; i < ctx->num_params; i++) {
-        arg = &ctx->params[i];
+        param = &ctx->params[i];
 
-        switch (arg->type) {
-            case MmRpc_ParamType_Atomic:
+        switch (param->type) {
+            case MmRpc_ParamType_Scalar:
                 rpfxn->params[i].type = RPPC_PARAM_TYPE_ATOMIC;
-                rpfxn->params[i].size = arg->param.atomic.size;
-                rpfxn->params[i].data = arg->param.atomic.data;
+                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;
                 break;
 
             case MmRpc_ParamType_Ptr:
                 rpfxn->params[i].type = RPPC_PARAM_TYPE_PTR;
-                rpfxn->params[i].size = arg->param.ptr.size;
-                rpfxn->params[i].data = arg->param.ptr.addr;
-                rpfxn->params[i].base = arg->param.ptr.addr;
-                rpfxn->params[i].reserved = arg->param.ptr.handle;
+                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;
                 break;
 
-            case MmRpc_ParamType_PtrOffset:
+#if 0 /* TBD */
+            case MmRpc_ParamType_Elem:
                 rpfxn->params[i].type = RPPC_PARAM_TYPE_PTR;
-                rpfxn->params[i].size = arg->param.ptrOffset.size;
-                rpfxn->params[i].data = arg->param.ptrOffset.offset;
-                rpfxn->params[i].base = arg->param.ptrOffset.base;
-                rpfxn->params[i].reserved = arg->param.ptrOffset.handle;
+                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;
+                break;
+#endif
+            default:
+                printf("MmRpc_call: Error: invalid parameter type\n");
+                status = MmRpc_E_INVALIDPARAM;
+                goto leave;
                 break;
         }
     }
 
     /* copy offset array into message */
-    for (i = 0; i < ctx->num_translations; i++) {
-        rpfxn->translations[i].index    = ctx->translations[i].index;
-        rpfxn->translations[i].offset   = ctx->translations[i].offset;
-        rpfxn->translations[i].base     = ctx->translations[i].base;
-        rpfxn->translations[i].reserved = 0;
+    rpfxn->num_translations = ctx->num_xlts;
+
+    for (i = 0; i < ctx->num_xlts; i++) {
+        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].reserved = ctx->xltAry[i].handle;
     }
 
     /* send message for remote execution */
@@ -285,6 +287,5 @@ leave:
         free(msg);
     }
 
-    printf("MmRpc_call: <-- status=%d\n", status);
     return(status);
 }
index 844246328da8ae242d743212ae245474969da137..2bdc1afc96e5463799947b3d501a2e8f96c6724c 100644 (file)
@@ -45,7 +45,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#if defined (__cplusplus)
+#if defined(__cplusplus)
 extern "C" {
 #endif
 
@@ -59,16 +59,36 @@ extern "C" {
  */
 #define MmRpc_E_FAIL (-1)
 
+/*!
+ *  @brief  Invalid parameter type
+ */
+#define MmRpc_E_INVALIDPARAM (-2)
+
 /*!
  *  @brief  Size of parameter array in function context structure
  */
-#define MmRpc_MAX_PARAMETERS (10)
+#define MmRpc_MAX_PARAMS (10)
 
 /*!
  *  @brief  Maximum size of translation array in function context structure
  */
 #define MmRpc_MAX_TRANSLATIONS (1024)
 
+/*!
+ *  @brief  Macro for computing offset to a field of a structure.
+ *
+ *          struct foobar {
+ *              int a;
+ *              int *p;
+ *          };
+ *
+ *          struct foobar *sp = ...;
+ *          offset = MmRpc_OFFSET(sp, &sp->p);
+ *          struct foobar st = ...;
+ *          offset = MmRpc_OFFSET(&st, &st.p);
+ */
+#define MmRpc_OFFSET(base, field) ((unsigned int)(field)-(unsigned int)(base))
+
 /*!
  *  @brief      MmRpc_Handle type
  */
@@ -78,9 +98,9 @@ typedef struct MmRpc_Object *MmRpc_Handle;
  *  @brief      MmRpc_ParamType enum
  */
 typedef enum {
-    MmRpc_ParamType_Atomic = 1, /*!< atomic data type */
+    MmRpc_ParamType_Scalar = 1, /*!< pass by value */
     MmRpc_ParamType_Ptr,        /*!< data pointer */
-    MmRpc_ParamType_PtrOffset   /*!< pointer offset */
+    MmRpc_ParamType_Elem        /*!< array element */
 } MmRpc_ParamType;
 
 /*!
@@ -92,21 +112,23 @@ typedef struct {
     union {
         struct {
             size_t      size;   /*!< size of the data */
-            size_t      data;   /*!< atomic data */
-        } atomic;
+            size_t      data;   /*!< data (pass by value)*/
+        } scalar;
 
         struct {
-            size_t      size;   /*!< size of the data */
+            size_t      size;   /*!< size of the data referenced */
             size_t      addr;   /*!< pointer value */
             size_t      handle; /*!< memory allocator handle */
         } ptr;
 
+#if 0 /* TBD */
         struct {
-            size_t      size;   /*!< size of the data */
-            size_t      offset; /*!< offset value */
-            size_t      base;   /*!< base pointer value */
+            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      handle; /*!< memory allocator handle */
-        } ptrOffset;
+        } elem;
+#endif
     } param;
 } MmRpc_Param;
 
@@ -114,20 +136,19 @@ typedef struct {
     uint32_t    index;  /*!< parameter index to base pointer */
     ptrdiff_t   offset; /*!< offset from the base address to pointer */
     size_t      base;   /*!< user virtual address */
-} MmRpc_Txlt;
+    size_t      handle; /*!< memory allocator handle */
+} MmRpc_Xlt;
 
 /*!
  *  @brief      Function call context structure
  */
 typedef struct {
-    uint32_t    fxn_id;         /*!< The function to call. */
-    uint32_t    num_params;     /*!< Number of elements in param array. */
-    MmRpc_Param params[MmRpc_MAX_PARAMETERS];
-                                /*!< The array of parameters */
-    uint32_t num_translations;
-                                /*!< The number of translations needed
-                                 *   in the offsets array */
-    MmRpc_Txlt *translations;   /*!< array of translations */
+    uint32_t    fxn_id;         /*!< function id to call */
+    uint32_t    num_params;     /*!< number of parameters in params array */
+    MmRpc_Param params[MmRpc_MAX_PARAMS];
+                                /*!< the array of parameters */
+    uint32_t    num_xlts;       /*!< number of translations in xltAry */
+    MmRpc_Xlt * xltAry;         /*!< array of translations */
 } MmRpc_FxnCtx;
 
 /*!
@@ -147,8 +168,8 @@ int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret);
  *  @brief      Create an MmRpc instance
  *
  */
-int MmRpc_create(const char *proc, const char *service,
-        const MmRpc_Params *params, MmRpc_Handle *handlPtr);
+int MmRpc_create(const char *service, const MmRpc_Params *params,
+        MmRpc_Handle *handlPtr);
 
 /*!
  *  @brief      Delete an MmRpc instance
@@ -164,7 +185,7 @@ void MmRpc_Params_init(MmRpc_Params *params);
 
 
 
-#if defined (__cplusplus)
+#if defined(__cplusplus)
 }
 #endif
 #endif /* ti_ipc_mm_MmRpc__include */
diff --git a/packages/ti/ipc/mm/MmServiceMgr.c b/packages/ti/ipc/mm/MmServiceMgr.c
new file mode 100644 (file)
index 0000000..a055183
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ */
+
+/*
+ *  ======== MmServiceMgr.c ========
+ */
+
+#include <string.h>
+
+#include <xdc/std.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/grcm/RcmServer.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/mm/MmType.h>
+#include <ti/srvmgr/ServiceMgr.h>
+#include <ti/srvmgr/omaprpc/OmapRpc.h>
+
+#include "MmServiceMgr.h"
+
+#define MmServiceMgr_PORT (59)
+
+typedef struct {
+    RcmServer_Params    rcmParams;
+    Int                 aryLen;
+    OmapRpc_FuncSignature *sigAry;
+} MmServiceMgr_Client;
+
+static Int MmServiceMgr_ref = 0;
+
+/* temporary: needs to be removed */
+extern Int32 OmapRpc_GetSvrMgrHandle(Void *srvc, Int32 num, Int32 *params);
+
+/*
+ *  ======== MmServiceMgr_init ========
+ */
+Int MmServiceMgr_init(Void)
+{
+    if (MmServiceMgr_ref++ != 0) {
+        return(MmServiceMgr_S_SUCCESS); /* module already initialized */
+    }
+
+    RcmServer_init();
+//  ServiceMgr_init();
+
+    return(MmServiceMgr_S_SUCCESS);
+}
+
+/*
+ *  ======== MmServiceMgr_exit ========
+ */
+Void MmServiceMgr_exit(Void)
+{
+    if (--MmServiceMgr_ref != 0) {
+        return; /* module still in use */
+    }
+
+    RcmServer_exit();
+}
+
+/*
+ *  ======== MmServiceMgr_register ========
+ */
+Int MmServiceMgr_register(const String name, RcmServer_Params *rcmParams,
+        MmType_FxnSigTab *fxnSigTab, MmServiceMgr_DelFxn delFxn)
+{
+#if 1
+    Int status = MmServiceMgr_S_SUCCESS;
+    OmapRpc_Handle handle;
+
+    handle = OmapRpc_createChannel(name, MultiProc_getId("HOST"),
+            MmServiceMgr_PORT, rcmParams, fxnSigTab, delFxn);
+
+    if (handle == NULL) {
+        status = MmServiceMgr_E_FAIL;
+    }
+
+    return(status);
+#else
+    Int status = MmServiceMgr_S_SUCCESS;
+    MmServiceMgr_Client *obj;
+    RcmServer_FxnDesc *fxnAry;
+    Int func;
+
+    System_printf("MmServiceMgr_register: -->\n");
+
+    obj = Memory_calloc(NULL, sizeof(MmServiceMgr_Client), 0, NULL);
+
+    if (obj == NULL) {
+        System_printf("MmServiceMgr_register: Error: out of memory\n");
+        status = MmServiceMgr_E_FAIL;
+        goto leave;
+    }
+
+    /* Temporary: make a local copy of server create params in order
+     * to add one more function to the function table. Will be removed.
+     */
+    memcpy(&obj->rcmParams, rcmParams, sizeof(RcmServer_Params));
+    obj->rcmParams.fxns.length = rcmParams->fxns.length + 1;
+
+    obj->rcmParams.fxns.elem = Memory_calloc(NULL, obj->rcmParams.fxns.length *
+            sizeof(RcmServer_FxnDesc), 0, NULL);
+
+    if (obj->rcmParams.fxns.elem == NULL) {
+        System_printf("MmServiceMgr_register: Error: out of memory\n");
+        status = MmServiceMgr_E_FAIL;
+        goto leave;
+    }
+
+    /* Temporary: make a local copy of signature array in order
+     * to add the "first function" signature. Will be removed.
+     */
+    obj->aryLen = aryLen + 1;
+
+    obj->sigAry = Memory_calloc(NULL, obj->aryLen *
+            sizeof(OmapRpc_FuncSignature), 0, NULL);
+
+    if (obj->sigAry == NULL) {
+        System_printf("MmServiceMgr_register: Error: out of memory\n");
+        status = MmServiceMgr_E_FAIL;
+        goto leave;
+    }
+
+    /* Temporary: insert the "first function" in slot 0, then copy
+     * in the caller's functions. Eventually, the create function will be
+     * removed.
+     */
+    obj->rcmParams.fxns.elem[0].name =
+            OmapRpc_Stringerize(OmapRpc_GetSvrMgrHandle);
+    obj->rcmParams.fxns.elem[0].addr.createFxn =
+            (RcmServer_MsgCreateFxn)OmapRpc_GetSvrMgrHandle;
+    strncpy(obj->sigAry[0].name, obj->rcmParams.fxns.elem[0].name,
+            OMAPRPC_MAX_CHANNEL_NAMELEN);
+    obj->sigAry[0].numParam = 0;
+
+    fxnAry = rcmParams->fxns.elem;
+
+    for (func = 0; func < rcmParams->fxns.length; func++) {
+        obj->rcmParams.fxns.elem[func+1].name = fxnAry[func].name;
+        obj->rcmParams.fxns.elem[func+1].addr.fxn = fxnAry[func].addr.fxn;
+
+        memcpy(&obj->sigAry[func+1], &sigAry[func],
+                sizeof(OmapRpc_FuncSignature));
+    }
+
+    if (!ServiceMgr_register(name, &obj->rcmParams)) {
+        System_printf("MmServiceMgr_register: Error: service register failed, "
+                "status=%d\n");
+        status = MmServiceMgr_E_FAIL;
+        goto leave;
+    }
+
+leave:
+    if (status < 0) {
+        if ((obj != NULL) && (obj->sigAry != NULL)) {
+            Memory_free(NULL, obj->sigAry,
+                    obj->aryLen * sizeof(OmapRpc_FuncDeclaration));
+        }
+        if ((obj != NULL) && (obj->rcmParams.fxns.elem != NULL)) {
+            Memory_free(NULL, obj->rcmParams.fxns.elem,
+                    obj->rcmParams.fxns.length * sizeof(RcmServer_FxnDesc));
+        }
+        if (obj != NULL) {
+            Memory_free(NULL, obj, sizeof(MmServiceMgr_Client));
+        }
+    }
+
+    System_printf("MmServiceMgr_register: <--, status=%d\n", status);
+    return(status);
+#endif
+}
+
+#if 0
+/*
+ *  ======== MmServiceMgr_start ========
+ */
+Int MmServiceMgr_start(const String name, Int aryLen,
+        OmapRpc_FuncSignature *sigAry)
+{
+    extern Int OmapRpc_start(const String name, Int port, Int aryLen,
+        OmapRpc_FuncSignature *sigAry);
+
+    Int status = MmServiceMgr_S_SUCCESS;
+
+    OmapRpc_start(name, MmServiceMgr_PORT, aryLen, sigAry);
+
+    return(status);
+}
+#endif
diff --git a/packages/ti/ipc/mm/MmServiceMgr.h b/packages/ti/ipc/mm/MmServiceMgr.h
new file mode 100644 (file)
index 0000000..bd78928
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * 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       MmServiceMgr.h
+ *
+ *  @brief      Multi-Media Service Manager
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_mm_MmServiceMgr__include
+#define ti_ipc_mm_MmServiceMgr__include
+
+#include <ti/grcm/RcmServer.h>
+#include <ti/ipc/mm/MmType.h>
+#include <ti/srvmgr/omaprpc/OmapRpc.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ *  @brief  Operation is successful
+ */
+#define MmServiceMgr_S_SUCCESS (0)
+
+/*!
+ *  @brief  Operation failed
+ */
+#define MmServiceMgr_E_FAIL (-1)
+
+typedef Void (*MmServiceMgr_DelFxn)(Void);
+
+
+/*!
+ *  @brief      Initialize the MmServiceMgr module
+ *
+ */
+Int MmServiceMgr_init(Void);
+
+/*!
+ *  @brief      Finalize the MmServiceMgr module
+ *
+ */
+Void MmServiceMgr_exit(Void);
+
+/*!
+ *  @brief      Register a new service
+ *
+ */
+Int MmServiceMgr_register(const String name, RcmServer_Params *params,
+        MmType_FxnSigTab *fxnSigTab, MmServiceMgr_DelFxn delFxn);
+
+/*!
+ *  @brief      Start the service manager listner task
+ *
+ */
+Int MmServiceMgr_start(const String name, Int aryLen,
+        OmapRpc_FuncSignature *sigAry);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif /* ti_ipc_mm_MmServiceMgr__include */
diff --git a/packages/ti/ipc/mm/MmType.h b/packages/ti/ipc/mm/MmType.h
new file mode 100644 (file)
index 0000000..94a78c5
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * 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       MmType.h
+ *
+ *  @brief      Specific types to support the MmRpc and MmServiceMgr modules
+ *
+ *  ============================================================================
+ */
+
+#ifndef ti_ipc_mm_MmType__include
+#define ti_ipc_mm_MmType__include
+
+#include <ti/grcm/RcmServer.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ *  @brief      Maximum function name length
+ */
+#define MmType_MAX_NAMELEN (64)
+
+/*!
+ *  @brief      Maximum number of parameters
+ */
+#define MmType_MAX_PARAMS (10)
+
+/*!
+ *  @brief      Compute number of elements in given array
+ *
+ *              The given array must be the actual array buffer,
+ *              not a pointer to it.
+ */
+#define MmType_NumElem(x) (sizeof(x)/sizeof(x[0]))
+
+/*!
+ *  @brief      Parameter Direction
+ *
+ *              The parameter direction relative to the function
+ *              it describes.
+ */
+typedef enum {
+    MmType_Dir_In = 0,
+    MmType_Dir_Out,
+    MmType_Dir_Bi,
+    MmType_Dir_MAX
+} MmType_Dir;
+
+/*!
+ *  @brief      Parameter Type
+ */
+typedef enum {
+    MmType_Param_VOID = 0,
+    MmType_Param_S08,
+    MmType_Param_U08,
+    MmType_Param_S16,
+    MmType_Param_U16,
+    MmType_Param_S32,
+    MmType_Param_U32,
+    MmType_Param_S64,
+    MmType_Param_U64,
+
+    MmType_Param_PTR = 0x80,   /*!< OR'd with lower type to make a
+                                    pointer to the correct type */
+    MmType_Param_MAX
+} MmType_ParamType;
+
+#define MmType_PtrType(type)    (type | MmType_Param_PTR)
+
+/*!
+ *  @brief      Parameter Signature
+ */
+typedef struct {
+    UInt32 direction;   /*!< @see MmType_Dir */
+    UInt32 type;        /*!< @see MmType_ParamType */
+    UInt32 count;       /*!< basic sanity checking on array bounds */
+} MmType_ParamSig;
+
+/*!
+ *  @brief      Function Signature
+ *
+ *  The first parameter (params[0]) is the return value.
+ */
+typedef struct {
+    Char                name[MmType_MAX_NAMELEN];
+    UInt32              numParam;
+    MmType_ParamSig     params[MmType_MAX_PARAMS + 1];
+} MmType_FxnSig;
+
+/*!
+ *  @brief      Function Signature Table
+ *
+ */
+typedef struct {
+    UInt                count;
+    MmType_FxnSig *     table;
+} MmType_FxnSigTab;
+
+/*!
+ *  @brief      Marshalled Parameter structure
+ *
+ */
+typedef struct {
+    SizeT size;
+    SizeT data;
+} MmType_Param;
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* ti_ipc_mm_MmType__include */
diff --git a/packages/ti/ipc/mm/package.bld b/packages/ti/ipc/mm/package.bld
new file mode 100644 (file)
index 0000000..2ec5c09
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2011-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.
+ */
+
+/*
+ *  ======== package.bld ========
+ */
+
+/* explicit references to global objects */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/* add custom files to all releases */
+Pkg.attrs.exportSrc = true;
+Pkg.otherFiles = [
+    "package.bld",
+    "MmRpc.h",
+    "MmRpc.c",
+    "MmServiceMgr.h"
+];
+
+var srcs = [ "MmServiceMgr.c" ];
+
+/* clean lib folder */
+Pkg.generatedFiles.$add("lib/");
+
+for (var j = 0; j < Build.targets.length; j++) {
+    var targ = Build.targets[j];
+
+    for (var profile in targ.profiles) {
+
+        /* name = lib/profile/name.a+suffix */
+        var name = "lib/" + profile + "/ti_ipc_mm";
+
+        /* build the library */
+        var library = Pkg.addLibrary(name, targ, {profile: profile });
+
+        /* add the source files */
+        library.addObjects(srcs);
+    }
+}
diff --git a/packages/ti/ipc/mm/package.xdc b/packages/ti/ipc/mm/package.xdc
new file mode 100644 (file)
index 0000000..b329b84
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011-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.
+ *
+ */
+
+/*
+ *  ======== package.xdc ========
+ *
+ */
+
+package ti.ipc.mm [1,0,0] {
+};
diff --git a/packages/ti/ipc/mm/package.xs b/packages/ti/ipc/mm/package.xs
new file mode 100644 (file)
index 0000000..de34c94
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011-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.
+ */
+
+/*
+ *  ======== package.xs ========
+ *
+ */
+
+/*
+ *  ======== getLibs ========
+ */
+function getLibs(prog)
+{
+    var suffix;
+    var file;
+    var libAry = [];
+    var profile = this.profile;
+
+    suffix = prog.build.target.findSuffix(this);
+    if (suffix == null) {
+        return("");  /* nothing to contribute */
+    }
+
+    /* make sure the library exists, else fallback to a built library */
+    file = "lib/" + profile + "/ti_ipc_mm.a" + suffix;
+    if (java.io.File(this.packageBase + file).exists()) {
+        libAry.push(file);
+    }
+    else {
+        file = "lib/release/ti_ipc_mm.a" + suffix;
+        if (java.io.File(this.packageBase + file).exists()) {
+            libAry.push(file);
+        }
+        else {
+            /* fallback to a compatible library built by this package */
+            for (var p in this.build.libDesc) {
+                if (suffix == this.build.libDesc[p].suffix) {
+                    libAry.push(p);
+                    break;
+                }
+            }
+        }
+    }
+
+    return libAry.join(";");
+}
index a242103bf0f97f89a0d9ae9f031c2b2e3def822c..b00268ef1ad874fc40fe5919f6656020e2bc88bb 100644 (file)
@@ -46,9 +46,7 @@ Pkg.otherFiles = [
     "NameServer.h",
     "Notify.h",
     "SharedRegion.h",
-    "package.bld",
-    "mm/MmRpc.c",
-    "mm/MmRpc.h"
+    "package.bld"
 ];
 
 /* include source files in the release package */
diff --git a/packages/ti/ipc/tests/Mx.c b/packages/ti/ipc/tests/Mx.c
new file mode 100644 (file)
index 0000000..6e65df3
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * 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.
+ */
+
+/*
+ *  ======== Mx.c ========
+ */
+#include <stdio.h>
+
+#include <ti/ipc/mm/MmRpc.h>
+
+#if defined(SYSLINK_BUILDOS_QNX)
+#include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
+#endif
+
+#include "Mx.h"
+
+/* hande used for remote communication */
+static MmRpc_Handle Mx_rpcIpu = NULL;
+
+/* static function indicies */
+#define Mx_Fxn_triple   (0x80000000 | 1)
+#define Mx_Fxn_add      (0x80000000 | 2)
+#define Mx_Fxn_compute  (0x80000000 | 5)
+
+#define Mx_OFFSET(base, member) ((uint_t)(member) - (uint_t)(base))
+
+/*
+ *  ======== Mx_initialize ========
+ */
+int Mx_initialize(void)
+{
+    int status;
+    MmRpc_Params args;
+
+    /* create remote server insance */
+    MmRpc_Params_init(&args);
+
+    status = MmRpc_create("rpc_example", &args, &Mx_rpcIpu);
+
+    if (status < 0) {
+        printf("mmrpc_test: Error: MmRpc_create failed\n");
+        status = -1;
+    }
+    else {
+        status = 0;
+    }
+
+    return(status);
+}
+
+/*
+ *  ======== Mx_finalize ========
+ */
+void Mx_finalize(void)
+{
+    /* delete remote server instance */
+    if (Mx_rpcIpu != NULL) {
+        MmRpc_delete(&Mx_rpcIpu);
+    }
+}
+
+/*
+ *  ======== Mx_triple ========
+ */
+int32_t Mx_triple(uint32_t a)
+{
+    MmRpc_FxnCtx *fxnCtx;
+    int32_t fxnRet;
+    char send_buf[512] = {0};
+    int status;
+
+    /* marshall function arguments into the send buffer */
+    fxnCtx = (MmRpc_FxnCtx *)send_buf;
+
+    fxnCtx->fxn_id = Mx_Fxn_triple;
+    fxnCtx->num_params = 1;
+    fxnCtx->params[0].type = MmRpc_ParamType_Scalar;
+    fxnCtx->params[0].param.scalar.size = sizeof(int);
+    fxnCtx->params[0].param.scalar.data = a;
+    fxnCtx->num_xlts = 0;
+    fxnCtx->xltAry = NULL;
+
+    /* invoke the remote function call */
+    status = MmRpc_call(Mx_rpcIpu, fxnCtx, &fxnRet);
+
+    if (status < 0) {
+        printf("mmrpc_test: Error: MmRpc_call failed\n");
+        fxnRet = -1;
+    }
+
+    return(fxnRet);
+}
+
+/*
+ *  ======== Mx_add ========
+ */
+int32_t Mx_add(int32_t a, int32_t b)
+{
+    MmRpc_FxnCtx *fxnCtx;
+    int32_t fxnRet;
+    char send_buf[512] = {0};
+    int status;
+
+    /* marshall function arguments into the send buffer */
+    fxnCtx = (MmRpc_FxnCtx *)send_buf;
+
+    fxnCtx->fxn_id = Mx_Fxn_add;
+    fxnCtx->num_params = 2;
+    fxnCtx->params[0].type = MmRpc_ParamType_Scalar;
+    fxnCtx->params[0].param.scalar.size = sizeof(int);
+    fxnCtx->params[0].param.scalar.data = a;
+    fxnCtx->params[1].type = MmRpc_ParamType_Scalar;
+    fxnCtx->params[1].param.scalar.size = sizeof(int);
+    fxnCtx->params[1].param.scalar.data = b;
+    fxnCtx->num_xlts = 0;
+
+    /* invoke the remote function call */
+    status = MmRpc_call(Mx_rpcIpu, fxnCtx, &fxnRet);
+
+    if (status < 0) {
+        printf("mmrpc_test: Error: MmRpc_call failed\n");
+        fxnRet = -1;
+    }
+
+    return(fxnRet);
+}
+
+/*
+ *  ======== Mx_compute ========
+ */
+int32_t Mx_compute(Mx_Compute *compute)
+{
+    MmRpc_FxnCtx *fxnCtx;
+    MmRpc_Xlt xltAry[2];
+    int32_t fxnRet;
+    char send_buf[512] = {0};
+    int status;
+
+    /* marshall function arguments into the send buffer */
+    fxnCtx = (MmRpc_FxnCtx *)send_buf;
+
+    fxnCtx->fxn_id = Mx_Fxn_compute;
+    fxnCtx->num_params = 1;
+    fxnCtx->params[0].type = MmRpc_ParamType_Ptr;
+    fxnCtx->params[0].param.ptr.size = sizeof(Mx_Compute);
+    fxnCtx->params[0].param.ptr.addr = (size_t)compute;
+#if defined(SYSLINK_BUILDOS_QNX)
+    fxnCtx->params[0].param.ptr.handle = NULL;
+#else
+//  fxnCtx->params[0].param.ptr.handle = ...;
+#endif
+
+    fxnCtx->num_xlts = 2;
+    fxnCtx->xltAry = xltAry;
+
+    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 = ...;
+#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 = ...;
+#endif
+
+    /* invoke the remote function call */
+    status = MmRpc_call(Mx_rpcIpu, fxnCtx, &fxnRet);
+
+    if (status < 0) {
+        printf("mmrpc_test: Error: MmRpc_call failed\n");
+        fxnRet = -1;
+    }
+
+    return(fxnRet);
+}
diff --git a/packages/ti/ipc/tests/Mx.h b/packages/ti/ipc/tests/Mx.h
new file mode 100644 (file)
index 0000000..85c0550
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * 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       Mx.h
+ *
+ *  @brief      Example of a host-side module which uses MmRpc to
+ *              invoke functions on a remote processor.
+ *
+ *  ============================================================================
+ */
+
+#ifndef Mx__include
+#define Mx__include
+
+#include <stddef.h>
+#include <stdint.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ *  @brief      Operation is successful
+ */
+#define Mx_S_SUCCESS (0)
+
+/*!
+ *  @brief      Operation failed
+ */
+#define Mx_E_FAIL (-1)
+
+/*!
+ *  @brief      Compute structure
+ */
+typedef struct {
+    uint32_t    coef;
+    int         key;
+    int         size;
+    uint32_t *  inBuf;
+    uint32_t *  outBuf;
+} Mx_Compute;
+
+/*!
+ *  @brief      Initialize the module, must be called first
+ */
+int Mx_initialize(void);
+
+/*!
+ *  @brief      Finalize the module, must be called last
+ */
+void Mx_finalize(void);
+
+/*!
+ *  @brief      Sample function which multiplies argument by three
+ */
+int32_t Mx_triple(uint32_t a);
+
+/*!
+ *  @brief      Sample function which addes two arguments
+ */
+int32_t Mx_add(int32_t a, int32_t b);
+
+/*!
+ *  @brief      Sample function which has pointer parameter to
+ *              a structure with two embedded pointers.
+ */
+int32_t Mx_compute(Mx_Compute *compute);
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* Mx__include */
diff --git a/packages/ti/ipc/tests/MxServer.c b/packages/ti/ipc/tests/MxServer.c
new file mode 100644 (file)
index 0000000..c927288
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+/*
+ *  ======== MxServer.c ========
+ *
+ *  Example implementation of the Mx module which runs on the host.
+ *  The Mx module will invoke these function here using MmRpc.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "MxServer.h"
+
+/*
+ *  ======== MxServer_triple ========
+ */
+int32_t MxServer_triple(uint32_t a)
+{
+    int32_t result;
+
+    result = a * 3;
+
+    return(result);
+}
+
+/*
+ *  ======== MxServer_add ========
+ */
+int32_t MxServer_add(int32_t a, int32_t b)
+{
+    int32_t result;
+
+    result = a + b;
+
+    return(result);
+}
+
+/*
+ *  ======== MxServer_compute ========
+ */
+int32_t MxServer_compute(MxServer_Compute *compute)
+{
+    int i;
+
+    /* process inBuf into outBuf */
+    for (i = 0; i < compute->size; i++) {
+        compute->outBuf[i] = compute->coef | compute->inBuf[i];
+    }
+
+    /* write a cookie into the key */
+    compute->key = 0xA0A0;
+
+    return(0);
+}
diff --git a/packages/ti/ipc/tests/MxServer.h b/packages/ti/ipc/tests/MxServer.h
new file mode 100644 (file)
index 0000000..b3c2e40
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * 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       MxServer.h
+ *
+ *  @brief      Example of a slave-side module which implements the Mx
+ *              module functions. The functions in MxServer are invoked
+ *              remotely by the Mx module running on the host processor.
+ *
+ *  ============================================================================
+ */
+
+#ifndef MxServer__include
+#define MxServer__include
+
+#include <stddef.h>
+#include <stdint.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ *  @brief      Operation is successful
+ */
+#define MxServer_S_SUCCESS (0)
+
+/*!
+ *  @brief      Operation failed
+ */
+#define MxServer_E_FAIL (-1)
+
+/*!
+ *  @brief      Compute structure
+ */
+typedef struct {
+    uint32_t    coef;
+    int         key;
+    int         size;
+    uint32_t *  inBuf;
+    uint32_t *  outBuf;
+} MxServer_Compute;
+
+/*!
+ *  @brief      Sample function which multiplies argument by three
+ */
+int32_t MxServer_triple(uint32_t a);
+
+/*!
+ *  @brief      Sample function which addes two arguments
+ */
+int32_t MxServer_add(int32_t a, int32_t b);
+
+/*!
+ *  @brief      Sample function which has pointer parameter to
+ *              a structure with two embedded pointers.
+ */
+int32_t MxServer_compute(MxServer_Compute *compute);
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* MxServer__include */
index d606e1712cb2e313dcc5a012467fe621ab0ce5c7..6fb7f183a476ec298b7161819538ff029e3f4b4c 100644 (file)
  */
 #include <stdio.h>
 
-#include <ti/ipc/mm/MmRpc.h>
-
-
-/*
- *  module 'Mx' functions
- */
-
-/* compute structure */
-typedef struct {
-    uint32_t    coef;
-    int         size;
-    uint32_t *  inBuf;
-    uint32_t *  outBuf;
-} Mx_Compute;
-
-int Mx_initialize(void);
-void Mx_finalize(void);
-
-int32_t Mx_triple(uint32_t a);
-int32_t Mx_add(int32_t a, int32_t b);
-int32_t Mx_compute(Mx_Compute *compute);
-
-MmRpc_Handle Mx_rpcDsp = NULL;
-
-/* static function indicies */
-#define Mx_Fxn_triple   (0x80000000 | 1)
-#define Mx_Fxn_add      (0x80000000 | 2)
-#define Mx_Fxn_compute  (0x80000000 | 3)
+#if defined(SYSLINK_BUILDOS_QNX)
+#include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
+#endif
 
+#include "Mx.h"
 
 /*
  *  ======== main ========
@@ -71,9 +47,13 @@ MmRpc_Handle Mx_rpcDsp = NULL;
 int main(int argc, char **argv)
 {
     int status;
+    int i;
     int32_t ret;
-//  int i;
-//  Mx_Compute *compute;
+    uint32_t val;
+    Mx_Compute *compute;
+#if defined(SYSLINK_BUILDOS_QNX)
+    shm_buf shmCompute, shmInBuf, shmOutBuf;
+#endif
 
     printf("mmrpc_test: --> main\n");
 
@@ -109,34 +89,109 @@ int main(int argc, char **argv)
         goto leave;
     }
 
-#if 0
     /* allocate a compute structure in shared memory */
-//  compute = ...;
+#if defined(SYSLINK_BUILDOS_QNX)
+    SHM_alloc(sizeof(Mx_Compute), &shmCompute);
+    compute = (Mx_Compute *)(shmCompute.vir_addr);
+#else
+    compute = NULL;
+#endif
+
+    if (compute == NULL) {
+        /* temporary: memory alloc not implemented on Linux */
+        goto leave;
+    }
+
+    /* initialize compute structure */
     compute->coef = 0x80400000;
+    compute->key = 0xABA0;
     compute->size = 0x1000;
+    compute->inBuf = NULL;
+    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
+
+    if (compute->inBuf == NULL) {
+        printf("mmrpc_test: Error: inBuf == NULL\n");
+        status = -1;
+        goto leave;
+    }
 
+    /* fill input buffer with seed value */
     for (i = 0; i < compute->size; i++) {
         compute->inBuf[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
+
+    if (compute->outBuf == NULL) {
+        printf("mmrpc_test: Error: outBuf == NULL\n");
+        status = -1;
+        goto leave;
+    }
+
+    /* 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(compute);
 
     if (ret < 0) {
         status = -1;
+        printf("mmrpc_test: Error: Mx_Compute() failed\n");
         goto leave;
     }
 
+    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]);
+
+    /* 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;
+        }
+    }
+
     /* free resources */
-//  free(compute->outBuf);
-//  free(compute->inBuf);
-//  free(compute);
+#if defined(SYSLINK_BUILDOS_QNX)
+    SHM_release(&shmOutBuf);
+    SHM_release(&shmInBuf);
+    SHM_release(&shmCompute);
+#else
+//  ...
 #endif
 
 leave:
@@ -151,143 +206,3 @@ leave:
     }
     return(0);
 }
-
-/*
- *  ======== Mx_initialize ========
- */
-int Mx_initialize(void)
-{
-    int status;
-    MmRpc_Params params;
-
-    /* create remote server insance */
-    MmRpc_Params_init(&params);
-
-    status = MmRpc_create("DSP", "FooServer", &params, &Mx_rpcDsp);
-
-    if (status < 0) {
-        printf("mmrpc_test: Error: MmRpc_create failed\n");
-        status = -1;
-    }
-    else {
-        status = 0;
-    }
-
-    return(status);
-}
-
-/*
- *  ======== Mx_finalize ========
- */
-void Mx_finalize(void)
-{
-    /* delete remote server instance */
-    if (Mx_rpcDsp != NULL) {
-        MmRpc_delete(&Mx_rpcDsp);
-    }
-}
-
-/*
- *  ======== Mx_triple ========
- */
-int32_t Mx_triple(uint32_t a)
-{
-    MmRpc_FxnCtx *fxnCtx;
-    int32_t fxnRet;
-    char send_buf[512] = {0};
-    int status;
-
-    /* marshall function arguments into the send buffer */
-    fxnCtx = (MmRpc_FxnCtx *)send_buf;
-
-    fxnCtx->fxn_id = Mx_Fxn_triple;
-    fxnCtx->num_params = 1;
-    fxnCtx->params[0].type = MmRpc_ParamType_Atomic;
-    fxnCtx->params[0].param.atomic.size = sizeof(int);
-    fxnCtx->params[0].param.atomic.data = a;
-    fxnCtx->num_translations = 0;
-
-    /* invoke the remote function call */
-    status = MmRpc_call(Mx_rpcDsp, fxnCtx, &fxnRet);
-
-    if (status < 0) {
-        printf("mmrpc_test: Error: MmRpc_call failed\n");
-        fxnRet = -1;
-    }
-
-    return(fxnRet);
-}
-
-/*
- *  ======== Mx_add ========
- */
-int32_t Mx_add(int32_t a, int32_t b)
-{
-    MmRpc_FxnCtx *fxnCtx;
-    int32_t fxnRet;
-    char send_buf[512] = {0};
-    int status;
-
-    /* marshall function arguments into the send buffer */
-    fxnCtx = (MmRpc_FxnCtx *)send_buf;
-
-    fxnCtx->fxn_id = Mx_Fxn_add;
-    fxnCtx->num_params = 2;
-    fxnCtx->params[0].type = MmRpc_ParamType_Atomic;
-    fxnCtx->params[0].param.atomic.size = sizeof(int);
-    fxnCtx->params[0].param.atomic.data = a;
-    fxnCtx->params[1].type = MmRpc_ParamType_Atomic;
-    fxnCtx->params[1].param.atomic.size = sizeof(int);
-    fxnCtx->params[1].param.atomic.data = b;
-    fxnCtx->num_translations = 0;
-
-    /* invoke the remote function call */
-    status = MmRpc_call(Mx_rpcDsp, fxnCtx, &fxnRet);
-
-    if (status < 0) {
-        printf("mmrpc_test: Error: MmRpc_call failed\n");
-        fxnRet = -1;
-    }
-
-    return(fxnRet);
-}
-
-/*
- *  ======== Mx_compute ========
- */
-int32_t Mx_compute(Mx_Compute *compute)
-{
-    MmRpc_FxnCtx *fxnCtx;
-    MmRpc_Txlt tlxtTable[2];
-    int32_t fxnRet;
-    char send_buf[512] = {0};
-    int status;
-
-    /* marshall function arguments into the send buffer */
-    fxnCtx = (MmRpc_FxnCtx *)send_buf;
-
-    fxnCtx->fxn_id = Mx_Fxn_compute;
-    fxnCtx->num_params = 1;
-    fxnCtx->params[0].type = MmRpc_ParamType_Ptr;
-    fxnCtx->params[0].param.ptr.size = sizeof(void *);
-    fxnCtx->params[0].param.ptr.addr = (size_t)compute;
-//  fxnCtx->params[0].param.ptr.handle = ...;
-
-    fxnCtx->num_translations = 2;
-    fxnCtx->translations = tlxtTable;
-
-    fxnCtx->translations[0].index = 0;
-    fxnCtx->translations[0].offset = 8;
-    fxnCtx->translations[1].index = 0;
-    fxnCtx->translations[1].offset = 12;
-
-    /* invoke the remote function call */
-    status = MmRpc_call(Mx_rpcDsp, fxnCtx, &fxnRet);
-
-    if (status < 0) {
-        printf("mmrpc_test: Error: MmRpc_call failed\n");
-        fxnRet = -1;
-    }
-
-    return(fxnRet);
-}
index f70b9b983dc0a7bce25f984f2d9a8a8d81a10d99..51fea022a2a3865596b5b858189e2a04f50572e6 100644 (file)
@@ -137,7 +137,8 @@ for (var i = 0; i < Build.targets.length; i++) {
             Pkg.addExecutable(name + "/test_omx_ipu_omap5", targ, platform, {
                 cfgScript: "test_omx_ipu_omap5",
                 defs: "-D IPU -D OMAP5xxx"
-            }).addObjects(["test_omx.c","ping_tasks.c","rpc_task.c"]);
+            }).addObjects(["test_omx.c","ping_tasks.c","rpc_task.c",
+                    "MxServer.c"]);
         }
     }
 }
index 8cfdc1a76eaf10e65f991055874e5dd7f8509d99..ad4c9cda142c28a4422827ed7925b0bedf4073b9 100644 (file)
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 /*
  *  ======== rpc_task.c ========
  *
- *  Example of setting up a 'RPC' service with the ServiceMgr, allowing clients
- *  to instantiate the example RPC instance.
- *
+ *  Example of how to integrate the MxServer module with the
+ *  MmService manager.
  */
 
 #include <xdc/std.h>
-#include <xdc/cfg/global.h>
 #include <xdc/runtime/System.h>
-#include <xdc/runtime/Diags.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
 
-#include <ti/ipc/MultiProc.h>
-#include <ti/sysbios/BIOS.h>
-#include <ti/sysbios/knl/Task.h>
-
-#include <ti/grcm/RcmTypes.h>
 #include <ti/grcm/RcmServer.h>
+#include <ti/ipc/mm/MmType.h>
+#include <ti/ipc/mm/MmServiceMgr.h>
+#include <ti/sysbios/hal/Cache.h>
 
-#include <ti/srvmgr/ServiceMgr.h>
-#include <ti/srvmgr/omaprpc/OmapRpc.h>
-#include <ti/srvmgr/rpmsg_omx.h>
-#include <ti/srvmgr/omx_packet.h>
+#include "MxServer.h"
 
-/* Turn on/off printf's */
+/* turn on/off printf's */
 #define CHATTER 1
 
-#define RPC_MGR_PORT    59
-
-/* Legacy function to allow Linux side rpmsg sample tests to work: */
-extern void start_rpc_task();
-
-/*
- * OMX packet expected to have its data payload start with a payload of
- * this value. Need to export this properly in a meaningful header file on
- * both HLOS and RTOS sides
- */
-typedef enum {
-    RPC_OMX_MAP_INFO_NONE       = 0,
-    RPC_OMX_MAP_INFO_ONE_BUF    = 1,
-    RPC_OMX_MAP_INFO_TWO_BUF    = 2,
-    RPC_OMX_MAP_INFO_THREE_BUF  = 3,
-    RPC_OMX_MAP_INFO_MAX        = 0x7FFFFFFF
-} map_info_type;
-
-/*
- *  ======== fxnTriple used by omx_benchmark test app ========
- */
 typedef struct {
-    Int size_a;
     Int a;
-} FxnTripleArgs;
-
-typedef struct {
-    Int size_a;
-    Int a;
-    Int size_b;
     Int b;
-} FxnAddArgs;
+    Int c;
+} FxnAdd3Args;
 
-#define H264_DECODER_NAME   "H264_decoder"
+typedef struct {
+    Int num;
+    Int *array;
+} FxnAddXArgs;
 
-#define OMX_VIDEO_THREAD_PRIORITY    5
 
-typedef UInt32 OMX_HANDLETYPE;
+#define SERVICE_NAME "rpc_example"
 
-static Int32 RPC_SKEL_Init(Void *, UInt32 size, UInt32 *data);
+/* MxServer skel function declarations */
 static Int32 RPC_SKEL_Init2(UInt32 size, UInt32 *data);
-static Int32 RPC_SKEL_SetParameter(UInt32 size, UInt32 *data);
-static Int32 RPC_SKEL_GetParameter(UInt32 size, UInt32 *data);
-static Int32 fxnTriple(UInt32 size, UInt32 *data);
-static Int32 fxnAdd(UInt32 size, UInt32 *data);
-
-#if 0
-/* RcmServer static function table */
-static RcmServer_FxnDesc RPCServerFxnAry[] = {
-    {"RPC_SKEL_Init", NULL}, /* filled in dynamically */
-    {"RPC_SKEL_SetParameter", RPC_SKEL_SetParameter},
-    {"RPC_SKEL_GetParameter", RPC_SKEL_GetParameter},
-    {"fxnTriple", fxnTriple },
+static Int32 MxServer_skel_triple(UInt32 size, UInt32 *data);
+static Int32 MxServer_skel_add(UInt32 size, UInt32 *data);
+static Int32 fxnAdd3(UInt32 size, UInt32 *data);
+static Int32 fxnAddX(UInt32 size, UInt32 *data);
+static Int32 MxServer_skel_compute(UInt32 size, UInt32 *data);
+
+/* MxServer skel function array */
+static RcmServer_FxnDesc mxSkelAry[] = {
+    { "RPC_SKEL_Init2",         RPC_SKEL_Init2          },
+    { "MxServer_triple",        MxServer_skel_triple    },
+    { "MxServer_add",           MxServer_skel_add       },
+    { "fxnAdd3",                fxnAdd3                 },
+    { "fxnAddX",                fxnAddX                 },
+    { "MxServer_compute",       MxServer_skel_compute   }
 };
 
-#define RPCServerFxnAryLen (sizeof RPCServerFxnAry / sizeof RPCServerFxnAry[0])
-
-static const RcmServer_FxnDescAry RPCServer_fxnTab = {
-    RPCServerFxnAryLen,
-    RPCServerFxnAry
+/* MxServer skel function table */
+static const RcmServer_FxnDescAry rpc_fxnTab = {
+    (sizeof(mxSkelAry) / sizeof(mxSkelAry[0])),
+    mxSkelAry
 };
-#endif
 
-#define RPC_SVR_NUM_FXNS 3
-OmapRpc_FuncDeclaration RPCServerFxns[RPC_SVR_NUM_FXNS] =
-{
-    { RPC_SKEL_Init2,
-        { "RPC_SKEL_Init2", 3,
-            {
-                {OmapRpc_Direction_Out, OmapRpc_Param_S32, 1}, // return
-                {OmapRpc_Direction_In, OmapRpc_Param_U32, 1},
-                {OmapRpc_Direction_In, OmapRpc_PtrType(OmapRpc_Param_U32), 1}
-            }
+static MmType_FxnSig rpc_sigAry[] = {
+    { "RPC_SKEL_Init2", 3,
+        {
+            { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+            { MmType_Dir_In,  MmType_Param_U32, 1 },
+            { MmType_Dir_In,  MmType_PtrType(MmType_Param_U32), 1 }
+        }
+    },
+    { "MxServer_triple", 2,
+        {
+            { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+            { MmType_Dir_In,  MmType_Param_U32, 1 }
+        }
+    },
+    { "MxServer_add", 3,
+        {
+            { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+            { MmType_Dir_In,  MmType_Param_S32, 1 },
+            { MmType_Dir_In,  MmType_Param_S32, 1 }
+        }
+    },
+    { "fxnAdd3", 2,
+        {
+            { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+            { MmType_Dir_In,  MmType_PtrType(MmType_Param_U32), 1 }
         }
     },
-    { fxnTriple,
-        { "fxnTriple", 2,
-            {
-                {OmapRpc_Direction_Out, OmapRpc_Param_S32, 1}, // return
-                {OmapRpc_Direction_In, OmapRpc_Param_U32, 1}
-            },
-        },
+    { "fxnAddX", 2,
+        {
+            { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+            { MmType_Dir_In,  MmType_PtrType(MmType_Param_U32), 1 }
+        }
     },
-    { fxnAdd,
-        { "fxnAdd", 3,
-            {
-                {OmapRpc_Direction_Out, OmapRpc_Param_S32, 1}, // return
-                {OmapRpc_Direction_In, OmapRpc_Param_S32, 1},
-                {OmapRpc_Direction_In, OmapRpc_Param_S32, 1}
-            }
+    { "MxServer_compute", 1,
+        {
+            { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+            { MmType_Dir_In,  MmType_PtrType(MmType_Param_VOID), 1 }
         }
     }
 };
 
-static Int32 RPC_SKEL_SetParameter(UInt32 size, UInt32 *data)
-{
-#if CHATTER
-    System_printf("RPC_SKEL_SetParameter: Called\n");
-#endif
+static MmType_FxnSigTab rpc_fxnSigTab = {
+    MmType_NumElem(rpc_sigAry), rpc_sigAry
+};
+
+/* the server create parameters, must be in persistent memory */
+static RcmServer_Params rpc_Params;
 
-    return(0);
-}
 
-static Int32 RPC_SKEL_GetParameter(UInt32 size, UInt32 *data)
+Void RPC_SKEL_SrvDelNotification(Void)
 {
-#if CHATTER
-    System_printf("RPC_SKEL_GetParameter: Called\n");
-#endif
+    System_printf("RPC_SKEL_SrvDelNotification: Nothing to cleanup\n");
+}
 
+static Int32 RPC_SKEL_Init2(UInt32 size, UInt32 *data)
+{
+    System_printf("RPC_SKEL_Init2: size=0x%x data=0x%x\n", size, data);
     return(0);
 }
 
-Void RPC_SKEL_SrvDelNotification()
+/*
+ *  ======== MxServer_skel_triple ========
+ */
+Int32 MxServer_skel_triple(UInt32 size, UInt32 *data)
 {
-    System_printf("RPC_SKEL_SrvDelNotification: Nothing to cleanup\n");
-}
+    MmType_Param *payload = (MmType_Param *)data;
+    UInt32 a;
+    Int32 result;
 
-#define CALLBACK_DATA      "OMX_Callback"
-#define PAYLOAD_SIZE       sizeof(CALLBACK_DATA)
-#define CALLBACK_DATA_SIZE (HDRSIZE + OMXPACKETSIZE + PAYLOAD_SIZE)
+    a = (UInt32)payload[0].data;
+    result = MxServer_triple(a);
 
-static Int32 RPC_SKEL_Init(Void *srvc, UInt32 size, UInt32 *data)
-{
-    char              cComponentName[128] = {0};
-    OMX_HANDLETYPE    hComp;
-    Char              cb_data[HDRSIZE + OMXPACKETSIZE + PAYLOAD_SIZE] =  {0};
+#if CHATTER
+    System_printf("fxnTriple: a=%d, result=%d\n", a, result);
+#endif
 
-    /*
-     * Note: Currently, rpmsg_omx linux driver expects an omx_msg_hdr in front
-     * of the omx_packet data, so we allow space for this:
-     */
-    struct omx_msg_hdr * hdr = (struct omx_msg_hdr *)cb_data;
-    struct omx_packet  * packet = (struct omx_packet *)hdr->data;
+    return(result);
+}
 
+/*
+ *  ======== MxServer_skel_add ========
+ */
+Int32 MxServer_skel_add(UInt32 size, UInt32 *data)
+{
+    MmType_Param *payload = (MmType_Param *)data;
+    Int32 a, b;
+    Int32 result;
 
-    //Marshalled:[>offset(cParameterName)|>pAppData|>offset(RcmServerName)|>pid|
-    //>--cComponentName--|>--CallingCorercmServerName--|
-    //<hComp]
+    a = (Int32)payload[0].data;
+    b = (Int32)payload[1].data;
 
-    strcpy(cComponentName, (char *)data + sizeof(map_info_type));
+    result = MxServer_add(a, b);
 
 #if CHATTER
-    System_printf("RPC_SKEL_GetHandle: Component Name received: %s\n",
-                  cComponentName);
+    System_printf("fxnAdd: a=%d, b=%d, result=%d\n", a, b, result);
 #endif
 
-    /* Simulate sending an async OMX callback message, passing an omx_packet
-     * structure.
-     */
-    packet->msg_id  = 99;   // Set to indicate callback instance, buffer id, etc.
-    packet->fxn_idx = 5;    // Set to indicate callback fxn
-    packet->data_size = PAYLOAD_SIZE;
-    strcpy((char *)packet->data, CALLBACK_DATA);
+    return(result);
+}
 
-#if CHATTER
-    System_printf("RPC_SKEL_GetHandle: Sending callback message id: %d, "
-                  "fxn_id: %d, data: %s\n",
-                  packet->msg_id, packet->fxn_idx, packet->data);
-#endif
-    ServiceMgr_send(srvc, cb_data, CALLBACK_DATA_SIZE);
+/*
+ *  ======== fxnAdd3 ========
+ */
+Int32 fxnAdd3(UInt32 size, UInt32 *data)
+{
+    MmType_Param *payload = (MmType_Param *)data;
+    FxnAdd3Args *args;
+    Int a, b, c;
+
+    args = (FxnAdd3Args *)payload[0].data;
 
-    /* Call OMX_Get_Handle() and return handle for future calls. */
-    //eCompReturn = OMX_GetHandle(&hComp, (OMX_STRING)&cComponentName[0], pAppData,&rpcCallBackInfo);
-    hComp = 0x5C0FFEE5;
-    data[0] = hComp;
+    Cache_inv (args, sizeof(FxnAdd3Args), Cache_Type_ALL, TRUE);
+
+    a = args->a;
+    b = args->b;
+    c = args->c;
 
 #if CHATTER
-    System_printf("RPC_SKEL_GetHandle: returning hComp: 0x%x\n", hComp);
+    System_printf("fxnAdd3: a=%d, b=%d, c=%d\n", a, b, c);
 #endif
 
-    return(0);
-}
-
-static Int32 RPC_SKEL_Init2(UInt32 size, UInt32 *data)
-{
-    System_printf("RPC_SKEL_Init2: size = 0x%x data = 0x%x\n", size,
-                                                            (UInt32)data);
-    return 0;
+    return(a + b + c);
 }
 
 /*
- *  ======== fxnTriple ========
+ *  ======== fxnAddX ========
  */
-Int32 fxnTriple(UInt32 size, UInt32 *data)
+Int32 fxnAddX(UInt32 size, UInt32 *data)
 {
-    FxnTripleArgs *args;
-    Int a;
+    MmType_Param *payload = (MmType_Param *)data;
+    FxnAddXArgs *args;
+    Int num, i, sum = 0;
+    Int *array;
 
-//  args = (FxnTripleArgs *)((UInt32)data + sizeof(map_info_type));
-    args = (FxnTripleArgs *)data;
-    a = args->a;
+    args = (FxnAddXArgs *)payload[0].data;
+
+    Cache_inv (args, sizeof(FxnAddXArgs), Cache_Type_ALL, TRUE);
+
+    num = args->num;
+    array = args->array;
+
+    Cache_inv (array, sizeof(Int) * num, Cache_Type_ALL, TRUE);
 
 #if CHATTER
-    System_printf("fxnTriple: a=%d\n", a);
+    System_printf("fxnAddX: ");
 #endif
+    for (i = 0; i < num; i++) {
+#if CHATTER
+        System_printf(" a[%d]=%d,", i, array[i]);
+#endif
+        sum += array[i];
+    }
 
-    return(a * 3);
+#if CHATTER
+    System_printf(" sum=%d\n", sum);
+#endif
+
+    return(sum);
 }
 
 /*
- *  ======== fxnAdd ========
+ *  ======== MxServer_skel_compute ========
  */
-Int32 fxnAdd(UInt32 size, UInt32 *data)
+Int32 MxServer_skel_compute(UInt32 size, UInt32 *data)
 {
-    FxnAddArgs *args;
-    Int a, b;
+    MmType_Param *payload;
+    MxServer_Compute *compute;
+    Int32 result = 0;
 
-    args = (FxnAddArgs *)data;
-    a = args->a;
-    b = args->b;
+    payload = (MmType_Param *)data;
+    compute = (MxServer_Compute *)payload[0].data;
 
 #if CHATTER
-    System_printf("fxnAdd: a=%d, b=%d\n", a, b);
+    System_printf("skel_compute: compute=0x%x\n", compute);
+    System_printf("skel_compute: compute size=%d\n", (Int)payload[0].size);
+    System_printf("skel_compute: coef=0x%x\n", compute->coef);
+    System_printf("skel_compute: key=0x%x\n", compute->key);
+    System_printf("skel_compute: size=0x%x\n", compute->size);
+    System_printf("skel_compute: inBuf=0x%x\n", compute->inBuf);
+    System_printf("skel_compute: outBuf=0x%x\n", compute->outBuf);
 #endif
 
-    return(a + b);
+    Cache_inv(compute->inBuf, compute->size * sizeof(uint32_t),
+            Cache_Type_ALL, TRUE);
+    Cache_inv(compute->outBuf, compute->size * sizeof(uint32_t),
+            Cache_Type_ALL, TRUE);
+
+    /* invoke the implementation function */
+    result = MxServer_compute(compute);
+
+    Cache_wbInv(compute->outBuf, compute->size * sizeof(uint32_t),
+            Cache_Type_ALL, TRUE);
+
+    return(result);
 }
 
-Void start_rpc_task()
+/*
+ *  ======== register_MxServer ========
+ *
+ *  Bootstrap function, must be configured in BIOS.addUserStartupFunctions.
+ */
+void register_MxServer(void)
 {
-    /* Init service manager */
-    System_printf("%s initializing OMAPRPC based service manager endpoint\n",
-                    MultiProc_getName(MultiProc_self()));
+    Int status = MmServiceMgr_S_SUCCESS;
+
+    System_printf("register_MxServer: -->\n");
+
+    /* must initialize these modules before using them */
+    RcmServer_init();
+    MmServiceMgr_init();
+
+    /* setup the server create params */
+    RcmServer_Params_init(&rpc_Params);
+    rpc_Params.priority = Thread_Priority_ABOVE_NORMAL;
+    rpc_Params.stackSize = 0x1000;
+    rpc_Params.fxns.length = rpc_fxnTab.length;
+    rpc_Params.fxns.elem = rpc_fxnTab.elem;
+
+    /* register an example service */
+    status = MmServiceMgr_register(SERVICE_NAME, &rpc_Params, &rpc_fxnSigTab,
+            RPC_SKEL_SrvDelNotification);
+
+    if (status < 0) {
+        System_printf("register_MxServer: MmServiceMgr_register failed, "
+                "status=%d\n", status);
+        status = -1;
+        goto leave;
+    }
 
-    OmapRpc_createChannel("rpc_example", MultiProc_getId("HOST"),
-                          RPC_MGR_PORT, RPC_SVR_NUM_FXNS, RPCServerFxns,
-                          (OmapRpc_SrvDelNotifyFxn)RPC_SKEL_SrvDelNotification);
+leave:
+    System_printf("register_MxServer: <--, status=%d\n", status);
 }
index 9352f3ca56fc43902cca9b798b7046ddb53c43f9..411e1f6c2709e2e7cfe52719b93e51bddf2e17b0 100644 (file)
@@ -34,7 +34,7 @@
 xdc.loadPackage('ti.ipc.ipcmgr');
 var BIOS        = xdc.useModule('ti.sysbios.BIOS');
 BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
-BIOS.addUserStartupFunction('&start_rpc_task');
+BIOS.addUserStartupFunction('&register_MxServer');
 
 var Task = xdc.useModule('ti.sysbios.knl.Task');
 Task.defaultStackSize = 0x2000;
@@ -54,3 +54,5 @@ xdc.includeFile("ti/configs/omap54xx/IpuAmmu.cfg");
 
 var Task = xdc.useModule('ti.sysbios.knl.Task');
 Task.defaultStackSize = 12 * 0x400;
+
+xdc.loadPackage('ti.ipc.mm');
index d07ff3705932f353178cc1e57a1bdf0db7c39ec9..80fd114738de338dd469064de9e78f5af277466c 100644 (file)
@@ -166,7 +166,7 @@ Bool ServiceMgr_registerSrvTask(UInt16 reserved, Task_FuncPtr func,
     return (found);
 }
 
-Bool ServiceMgr_register(String name, RcmServer_Params  *rcmServerParams)
+Bool ServiceMgr_register(String name, RcmServer_Params *rcmServerParams)
 {
     UInt              i;
     Bool              found = FALSE;
index b646b204c4004fad05022d8745faf3f997a18781..4b2ff3f079f89eb0253ff28174341ccba475b87b 100644 (file)
@@ -131,7 +131,7 @@ UInt ServiceMgr_start(UInt16 reserved);
  *
  *  @sa RcmServer_create
  */
-Bool ServiceMgr_register(String name, RcmServer_Params  *rcmServerParams);
+Bool ServiceMgr_register(String name, RcmServer_Params *rcmServerParams);
 
 /*
  *  ======== ServiceMgr_send ========
index 342c733e5d0c53af901cf6e9cb675f8949d9a968..d1fd00a78f9d96b7735828b6bcf3a3e0ac060cea 100644 (file)
@@ -46,6 +46,7 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include <ti/ipc/mm/MmType.h>
 #include <ti/ipc/rpmsg/MessageQCopy.h>
 #include <ti/ipc/rpmsg/NameMap.h>
 #include <ti/srvmgr/ServiceMgr.h>
@@ -67,7 +68,7 @@ typedef struct OmapRpc_Object {
     OmapRpc_FuncSignature  *funcSigs;
 } OmapRpc_Object;
 
-static Int32 OmapRpc_GetSvrMgrHandle(Void *srvc, Int32 num, Int32 *params)
+Int32 OmapRpc_GetSvrMgrHandle(Void *srvc, Int32 num, Int32 *params)
 {
     System_printf("OMAPRPC: Calling RCM Service Manager Create Function!\n");
     return 0;
@@ -245,32 +246,54 @@ static Void omapRpcTask(UArg arg0, UArg arg1)
     Semaphore_post(obj->exitSem);
 }
 
-OmapRpc_Handle OmapRpc_createChannel(String channelName,
-                                     UInt16 dstProc,
-                                     UInt32 port,
-                                     UInt32 numFuncs,
-                                     OmapRpc_FuncDeclaration *fxns,
-                                     OmapRpc_SrvDelNotifyFxn srvDelCBFunc)
+/*
+ *  ======== OmapRpc_createChannel ========
+ */
+#if 0
+OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
+        UInt32 port, UInt32 numFuncs, OmapRpc_FuncDeclaration *fxns,
+        OmapRpc_SrvDelNotifyFxn srvDelCBFunc)
+#else
+OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
+        UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
+        OmapRpc_SrvDelNotifyFxn srvDelCBFunc)
+#endif
 {
-    Task_Params          taskParams;
-    UInt32               func;
+    Task_Params taskParams;
+    UInt32      func;
 
     OmapRpc_Object *obj = Memory_alloc(NULL, sizeof(OmapRpc_Object), 0, NULL);
+
     if (obj == NULL) {
         System_printf("OMAPRPC: Failed to allocate memory for object!\n");
         goto unload;
     }
     _memset(obj, 0, sizeof(OmapRpc_Object));
-    obj->numFuncs = numFuncs+1;
+    obj->numFuncs = fxnSigTab->count + 1;
+#if 0
     RcmServer_Params_init(&obj->rcmParams);
     obj->rcmParams.priority = Thread_Priority_ABOVE_NORMAL;
     obj->rcmParams.stackSize = 0x1000;
     obj->rcmParams.fxns.length = obj->numFuncs;
-    obj->rcmParams.fxns.elem = Memory_alloc(NULL, sizeof(RcmServer_FxnDesc)*obj->numFuncs, 0, NULL);
+    obj->rcmParams.fxns.elem = Memory_alloc(NULL,
+            sizeof(RcmServer_FxnDesc) * obj->numFuncs, 0, NULL);
+
+    if (obj->rcmParams.fxns.elem == NULL) {
+        System_printf("OMAPRPC: Failed to allocate RCM function list!\n");
+        goto unload;
+    }
+#else
+    memcpy(&obj->rcmParams, rcmParams, sizeof(RcmServer_Params));
+    obj->rcmParams.fxns.length = obj->numFuncs;
+    obj->rcmParams.fxns.elem = Memory_calloc(NULL, obj->numFuncs *
+            sizeof(RcmServer_FxnDesc), 0, NULL);
+
     if (obj->rcmParams.fxns.elem == NULL) {
         System_printf("OMAPRPC: Failed to allocate RCM function list!\n");
         goto unload;
     }
+#endif
+
     // setup other variables...
     obj->shutdown = FALSE;
     obj->dstProc = dstProc;
@@ -278,67 +301,84 @@ OmapRpc_Handle OmapRpc_createChannel(String channelName,
     strncpy(obj->channelName, channelName, OMAPRPC_MAX_CHANNEL_NAMELEN-1);
     obj->channelName[OMAPRPC_MAX_CHANNEL_NAMELEN-1]='\0';
     obj->srvDelCB = srvDelCBFunc;
-    obj->funcSigs = Memory_alloc(NULL, sizeof(OmapRpc_FuncSignature)*obj->numFuncs, 0, NULL);
+    obj->funcSigs = Memory_alloc(NULL, obj->numFuncs *
+            sizeof(OmapRpc_FuncSignature), 0, NULL);
+
     if (obj->funcSigs == NULL) {
         System_printf("OMAPRPC: Failed to allocate signtures list!\n");
         goto unload;
     }
-    // setup the RCM functions and Signatures
-    for (func = 0; func < obj->numFuncs; func++)
-    {
-        if (func == 0)
-        {
+
+    /* setup the RCM functions and Signatures */
+    for (func = 0; func < obj->numFuncs; func++) {
+        if (func == 0) {
             // assign the "first function"
-            obj->rcmParams.fxns.elem[func].name = OmapRpc_Stringerize(OmapRpc_GetSvrMgrHandle);
-            obj->rcmParams.fxns.elem[func].addr.createFxn = (RcmServer_MsgCreateFxn)OmapRpc_GetSvrMgrHandle;
+            obj->rcmParams.fxns.elem[func].name =
+                    OmapRpc_Stringerize(OmapRpc_GetSvrMgrHandle);
+            obj->rcmParams.fxns.elem[func].addr.createFxn =
+                    (RcmServer_MsgCreateFxn)OmapRpc_GetSvrMgrHandle;
 
-            strncpy(obj->funcSigs[func].name,
-                    obj->rcmParams.fxns.elem[0].name,
+            strncpy(obj->funcSigs[func].name, obj->rcmParams.fxns.elem[0].name,
                     OMAPRPC_MAX_CHANNEL_NAMELEN);
             obj->funcSigs[func].numParam = 0;
         }
-        else
-        {
+        else {
             // assign the other functions
-            obj->rcmParams.fxns.elem[func].name = fxns[func-1].signature.name;
-            obj->rcmParams.fxns.elem[func].addr.fxn = (RcmServer_MsgFxn)fxns[func-1].function;
+//          obj->rcmParams.fxns.elem[func].name = fxns[func-1].signature.name;
+            obj->rcmParams.fxns.elem[func].name =
+                    rcmParams->fxns.elem[func-1].name;
+//          obj->rcmParams.fxns.elem[func].addr.fxn =
+//                  (RcmServer_MsgFxn)fxns[func-1].function;
+            obj->rcmParams.fxns.elem[func].addr.fxn =
+                    rcmParams->fxns.elem[func-1].addr.fxn;
 
             // copy the signature
-            memcpy(&obj->funcSigs[func],
-                   &fxns[func-1].signature,
-                   sizeof(OmapRpc_FuncSignature));
+//          memcpy(&obj->funcSigs[func], &fxns[func-1].signature,
+//                  sizeof(OmapRpc_FuncSignature));
+            memcpy(&obj->funcSigs[func], &fxnSigTab->table[func - 1],
+                    sizeof(MmType_FxnSig));
         }
     }
 
     ServiceMgr_init();
+
     if (ServiceMgr_register(channelName, &obj->rcmParams) == TRUE) {
         System_printf("OMAPRPC: registered channel: %s\n", obj->channelName);
+
         obj->msgq = MessageQCopy_create(obj->port, NULL, NULL,&obj->localEndPt);
+
         if (obj->msgq == NULL) {
             goto unload;
         }
+
         Task_Params_init(&taskParams);
         taskParams.instance->name = channelName;
         taskParams.priority = 1;   /* Lowest priority thread */
         taskParams.arg0 = (UArg)obj;
+
         obj->exitSem = Semaphore_create(0, NULL, NULL);
+
         if (obj->exitSem == NULL) {
             goto unload;
         }
+
         obj->taskHandle = Task_create(omapRpcTask, &taskParams, NULL);
+
         if (obj->taskHandle == NULL) {
             goto unload;
         }
     }
     else {
         System_printf("OMAPRPC: FAILED to register channel: %s\n",
-                                                            obj->channelName);
+                obj->channelName);
     }
+
     System_printf("OMAPRPC: Returning Object %p\n", obj);
-    return obj;
+    return(obj);
+
 unload:
     OmapRpc_deleteChannel(obj);
-    return NULL;
+    return(NULL);
 }
 
 Int OmapRpc_deleteChannel(OmapRpc_Handle handle)
@@ -371,3 +411,90 @@ Int OmapRpc_deleteChannel(OmapRpc_Handle handle)
     Memory_free(NULL, obj, sizeof(*obj));
     return OmapRpc_S_SUCCESS;
 }
+
+#if 0
+/*
+ *  ======== OmapRpc_start ========
+ */
+Int OmapRpc_start(const String name, Int port, Int aryLen,
+        OmapRpc_FuncSignature *sigAry)
+{
+    Int status = OmapRpc_S_SUCCESS;
+    Task_Params taskParams;
+    OmapRpc_Object *obj;
+
+    /* create an instance */
+    obj = Memory_calloc(NULL, sizeof(OmapRpc_Object), 0, NULL);
+
+    if (obj == NULL) {
+        System_printf("OMAPRPC: Failed to allocate memory for object!\n");
+        status = OmapRpc_E_FAIL;
+        goto leave;
+    }
+
+    obj->numFuncs = aryLen + 1;
+    obj->shutdown = FALSE;
+    obj->dstProc = MultiProc_getId("HOST");
+    obj->port = port;
+    strncpy(obj->channelName, name, OMAPRPC_MAX_CHANNEL_NAMELEN-1);
+    obj->channelName[OMAPRPC_MAX_CHANNEL_NAMELEN-1]='\0';
+    obj->srvDelCB = srvDelCBFunc;
+    obj->funcSigs = Memory_alloc(NULL,
+            sizeof(OmapRpc_FuncSignature) * obj->numFuncs, 0, NULL);
+
+    if (obj->funcSigs == NULL) {
+        System_printf("OMAPRPC: Failed to allocate signtures list!\n");
+        goto unload;
+    }
+
+    /* setup the functions and signatures */
+    for (func = 0; func < obj->numFuncs; func++) {
+        if (func == 0) {
+            // assign the "first function"
+//          strncpy(obj->funcSigs[func].name, obj->rcmParams.fxns.elem[0].name,
+//                  OMAPRPC_MAX_CHANNEL_NAMELEN);
+            strncpy(obj->funcSigs[func].name,
+                    OmapRpc_Stringerize(OmapRpc_GetSvrMgrHandle),
+                    OMAPRPC_MAX_CHANNEL_NAMELEN);
+            obj->funcSigs[func].numParam = 0;
+        }
+        else {
+            // copy the signature
+            memcpy(&obj->funcSigs[func], &fxns[func-1].signature,
+                    sizeof(OmapRpc_FuncSignature));
+        }
+    }
+
+    obj->msgq = MessageQCopy_create(obj->port, NULL, NULL,&obj->localEndPt);
+
+    if (obj->msgq == NULL) {
+        goto unload;
+    }
+
+    Task_Params_init(&taskParams);
+    taskParams.instance->name = channelName;
+    taskParams.priority = 1;   /* Lowest priority thread */
+    taskParams.arg0 = (UArg)obj;
+
+    obj->exitSem = Semaphore_create(0, NULL, NULL);
+
+    if (obj->exitSem == NULL) {
+        goto unload;
+    }
+
+    obj->taskHandle = Task_create(omapRpcTask, &taskParams, NULL);
+
+    if (obj->taskHandle == NULL) {
+        goto unload;
+    }
+
+    System_printf("OMAPRPC: Returning Object %p\n", obj);
+    return(obj);
+
+leave:
+    if (status < 0) {
+        OmapRpc_deleteChannel(obj);
+    }
+    return(status);
+}
+#endif
index 415c2fd79cee3d79ab318cb0bc36d5018fa5129c..b5b241d56a1d078ed26a0a200c126c7c9e393ca6 100644 (file)
@@ -40,6 +40,7 @@
 #define ti_srvmgr_OmapRpc__include
 
 #include <ti/grcm/RcmServer.h>
+#include <ti/ipc/mm/MmType.h>
 
 
 #if defined (__cplusplus)
@@ -274,12 +275,15 @@ typedef struct OmapRpc_FuncDeclaration {
 typedef struct OmapRpc_Object *OmapRpc_Handle;
 typedef Void (*OmapRpc_SrvDelNotifyFxn)(Void);
 
-OmapRpc_Handle OmapRpc_createChannel(String channelName,
-                                     UInt16 dstProc,
-                                     UInt32 port,
-                                     UInt32 numFuncs,
-                                     OmapRpc_FuncDeclaration* fxns,
-                                     OmapRpc_SrvDelNotifyFxn func);
+#if 0
+OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
+        UInt32 port, UInt32 numFuncs, OmapRpc_FuncDeclaration* fxns,
+        OmapRpc_SrvDelNotifyFxn func);
+#else
+OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
+        UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
+        OmapRpc_SrvDelNotifyFxn srvDelCBFunc);
+#endif
 
 Int OmapRpc_deleteChannel(OmapRpc_Handle handle);
 
index 3e330d5cfb390be837129ec16c5b88aedd8b54c7..5e74c17dbc841b744bfdf830e926e64cdfaa2bf5 100644 (file)
@@ -40,7 +40,8 @@ DEPOT = _your_depot_folder_
 # Set up required cross compiler path for IPC Linux configuration and build
 TOOLCHAIN_LONGNAME ?=arm-none-linux-gnueabi
 TOOLCHAIN_INSTALL_DIR ?= $(DEPOT)/_your_arm_code_gen_install_
-TOOLCHAIN_PREFIX= $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+KERNEL_INSTALL_DIR =
 
 # Linux platform to build (optional)
 # Run './configure --help' for available PLATFORM options
diff --git a/qnx/.gitignore b/qnx/.gitignore
new file mode 100644 (file)
index 0000000..000d33e
--- /dev/null
@@ -0,0 +1,13 @@
+*.map
+*.o
+*.so
+*.a
+*.pinfo
+src/tests/MessageQApp/arm/o.g.le.v7/MessageQApp_g
+src/tests/MessageQApp/arm/o.le.v7/MessageQApp
+src/tests/MessageQBench/arm/o.g.le.v7/MessageQBench_g
+src/tests/MessageQBench/arm/o.le.v7/MessageQBench
+src/tests/MessageQMulti/arm/o.g.le.v7/MessageQMulti_g
+src/tests/MessageQMulti/arm/o.le.v7/MessageQMulti
+src/tests/NameServerApp/arm/o.g.le.v7/NameServerApp_g
+src/tests/NameServerApp/arm/o.le.v7/NameServerApp
index 6c05e801af61901f7d127c22605873ce94efdb4e..1c7682921d08adcdc7d68591ce827c4242dd5c5d 100644 (file)
@@ -44,8 +44,8 @@
  *
  */
 
-#define SH_MEM_BLOCK1_START 0x9EB00000
-#define SH_MEM_BLOCK1_SIZE  0x1000000
+#define SH_MEM_BLOCK1_START 0xBA300000
+#define SH_MEM_BLOCK1_SIZE  0x5A00000
 
 #define SH_MEM_BLOCK2_START 0x9DB00000
 #define SH_MEM_BLOCK2_SIZE  0x1000000
index 3ff42eb5491606c58c813472def4275bd6bffad0..9af6aa2ee05c8f22815f5db54bce3be440f6156c 100644 (file)
@@ -236,19 +236,15 @@ extern unsigned int syslink_dsp_mem_size;
 
 #define MAX_SIZE_OVERRIDE_PARAMS 500
 
-Char Syslink_Override_Params[MAX_SIZE_OVERRIDE_PARAMS];
-/*
+/*Char Syslink_Override_Params[MAX_SIZE_OVERRIDE_PARAMS];*/
+
 String Syslink_Override_Params = "ProcMgr.proc[CORE0].mmuEnable=TRUE;"
-                                 "ProcMgr.proc[CORE0].carveoutAddr0=0x95800000;"
-                                 "ProcMgr.proc[CORE0].carveoutSize0=0xA400000;"
-                                 "ProcMgr.proc[CORE0].carveoutAddr1=0xBA300000;"
-                                 "ProcMgr.proc[CORE0].carveoutSize1=0x5A00000;"
+                                 "ProcMgr.proc[CORE0].carveoutAddr0=0xBA300000;"
+                                 "ProcMgr.proc[CORE0].carveoutSize0=0x5A00000;"
                                  "ProcMgr.proc[DSP].mmuEnable=TRUE;"
-                                 "ProcMgr.proc[DSP].carveoutAddr0=0x95000000;"
-                                 "ProcMgr.proc[DSP].carveoutSize0=0x700000;"
-                                 "ProcMgr.proc[DSP].carveoutAddr1=0xBA300000;"
-                                 "ProcMgr.proc[DSP].carveoutSize1=0x5A00000";
-*/
+                                 "ProcMgr.proc[DSP].carveoutAddr0=0xBA300000;"
+                                 "ProcMgr.proc[DSP].carveoutSize0=0x5A00000;";
+
 
 /** ============================================================================
  *  APIs.
@@ -318,7 +314,7 @@ Int32
 Platform_overrideConfig (Platform_Config * config, Ipc_Config * cfg)
 {
     Int32  status = Platform_S_SUCCESS;
-    Char   hexString[16];
+    /*Char   hexString[16];*/
 
     GT_1trace (curTrace, GT_ENTER, "Platform_overrideConfig", config);
 
@@ -338,7 +334,7 @@ Platform_overrideConfig (Platform_Config * config, Ipc_Config * cfg)
     }
     else {
 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
-
+/*
         String_cpy(Syslink_Override_Params,
                    "ProcMgr.proc[CORE0].mmuEnable=TRUE;");
         String_hexToStr(hexString, cfg->pAddr);
@@ -363,6 +359,7 @@ Platform_overrideConfig (Platform_Config * config, Ipc_Config * cfg)
                    "ProcMgr.proc[DSP].carveoutSize0=");
         String_cat(Syslink_Override_Params, hexString);
         String_cat(Syslink_Override_Params, ";");
+*/
         cfg->params = Memory_alloc(NULL,
                                    String_len(Syslink_Override_Params) + 1, 0,
                                    NULL);
index 74ec0a5c275750e19aa727604202f97c79537915..71636ff16e60e7afd2f8d01d3e5d8fc7773ad533 100644 (file)
@@ -66,7 +66,6 @@
 #include <devctl.h>
 
 /* Module headers */
-//#include <ti/ipc/omap_rpc.h>
 #include <ti/ipc/rpmsg_rpc.h>
 #include <ti/ipc/MessageQCopy.h>
 #include <_MessageQCopy.h>
@@ -204,12 +203,26 @@ typedef struct rpmsg_rpc_EventCbck_tag {
     /*!< Process Identifier for user process. */
 } rpmsg_rpc_EventCbck ;
 
+/*!
+ *  @brief  Structure of Fxn Info for reverse translations.
+ */
+typedef struct rpmsg_rpc_FxnInfo_tag {
+    List_Elem              element;
+    /*!< List element header */
+    UInt16                 msgId;
+    /*!< Unique msgId of the rpc fxn call */
+    struct rppc_function   func;
+    /*!< rpc function information. */
+} rpmsg_rpc_FxnInfo ;
+
 /*!
  *  @brief  Keeps the information related to Event.
  */
 typedef struct rpmsg_rpc_EventState_tag {
     List_Handle            bufList;
     /*!< Head of received event list. */
+    List_Handle            fxnList;
+    /*!< Head of received msg list. */
     UInt32                 pid;
     /*!< User process ID. */
     rpmsg_rpc_object *     rpc;
@@ -342,6 +355,13 @@ static void put_uBuf(rpmsg_rpc_EventPacket * uBuf)
     return;
 }
 
+/** ============================================================================
+ *  Function Prototypes
+ *  ============================================================================
+ */
+int
+_rpmsg_rpc_translate (ProcMgr_Handle handle, char *data, pid_t pid,
+                      bool reverse);
 
 /** ============================================================================
  *  Globals
@@ -365,6 +385,8 @@ static rpmsg_rpc_ModuleObject rpmsg_rpc_state =
     .run  = 0
 };
 
+static uint16_t msg_id = 0xFFFF;
+
 extern dispatch_t * syslink_dpp;
 
 
@@ -811,6 +833,7 @@ _rpmsg_rpc_attach (rpmsg_rpc_object * rpc)
     Bool                 flag     = FALSE;
     Bool                 isInit   = FALSE;
     List_Object *        bufList  = NULL;
+    List_Object *        fxnList  = NULL;
     IArg                 key      = 0;
     List_Params          listparams;
     UInt32               i;
@@ -830,12 +853,14 @@ _rpmsg_rpc_attach (rpmsg_rpc_object * rpc)
     if (isInit == FALSE) {
         List_Params_init (&listparams);
         bufList = List_create (&listparams) ;
+        fxnList = List_create (&listparams) ;
         /* Search for an available slot for user process. */
         for (i = 0 ; i < MAX_PROCESSES ; i++) {
             if (rpmsg_rpc_state.eventState [i].rpc == NULL) {
                 rpmsg_rpc_state.eventState [i].rpc = rpc;
                 rpmsg_rpc_state.eventState [i].refCount = 1;
                 rpmsg_rpc_state.eventState [i].bufList = bufList;
+                rpmsg_rpc_state.eventState [i].fxnList = fxnList;
                 flag = TRUE;
                 break;
             }
@@ -858,11 +883,14 @@ _rpmsg_rpc_attach (rpmsg_rpc_object * rpc)
             if (bufList != NULL) {
                 List_delete (&bufList);
             }
+            if (fxnList != NULL) {
+                List_delete (&fxnList);
+            }
         }
     }
     IGateProvider_leave (rpmsg_rpc_state.gateHandle, key);
 
-    GT_1trace (curTrace, GT_LEAVE, "rpmsgDrv_attach", status);
+    GT_1trace (curTrace, GT_LEAVE, "_rpmsg_rpc_attach", status);
 
     /*! @retval Notify_S_SUCCESS Operation successfully completed. */
     return status ;
@@ -884,6 +912,7 @@ Int
 _rpmsg_rpc_addBufByPid (rpmsg_rpc_object *rpc,
                         UInt32             src,
                         UInt32             pid,
+                        UInt16             msgId,
                         void *             data,
                         UInt32             len)
 {
@@ -894,6 +923,8 @@ _rpmsg_rpc_addBufByPid (rpmsg_rpc_object *rpc,
     UInt32                  i;
     WaitingReaders_t *item;
     MsgList_t *msgItem;
+    List_Elem * elem = NULL;
+    List_Elem * temp = NULL;
 
     GT_5trace (curTrace,
                GT_ENTER,
@@ -949,6 +980,23 @@ _rpmsg_rpc_addBufByPid (rpmsg_rpc_object *rpc,
         }
         else {
 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
+            key = IGateProvider_enter (rpmsg_rpc_state.gateHandle);
+            List_traverse_safe(elem, temp, rpmsg_rpc_state.eventState [i].fxnList) {
+                if (((rpmsg_rpc_FxnInfo *)elem)->msgId == msgId) {
+                    List_remove(rpmsg_rpc_state.eventState [i].fxnList, elem);
+                    break;
+                }
+            }
+            IGateProvider_leave (rpmsg_rpc_state.gateHandle, key);
+
+            if (elem != (List_Elem *)rpmsg_rpc_state.eventState [i].fxnList) {
+                struct rppc_function * function;
+                function = &(((rpmsg_rpc_FxnInfo *)elem)->func);
+                _rpmsg_rpc_translate(NULL, (char *)function, pid, true);
+                Memory_free(NULL, elem, sizeof(rpmsg_rpc_FxnInfo) +\
+                            RPPC_TRANS_SIZE(function->num_translations));
+            }
+
             List_elemClear (&(uBuf->element));
             GT_assert (curTrace,
                        (rpmsg_rpc_state.eventState [i].bufList != NULL));
@@ -1112,6 +1160,7 @@ _rpmsg_rpc_cb (MessageQCopy_Handle handle, void * data, int len, void * priv,
             _rpmsg_rpc_addBufByPid (rpc,
                                     src,
                                     rpc->pid,
+                                    packet->msg_id,
                                     &packet->fxn_id,
                                     sizeof(packet->fxn_id) + sizeof(packet->result));
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
@@ -1242,6 +1291,7 @@ _rpmsg_rpc_detach (rpmsg_rpc_object * rpc)
     Int32                tmpStatus = EOK;
     Bool                 flag      = FALSE;
     List_Object *        bufList   = NULL;
+    List_Object *        fxnList   = NULL;
     UInt32               i;
     IArg                 key;
     MsgList_t          * item;
@@ -1279,6 +1329,11 @@ _rpmsg_rpc_detach (rpmsg_rpc_object * rpc)
 
         rpmsg_rpc_state.eventState [i].bufList = NULL;
 
+        /* Store in local variable to delete outside lock. */
+        fxnList = rpmsg_rpc_state.eventState [i].fxnList;
+
+        rpmsg_rpc_state.eventState [i].fxnList = NULL;
+
         IGateProvider_leave (rpmsg_rpc_state.gateHandle, key);
     }
 
@@ -1335,6 +1390,16 @@ _rpmsg_rpc_detach (rpmsg_rpc_object * rpc)
             /* Last client being unregistered with Notify module. */
             List_delete (&bufList);
         }
+        if (fxnList != NULL) {
+            key = IGateProvider_enter (rpmsg_rpc_state.gateHandle);
+            rpmsg_rpc_FxnInfo * fxnInfo = NULL;
+            while ((fxnInfo = (rpmsg_rpc_FxnInfo *)List_dequeue (fxnList))) {
+                Memory_free (NULL, fxnInfo, sizeof(rpmsg_rpc_FxnInfo) +\
+                             RPPC_TRANS_SIZE(fxnInfo->func.num_translations));
+            }
+            IGateProvider_leave (rpmsg_rpc_state.gateHandle, key);
+            List_delete (&fxnList);
+        }
 
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
         if ((tmpStatus < 0) && (status >= 0)) {
@@ -1610,7 +1675,7 @@ _rpmsg_rpc_pa2da(ProcMgr_Handle handle, uint32_t pa)
 }
 
 int
-_rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, uint32_t bytes, pid_t pid)
+_rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, pid_t pid, bool reverse)
 {
     int status = EOK;
     struct rppc_function * function = NULL;
@@ -1623,6 +1688,7 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, uint32_t bytes, pid_t pi
     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);
@@ -1635,7 +1701,8 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, uint32_t bytes, pid_t pi
             status = -EINVAL;
             break;
         }
-        if (translation[i].offset + sizeof(uint32_t) > function->params[idx].size) {
+        param_offset = function->params[idx].data - function->params[idx].base;
+        if (translation[i].offset - param_offset + sizeof(uint32_t) > function->params[idx].size) {
             status = -EINVAL;
             break;
         }
@@ -1661,27 +1728,34 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, uint32_t bytes, pid_t pi
             }
         }
         /* Get physical address of the contents */
-        ptr = (uint32_t)vptr[idx] + translation[i].offset;
-        status = mem_offset64_peer(pid, *(uint32_t *)ptr, sizeof(uint32_t),
-                                   &phys_addr, &phys_len);
-        if (status >= 0 && phys_len == sizeof(uint32_t)) {
-            /* translate pa2da */
-            if ((ipu_addr =
-                    _rpmsg_rpc_pa2da(handle, (uint32_t)phys_addr)) != 0)
-                /* update vptr contents */
-                *(uint32_t *)ptr = ipu_addr;
+        ptr = (uint32_t)vptr[idx] + translation[i].offset - param_offset;
+        if (reverse) {
+            *(uint32_t *)ptr = translation[i].base;
+        }
+        else {
+            translation[i].base = *(uint32_t *)ptr;
+            status = mem_offset64_peer(pid, *(uint32_t *)ptr, sizeof(uint32_t),
+                                       &phys_addr, &phys_len);
+            if (status >= 0 && phys_len == sizeof(uint32_t)) {
+                /* translate pa2da */
+                if ((ipu_addr =
+                        _rpmsg_rpc_pa2da(handle, (uint32_t)phys_addr)) != 0)
+                    /* update vptr contents */
+                    *(uint32_t *)ptr = ipu_addr;
+                else {
+                    status = -EINVAL;
+                    break;
+                }
+            }
             else {
                 status = -EINVAL;
                 break;
             }
         }
-        else {
-            status = -EINVAL;
-            break;
-        }
     }
 
-    for (i = 0; i < function->num_params && status >= 0; i++) {
+    /* No need to do this for reverse translations */
+    for (i = 0; i < function->num_params && status >= 0 && !reverse; i++) {
         if (function->params[i].type == RPPC_PARAM_TYPE_PTR) {
             if (paddr[i]) {
                 phys_addr = paddr[i];
@@ -1690,7 +1764,8 @@ _rpmsg_rpc_translate(ProcMgr_Handle handle, char *data, uint32_t bytes, pid_t pi
                 /* translate the param pointer */
                 status = mem_offset64_peer(pid,
                                            (uintptr_t)(function->params[i].data),
-                                           function->params[i].size, &phys_addr, &phys_len);
+                                           function->params[i].size, &phys_addr,
+                                           &phys_len);
             }
             if (status >= 0) {
                 if ((ipu_addr =
@@ -1748,6 +1823,9 @@ rpmsg_rpc_write(resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *io_ocb)
     struct rppc_function *function = NULL;
     char usr_msg[MessageQCopy_BUFSIZE];
     int i = 0;
+    rpmsg_rpc_EventState * event_state = NULL;
+    rpmsg_rpc_FxnInfo * fxn_info = NULL;
+    IArg key = 0;
 
     if ((status = iofunc_write_verify(ctp, msg, io_ocb, NULL)) != EOK) {
         return (status);
@@ -1760,6 +1838,16 @@ rpmsg_rpc_write(resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *io_ocb)
     }
     _IO_SET_WRITE_NBYTES (ctp, bytes);
 
+    for (i = 0 ; i < MAX_PROCESSES ; i++) {
+        if (rpmsg_rpc_state.eventState [i].rpc == rpc) {
+            break;
+        }
+    }
+    if (i == MAX_PROCESSES) {
+        return EINVAL;
+    }
+    event_state = &rpmsg_rpc_state.eventState[i];
+
     msg_hdr = (struct rppc_msg_header *)buf;
     packet = (struct rppc_packet *)((UInt32)msg_hdr + sizeof(struct rppc_msg_header));
 
@@ -1772,9 +1860,7 @@ rpmsg_rpc_write(resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *io_ocb)
     }
     function = (struct rppc_function *)usr_msg;
 
-    if (bytes < sizeof(struct rppc_function) +
-        (function->num_translations * \
-         sizeof(struct rppc_param_translation))) {
+    if (bytes < RPPC_PARAM_SIZE(function->num_translations)) {
          return (EINVAL);
     }
 
@@ -1783,9 +1869,19 @@ rpmsg_rpc_write(resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *io_ocb)
         return (EINVAL);
     }
 
-    status = _rpmsg_rpc_translate(rpc->conn->procH, (char *)function, bytes,
-                                  ctp->info.pid);
+    /* store the fxn info for use with reverse translation */
+    fxn_info = Memory_alloc (NULL, sizeof(rpmsg_rpc_FxnInfo) +\
+                             RPPC_TRANS_SIZE(function->num_translations),
+                             0, NULL);
+    List_elemClear(&(fxn_info->element));
+    Memory_copy (&(fxn_info->func), function,
+                 RPPC_PARAM_SIZE(function->num_translations));
+
+    status = _rpmsg_rpc_translate(rpc->conn->procH, (char *)function,
+                                  ctp->info.pid, false);
     if (status < 0) {
+        Memory_free(NULL, fxn_info, sizeof(rpmsg_rpc_FxnInfo) +\
+                    RPPC_TRANS_SIZE(function->num_translations));
         return -status;
     }
 
@@ -1794,7 +1890,7 @@ rpmsg_rpc_write(resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *io_ocb)
 
     /* initialize the packet structure */
     packet->desc = RPPC_DESC_EXEC_SYNC;
-    packet->msg_id = 0;
+    packet->msg_id = msg_id == 0xFFFF ? msg_id = 1 : ++(msg_id);
     packet->flags = (0x8000);//OMAPRPC_POOLID_DEFAULT;
     packet->fxn_id = RPPC_SET_FXN_IDX(function->fxn_id);
     packet->result = 0;
@@ -1807,10 +1903,21 @@ rpmsg_rpc_write(resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *io_ocb)
     }
     msg_hdr->msg_len += packet->data_size;
 
+    fxn_info->msgId = packet->msg_id;
+    key = IGateProvider_enter (rpmsg_rpc_state.gateHandle);
+    List_enqueue(event_state->fxnList, &(fxn_info->element));
+    IGateProvider_leave (rpmsg_rpc_state.gateHandle, key);
+
     status = MessageQCopy_send(rpc->conn->procId, MultiProc_self(),
-                               rpc->remoteAddr, rpc->addr, buf,
-                               msg_hdr->msg_len + sizeof(struct rppc_msg_header), TRUE);
+                              rpc->remoteAddr, rpc->addr, buf,
+                              msg_hdr->msg_len + sizeof(struct rppc_msg_header),
+                              TRUE);
     if (status < 0) {
+        key = IGateProvider_enter (rpmsg_rpc_state.gateHandle);
+        List_remove(event_state->fxnList, &(fxn_info->element));
+        IGateProvider_leave (rpmsg_rpc_state.gateHandle, key);
+        Memory_free(NULL, fxn_info, sizeof(rpmsg_rpc_FxnInfo) +\
+                    RPPC_TRANS_SIZE(function->num_translations));
         return (EIO);
     }
 
index 12c1c952262df00e2676cf844f7e26dbc1f036f6..e7cc922b72da537ae0919dfed655379303f01d42 100644 (file)
@@ -56,6 +56,7 @@
 extern "C" {
 #endif
 
+#include <ti/ipc/rpmsg_rpc.h>
 
 /* =============================================================================
  *  Macros and types
@@ -112,6 +113,11 @@ struct rppc_channel_info {
     UInt32 num_funcs;      /**< The number of functions supported on this endpoint */
 };
 
+#define RPPC_TRANS_SIZE(num)   (sizeof(struct rppc_param_translation) * num)
+
+#define RPPC_PARAM_SIZE(num)   (sizeof(struct rppc_function) +\
+                                RPPC_TRANS_SIZE(num))
+
 /*!
  *  @brief  Max number of user processes supported
  */
index 58b8836a6123aebfdea5acf16d96c71ca1b9f58c..401797dc3f17b272a3a5503f6ed6674875da34bb 100644 (file)
@@ -46,15 +46,18 @@ SYSLINK_ROOT = $(PROJECT_ROOT)/../../../../../..
 SYSLINK_BUILDOS = Qnx
 
 #Add extra include path
-EXTRA_INCVPATH+=$(SYSLINK_ROOT)        \
-                               $(SYSLINK_ROOT)/ti/syslink/inc  \
-                               $(SYSLINK_ROOT)/ti/syslink/inc/usr/$(SYSLINK_BUILDOS)   \
-                               $(SYSLINK_ROOT)/ti/syslink/inc/usr      \
-                               $(SYSLINK_ROOT)/ti/syslink/inc/$(SYSLINK_BUILDOS)
-
-EXTRA_SRCVPATH+=$(PROJECT_ROOT)/$(SYSLINK_BUILDOS)     \
-                               $(PROJECT_ROOT)/..
-
-CCOPTS+=-g -O0 -DSYSLINK_BUILDOS_QNX
+EXTRA_INCVPATH += $(SYSLINK_ROOT) \
+        $(SYSLINK_ROOT)/ti/syslink/inc \
+        $(SYSLINK_ROOT)/ti/syslink/inc/usr/$(SYSLINK_BUILDOS) \
+        $(SYSLINK_ROOT)/ti/syslink/inc/usr \
+        $(SYSLINK_ROOT)/ti/syslink/inc/$(SYSLINK_BUILDOS) \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
+
+EXTRA_SRCVPATH += \
+        $(PROJECT_ROOT)/$(SYSLINK_BUILDOS) \
+        $(PROJECT_ROOT)/..
+
+CCOPTS += -g -O0 -DSYSLINK_BUILDOS_QNX
 
 include $(MKFILES_ROOT)/qtargets.mk
index 0fad850a334f8cfc3692854dd84b378cb7201fd5..f1f7df4ee8e49c9e905b5091430fd652e5b5ce95 100644 (file)
@@ -1,7 +1,7 @@
 rpmsg-rpc Stress Test
 
 Syntax:
-  rpmsg-rpc-stress -t <test_no> [-c <id>] [-x <num>] [-l <num>]
+  rpmsg-rpc-stress -t <test_no> [-c <id>] [-f <func_id>] [-x <num>] [-l <num>]
 
   Where:
     -t <test_no>    Test number to be run. Valid values are 1-3.
@@ -10,8 +10,12 @@ Syntax:
                     3: Run select test
     -c <id>         Core ID with which to communicate.
                     0: IPU CORE0 (default)
-                    1: IPU CORE1
+                    1: IPU CORE1 or IPU SMP
                     2: DSP
+    -f <func_id>    1: FxnTriple (default)
+                    2: FxnAdd
+                    3: FxnAdd3
+                    4: FxnAddX
     -x <num>        For tests 1 and 3, the number of RPMSGRPC ServiceMgr instances.
                     Default is 1.
     -l <num>        For test 2, the number of threads communicating with the
index abf41e9580786df03d25a84650342b991c0cff7b..23ca57baca4b0faa9deaecdc943c81043fab67e8 100644 (file)
 #include <time.h>
 #include <stdbool.h>
 #include <semaphore.h>
+#include <dlfcn.h>
 
 #include "ti/ipc/rpmsg_rpc.h"
+#include "ti/shmemallocator/SharedMemoryAllocatorUsr.h"
 
 
 typedef struct {
     int a;
-} fxn_triple_args;
+    int b;
+    int c;
+} fxn_add3_args;
+
+typedef struct {
+    int num;
+    int *array;
+} fxn_addx_args;
 
 /* Note: Set bit 31 to indicate static function indicies:
  * This function order will be hardcoded on BIOS side, hence preconfigured:
  */
-#define FXN_IDX_FXNTRIPLE            (1 | 0x80000000)
+enum {
+    FXN_IDX_FXNTRIPLE = 1,
+    FXN_IDX_FXNADD,
+    FXN_IDX_FXNADD3,
+    FXN_IDX_FXNADDX,
+    FXN_IDX_MAX
+};
 
 #define NUM_ITERATIONS               20
 
 static int test_status = 0;
 static bool runTest = true;
+static int testFunc = FXN_IDX_FXNTRIPLE;
 
 int exec_cmd(int fd, char *msg, size_t len, char *reply_msg, int *reply_len)
 {
@@ -127,6 +143,7 @@ typedef struct test_exec_args {
     int test_num;
     sem_t * sem;
     int thread_num;
+    int func_idx;
 } test_exec_args;
 
 static pthread_t * clientThreads = NULL;
@@ -135,6 +152,53 @@ static char **clientPackets = NULL;
 static bool *readMsg = NULL;
 static int *fds;
 
+void *sharedmemalloc_lib = NULL;
+int (*sharedmem_alloc)(int size, shm_buf *buf);
+int (*sharedmem_free)(shm_buf *buf);
+
+int deinit_sharedmem_funcs(void)
+{
+    int ret = 0;
+
+    if (sharedmemalloc_lib)
+        dlclose(sharedmemalloc_lib);
+    sharedmemalloc_lib = NULL;
+
+    return ret;
+}
+
+int init_sharedmem_funcs()
+{
+    int ret = 0;
+
+    if (sharedmemalloc_lib == NULL) {
+        sharedmemalloc_lib = dlopen("libsharedmemallocator.so",
+                                    RTLD_NOW | RTLD_GLOBAL);
+        if (sharedmemalloc_lib == NULL) {
+            perror("init_sharedmem_funcs: Error opening shared lib");
+            ret = -1;
+        }
+        else {
+            sharedmem_alloc = dlsym(sharedmemalloc_lib, "SHM_alloc");
+            if (sharedmem_alloc == NULL) {
+                perror("init_sharedmem_funcs: Error getting shared lib sym");
+                ret = -1;
+            }
+            else {
+                sharedmem_free = dlsym(sharedmemalloc_lib, "SHM_release");
+                if (sharedmem_free == NULL) {
+                    perror("init_sharedmem_funcs: Error getting shared lib sym");
+                    ret = -1;
+                }
+            }
+        }
+    }
+    if (ret < 0) {
+        deinit_sharedmem_funcs();
+    }
+    return ret;
+}
+
 void * test_exec_call(void * arg)
 {
     int               i;
@@ -146,15 +210,85 @@ void * test_exec_call(void * arg)
     int               fd = args->fd;
     struct rppc_function *function;
     struct rppc_function_return *returned;
+    shm_buf           buf, buf2;
+    void              *ptr = NULL, *ptr2 = NULL;
 
     for (i = args->start_num; i < args->start_num + NUM_ITERATIONS; i++) {
         function = (struct rppc_function *)packet_buf;
-        function->fxn_id = FXN_IDX_FXNTRIPLE;
-        function->num_params = 1;
-        function->params[0].type = RPPC_PARAM_TYPE_ATOMIC;
-        function->params[0].size = sizeof(int);
-        function->params[0].data = i;
-        function->num_translations = 0;
+        function->fxn_id = args->func_idx;
+        switch (function->fxn_id) {
+            case FXN_IDX_FXNTRIPLE:
+                function->num_params = 1;
+                function->params[0].type = RPPC_PARAM_TYPE_ATOMIC;
+                function->params[0].size = sizeof(int);
+                function->params[0].data = i;
+                function->num_translations = 0;
+                break;
+            case FXN_IDX_FXNADD:
+                function->num_params = 2;
+                function->params[0].type = RPPC_PARAM_TYPE_ATOMIC;
+                function->params[0].size = sizeof(int);
+                function->params[0].data = i;
+                function->params[1].type = RPPC_PARAM_TYPE_ATOMIC;
+                function->params[1].size = sizeof(int);
+                function->params[1].data = i+1;
+                function->num_translations = 0;
+                break;
+            case FXN_IDX_FXNADD3:
+                if (init_sharedmem_funcs() < 0)
+                    test_status = -1;
+                else {
+                    if ((*sharedmem_alloc)(sizeof(fxn_add3_args), &buf) < 0) {
+                        test_status = -1;
+                    }
+                    else {
+                        ptr = (fxn_add3_args *)(buf.vir_addr);
+                        ((fxn_add3_args *)ptr)->a = i;
+                        ((fxn_add3_args *)ptr)->b = i+1;
+                        ((fxn_add3_args *)ptr)->c = i+2;
+                        function->num_params = 1;
+                        function->params[0].type = RPPC_PARAM_TYPE_PTR;
+                        function->params[0].size = sizeof(fxn_add3_args);
+                        function->params[0].data = (size_t)ptr;
+                        function->params[0].base = (size_t)ptr;
+                        function->num_translations = 0;
+                    }
+                }
+                break;
+            case FXN_IDX_FXNADDX:
+                if (init_sharedmem_funcs() < 0)
+                    test_status = -1;
+                else {
+                    if ((*sharedmem_alloc)(sizeof(fxn_addx_args), &buf) < 0) {
+                        test_status = -1;
+                    }
+                    else if ((*sharedmem_alloc)(sizeof(int) * 3, &buf2) < 0) {
+                        test_status = -1;
+                    }
+                    else {
+                        ptr = (fxn_addx_args *)(buf.vir_addr);
+                        ptr2 = (int *)(buf2.vir_addr);
+                        ((fxn_addx_args *)ptr)->num = 3;
+                        ((fxn_addx_args *)ptr)->array = ptr2;
+                        ((int *)ptr2)[0] = i;
+                        ((int *)ptr2)[1] = i+1;
+                        ((int *)ptr2)[2] = i+2;
+                        function->num_params = 1;
+                        function->params[0].type = RPPC_PARAM_TYPE_PTR;
+                        function->params[0].size = sizeof(fxn_addx_args);
+                        function->params[0].data = (size_t)ptr;
+                        function->params[0].base = (size_t)ptr;
+                        function->num_translations = 1;
+                        function->translations[0].index = 0;
+                        function->translations[0].offset = (int)&(((fxn_addx_args *)ptr)->array) - (int)ptr;
+                        function->translations[0].base = ((fxn_addx_args *)ptr)->array;
+                    }
+                }
+                break;
+        }
+
+        if (test_status == -1)
+            break;
 
         returned = (struct rppc_function_return *)return_buf;
 
@@ -178,17 +312,79 @@ void * test_exec_call(void * arg)
             memcpy(return_buf, clientPackets[args->thread_num], 512);
             readMsg[args->thread_num] = true;
         }
-       if (i * 3 != returned->status) {
-           printf ("rpc_stress: "
-                   "called fxnTriple(%d), result = %d, expected %d\n",
-                        function->params[0].data, returned->status, i * 3);
-           test_status = -1;
-           break;
-       }
-       else {
-           printf ("rpc_stress: called fxnTriple(%d), result = %d\n",
-                        function->params[0].data, returned->status);
-       }
+        switch (function->fxn_id) {
+            case FXN_IDX_FXNTRIPLE:
+                if (i * 3 != returned->status) {
+                    printf ("rpc_stress: "
+                            "called fxnTriple(%d), result = %d, expected %d\n",
+                            function->params[0].data, returned->status, i * 3);
+                    test_status = -1;
+                }
+                else {
+                    printf ("rpc_stress: called fxnTriple(%d), result = %d\n",
+                            function->params[0].data, returned->status);
+                }
+                break;
+            case FXN_IDX_FXNADD:
+                if (i + (i+1) != returned->status) {
+                    printf ("rpc_stress: "
+                            "called fxnAdd(%d,%d), result = %d, expected %d\n",
+                            function->params[0].data, function->params[1].data,
+                            returned->status, i + (i+1));
+                    test_status = -1;
+                }
+                else {
+                    printf ("rpc_stress: called fxnAdd(%d,%d), result = %d\n",
+                            function->params[0].data, function->params[1].data,
+                            returned->status);
+                }
+                break;
+            case FXN_IDX_FXNADD3:
+                if (i + (i+1) + (i+2) != returned->status) {
+                    printf ("rpc_stress: "
+                            "called fxnAdd3(%d,%d,%d), result = %d, expected %d\n",
+                            ((fxn_add3_args *)ptr)->a,
+                            ((fxn_add3_args *)ptr)->b,
+                            ((fxn_add3_args *)ptr)->c, returned->status,
+                            i + (i+1) + (i+2));
+                    test_status = -1;
+                }
+                else {
+                    printf ("rpc_stress: called fxnAdd3(%d,%d,%d), result = %d\n",
+                            ((fxn_add3_args *)ptr)->a,
+                            ((fxn_add3_args *)ptr)->b,
+                            ((fxn_add3_args *)ptr)->c, returned->status);
+                }
+                (*sharedmem_free)(&buf);
+                break;
+            case FXN_IDX_FXNADDX:
+                if (i + (i+1) + (i+2) != returned->status) {
+                    printf ("rpc_stress: "
+                            "called fxnAddX(%d,%d,%d), result = %d, expected %d\n",
+                            ((int *)ptr2)[0], ((int *)ptr2)[1],
+                            ((int *)ptr2)[2], returned->status,
+                            i + (i+1) + (i+2));
+                    test_status = -1;
+                }
+                else {
+                    /* Check that reverse address translation is working */
+                    if (((fxn_addx_args *)ptr)->array != ptr2) {
+                        printf("rpc_stress: reverse addr translation failed, "
+                               "addr = 0x%x expected 0x%x\n",
+                               ((fxn_addx_args *)ptr)->array, ptr2);
+                        test_status = -1;
+                    }
+                    printf ("rpc_stress: called fxnAddX(%d,%d,%d), result = %d\n",
+                            ((int *)ptr2)[0], ((int *)ptr2)[1],
+                            ((int *)ptr2)[2], returned->status);
+                }
+                (*sharedmem_free)(&buf);
+                (*sharedmem_free)(&buf2);
+                break;
+        }
+        if (test_status == -1) {
+            break;
+        }
     }
 
     return NULL;
@@ -265,7 +461,20 @@ void * test_read_thread (void * arg)
             break;
 
         /* Decode reply: */
-        packet_id = ((rtn_packet->status / 3) - 1) / NUM_ITERATIONS;
+        switch (testFunc) {
+            case FXN_IDX_FXNTRIPLE:
+                packet_id = ((rtn_packet->status / 3) - 1) / NUM_ITERATIONS;
+                break;
+            case FXN_IDX_FXNADD:
+                packet_id = (((rtn_packet->status - 1) / 2) - 1) / NUM_ITERATIONS;
+                break;
+            case FXN_IDX_FXNADD3:
+                packet_id = (((rtn_packet->status - 3) / 3) - 1) / NUM_ITERATIONS;
+                break;
+            case FXN_IDX_FXNADDX:
+                packet_id = (((rtn_packet->status - 3) / 3) - 1) / NUM_ITERATIONS;
+                break;
+        }
         while (readMsg[packet_id] == false) {
             sleep(1);
         }
@@ -276,7 +485,7 @@ void * test_read_thread (void * arg)
     return NULL;
 }
 
-int test_rpc_stress_select(int core_id, int num_comps)
+int test_rpc_stress_select(int core_id, int num_comps, int func_idx)
 {
     int ret = 0;
     int i = 0, j = 0;
@@ -426,6 +635,7 @@ int test_rpc_stress_select(int core_id, int num_comps)
         args[i].test_num = 3;
         args[i].sem = &clientSems[i];
         args[i].thread_num = i;
+        args[i].func_idx = func_idx;
         readMsg[i] = true;
         ret = pthread_create(&clientThreads[i], NULL, test_exec_call,
                              (void *)&args[i]);
@@ -485,7 +695,7 @@ int test_rpc_stress_select(int core_id, int num_comps)
     return ret;
 }
 
-int test_rpc_stress_multi_threads(int core_id, int num_threads)
+int test_rpc_stress_multi_threads(int core_id, int num_threads, int func_idx)
 {
     int ret = 0;
     int i = 0, j = 0;
@@ -599,6 +809,7 @@ int test_rpc_stress_multi_threads(int core_id, int num_threads)
         args[i].test_num = 2;
         args[i].sem = &clientSems[i];
         args[i].thread_num = i;
+        args[i].func_idx = func_idx;
         readMsg[i] = true;
         ret = pthread_create(&clientThreads[i], NULL, test_exec_call,
                              (void *)&args[i]);
@@ -655,7 +866,7 @@ int test_rpc_stress_multi_threads(int core_id, int num_threads)
     return ret;
 }
 
-int test_rpc_stress_multi_srvmgr(int core_id, int num_comps)
+int test_rpc_stress_multi_srvmgr(int core_id, int num_comps, int func_idx)
 {
     int ret = 0;
     int i = 0, j = 0;
@@ -731,6 +942,7 @@ int test_rpc_stress_multi_srvmgr(int core_id, int num_comps)
         args[i].test_num = 1;
         args[i].sem = NULL;
         args[i].thread_num = i;
+        args[i].func_idx = func_idx;
         ret = pthread_create(&clientThreads[i], NULL, test_exec_call,
                              (void *)&args[i]);
         if (ret < 0) {
@@ -768,11 +980,12 @@ int main(int argc, char *argv[])
     int core_id = 0;
     int num_comps = 1;
     int num_threads = 1;
+    int func_idx = 1;
     int c;
 
     while (1)
     {
-        c = getopt (argc, argv, "t:c:x:l:");
+        c = getopt (argc, argv, "t:c:x:l:f:");
         if (c == -1)
             break;
 
@@ -790,6 +1003,9 @@ int main(int argc, char *argv[])
         case 'l':
             num_threads = atoi(optarg);
             break;
+        case 'f':
+            func_idx = atoi(optarg);
+            break;
         default:
             printf ("Unrecognized argument\n");
         }
@@ -800,6 +1016,12 @@ int main(int argc, char *argv[])
         return 1;
     }
 
+    if (func_idx < FXN_IDX_FXNTRIPLE || func_idx >= FXN_IDX_MAX) {
+        printf("Invalid function index\n");
+        return 1;
+    }
+    testFunc = func_idx;
+
     switch (test_id) {
         case 1:
             /* multiple threads each with an RPMSG-RPC ServiceMgr instance */
@@ -811,7 +1033,7 @@ int main(int argc, char *argv[])
                 printf("Invalid num comps id\n");
                 return 1;
             }
-            ret = test_rpc_stress_multi_srvmgr(core_id, num_comps);
+            ret = test_rpc_stress_multi_srvmgr(core_id, num_comps, func_idx);
             break;
         case 2:
             /* Multiple threads, 1 RPMSG-RPC ServiceMgr instances */
@@ -823,7 +1045,7 @@ int main(int argc, char *argv[])
                 printf("Invalid num threads\n");
                 return 1;
             }
-            ret = test_rpc_stress_multi_threads(core_id, num_threads);
+            ret = test_rpc_stress_multi_threads(core_id, num_threads, func_idx);
             break;
         case 3:
             /* 1 thread using multiple RPMSG-RPC ServiceMgr instances */
@@ -835,7 +1057,7 @@ int main(int argc, char *argv[])
                 printf("Invalid num comps id\n");
                 return 1;
             }
-            ret = test_rpc_stress_select(core_id, num_comps);
+            ret = test_rpc_stress_select(core_id, num_comps, func_idx);
             break;
         default:
             break;
index 542a111ebee587fce41d05eae5da48f1c20f17dc..f25c646a19479027c400c5a0eb4172fe53e874d4 100644 (file)
 include ../../common.mk
 
 $(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/mm/arm/a.g.le.v7/libmmrpc_g.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/libsharedmemallocatorS.a
 
 # link with syslink static library, dynamic for others
 LIBPREF_mmrpc_g = -Bstatic
 LIBPOST_mmrpc_g = -Bdynamic
+LIBPREF_sharedmemallocatorS = -Bstatic
+LIBPOST_sharedmemallocatorS = -Bdynamic
 
 # add libpath and libs
-EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/mm/arm/a.g.le.v7
-LIBS += mmrpc_g
+EXTRA_LIBVPATH += \
+        $(IPC_REPO)/qnx/src/mm/arm/a.g.le.v7 \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7
 
-# copy and rename executables to suit our preferences (TODO: where do we copy the executables)
-#POST_BUILD = \
-#        $(CP_HOST) \
-#        $(PROJECT_ROOT)/arm/o.g.le.v7/MessageQApp_g \
-#        $(PROJECT_ROOT)/../bin/debug/MessageQApp
+LIBS += mmrpc_g
+LIBS += sharedmemallocatorS
index 35797d880bec4ebd413f468cc3d8218ab5c93b6d..793a437c29d57d6e121fefa73734f00ad4243457 100644 (file)
@@ -34,17 +34,18 @@ include ../../common.mk
 CCFLAGS += -O3
 
 $(PROJECT_ROOT)/arm/o.le.v7/mmrpc_test: $(IPC_REPO)/qnx/src/mm/arm/a.le.v7/libmmrpc.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/mmrpc_test_g: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/libsharedmemallocatorS.a
 
 # link with syslink static library, dynamic for others
 LIBPREF_mmrpc = -Bstatic
 LIBPOST_mmrpc = -Bdynamic
+LIBPREF_sharedmemallocatorS = -Bstatic
+LIBPOST_sharedmemallocatorS = -Bdynamic
 
 # add libpath and libs
-EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/mm/arm/a.le.v7
-LIBS += mmrpc
+EXTRA_LIBVPATH += \
+        $(IPC_REPO)/qnx/src/mm/arm/a.le.v7 \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7
 
-# copy and rename executables to suit our preferences (TODO: where do we copy the executables)
-#POST_BUILD = \
-#        $(CP_HOST) \
-#        $(PROJECT_ROOT)/arm/o.le.v7/MessageQApp \
-#        $(PROJECT_ROOT)/../bin/debug/MessageQApp
+LIBS += mmrpc
+LIBS += sharedmemallocatorS
index 007b57e9736900acfa790fd1c74d03ecba485f51..200ae8937cbed41205cac412838164414cdb1d1c 100644 (file)
@@ -40,21 +40,21 @@ define PINFO
 PINFO DESCRIPTION=MmRpc test program
 endef
 
-# don't install the binaries, they are copied in base makefile
-#INSTALLDIR = bin/tests
-INSTALLDIR = /dev/null
+INSTALLDIR = bin/tests
 
 CCOPTS += -DSYSLINK_BUILDOS_QNX
 
 # source path
 EXTRA_SRCVPATH = $(IPC_REPO)/packages/ti/ipc/tests
-SRCS = mmrpc_test.c
+SRCS = Mx.c mmrpc_test.c
 
 EXCLUDE_OBJS =
 
 # include path
 EXTRA_INCVPATH += \
-        $(IPC_REPO)/packages
+        $(IPC_REPO)/packages \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+        $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
 
 include $(MKFILES_ROOT)/qtargets.mk