summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9c5531e)
raw | patch | inline | side by side (parent: 9c5531e)
author | Justin Sobota <jsobota@ti.com> | |
Thu, 29 May 2014 16:04:13 +0000 (12:04 -0400) | ||
committer | Justin Sobota <jsobota@ti.com> | |
Thu, 29 May 2014 16:04:13 +0000 (12:04 -0400) |
61 files changed:
diff --git a/makefile_armv7 b/makefile_armv7
index 99dd1c91b7f56f4cd062fe260e31e7e3beded8ba..c51a8882734ca5f949f3a7ca7d75fdd41e3d04d7 100644 (file)
--- a/makefile_armv7
+++ b/makefile_armv7
# tests Stub to add tests
tests:
- @$(MAKE) -f ./test/$(DEVICE)/armv7/linux/build/makefile all
+ @$(MAKE) -f ./test/armv7/linux/build/makefile all
# examples Stub to add Examples
#examples:
# Rule to clean $(ARMV7LIBDIR)/librm.a library
clean:
@$(MAKE) -f ./build/armv7/librm_aearmv7.mk $@
- @$(MAKE) -f ./test/$(DEVICE)/armv7/linux/build/makefile $@
+ @$(MAKE) -f ./test/armv7/linux/build/makefile $@
@$(RMDIR) $(ARMV7OBJDIR)/rm
@$(RMDIR) $(ARMV7BINDIR)/rm
@$(RM) $(ARMV7LIBDIR)/librm.a
similarity index 100%
rename from test/k2e/armv7/linux/README.txt
rename to test/armv7/linux/README.txt
rename from test/k2e/armv7/linux/README.txt
rename to test/armv7/linux/README.txt
similarity index 100%
rename from test/k2e/armv7/linux/rm_dsp_client_test.c
rename to test/armv7/linux/rm_dsp_client_test.c
rename from test/k2e/armv7/linux/rm_dsp_client_test.c
rename to test/armv7/linux/rm_dsp_client_test.c
similarity index 100%
rename from test/k2e/armv7/linux/rm_linux_client_test.c
rename to test/armv7/linux/rm_linux_client_test.c
rename from test/k2e/armv7/linux/rm_linux_client_test.c
rename to test/armv7/linux/rm_linux_client_test.c
similarity index 100%
rename from test/k2e/armv7/linux/rm_linux_osal.c
rename to test/armv7/linux/rm_linux_osal.c
rename from test/k2e/armv7/linux/rm_linux_osal.c
rename to test/armv7/linux/rm_linux_osal.c
similarity index 100%
rename from test/k2e/armv7/linux/rm_server.c
rename to test/armv7/linux/rm_server.c
rename from test/k2e/armv7/linux/rm_server.c
rename to test/armv7/linux/rm_server.c
similarity index 100%
rename from test/k2e/armv7/linux/rm_server_osal.c
rename to test/armv7/linux/rm_server_osal.c
rename from test/k2e/armv7/linux/rm_server_osal.c
rename to test/armv7/linux/rm_server_osal.c
similarity index 100%
rename from test/k2e/armv7/linux/serverlogutil.h
rename to test/armv7/linux/serverlogutil.h
rename from test/k2e/armv7/linux/serverlogutil.h
rename to test/armv7/linux/serverlogutil.h
similarity index 100%
rename from test/k2e/armv7/linux/sockrmmsg.h
rename to test/armv7/linux/sockrmmsg.h
rename from test/k2e/armv7/linux/sockrmmsg.h
rename to test/armv7/linux/sockrmmsg.h
similarity index 100%
rename from test/k2e/armv7/linux/sockutils.c
rename to test/armv7/linux/sockutils.c
rename from test/k2e/armv7/linux/sockutils.c
rename to test/armv7/linux/sockutils.c
similarity index 100%
rename from test/k2e/armv7/linux/sockutils.h
rename to test/armv7/linux/sockutils.h
rename from test/k2e/armv7/linux/sockutils.h
rename to test/armv7/linux/sockutils.h
diff --git a/test/k2e/armv7/linux/build/makefile b/test/k2e/armv7/linux/build/makefile
+++ /dev/null
@@ -1,128 +0,0 @@
-#
-# Macro definitions referenced below
-#
-
-empty =
-space =$(empty) $(empty)
-
-PDK_INSTALL_PATH ?= ../../..
-# IPC_DEVKIT_INSTALL_PATH ?= need/to/set/path
-# export IPC_DEVKIT_INSTALL_PATH if IPC is not in /usr/lib
-# Currently requiring IPC from linux-devkit because that package is compiled with Linaro tools
-
-ARMV7OBJDIR ?= ./obj/$(DEVICE)
-ARMV7BINDIR ?= ./bin/$(DEVICE)
-ARMV7LIBDIR ?= ./lib
-
-ARMV7OBJDIR := $(ARMV7OBJDIR)/rm/test
-ARMV7BINDIR := $(ARMV7BINDIR)/rm/test
-
-#Cross tools
-ifdef CROSS_TOOL_INSTALL_PATH
-# Support backwards compatibility with KeyStone1 approach
- CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
- AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
- AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
- LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
-endif
-
-ifdef IPC_DEVKIT_INSTALL_PATH
- IPCLIBDIRS := -L$(IPC_DEVKIT_INSTALL_PATH)/lib/
-else
- IPCLIBDIRS :=
-endif
-
-# INCLUDE Directories
-RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
-
-RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
-RM_TEST_DIR = $(RM_SRC_DIR)/test
-RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/$(DEVICE)/armv7/linux
-
-INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(IPC_DEVKIT_INSTALL_PATH)/include
-
-# Libraries
-RM_LIB = -lrm
-DAEMON_LIB = -ldaemon
-IPC_LIBS = -ltiipc -ltiipcutils
-
-ifeq ($(USEDYNAMIC_LIB), yes)
-#presuming ARM executable would depend on dynamic library dependency
-EXE_EXTN = _so
-LIBS = $(RM_LIB) $(DAEMON_LIB)
-else
-#forcing ARM executable to depend on static LLD libraries
-EXE_EXTN =
-LIBS = -static $(RM_LIB) -Wl,-Bdynamic $(DAEMON_LIB)
-endif
-
-# Compiler options
-INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
-
-# Linker options
-INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
-IPC_INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(IPCLIBDIRS) $(IPC_LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
-
-RM_SERVER_EXE=rmServer$(EXE_EXTN).out
-RM_LINUX_CLIENT_TEST_EXE=rmLinuxClientTest$(EXE_EXTN).out
-RM_DSP_CLIENT_TEST_EXE=rmDspClientTest$(EXE_EXTN).out
-
-OBJEXT = o
-
-SRCDIR = $(RM_ARM_LIN_TEST_DIR)
-
-INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
-
-VPATH=$(SRCDIR)
-
-#List the Source Files
-RM_SERVER_SRC = \
- rm_server.c \
- rm_server_osal.c \
- sockutils.c
-
-RM_LINUX_CLIENT_TEST_SRC = \
- rm_linux_client_test.c \
- rm_linux_osal.c \
- sockutils.c
-
-RM_DSP_CLIENT_TEST_SRC = \
- rm_dsp_client_test.c \
- sockutils.c
-
-# FLAGS for the SourceFiles
-SRC_CFLAGS = -I. $(CFLAGS)
-
-# Make Rule for the SRC Files
-RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
-RM_LINUX_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_CLIENT_TEST_SRC))
-RM_DSP_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_DSP_CLIENT_TEST_SRC))
-
-all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE)
-
-$(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
- @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE): $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_LINUX_CLIENT_TEST_SRC_OBJS) into $@ ...
- @$(CC) $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE): $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_DSP_CLIENT_TEST_SRC_OBJS) into $@ ...
- @$(CC) $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(IPC_INTERNALLINKDEFS) -o $@
-
-$(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
- @echo compiling $< ...
- @$(CC) -c $(SRC_CFLAGS) $(INTERNALDEFS) $(INCS) $< -o $@
-
-$(ARMV7OBJDIR)/.created:
- @mkdir -p $(ARMV7OBJDIR)
- @touch $(ARMV7OBJDIR)/.created
-
-$(ARMV7BINDIR)/.created:
- @mkdir -p $(ARMV7BINDIR)
- @touch $(ARMV7BINDIR)/.created
-
-clean:
- @rm -fr $(ARMV7OBJDIR)
- @rm -fr $(ARMV7BINDIR)
-
diff --git a/test/k2e/armv7/linux/dspClientTest/dsp_client.cfg b/test/k2e/armv7/linux/dspClientTest/dsp_client.cfg
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-xdc.loadCapsule("dsp_client.cfg.xs");
-
-var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
-
-var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
-MessageQ.SetupTransportProxy = VirtioSetup;
-
-var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
-var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
-NameServer.SetupProxy = NsRemote;
-
-var TransportRpmsg = xdc.useModule('ti.ipc.transports.TransportRpmsg');
-
diff --git a/test/k2e/armv7/linux/dspClientTest/dsp_client.cfg.xs b/test/k2e/c66/bios/dsp_client.cfg
similarity index 61%
rename from test/k2e/armv7/linux/dspClientTest/dsp_client.cfg.xs
rename to test/k2e/c66/bios/dsp_client.cfg
index 918fb96f72934f0a6efa77bf081b960e8af44eef..33f4ded46b10e2618521bf489828db51babd26d1 100644 (file)
rename from test/k2e/armv7/linux/dspClientTest/dsp_client.cfg.xs
rename to test/k2e/c66/bios/dsp_client.cfg
index 918fb96f72934f0a6efa77bf081b960e8af44eef..33f4ded46b10e2618521bf489828db51babd26d1 100644 (file)
print ("Program.cpu.deviceName = " + Program.cpu.deviceName);
print ("Program.platformName = " + Program.platformName);
-if (Program.cpu.deviceName.match(/TMS320C66AK2E05/)) {
- var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
- var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
-
- /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
- var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
- MultiProc.setConfig(null, ["HOST", "CORE0"]);
- Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
- Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
- Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
-
- var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
- Hwi.enableException = true;
-
- /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
- We assume the rest is to be left cacheable.
- Per sprugw0b.pdf
- 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
- 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
- */
- var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
- /* This doesn't work:
- Cache.MAR160_191 = 0xFFFFFFFC;
- So, need to do this:
- */
- /* TBD: Update for Kepler: */
- Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
-
- Program.global.sysMinBufSize = 0x8000;
- SysMin.bufSize = Program.global.sysMinBufSize;
-
- /* Enable Memory Translation module that operates on the Resource Table */
- var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
- Resource.loadSegment = Program.platform.dataMemory;
-
- /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
- /*
- Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
- Diags.ALWAYS_ON);
- Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
- Diags.ALWAYS_ON);
- Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
- Diags.INFO|Diags.USER1|Diags.STATUS,
- Diags.ALWAYS_ON);
- Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
- Diags.ALWAYS_ON);
- */
-}
-else {
- throw("dsp_client.cfg.xs: Did not match any platform!");
-}
+var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+/* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+/* K2E - TMS320C66AK2E05 */
+MultiProc.setConfig(null, ["HOST", "CORE0"]);
+Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+Hwi.enableException = true;
+
+/* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+ We assume the rest is to be left cacheable.
+ Per sprugw0b.pdf
+ 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+ 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+*/
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+/* This doesn't work:
+ Cache.MAR160_191 = 0xFFFFFFFC;
+ So, need to do this:
+*/
+/* TBD: Update for Kepler: */
+Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+Program.global.sysMinBufSize = 0x8000;
+SysMin.bufSize = Program.global.sysMinBufSize;
+
+/* Enable Memory Translation module that operates on the Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = Program.platform.dataMemory;
+
+/* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+/*
+Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
+ Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
+ Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+ Diags.INFO|Diags.USER1|Diags.STATUS,
+ Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+ Diags.ALWAYS_ON);
+*/
Hwi.enableException = true;
Csl.deviceType = devType;
var Rm = xdc.loadPackage('ti.drv.rm');
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+var TransportRpmsg = xdc.useModule('ti.ipc.transports.TransportRpmsg');
+
diff --git a/test/k2e/c66/bios/rmK2EArmv7LinuxDspClientTestProject.txt b/test/k2e/c66/bios/rmK2EArmv7LinuxDspClientTestProject.txt
index d0ce80e89497dbfcdfedeaa13f42761e4ce6beaa..a127c12c5d73e6595d4b8d7ea69306f7aa0c9881 100644 (file)
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2e/armv7/linux/dspClientTest/dsp_client.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/src/dsp_client.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2e/c66/bios/rm_osal.c"
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2e/armv7/linux/dspClientTest/dsp_client.cfg"
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2e/armv7/linux/dspClientTest/dsp_client.cfg.xs"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2e/c66/bios/dsp_client.cfg"
-ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2E --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm"
-rtsc.enableRtsc
diff --git a/test/k2h/armv7/linux/README.txt b/test/k2h/armv7/linux/README.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-Running the RM ARM Linux + DSP Test:
-Please see the RM User Guide for instructions on how to run this test
-http://processors.wiki.ti.com/index.php/MCSDK_UG_Chapter_Developing_System_Mgmt#Running_RM_Test_Projects
-
-Running the RM ARM Linux multi-process test:
-
-To run rmServer.out:
-
-copy the following files from rm/test/dts_files to the install directory containing rmServer.out:
-global-resources.dtb
-server-policy.dtb
-linux-evm.dtb [Optional]
-
-The data contained in the latter DTB files is not required to run the RM Server. A new GRL and policy
-can be written and supplied instead of the latter files.
-
-For information on how to create new GRLs and Policies please see:
-http://processors.wiki.ti.com/index.php/MCSDK_UG_Chapter_Developing_System_Mgmt#Resource_Manager
-
-To run the Server:
-$ ./rmServer.out global-resources.dtb server-policy.dtb -l linux-evm.dtb
-
-The Server will wait for Client socket connections and service any requests received via those sockets.
-
-
-To run the rmLinuxClientTest.out:
-
-copy the following files from rm/test/dts_files to the install directory containing rmLinuxClientTest.out:
-static-policy.dtb
-
-To execute the Client test:
-$ ./rmLinuxClientTest.out static-policy.dtb
-
-The Client test will establish a socket connection with the Server, request resources and then free all resources requested.
diff --git a/test/k2h/armv7/linux/build/makefile b/test/k2h/armv7/linux/build/makefile
+++ /dev/null
@@ -1,128 +0,0 @@
-#
-# Macro definitions referenced below
-#
-
-empty =
-space =$(empty) $(empty)
-
-PDK_INSTALL_PATH ?= ../../..
-# IPC_DEVKIT_INSTALL_PATH ?= need/to/set/path
-# export IPC_DEVKIT_INSTALL_PATH if IPC is not in /usr/lib
-# Currently requiring IPC from linux-devkit because that package is compiled with Linaro tools
-
-ARMV7OBJDIR ?= ./obj/$(DEVICE)
-ARMV7BINDIR ?= ./bin/$(DEVICE)
-ARMV7LIBDIR ?= ./lib
-
-ARMV7OBJDIR := $(ARMV7OBJDIR)/rm/test
-ARMV7BINDIR := $(ARMV7BINDIR)/rm/test
-
-#Cross tools
-ifdef CROSS_TOOL_INSTALL_PATH
-# Support backwards compatibility with KeyStone1 approach
- CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
- AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
- AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
- LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
-endif
-
-ifdef IPC_DEVKIT_INSTALL_PATH
- IPCLIBDIRS := -L$(IPC_DEVKIT_INSTALL_PATH)/lib/
-else
- IPCLIBDIRS :=
-endif
-
-# INCLUDE Directories
-RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
-
-RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
-RM_TEST_DIR = $(RM_SRC_DIR)/test
-RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/$(DEVICE)/armv7/linux
-
-INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(IPC_DEVKIT_INSTALL_PATH)/include
-
-# Libraries
-RM_LIB = -lrm
-DAEMON_LIB = -ldaemon
-IPC_LIBS = -ltiipc -ltiipcutils
-
-ifeq ($(USEDYNAMIC_LIB), yes)
-#presuming ARM executable would depend on dynamic library dependency
-EXE_EXTN = _so
-LIBS = $(RM_LIB) $(DAEMON_LIB)
-else
-#forcing ARM executable to depend on static LLD libraries
-EXE_EXTN =
-LIBS = -static $(RM_LIB) -Wl,-Bdynamic $(DAEMON_LIB)
-endif
-
-# Compiler options
-INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
-
-# Linker options
-INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
-IPC_INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(IPCLIBDIRS) $(IPC_LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
-
-RM_SERVER_EXE=rmServer$(EXE_EXTN).out
-RM_LINUX_CLIENT_TEST_EXE=rmLinuxClientTest$(EXE_EXTN).out
-RM_DSP_CLIENT_TEST_EXE=rmDspClientTest$(EXE_EXTN).out
-
-OBJEXT = o
-
-SRCDIR = $(RM_ARM_LIN_TEST_DIR)
-
-INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
-
-VPATH=$(SRCDIR)
-
-#List the Source Files
-RM_SERVER_SRC = \
- rm_server.c \
- rm_server_osal.c \
- sockutils.c
-
-RM_LINUX_CLIENT_TEST_SRC = \
- rm_linux_client_test.c \
- rm_linux_osal.c \
- sockutils.c
-
-RM_DSP_CLIENT_TEST_SRC = \
- rm_dsp_client_test.c \
- sockutils.c
-
-# FLAGS for the SourceFiles
-SRC_CFLAGS = -I. $(CFLAGS)
-
-# Make Rule for the SRC Files
-RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
-RM_LINUX_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_CLIENT_TEST_SRC))
-RM_DSP_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_DSP_CLIENT_TEST_SRC))
-
-all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE)
-
-$(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
- @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE): $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_LINUX_CLIENT_TEST_SRC_OBJS) into $@ ...
- @$(CC) $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE): $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_DSP_CLIENT_TEST_SRC_OBJS) into $@ ...
- @$(CC) $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(IPC_INTERNALLINKDEFS) -o $@
-
-$(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
- @echo compiling $< ...
- @$(CC) -c $(SRC_CFLAGS) $(INTERNALDEFS) $(INCS) $< -o $@
-
-$(ARMV7OBJDIR)/.created:
- @mkdir -p $(ARMV7OBJDIR)
- @touch $(ARMV7OBJDIR)/.created
-
-$(ARMV7BINDIR)/.created:
- @mkdir -p $(ARMV7BINDIR)
- @touch $(ARMV7BINDIR)/.created
-
-clean:
- @rm -fr $(ARMV7OBJDIR)
- @rm -fr $(ARMV7BINDIR)
-
diff --git a/test/k2h/armv7/linux/dspClientTest/dsp_client.c b/test/k2h/armv7/linux/dspClientTest/dsp_client.c
+++ /dev/null
@@ -1,1011 +0,0 @@
-/*
- * dsp_client.c
- *
- * DSP portion of Resource Manager ARM+DSP test that uses RPMSG and sockets to
- * allow a DSP application to to request RM services from a RM Server running
- * from Linux User-space.
- *
- * ============================================================================
- *
- * 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.
- *
- */
-
-/* Standard includes */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* XDC includes */
-#include <xdc/std.h>
-#include <xdc/runtime/Assert.h>
-#include <xdc/runtime/System.h>
-
-/* BIOS includes */
-#include <ti/sysbios/BIOS.h>
-#include <ti/sysbios/knl/Task.h>
-
-/* IPC includes */
-#include <ti/ipc/MultiProc.h>
-#include <ti/ipc/HeapBufMP.h>
-#include <ti/ipc/MessageQ.h>
-
-/* CSL includes */
-#include <ti/csl/csl_chip.h>
-
-/* RM Includes */
-#include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_transport.h>
-#include <ti/drv/rm/rm_services.h>
-
-/**********************************************************************
- ************************** RM Test Symbols ***************************
- **********************************************************************/
-
-/* Test will run on this core */
-#define TEST_CORE 0
-
-/* Test FALSE */
-#define RM_TEST_FALSE 0
-/* Test TRUE */
-#define RM_TEST_TRUE 1
-
-/* RM packet heap name */
-#define MSGQ_HEAP_ID 0
-
-/* MessageQ Name for DSP RM Client */
-#define CLIENT_MESSAGEQ_NAME "RM_CLIENT"
-
-/* Size of RM static allocation response queue. Must be greater than number of APPROVED
- * static allocations */
-#define MAX_STATIC_ALLOCATION_RESPS 5
-
-/* Size of RM service response queue */
-#define MAX_QUEUED_SERVICE_RESPONSES 10
-
-/* Error checking macro */
-#define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg) \
- if (resultVal != checkVal) { \
- char errorMsgToPrint[] = printMsg; \
- System_printf("Error Core %d : %s : ", coreNum, rmInstName); \
- System_printf("%s with error code : %d\n", errorMsgToPrint, resultVal); \
- testErrors++; \
- System_abort("Test Failure\n"); \
- }
-
-#define POSITIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("Core %d : %s\n", core, titleMsg); \
- System_printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- System_printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- System_printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- System_printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- System_printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- System_printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- System_printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- System_printf ("Core %d : - -\n", \
- core); \
- if (state == check) { \
- System_printf ("Core %d : - PASSED -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- testErrors++; \
- } \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("\n"); \
- } while(0);
-
-#define NEGATIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("Core %d : %s\n", core, titleMsg); \
- System_printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- System_printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- System_printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- System_printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- System_printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- System_printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- System_printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- System_printf ("Core %d : - -\n", \
- core); \
- if (state != check) { \
- System_printf ("Core %d : - PASSED - Denial: %-6d -\n", \
- core, state); \
- } \
- else { \
- System_printf ("Core %d : - FAILED - Expected Denial -\n", \
- core); \
- testErrors++; \
- } \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("\n"); \
- } while(0);
-
-#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
- do { \
- int32_t start = resStart; \
- char titleMsg[] = title; \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("Core %d : %s\n", core, titleMsg); \
- System_printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- System_printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- System_printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- System_printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- System_printf ("Core %d : - Expected Owner Count: %-16d -\n", \
- core, expectRefCnt); \
- System_printf ("Core %d : - Returned Owner Count: %-16d -\n", \
- core, refCnt); \
- System_printf ("Core %d : - -\n", core); \
- if ((state == check) && (refCnt == expectRefCnt)) { \
- System_printf ("Core %d : - PASSED -\n", core); \
- } \
- else { \
- if (refCnt != expectRefCnt) { \
- System_printf ("Core %d : - FAILED - Owner Count Mismatch -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- } \
- testErrors++; \
- } \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("\n"); \
- } while(0);
-
-/**********************************************************************
- ********************** RM Test Data Structures ***********************
- **********************************************************************/
-
-/* IPC MessageQ RM packet encapsulation structure */
-typedef struct {
- /* IPC MessageQ header (must be first element in structure) */
- MessageQ_MsgHeader msgQHeader;
- /* Pointer to RM packet */
- Rm_Packet rmPkt;
-} MsgQ_RmPacket;
-
-/**********************************************************************
- ********************** Extern Variables ******************************
- **********************************************************************/
-
-/* Alloc and free OSAL variables */
-extern uint32_t rmMallocCounter;
-extern uint32_t rmFreeCounter;
-
-/* RM test Static Policy provided to RM Client */
-extern const char rmStaticPolicy[];
-
-/**********************************************************************
- ********************** Global Variables ******************************
- **********************************************************************/
-
-/* Core number */
-uint16_t coreNum;
-/* Number of errors that occurred during the test */
-uint16_t testErrors;
-
-/* Task to configure application transport code for RM */
-Task_Handle rmStartupTskHandle;
-/* High priority task for receiving RM packets */
-Task_Handle rmReceiveTskHandle;
-/* RM client delegate and client test task */
-Task_Handle rmClientTskHandle;
-
-/* Handle for heap that RM packets will be allocated from */
-HeapBufMP_Handle rmPktHeapHandle = NULL;
-
-/* Client instance name (must match with RM Global Resource List (GRL) and policies */
-char rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
-
-/* Client MessageQ */
-MessageQ_Handle rmClientQ = NULL;
-
-/* Linux MessageQ ID */
-MessageQ_QueueId linuxQueueId;
-
-/* Client instance handles */
-Rm_Handle rmClientHandle = NULL;
-
-/* Client instance service handles */
-Rm_ServiceHandle *rmClientServiceHandle = NULL;
-
-/* Client from Server transport handle */
-Rm_TransportHandle clientFromServerTransportHandle;
-
-/* Static allocation response queue */
-Rm_ServiceRespInfo staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
-/* Static allocation response queue index */
-uint32_t numStaticResponses;
-
-/* RM response info queue used to store service responses received via the callback function */
-Rm_ServiceRespInfo responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
-
-/* RM resource names (must match resource node names in GRL and policies */
-char resourceNameMemRegion[RM_NAME_MAX_CHARS] = "memory-regions";
-char resourceNameAccumCh[RM_NAME_MAX_CHARS] = "accumulator-ch";
-char resourceNameGpQ[RM_NAME_MAX_CHARS] = "gp-queue";
-char resourceNameAifQ[RM_NAME_MAX_CHARS] = "aif-queue";
-char resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
-char resourceNameAifRxCh[RM_NAME_MAX_CHARS] = "aif-rx-ch";
-char resourceNameInfraQ[RM_NAME_MAX_CHARS] = "infra-queue";
-
-/* Test RM NameServer name */
-char nameServerNameFavQ[RM_NAME_MAX_CHARS] = "My_Favorite_Queue";
-
-/**********************************************************************
- *************************** Test Functions ***************************
- **********************************************************************/
-
-Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
-{
- Rm_Packet *rmPkt = NULL;
- MsgQ_RmPacket *rmMsg = NULL;
-
- /* Allocate a messageQ message for containing the RM packet */
- rmMsg = (MsgQ_RmPacket *)MessageQ_alloc(MSGQ_HEAP_ID, sizeof(MsgQ_RmPacket));
- if (rmMsg == NULL) {
- System_printf("Error Core %d : MessageQ_alloc failed to allocate message: %d\n", coreNum);
- testErrors++;
- *pktHandle = NULL;
- return(NULL);
- }
- else {
- rmPkt = &(rmMsg->rmPkt);
- rmPkt->pktLenBytes = pktSize;
- *pktHandle = (Rm_PacketHandle)rmMsg;
- }
- return (rmPkt);
-}
-
-void transportFree (MessageQ_Msg rmMsgQMsg)
-{
- int32_t status;
-
- status = MessageQ_free(rmMsgQMsg);
- if (status < 0) {
- System_printf("Error Core %d : MessageQ_free failed to free message: %d\n", coreNum, status);
- testErrors++;
- }
-}
-
-int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
-{
- MessageQ_QueueId *remoteQueueId = (MessageQ_QueueId *)appTransport;
- MsgQ_RmPacket *rmMsg = pktHandle;
- int32_t status;
-
- /* Send the message to Linux */
- status = MessageQ_put(*remoteQueueId, (MessageQ_Msg)rmMsg);
- if (status < 0) {
- System_printf("Error Core %d : MessageQ_put failed to send message: %d\n", coreNum, status);
- testErrors++;
- }
-
- return (0);
-}
-
-void transportReceive (void)
-{
- int32_t numPkts;
- MessageQ_Msg rmMsg = NULL;
- Rm_Packet *rmPkt = NULL;
- int32_t status;
- uint32_t i;
-
- /* Check if any packets available */
- numPkts = (int32_t) MessageQ_count(rmClientQ);
-
- /* Process all available packets */
- for (i = 0; i < numPkts; i++) {
- status = (int32_t) MessageQ_get(rmClientQ, &rmMsg, MessageQ_FOREVER);
- if (rmMsg == NULL) {
- System_printf("Error Core %d : MessageQ_get failed, returning a NULL packet\n", coreNum);
- testErrors++;
- }
-
- /* Extract the Rm_Packet from the RM msg */
- rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
-
- /* Provide packet to RM for processing */
- if (status = Rm_receivePacket(clientFromServerTransportHandle, rmPkt)) {
- System_printf("Error Core %d : RM failed to process received packet: %d\n", coreNum, status);
- testErrors++;
- }
-
- /* Free RM packet buffer and messageQ message */
- transportFree(rmMsg);
- }
-}
-
-void serviceCallback(Rm_ServiceRespInfo *serviceResponse)
-{
- uint32_t qIndex = 0;
-
- /* Populate next free entry in the responseInfoQueue */
- while (responseInfoQueue[qIndex].serviceId != 0) {
- qIndex++;
- if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
- qIndex = 0;
- }
- }
-
- /* Save the response in the response queue for the test task to pick up */
- memcpy((void *)&responseInfoQueue[qIndex], (void *)serviceResponse, sizeof(Rm_ServiceRespInfo));
-}
-
-/* Packets received via rpmsg port will issue callback vai transportReceive function */
-void waitForResponse(Rm_ServiceRespInfo *respInfo)
-{
- uint32_t qIndex = 0;
-
- if ((respInfo->serviceState == RM_SERVICE_PROCESSING) ||
- (respInfo->serviceState == RM_SERVICE_PENDING_SERVER_RESPONSE)) {
- /* Scan responseInfoQueue for the response received via the callback function */
- while((responseInfoQueue[qIndex].serviceId != respInfo->serviceId) ||
- (responseInfoQueue[qIndex].rmHandle != respInfo->rmHandle)) {
- qIndex++;
- if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
- qIndex = 0;
- }
-
- /* Higher priority receive task will retrieve response */
- }
-
- memcpy((void *)respInfo, (void *)&responseInfoQueue[qIndex], sizeof(Rm_ServiceRespInfo));
- memset((void *)&responseInfoQueue[qIndex], 0, sizeof(Rm_ServiceRespInfo));
- }
-}
-
-void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *resName, int32_t resBase,
- uint32_t resLen, int32_t resAlign, const char *nsName, int setCallback, Rm_ServiceRespInfo *respInfo)
-{
- memset((void *)reqInfo, 0, sizeof(Rm_ServiceReqInfo));
- reqInfo->type = type;
- reqInfo->resourceName = resName;
- reqInfo->resourceBase = resBase;
- reqInfo->resourceLength = resLen;
- reqInfo->resourceAlignment = resAlign;
- reqInfo->resourceNsName = nsName;
- if (setCallback) {
- reqInfo->callback.serviceCallback = serviceCallback;
- }
- memset((void *)respInfo, 0, sizeof(Rm_ServiceRespInfo));
-}
-
-void rmCleanupTsk(UArg arg0, UArg arg1)
-{
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- int32_t result;
- int32_t finalMallocFree;
-
- /* Free all allocated resources */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh,
- 0, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh,
- 40, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster,
- 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster,
- 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameInfraQ,
- 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
- result = Rm_serviceCloseHandle(rmClientServiceHandle);
- ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed");
-
- result = Rm_transportUnregister(clientFromServerTransportHandle);
- ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of Server transport failed");
-
- result = MessageQ_delete(&rmClientQ);
- if (result < 0) {
- System_printf("Core %d : Error in MessageQ_delete [%d]\n", coreNum, result);
- testErrors++;
- }
-
- result = Rm_delete(rmClientHandle, RM_TEST_TRUE);
- ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed");
-
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum);
- System_printf ("Core %d : - : malloc count | free count -\n", coreNum);
- System_printf ("Core %d : - Example Completion : %6d | %6d -\n", coreNum,
- rmMallocCounter, rmFreeCounter);
- finalMallocFree = rmMallocCounter - rmFreeCounter;
- if (finalMallocFree > 0) {
- System_printf ("Core %d : - FAILED - %6d unfreed mallocs -\n",
- coreNum, finalMallocFree);
- testErrors++;
- }
- else if (finalMallocFree < 0) {
- System_printf ("Core %d : - FAILED - %6d more frees than mallocs -\n",
- coreNum, -finalMallocFree);
- testErrors++;
- }
- else {
- System_printf ("Core %d : - PASSED -\n",
- coreNum);
- }
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("\n");
-
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("Core %d : ------------------ Example Completion -------------------\n", coreNum);
- if (testErrors) {
- System_printf ("Core %d : - Test Errors: %-32d -\n", coreNum, testErrors);
- }
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("\n");
-}
-
-/* Receive task has priority of 2 so that it pre-empts the RM instance test tasks */
-void rmReceiveTsk(UArg arg0, UArg arg1)
-{
- while(1) {
- transportReceive();
- /* Sleep for 1ms so that the main test tasks can run */
- Task_sleep(1);
- }
-}
-
-void rmClientTsk(UArg arg0, UArg arg1)
-{
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- Task_Params taskParams;
- uint32_t i, j;
-
- /* Create new NameServer object */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ,
- 1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--------------- Create NameServer Object ----------------",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Retrieve a resource via a NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("------- Retrieve Resource Via NameServer Object ---------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Allocate the resource returned from the NameServer request */
- memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo));
- requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
- requestInfo.resourceName = responseInfo.resourceName;
- requestInfo.resourceBase = responseInfo.resourceBase;
- requestInfo.resourceLength = responseInfo.resourceLength;
- requestInfo.resourceNsName = NULL;
- requestInfo.callback.serviceCallback = serviceCallback;
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------- Init Allocate Using Retrieved Resource ---------",
- coreNum, rmClientName, responseInfo.resourceName,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Retrieve the resource status via the NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("---- Retrieve Resource Status Via NameServer Object -----",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
-
- /* Free resource via a NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--- Free of Retrieved Resource Using NameServer Name ----",
- coreNum, rmClientName, nameServerNameFavQ,
- 0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Delete the NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--------------- Delete NameServer Object ----------------",
- coreNum, rmClientName, nameServerNameFavQ,
- 0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --",
- coreNum, rmClientName, resourceNameAifRxCh,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh,
- 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Init Allocate) -",
- coreNum, rmClientName, resourceNameAifRxCh,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
-
- /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---- Use Allocation w/ UNSPECIFIED Base & Alignment -----",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- RM_RESOURCE_ALIGNMENT_UNSPECIFIED, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END testing allocations with UNSPECIFIED base and alignment values */
-
- /* Allocate infrastructure queue shared between Linux kernel and Client */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ,
- 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Init Allocation of Shared Linux and Client Resource --",
- coreNum, rmClientName, resourceNameInfraQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* BEGIN Allocating some resources without providing a callback function. RM should block and not return until the result
- * is returned by the server. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Init Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Init allocation of resource already owned by Client should return approved and there should only
- * be one instance of Client in resource's owner list. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("----- Use Allocation of Owned Resource (RM Blocked) -----",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END Allocating some resources without providing a callback function. RM should block and not return
- * until the result is returned by the Server. */
-
- /* BEGIN Getting the status of resources from Client and CD */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ,
- 7012, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("-- Status Check of Resources from Client (Non-Blocking) -",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ,
- 4025, 20, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("---- Status Check of Resources from Client (Blocking) ---",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
- /* END Getting the status of resources from Client and CD */
-
- /* Verify static allocations were validated. Validation responses should have been received after the
- * first service requests were made on the Client and CD post transport path registration. */
- while (numStaticResponses > 0) {
- /* Loop until all static request validations have been received */
- for (i = 0; i < MAX_STATIC_ALLOCATION_RESPS; i++) {
- if (staticResponseQueue[i].serviceId != 0) {
- for (j = 0; j < MAX_QUEUED_SERVICE_RESPONSES; j++) {
- if ((staticResponseQueue[i].serviceId == responseInfoQueue[j].serviceId) &&
- (staticResponseQueue[i].rmHandle == responseInfoQueue[j].rmHandle)) {
- POSITIVE_PASS_CHECK("------------- Static Allocation Validation --------------",
- coreNum, rmClientName, responseInfoQueue[j].resourceName,
- responseInfoQueue[j].resourceBase, responseInfoQueue[j].resourceLength,
- 0, responseInfoQueue[j].serviceState,
- RM_SERVICE_APPROVED);
- memset((void *)&staticResponseQueue[i], 0, sizeof(Rm_ServiceRespInfo));
- memset((void *)&responseInfoQueue[j], 0, sizeof(Rm_ServiceRespInfo));
- numStaticResponses--;
- break;
- }
- }
- }
- }
- }
-
- /* Create the RM cleanup task. */
- System_printf("Core %d : Creating RM cleanup task...\n", coreNum);
- Task_Params_init (&taskParams);
- Task_create (rmCleanupTsk, &taskParams, NULL);
-}
-
-void rmStartupTsk(UArg arg0, UArg arg1)
-{
- Task_Params taskParams;
- Char localQueueName[64];
- MessageQ_Msg msg;
- Rm_TransportCfg rmTransCfg;
- int32_t rm_result;
-
- /* Construct a MessageQ name adorned with core name: */
- System_sprintf(localQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
- MultiProc_getName(MultiProc_self()));
-
- rmClientQ = MessageQ_create(localQueueName, NULL);
- if (rmClientQ == NULL) {
- System_abort("MessageQ_create failed\n");
- }
-
- if (coreNum == TEST_CORE) {
- System_printf("Awaiting sync message from host...\n");
- MessageQ_get(rmClientQ, &msg, MessageQ_FOREVER);
-
- linuxQueueId = MessageQ_getReplyQueue(msg);
- MessageQ_put(linuxQueueId, msg);
-
- /* Register the Server with the Client instance */
- rmTransCfg.rmHandle = rmClientHandle;
- rmTransCfg.appTransportHandle = (Rm_AppTransportHandle) &linuxQueueId;
- rmTransCfg.remoteInstType = Rm_instType_SERVER;
- rmTransCfg.transportCallouts.rmAllocPkt = transportAlloc;
- rmTransCfg.transportCallouts.rmSendPkt = transportSend;
- clientFromServerTransportHandle = Rm_transportRegister(&rmTransCfg, &rm_result);
-
- /* Create the RM receive task. Assign higher priority than the test tasks so that
- * when they spin waiting for messages from other RM instances the receive task is
- * executed. */
- System_printf("Core %d : Creating RM receive task...\n", coreNum);
- Task_Params_init (&taskParams);
- taskParams.priority = 2;
- rmReceiveTskHandle = Task_create (rmReceiveTsk, &taskParams, NULL);
-
- System_printf("Core %d : Creating RM client task...\n", coreNum);
- Task_Params_init (&taskParams);
- taskParams.priority = 1;
- rmClientTskHandle = Task_create (rmClientTsk, &taskParams, NULL);
- }
-}
-
-int main(int argc, char *argv[])
-{
- Task_Params taskParams;
- Rm_InitCfg rmInitCfg;
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- int32_t result;
-
-
- System_printf ("*********************************************************\n");
- System_printf ("************ RM DSP+ARM DSP Client Testing **************\n");
- System_printf ("*********************************************************\n");
-
- System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
-
- coreNum = CSL_chipReadReg(CSL_CHIP_DNUM);
-
- if (coreNum == TEST_CORE) {
- testErrors = 0;
-
- /* Initialize the RM Client - RM must be initialized before anything else in the system */
- memset(&rmInitCfg, 0, sizeof(rmInitCfg));
- rmInitCfg.instName = rmClientName;
- rmInitCfg.instType = Rm_instType_CLIENT;
- rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmStaticPolicy;
- rmClientHandle = Rm_init(&rmInitCfg, &result);
- ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed");
-
- System_printf("\n\nInitialized %s\n\n", rmClientName);
-
- /* Open Client service handle */
- rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
- ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed");
-
- /* Initialize the static allocation response queue */
- for (numStaticResponses = 0; numStaticResponses < MAX_STATIC_ALLOCATION_RESPS; numStaticResponses++) {
- memset((void *)&staticResponseQueue[numStaticResponses], 0, sizeof(Rm_ServiceRespInfo));
- }
- numStaticResponses = 0;
-
- /* Static allocation tests */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- /* Request resource from Client that can only be allocated to CD according to static policy */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- NEGATIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
-
- /* Request resource from both Client and CD that is shared according to static policy */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameAifQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameAifQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- }
- else {
- System_printf("Core %d : RM DSP+ARM Linux test not executing on this core\n", coreNum);
- }
-
- /* Create the RM startup task */
- System_printf("Core %d : Creating RM startup task...\n", coreNum);
- Task_Params_init (&taskParams);
- rmStartupTskHandle = Task_create (rmStartupTsk, &taskParams, NULL);
-
- System_printf("Core %d : Starting BIOS...\n", coreNum);
- BIOS_start();
-
- return (0);
-}
-
diff --git a/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg b/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-xdc.loadCapsule("dsp_client.cfg.xs");
-
-var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
-
-var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
-MessageQ.SetupTransportProxy = VirtioSetup;
-
-var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
-var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
-NameServer.SetupProxy = NsRemote;
-
-var TransportRpmsg = xdc.useModule('ti.ipc.transports.TransportRpmsg');
-
diff --git a/test/k2h/armv7/linux/rm_dsp_client_test.c b/test/k2h/armv7/linux/rm_dsp_client_test.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * ======== rm_dsp_client_test.c ========
- *
- * Works with the dspClientTest DSP application over the rpmsg-proto socket.
- */
-
-/* Standard headers */
-#include <stdio.h>
-#include <stdlib.h>
-
-/* IPC Headers */
-#include <ti/ipc/Std.h>
-#include <ti/ipc/Ipc.h>
-#include <ti/ipc/MessageQ.h>
-
-/* Socket Includes */
-#include "sockutils.h"
-#include "sockrmmsg.h"
-
-/* RM includes */
-#include <ti/drv/rm/rm_transport.h>
-
-/* App defines: Must match on remote proc side: */
-#define HEAPID 0u
-#define CLIENT_MESSAGEQ_NAME "RM_CLIENT"
-#define SERVER_MESSAGEQ_NAME "RM_SERVER"
-
-#define PROC_ID_DEFAULT 1 /* Host is zero, remote cores start at 1 */
-
-/* IPC MessageQ RM packet encapsulation structure */
-typedef struct {
- /* IPC MessageQ header (must be first element in structure) */
- MessageQ_MsgHeader msgQHeader;
- /* Pointer to RM packet */
- Rm_Packet rmPkt;
-} MsgQ_RmPacket;
-
-Int rmServerExchange_execute(UInt16 procId)
-{
- int32_t status = 0;
- int err;
- MessageQ_Msg msg = NULL;
- MessageQ_Params msgParams;
- MessageQ_QueueId queueId = MessageQ_INVALIDMESSAGEQ;
- MessageQ_Handle msgqHandle;
- char remoteQueueName[64];
- MessageQ_Msg rmMsg;
- Rm_Packet *rmPkt;
- int rm_pkt_len;
- sock_h sock_to_server;
- sock_name_t local_sock_name;
- sock_name_t server_sock;
- sock_name_t server_sock_addr;
- struct sockaddr_un server_addr;
- char client_ex_sock_name[] = "/tmp/var/run/rm/rm_dsp_client_exchange";
- char server_sock_name[] = RM_SERVER_SOCKET_NAME;
-
- printf("Entered rmServerExchange_execute\n");
-
- /* Create the local Message Queue for receiving from DSP Client. */
- MessageQ_Params_init(&msgParams);
- msgqHandle = MessageQ_create(SERVER_MESSAGEQ_NAME, &msgParams);
- if (msgqHandle == NULL) {
- printf("Error in MessageQ_create\n");
- goto exit;
- }
- else {
- printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
- }
-
- sprintf(remoteQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
- MultiProc_getName(procId));
-
- /* Poll until remote side has it's messageQ created before we send: */
- do {
- status = MessageQ_open(remoteQueueName, &queueId);
- sleep (1);
- } while (status == MessageQ_E_NOTFOUND);
-
- if (status < 0) {
- printf("Error in MessageQ_open [%d]\n", status);
- goto cleanup;
- }
- else {
- printf("Remote queueId [0x%x]\n", queueId);
- }
-
- msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
- if (msg == NULL) {
- printf("Error in MessageQ_alloc\n");
- MessageQ_close(&queueId);
- goto cleanup;
- }
-
- /* handshake with DSP client so that it knows Linux's receive Q */
- MessageQ_setReplyQueue(msgqHandle, msg);
- MessageQ_put(queueId, msg);
- MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
- MessageQ_free(msg);
-
- printf("Setting up socket connection with RM Server\n");
-
- /* open local sock for communication to RM Server */
- local_sock_name.type = sock_name_e;
- local_sock_name.s.name = client_ex_sock_name;
- sock_to_server = sock_open(&local_sock_name);
- if (!sock_to_server) {
- printf("Local socket to RM Server open failed\n");
- return -1;
- }
- /* RM Server sock */
- server_sock.type = sock_name_e;
- server_sock.s.name = server_sock_name;
-
- printf("Waiting for RM messages from DSP Client\n");
-
- while(1) {
- status = MessageQ_get(msgqHandle, &rmMsg, MessageQ_FOREVER);
- if (status < 0) {
- printf("Error in MessageQ_get [%d]\n", status);
- break;
- }
-
- rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
- printf("Received RM pkt of size %d from DSP client\n", rmPkt->pktLenBytes);
-
- /* Send received data to RM Server */
- if (sock_send(sock_to_server, (char *)rmPkt, sizeof(*rmPkt), &server_sock)) {
- printf("Failed to send data to RM Server\n");
- }
-
- /* Wait for response from RM Server */
- rm_pkt_len = 0;
- err = sock_wait(sock_to_server, &rm_pkt_len, NULL, -1);
- if (err == -2) {
- /* Timeout */
- printf("Error socket timeout\n");
- return -1;
- }
- else if (err < 0) {
- printf("Error in reading from socket, error %d\n", err);
- return -1;
- }
-
- server_sock_addr.type = sock_addr_e;
- server_sock_addr.s.addr = &server_addr;
- err = sock_recv(sock_to_server, (char *)rmPkt, rm_pkt_len, &server_sock_addr);
- if (err != rm_pkt_len) {
- printf("recv RM pkt failed from socket, received = %d, expected = %d\n",
- err, rm_pkt_len);
- return;
- }
-
- /* send back to DSP */
- status = MessageQ_put(queueId, rmMsg);
- if (status < 0) {
- printf("Error in MessageQ_put [%d]\n", status);
- break;
- }
- }
-
-cleanup:
- /* Clean-up */
- status = MessageQ_delete(&msgqHandle);
- if (status < 0) {
- printf("Error in MessageQ_delete [%d]\n", status);
- }
-
-exit:
- printf("Leaving rmServerExchange_execute\n\n");
-
- return 0;
-}
-
-int main (int argc, char ** argv)
-{
- Int32 status = 0;
- UInt16 procId = PROC_ID_DEFAULT;
-
- /* Parse Args: */
- switch (argc) {
- case 1:
- /* use defaults */
- break;
- case 2:
- procId = atoi(argv[2]);
- break;
- default:
- printf("Usage: %s [<ProcId>]\n", argv[0]);
- printf("\tDefaults: ProcId: %d\n", PROC_ID_DEFAULT);
- exit(0);
- }
-
- status = Ipc_start();
-
- if (procId >= MultiProc_getNumProcessors()) {
- printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
- Ipc_stop();
- exit(0);
- }
- printf("Using procId : %d\n", procId);
-
- if (status >= 0) {
- rmServerExchange_execute(procId);
- Ipc_stop();
- }
- else {
- printf("Ipc_start failed: status = %d\n", status);
- }
-
- return(0);
-}
diff --git a/test/k2h/armv7/linux/rm_linux_client_test.c b/test/k2h/armv7/linux/rm_linux_client_test.c
+++ /dev/null
@@ -1,987 +0,0 @@
-/*
- * rm_linux_client_test.c
- *
- * Multi-process Resource Manager test that uses sockets to allow a Linux
- * User-space application to request RM services from a RM Server,
- * Client Delegate, and Client.
- *
- * ============================================================================
- *
- * 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.
- *
- */
-
- /* Standard includes */
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-/* Socket Includes */
-#include "sockutils.h"
-#include "sockrmmsg.h"
-
-/* RM Includes */
-#include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_transport.h>
-#include <ti/drv/rm/rm_services.h>
-
-/**********************************************************************
- ************************** RM Test Symbols ***************************
- **********************************************************************/
-
-#define error_msg printf
-#define info_msg printf
-
-/* Test FALSE */
-#define RM_TEST_FALSE 0
-/* Test TRUE */
-#define RM_TEST_TRUE 1
-
-/* Socket timeout */
-#define CLIENT_SOCK_TIMEOUT_USEC (500)
-
-/* Application's registered RM transport indices */
-#define SERVER_TO_CLIENT_MAP_ENTRY 0
-/* Maximum number of registered RM transports */
-#define MAX_MAPPING_ENTRIES 1
-
-/* Size of RM static allocation response queue. Must be greater than number of APPROVED
- * static allocations */
-#define MAX_STATIC_ALLOCATION_RESPS 5
-
-/* Size of RM service response queue */
-#define MAX_QUEUED_SERVICE_RESPONSES 10
-
-/* Error checking macro */
-#define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg) \
- if (resultVal != checkVal) { \
- char errorMsgToPrint[] = printMsg; \
- printf("Error Core %d : %s : ", coreNum, rmInstName); \
- printf("%s with error code : %d\n", errorMsgToPrint, resultVal); \
- testErrors++; \
- }
-
-#define POSITIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("Core %d : %s\n", core, titleMsg); \
- printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- printf ("Core %d : - -\n", \
- core); \
- if (state == check) { \
- printf ("Core %d : - PASSED -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- testErrors++; \
- } \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("\n"); \
- } while(0);
-
-#define NEGATIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("Core %d : %s\n", core, titleMsg); \
- printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- printf ("Core %d : - -\n", \
- core); \
- if (state != check) { \
- printf ("Core %d : - PASSED - Denial: %-6d -\n", \
- core, state); \
- } \
- else { \
- printf ("Core %d : - FAILED - Expected Denial -\n", \
- core); \
- testErrors++; \
- } \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("\n"); \
- } while(0);
-
-#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
- do { \
- int32_t start = resStart; \
- char titleMsg[] = title; \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("Core %d : %s\n", core, titleMsg); \
- printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- printf ("Core %d : - Expected Owner Count: %-16d -\n", \
- core, expectRefCnt); \
- printf ("Core %d : - Returned Owner Count: %-16d -\n", \
- core, refCnt); \
- printf ("Core %d : - -\n", core); \
- if ((state == check) && (refCnt == expectRefCnt)) { \
- printf ("Core %d : - PASSED -\n", core); \
- } \
- else { \
- if (refCnt != expectRefCnt) { \
- printf ("Core %d : - FAILED - Owner Count Mismatch -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- } \
- testErrors++; \
- } \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("\n"); \
- } while(0);
-
-/**********************************************************************
- ********************** RM Test Data Structures ***********************
- **********************************************************************/
-
-/* RM registered transport mapping structure */
-typedef struct trans_map_entry_s {
- /* Registered RM transport handle */
- Rm_TransportHandle transportHandle;
- /* Remote socket tied to the transport handle */
- sock_name_t *remote_sock;
-} Transport_MapEntry;
-
-/**********************************************************************
- ********************** Extern Variables ******************************
- **********************************************************************/
-
-/* Alloc and free OSAL variables */
-extern uint32_t rmMallocCounter;
-extern uint32_t rmFreeCounter;
-
-/**********************************************************************
- ********************** Global Variables ******************************
- **********************************************************************/
-
-/* Core number */
-uint16_t coreNum;
-/* Number of errors that occurred during the test */
-uint16_t testErrors;
-
-/* Client instance name (must match with RM Global Resource List (GRL) and policies */
-char rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
-
-/* Client socket name */
-char rmClientSockName[] = "/tmp/var/run/rm/rm_client";
-
-/* Client socket handle */
-sock_h rmClientSocket;
-
-/* Client instance handles */
-Rm_Handle rmClientHandle = NULL;
-
-/* Client instance service handles */
-Rm_ServiceHandle *rmClientServiceHandle = NULL;
-
-/* Transport map stores the RM transport handle to IPC MessageQ queue mapping */
-Transport_MapEntry rmTransportMap[MAX_MAPPING_ENTRIES];
-
-/* Static allocation response queue */
-Rm_ServiceRespInfo staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
-/* Static allocation response queue index */
-uint32_t numStaticResponses;
-
-/* RM response info queue used to store service responses received via the callback function */
-Rm_ServiceRespInfo responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
-
-/* RM resource names (must match resource node names in GRL and policies */
-char resourceNameMemRegion[RM_NAME_MAX_CHARS] = "memory-regions";
-char resourceNameAccumCh[RM_NAME_MAX_CHARS] = "accumulator-ch";
-char resourceNameGpQ[RM_NAME_MAX_CHARS] = "gp-queue";
-char resourceNameAifQ[RM_NAME_MAX_CHARS] = "aif-queue";
-char resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
-char resourceNameAifRxCh[RM_NAME_MAX_CHARS] = "aif-rx-ch";
-char resourceNameInfraQ[RM_NAME_MAX_CHARS] = "infra-queue";
-
-/* Test RM NameServer name */
-char nameServerNameFavQ[RM_NAME_MAX_CHARS] = "My_Favorite_Queue";
-
-/**********************************************************************
- *************************** Test Functions ***************************
- **********************************************************************/
-
-Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
-{
- Rm_Packet *rm_pkt = NULL;
-
- rm_pkt = calloc(1, sizeof(*rm_pkt));
- if (!rm_pkt) {
- error_msg("can't malloc for RM send message (err: %s)\n",
- strerror(errno));
- return (NULL);
- }
- rm_pkt->pktLenBytes = pktSize;
- *pktHandle = rm_pkt;
-
- return(rm_pkt);
-}
-
-void transportFree (Rm_Packet *rm_pkt)
-{
- uint32_t pkt_size = rm_pkt->pktLenBytes;
- int32_t status;
-
- if (rm_pkt) {
- free (rm_pkt);
- }
-}
-
-int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
-{
- sock_name_t *server_sock_name = (sock_name_t *)appTransport;
- Rm_Packet *rm_pkt = (Rm_Packet *)pktHandle;
-
- if (sock_send(rmClientSocket, (char *)rm_pkt, (int) rm_pkt->pktLenBytes, server_sock_name)) {
- error_msg("send data failed\n");
- }
-
- return (0);
-}
-
-void transportReceive (void)
-{
- int32_t rm_result;
- int retval;
- int length = 0;
- sock_name_t serv_sock_name;
- sock_name_t server_sock_addr;
- Rm_Packet *rm_pkt = NULL;
- struct timeval tv = {0, CLIENT_SOCK_TIMEOUT_USEC};
- struct sockaddr_un server_addr;
-
- retval = sock_wait(rmClientSocket, &length, &tv, -1);
- if (retval == -2) {
- /* Timeout */
- return;
- }
- else if (retval < 0) {
- error_msg("Error in reading from socket, error %d\n", retval);
- return;
- }
-
- if (length < sizeof(*rm_pkt)) {
- error_msg("invalid RM message length %d\n", length);
- return;
- }
- rm_pkt = calloc(1, length);
- if (!rm_pkt) {
- error_msg("can't malloc for recv'd RM message (err: %s)\n",
- strerror(errno));
- return;
- }
-
- server_sock_addr.type = sock_addr_e;
- server_sock_addr.s.addr = &server_addr;
- retval = sock_recv(rmClientSocket, (char *)rm_pkt, length, &server_sock_addr);
- if (retval != length) {
- error_msg("recv RM pkt failed from socket, received = %d, expected = %d\n",
- retval, length);
- return;
- }
-
- info_msg("received RM pkt of size %d bytes from %s\n", length, server_sock_addr.s.addr->sun_path);
-
- /* Provide packet to RM Server for processing */
- if (rm_result = Rm_receivePacket(rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].transportHandle, rm_pkt)) {
- printf("RM failed to process received packet: %d\n", rm_result);
- }
-
- transportFree(rm_pkt);
-}
-
-
-void serviceCallback(Rm_ServiceRespInfo *serviceResponse)
-{
- uint32_t qIndex = 0;
-
- /* Populate next free entry in the responseInfoQueue */
- while (responseInfoQueue[qIndex].serviceId != 0) {
- qIndex++;
- if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
- qIndex = 0;
- }
- }
-
- /* Save the response in the response queue for the test task to pick up */
- memcpy((void *)&responseInfoQueue[qIndex], (void *)serviceResponse, sizeof(Rm_ServiceRespInfo));
-}
-
-void waitForResponse(Rm_ServiceRespInfo *respInfo)
-{
- uint32_t qIndex = 0;
-
- if ((respInfo->serviceState == RM_SERVICE_PROCESSING) ||
- (respInfo->serviceState == RM_SERVICE_PENDING_SERVER_RESPONSE)) {
- /* Scan responseInfoQueue for the response received via the callback function */
- while((responseInfoQueue[qIndex].serviceId != respInfo->serviceId) ||
- (responseInfoQueue[qIndex].rmHandle != respInfo->rmHandle)) {
- /* Check socket for response packets */
- transportReceive();
-
- qIndex++;
- if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
- qIndex = 0;
- }
- }
-
- memcpy((void *)respInfo, (void *)&responseInfoQueue[qIndex], sizeof(Rm_ServiceRespInfo));
- memset((void *)&responseInfoQueue[qIndex], 0, sizeof(Rm_ServiceRespInfo));
- }
-}
-
-void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *resName, int32_t resBase,
- uint32_t resLen, int32_t resAlign, const char *nsName, int setCallback, Rm_ServiceRespInfo *respInfo)
-{
- memset((void *)reqInfo, 0, sizeof(Rm_ServiceReqInfo));
- reqInfo->type = type;
- reqInfo->resourceName = resName;
- reqInfo->resourceBase = resBase;
- reqInfo->resourceLength = resLen;
- reqInfo->resourceAlignment = resAlign;
- reqInfo->resourceNsName = nsName;
- if (setCallback) {
- reqInfo->callback.serviceCallback = serviceCallback;
- }
- memset((void *)respInfo, 0, sizeof(Rm_ServiceRespInfo));
-}
-
-void cleanup(void)
-{
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- int32_t result;
- int32_t finalMallocFree;
-
- /* Free all allocated resources */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh,
- 0, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh,
- 40, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster,
- 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster,
- 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameInfraQ,
- 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
- result = Rm_serviceCloseHandle(rmClientServiceHandle);
- ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed");
-
- result = Rm_transportUnregister(rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].transportHandle);
- ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of Server transport failed");
-
- sock_close(rmClientSocket);
-
- result = Rm_delete(rmClientHandle, RM_TEST_TRUE);
- ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed");
-
- printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- printf ("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum);
- printf ("Core %d : - : malloc count | free count -\n", coreNum);
- printf ("Core %d : - Example Completion : %6d | %6d -\n", coreNum,
- rmMallocCounter, rmFreeCounter);
- finalMallocFree = rmMallocCounter - rmFreeCounter;
- if (finalMallocFree > 0) {
- printf ("Core %d : - FAILED - %6d unfreed mallocs -\n",
- coreNum, finalMallocFree);
- testErrors++;
- }
- else if (finalMallocFree < 0) {
- printf ("Core %d : - FAILED - %6d more frees than mallocs -\n",
- coreNum, -finalMallocFree);
- testErrors++;
- }
- else {
- printf ("Core %d : - PASSED -\n",
- coreNum);
- }
- printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- printf ("\n");
-
- printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- printf ("Core %d : ------------------ Example Completion -------------------\n", coreNum);
- if (testErrors) {
- printf ("Core %d : - Test Errors: %-32d -\n", coreNum, testErrors);
- }
- printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- printf ("\n");
-}
-
-void client_test(void)
-{
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- uint32_t i, j;
-
- /* Create new NameServer object */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ,
- 1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--------------- Create NameServer Object ----------------",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Retrieve a resource via a NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("------- Retrieve Resource Via NameServer Object ---------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Allocate the resource returned from the NameServer request */
- memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo));
- requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
- requestInfo.resourceName = responseInfo.resourceName;
- requestInfo.resourceBase = responseInfo.resourceBase;
- requestInfo.resourceLength = responseInfo.resourceLength;
- requestInfo.resourceNsName = NULL;
- requestInfo.callback.serviceCallback = serviceCallback;
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------- Init Allocate Using Retrieved Resource ---------",
- coreNum, rmClientName, responseInfo.resourceName,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Retrieve the resource status via the NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("---- Retrieve Resource Status Via NameServer Object -----",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
-
- /* Free resource via a NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--- Free of Retrieved Resource Using NameServer Name ----",
- coreNum, rmClientName, nameServerNameFavQ,
- 0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Delete the NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--------------- Delete NameServer Object ----------------",
- coreNum, rmClientName, nameServerNameFavQ,
- 0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --",
- coreNum, rmClientName, resourceNameAifRxCh,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh,
- 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Init Allocate) -",
- coreNum, rmClientName, resourceNameAifRxCh,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
-
- /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---- Use Allocation w/ UNSPECIFIED Base & Alignment -----",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- RM_RESOURCE_ALIGNMENT_UNSPECIFIED, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END testing allocations with UNSPECIFIED base and alignment values */
-
- /* Allocate infrastructure queue shared between Linux kernel and Client */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ,
- 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Init Allocation of Shared Linux and Client Resource --",
- coreNum, rmClientName, resourceNameInfraQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* BEGIN Allocating some resources without providing a callback function. RM should block and not return until the result
- * is returned by the server. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Init Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Init allocation of resource already owned by Client should return approved and there should only
- * be one instance of Client in resource's owner list. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("----- Use Allocation of Owned Resource (RM Blocked) -----",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END Allocating some resources without providing a callback function. RM should block and not return
- * until the result is returned by the Server. */
-
- /* BEGIN Getting the status of resources from Client and CD */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ,
- 7012, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("-- Status Check of Resources from Client (Non-Blocking) -",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ,
- 4025, 20, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("---- Status Check of Resources from Client (Blocking) ---",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
- /* END Getting the status of resources from Client and CD */
-
- /* Verify static allocations were validated. Validation responses should have been received after the
- * first service requests were made on the Client and CD post transport path registration. */
- while (numStaticResponses > 0) {
- /* Loop until all static request validations have been received */
- for (i = 0; i < MAX_STATIC_ALLOCATION_RESPS; i++) {
- if (staticResponseQueue[i].serviceId != 0) {
- for (j = 0; j < MAX_QUEUED_SERVICE_RESPONSES; j++) {
- if ((staticResponseQueue[i].serviceId == responseInfoQueue[j].serviceId) &&
- (staticResponseQueue[i].rmHandle == responseInfoQueue[j].rmHandle)) {
- POSITIVE_PASS_CHECK("------------- Static Allocation Validation --------------",
- coreNum, rmClientName, responseInfoQueue[j].resourceName,
- responseInfoQueue[j].resourceBase, responseInfoQueue[j].resourceLength,
- 0, responseInfoQueue[j].serviceState,
- RM_SERVICE_APPROVED);
- memset((void *)&staticResponseQueue[i], 0, sizeof(Rm_ServiceRespInfo));
- memset((void *)&responseInfoQueue[j], 0, sizeof(Rm_ServiceRespInfo));
- numStaticResponses--;
- break;
- }
- }
- }
- }
- }
-}
-
-void connection_setup(void)
-{
- Rm_TransportCfg rmTransCfg;
- int32_t rm_result;
- int i;
- sock_name_t sock_name;
- int32_t result = 0;
- char server_sock_name[] = RM_SERVER_SOCKET_NAME;
-
- /* Initialize the transport map */
- for (i = 0; i < MAX_MAPPING_ENTRIES; i++) {
- rmTransportMap[i].transportHandle = NULL;
- }
-
- sock_name.type = sock_name_e;
- sock_name.s.name = rmClientSockName;
-
- rmClientSocket = sock_open(&sock_name);
- if (!rmClientSocket) {
- error_msg("Client socket open failed\n");
- exit(EXIT_FAILURE);
- }
-
- rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].remote_sock = calloc(1, sizeof(sock_name_t));
- rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].remote_sock->type = sock_name_e;
- rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].remote_sock->s.name = calloc(1, strlen(server_sock_name)+1);
- strncpy(rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].remote_sock->s.name, server_sock_name, strlen(server_sock_name)+1);
-
- /* Register the Server with the Client instance */
- rmTransCfg.rmHandle = rmClientHandle;
- rmTransCfg.appTransportHandle = (Rm_AppTransportHandle) rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].remote_sock;
- rmTransCfg.remoteInstType = Rm_instType_SERVER;
- rmTransCfg.transportCallouts.rmAllocPkt = transportAlloc;
- rmTransCfg.transportCallouts.rmSendPkt = transportSend;
- rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].transportHandle = Rm_transportRegister(&rmTransCfg, &rm_result);
-}
-
-int main(int argc, char *argv[])
-{
- int fd;
- struct stat file_stat;
- char *static_policy_addr = NULL;
- Rm_InitCfg rmInitCfg;
- int status;
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- int32_t result;
-
- printf ("*********************************************************\n");
- printf ("*************** RM Linux Client Testing *****************\n");
- printf ("*********************************************************\n");
-
- printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
-
- coreNum = 0;
- testErrors = 0;
-
- if (argc > 2)
- {
- error_msg("Invalid number of input arguments\n");
- exit(EXIT_FAILURE);
- }
-
- if (argc == 2){
- /* mmap static policy */
- fd = open(argv[1], O_RDONLY);
- if (fd == -1) {
- error_msg("Error opening static policy\n");
- exit(EXIT_FAILURE);
- }
- /* Obtain file size */
- if (fstat(fd, &file_stat) == -1) {
- error_msg("Error getting static policy size\n");
- exit(EXIT_FAILURE);
- }
- static_policy_addr = mmap(NULL, file_stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (static_policy_addr == MAP_FAILED) {
- error_msg("mmap of static failed\n");
- exit(EXIT_FAILURE);
- }
- }
-
- /* Initialize the RM Client - RM must be initialized before anything else in the system */
- memset(&rmInitCfg, 0, sizeof(rmInitCfg));
- rmInitCfg.instName = rmClientName;
- rmInitCfg.instType = Rm_instType_CLIENT;
- if (static_policy_addr) {
- rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)static_policy_addr;
- }
- rmClientHandle = Rm_init(&rmInitCfg, &result);
- ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed");
-
- printf("\n\nInitialized %s\n\n", rmClientName);
-
- /* Open Client service handle */
- rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
- ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed");
-
- /* Initialize the static allocation response queue */
- for (numStaticResponses = 0; numStaticResponses < MAX_STATIC_ALLOCATION_RESPS; numStaticResponses++) {
- memset((void *)&staticResponseQueue[numStaticResponses], 0, sizeof(Rm_ServiceRespInfo));
- }
- numStaticResponses = 0;
-
- /* Static allocation tests */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- /* Request resource from Client that can only be allocated to CD according to static policy */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- NEGATIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
-
- /* Request resource from both Client and CD that is shared according to static policy */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameAifQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameAifQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- connection_setup();
- client_test();
- cleanup();
-
- return (0);
-}
-
diff --git a/test/k2h/armv7/linux/rm_linux_osal.c b/test/k2h/armv7/linux/rm_linux_osal.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
- * @file rm_linux_osal.c
- *
- * @brief
- * This is the OS abstraction layer used by the Resource Manager in Linux.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
- *
- * 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.
- *
- * \par
-*/
-
-/* Standard Includes */
-#include <stdint.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-/**********************************************************************
- ****************************** Defines *******************************
- **********************************************************************/
-
-/**********************************************************************
- ************************** Global Variables **************************
- **********************************************************************/
-uint32_t rmMallocCounter = 0;
-uint32_t rmFreeCounter = 0;
-
-/**********************************************************************
- *************************** OSAL Functions **************************
- **********************************************************************/
-
-/* FUNCTION PURPOSE: Allocates memory
- ***********************************************************************
- * DESCRIPTION: The function is used to allocate a memory block of the
- * specified size.
- */
-void *Osal_rmMalloc (uint32_t num_bytes)
-{
- /* Increment the allocation counter. */
- rmMallocCounter++;
-
- /* Allocate memory. */
- return calloc(1, num_bytes);
-}
-
-/* FUNCTION PURPOSE: Frees memory
- ***********************************************************************
- * DESCRIPTION: The function is used to free a memory block of the
- * specified size.
- */
-void Osal_rmFree (void *ptr, uint32_t size)
-{
- /* Increment the free counter. */
- rmFreeCounter++;
- free(ptr);
-}
-
-/* FUNCTION PURPOSE: Critical section enter
- ***********************************************************************
- * DESCRIPTION: The function is used to enter a critical section.
- * Function protects against
- *
- * access from multiple cores
- * and
- * access from multiple threads on single core
- */
-void *Osal_rmCsEnter(void)
-{
- return NULL;
-}
-
-/* FUNCTION PURPOSE: Critical section exit
- ***********************************************************************
- * DESCRIPTION: The function is used to exit a critical section
- * protected using Osal_cppiCsEnter() API.
- */
-void Osal_rmCsExit(void *CsHandle)
-{
-
-}
-
-/* FUNCTION PURPOSE: Cache invalidate
- ***********************************************************************
- * DESCRIPTION: The function is used to indicate that a block of memory is
- * about to be accessed. If the memory block is cached then this
- * indicates that the application would need to ensure that the
- * cache is updated with the data from the actual memory.
- */
-void Osal_rmBeginMemAccess(void *ptr, uint32_t size)
-{
- return;
-}
-
-/* FUNCTION PURPOSE: Cache writeback
- ***********************************************************************
- * DESCRIPTION: The function is used to indicate that the block of memory has
- * finished being accessed. If the memory block is cached then the
- * application would need to ensure that the contents of the cache
- * are updated immediately to the actual memory.
- */
-void Osal_rmEndMemAccess(void *ptr, uint32_t size)
-{
- return;
-}
-
-/* FUNCTION PURPOSE: Creates a task blocking object
- ***********************************************************************
- * DESCRIPTION: The function is used to create a task blocking object
- * capable of blocking the task a RM instance is running
- * within
- */
-void *Osal_rmTaskBlockCreate(void)
-{
- return(NULL);
-}
-
-/* FUNCTION PURPOSE: Blocks a RM instance
- ***********************************************************************
- * DESCRIPTION: The function is used to block a task whose context a
- * RM instance is running within.
- */
-void Osal_rmTaskBlock(void *handle)
-{
-
-}
-
-/* FUNCTION PURPOSE: unBlocks a RM instance
- ***********************************************************************
- * DESCRIPTION: The function is used to unblock a task whose context a
- * RM instance is running within.
- */
-void Osal_rmTaskUnblock(void *handle)
-{
-
-}
-
-/* FUNCTION PURPOSE: Deletes a task blocking object
- ***********************************************************************
- * DESCRIPTION: The function is used to delete a task blocking object
- * provided to a RM instance
- */
-void Osal_rmTaskBlockDelete(void *handle)
-{
-
-}
-
-/* FUNCTION PURPOSE: Prints a variable list
- ***********************************************************************
- * DESCRIPTION: The function is used to print a string to the console
- */
-void Osal_rmLog (char *fmt, ... )
-{
- va_list ap;
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
-}
-
diff --git a/test/k2h/armv7/linux/rm_server.c b/test/k2h/armv7/linux/rm_server.c
+++ /dev/null
@@ -1,601 +0,0 @@
-/*
- * Copyright (C) 2013-2014 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Standard includes */
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <unistd.h>
-
-#include <libdaemon/daemon.h>
-
-/* Socket Includes */
-#include "serverlogutil.h"
-#include "sockutils.h"
-#include "sockrmmsg.h"
-
-/* RM includes */
-#include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_transport.h>
-
-#define RMSERVER_DAEMON_PID_FILE_NAME "/var/run/rmServer/pid"
-
-/* Error checking macro */
-#define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg) \
- if (resultVal != checkVal) { \
- char errorMsgToPrint[] = printMsg; \
- error_msg("%s : ", rmInstName); \
- error_msg("%s with error code : %d\n", errorMsgToPrint, resultVal); \
- exit(EXIT_FAILURE); \
- }
-
-/* logging errors */
-#define error_msg(...) rmsrv_log(LOG_ERR, __func__, __FILE__, __LINE__, __VA_ARGS__);
-/* logging warnings */
-#define warning_msg(...) rmsrv_log(LOG_WARNING, __func__, __FILE__, __LINE__, __VA_ARGS__);
-/* logging information */
-#define info_msg(...) rmsrv_log(LOG_INFO, __func__, __FILE__, __LINE__, __VA_ARGS__);
-/* logging debug information */
-#define debug_msg(...) rmsrv_log(LOG_DEBUG, __func__, __FILE__, __LINE__, __VA_ARGS__);
-
-#define LOG_APPEND(x) \
- do { \
- int len; \
- len = MAX_PRE_LOG_BUF_LEN - strlen(rmsrv_log_buf); \
- if (len > 0) { \
- strncat(rmsrv_log_buf, x, len); \
- } \
- else { \
- return; \
- } \
- } while(0)
-
-/* RM registered transport mapping structure */
-typedef struct trans_map_entry_s {
- /* Registered RM transport handle */
- Rm_TransportHandle trans_handle;
- /* Remote socket tied to the transport handle */
- sock_name_t *remote_sock;
- /* Next entry in the transport map */
- struct trans_map_entry_s *n;
-} trans_map_entry_t;
-
-/**********************************************************************
- ********************** Global Variables ******************************
- **********************************************************************/
-
-/* RM Server instance name (must match with RM Global Resource List (GRL) and policies */
-char server_name[RM_NAME_MAX_CHARS] = "RM_Server";
-
-Rm_Handle server_h;
-
-sock_h server_sock = NULL;
-
-rmserver_cfg_t rmsrv_cfg;
-
-char rmsrv_log_buf[MAX_PRE_LOG_BUF_LEN];
-
-/**********************************************************************
- ********************** External Variables ****************************
- **********************************************************************/
-
-extern int optind;
-extern char *optarg;
-
-/**********************************************************************
- ************************** Server Functions **************************
- **********************************************************************/
-
-/* RM Server logging utility (need to move it to another file) */
-void rmsrv_log(const int loglevel, const char* functionName, const char* fileName, const int lineNo, const char* format, ...)
-{
- int len;
- char lineno_a[32];
- va_list args;
- struct stat fbuf;
-
- sprintf(lineno_a, "%d", lineNo);
-
- rmsrv_log_buf[0] = 0;
-
- LOG_APPEND(fileName);
- LOG_APPEND(":");
- LOG_APPEND(lineno_a);
- LOG_APPEND(":");
- LOG_APPEND(functionName);
- LOG_APPEND(":");
-
- len = MAX_PRE_LOG_BUF_LEN - strlen(rmsrv_log_buf);
- if (len <= 0) {
- return;
- }
-
- va_start(args, format);
- vsnprintf(&rmsrv_log_buf[strlen(rmsrv_log_buf)], len, format, args);
- va_end(args);
-
- /* logfile reset if going over max_len */
- fstat(fileno(rmsrv_cfg.logfile_p), &fbuf);
- if ((fbuf.st_size + strlen(rmsrv_log_buf)) > rmsrv_cfg.logfile_max_len) {
- freopen(RMSERVER_DAEMON_LOG_FILE_NAME, "w+", rmsrv_cfg.logfile_p);
- }
-
- fprintf(rmsrv_cfg.logfile_p, "%s", rmsrv_log_buf);
- fflush(rmsrv_cfg.logfile_p);
-}
-
-Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
-{
- Rm_Packet *rm_pkt = NULL;
-
- rm_pkt = calloc(1, sizeof(*rm_pkt));
- if (!rm_pkt) {
- error_msg("Failed to malloc RM packet (err: %s)\n",
- strerror(errno));
- return (NULL);
- }
- rm_pkt->pktLenBytes = pktSize;
- *pktHandle = rm_pkt;
-
- return(rm_pkt);
-}
-
-void transportFree (Rm_Packet *rm_pkt)
-{
- int32_t status;
-
- if (rm_pkt) {
- free (rm_pkt);
- }
-}
-
-int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
-{
- sock_name_t *client_sock_name = (sock_name_t *)appTransport;
- Rm_Packet *rm_pkt = (Rm_Packet *)pktHandle;
-
- if (sock_send(server_sock, (char *)rm_pkt, (int) rm_pkt->pktLenBytes, client_sock_name)) {
- error_msg("Failed to send RM packet\n");
- }
- else {
- /* Print resources after sending response */
- Rm_resourceStatus(server_h, 1);
- }
-
- transportFree(rm_pkt);
- return (0);
-}
-
-int rm_server_run(void *grl, void *policy, void *lin_dtb, int is_daemon)
-{
- Rm_InitCfg rm_init_cfg;
- Rm_TransportCfg rm_trans_cfg;
- int32_t rm_result;
- trans_map_entry_t *trans_map = NULL;
- trans_map_entry_t *new_map_entry;
- trans_map_entry_t *map_index;
- int retval;
- int length = 0;
- sock_name_t serv_sock_name;
- sock_name_t client_sock_addr;
- Rm_Packet *rm_pkt = NULL;
- char pkt_src[RM_NAME_MAX_CHARS];
- struct sockaddr_un client_addr;
- int signal_fd = -1;
- char rm_socket_name[] = RM_SERVER_SOCKET_NAME;
-
- rmsrv_cfg.logfile_p = fopen(RMSERVER_DAEMON_LOG_FILE_NAME, "w+");
- if (!rmsrv_cfg.logfile_p) {
- printf("Error in opening log file %s (%s)", RMSERVER_DAEMON_LOG_FILE_NAME, strerror(errno));
- }
-
- debug_msg("Starting RM server");
-
- /* Create the Server instance */
- memset(&rm_init_cfg, 0, sizeof(rm_init_cfg));
- rm_init_cfg.instName = server_name;
- rm_init_cfg.instType = Rm_instType_SERVER;
- rm_init_cfg.instCfg.serverCfg.globalResourceList = grl;
- rm_init_cfg.instCfg.serverCfg.linuxDtb = lin_dtb;
- rm_init_cfg.instCfg.serverCfg.globalPolicy = policy;
- server_h = Rm_init(&rm_init_cfg, &rm_result);
- ERROR_CHECK(RM_OK, rm_result, server_name, "Initialization failed\n");
-
- debug_msg("RM Server initialized with name: %s", server_name);
-
- Rm_resourceStatus(server_h, 1);
-
- serv_sock_name.type = sock_name_e;
- serv_sock_name.s.name = rm_socket_name;
- server_sock = sock_open (&serv_sock_name);
- if (!server_sock) {
- error_msg("Error when opening socket %s", rm_socket_name);
- return -1;
- }
-
- if (is_daemon){
- signal_fd = daemon_signal_fd();
- }
-
- while(1) {
- info_msg("Waiting for messages from Clients\n");
- retval = sock_wait(server_sock, &length, NULL, signal_fd);
- if (retval < 0) {
- error_msg("Error in reading from socket\n");
- goto loop_continue;
- }
-
- if (length < sizeof(rm_pkt)) {
- error_msg("invalid RM message length %d\n", length);
- goto loop_continue;
- }
- rm_pkt = calloc(1, length);
- if (!rm_pkt) {
- error_msg("can't malloc for recv'd RM message (err: %s)\n",
- strerror(errno));
- goto loop_continue;
- }
-
- client_sock_addr.type = sock_addr_e;
- client_sock_addr.s.addr = &client_addr;
- retval = sock_recv(server_sock, (char *)rm_pkt, length, &client_sock_addr);
- if (retval != length) {
- error_msg("recv RM pkt failed from socket, received = %d, expected = %d\n",
- retval, length);
- goto loop_continue;
- }
-
- info_msg("Received RM pkt of size %d bytes from socket %s\n", length, client_sock_addr.s.addr->sun_path);
- if (Rm_receiveGetPktSrcName(rm_pkt, &pkt_src[0], RM_NAME_MAX_CHARS) == RM_OK) {
- info_msg(" RM pkt originated from %s instance\n", &pkt_src[0]);
- }
- if (Rm_receiveGetPktServiceSrcName(rm_pkt, &pkt_src[0], RM_NAME_MAX_CHARS) == RM_OK) {
- info_msg(" Service request within RM pkt originated from %s instance\n", &pkt_src[0]);
- }
-
- map_index = trans_map;
- while(map_index != NULL) {
- if (strncmp(map_index->remote_sock->s.addr->sun_path,
- client_addr.sun_path,
- sizeof(client_addr.sun_path)) == 0) {
- break;
- }
- map_index = map_index->n;
- }
-
- if (!map_index) {
- new_map_entry = calloc(1, sizeof(*new_map_entry));
- new_map_entry->remote_sock = calloc(1, sizeof(sock_name_t));
- new_map_entry->remote_sock->s.addr = calloc(1, sizeof(struct sockaddr_un));
- new_map_entry->remote_sock->type = sock_addr_e;
- memcpy(new_map_entry->remote_sock->s.addr, &client_addr, sizeof(struct sockaddr_un));
-
- /* Register the Client with the Server instance */
- rm_trans_cfg.rmHandle = server_h;
- rm_trans_cfg.appTransportHandle = (Rm_AppTransportHandle)new_map_entry->remote_sock;
- rm_trans_cfg.remoteInstType = Rm_instType_CLIENT;
- rm_trans_cfg.transportCallouts.rmAllocPkt = transportAlloc;
- rm_trans_cfg.transportCallouts.rmSendPkt = transportSend;
- new_map_entry->trans_handle = Rm_transportRegister(&rm_trans_cfg, &rm_result);
-
- new_map_entry->n = NULL;
-
- if (trans_map == NULL) {
- trans_map = new_map_entry;
- }
- else {
- map_index = trans_map;
-
- while(map_index->n != NULL) {
- map_index = map_index->n;
- }
- map_index->n = new_map_entry;
- }
-
- map_index = new_map_entry;
- }
-
- /* Provide packet to RM Server for processing */
- if (rm_result = Rm_receivePacket(map_index->trans_handle, rm_pkt)) {
- error_msg("RM failed to process received packet: %d\n", rm_result);
- }
-
-loop_continue:
- /* Cleanups */
- length = 0;
- transportFree(rm_pkt);
- memset(&client_sock_addr, 0, sizeof(sock_name_t));
- memset(&client_addr, 0, sizeof(struct sockaddr_un));
- }
-}
-
-char *get_pid_file_name(void) {
- static char pid_file_name[] = RMSERVER_DAEMON_PID_FILE_NAME;
-
- return pid_file_name;
-}
-
-static void print_usage(char *appname)
-{
- printf ("Usage: %s [OPTION]... [GRL] [POLICY]\n", appname);
- printf ("Run a resource manager server with the specified [GRL] and [POLICY]\n"
- "[GRL] and [POLICY] must be device tree blob (DTB) files\n"
- "Example: rmserver grl.dtb policy.dtb\n\n"
- "Configuration:\n"
- " -s, --logsize MAXLOGSIZE MAXLOGSIZE bytes will be written to the\n"
- " log file before the log is reset. On\n"
- " reset, the log file will be wiped.\n"
- "\n"
- " The default for MAXLOGSIZE is 8MB if\n"
- " logsize is not specified\n"
- "Optional Input:\n"
- " -l, --lindtb [LINUX_DTB] Optionally, provide a Linux DTB file\n"
- " that RM will use to reserve resources\n"
- " for Linux. The GRL must have the\n"
- " proper Linux DTB resource mappings\n"
- " for this feature to work\n"
- "Miscellaneous:\n"
- " -n, --nodaemon do not daemonize, run in foreground\n"
- " -k, --kill kill the existing daemon\n"
- " -h, --help print this message\n"
- "\n"
- "rmserver will run as a daemon by default.\n\n");
-}
-
-int main(int argc, char *argv[])
-{
- int opt;
- int daemonize = 1, kill = 0;
- int fd;
- struct stat file_stat;
- pid_t pid;
- char *grl_file;
- char *policy_file;
- char *lin_dtb_file = NULL;
- void *grl;
- void *policy;
- void *lin_dtb = NULL;
-
- const struct option longopts[] =
- {
- {"nodaemon", no_argument, 0, 'n'},
- {"kill", no_argument, 0, 'k'},
- {"help", no_argument, 0, 'h'},
- {"lindtb", required_argument, 0, 'l'},
- {"logsize", required_argument, 0, 's'},
- {0, 0, 0, 0},
- };
-
- rmsrv_cfg.logfile_max_len = DEFAULT_LOG_LEN;
-
- while((opt = getopt_long(argc, argv, "nkhl:s:", longopts, NULL)) != -1) {
- switch (opt) {
- case 'n':
- daemonize = 0;
- break;
- case 'k':
- kill = 1;
- break;
- case 'l':
- lin_dtb_file = optarg;
- break;
- case 's':
- rmsrv_cfg.logfile_max_len = strtol(optarg, NULL, 0);
- break;
- case 'h':
- default:
- print_usage(argv[0]);
- exit(EXIT_SUCCESS);
- }
- }
-
- if (!kill) {
- /* GRL and Policy must always be provided */
- if (optind == (argc - 2)) {
- /* First must be GRL */
- grl_file = argv[optind++];
- /* Second must be policy */
- policy_file = argv[optind++];
- }
- else {
- printf("GRL or policy not provided\n\n");
- print_usage(argv[0]);
- exit(EXIT_FAILURE);
- }
-
- /* mmap the GRL */
- fd = open(grl_file, O_RDONLY);
- if (fd == -1) {
- printf("Error opening GRL: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
- /* Obtain file size */
- if (fstat(fd, &file_stat) == -1) {
- printf("Error getting GRL size\n");
- exit(EXIT_FAILURE);
- }
- grl = mmap(NULL, file_stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (grl == MAP_FAILED) {
- printf("mmap of GRL failed\n");
- exit(EXIT_FAILURE);
- }
-
- /* mmap the Global Policy */
- fd = open(policy_file, O_RDONLY);
- if (fd == -1) {
- printf("Error opening Global Policy: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
- /* Obtain file size */
- if (fstat(fd, &file_stat) == -1) {
- printf("Error getting Global Policy size\n");
- exit(EXIT_FAILURE);
- }
- policy = mmap(NULL, file_stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (policy == MAP_FAILED) {
- printf("mmap of Global Policy failed\n");
- exit(EXIT_FAILURE);
- }
-
- if (lin_dtb_file) {
- /* mmap the Linux DTB if it was provided */
- fd = open(lin_dtb_file, O_RDONLY);
- if (fd == -1) {
- printf("Error opening Linux DTB: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
- /* Obtain file size */
- if (fstat(fd, &file_stat) == -1) {
- printf("Error getting Linux DTB size\n");
- exit(EXIT_FAILURE);
- }
- lin_dtb = mmap(NULL, file_stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (lin_dtb == MAP_FAILED) {
- printf("mmap of Linux DTB failed\n");
- exit(EXIT_FAILURE);
- }
- }
- }
-
- if (daemonize) {
- if (kill) {
- printf("Killing %s\n", argv[0]);
- }
- else {
- printf("Starting %s\n", argv[0]);
- }
-
- /* Reset signal handlers */
- if (daemon_reset_sigs(-1) < 0) {
- printf("Failed to reset all signal handlers: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
-
- /* Unblock signals */
- if (daemon_unblock_sigs(-1) < 0) {
- printf("Failed to unblock all signals: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
-
- if (check_and_create_path (get_pid_file_name()) < 0) {
- printf("Failed to create pid file path: %s\n", get_pid_file_name());
- exit(EXIT_FAILURE);
- }
-
- /* set daemon id string */
- daemon_log_ident = daemon_ident_from_argv0(argv[0]);
- daemon_pid_file_proc = (daemon_pid_file_proc_t) get_pid_file_name;
-
- if (kill) {
- if (daemon_pid_file_kill_wait(SIGTERM, 5) < 0) {
- printf("Failed to kill daemon: %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
- daemon_pid_file_remove();
- exit(EXIT_SUCCESS);
- }
-
- /* Single instance */
- if ((pid = daemon_pid_file_is_running()) >= 0) {
- printf("Daemon already running on PID file %u\n", pid);
- exit(EXIT_FAILURE);
- }
-
- if (daemon_retval_init() < 0) {
- printf("Failed to create pipe.\n");
- exit(EXIT_FAILURE);
- }
-
- /* Do the fork */
- if ((pid = daemon_fork()) < 0) {
- daemon_retval_done();
- printf("Error in daemon fork %s\n", strerror(errno));
- exit(EXIT_FAILURE);
- }
- else if (pid) { /* The parent */
- int ret;
-
- /* Wait for 20 seconds for the return value passed from the daemon process */
- if ((ret = daemon_retval_wait(20)) < 0) {
- printf("Could not receive return value from daemon process: %s\n", strerror(errno));
- return -1;
- }
-
- printf("Daemon returned %i as return value.\n", ret);
- return ret;
- }
-
- /* Close FDs */
- if (daemon_close_all(-1) < 0) {
- printf("Failed to close all file descriptors: %s\n", strerror(errno));
-
- /* Send the error condition to the parent process */
- daemon_retval_send(1);
- goto close_n_exit;
- }
-
- /* Create the PID file */
- if (daemon_pid_file_create() < 0) {
- printf("Could not create PID file (%s).\n", strerror(errno));
- daemon_retval_send(2);
- goto close_n_exit;
- }
-
- /* Initialize signal handling */
- if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, 0) < 0) {
- printf("Could not register signal handlers (%s).\n", strerror(errno));
- daemon_retval_send(3);
- goto close_n_exit;
- }
-
- /* Send OK to parent process */
- daemon_retval_send(0);
- }
-
- rm_server_run(grl, policy, lin_dtb, daemonize);
-
-close_n_exit:
- printf("Exiting %s daemon\n", argv[0]);
- if (daemonize) {
- daemon_retval_send(255);
- daemon_signal_done();
- daemon_pid_file_remove();
- }
-}
-
diff --git a/test/k2h/armv7/linux/rm_server_osal.c b/test/k2h/armv7/linux/rm_server_osal.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/**
- * @file rm_server_osal.c
- *
- * @brief
- * This is the OS abstraction layer used by the RM Server in Linux.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
- *
- * 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.
- *
- * \par
-*/
-
-/* Standard Includes */
-#include <stdint.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "serverlogutil.h"
-
-/**********************************************************************
- ****************************** Defines *******************************
- **********************************************************************/
-
-/**********************************************************************
- ************************** Global Variables **************************
- **********************************************************************/
-uint32_t rmMallocCounter = 0;
-uint32_t rmFreeCounter = 0;
-
-/**********************************************************************
- ********************** External Variables ****************************
- **********************************************************************/
-
-extern char rmsrv_log_buf[MAX_PRE_LOG_BUF_LEN];
-extern rmserver_cfg_t rmsrv_cfg;
-
-/**********************************************************************
- *************************** OSAL Functions **************************
- **********************************************************************/
-
-/* FUNCTION PURPOSE: Allocates memory
- ***********************************************************************
- * DESCRIPTION: The function is used to allocate a memory block of the
- * specified size.
- */
-void *Osal_rmMalloc (uint32_t num_bytes)
-{
- /* Increment the allocation counter. */
- rmMallocCounter++;
-
- /* Allocate memory. */
- return calloc(1, num_bytes);
-}
-
-/* FUNCTION PURPOSE: Frees memory
- ***********************************************************************
- * DESCRIPTION: The function is used to free a memory block of the
- * specified size.
- */
-void Osal_rmFree (void *ptr, uint32_t size)
-{
- /* Increment the free counter. */
- rmFreeCounter++;
- free(ptr);
-}
-
-/* FUNCTION PURPOSE: Critical section enter
- ***********************************************************************
- * DESCRIPTION: The function is used to enter a critical section.
- * Function protects against
- *
- * access from multiple cores
- * and
- * access from multiple threads on single core
- */
-void *Osal_rmCsEnter(void)
-{
- return NULL;
-}
-
-/* FUNCTION PURPOSE: Critical section exit
- ***********************************************************************
- * DESCRIPTION: The function is used to exit a critical section
- * protected using Osal_cppiCsEnter() API.
- */
-void Osal_rmCsExit(void *CsHandle)
-{
-
-}
-
-/* FUNCTION PURPOSE: Cache invalidate
- ***********************************************************************
- * DESCRIPTION: The function is used to indicate that a block of memory is
- * about to be accessed. If the memory block is cached then this
- * indicates that the application would need to ensure that the
- * cache is updated with the data from the actual memory.
- */
-void Osal_rmBeginMemAccess(void *ptr, uint32_t size)
-{
- return;
-}
-
-/* FUNCTION PURPOSE: Cache writeback
- ***********************************************************************
- * DESCRIPTION: The function is used to indicate that the block of memory has
- * finished being accessed. If the memory block is cached then the
- * application would need to ensure that the contents of the cache
- * are updated immediately to the actual memory.
- */
-void Osal_rmEndMemAccess(void *ptr, uint32_t size)
-{
- return;
-}
-
-/* FUNCTION PURPOSE: Creates a task blocking object
- ***********************************************************************
- * DESCRIPTION: The function is used to create a task blocking object
- * capable of blocking the task a RM instance is running
- * within
- */
-void *Osal_rmTaskBlockCreate(void)
-{
- return(NULL);
-}
-
-/* FUNCTION PURPOSE: Blocks a RM instance
- ***********************************************************************
- * DESCRIPTION: The function is used to block a task whose context a
- * RM instance is running within.
- */
-void Osal_rmTaskBlock(void *handle)
-{
-
-}
-
-/* FUNCTION PURPOSE: unBlocks a RM instance
- ***********************************************************************
- * DESCRIPTION: The function is used to unblock a task whose context a
- * RM instance is running within.
- */
-void Osal_rmTaskUnblock(void *handle)
-{
-
-}
-
-/* FUNCTION PURPOSE: Deletes a task blocking object
- ***********************************************************************
- * DESCRIPTION: The function is used to delete a task blocking object
- * provided to a RM instance
- */
-void Osal_rmTaskBlockDelete(void *handle)
-{
-
-}
-
-/* FUNCTION PURPOSE: Prints a variable list
- ***********************************************************************
- * DESCRIPTION: The function is used to print a string to the console
- */
-void Osal_rmLog (char *fmt, ... )
-{
- va_list ap;
- int len;
- struct stat fbuf;
-
- rmsrv_log_buf[0] = 0;
-
- len = MAX_PRE_LOG_BUF_LEN - strlen(rmsrv_log_buf);
- if (len <= 0) {
- return;
- }
-
- va_start(ap, fmt);
- vsnprintf(&rmsrv_log_buf[strlen(rmsrv_log_buf)], len, fmt, ap);
- va_end(ap);
-
- /* logfile reset if going over max_len */
- fstat(fileno(rmsrv_cfg.logfile_p), &fbuf);
- if ((fbuf.st_size + strlen(rmsrv_log_buf)) > rmsrv_cfg.logfile_max_len) {
- freopen(RMSERVER_DAEMON_LOG_FILE_NAME, "w+", rmsrv_cfg.logfile_p);
- }
-
- fprintf(rmsrv_cfg.logfile_p, "%s", rmsrv_log_buf);
- fflush(rmsrv_cfg.logfile_p);
-}
-
diff --git a/test/k2h/armv7/linux/serverlogutil.h b/test/k2h/armv7/linux/serverlogutil.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef __SERVERLOGUTIL_H__
-#define __SERVERLOGUTIL_H__
-
-#include <stdio.h>
-
-#define RMSERVER_DAEMON_LOG_FILE_NAME "/var/log/rmServer.log"
-
-#define MAX_PRE_LOG_BUF_LEN (4096)
-
-/* Default log length before reset is 8MB */
-#define DEFAULT_LOG_LEN (0x800000)
-
-typedef struct rmserver_cfg_tag {
- FILE *logfile_p;
- int logfile_max_len;
-} rmserver_cfg_t;
-
-#endif /* __SERVERLOGUTIL_H__ */
diff --git a/test/k2h/armv7/linux/sockrmmsg.h b/test/k2h/armv7/linux/sockrmmsg.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef __SOCKRMMSG_H__
-#define __SOCKRMMSG_H__
-
-#include <stdint.h>
-
-#define RM_SERVER_SOCKET_NAME "/tmp/var/run/rm/rm_server"
-
-#define msg_alloc(p) \
- do { \
- p = calloc(1, sizeof(*p)); \
- if (p) { \
- p->length = sizeof(*p); \
- } \
- } while (0)
-
-#define msg_length(x) ((x) ? (sizeof(*x) + x->length) : 0)
-#define msg_data(x) ((x->length) ? ((char *)x + sizeof(*x)) : NULL)
-
-#endif /* __SOCKRMMSG_H__ */
diff --git a/test/k2h/armv7/linux/sockutils.c b/test/k2h/armv7/linux/sockutils.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <malloc.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-
-#include "sockutils.h"
-
-#define error_msg printf
-
-typedef struct sock_data {
- struct sockaddr_un addr;
- fd_set readfds;
- int fd;
-} sock_data_t;
-
-int check_and_create_path (char *path)
-{
- char *d = path;
- if (!d)
- return -1;
-
- while (d = strchr(d + 1, '/')) {
- *d = 0;
- if (mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
- if (errno != EEXIST) {
- *d = '/';
- error_msg("can't create path %s (error: %s)",
- path, strerror(errno));
- return -1;
- }
- }
- *d = '/';
- }
- return 0;
-}
-
-sock_h sock_open (sock_name_t *sock_name)
-{
- sock_data_t *sd = 0;
- int retval = 0;
-
- if (!sock_name) {
- return 0;
- }
-
- sd = calloc (1, sizeof(sock_data_t));
-
- if (sock_name->type == sock_addr_e) {
- memcpy (&sd->addr, sock_name->s.addr, sizeof(struct sockaddr_un));
- } else {
- if (check_and_create_path(sock_name->s.name) < 0) {
- goto check_n_return;
- }
- sd->addr.sun_family = AF_UNIX;
- strncpy(sd->addr.sun_path, sock_name->s.name, UNIX_PATH_MAX);
- }
-
- sd->fd = socket(AF_UNIX, SOCK_DGRAM, 0);
- if (sd->fd < 0) {
- error_msg("can't open socket (error: %s)",
- sd->addr.sun_path, strerror(errno));
- goto check_n_return;
- }
-
- unlink(sd->addr.sun_path);
- if (bind(sd->fd, (struct sockaddr *) &sd->addr, sizeof(struct sockaddr_un)) < 0) {
- error_msg("can't bind socket (error: %s)",
- sd->addr.sun_path, strerror(errno));
- goto check_n_return;
- }
-
- FD_ZERO(&sd->readfds);
- FD_SET(sd->fd, &sd->readfds);
-
- retval = (int) sd;
-
-check_n_return:
- if (!retval) {
- sock_close ((sock_h) &sd);
- }
-
- return ((sock_h) retval);
-}
-
-int sock_close (sock_h handle)
-{
- sock_data_t *sd = (sock_data_t *) handle;
-
- if (!sd) {
- return -1;
- }
-
- if (sd->fd)
- close (sd->fd);
- free (sd);
-
- return 0;
-}
-
-int sock_send (sock_h handle, const char *data, int length,
- sock_name_t *to)
-{
- int fd;
- sock_data_t *sd = (sock_data_t *) handle;
- struct sockaddr_un to_addr;
-
- if (!to) {
- return -1;
- }
-
- if (to->type == sock_addr_e) {
- memcpy (&to_addr, to->s.addr, sizeof(struct sockaddr_un));
- } else {
- to_addr.sun_family = AF_UNIX;
- strncpy(to_addr.sun_path, to->s.name, UNIX_PATH_MAX);
- }
-
- if (sd) {
- fd = sd->fd;
- } else {
- fd = socket(AF_UNIX, SOCK_DGRAM, 0);
- if (fd < 0) {
- error_msg("can't open socket (error: %s)",
- to_addr.sun_path, strerror(errno));
- return -1;
- }
- }
-
- if (sendto (fd, data, length, 0, (struct sockaddr *) &to_addr,
- sizeof(struct sockaddr_un)) < 0) {
- error_msg("can't send data to %s (error: %s)",
- to_addr.sun_path, strerror(errno));
- return -1;
-
- }
-
- return 0;
-}
-
-int sock_wait (sock_h handle, int *size, struct timeval *timeout, int extern_fd)
-{
- sock_data_t *sd = (sock_data_t *) handle;
- int retval;
- fd_set fds;
-
- if (!sd) {
- error_msg("invalid hanlde");
- return -1;
- }
-
- fds = sd->readfds;
-
- if (extern_fd != -1) {
- FD_SET(extern_fd, &fds);
- }
-
- retval = select(FD_SETSIZE, &fds, NULL, NULL, timeout);
- if (retval == -1) {
- error_msg("select failed for %s (error: %s)",
- sd->addr.sun_path, strerror(errno));
- return -1;
- }
-
- if ((extern_fd != -1) && (FD_ISSET(extern_fd, &fds))) {
- return 1;
- }
-
- if (!FD_ISSET(sd->fd, &fds)) {
- /* Wait timedout */
- return -2;
- }
-
- if (!retval) {
- return 0;
- }
-
- if (size != 0) {
- retval = ioctl(sd->fd, FIONREAD, size);
- if (retval == -1) {
- error_msg("can't read datagram size for %s (error: %s)",
- sd->addr.sun_path, strerror(errno));
- return -1;
- }
- }
-
- return 0;
-}
-
-int sock_recv (sock_h handle, char *data, int length, sock_name_t *from)
-{
- int size;
- int retval;
- fd_set fds;
- sock_data_t *sd = (sock_data_t *) handle;
- socklen_t from_length = 0;
-
- if (!sd) {
- error_msg("invalid hanlde");
- return -1;
- }
-
- if (from) {
- if((from->type = sock_addr_e) && (from->s.addr))
- from_length = sizeof(struct sockaddr_un);
- else {
- error_msg("invalid from parameter");
- return -1;
- }
- }
-
- size = recvfrom(sd->fd, data, length, 0, (struct sockaddr *)((from_length) ? from->s.addr : NULL), &from_length);
- if (size < 1) {
- error_msg("can't read datagram from socket for %s (error: %s), size %d",
- sd->addr.sun_path, strerror(errno), size);
- return -1;
- }
-
- return size;
-
-}
-
diff --git a/test/k2h/armv7/linux/sockutils.h b/test/k2h/armv7/linux/sockutils.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
-*/
-
-#ifndef __SOCKUTILS_H__
-#define __SOCKUTILS_H__
-
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX 108
-#endif
-
-
-typedef enum {
- sock_name_e,
- sock_addr_e
-} sock_name_type;
-
-typedef struct {
- sock_name_type type;
- union sock {
- char *name;
- struct sockaddr_un *addr;
- } s;
-} sock_name_t;
-
-#define sock_h void *
-
-sock_h sock_open (sock_name_t *sock_name);
-
-int sock_close (sock_h handle);
-
-int sock_send (sock_h handle, const char *data, int length,
- sock_name_t *to);
-
-/* Returns: 1 => success (external FD), 0 => success, -1 => error, -2 => timeout */
-int sock_wait (sock_h handle, int *size, struct timeval *timeout, int extern_fd);
-
-int sock_recv (sock_h handle, char *data, int length, sock_name_t *from);
-
-#endif
diff --git a/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs b/test/k2h/c66/bios/dsp_client.cfg
similarity index 60%
rename from test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs
rename to test/k2h/c66/bios/dsp_client.cfg
index 09fa8239bd42cd7617cb574208704763da34d7c1..db6ee5efcb6415a510e29855d0dfd207c685ba3e 100644 (file)
rename from test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs
rename to test/k2h/c66/bios/dsp_client.cfg
index 09fa8239bd42cd7617cb574208704763da34d7c1..db6ee5efcb6415a510e29855d0dfd207c685ba3e 100644 (file)
print ("Program.cpu.deviceName = " + Program.cpu.deviceName);
print ("Program.platformName = " + Program.platformName);
-if (Program.cpu.deviceName.match(/TMS320TCI6636/)) {
- var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
- var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
-
- /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
- var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
- MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
- "CORE4", "CORE5", "CORE6", "CORE7"]);
- Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
- Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
- Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
-
- var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
- Hwi.enableException = true;
-
- /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
- We assume the rest is to be left cacheable.
- Per sprugw0b.pdf
- 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
- 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
- */
- var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
- /* This doesn't work:
- Cache.MAR160_191 = 0xFFFFFFFC;
- So, need to do this:
- */
- /* TBD: Update for Kepler: */
- Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
-
- Program.global.sysMinBufSize = 0x8000;
- SysMin.bufSize = Program.global.sysMinBufSize;
-
- /* Enable Memory Translation module that operates on the Resource Table */
- var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
- Resource.loadSegment = Program.platform.dataMemory;
-
- /* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
- /*
- Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
- Diags.ALWAYS_ON);
- Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
- Diags.ALWAYS_ON);
- Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
- Diags.INFO|Diags.USER1|Diags.STATUS,
- Diags.ALWAYS_ON);
- Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
- Diags.ALWAYS_ON);
- */
-}
-else {
- throw("dsp_client.cfg.xs: Did not match any platform!");
-}
+var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+/* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+/* K2H - TMS320TCI6636 */
+MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
+ "CORE4", "CORE5", "CORE6", "CORE7"]);
+Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+Hwi.enableException = true;
+
+/* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+ We assume the rest is to be left cacheable.
+ Per sprugw0b.pdf
+ 0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+ 0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+*/
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+/* This doesn't work:
+ Cache.MAR160_191 = 0xFFFFFFFC;
+ So, need to do this:
+*/
+/* TBD: Update for Kepler: */
+Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+Program.global.sysMinBufSize = 0x8000;
+SysMin.bufSize = Program.global.sysMinBufSize;
+
+/* Enable Memory Translation module that operates on the Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = Program.platform.dataMemory;
+
+/* COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+/*
+Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
+ Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
+ Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+ Diags.INFO|Diags.USER1|Diags.STATUS,
+ Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+ Diags.ALWAYS_ON);
+*/
Hwi.enableException = true;
Csl.deviceType = devType;
var Rm = xdc.loadPackage('ti.drv.rm');
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+var TransportRpmsg = xdc.useModule('ti.ipc.transports.TransportRpmsg');
+
diff --git a/test/k2h/c66/bios/rmK2HArmv7LinuxDspClientTestProject.txt b/test/k2h/c66/bios/rmK2HArmv7LinuxDspClientTestProject.txt
index 8a14f8659ba68039e176d9a0b2f7b7737344f9d8..80d4d3ccacf93cd3a32c6e32cc8733a77c1347d3 100644 (file)
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/armv7/linux/dspClientTest/dsp_client.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/src/dsp_client.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c"
-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/c66/bios/rm_osal.c"
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg"
--ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/c66/bios/dsp_client.cfg"
-ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2H --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm"
-rtsc.enableRtsc
diff --git a/test/k2k/armv7/linux/README.txt b/test/k2k/armv7/linux/README.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-Running the RM ARM Linux + DSP Test:
-Please see the RM User Guide for instructions on how to run this test
-http://processors.wiki.ti.com/index.php/MCSDK_UG_Chapter_Developing_System_Mgmt#Running_RM_Test_Projects
-
-Running the RM ARM Linux multi-process test:
-
-To run rmServer.out:
-
-copy the following files from rm/test/dts_files to the install directory containing rmServer.out:
-global-resources.dtb
-server-policy.dtb
-linux-evm.dtb [Optional]
-
-The data contained in the latter DTB files is not required to run the RM Server. A new GRL and policy
-can be written and supplied instead of the latter files.
-
-For information on how to create new GRLs and Policies please see:
-http://processors.wiki.ti.com/index.php/MCSDK_UG_Chapter_Developing_System_Mgmt#Resource_Manager
-
-To run the Server:
-$ ./rmServer.out global-resources.dtb server-policy.dtb -l linux-evm.dtb
-
-The Server will wait for Client socket connections and service any requests received via those sockets.
-
-
-To run the rmLinuxClientTest.out:
-
-copy the following files from rm/test/dts_files to the install directory containing rmLinuxClientTest.out:
-static-policy.dtb
-
-To execute the Client test:
-$ ./rmLinuxClientTest.out static-policy.dtb
-
-The Client test will establish a socket connection with the Server, request resources and then free all resources requested.
diff --git a/test/k2k/armv7/linux/build/makefile b/test/k2k/armv7/linux/build/makefile
+++ /dev/null
@@ -1,128 +0,0 @@
-#
-# Macro definitions referenced below
-#
-
-empty =
-space =$(empty) $(empty)
-
-PDK_INSTALL_PATH ?= ../../..
-# IPC_DEVKIT_INSTALL_PATH ?= need/to/set/path
-# export IPC_DEVKIT_INSTALL_PATH if IPC is not in /usr/lib
-# Currently requiring IPC from linux-devkit because that package is compiled with Linaro tools
-
-ARMV7OBJDIR ?= ./obj/$(DEVICE)
-ARMV7BINDIR ?= ./bin/$(DEVICE)
-ARMV7LIBDIR ?= ./lib
-
-ARMV7OBJDIR := $(ARMV7OBJDIR)/rm/test
-ARMV7BINDIR := $(ARMV7BINDIR)/rm/test
-
-#Cross tools
-ifdef CROSS_TOOL_INSTALL_PATH
-# Support backwards compatibility with KeyStone1 approach
- CC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
- AC = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)as
- AR = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)ar
- LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
-endif
-
-ifdef IPC_DEVKIT_INSTALL_PATH
- IPCLIBDIRS := -L$(IPC_DEVKIT_INSTALL_PATH)/lib/
-else
- IPCLIBDIRS :=
-endif
-
-# INCLUDE Directories
-RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
-
-RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
-RM_TEST_DIR = $(RM_SRC_DIR)/test
-RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/$(DEVICE)/armv7/linux
-
-INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(IPC_DEVKIT_INSTALL_PATH)/include
-
-# Libraries
-RM_LIB = -lrm
-DAEMON_LIB = -ldaemon
-IPC_LIBS = -ltiipc -ltiipcutils
-
-ifeq ($(USEDYNAMIC_LIB), yes)
-#presuming ARM executable would depend on dynamic library dependency
-EXE_EXTN = _so
-LIBS = $(RM_LIB) $(DAEMON_LIB)
-else
-#forcing ARM executable to depend on static LLD libraries
-EXE_EXTN =
-LIBS = -static $(RM_LIB) -Wl,-Bdynamic $(DAEMON_LIB)
-endif
-
-# Compiler options
-INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
-
-# Linker options
-INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
-IPC_INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(IPCLIBDIRS) $(IPC_LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
-
-RM_SERVER_EXE=rmServer$(EXE_EXTN).out
-RM_LINUX_CLIENT_TEST_EXE=rmLinuxClientTest$(EXE_EXTN).out
-RM_DSP_CLIENT_TEST_EXE=rmDspClientTest$(EXE_EXTN).out
-
-OBJEXT = o
-
-SRCDIR = $(RM_ARM_LIN_TEST_DIR)
-
-INCS = -I. -I$(strip $(subst ;, -I,$(INCDIR)))
-
-VPATH=$(SRCDIR)
-
-#List the Source Files
-RM_SERVER_SRC = \
- rm_server.c \
- rm_server_osal.c \
- sockutils.c
-
-RM_LINUX_CLIENT_TEST_SRC = \
- rm_linux_client_test.c \
- rm_linux_osal.c \
- sockutils.c
-
-RM_DSP_CLIENT_TEST_SRC = \
- rm_dsp_client_test.c \
- sockutils.c
-
-# FLAGS for the SourceFiles
-SRC_CFLAGS = -I. $(CFLAGS)
-
-# Make Rule for the SRC Files
-RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
-RM_LINUX_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_CLIENT_TEST_SRC))
-RM_DSP_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_DSP_CLIENT_TEST_SRC))
-
-all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE)
-
-$(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
- @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE): $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_LINUX_CLIENT_TEST_SRC_OBJS) into $@ ...
- @$(CC) $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE): $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
- @echo linking $(RM_DSP_CLIENT_TEST_SRC_OBJS) into $@ ...
- @$(CC) $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(IPC_INTERNALLINKDEFS) -o $@
-
-$(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
- @echo compiling $< ...
- @$(CC) -c $(SRC_CFLAGS) $(INTERNALDEFS) $(INCS) $< -o $@
-
-$(ARMV7OBJDIR)/.created:
- @mkdir -p $(ARMV7OBJDIR)
- @touch $(ARMV7OBJDIR)/.created
-
-$(ARMV7BINDIR)/.created:
- @mkdir -p $(ARMV7BINDIR)
- @touch $(ARMV7BINDIR)/.created
-
-clean:
- @rm -fr $(ARMV7OBJDIR)
- @rm -fr $(ARMV7BINDIR)
-
diff --git a/test/k2k/armv7/linux/dspClientTest/dsp_client.c b/test/k2k/armv7/linux/dspClientTest/dsp_client.c
+++ /dev/null
@@ -1,1011 +0,0 @@
-/*
- * dsp_client.c
- *
- * DSP portion of Resource Manager ARM+DSP test that uses RPMSG and sockets to
- * allow a DSP application to to request RM services from a RM Server running
- * from Linux User-space.
- *
- * ============================================================================
- *
- * 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.
- *
- */
-
-/* Standard includes */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* XDC includes */
-#include <xdc/std.h>
-#include <xdc/runtime/Assert.h>
-#include <xdc/runtime/System.h>
-
-/* BIOS includes */
-#include <ti/sysbios/BIOS.h>
-#include <ti/sysbios/knl/Task.h>
-
-/* IPC includes */
-#include <ti/ipc/MultiProc.h>
-#include <ti/ipc/HeapBufMP.h>
-#include <ti/ipc/MessageQ.h>
-
-/* CSL includes */
-#include <ti/csl/csl_chip.h>
-
-/* RM Includes */
-#include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_transport.h>
-#include <ti/drv/rm/rm_services.h>
-
-/**********************************************************************
- ************************** RM Test Symbols ***************************
- **********************************************************************/
-
-/* Test will run on this core */
-#define TEST_CORE 0
-
-/* Test FALSE */
-#define RM_TEST_FALSE 0
-/* Test TRUE */
-#define RM_TEST_TRUE 1
-
-/* RM packet heap name */
-#define MSGQ_HEAP_ID 0
-
-/* MessageQ Name for DSP RM Client */
-#define CLIENT_MESSAGEQ_NAME "RM_CLIENT"
-
-/* Size of RM static allocation response queue. Must be greater than number of APPROVED
- * static allocations */
-#define MAX_STATIC_ALLOCATION_RESPS 5
-
-/* Size of RM service response queue */
-#define MAX_QUEUED_SERVICE_RESPONSES 10
-
-/* Error checking macro */
-#define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg) \
- if (resultVal != checkVal) { \
- char errorMsgToPrint[] = printMsg; \
- System_printf("Error Core %d : %s : ", coreNum, rmInstName); \
- System_printf("%s with error code : %d\n", errorMsgToPrint, resultVal); \
- testErrors++; \
- System_abort("Test Failure\n"); \
- }
-
-#define POSITIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("Core %d : %s\n", core, titleMsg); \
- System_printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- System_printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- System_printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- System_printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- System_printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- System_printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- System_printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- System_printf ("Core %d : - -\n", \
- core); \
- if (state == check) { \
- System_printf ("Core %d : - PASSED -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- testErrors++; \
- } \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("\n"); \
- } while(0);
-
-#define NEGATIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("Core %d : %s\n", core, titleMsg); \
- System_printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- System_printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- System_printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- System_printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- System_printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- System_printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- System_printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- System_printf ("Core %d : - -\n", \
- core); \
- if (state != check) { \
- System_printf ("Core %d : - PASSED - Denial: %-6d -\n", \
- core, state); \
- } \
- else { \
- System_printf ("Core %d : - FAILED - Expected Denial -\n", \
- core); \
- testErrors++; \
- } \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("\n"); \
- } while(0);
-
-#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
- do { \
- int32_t start = resStart; \
- char titleMsg[] = title; \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("Core %d : %s\n", core, titleMsg); \
- System_printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- System_printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- System_printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- System_printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- System_printf ("Core %d : - Expected Owner Count: %-16d -\n", \
- core, expectRefCnt); \
- System_printf ("Core %d : - Returned Owner Count: %-16d -\n", \
- core, refCnt); \
- System_printf ("Core %d : - -\n", core); \
- if ((state == check) && (refCnt == expectRefCnt)) { \
- System_printf ("Core %d : - PASSED -\n", core); \
- } \
- else { \
- if (refCnt != expectRefCnt) { \
- System_printf ("Core %d : - FAILED - Owner Count Mismatch -\n", \
- core); \
- } \
- else { \
- System_printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- } \
- testErrors++; \
- } \
- System_printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- System_printf ("\n"); \
- } while(0);
-
-/**********************************************************************
- ********************** RM Test Data Structures ***********************
- **********************************************************************/
-
-/* IPC MessageQ RM packet encapsulation structure */
-typedef struct {
- /* IPC MessageQ header (must be first element in structure) */
- MessageQ_MsgHeader msgQHeader;
- /* Pointer to RM packet */
- Rm_Packet rmPkt;
-} MsgQ_RmPacket;
-
-/**********************************************************************
- ********************** Extern Variables ******************************
- **********************************************************************/
-
-/* Alloc and free OSAL variables */
-extern uint32_t rmMallocCounter;
-extern uint32_t rmFreeCounter;
-
-/* RM test Static Policy provided to RM Client */
-extern const char rmStaticPolicy[];
-
-/**********************************************************************
- ********************** Global Variables ******************************
- **********************************************************************/
-
-/* Core number */
-uint16_t coreNum;
-/* Number of errors that occurred during the test */
-uint16_t testErrors;
-
-/* Task to configure application transport code for RM */
-Task_Handle rmStartupTskHandle;
-/* High priority task for receiving RM packets */
-Task_Handle rmReceiveTskHandle;
-/* RM client delegate and client test task */
-Task_Handle rmClientTskHandle;
-
-/* Handle for heap that RM packets will be allocated from */
-HeapBufMP_Handle rmPktHeapHandle = NULL;
-
-/* Client instance name (must match with RM Global Resource List (GRL) and policies */
-char rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
-
-/* Client MessageQ */
-MessageQ_Handle rmClientQ = NULL;
-
-/* Linux MessageQ ID */
-MessageQ_QueueId linuxQueueId;
-
-/* Client instance handles */
-Rm_Handle rmClientHandle = NULL;
-
-/* Client instance service handles */
-Rm_ServiceHandle *rmClientServiceHandle = NULL;
-
-/* Client from Server transport handle */
-Rm_TransportHandle clientFromServerTransportHandle;
-
-/* Static allocation response queue */
-Rm_ServiceRespInfo staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
-/* Static allocation response queue index */
-uint32_t numStaticResponses;
-
-/* RM response info queue used to store service responses received via the callback function */
-Rm_ServiceRespInfo responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
-
-/* RM resource names (must match resource node names in GRL and policies */
-char resourceNameMemRegion[RM_NAME_MAX_CHARS] = "memory-regions";
-char resourceNameAccumCh[RM_NAME_MAX_CHARS] = "accumulator-ch";
-char resourceNameGpQ[RM_NAME_MAX_CHARS] = "gp-queue";
-char resourceNameAifQ[RM_NAME_MAX_CHARS] = "aif-queue";
-char resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
-char resourceNameAifRxCh[RM_NAME_MAX_CHARS] = "aif-rx-ch";
-char resourceNameInfraQ[RM_NAME_MAX_CHARS] = "infra-queue";
-
-/* Test RM NameServer name */
-char nameServerNameFavQ[RM_NAME_MAX_CHARS] = "My_Favorite_Queue";
-
-/**********************************************************************
- *************************** Test Functions ***************************
- **********************************************************************/
-
-Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
-{
- Rm_Packet *rmPkt = NULL;
- MsgQ_RmPacket *rmMsg = NULL;
-
- /* Allocate a messageQ message for containing the RM packet */
- rmMsg = (MsgQ_RmPacket *)MessageQ_alloc(MSGQ_HEAP_ID, sizeof(MsgQ_RmPacket));
- if (rmMsg == NULL) {
- System_printf("Error Core %d : MessageQ_alloc failed to allocate message: %d\n", coreNum);
- testErrors++;
- *pktHandle = NULL;
- return(NULL);
- }
- else {
- rmPkt = &(rmMsg->rmPkt);
- rmPkt->pktLenBytes = pktSize;
- *pktHandle = (Rm_PacketHandle)rmMsg;
- }
- return (rmPkt);
-}
-
-void transportFree (MessageQ_Msg rmMsgQMsg)
-{
- int32_t status;
-
- status = MessageQ_free(rmMsgQMsg);
- if (status < 0) {
- System_printf("Error Core %d : MessageQ_free failed to free message: %d\n", coreNum, status);
- testErrors++;
- }
-}
-
-int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
-{
- MessageQ_QueueId *remoteQueueId = (MessageQ_QueueId *)appTransport;
- MsgQ_RmPacket *rmMsg = pktHandle;
- int32_t status;
-
- /* Send the message to Linux */
- status = MessageQ_put(*remoteQueueId, (MessageQ_Msg)rmMsg);
- if (status < 0) {
- System_printf("Error Core %d : MessageQ_put failed to send message: %d\n", coreNum, status);
- testErrors++;
- }
-
- return (0);
-}
-
-void transportReceive (void)
-{
- int32_t numPkts;
- MessageQ_Msg rmMsg = NULL;
- Rm_Packet *rmPkt = NULL;
- int32_t status;
- uint32_t i;
-
- /* Check if any packets available */
- numPkts = (int32_t) MessageQ_count(rmClientQ);
-
- /* Process all available packets */
- for (i = 0; i < numPkts; i++) {
- status = (int32_t) MessageQ_get(rmClientQ, &rmMsg, MessageQ_FOREVER);
- if (rmMsg == NULL) {
- System_printf("Error Core %d : MessageQ_get failed, returning a NULL packet\n", coreNum);
- testErrors++;
- }
-
- /* Extract the Rm_Packet from the RM msg */
- rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
-
- /* Provide packet to RM for processing */
- if (status = Rm_receivePacket(clientFromServerTransportHandle, rmPkt)) {
- System_printf("Error Core %d : RM failed to process received packet: %d\n", coreNum, status);
- testErrors++;
- }
-
- /* Free RM packet buffer and messageQ message */
- transportFree(rmMsg);
- }
-}
-
-void serviceCallback(Rm_ServiceRespInfo *serviceResponse)
-{
- uint32_t qIndex = 0;
-
- /* Populate next free entry in the responseInfoQueue */
- while (responseInfoQueue[qIndex].serviceId != 0) {
- qIndex++;
- if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
- qIndex = 0;
- }
- }
-
- /* Save the response in the response queue for the test task to pick up */
- memcpy((void *)&responseInfoQueue[qIndex], (void *)serviceResponse, sizeof(Rm_ServiceRespInfo));
-}
-
-/* Packets received via rpmsg port will issue callback vai transportReceive function */
-void waitForResponse(Rm_ServiceRespInfo *respInfo)
-{
- uint32_t qIndex = 0;
-
- if ((respInfo->serviceState == RM_SERVICE_PROCESSING) ||
- (respInfo->serviceState == RM_SERVICE_PENDING_SERVER_RESPONSE)) {
- /* Scan responseInfoQueue for the response received via the callback function */
- while((responseInfoQueue[qIndex].serviceId != respInfo->serviceId) ||
- (responseInfoQueue[qIndex].rmHandle != respInfo->rmHandle)) {
- qIndex++;
- if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
- qIndex = 0;
- }
-
- /* Higher priority receive task will retrieve response */
- }
-
- memcpy((void *)respInfo, (void *)&responseInfoQueue[qIndex], sizeof(Rm_ServiceRespInfo));
- memset((void *)&responseInfoQueue[qIndex], 0, sizeof(Rm_ServiceRespInfo));
- }
-}
-
-void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *resName, int32_t resBase,
- uint32_t resLen, int32_t resAlign, const char *nsName, int setCallback, Rm_ServiceRespInfo *respInfo)
-{
- memset((void *)reqInfo, 0, sizeof(Rm_ServiceReqInfo));
- reqInfo->type = type;
- reqInfo->resourceName = resName;
- reqInfo->resourceBase = resBase;
- reqInfo->resourceLength = resLen;
- reqInfo->resourceAlignment = resAlign;
- reqInfo->resourceNsName = nsName;
- if (setCallback) {
- reqInfo->callback.serviceCallback = serviceCallback;
- }
- memset((void *)respInfo, 0, sizeof(Rm_ServiceRespInfo));
-}
-
-void rmCleanupTsk(UArg arg0, UArg arg1)
-{
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- int32_t result;
- int32_t finalMallocFree;
-
- /* Free all allocated resources */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh,
- 0, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh,
- 40, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster,
- 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster,
- 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameInfraQ,
- 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ,
- 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
- result = Rm_serviceCloseHandle(rmClientServiceHandle);
- ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed");
-
- result = Rm_transportUnregister(clientFromServerTransportHandle);
- ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of Server transport failed");
-
- result = MessageQ_delete(&rmClientQ);
- if (result < 0) {
- System_printf("Core %d : Error in MessageQ_delete [%d]\n", coreNum, result);
- testErrors++;
- }
-
- result = Rm_delete(rmClientHandle, RM_TEST_TRUE);
- ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed");
-
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum);
- System_printf ("Core %d : - : malloc count | free count -\n", coreNum);
- System_printf ("Core %d : - Example Completion : %6d | %6d -\n", coreNum,
- rmMallocCounter, rmFreeCounter);
- finalMallocFree = rmMallocCounter - rmFreeCounter;
- if (finalMallocFree > 0) {
- System_printf ("Core %d : - FAILED - %6d unfreed mallocs -\n",
- coreNum, finalMallocFree);
- testErrors++;
- }
- else if (finalMallocFree < 0) {
- System_printf ("Core %d : - FAILED - %6d more frees than mallocs -\n",
- coreNum, -finalMallocFree);
- testErrors++;
- }
- else {
- System_printf ("Core %d : - PASSED -\n",
- coreNum);
- }
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("\n");
-
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("Core %d : ------------------ Example Completion -------------------\n", coreNum);
- if (testErrors) {
- System_printf ("Core %d : - Test Errors: %-32d -\n", coreNum, testErrors);
- }
- System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
- System_printf ("\n");
-}
-
-/* Receive task has priority of 2 so that it pre-empts the RM instance test tasks */
-void rmReceiveTsk(UArg arg0, UArg arg1)
-{
- while(1) {
- transportReceive();
- /* Sleep for 1ms so that the main test tasks can run */
- Task_sleep(1);
- }
-}
-
-void rmClientTsk(UArg arg0, UArg arg1)
-{
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- Task_Params taskParams;
- uint32_t i, j;
-
- /* Create new NameServer object */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ,
- 1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--------------- Create NameServer Object ----------------",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, responseInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Retrieve a resource via a NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("------- Retrieve Resource Via NameServer Object ---------",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Allocate the resource returned from the NameServer request */
- memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo));
- requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
- requestInfo.resourceName = responseInfo.resourceName;
- requestInfo.resourceBase = responseInfo.resourceBase;
- requestInfo.resourceLength = responseInfo.resourceLength;
- requestInfo.resourceNsName = NULL;
- requestInfo.callback.serviceCallback = serviceCallback;
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-------- Init Allocate Using Retrieved Resource ---------",
- coreNum, rmClientName, responseInfo.resourceName,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Retrieve the resource status via the NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("---- Retrieve Resource Status Via NameServer Object -----",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
-
- /* Free resource via a NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--- Free of Retrieved Resource Using NameServer Name ----",
- coreNum, rmClientName, nameServerNameFavQ,
- 0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Delete the NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("--------------- Delete NameServer Object ----------------",
- coreNum, rmClientName, nameServerNameFavQ,
- 0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --",
- coreNum, rmClientName, resourceNameAifRxCh,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh,
- 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Init Allocate) -",
- coreNum, rmClientName, resourceNameAifRxCh,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
-
- /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("---- Use Allocation w/ UNSPECIFIED Base & Alignment -----",
- coreNum, rmClientName, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength,
- RM_RESOURCE_ALIGNMENT_UNSPECIFIED, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END testing allocations with UNSPECIFIED base and alignment values */
-
- /* Allocate infrastructure queue shared between Linux kernel and Client */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ,
- 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Init Allocation of Shared Linux and Client Resource --",
- coreNum, rmClientName, resourceNameInfraQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* BEGIN Allocating some resources without providing a callback function. RM should block and not return until the result
- * is returned by the server. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("- Init Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
-
- /* Init allocation of resource already owned by Client should return approved and there should only
- * be one instance of Client in resource's owner list. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- POSITIVE_PASS_CHECK("----- Use Allocation of Owned Resource (RM Blocked) -----",
- coreNum, rmClientName, resourceNameGpQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
- /* END Allocating some resources without providing a callback function. RM should block and not return
- * until the result is returned by the Server. */
-
- /* BEGIN Getting the status of resources from Client and CD */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ,
- 7012, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("-- Status Check of Resources from Client (Non-Blocking) -",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ,
- 4025, 20, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- waitForResponse(&responseInfo);
- STATUS_PASS_CHECK("---- Status Check of Resources from Client (Blocking) ---",
- coreNum, rmClientName, responseInfo.resourceName,
- responseInfo.resourceBase, responseInfo.resourceLength,
- responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);
- /* END Getting the status of resources from Client and CD */
-
- /* Verify static allocations were validated. Validation responses should have been received after the
- * first service requests were made on the Client and CD post transport path registration. */
- while (numStaticResponses > 0) {
- /* Loop until all static request validations have been received */
- for (i = 0; i < MAX_STATIC_ALLOCATION_RESPS; i++) {
- if (staticResponseQueue[i].serviceId != 0) {
- for (j = 0; j < MAX_QUEUED_SERVICE_RESPONSES; j++) {
- if ((staticResponseQueue[i].serviceId == responseInfoQueue[j].serviceId) &&
- (staticResponseQueue[i].rmHandle == responseInfoQueue[j].rmHandle)) {
- POSITIVE_PASS_CHECK("------------- Static Allocation Validation --------------",
- coreNum, rmClientName, responseInfoQueue[j].resourceName,
- responseInfoQueue[j].resourceBase, responseInfoQueue[j].resourceLength,
- 0, responseInfoQueue[j].serviceState,
- RM_SERVICE_APPROVED);
- memset((void *)&staticResponseQueue[i], 0, sizeof(Rm_ServiceRespInfo));
- memset((void *)&responseInfoQueue[j], 0, sizeof(Rm_ServiceRespInfo));
- numStaticResponses--;
- break;
- }
- }
- }
- }
- }
-
- /* Create the RM cleanup task. */
- System_printf("Core %d : Creating RM cleanup task...\n", coreNum);
- Task_Params_init (&taskParams);
- Task_create (rmCleanupTsk, &taskParams, NULL);
-}
-
-void rmStartupTsk(UArg arg0, UArg arg1)
-{
- Task_Params taskParams;
- Char localQueueName[64];
- MessageQ_Msg msg;
- Rm_TransportCfg rmTransCfg;
- int32_t rm_result;
-
- /* Construct a MessageQ name adorned with core name: */
- System_sprintf(localQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
- MultiProc_getName(MultiProc_self()));
-
- rmClientQ = MessageQ_create(localQueueName, NULL);
- if (rmClientQ == NULL) {
- System_abort("MessageQ_create failed\n");
- }
-
- if (coreNum == TEST_CORE) {
- System_printf("Awaiting sync message from host...\n");
- MessageQ_get(rmClientQ, &msg, MessageQ_FOREVER);
-
- linuxQueueId = MessageQ_getReplyQueue(msg);
- MessageQ_put(linuxQueueId, msg);
-
- /* Register the Server with the Client instance */
- rmTransCfg.rmHandle = rmClientHandle;
- rmTransCfg.appTransportHandle = (Rm_AppTransportHandle) &linuxQueueId;
- rmTransCfg.remoteInstType = Rm_instType_SERVER;
- rmTransCfg.transportCallouts.rmAllocPkt = transportAlloc;
- rmTransCfg.transportCallouts.rmSendPkt = transportSend;
- clientFromServerTransportHandle = Rm_transportRegister(&rmTransCfg, &rm_result);
-
- /* Create the RM receive task. Assign higher priority than the test tasks so that
- * when they spin waiting for messages from other RM instances the receive task is
- * executed. */
- System_printf("Core %d : Creating RM receive task...\n", coreNum);
- Task_Params_init (&taskParams);
- taskParams.priority = 2;
- rmReceiveTskHandle = Task_create (rmReceiveTsk, &taskParams, NULL);
-
- System_printf("Core %d : Creating RM client task...\n", coreNum);
- Task_Params_init (&taskParams);
- taskParams.priority = 1;
- rmClientTskHandle = Task_create (rmClientTsk, &taskParams, NULL);
- }
-}
-
-int main(int argc, char *argv[])
-{
- Task_Params taskParams;
- Rm_InitCfg rmInitCfg;
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
- int32_t result;
-
-
- System_printf ("*********************************************************\n");
- System_printf ("************ RM DSP+ARM DSP Client Testing **************\n");
- System_printf ("*********************************************************\n");
-
- System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
-
- coreNum = CSL_chipReadReg(CSL_CHIP_DNUM);
-
- if (coreNum == TEST_CORE) {
- testErrors = 0;
-
- /* Initialize the RM Client - RM must be initialized before anything else in the system */
- memset(&rmInitCfg, 0, sizeof(rmInitCfg));
- rmInitCfg.instName = rmClientName;
- rmInitCfg.instType = Rm_instType_CLIENT;
- rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmStaticPolicy;
- rmClientHandle = Rm_init(&rmInitCfg, &result);
- ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed");
-
- System_printf("\n\nInitialized %s\n\n", rmClientName);
-
- /* Open Client service handle */
- rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
- ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed");
-
- /* Initialize the static allocation response queue */
- for (numStaticResponses = 0; numStaticResponses < MAX_STATIC_ALLOCATION_RESPS; numStaticResponses++) {
- memset((void *)&staticResponseQueue[numStaticResponses], 0, sizeof(Rm_ServiceRespInfo));
- }
- numStaticResponses = 0;
-
- /* Static allocation tests */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- /* Request resource from Client that can only be allocated to CD according to static policy */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- 1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- NEGATIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameQosCluster,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
-
- /* Request resource from both Client and CD that is shared according to static policy */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameAifQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ,
- 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
- POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------",
- coreNum, rmClientName, resourceNameAifQ,
- requestInfo.resourceBase, requestInfo.resourceLength,
- requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {
- memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
- }
-
- }
- else {
- System_printf("Core %d : RM DSP+ARM Linux test not executing on this core\n", coreNum);
- }
-
- /* Create the RM startup task */
- System_printf("Core %d : Creating RM startup task...\n", coreNum);
- Task_Params_init (&taskParams);
- rmStartupTskHandle = Task_create (rmStartupTsk, &taskParams, NULL);
-
- System_printf("Core %d : Starting BIOS...\n", coreNum);
- BIOS_start();
-
- return (0);
-}
-
diff --git a/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg b/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-xdc.loadCapsule("dsp_client.cfg.xs");
-
-var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
-
-var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
-MessageQ.SetupTransportProxy = VirtioSetup;
-
-var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
-var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
-NameServer.SetupProxy = NsRemote;
-
-var TransportRpmsg = xdc.useModule('ti.ipc.transports.TransportRpmsg');
-
diff --git a/test/k2k/armv7/linux/rm_dsp_client_test.c b/test/k2k/armv7/linux/rm_dsp_client_test.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * ======== rm_dsp_client_test.c ========
- *
- * Works with the dspClientTest DSP application over the rpmsg-proto socket.
- */
-
-/* Standard headers */
-#include <stdio.h>
-#include <stdlib.h>
-
-/* IPC Headers */
-#include <ti/ipc/Std.h>
-#include <ti/ipc/Ipc.h>
-#include <ti/ipc/MessageQ.h>
-
-/* Socket Includes */
-#include "sockutils.h"
-#include "sockrmmsg.h"
-
-/* RM includes */
-#include <ti/drv/rm/rm_transport.h>
-
-/* App defines: Must match on remote proc side: */
-#define HEAPID 0u
-#define CLIENT_MESSAGEQ_NAME "RM_CLIENT"
-#define SERVER_MESSAGEQ_NAME "RM_SERVER"
-
-#define PROC_ID_DEFAULT 1 /* Host is zero, remote cores start at 1 */
-
-/* IPC MessageQ RM packet encapsulation structure */
-typedef struct {
- /* IPC MessageQ header (must be first element in structure) */
- MessageQ_MsgHeader msgQHeader;
- /* Pointer to RM packet */
- Rm_Packet rmPkt;
-} MsgQ_RmPacket;
-
-Int rmServerExchange_execute(UInt16 procId)
-{
- int32_t status = 0;
- int err;
- MessageQ_Msg msg = NULL;
- MessageQ_Params msgParams;
- MessageQ_QueueId queueId = MessageQ_INVALIDMESSAGEQ;
- MessageQ_Handle msgqHandle;
- char remoteQueueName[64];
- MessageQ_Msg rmMsg;
- Rm_Packet *rmPkt;
- int rm_pkt_len;
- sock_h sock_to_server;
- sock_name_t local_sock_name;
- sock_name_t server_sock;
- sock_name_t server_sock_addr;
- struct sockaddr_un server_addr;
- char client_ex_sock_name[] = "/tmp/var/run/rm/rm_dsp_client_exchange";
- char server_sock_name[] = RM_SERVER_SOCKET_NAME;
-
- printf("Entered rmServerExchange_execute\n");
-
- /* Create the local Message Queue for receiving from DSP Client. */
- MessageQ_Params_init(&msgParams);
- msgqHandle = MessageQ_create(SERVER_MESSAGEQ_NAME, &msgParams);
- if (msgqHandle == NULL) {
- printf("Error in MessageQ_create\n");
- goto exit;
- }
- else {
- printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
- }
-
- sprintf(remoteQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
- MultiProc_getName(procId));
-
- /* Poll until remote side has it's messageQ created before we send: */
- do {
- status = MessageQ_open(remoteQueueName, &queueId);
- sleep (1);
- } while (status == MessageQ_E_NOTFOUND);
-
- if (status < 0) {
- printf("Error in MessageQ_open [%d]\n", status);
- goto cleanup;
- }
- else {
- printf("Remote queueId [0x%x]\n", queueId);
- }
-
- msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
- if (msg == NULL) {
- printf("Error in MessageQ_alloc\n");
- MessageQ_close(&queueId);
- goto cleanup;
- }
-
- /* handshake with DSP client so that it knows Linux's receive Q */
- MessageQ_setReplyQueue(msgqHandle, msg);
- MessageQ_put(queueId, msg);
- MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
- MessageQ_free(msg);
-
- printf("Setting up socket connection with RM Server\n");
-
- /* open local sock for communication to RM Server */
- local_sock_name.type = sock_name_e;
- local_sock_name.s.name = client_ex_sock_name;
- sock_to_server = sock_open(&local_sock_name);
- if (!sock_to_server) {
- printf("Local socket to RM Server open failed\n");
- return -1;
- }
- /* RM Server sock */
- server_sock.type = sock_name_e;
- server_sock.s.name = server_sock_name;
-
- printf("Waiting for RM messages from DSP Client\n");
-
- while(1) {
- status = MessageQ_get(msgqHandle, &rmMsg, MessageQ_FOREVER);
- if (status < 0) {
- printf("Error in MessageQ_get [%d]\n", status);
- break;
- }
-
- rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
- printf("Received RM pkt of size %d from DSP client\n", rmPkt->pktLenBytes);
-
- /* Send received data to RM Server */
- if (sock_send(sock_to_server, (char *)rmPkt, sizeof(*rmPkt), &server_sock)) {
- printf("Failed to send data to RM Server\n");
- }
-
- /* Wait for response from RM Server */
- rm_pkt_len = 0;
- err = sock_wait(sock_to_server, &rm_pkt_len, NULL, -1);
- if (err == -2) {
- /* Timeout */
- printf("Error socket timeout\n");
- return -1;
- }
- else if (err < 0) {
- printf("Error in reading from socket, error %d\n", err);
- return -1;
- }
-
- server_sock_addr.type = sock_addr_e;
- server_sock_addr.s.addr = &server_addr;
- err = sock_recv(sock_to_server, (char *)rmPkt, rm_pkt_len, &server_sock_addr);
- if (err != rm_pkt_len) {
- printf("recv RM pkt failed from socket, received = %d, expected = %d\n",
- err, rm_pkt_len);
- return;
- }
-
- /* send back to DSP */
- status = MessageQ_put(queueId, rmMsg);
- if (status < 0) {
- printf("Error in MessageQ_put [%d]\n", status);
- break;
- }
- }
-
-cleanup:
- /* Clean-up */
- status = MessageQ_delete(&msgqHandle);
- if (status < 0) {
- printf("Error in MessageQ_delete [%d]\n", status);
- }
-
-exit:
- printf("Leaving rmServerExchange_execute\n\n");
-
- return 0;
-}
-
-int main (int argc, char ** argv)
-{
- Int32 status = 0;
- UInt16 procId = PROC_ID_DEFAULT;
-
- /* Parse Args: */
- switch (argc) {
- case 1:
- /* use defaults */
- break;
- case 2:
- procId = atoi(argv[2]);
- break;
- default:
- printf("Usage: %s [<ProcId>]\n", argv[0]);
- printf("\tDefaults: ProcId: %d\n", PROC_ID_DEFAULT);
- exit(0);
- }
-
- status = Ipc_start();
-
- if (procId >= MultiProc_getNumProcessors()) {
- printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
- Ipc_stop();
- exit(0);
- }
- printf("Using procId : %d\n", procId);
-
- if (status >= 0) {
- rmServerExchange_execute(procId);
- Ipc_stop();
- }
- else {
- printf("Ipc_start failed: status = %d\n", status);
- }
-
- return(0);
-}
diff --git a/test/k2k/armv7/linux/rm_linux_client_test.c b/test/k2k/armv7/linux/rm_linux_client_test.c
+++ /dev/null
@@ -1,987 +0,0 @@
-/*
- * rm_linux_client_test.c
- *
- * Multi-process Resource Manager test that uses sockets to allow a Linux
- * User-space application to request RM services from a RM Server,
- * Client Delegate, and Client.
- *
- * ============================================================================
- *
- * 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.
- *
- */
-
- /* Standard includes */
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-/* Socket Includes */
-#include "sockutils.h"
-#include "sockrmmsg.h"
-
-/* RM Includes */
-#include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_transport.h>
-#include <ti/drv/rm/rm_services.h>
-
-/**********************************************************************
- ************************** RM Test Symbols ***************************
- **********************************************************************/
-
-#define error_msg printf
-#define info_msg printf
-
-/* Test FALSE */
-#define RM_TEST_FALSE 0
-/* Test TRUE */
-#define RM_TEST_TRUE 1
-
-/* Socket timeout */
-#define CLIENT_SOCK_TIMEOUT_USEC (500)
-
-/* Application's registered RM transport indices */
-#define SERVER_TO_CLIENT_MAP_ENTRY 0
-/* Maximum number of registered RM transports */
-#define MAX_MAPPING_ENTRIES 1
-
-/* Size of RM static allocation response queue. Must be greater than number of APPROVED
- * static allocations */
-#define MAX_STATIC_ALLOCATION_RESPS 5
-
-/* Size of RM service response queue */
-#define MAX_QUEUED_SERVICE_RESPONSES 10
-
-/* Error checking macro */
-#define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg) \
- if (resultVal != checkVal) { \
- char errorMsgToPrint[] = printMsg; \
- printf("Error Core %d : %s : ", coreNum, rmInstName); \
- printf("%s with error code : %d\n", errorMsgToPrint, resultVal); \
- testErrors++; \
- }
-
-#define POSITIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("Core %d : %s\n", core, titleMsg); \
- printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- printf ("Core %d : - -\n", \
- core); \
- if (state == check) { \
- printf ("Core %d : - PASSED -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- testErrors++; \
- } \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("\n"); \
- } while(0);
-
-#define NEGATIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check) \
- do { \
- int32_t start = resStart; \
- int32_t alignment = align; \
- char titleMsg[] = title; \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("Core %d : %s\n", core, titleMsg); \
- printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- if (start == RM_RESOURCE_BASE_UNSPECIFIED) { \
- printf ("Core %d : - Start: UNSPECIFIED -\n", \
- core); \
- printf ("Core %d : - Length: %-16d -\n", \
- core, resLen); \
- } \
- else { \
- printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- } \
- if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) { \
- printf ("Core %d : - Alignment: UNSPECIFIED -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - Alignment: %-16d -\n", \
- core, alignment); \
- } \
- printf ("Core %d : - -\n", \
- core); \
- if (state != check) { \
- printf ("Core %d : - PASSED - Denial: %-6d -\n", \
- core, state); \
- } \
- else { \
- printf ("Core %d : - FAILED - Expected Denial -\n", \
- core); \
- testErrors++; \
- } \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("\n"); \
- } while(0);
-
-#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
- do { \
- int32_t start = resStart; \
- char titleMsg[] = title; \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("Core %d : %s\n", core, titleMsg); \
- printf ("Core %d : - Instance Name: %-32s -\n", core, instName); \
- printf ("Core %d : - Resource Name: %-32s -\n", core, resName); \
- printf ("Core %d : - Start: %-16d -\n", \
- core, resStart); \
- printf ("Core %d : - End: %-16d -\n", core, \
- (start + resLen - 1)); \
- printf ("Core %d : - Expected Owner Count: %-16d -\n", \
- core, expectRefCnt); \
- printf ("Core %d : - Returned Owner Count: %-16d -\n", \
- core, refCnt); \
- printf ("Core %d : - -\n", core); \
- if ((state == check) && (refCnt == expectRefCnt)) { \
- printf ("Core %d : - PASSED -\n", core); \
- } \
- else { \
- if (refCnt != expectRefCnt) { \
- printf ("Core %d : - FAILED - Owner Count Mismatch -\n", \
- core); \
- } \
- else { \
- printf ("Core %d : - FAILED - Denial: %-6d -\n", \
- core, state); \
- } \
- testErrors++; \
- } \
- printf ("Core %d : ---------------------------------------------------------\n", \
- core); \
- printf ("\n"); \
- } while(0);
-
-/**********************************************************************
- ********************** RM Test Data Structures ***********************
- **********************************************************************/
-
-/* RM registered transport mapping structure */
-typedef struct trans_map_entry_s {
- /* Registered RM transport handle */
- Rm_TransportHandle transportHandle;
- /* Remote socket tied to the transport handle */
- sock_name_t *remote_sock;
-} Transport_MapEntry;
-
-/**********************************************************************
- ********************** Extern Variables ******************************
- **********************************************************************/
-
-/* Alloc and free OSAL variables */
-extern uint32_t rmMallocCounter;
-extern uint32_t rmFreeCounter;
-
-/**********************************************************************
- ********************** Global Variables ******************************
- **********************************************************************/
-
-/* Core number */
-uint16_t coreNum;
-/* Number of errors that occurred during the test */
-uint16_t testErrors;
-
-/* Client instance name (must match with RM Global Resource List (GRL) and policies */
-char rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
-
-/* Client socket name */
-char rmClientSockName[] = "/tmp/var/run/rm/rm_client";
-
-/* Client socket handle */
-sock_h rmClientSocket;
-
-/* Client instance handles */
-Rm_Handle rmClientHandle = NULL;
-
-/* Client instance service handles */
-Rm_ServiceHandle *rmClientServiceHandle = NULL;
-
-/* Transport map stores the RM transport handle to IPC MessageQ queue mapping */
-Transport_MapEntry rmTransportMap[MAX_MAPPING_ENTRIES];
-
-/* Static allocation response queue */
-Rm_ServiceRespInfo staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
-/* Static allocation response queue index */
-uint32_t numStaticResponses;
-
-/* RM response info queue used to store service responses received via the callback function */
-Rm_ServiceRespInfo responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
-
-/* RM resource names (must match resource node names in GRL and policies */
-char resourceNameMemRegion[RM_NAME_MAX_CHARS] = "memory-regions";
-char resourceNameAccumCh[RM_NAME_MAX_CHARS] = "accumulator-ch";
-char resourceNameGpQ[RM_NAME_MAX_CHARS] = "gp-queue";
-char resourceNameAifQ[RM_NAME_MAX_CHARS] = "aif-queue";
-char resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
-char resourceNameAifRxCh[RM_NAME_MAX_CHARS] = "aif-rx-ch";
-char resourceNameInfraQ[RM_NAME_MAX_CHARS] = "infra-queue";
-
-/* Test RM NameServer name */
-char nameServerNameFavQ[RM_NAME_MAX_CHARS] = "My_Favorite_Queue";
-
-/**********************************************************************
- *************************** Test Functions ***************************
- **********************************************************************/
-
-Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
-{
- Rm_Packet *rm_pkt = NULL;
-
- rm_pkt = calloc(1, sizeof(*rm_pkt));
- if (!rm_pkt) {
- error_msg("can't malloc for RM send message (err: %s)\n",
- strerror(errno));
- return (NULL);
- }
- rm_pkt->pktLenBytes = pktSize;
- *pktHandle = rm_pkt;
-
- return(rm_pkt);
-}
-
-void transportFree (Rm_Packet *rm_pkt)
-{
- uint32_t pkt_size = rm_pkt->pktLenBytes;
- int32_t status;
-
- if (rm_pkt) {
- free (rm_pkt);
- }
-}
-
-int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
-{
- sock_name_t *server_sock_name = (sock_name_t *)appTransport;
- Rm_Packet *rm_pkt = (Rm_Packet *)pktHandle;
-
- if (sock_send(rmClientSocket, (char *)rm_pkt, (int) rm_pkt->pktLenBytes, server_sock_name)) {
- error_msg("send data failed\n");
- }
-
- return (0);
-}
-
-void transportReceive (void)
-{
- int32_t rm_result;
- int retval;
- int length = 0;
- sock_name_t serv_sock_name;
- sock_name_t server_sock_addr;
- Rm_Packet *rm_pkt = NULL;
- struct timeval tv = {0, CLIENT_SOCK_TIMEOUT_USEC};
- struct sockaddr_un server_addr;
-
- retval = sock_wait(rmClientSocket, &length, &tv, -1);
- if (retval == -2) {
- /* Timeout */
- return;
- }
- else if (retval < 0) {
- error_msg("Error in reading from socket, error %d\n", retval);
- return;
- }
-
- if (length < sizeof(*rm_pkt)) {
- error_msg("invalid RM message length %d\n", length);
- return;
- }
- rm_pkt = calloc(1, length);
- if (!rm_pkt) {
- error_msg("can't malloc for recv'd RM message (err: %s)\n",
- strerror(errno));
- return;
- }
-
-