author | Chris Ring <cring@ti.com> | |
Fri, 22 Mar 2013 21:20:03 +0000 (14:20 -0700) | ||
committer | Chris Ring <cring@ti.com> | |
Fri, 22 Mar 2013 21:20:03 +0000 (14:20 -0700) |
44 files changed:
diff --git a/Makefile.in b/Makefile.in
index e44aa2d519ff916d1268627db02570c3d9bb5515..8f0f928b9e523b251917206953fbab723fe960e5 100644 (file)
--- a/Makefile.in
+++ b/Makefile.in
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@
diff --git a/configure b/configure
index 00a9561f3dde91b23cdb596c6a1d78c797f209a4..cf8e3db93f39f8b88b9b7ff1d76ea7bd83b1b2e2 100755 (executable)
--- a/configure
+++ b/configure
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP LIBTOOL AM_CFLAGS AM_LDFLAGS PLATFORM CMEM_INSTALL_DIR 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.
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.
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.
;;
*-*-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=$?
-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.
-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.
-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
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
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
-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.
-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
-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.
-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.
-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
+
# 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
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
diff --git a/ipc-bios.mak b/ipc-bios.mak
index a6fc8c2788edbdadc991f375b0fae03efbe7f0f8..121f65e39b80f54bcbcff996f9ba8409ae73031d 100644 (file)
--- a/ipc-bios.mak
+++ b/ipc-bios.mak
@ $(XDC) -P $(LIST)
libs:
- @ echo #
- @ echo # Making $@ ...
- @ $(XDC) -P $(LIST) .libraries
+ @echo "#"
+ @echo "# Making $@ ..."
+ $(XDC) .libraries -P $(LIST)
release:
@ echo building ipc packages ...
diff --git a/linux/etc/Makefile.in b/linux/etc/Makefile.in
index ad29aba5a4b8b5deafcc0ce14d883b9853fac875..6dc9f92f38c8078f37099b4188b4c981813b689c 100644 (file)
--- a/linux/etc/Makefile.in
+++ b/linux/etc/Makefile.in
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)
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)
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)
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)
--- a/linux/src/mm/Makefile.in
+++ b/linux/src/mm/Makefile.in
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@
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)
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)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
-VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
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)
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@
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@
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
@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)
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)
/*
* ======== 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));
}
/* 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");
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) {
*handlePtr = (MmRpc_Handle)obj;
}
- printf("MmRpc_create: <--\n");
return(status);
}
int status = MmRpc_S_SUCCESS;
MmRpc_Object *obj;
- printf("MmRpc_delete: -->\n");
obj = (MmRpc_Object *)(*handlePtr);
/* close the device */
free((void *)(*handlePtr));
*handlePtr = NULL;
- printf("MmRpc_delete: <--\n");
return(status);
}
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) {
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 */
free(msg);
}
- printf("MmRpc_call: <-- status=%d\n", status);
return(status);
}
index 844246328da8ae242d743212ae245474969da137..2bdc1afc96e5463799947b3d501a2e8f96c6724c 100644 (file)
#include <stddef.h>
#include <stdint.h>
-#if defined (__cplusplus)
+#if defined(__cplusplus)
extern "C" {
#endif
*/
#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
*/
* @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;
/*!
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;
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;
/*!
* @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
-#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
--- /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
--- /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
--- /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
--- /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
--- /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
--- /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)
"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
--- /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
--- /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
--- /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
--- /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 ========
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");
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:
}
return(0);
}
-
-/*
- * ======== Mx_initialize ========
- */
-int Mx_initialize(void)
-{
- int status;
- MmRpc_Params params;
-
- /* create remote server insance */
- MmRpc_Params_init(¶ms);
-
- status = MmRpc_create("DSP", "FooServer", ¶ms, &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)
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);
}
diff --git a/packages/ti/ipc/tests/test_omx_ipu_omap5.cfg b/packages/ti/ipc/tests/test_omx_ipu_omap5.cfg
index 9352f3ca56fc43902cca9b798b7046ddb53c43f9..411e1f6c2709e2e7cfe52719b93e51bddf2e17b0 100644 (file)
xdc.loadPackage('ti.ipc.ipcmgr');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');
-BIOS.addUserStartupFunction('&start_rpc_task');
+BIOS.addUserStartupFunction('®ister_MxServer');
var Task = xdc.useModule('ti.sysbios.knl.Task');
Task.defaultStackSize = 0x2000;
var Task = xdc.useModule('ti.sysbios.knl.Task');
Task.defaultStackSize = 12 * 0x400;
+
+xdc.loadPackage('ti.ipc.mm');
index d07ff3705932f353178cc1e57a1bdf0db7c39ec9..80fd114738de338dd469064de9e78f5af277466c 100644 (file)
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)
*
* @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)
#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>
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;
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;
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)
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)
#define ti_srvmgr_OmapRpc__include
#include <ti/grcm/RcmServer.h>
+#include <ti/ipc/mm/MmType.h>
#if defined (__cplusplus)
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);
diff --git a/products.mak b/products.mak
index 3e330d5cfb390be837129ec16c5b88aedd8b54c7..5e74c17dbc841b744bfdf830e926e64cdfaa2bf5 100644 (file)
--- a/products.mak
+++ b/products.mak
# 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
--- /dev/null
+++ b/qnx/.gitignore
@@ -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
diff --git a/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/SharedMemoryAllocator.c b/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/SharedMemoryAllocator.c
index 6c05e801af61901f7d127c22605873ce94efdb4e..1c7682921d08adcdc7d68591ce827c4242dd5c5d 100644 (file)
*
*/
-#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
diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap5430/Platform.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap5430/Platform.c
index 3ff42eb5491606c58c813472def4275bd6bffad0..9af6aa2ee05c8f22815f5db54bce3be440f6156c 100644 (file)
#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.
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);
}
else {
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
-
+/*
String_cpy(Syslink_Override_Params,
"ProcMgr.proc[CORE0].mmuEnable=TRUE;");
String_hexToStr(hexString, cfg->pAddr);
"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);
diff --git a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c
index 74ec0a5c275750e19aa727604202f97c79537915..71636ff16e60e7afd2f8d01d3e5d8fc7773ad533 100644 (file)
#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>
/*!< 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;
return;
}
+/** ============================================================================
+ * Function Prototypes
+ * ============================================================================
+ */
+int
+_rpmsg_rpc_translate (ProcMgr_Handle handle, char *data, pid_t pid,
+ bool reverse);
/** ============================================================================
* Globals
.run = 0
};
+static uint16_t msg_id = 0xFFFF;
+
extern dispatch_t * syslink_dpp;
Bool flag = FALSE;
Bool isInit = FALSE;
List_Object * bufList = NULL;
+ List_Object * fxnList = NULL;
IArg key = 0;
List_Params listparams;
UInt32 i;
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;
}
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 ;
_rpmsg_rpc_addBufByPid (rpmsg_rpc_object *rpc,
UInt32 src,
UInt32 pid,
+ UInt16 msgId,
void * data,
UInt32 len)
{
UInt32 i;
WaitingReaders_t *item;
MsgList_t *msgItem;
+ List_Elem * elem = NULL;
+ List_Elem * temp = NULL;
GT_5trace (curTrace,
GT_ENTER,
}
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));
_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)
Int32 tmpStatus = EOK;
Bool flag = FALSE;
List_Object * bufList = NULL;
+ List_Object * fxnList = NULL;
UInt32 i;
IArg key;
MsgList_t * item;
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);
}
/* 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)) {
}
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 =
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));
}
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;
}
/* 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);
}
diff --git a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.h b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.h
index 12c1c952262df00e2676cf844f7e26dbc1f036f6..e7cc922b72da537ae0919dfed655379303f01d42 100644 (file)
extern "C" {
#endif
+#include <ti/ipc/rpmsg_rpc.h>
/* =============================================================================
* Macros and types
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
*/
diff --git a/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/common.mk b/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/common.mk
index 58b8836a6123aebfdea5acf16d96c71ca1b9f58c..401797dc3f17b272a3a5503f6ed6674875da34bb 100644 (file)
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
diff --git a/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/rpmsg-rpc-stress.use b/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/rpmsg-rpc-stress.use
index 0fad850a334f8cfc3692854dd84b378cb7201fd5..f1f7df4ee8e49c9e905b5091430fd652e5b5ce95 100644 (file)
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.
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
diff --git a/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/tests_rpc_stress.c b/qnx/src/ipc3x_dev/ti/syslink/samples/hlos/rpmsg-rpc-stress/usr/tests_rpc_stress.c
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)
{
int test_num;
sem_t * sem;
int thread_num;
+ int func_idx;
} test_exec_args;
static pthread_t * clientThreads = 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;
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;
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;
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);
}
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;
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]);
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;
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]);
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;
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) {
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;
case 'l':
num_threads = atoi(optarg);
break;
+ case 'f':
+ func_idx = atoi(optarg);
+ break;
default:
printf ("Unrecognized argument\n");
}
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 */
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 */
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 */
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;
diff --git a/qnx/src/tests/mmrpc_test/arm/o.g.le.v7/Makefile b/qnx/src/tests/mmrpc_test/arm/o.g.le.v7/Makefile
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
diff --git a/qnx/src/tests/mmrpc_test/arm/o.le.v7/Makefile b/qnx/src/tests/mmrpc_test/arm/o.le.v7/Makefile
index 35797d880bec4ebd413f468cc3d8218ab5c93b6d..793a437c29d57d6e121fefa73734f00ad4243457 100644 (file)
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)
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