author | Sam Nelson <sam.nelson@ti.com> | |
Thu, 21 Jan 2016 04:37:33 +0000 (23:37 -0500) | ||
committer | Sam Nelson <sam.nelson@ti.com> | |
Tue, 16 Feb 2016 05:05:46 +0000 (00:05 -0500) |
Includes example templates and makefile to create the examples for
different platforms
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
different platforms
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
345 files changed:
diff --git a/src/examples/dosrc.bat b/src/examples/dosrc.bat
--- /dev/null
+++ b/src/examples/dosrc.bat
@@ -0,0 +1,22 @@
+@echo off\r
+REM This file is not required. It is optional.\r
+REM Use it to customize your Windows build environment.\r
+\r
+set system=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem\r
+set xdctools=C:\Products\xdctools_3_30_04_52_core\r
+\r
+PATH=%system%;%xdctools%;%xdctools%\bin\r
+prompt $p$g \r
+\r
+doskey alias=doskey /macros\r
+doskey make="%xdctools%\gmake.exe" $*\r
+doskey xdc="%xdctools%\xdc.exe" $*\r
+doskey xs="%xdctools%\xs.exe" $*\r
+\r
+REM Cannot use doskey macro for tee command.\r
+REM Note: Cannot use ^ with 2>&1 redirection.\r
+REM make 2>&1 | %tee% Make.log\r
+set tee=%xdctools%\bin\tee.exe\r
+\r
+set system=\r
+set xdctools=\r
diff --git a/src/examples/makefile b/src/examples/makefile
--- /dev/null
+++ b/src/examples/makefile
@@ -0,0 +1,186 @@
+#
+# Copyright (c) 2013-2014, 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.
+#
+
+#
+# ======== makefile ========
+#
+IPC_INSTALL_DIR = ..
+include $(IPC_INSTALL_DIR)/products.mak
+
+# HOSTOS is best-effort assigned from values which should already have been
+# set in ../products.mak. If for some reason it is incorrectly determined,
+# you can always assign it explicitly here (to Bios, Linux, or Qnx)
+#
+# If we see KERNEL_INSTALL_DIR set, we assume Linux, else if we see
+# QNX_INSTALL_DIR set, we assume Qnx, else we assume Bios.
+ifneq ("$(KERNEL_INSTALL_DIR)","")
+ HOSTOS = Linux
+else
+ ifneq ("$(QNX_INSTALL_DIR)","")
+ HOSTOS = Qnx
+ else
+ HOSTOS = Bios
+ endif
+endif
+
+# Defining an unzip command to extract the provided examples. It uses an
+# XDCTools provided utility but can be defined to a similar utility if
+# XDCTools are not available.
+#
+UNZIP = $(XDC_INSTALL_DIR)/bin/unzip
+
+
+###############################################################################
+# Generally there is no need to edit the content below.
+#
+# The below build goals extract and build the examples based on PLATFORM and
+# HOSTOS
+###############################################################################
+
+
+EXEC_DIR = $(CURDIR)/install
+
+# determine which shell make is using
+ifeq ("$(SHELL)","sh.exe")
+ # use Windows commands
+ MKSH = CMD
+else
+ # use Linux commands
+ MKSH = SH
+endif
+
+ifeq ("$(MKSH)","SH")
+ EXHOSTOS := $(shell echo $(HOSTOS) | tr A-Z a-z)
+else
+ EXHOSTOS = $(HOSTOS)
+endif
+
+# Only elf supported now
+EXLDR = elf
+
+ARCHIVES = $(wildcard $(PLATFORM)_$(EXHOSTOS)_$(EXLDR)/ex??_*)
+EXAMPLES = $(filter %/, $(wildcard *_$(EXLDR)/ex??_*/))
+
+all:
+ @echo "#"
+ @echo "# Making all examples..."
+ifeq ("$(EXAMPLES)","")
+ @echo "There are no examples to build."
+else
+ ifeq ("$(MKSH)","SH")
+ @for d in $(EXAMPLES); do $(MAKE) -C $$d .show;\
+ $(MAKE) -C $$d all; done
+ else
+ @for %%d in ($(EXAMPLES)) do $(MAKE) -C %%d all
+ endif
+endif
+
+help:
+ @echo "make all # build all examples"
+ @echo "make clean # clean all examples (does not delete them)"
+ @echo "make clobber # delete all example"
+ @echo "make extract # unzip examples from archive folder"
+ @echo "make install # install examples onto target file system"
+ @echo ""
+ @echo "Use the EXEC_DIR variable to override install folder"
+ @echo "make EXEC_DIR=/tmp install"
+ @echo ""
+ @echo "Use -n option to make for dry run"
+ @echo "make -n all"
+ @echo ""
+ @echo "The extract goal will unzip the appropriate examples based"
+ @echo "on your settings in the products.mak file. Note: unzip will"
+ @echo "prompt before overwritting existing files."
+ @echo ""
+
+clean::
+ @echo "#"
+ @echo "# Cleaning all examples..."
+ifeq ("$(EXAMPLES)","")
+ @echo "No examples found to clean."
+else
+ ifeq ("$(MKSH)","SH")
+ @for d in $(EXAMPLES); do $(MAKE) -C $$d clean; done
+ else
+ @for %%d in ($(EXAMPLES)) do $(MAKE) -C %%d clean
+ endif
+endif
+
+clobber::
+ @echo "#"
+ @echo "# Deleting all examples..."
+ifeq ("$(EXAMPLES)","")
+ @echo "No examples found to delete."
+else
+ ifeq ("$(MKSH)","SH")
+ @for d in $(EXAMPLES); do rm -rf $$d; done
+ else
+ @for %%d in ($(EXAMPLES)) do rmdir /s /q %%d
+ endif
+endif
+
+# Note: the unzip command will prompt user when target file exists.
+extract:
+ @echo "#"
+ @echo "# Unzipping all examples..."
+ifeq ("$(ARCHIVES)","")
+ @echo "No appropriate examples found in archive folder."
+else
+ ifeq ("$(MKSH)","SH")
+ @for f in $(ARCHIVES); do $(UNZIP) -o $$f -d $$(dirname $$f); rm $$f; done
+ else
+ @for %%f in ($(ARCHIVES)) do $(UNZIP) -o -%%f -d %%(dir %%f); rm %%f
+ endif
+endif
+
+install:
+ @echo "#"
+ @echo "# Installing examples into $(EXEC_DIR)"
+ifeq ("$(EXAMPLES)","")
+ @echo "No examples found to install."
+else
+ ifeq ("$(MKSH)","SH")
+ @for d in $(EXAMPLES); do \
+ $(MAKE) -C $$d install EXEC_DIR=$(EXEC_DIR); \
+ done
+ else
+ @for %%d in ($(EXAMPLES)) do \
+ $(MAKE) -C %%d install EXEC_DIR=$(EXEC_DIR)
+ endif
+endif
+
+# portable install commands
+ifneq ($(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe),)
+ INSTALL_M = $(XDC_INSTALL_DIR)/bin/cp.exe
+else
+ INSTALL_M = install -m 0755
+endif
diff --git a/src/examples/readme.txt b/src/examples/readme.txt
--- /dev/null
+++ b/src/examples/readme.txt
@@ -0,0 +1,13 @@
+These examples have been separated into their own stand-alone .zip
+files and they build independently of the IPC makefiles.
+
+Examples can be extracted by using the unzip command. Remember to protect
+wildcard characters from the shell (unzip must see the wildcard).
+
+Some examples:
+
+1. From the platform specific folder, unzip all examples to a
+destination folder.
+
+% cd TI814X_*
+% unzip \*.zip -d /home/examples
diff --git a/src/examples/templates/ex01_hello/makefile b/src/examples/templates/ex01_hello/makefile
--- /dev/null
@@ -0,0 +1,105 @@
+#
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+# ipu1: implies smp mode
+# ipu1-0 ipu1-1: implies non-smp mode
+ALL = dsp1 dsp2 eve1 eve2 eve3 eve4 ipu1 ipu1-0 ipu1-1 ipu2 host
+PROCLIST = dsp1 dsp2
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+
+all: $(PROCLIST)
+
+$(PROCLIST):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+EXEC_DIR=$(CURDIR)/install
+endif
+override EXEC_DIR:=$(EXEC_DIR)/ex01_hello
+endif
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+clean:: $(addsuffix _clean,$(ALL))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(ALL))::
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex01_hello/mkpkg.xdt b/src/examples/templates/ex01_hello/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,100 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt
+shared/config.bld -> `this.example`/shared/config.bld
+shared/ipc.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+shared/SysCfg.h -> `this.example`/shared/SysCfg.h
+
+%%{
+ var outdir = "";
+
+ if (this.platform.match(/DRA7XX_bios_elf/)) {
+
+ /* HOST */
+ outdir = "host";
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Host.cfg" },
+ { inFile: "slave/Hello.c", outFile: outdir + "/HelloHost.c" },
+ { inFile: "slave/makefile_gcc", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Host", "a15fg", "gnu.targets.arm.A15F", this.hostOS);
+ }
+
+ /* IPU[1,2] */
+ for (var j = 1; j <= 2; j++) {
+ outdir = "ipu" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Ipu" + j + ".cfg" },
+ { inFile: "slave/Hello.c", outFile: outdir + "/HelloIpu" + j + ".c" },
+ { inFile: "slave/ipu.gel", outFile: outdir + "/ex01_hello_ipu" + j + ".gel" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* IPU1-[0,1]*/
+ for (var j = 0; j <= 1; j++) {
+ outdir = "ipu1-" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Ipu1-" + j + ".cfg" },
+ { inFile: "slave/Hello.c", outFile: outdir + "/HelloIpu1-" + j + ".c" },
+ { inFile: "slave/ipu.gel", outFile: outdir + "/ex01_hello_ipu1-" + j + ".gel" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ if (outdir == "ipu1-1") {
+ files.splice(2, 1); /* remove gel file */
+ }
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu1-" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* DSP1-2 */
+ for (var j = 1; j <= 2; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Dsp" + j + ".cfg" },
+ { inFile: "slave/Hello.c", outFile: outdir + "/HelloDsp" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+
+ /* EVE1-4 */
+ for (var j = 1; j <= 4; j++) {
+ outdir = "eve" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Eve" + j + ".cfg" },
+ { inFile: "slave/Hello.c", outFile: outdir + "/HelloEve" + j + ".c" },
+ { inFile: "slave/eve.gel", outFile: outdir + "/ex01_hello_eve" + j + ".gel" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Eve" + j, "earp32F", "ti.targets.arp32.elf.ARP32_far");
+ }
+ }
+ }
+%%}
diff --git a/src/examples/templates/ex01_hello/products.mak b/src/examples/templates/ex01_hello/products.mak
--- /dev/null
@@ -0,0 +1,83 @@
+#
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+#gnu.targets.arm.A15F = $(DEPOT)/_your_gnu_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.arp32.elf.ARP32_far = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ @echo "gnu.targets.arm.A15F = $(gnu.targets.arm.A15F)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.arp32.elf.ARP32_far = $(ti.targets.arp32.elf.ARP32_far)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex01_hello/readme.txt b/src/examples/templates/ex01_hello/readme.txt
--- /dev/null
@@ -0,0 +1,240 @@
+#
+# ======== readme.txt ========
+#
+
+hello - Send one-way messages from writer to reader
+
+Overview
+=========================================================================
+This is the "Hello World" example for IPC. It is a very simple example
+to help you get started. It is a two processor example. You can build
+it for any two processors on your device, but only for two at a time.
+
+It uses the reader/writer design pattern. One processor will be the reader
+and the other will be the writer. The reader creates a message queue and
+waits on it for messages. The writer opens the reader's message queue
+and sends messages to it. The writer allocates the message from a shared
+message pool and the reader returns the message to the pool. Thus, messages
+are sent in only one direction, but they are recycled back to the pool.
+
+
+Build Instructions
+=========================================================================
+ 1. Create a work folder on your file system.
+
+ mkdir work
+
+ 2. Extract this example into your work folder.
+
+ cd work
+ unzip <...>/ex01_hello.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ edit ex01_hello/products.mak
+
+ IPC_INSTALL_DIR = <...>/ipc_m_mm_pp_bb
+ BIOS_INSTALL_DIR = <...>/bios_m_mm_pp_bb
+ XDC_INSTALL_DIR = <...>/xdctools_m_mm_pp_bb
+
+ The compilers ship with CCS. You can use them to build this example.
+
+ edit ex01_hello/products.mak
+
+ CCS = <...>/ccsv6/tools/compiler
+
+ gnu.targets.arm.A15F = $(CCS)/gcc_arm_none_eabi_m_m_p
+ ti.targets.elf.C66 = $(CCS)/c6000_m_m_p
+ ti.targets.arm.elf.M4 = $(CCS)/arm_m_m_p
+ ti.targets.arp32.elf.ARP32_far = $(CCS)/arp32_m_m_p
+
+ 4. Build the example. This will build debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ex01_hello
+ make
+
+ By default, the example builds for dsp1 and dsp2. Look in the following
+ folders for the executables.
+
+ ex01_hello/dsp1/bin/debug/hello_dsp1.xe66
+ ex01_hello/dsp2/bin/debug/hello_dsp2.xe66
+
+ Issue the following commands to clean your example.
+
+ cd ex01_hello
+ make clean
+
+
+Build Configuration
+=========================================================================
+This example can be built for any two processors. However, you must ensure
+that each processor is assigned the appropriate role. One processor must
+be the writer and the other processor must be the reader. In addition, you
+must tell each processor the name of its peer. This is how IPC will make
+the correct connections between processors.
+
+ 1. Specify which two processors to build. Edit the top-level makefile and
+ modify the PROCLIST macro to specify which processors to build. The
+ list of available processors in defined in the ALL macro. For example,
+ to build for dsp1 and eve1, make the following changes.
+
+ edit ex01_hello/makefile
+
+ PROCLIST = dsp1 eve1
+
+ 2. Specify the role for each processor. You need to edit the source file
+ for each processor and specify its role and name its peer.
+
+ edit ex01_hello/dsp1/HelloDsp1.c
+
+ Int role = Role_WRITER;
+ String peer = "EVE1";
+
+ edit ex01_hello/eve1/HelloEve1.c
+
+ Int role = Role_READER;
+ String peer = "DSP1";
+
+ Remove the error directive. This was added as a marker in case you
+ forgot to specify the role or peer. Delete the following line:
+
+ #error Must define role and peer
+
+ 3. Specify the owner of SharedRegion zero. IPC uses a block of memory
+ commonly referred to as SR-Zero. This is the first entry in the array
+ of shared regions. This region must have an owner. One of the two
+ processors you are using must be assigned as the owner. It does not
+ matter which one.
+
+ Edit the shared configuration file and specify the name of the
+ processor which is to be the owner. Look for the ownerProcId
+ property of the SharedRegion.Entry.
+
+ edit ex01_hello/shared/ipc.cfg.xs
+
+ ownerProcId: MultiProc_getIdMeta("DSP1"),
+
+ 4. Clean and build your example.
+
+ cd ex01_hello
+ make clean
+ make
+
+
+Running the example
+=========================================================================
+Use CCS to load and run the executables. These instructions assume the
+default build configuration. Substitute the actual programs you have built.
+
+ 1. Launch CCS. Connect to the two processors you have built for. Your
+ specific connect sequence will depend on your setup.
+
+ 2. IPU only. Before loading a program on the IPU processor, you must
+ program its AMMU. Use the gel file provided with the example.
+
+ Select IPU1_C0 in the Debug window
+
+ Open the GEL Files window
+
+ Tools > GEL Files
+
+ Load the gel file provided in the example.
+
+ ex01_hello/ipu1/ex01_hello_ipu1.gel
+
+ Run the script to configure the AMMU.
+
+ Scripts > ex01_hello > ex01_hello_ipu1_ammu_config
+
+ The IPU is now ready for program loading.
+
+ 3. EVE only. Before loading a program on the EVE processor, you must
+ program its MMU. Use the gel file provided with the example.
+
+ You must be disconnected from the processor before you program its
+ MMU because the gel script will reset the processor. Disconnect from
+ the processor now.
+
+ Use the DebugSS device to load and run the gel file.
+
+ Debug > Right-Mouse-Button > Show all cores
+ Select DebugSS (open Non Debuggable Devices)
+
+ Open the GEL Files window
+
+ Tools > GEL Files
+
+ Load the gel file provided in the example.
+
+ ex01_hello/eve1/ex01_hello_eve1.gel
+
+ Run the script to configure the AMMU.
+
+ Scripts > EVE MMU Configuration > ex01_hello_eve1_ammu_config
+
+ Now you can select the EVE processor and connect to it. The EVE is
+ now ready for program loading.
+
+ 4. Load the programs. Select the processor and load the program. The
+ programs are located at the following locations.
+
+ ex01_hello/dsp1/bin/debug/hello_dsp1.xe66
+ ex01_hello/dsp2/bin/debug/hello_dsp2.xe66
+
+ 5. Run the example. Select the two processors and run them. The example
+ completes quickly, but there is no visual indication. Pause both
+ processors after a few seconds.
+
+ 6. Use the RTOS Object View to inspect the results. Each processor will
+ write log events which you can inspect in the ROV window. Open this
+ tool and select the LoggerBuf module. Open the Records tab to see the
+ individual log events. Do this for both the writer program and the
+ reader program.
+
+ Select DSP1 in the Debug window
+
+ Open the RTOS Object View
+
+ Tools > RTOS Object View (ROV)
+
+ Select the LoggerBuf module in the object browser
+ Click on the Records tab
+ Select the AppLog item
+
+ For the writer, you should see the following events (partial list):
+
+ 1 66013 xdc.runtime.Main main: -->
+ 2 79408 xdc.runtime.Main App_taskFxn: -->
+ 3 337945 xdc.runtime.Main App_taskFxn: ipc ready
+ 4 338463 xdc.runtime.Main App_writer: -->
+ 5 676262 xdc.runtime.Main App_writer: opened reader queue
+ 6 681172 xdc.runtime.Main App_writer: sending job=1
+ 7 693607 xdc.runtime.Main App_writer: sending job=2
+ 8 706192 xdc.runtime.Main App_writer: sending job=3
+ ...
+
+ For the reader, you should see the following events (partial list):
+
+ 1 54682 xdc.runtime.Main main: -->
+ 2 68095 xdc.runtime.Main App_taskFxn: -->
+ 3 325859 xdc.runtime.Main App_taskFxn: ipc ready
+ 4 326320 xdc.runtime.Main App_reader: -->
+ 5 359969 xdc.runtime.Main App_reader: reader is ready
+ 6 798508 xdc.runtime.Main App_reader: received job=1
+ 7 807514 xdc.runtime.Main App_reader: received job=2
+ 8 813934 xdc.runtime.Main App_reader: received job=3
+ ...
+
+ 7. Inspect the role variable. If you want to verify the role performed
+ by each processor, you can use the CCS Expressions window. Enter the
+ name of the variable (role) into this window. Then select one of the
+ processors. CCS will display the value of this variable. You should
+ see the following values:
+
+ role = 1 (reader)
+ role = 2 (writer)
diff --git a/src/examples/templates/ex01_hello/shared/SysCfg.h b/src/examples/templates/ex01_hello/shared/SysCfg.h
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== SysCfg.h ========
+ *
+ */
+
+#ifndef SysCfg__include
+#define SysCfg__include
+
+#include <ti/ipc/MessageQ.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#define SysCfg_NUM_MSGS 5 /* number of message to send each server */
+
+#define SysCfg_MsgHeapId 0
+#define SysCfg_ReaderFmt "ReaderQ_%s" /* %s = proc name */
+
+#define SysCfg_Cmd_START 1
+#define SysCfg_Cmd_STOP 2
+#define SysCfg_Cmd_PROCESS 3
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ UInt32 cmd;
+ UInt32 job;
+ Char buf[32];
+} SysCfg_Msg;
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex01_hello/shared/config.bld b/src/examples/templates/ex01_hello/shared/config.bld
--- /dev/null
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+/* Memory Map
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_0000 8000_0000 1000 ( 4 KB) EVE1_VECS (vector table)
+ * 8000_1000 3F_F000 ( ~4 MB) EVE1_PROG (code, data)
+ * 0000_0000 8040_0000 1000 ( 4 KB) EVE2_VECS (vector table)
+ * 8040_1000 3F_F000 ( ~4 MB) EVE2_PROG (code, data)
+ * 0000_0000 8080_0000 1000 ( 4 KB) EVE3_VECS (vector table)
+ * 8080_1000 3F_F000 ( ~4 MB) EVE3_PROG (code, data)
+ * 0000_0000 80C0_0000 1000 ( 4 KB) EVE4_VECS (vector table)
+ * 80C0_1000 3F_F000 ( ~4 MB) EVE4_PROG (code, data)
+ * 8100_0000 100_0000 ( 16 MB) --------
+ * 8200_0000 100_0000 ( 16 MB) --------
+ * 8300_0000 100_0000 ( 16 MB) --------
+ * 8400_0000 100_0000 ( 16 MB) --------
+ * 8500_0000 100_0000 ( 16 MB) --------
+ * 8600_0000 100_0000 ( 16 MB) IPU1 (code, data) [1]
+ * 8600_0000 80_0000 ( 8 MB) IPU1-0 (code, data) [1]
+ * 8680_0000 80_0000 ( 8 MB) IPI1-1 (code, data) [1]
+ * 8700_0000 100_0000 ( 16 MB) --------
+ * 8800_0000 100_0000 ( 16 MB) --------
+ * 8900_0000 100_0000 ( 16 MB) --------
+ * 8A00_0000 100_0000 ( 16 MB) IPU2 (code, data) [2]
+ * 8B00_0000 100_0000 ( 16 MB) HOST (code, data)
+ * 8C00_0000 100_0000 ( 16 MB) DSP1 (code, data)
+ * 8D00_0000 100_0000 ( 16 MB) DSP2 (code, data)
+ * 8E00_0000 100_0000 ( 16 MB) SR_0 (ipc)
+ * 8F00_0000 100_0000 ( 16 MB) --------
+ *
+ * Notes
+ * ------------------------------------------------------------------------
+ * [1] IPU1 implies SMP mode; IPU1-0, IPU1-1 implies non-SMP mode. You
+ * cannot use both at the same time.
+ *
+ * [2] IPU2 implies SMP mode.
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x8E000000, len: 0x1000000,
+ comment: "SR#0 Memory (16 MB)"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "DSP1_PROG", {
+ name: "DSP1_PROG", space: "code/data", access: "RWX",
+ base: 0x8C000000, len: 0x1000000,
+ comment: "DSP1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP1_PROG",
+ dataMemory: "DSP1_PROG",
+ stackMemory: "DSP1_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] = {
+ externalMemoryMap: [
+ [ "DSP2_PROG", {
+ name: "DSP2_PROG", space: "code/data", access: "RWX",
+ base: 0x8D000000, len: 0x1000000,
+ comment: "DSP2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP2_PROG",
+ dataMemory: "DSP2_PROG",
+ stackMemory: "DSP2_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve1"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x1000, page: 0,
+ comment: "EVE1 Vector Table (4 KB)"
+ }],
+ [ "EVE1_PROG", {
+ name: "EVE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80001000, len: 0x3FF000, page: 1,
+ comment: "EVE1 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE1_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE1_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve2"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80400000, len: 0x1000, page: 0,
+ comment: "EVE2 Vector Table (4 KB)"
+ }],
+ [ "EVE2_PROG", {
+ name: "EVE2_PROG", space: "code/data", access: "RWX",
+ base: 0x80401000, len: 0x3FF000, page: 1,
+ comment: "EVE2 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE2_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE2_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve3"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x1000, page: 0,
+ comment: "EVE3 Vector Table (4 KB)"
+ }],
+ [ "EVE3_PROG", {
+ name: "EVE3_PROG", space: "code/data", access: "RWX",
+ base: 0x80801000, len: 0x3FF000, page: 1,
+ comment: "EVE3 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE3_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE3_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve4"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80C00000, len: 0x1000, page: 0,
+ comment: "EVE4 Vector Table (4 KB)"
+ }],
+ [ "EVE4_PROG", {
+ name: "EVE4_PROG", space: "code/data", access: "RWX",
+ base: 0x80C01000, len: 0x3FF000, page: 1,
+ comment: "EVE4 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE4_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE4_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE4_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "IPU1_PROG", {
+ name: "IPU1_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x1000000,
+ comment: "IPU1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_PROG",
+ dataMemory: "IPU1_PROG",
+ stackMemory: "IPU1_PROG"
+};
+
+var ipu1_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-0"] = {
+ externalMemoryMap: [
+ [ "IPU1_0_PROG", {
+ name: "IPU1_0_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x800000,
+ comment: "IPU1-0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_0_PROG",
+ dataMemory: "IPU1_0_PROG",
+ stackMemory: "IPU1_0_PROG"
+};
+
+var ipu1_0_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-1"] = {
+ externalMemoryMap: [
+ [ "IPU1_1_PROG", {
+ name: "IPU1_1_PROG", space: "code/data", access: "RWX",
+ base: 0x86800000, len: 0x800000,
+ comment: "IPU1-1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_1_PROG",
+ dataMemory: "IPU1_1_PROG",
+ stackMemory: "IPU1_1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "IPU2_PROG", {
+ name: "IPU2_PROG", space: "code/data", access: "RWX",
+ base: 0x8A000000, len: 0x1000000,
+ comment: "IPU2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU2_PROG",
+ dataMemory: "IPU2_PROG",
+ stackMemory: "IPU2_PROG"
+};
+
+var ipu2_ammu = {
+ prog: { /* program memory */
+ pa: 0x8A000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x8B000000, len: 0x1000000,
+ comment: "HOST Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% }
\ No newline at end of file
diff --git a/src/examples/templates/ex01_hello/shared/ipc.cfg.xs b/src/examples/templates/ex01_hello/shared/ipc.cfg.xs
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+var procNameAry = ["DSP1","DSP2","EVE1","EVE2","EVE3","EVE4","IPU1","IPU2",
+ "HOST"];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: MultiProc.getIdMeta("DSP1"),
+ isValid: true,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
diff --git a/src/examples/templates/ex01_hello/slave/Hello.c b/src/examples/templates/ex01_hello/slave/Hello.c
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ this.platform = this.arguments[0];
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== Hello`core`.c ========
+ * Platform: `platform`
+ */
+
+/* package header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "../shared/SysCfg.h"
+
+
+/* private functions */
+Void App_taskFxn(UArg arg0, UArg arg1);
+int App_reader(void);
+int App_writer(void);
+
+/* define application role */
+#define Role_READER 1
+#define Role_WRITER 2
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+% if (core.match(/dsp1/i)) {
+Int role = Role_WRITER; /* role of this processor */
+String peer = "DSP2"; /* name of peer processor */
+% } else if (core.match(/dsp2/i)) {
+Int role = Role_READER; /* role of this processor */
+String peer = "DSP1"; /* name of peer processor */
+% } else {
+#error Must define role and peer
+Int role = ; /* role of this processor */
+String peer = ; /* name of peer processor */
+% }
+% }
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "App_taskFxn";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Error_init(&eb);
+
+ Task_create(App_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== App_taskFxn ========
+ */
+Void App_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status;
+ UInt16 remoteProcId;
+
+ Log_print0(Diags_ENTRY, "App_taskFxn: -->");
+
+ /*
+ * initialize the ipc layer
+ */
+ status = Ipc_start();
+
+ if (status < 0) {
+ System_abort("Ipc_start failed\n");
+ }
+
+ remoteProcId = MultiProc_getId(peer);
+ do {
+ status = Ipc_attach(remoteProcId);
+
+ } while ((status < 0) && (status == Ipc_E_NOTREADY));
+
+ Log_print0(Diags_INFO, "App_taskFxn: ipc ready");
+
+
+ /* perform application role */
+ if (role == Role_READER) {
+ App_reader();
+ }
+ else if (role == Role_WRITER) {
+ App_writer();
+ }
+ else {
+ System_abort("main: invalid application role");
+ }
+
+ Log_print0(Diags_EXIT, "App_taskFxn: <--");
+}
+
+/*
+ * ======== App_reader ========
+ */
+int App_reader(void)
+{
+ Int status;
+ MessageQ_Handle que;
+ SysCfg_Msg *msg;
+ Ptr heap;
+ Bool running = TRUE;
+
+
+ Log_print0(Diags_ENTRY, "App_reader: -->");
+
+ /* use SR_0 heap for messages */
+ heap = SharedRegion_getHeap(0);
+ MessageQ_registerHeap(heap, 0);
+
+ /* create local message queue (inbound messages) */
+ que = MessageQ_create("ReaderQ", NULL);
+
+ if (que == NULL) {
+ Log_error0("App_reader: MessageQ_create failed");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO, "App_reader: reader is ready");
+
+ /* main process loop */
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(que, (MessageQ_Msg *)&msg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ Log_error1("App_reader: MessageQ_get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* process the message */
+ switch (msg->cmd) {
+ case SysCfg_Cmd_PROCESS:
+ Log_print1(Diags_INFO, "App_reader: received job=%d",
+ (IArg)(msg->job));
+ /* ... */
+ break;
+
+ case SysCfg_Cmd_STOP:
+ Log_print0(Diags_INFO, "App_reader: received stop message");
+ running = FALSE;
+ break;
+
+ default:
+ Log_error1("App_reader: unknown cmd=%d", (IArg)(msg->cmd));
+ break;
+ }
+
+ MessageQ_free((MessageQ_Msg)msg);
+
+ } /* while (running) */
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&que);
+
+ if (status < 0) {
+ Log_error1("App_reader: MessageQ_delete error=%d", (IArg)status);
+ goto leave;
+ }
+
+leave:
+ Log_print1(Diags_EXIT, "App_reader: <-- %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== App_writer ========
+ */
+int App_writer(void)
+{
+ Int status, i;
+ Ptr heap;
+ MessageQ_QueueId que;
+ SysCfg_Msg *msg;
+
+ Log_print0(Diags_ENTRY, "App_writer: -->");
+
+ /* use SR_0 heap for messages */
+ heap = SharedRegion_getHeap(0);
+ MessageQ_registerHeap(heap, 0);
+
+ /* open the reader message queue, loop until queue is available */
+ do {
+ status = MessageQ_open("ReaderQ", &que);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ Task_sleep(1);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("App_writer: could not open reader message queue");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO, "App_writer: opened reader queue");
+
+ /* send process messages */
+ for (i = 1; i <= 10; i++) {
+
+ /* allocate a message */
+ msg = (SysCfg_Msg *)MessageQ_alloc(0, sizeof(SysCfg_Msg));
+
+ if (msg == NULL) {
+ Log_error0("App_writer: MessageQ_alloc failed");
+ goto leave;
+ }
+
+ /* fill in the message */
+ msg->cmd = SysCfg_Cmd_PROCESS;
+ msg->job = i;
+
+ Log_print1(Diags_INFO, "App_writer: sending job=%d", (IArg)(msg->job));
+
+ /* send the message */
+ status = MessageQ_put(que, (MessageQ_Msg)msg);
+
+ if (status < 0) {
+ Log_error1("App_writer: MessageQ_put error=%d", (IArg)status);
+ goto leave;
+ }
+ }
+
+ /* send stop message */
+ msg = (SysCfg_Msg *)MessageQ_alloc(0, sizeof(SysCfg_Msg));
+
+ if (msg == NULL) {
+ Log_error0("App_writer: MessageQ_alloc failed");
+ goto leave;
+ }
+
+ /* fill in the message */
+ msg->cmd = SysCfg_Cmd_STOP;
+
+ /* send the message */
+ status = MessageQ_put(que, (MessageQ_Msg)msg);
+
+ if (status < 0) {
+ Log_error1("App_writer: MessageQ_put error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* close the queue */
+ status = MessageQ_close(&que);
+
+ if (status < 0) {
+ Log_error1("App_writer: MessageQ_close error=%d", (IArg)status);
+ goto leave;
+ }
+
+leave:
+ Log_print1(Diags_EXIT, "App_writer: <-- %d", (IArg)status);
+ return(status);
+}
diff --git a/src/examples/templates/ex01_hello/slave/Slave.cfg b/src/examples/templates/ex01_hello/slave/Slave.cfg
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+% if (platform.match(/^DRA7XX_bios_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+var Assert = xdc.useModule('xdc.runtime.Assert');
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Error = xdc.useModule('xdc.runtime.Error');
+var Log = xdc.useModule('xdc.runtime.Log');
+var Registry = xdc.useModule('xdc.runtime.Registry');
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+% if (platform.match(/DRA7XX/)) {
+% if (target.match(/\.A15F$/)) {
+xdc.global.SR0_cacheEnable = true;
+% } else {
+xdc.global.SR0_cacheEnable = false;
+% }
+% }
+xdc.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+% if (platform.match(/DRA7XX/) && target.match(/\.C66$/)) {
+
+/* make SR_0 non-cacheable */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(ipc_cfg.SR0Mem.base, ipc_cfg.SR0Mem.len, Cache.Mar_DISABLE);
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/ipu[12]/)) {
+
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+% }
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1(?!-1)|ipu2/)) {
+/*
+ * ======== IPU/CORE0 Processor (primary core) ========
+ */
+% if (lcCore == "ipu1-0") {
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 0;
+% }
+
+/* enable the unicache */
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* configure ammu (because unicache is enabled) */
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+
+/* increase small page 0 to 16 KB */
+var entry = AMMU.smallPages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x00000000;
+entry.translatedAddress = 0x55020000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/* increase small page 1 to 16 KB to access timers (non-cacheable) */
+var entry = AMMU.smallPages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x40000000;
+entry.translatedAddress = 0x55080000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* map program code/data memory into ammu (cacheable) */
+var entry = AMMU.largePages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.prog.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.cache];
+
+/* map SR_0 ammu (non-cacheable) */
+var entry = AMMU.largePages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.cache];
+
+/* map L3/L4 peripherals (mailbox, spinlock) into ammu (non-cacheable) */
+var entry = AMMU.largePages[3];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x60000000;
+entry.translatedAddress = 0x40000000;
+entry.size = AMMU.Large_512M;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+% } else {
+/*
+ * ======== IPU/CORE1 Processor (slave core) ========
+ */
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 1;
+
+% }
+/* configure the interrupt cross-bar mmr base address */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+
+/* configure hardware spin lock base address to match ammu mapping of L3/L4 */
+var GateHWSpinlock = xdc.useModule('ti.sdo.ipc.gates.GateHWSpinlock');
+GateHWSpinlock.baseAddr = 0x6A0F6800;
+
+% }
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+% if (lcCore.match(/eve/)) {
+//Program.stack = 0x800; /* small stack needed to fit in DMEM */
+% }
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+% if (lcCore.match(/eve/)) {
+//heapMemParams.size = 0x1400; /* small heap needed to fit in DMEM */
+% }
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* configure SMP-enabled System module */
+var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
+% } else {
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+% }
+% if (lcCore.match(/eve/)) {
+//SysMin.bufSize = 0x200; /* small buffer needed to fit in DMEM */
+% }
+% }
+% else {
+% throw new Error("unsupported platform: " + platform);
+% }
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/eve/)) {
+
+/* place text character table in external memory, too big for DMEM */
+var Text_charTab = new prog.SectionSpec();
+Text_charTab.loadSegment = "`procName`_PROG";
+Program.sectMap[".const:xdc_runtime_Text_charTab__A"] = Text_charTab;
+
+/* reduce size of idle stack, too big for DMEM */
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.idleTaskStackSize = 0x200;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+
+/* Turn off the timer frequency check. The DSP timer does not run when
+ * the host is halted because of the emulation suspend signal.
+ */
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+Timer.checkFrequency = false;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+% if (lcCore == "dsp1") {
+
+/* allocate timers 5 and 6 to DSP1 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x0030;
+% } else {
+
+/* allocate timers 7 and 8 to DSP2 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x00C0;
+% }
+% }
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1-[01]/)) {
+
+BIOS.smpEnabled = false;
+% } else {
+
+BIOS.smpEnabled = true;
+% }
+% }
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* create a SMP-enabled logger instance */
+var LoggerBuf = xdc.useModule('ti.sysbios.smp.LoggerBuf');
+% } else {
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+% }
+% }
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex01_hello/slave/eve.gel b/src/examples/templates/ex01_hello/slave/eve.gel
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2013-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== ex01_hello_`lcCore`.gel ========
+ */
+
+#define UInt32 unsigned int
+#define WR_MEM_32(addr, data) *(UInt32*)(addr) = (UInt32)(data)
+#define RD_MEM_32(addr) *(UInt32*)(addr)
+
+
+/*
+ * TRM 19.5.2 MMU Registers
+ *
+ * 0000_0050 MMU_LOCK Table 19-42
+ * [14:10] BASEVALUE Locked entries base value
+ * [8:4] CURRENTVICTIM Current entry to be updated
+ *
+ * 0000_0058 MMU_CAM Table 19-46
+ * [31:12] VTAG Valid bit
+ * [3] P Preserved bit
+ * 0: TLB entry may be flushed
+ * 1: TLB entry is protected against flush
+ * [2] V Valid bit
+ * 0: TLB entry is invalid
+ * 1: TLB entry is valid
+ * [1:0] PAGESIZE Page size
+ * 0: Section (1 MB)
+ * 1: Large page (64 KB)
+ * 2: Small page (4 KB)
+ * 3: Supersection (16 MB)
+ *
+ * 0000_0058 MMU_RAM Table 19-48
+ * [31:12] PHYSICALADDR Physical address of the page
+ * [11:0] RESERVED
+ */
+
+% if (lcCore == "eve1") {
+#define EVE_MMU0 0x42081000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07B50 /* TRM 3.11.39.1 */
+% } else if (lcCore == "eve2") {
+#define EVE_MMU0 0x42181000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07B90 /* TRM 3.11.40.1 */
+% } else if (lcCore == "eve3") {
+#define EVE_MMU0 0x42281000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07BD0 /* TRM 3.11.41.1 */
+% } else if (lcCore == "eve4") {
+#define EVE_MMU0 0x42381000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07C10 /* TRM 3.11.42.1 */
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+
+menuitem "EVE MMU Configuration"
+
+hotmenu ex01_hello_`lcCore`_mmu_config()
+{
+ unsigned int val;
+ unsigned int PHY_ADDR;
+
+% if (lcCore == "eve1") {
+ PHY_ADDR = 0x80000000;
+% } else if (lcCore == "eve2") {
+ PHY_ADDR = 0x80400000;
+% } else if (lcCore == "eve3") {
+ PHY_ADDR = 0x80800000;
+% } else if (lcCore == "eve4") {
+ PHY_ADDR = 0x80C00000;
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+
+ GEL_TextOut("`procName`_mmu_config start...\n");
+
+ /* map program vector table */
+ WR_MEM_32(EVE_MMU0+0x58, 0x0000000E); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, PHY_ADDR); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2800); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x0000_0000 --> 0x8000_0000 (4 KB)\n");
+
+ /* map program load address */
+ WR_MEM_32(EVE_MMU0+0x58, 0x8000000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x80000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2810); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x8000_0000 --> 0x8000_0000 (16 MB)\n");
+
+ /* map SR_0 */
+ WR_MEM_32(EVE_MMU0+0x58, 0x8E00000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x8E000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2820); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x8E00_0000 --> 0x8E00_0000 (16 MB)\n");
+
+ /* map L3/L4 */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4800000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x48000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2830); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4800_0000 --> 0x4800_0000 (16 MB)\n");
+
+ /* map Control Module */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4A00000C); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x4A000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2840); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4A00_0000 --> 0x4A00_0000 (1 MB)\n");
+
+ /* map EVE Mailbox */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4200000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x42000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2850); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4200_0000 --> 0x4200_0000 (16 MB)\n");
+
+ /* disable walking logic */
+ val = RD_MEM_32(EVE_MMU0+0x44); /* MMU_CNTL */
+ val &= 4;
+ WR_MEM_32(EVE_MMU0+0x44, val);
+
+ /* enable mmu */
+ val = RD_MEM_32(EVE_MMU0+0x44); /* MMU_CNTL */
+ val |= 2;
+ WR_MEM_32(EVE_MMU0+0x44, val);
+
+ GEL_TextOut("`procName`_mmu_config done\n");
+
+ /* setup reset vectors */
+ *(unsigned int *)(PHY_ADDR + 0x0) = PHY_ADDR + 0x30;
+ *(unsigned int *)(PHY_ADDR + 0x4) = PHY_ADDR + 0x30;
+ *(unsigned int *)(PHY_ADDR + 0x8) = PHY_ADDR + 0x30;
+
+ /* write idle instruction */
+ *(unsigned int *)(PHY_ADDR + 0x30) = 0x0000037F;
+ *(unsigned int *)(PHY_ADDR + 0x34) = 0x0000037F;
+
+ /* release cpu from reset */
+ *(unsigned int *)RM_EVE_RSTCTRL &= ~(0x1);
+
+ GEL_TextOut("`procName` cpu released from reset\n");
+}
diff --git a/src/examples/templates/ex01_hello/slave/ipu.gel b/src/examples/templates/ex01_hello/slave/ipu.gel
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2013-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== ex01_hello_`lcCore`.gel ========
+ */
+
+#define UInt32 unsigned int
+#define WR_MEM_32(addr, data) *(UInt32*)(addr) = (UInt32)(data)
+#define RD_MEM_32(addr) *(UInt32*)(addr)
+
+/* AMMU Configuration Registers
+ *
+ * 0x000 Large_0 Page Address
+ * 0x020 Large_0 Page Translated Address
+ * 0x040 Large_0 Page Policy
+ * 0x004 Large_1 Page Address
+ * 0x024 Large_1 Page Translated Address
+ * 0x044 Large_1 Page Policy
+ * 0x008 Large_2 Page Address
+ * 0x028 Large_2 Page Translated Address
+ * 0x048 Large_2 Page Policy
+ * 0x00C Large_3 Page Address
+ * 0x02C Large_3 Page Translated Address
+ * 0x04C Large_3 Page Policy
+
+ * 0x060 Medium_0 Page Address
+ * 0x0A0 Medium_0 Page Translated Address
+ * 0x0E0 Medium_0 Page Policy
+ * 0x064 Medium_1 Page Address
+ * 0x0A4 Medium_1 Page Translated Address
+ * 0x0E4 Medium_1 Page Policy
+
+ * 0x120 - 0x19F Small Page Address
+ * 0x1A0 - 0x21F Small Page Translated Address
+ * 0x220 - 0x29F Small Page Policy
+ * 0x2A0 - 0x31F Small Page Maintenance
+ *
+ * Policy Description
+ * [16] CACHE Cache enable
+ * 0: non-cacheable
+ * 1: cacheable
+ * [1:0] SIZE Page size
+ * 0: mmu entry is disabled
+ * 1: 4 KB - small page
+ * 1: 128 KB - medium page
+ * 1: 32 MB - large page
+ * 3: 16 KB - small page
+ * 3: 256 KB - medium page
+ * 3: 512 MB - large page
+ */
+
+/* TRM 7.4.1 Unicache MMU (AMMU), local address */
+#define IPU1_AMMU_CFG 0x55080800
+
+menuitem "ex01_hello"
+
+hotmenu ex01_hello_`lcCore.replace(/-/,"_")`_ammu_config()
+{
+ GEL_TextOut("`procName` AMMU config\n");
+
+ /* disable all entries */
+ WR_MEM_32(IPU1_AMMU_CFG+0x220, 0x00000000); // Small_0
+ WR_MEM_32(IPU1_AMMU_CFG+0x224, 0x00000000); // Small_1
+ WR_MEM_32(IPU1_AMMU_CFG+0x228, 0x00000000); // Small_2
+ WR_MEM_32(IPU1_AMMU_CFG+0x22C, 0x00000000); // Small_3
+ WR_MEM_32(IPU1_AMMU_CFG+0x230, 0x00000000); // Small_4
+ WR_MEM_32(IPU1_AMMU_CFG+0x234, 0x00000000); // Small_5
+ WR_MEM_32(IPU1_AMMU_CFG+0x238, 0x00000000); // Small_6
+ WR_MEM_32(IPU1_AMMU_CFG+0x23C, 0x00000000); // Small_7
+ WR_MEM_32(IPU1_AMMU_CFG+0x240, 0x00000000); // Small_8
+ WR_MEM_32(IPU1_AMMU_CFG+0x244, 0x00000000); // Small_9
+
+ WR_MEM_32(IPU1_AMMU_CFG+0x0E0, 0x00000000); // Medium_0
+ WR_MEM_32(IPU1_AMMU_CFG+0x0E4, 0x00000000); // Medium_1
+
+ WR_MEM_32(IPU1_AMMU_CFG+0x040, 0x00000000); // Large_0
+ WR_MEM_32(IPU1_AMMU_CFG+0x044, 0x00000000); // Large_1
+ WR_MEM_32(IPU1_AMMU_CFG+0x048, 0x00000000); // Large_2
+ WR_MEM_32(IPU1_AMMU_CFG+0x04C, 0x00000000); // Large_3
+
+ /* Large_0 */
+% if (lcCore.match(/ipu1/)) {
+ WR_MEM_32(IPU1_AMMU_CFG+0x000, 0x86000000); // physical address
+% } else if (lcCore == "ipu2") {
+ WR_MEM_32(IPU1_AMMU_CFG+0x000, 0x8A000000); // physical address
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+ WR_MEM_32(IPU1_AMMU_CFG+0x020, 0xFE000001); // no translate
+ WR_MEM_32(IPU1_AMMU_CFG+0x040, 0x00010001); // 32 MB, cacheable
+
+ /* Medium_0 */
+// WR_MEM_32(IPU1_AMMU_CFG+0x060, 0x8A100000); // virtual address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0A0, 0x40440000); // physical address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0E0, 0x00010001); // 128 KB, cacheable
+
+ /* Medium_1 */
+// WR_MEM_32(IPU1_AMMU_CFG+0x064, 0x8A140000); // virtual address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0A4, 0x40300000); // physical address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0E4, 0x00000003); // 256 KB, non-cacheable
+
+ /* Small_0 (L2 RAM)*/
+ WR_MEM_32(IPU1_AMMU_CFG+0x120, 0x00000000); // virtual address
+ WR_MEM_32(IPU1_AMMU_CFG+0x1A0, 0x55020000); // physical address
+ WR_MEM_32(IPU1_AMMU_CFG+0x220, 0x00000003); // 16 KB, non-cacheable
+
+ /* Small_1 (local config) */
+ WR_MEM_32(IPU1_AMMU_CFG+0x124, 0x40000000); // virtual address
+ WR_MEM_32(IPU1_AMMU_CFG+0x1A4, 0x55080000); // physical address
+ WR_MEM_32(IPU1_AMMU_CFG+0x224, 0x00000003); // 16 KB, non-cacheable
+
+ GEL_TextOut("AMMU config done.\n");
+}
diff --git a/src/examples/templates/ex01_hello/slave/makefile b/src/examples/templates/ex01_hello/slave/makefile
--- /dev/null
@@ -0,0 +1,197 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+
+ if (platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+ if (target.match(/\.C66$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.ARP32(_far|)$/)) {
+ cc = "bin/cl-arp32";
+ lnk = "bin/cl-arp32 -z";
+ }
+ else if (target.match(/\.M4$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Hello`core`.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug hello_`lcCore`.x
+# $(MAKE) PROFILE=release hello_`lcCore`.x
+
+hello_`lcCore`.x: bin/$(PROFILE)/hello_`lcCore`.x`suffix`
+bin/$(PROFILE)/hello_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: `core`.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../shared/config.bld -r release \
+% if (target.match(/\.M4$/)) {
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\", \
+ configBld: \"../shared/config.bld\" \
+ }" `core`.cfg
+% } else {
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" `core`.cfg
+% }
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/hello_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+% if (platform.match(/DRA7XX/) && lcCore.match(/eve|ipu1(?!-1)|ipu2/)) {
+ $(CP) ex01_hello_`lcCore`.gel $(EXEC_DIR)/debug
+% }
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/hello_`lcCore`.x`suffix` $(EXEC_DIR)/release
+% if (platform.match(/DRA7XX/) && lcCore.match(/eve|ipu1(?!-1)|ipu2/)) {
+ $(CP) ex01_hello_`lcCore`.gel $(EXEC_DIR)/release
+% }
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex01_hello/slave/makefile_gcc b/src/examples/templates/ex01_hello/slave/makefile_gcc
--- /dev/null
@@ -0,0 +1,177 @@
+#
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var csprefix = "";
+
+ if (platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ if (target.match(/^gnu.targets.arm.A15F$/)) {
+ csprefix = "gnu.targets.arm.A15F";
+ cc = "/bin/arm-none-eabi-gcc";
+ lnk = "/bin/arm-none-eabi-gcc";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Hello`core`.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug hello_`lcCore`.x
+# $(MAKE) PROFILE=release hello_`lcCore`.x
+
+hello_`lcCore`.x: bin/$(PROFILE)/hello_`lcCore`.x`suffix`
+bin/$(PROFILE)/hello_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) -o $@ $(LDFLAGS) $(objs) $(libs) -Wl,-T,$(CONFIG)/linker.cmd \
+ -lgcc -lc -lm -lnosys $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: `core`.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" `core`.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/hello_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/hello_`lcCore`.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(`csprefix`)`cc` -c -MD -MF $@.dep
+%// unused
+%// AR = $(CS_A15_PREFIX)ar cr
+LD = $(`csprefix`)`cc`
+
+CPPFLAGS = -Dfar= -D__DYNAMIC_REENT__
+CFLAGS = -Wall -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections $(CCPROFILE_$(PROFILE)) @$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -mfloat-abi=hard -nostartfiles -Wl,-static -Wl,--gc-sections -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -L$(XDC_INSTALL_DIR)/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu
+
+CCPROFILE_debug = -g -ggdb -D_DEBUG_=1
+CCPROFILE_release = -O2
+
+LDPROFILE_debug = -g -ggdb
+LDPROFILE_release =
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex02_messageq/host/Android.mk b/src/examples/templates/ex02_messageq/host/Android.mk
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+##### appHost #####
+include $(CLEAR_VARS)
+
+IPC_ROOT := ../../..
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(IPC_ROOT)/linux/include \
+ $(LOCAL_PATH)/$(IPC_ROOT)/packages
+
+LOCAL_CFLAGS += -DIPC_BUILDOS_ANDROID
+LOCAL_MODULE_TAGS:= optional
+
+LOCAL_SRC_FILES:= $(IPC_ROOT)/examples/ex02_messageq/host/App.c \
+ $(IPC_ROOT)/examples/ex02_messageq/host/main_host.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog libtiipcutils libtiipc libtitransportrpmsg
+
+LOCAL_MODULE:= appHost
+include $(BUILD_EXECUTABLE)
diff --git a/src/examples/templates/ex02_messageq/host/App.c b/src/examples/templates/ex02_messageq/host/App.c
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== App.c ========
+ *
+ */
+
+/* host header files */
+#include <stdio.h>
+#include <unistd.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+#include "App.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; // created locally
+ MessageQ_QueueId slaveQue; // opened remotely
+ UInt16 heapId; // MessageQ heapId
+ UInt32 msgSize;
+} App_Module;
+
+/* private data */
+static App_Module Module;
+
+
+/*
+ * ======== App_create ========
+ */
+
+Int App_create(UInt16 remoteProcId)
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ char msgqName[32];
+
+ printf("--> App_create:\n");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = App_MsgHeapId;
+ Module.msgSize = sizeof(App_Msg);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(App_HostMsgQueName, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ printf("App_create: Failed creating MessageQ\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* open the remote message queue */
+ sprintf(msgqName, App_SlaveMsgQueName, MultiProc_getName(remoteProcId));
+
+ do {
+ status = MessageQ_open(msgqName, &Module.slaveQue);
+ sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("App_create: Failed opening MessageQ\n");
+ goto leave;
+ }
+
+ printf("App_create: Host is ready\n");
+
+leave:
+ printf("<-- App_create:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_delete ========
+ */
+Int App_delete(Void)
+{
+ Int status;
+
+ printf("--> App_delete:\n");
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- App_delete:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_exec ========
+ */
+Int App_exec(Void)
+{
+ Int status;
+ Int i;
+ App_Msg * msg;
+
+ printf("--> App_exec:\n");
+
+ /* fill process pipeline */
+ for (i = 1; i <= 3; i++) {
+ printf("App_exec: sending message %d\n", i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = App_CMD_NOP;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* process steady state (keep pipeline full) */
+ for (i = 4; i <= 15; i++) {
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* extract message payload */
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ printf("App_exec: message received, sending message %d\n", i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ if (i == 15) {
+ /* Last message will tell the slave to shutdown */
+ msg->cmd = App_CMD_SHUTDOWN;
+ }
+ else {
+ msg->cmd = App_CMD_NOP;
+ }
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* drain process pipeline */
+ for (i = 1; i <= 3; i++) {
+ printf("App_exec: message received\n");
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* extract message payload */
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+
+leave:
+ printf("<-- App_exec: %d\n", status);
+ return(status);
+}
diff --git a/src/examples/templates/ex02_messageq/host/App.h b/src/examples/templates/ex02_messageq/host/App.h
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== App.h ========
+ *
+ */
+
+#ifndef App__include
+#define App__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Int App_create(UInt16 remoteProcId);
+Int App_delete();
+Int App_exec();
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* App__include */
diff --git a/src/examples/templates/ex02_messageq/host/App_bios.c b/src/examples/templates/ex02_messageq/host/App_bios.c
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== App.c ========
+ */
+
+/* package header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+
+#include <ti/sysbios/heaps/HeapBuf.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+#include "App.h"
+
+/* round up the value 'size' to the next 'align' boundary */
+#define ROUNDUP(size, align) \
+ (UInt32)(((UInt32)(size) + ((UInt32)(align) - 1)) & ~((UInt32)(align) - 1))
+
+#define NUM_MSGS 4
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; // created locally
+ MessageQ_QueueId slaveQue; // opened remotely
+ UInt16 heapId; // MessageQ heapId
+ HeapBuf_Handle heap; // message heap
+ Int msgSize; // aligned size of message
+ Int poolSize; // size of message pool
+ Ptr store; // memory store for message pool
+} App_Module;
+
+/* private data */
+static App_Module Module;
+
+
+/*
+ * ======== App_create ========
+ */
+
+Int App_create(UInt16 remoteProcId)
+{
+ Int status = 0;
+ Int align;
+ Error_Block eb;
+ IHeap_Handle srHeap;
+ HeapBuf_Params heapParams;
+ MessageQ_Params msgqParams;
+ char msgqName[32];
+
+ Log_print0(Diags_INFO, "App_create: -->");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = App_MsgHeapId;
+ Module.msgSize = 0;
+
+ /* compute message size to fill entire cache lines */
+ align = SharedRegion_getCacheLineSize(0);
+ Module.msgSize = ROUNDUP(sizeof(App_Msg), align);
+
+ /* compute message pool size */
+ Module.poolSize = Module.msgSize * NUM_MSGS;
+
+ /* acquire message pool memory */
+ srHeap = (IHeap_Handle)SharedRegion_getHeap(0);
+ Module.store = Memory_alloc(srHeap, Module.poolSize, align, NULL);
+
+ /* create a heap in shared memory for message pool */
+ HeapBuf_Params_init(&heapParams);
+ heapParams.blockSize = Module.msgSize;
+ heapParams.numBlocks = NUM_MSGS;
+ heapParams.bufSize = Module.poolSize;
+ heapParams.align = align;
+ heapParams.buf = Module.store;
+ Error_init(&eb);
+
+ Module.heap = HeapBuf_create(&heapParams, &eb);
+
+ if (Module.heap == NULL) {
+ Log_error0("App_create: failed creating message pool");
+ status = -1;
+ goto leave;
+ }
+
+ /* bind message pool to heapId */
+ MessageQ_registerHeap((Ptr)(Module.heap), App_MsgHeapId);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(NULL, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ Log_error0("App_create: failed creating MessageQ");
+ status = -1;
+ goto leave;
+ }
+
+ /* open the remote message queue */
+ System_sprintf(msgqName, App_SlaveMsgQueName,
+ MultiProc_getName(remoteProcId));
+
+ do {
+ status = MessageQ_open(msgqName, &Module.slaveQue);
+ Task_sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("App_create: failed opening MessageQ");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO, "App_create: Host is ready");
+
+leave:
+ Log_print1(Diags_INFO, "App_create: <-- status=%d", (IArg)status);
+ return(status);
+}
+
+
+/*
+ * ======== App_delete ========
+ */
+Int App_delete(Void)
+{
+ Int status;
+ IHeap_Handle srHeap;
+
+ Log_print0(Diags_INFO, "App_delete: -->");
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* unregister message pool heap */
+ MessageQ_unregisterHeap(App_MsgHeapId);
+
+ /* delete the message pool heap */
+ HeapBuf_delete(&Module.heap);
+
+ /* release message pool memory */
+ srHeap = (IHeap_Handle)SharedRegion_getHeap(0);
+ Memory_free(srHeap, Module.store, Module.poolSize);
+
+leave:
+ Log_print1(Diags_INFO, "App_delete: <-- status=%d", (IArg)status);
+ return(status);
+}
+
+
+/*
+ * ======== App_exec ========
+ */
+Int App_exec(Void)
+{
+ Int status;
+ Int i;
+ App_Msg * msg;
+
+ Log_print0(Diags_INFO, "App_exec: -->");
+
+ /* fill process pipeline */
+ for (i = 1; i <= 3; i++) {
+ Log_print1(Diags_INFO, "App_exec: sending message %d", (IArg)i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = App_CMD_NOP;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* process steady state (keep pipeline full) */
+ for (i = 4; i <= 15; i++) {
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* extract message payload */
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ Log_print1(Diags_INFO, "App_exec: message received, sending message %d",
+ (IArg)i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ if (i == 15) {
+ /* Last message will tell the slave to shutdown */
+ msg->cmd = App_CMD_SHUTDOWN;
+ }
+ else {
+ msg->cmd = App_CMD_NOP;
+ }
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* drain process pipeline */
+ for (i = 1; i <= 3; i++) {
+ Log_print0(Diags_INFO, "App_exec: message received");
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* extract message payload */
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+
+leave:
+ Log_print1(Diags_INFO, "App_exec: <-- status=%d", (IArg)status);
+ return(status);
+}
diff --git a/src/examples/templates/ex02_messageq/host/Host.cfg b/src/examples/templates/ex02_messageq/host/Host.cfg
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.platform;
+%%}
+
+/*
+ * ======== Host.cfg ========
+ * Platform: `platform`
+ * Target: gnu.targets.arm.A15F
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.IHeap');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Memory');
+xdc.useModule('xdc.runtime.System');
+
+xdc.useModule('ti.sdo.ipc.Ipc');
+xdc.useModule('ti.sdo.ipc.MessageQ');
+xdc.useModule('ti.sdo.ipc.SharedRegion');
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+xdc.useModule('ti.sysbios.heaps.HeapBuf');
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+% if (platform.match(/(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf/)) {
+xdc.global.SR0_cacheEnable = true;
+% } else {
+% throw new Error("unsupported platform: " + platform);
+% }
+xdc.global.procName = "HOST";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex02_messageq/host/Qnx/app_host.use b/src/examples/templates/ex02_messageq/host/Qnx/app_host.use
--- /dev/null
@@ -0,0 +1,14 @@
+Usage:
+ app_host [options] procName
+
+Arguments:
+ procName : the name of the remote processor
+
+Options:
+ h : print this help message
+ l : list the available remote names
+
+Examples:
+ app_host DSP
+ app_host -l
+ app_host -h
\ No newline at end of file
diff --git a/src/examples/templates/ex02_messageq/host/Qnx/arm/makefile b/src/examples/templates/ex02_messageq/host/Qnx/arm/makefile
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
diff --git a/src/examples/templates/ex02_messageq/host/Qnx/arm/o.g.le.v7/makefile b/src/examples/templates/ex02_messageq/host/Qnx/arm/o.g.le.v7/makefile
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+$(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g: \
+ $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.g.le.v7/libipc_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.g.le.v7/libutils_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc_g = -Bstatic
+LIBPOST_ipc_g = -Bdynamic
+LIBPREF_utils_g = -Bstatic
+LIBPOST_utils_g = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.g.le.v7
+LIBS += ipc_g
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.g.le.v7
+LIBS += utils_g
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+
+# copy and rename executables to suit our preferences
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g \
+ $(PROJECT_ROOT)/../bin/debug/app_host
diff --git a/src/examples/templates/ex02_messageq/host/Qnx/arm/o.le.v7/makefile b/src/examples/templates/ex02_messageq/host/Qnx/arm/o.le.v7/makefile
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+CCFLAGS += -O3
+
+$(PROJECT_ROOT)/arm/o.le.v7/app_host: \
+ $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.le.v7/libipc.a \
+ $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.le.v7/libutils.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc = -Bstatic
+LIBPOST_ipc = -Bdynamic
+LIBPREF_utils = -Bstatic
+LIBPOST_utils = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.le.v7
+LIBS += ipc
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.le.v7
+LIBS += utils
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+
+# copy and rename executables to suite our preferences
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.le.v7/app_host \
+ $(PROJECT_ROOT)/../bin/release/app_host
diff --git a/src/examples/templates/ex02_messageq/host/Qnx/common.mk b/src/examples/templates/ex02_messageq/host/Qnx/common.mk
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME = app_host
+
+define PINFO
+PINFO DESCRIPTION=MessageQ Example
+endef
+
+# don't install the binaries, they are copied in base makefile
+INSTALLDIR = bin/examples
+
+CCOPTS += -DOS_QNX
+
+# source path
+EXTRA_SRCVPATH += $(PROJECT_ROOT)/..
+SRCS = main_host.c App.c
+
+# include path
+EXTRA_INCVPATH += \
+ $(PROJECT_ROOT)/../.. \
+ $(IPC_INSTALL_DIR)/packages \
+ $(IPC_INSTALL_DIR)/qnx/include \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
+
+include $(MKFILES_ROOT)/qtargets.mk
+
+LDFLAGS += -M
diff --git a/src/examples/templates/ex02_messageq/host/Qnx/makefile b/src/examples/templates/ex02_messageq/host/Qnx/makefile
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+LIST=CPU
+include recurse.mk
diff --git a/src/examples/templates/ex02_messageq/host/main_bios.c b/src/examples/templates/ex02_messageq/host/main_bios.c
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== Main`core`.c ========
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "App.h"
+
+/* private functions */
+Void App_taskFxn(UArg arg0, UArg arg1);
+
+/* define server processor name */
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+#define SERVER "DSP1"
+% } else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+#define SERVER "CORE0"
+% } else {
+% }
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char* argv[])
+{
+ Int status;
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "App_taskFxn";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Error_init(&eb);
+
+ Task_create(App_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== App_taskFxn ========
+ */
+Void App_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status;
+ UInt16 remoteProcId;
+
+ Log_print0(Diags_INFO, "App_taskFxn: -->");
+
+ /*
+ * initialize the ipc layer
+ */
+ status = Ipc_start();
+
+ if (status < 0) {
+ System_abort("Ipc_start failed\n");
+ }
+
+ remoteProcId = MultiProc_getId(SERVER);
+ if (remoteProcId == MultiProc_INVALIDID) {
+ System_abort("Improper MultiProc ID\n");
+ }
+ do {
+ status = Ipc_attach(remoteProcId);
+
+ } while ((status < 0) && (status == Ipc_E_NOTREADY));
+
+ Log_print0(Diags_INFO, "App_taskFxn: ipc ready");
+
+ /* application create phase */
+ status = App_create(remoteProcId);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = App_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = App_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ Log_print1(Diags_INFO, "App_taskFxn: <-- status=%d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex02_messageq/host/main_host.c b/src/examples/templates/ex02_messageq/host/main_host.c
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== main_host.c ========
+ *
+ */
+
+/* cstdlib header files */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+% if (!this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#include <ti/ipc/transports/TransportRpmsg.h>
+% }
+
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "App.h"
+
+/* private functions */
+static Int Main_main(Void);
+static Int Main_parseArgs(Int argc, Char *argv[]);
+
+
+#define Main_USAGE "\
+Usage:\n\
+ app_host [options] procName\n\
+\n\
+Arguments:\n\
+ procName : the name of the remote processor\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+ l : list the available remote names\n\
+\n\
+Examples:\n\
+ app_host DSP\n\
+ app_host -l\n\
+ app_host -h\n\
+\n"
+
+/* private data */
+static String Main_remoteProcName = NULL;
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Int status;
+
+ printf("--> main:\n");
+
+ /* parse command line */
+ status = Main_parseArgs(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+% if (!this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+% }
+
+ /* Ipc initialization */
+ status = Ipc_start();
+
+ if (status >= 0) {
+ /* application create, exec, delete */
+ status = Main_main();
+
+ /* Ipc finalization */
+ Ipc_stop();
+ }
+ else {
+ printf("Ipc_start failed: status = %d\n", status);
+ goto leave;
+ }
+
+leave:
+ printf("<-- main:\n");
+ status = (status >= 0 ? 0 : status);
+
+ return (status);
+}
+
+
+/*
+ * ======== Main_main ========
+ */
+Int Main_main(Void)
+{
+ UInt16 remoteProcId;
+ Int status = 0;
+
+ printf("--> Main_main:\n");
+
+ remoteProcId = MultiProc_getId(Main_remoteProcName);
+
+ /* application create phase */
+ status = App_create(remoteProcId);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = App_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = App_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- Main_main:\n");
+
+ status = (status >= 0 ? 0 : status);
+ return (status);
+}
+
+
+/*
+ * ======== Main_parseArgs ========
+ */
+Int Main_parseArgs(Int argc, Char *argv[])
+{
+ Int x, cp, opt, argNum;
+ UInt16 i, numProcs;
+ String name;
+ Int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ case 'l': /* -l */
+ printf("Processor List\n");
+ status = Ipc_start();
+ if (status >= 0) {
+ numProcs = MultiProc_getNumProcessors();
+ for (i = 0; i < numProcs; i++) {
+ name = MultiProc_getName(i);
+ printf(" procId=%d, procName=%s\n", i, name);
+ }
+ Ipc_stop();
+ }
+ else {
+ printf(
+ "Error: %s, line %d: Ipc_start failed\n",
+ __FILE__, __LINE__);
+ goto leave;
+ }
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (Char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ for (argNum = 1; opt < argc; argNum++, opt++) {
+
+ switch (argNum) {
+ case 1: /* name of proc #1 */
+ Main_remoteProcName = argv[opt];
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: too many arguments\n",
+ __FILE__, __LINE__);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* validate command line arguments */
+ if (Main_remoteProcName == NULL) {
+ printf("Error: missing procName argument\n");
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ return(status);
+}
diff --git a/src/examples/templates/ex02_messageq/host/makefile_bios b/src/examples/templates/ex02_messageq/host/makefile_bios
--- /dev/null
@@ -0,0 +1,179 @@
+#
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var suffix = "";
+ var platInst = "";
+ var csprefix = "";
+
+ if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:host";
+ suffix = "a15fg";
+ } else if (this.platform.match(/^TCI6636_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI6636K2H:host";
+ suffix = "a15fg";
+ } else if (this.platform.match(/^66AK2E_bios_elf$/)) {
+ platInst = "ti.platforms.evmC66AK2E:host";
+ suffix = "a15fg";
+ } else if (this.platform.match(/^66AK2G_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI66AK2G02:host";
+ suffix = "a15fg";
+ } else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI6630K2L:host";
+ suffix = "a15fg";
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ /* gnu.targets.arm.A15F */
+ csprefix = "gnu.targets.arm.A15F";
+ cc = "/bin/arm-none-eabi-gcc";
+ lnk = "/bin/arm-none-eabi-gcc";
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = MainHost.c App.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug app_host.x
+# $(MAKE) PROFILE=release app_host.x
+
+app_host.x: bin/$(PROFILE)/app_host.x`suffix`
+bin/$(PROFILE)/app_host.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) -o $@ $(LDFLAGS) $(objs) $(libs) -Wl,-T,$(CONFIG)/linker.cmd \
+ -lgcc -lc -lm -lnosys $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: Host.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t gnu.targets.arm.A15F \
+ -c $(gnu.targets.arm.A15F) \
+ -p `platInst` \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" Host.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(`csprefix`)`cc` -c -MD -MF $@.dep
+%// unused
+%// AR = $(CS_A15_PREFIX)ar cr
+LD = $(`csprefix`)`cc`
+
+CPPFLAGS = -Dfar= -D__DYNAMIC_REENT__
+CFLAGS = -Wall -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections $(CCPROFILE_$(PROFILE)) @$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -mfloat-abi=hard -nostartfiles -Wl,-static -Wl,--gc-sections -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -L$(XDC_INSTALL_DIR)/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu
+
+CCPROFILE_debug = -g -ggdb -D_DEBUG_=1
+CCPROFILE_release = -O2
+
+LDPROFILE_debug = -g -ggdb
+LDPROFILE_release =
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex02_messageq/host/makefile_linux b/src/examples/templates/ex02_messageq/host/makefile_linux
--- /dev/null
@@ -0,0 +1,146 @@
+#
+# Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+%%{
+ if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ var suffix = 'ov5T';
+ } else {
+ var suffix = 'ov7A';
+ }
+%%}
+
+srcs = main_host.c App.c
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.`suffix`.dep,$(srcs)))
+
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.`suffix`,$(srcs)))
+libs = $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.a \
+ $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.a \
+ $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.a
+
+# Use dynamic or shared libs
+#libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.so \
+# $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.so \
+# $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.so
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug app_host
+ $(MAKE) PROFILE=release app_host
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+app_host: bin/$(PROFILE)/app_host
+bin/$(PROFILE)/app_host: $(objs) $(libs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.`suffix`: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I.. -I $(IPC_INSTALL_DIR)/linux/include -I $(IPC_INSTALL_DIR)/packages
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex02_messageq/host/makefile_qnx b/src/examples/templates/ex02_messageq/host/makefile_qnx
--- /dev/null
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+export PKGPATH
+
+#
+# Determine build host OS (Windows or Linux)
+#
+ifeq (,$(BUILDHOSTOS))
+ ifeq (,$(findstring :,$(WINDIR)$(windir)$(COMSPEC)$(comspec)))
+ BUILDHOSTOS := Linux
+ else
+ BUILDHOSTOS := Windows
+ endif
+endif
+
+ifeq (Linux,$(BUILDHOSTOS))
+QNX_PATH := $(QNX_INSTALL_DIR)/host/linux/x86/usr/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/usr/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/linux/x86/usr/photon/appbuilder
+endif
+
+export PATH
+
+export QNX_CONFIGURATION ?= $(QNX_INSTALL_DIR)/etc/qnx
+export QNX_HOST ?= $(QNX_INSTALL_DIR)/host/linux/x86
+export QNX_TARGET ?= $(QNX_INSTALL_DIR)/target/qnx6
+export MAKEFLAGS = -I$(QNX_INSTALL_DIR)/target/qnx6/usr/include
+export LD_LIBRARY_PATH ?= $(QNX_INSTALL_DIR)/host/linux/x86/usr/lib
+export IPC_INSTALL_DIR
+
+all: app
+
+app: PATH:=$(QNX_PATH):$(PATH)
+app:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C Qnx
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean:: PATH:=$(QNX_PATH):$(PATH)
+clean::
+ $(MAKE) -C Qnx clean
+ $(RMDIR) bin
+
+
+#
+# ======== install validation ========
+#
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+#
+# ======== standard macros ========
+#
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+#
+# ======== create output directories ========
+#
+ifneq (clean,$(MAKECMDGOALS))
+ifeq (,$(wildcard bin/debug))
+ $(shell $(MKDIR) -p bin/debug)
+endif
+ifeq (,$(wildcard bin/release))
+ $(shell $(MKDIR) -p bin/release)
+endif
+endif
diff --git a/src/examples/templates/ex02_messageq/makefile b/src/examples/templates/ex02_messageq/makefile
--- /dev/null
@@ -0,0 +1,133 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+PROCLIST = dsp1 dsp2 ipu1 ipu2 host
+% } else if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+# ipu1: implies smp mode
+# ipu1-0 ipu1-1: implies non-smp mode
+ALL = dsp1 dsp2 host
+PROCLIST = dsp1 host
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+PROCLIST = dsp1 dsp2 ipu1 ipu2 host
+% } else if (this.platform.match(/^DRA7XX_android_elf$/)) {
+PROCLIST = dsp1 dsp2 ipu1 ipu2
+% } else if (this.platform.match(/^OMAP54XX_(qnx|linux)_elf$/)) {
+PROCLIST = dsp ipu host
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+PROCLIST = dsp host
+% } else if (this.platform.match(/^TCI6636_(bios|linux)_elf$/)) {
+PROCLIST = host core0 core1 core2 core3 core4 core5 core6 core7
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_(bios|linux)_elf$/)) {
+PROCLIST = host core0
+% } else if (this.platform.match(/^TCI6630_(bios|linux)_elf$/)) {
+PROCLIST = host core0 core1 core2 core3
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+
+all: $(PROCLIST)
+
+$(PROCLIST):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ $(MAKE) -C $@
+% } else {
+ $(MAKE) -C $@ PROCLIST="$(PROCLIST)"
+% }
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+EXEC_DIR=$(CURDIR)/install
+endif
+override EXEC_DIR:=$(EXEC_DIR)/ex02_messageq
+endif
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+clean:: $(addsuffix _clean,$(ALL))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(ALL))::
+ $(MAKE) -C $(subst _clean,,$@) clean
+% } else {
+clean: $(addsuffix _clean,$(PROCLIST))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(PROCLIST)):
+ $(MAKE) -C $(subst _clean,,$@) clean
+% }
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex02_messageq/mkpkg.xdt b/src/examples/templates/ex02_messageq/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,252 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (this.platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+% /* OK */
+% } else if (!this.hostOS.match(/qnx|linux|android/)) {
+ throw ("Unsupported Host OS: " + this.hostOS);
+% }
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+% // readme.txt -> `this.example`/readme.txt @verbatim
+readme.txt -> `this.example`/readme.txt
+
+shared/AppCommon.h -> `this.example`/shared/AppCommon.h
+% if (this.platform.match(/OMAPL138_linux_elf/)) {
+ shared/config_linux.bld -> `this.example`/dsp/config.bld
+% } else if (this.platform.match(/DRA7XX_bios_elf/)) {
+ shared/config_dra7xx.bld -> `this.example`/shared/config.bld
+ shared/ipc_dra7xx.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+% } else if (this.platform.match(/TCI6636_bios_elf/)) {
+ shared/config_tci6636.bld -> `this.example`/shared/config.bld
+ shared/ipc_tci6636.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+% } else if (this.platform.match(/66AK2E_bios_elf/)) {
+ shared/config_66ak2e.bld -> `this.example`/shared/config.bld
+ shared/ipc_66ak2e.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+% } else if (this.platform.match(/66AK2G_bios_elf/)) {
+ shared/config_66ak2g.bld -> `this.example`/shared/config.bld
+ shared/ipc_66ak2g.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+% } else if (this.platform.match(/TCI6630_bios_elf/)) {
+ shared/config_tci6630.bld -> `this.example`/shared/config.bld
+ shared/ipc_tci6630.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+% } else if (this.platform.match(/TCI6636_linux_elf/)) {
+ shared/config_tci6636_linux.bld -> `this.example`/shared/config.bld
+% } else if (this.platform.match(/66AK2E_linux_elf/)) {
+ shared/config_66ak2e_linux.bld -> `this.example`/shared/config.bld
+% } else if (this.platform.match(/66AK2G_linux_elf/)) {
+ shared/config_66ak2g_linux.bld -> `this.example`/shared/config.bld
+% } else if (this.platform.match(/TCI6630_linux_elf/)) {
+ shared/config_tci6630_linux.bld -> `this.example`/shared/config.bld
+% } else {
+ shared/config.bld -> `this.example`/shared/config.bld
+ shared/ipc.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+% }
+
+% if ((this.hostOS == "qnx") || (this.hostOS == "linux") || (this.hostOS == "android")) {
+host/main_host.c -> `this.example`/host/main_host.c
+host/App.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+% } else if (this.hostOS == "bios") {
+host/main_bios.c -> `this.example`/host/MainHost.c
+host/Host.cfg -> `this.example`/host/Host.cfg
+host/App_bios.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+% } else {
+% throw new Error("unsupported host operating system: " + this.hostOS);
+% }
+
+% if (this.hostOS == "qnx") {
+ host/makefile_qnx -> `this.example`/host/makefile
+ host/Qnx/app_host.use -> `this.example`/host/Qnx/app_host.use
+ host/Qnx/common.mk -> `this.example`/host/Qnx/common.mk
+ host/Qnx/makefile -> `this.example`/host/Qnx/makefile
+ host/Qnx/arm/makefile -> `this.example`/host/Qnx/arm/makefile
+ host/Qnx/arm/o.g.le.v7/makefile -> `this.example`/host/Qnx/arm/o.g.le.v7/makefile
+ host/Qnx/arm/o.le.v7/makefile -> `this.example`/host/Qnx/arm/o.le.v7/makefile
+% } else if (this.hostOS == "linux") {
+ host/makefile_linux -> `this.example`/host/makefile
+% } else if (this.hostOS == "android") {
+ host/Android.mk -> `this.example`/host/Android.mk
+% } else if (this.hostOS == "bios") {
+% if (this.platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+host/makefile_bios -> `this.example`/host/makefile
+% }
+% else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+% } else {
+% throw new Error("unsupported host operating system: " + this.hostOS);
+% }
+
+%%{
+ var outdir = "";
+
+ if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: "dsp/Dsp.cfg" },
+ { inFile: "slave/DspAmmu.cfg", outFile: "dsp/DspAmmu.cfg" },
+ { inFile: "slave/main_slave.c", outFile: "dsp/MainDsp.c" },
+ { inFile: "slave/makefile", outFile: "dsp/makefile" },
+ { inFile: "slave/Server.c", outFile: "dsp/Server.c" },
+ { inFile: "slave/Server.h", outFile: "dsp/Server.h" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp", "e64T", "ti.targets.elf.C64T");
+ }
+
+ /* ipu */
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: "ipu/Ipu.cfg" },
+ { inFile: "slave/IpuAmmu_omap5.cfg", outFile: "ipu/IpuAmmu.cfg" },
+ { inFile: "slave/main_slave.c", outFile: "ipu/MainIpu.c" },
+ { inFile: "slave/makefile", outFile: "ipu/makefile" },
+ { inFile: "slave/Server.c", outFile: "ipu/Server.c" },
+ { inFile: "slave/Server.h", outFile: "ipu/Server.h" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu", "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+ else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: "dsp/Dsp.cfg" },
+ { inFile: "slave/main_slave.c", outFile: "dsp/MainDsp.c" },
+ { inFile: "slave/makefile", outFile: "dsp/makefile" },
+ { inFile: "slave/Server.c", outFile: "dsp/Server.c" },
+ { inFile: "slave/Server.h", outFile: "dsp/Server.h" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp", "e674", "ti.targets.elf.C674");
+ }
+ }
+ else if (this.platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+ var baseIpu, maxIpu;
+ var baseDsp, maxDsp;
+ var outdir;
+
+ if (this.platform.match(/^DRA7XX_(linux|android)_elf$/)) {
+ baseIpu = 1;
+ maxIpu = 2;
+ baseDsp = 1;
+ maxDsp = 2;
+ } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ baseIpu = 1;
+ maxIpu = 2;
+ baseDsp = 1;
+ maxDsp = 2;
+ }
+
+ /* IPU[1,2] */
+ for (var j = baseIpu; j <= maxIpu; j++) {
+ outdir = "ipu" + j;
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: outdir + "/Ipu" + j + ".cfg" },
+ { inFile: "slave/IpuAmmu_dra7xx.cfg", outFile: outdir + "/IpuAmmu.cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: outdir + "/MainIpu" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* DSP[1,2] */
+ for (var j = baseDsp; j <= maxDsp; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: outdir + "/Dsp" + j + ".cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: outdir + "/MainDsp" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+ }
+ else if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+
+ /* DSP1-2 */
+ for (var j = 1; j <= 2; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Dsp" + j + ".cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_bios.c", outFile: outdir + "/MainDsp" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+ }
+ else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_(bios|linux)_elf$/)) {
+
+ /* CORE0-7 */
+ var coreNum;
+ if (this.platform.match(/^TCI6636_bios_elf$/)) {
+ coreNum = 7;
+ }
+ else if (this.platform.match(/^(66AK2E|66AK2G)_(bios|linux)_elf$/)) {
+ coreNum = 0;
+ }
+ else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+ coreNum = 3;
+ }
+ if (this.hostOS == "linux") {
+ for (var j = 0; j <= coreNum; j++) {
+ outdir = "core" + j;
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: outdir + "/Core" + j + ".cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: outdir + "/MainCore" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Core" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+ }
+ else {
+ for (var j = 0; j <= coreNum; j++) {
+ outdir = "core" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Core" + j + ".cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_bios.c", outFile: outdir + "/MainCore" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Core" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+ }
+ }
+%%}
diff --git a/src/examples/templates/ex02_messageq/products.mak b/src/examples/templates/ex02_messageq/products.mak
--- /dev/null
@@ -0,0 +1,141 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ var isLinux = this.platform.match(/_linux_/);
+ var isQnx = this.platform.match(/_qnx_/);
+%%}
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+% if (isLinux) {
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+% } else if (isQnx) {
+#### QNX toolchain ####
+#QNX_INSTALL_DIR = $(DEPOT)/_your_qnx_install_
+% }
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C64T = $(DEPOT)/_your_ti_codegen_install_
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+#ti.targets.elf.C674 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^OMAP54XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C64T = $(DEPOT)/_your_ti_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_android_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+#gnu.targets.arm.A15F = $(DEPOT)/_your_gnu_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.arp32.elf.ARP32_far = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_(bios|linux)_elf$/)) {
+#gnu.targets.arm.A15F = $(DEPOT)/_your_gnu_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+% if (isLinux) {
+ @echo "HOST TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+% } else if (isQnx) {
+ @echo "QNX_INSTALL_DIR = $(QNX_INSTALL_DIR)"
+% }
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C64T = $(ti.targets.elf.C64T)"
+% } else if (this.platform.match(/^OMAP54XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C64T = $(ti.targets.elf.C64T)"
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ @echo "ti.targets.elf.C674 = $(ti.targets.elf.C674)"
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else if (this.platform.match(/^DRA7XX_android_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ @echo "gnu.targets.arm.A15F = $(gnu.targets.arm.A15F)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.arp32.elf.ARP32_far = $(ti.targets.arp32.elf.ARP32_far)"
+% } else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_(bios|linux)_elf$/)) {
+ @echo "gnu.targets.arm.A15F = $(gnu.targets.arm.A15F)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex02_messageq/readme.txt b/src/examples/templates/ex02_messageq/readme.txt
--- /dev/null
@@ -0,0 +1,117 @@
+#
+# ======== readme.txt ========
+#
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+
+message queue - Send round-trip message from client to server and back
+
+
+Overview
+=========================================================================
+This is a MessageQ example using the client/server pattern. It is a two
+processor example. It only builds for the HOST and DSP processors. You can
+build for either DSP1 or DSP2.
+
+The DSP processor is the server. It will create a named message queue.
+The server does not open any queues because it will extract the return
+address from the message header. The server returns all messages to the
+sender. It does not access the message pool.
+
+The HOST processor is the client application. The client creates an
+anonymous message queue. The client also creates and manages the message
+pool. The client's return address is set in the message header for each
+message before sending it to the server.
+
+
+Build Instructions
+=========================================================================
+
+ 1. Create a work folder on your file system.
+
+ mkdir work
+
+ 2. Extract this example into your work folder.
+
+ cd work
+ unzip <...>/ex02_messageq.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ edit ex02_messageq/products.mak
+
+ IPC_INSTALL_DIR = <...>/ipc_m_mm_pp_bb
+ BIOS_INSTALL_DIR = <...>/bios_m_mm_pp_bb
+ XDC_INSTALL_DIR = <...>/xdctools_m_mm_pp_bb
+
+ The compilers ship with CCS. You can use them to build this example.
+
+ edit ex02_messageq/products.mak
+
+ CCS = <...>/ccsv6/tools/compiler
+
+ gnu.targets.arm.A15F = $(CCS)/gcc_arm_none_eabi_m_m_p
+ ti.targets.elf.C66 = $(CCS)/c6000_m_m_p
+ ti.targets.arm.elf.M4 = $(CCS)/arm_m_m_p
+ ti.targets.arp32.elf.ARP32_far = $(CCS)/arp32_m_m_p
+
+ 4. Build the example. This will build only debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ex02_messageq
+ make
+
+ By default, the example builds for host and dsp1. Look in the following
+ folders for the executables.
+
+ ex02_messageq/host/bin/debug/app_host.xa15fg
+ ex02_messageq/dsp1/bin/debug/server_dsp1.xe66
+
+ 5. Issue the following commands to clean your example.
+
+ cd ex02_messageq
+ make clean
+
+
+Build Configuration
+=========================================================================
+When building, you can choose between dsp1 or dsp2. Use these instructions
+to specify which processor to build and to configure the host to use the
+correct server.
+
+ 1. Specify which two processors to build. Edit the top-level makefile and
+ modify the PROCLIST macro to specify which processors to build. The
+ list of available processors in defined in the ALL macro. However,
+ the client must always run on the HOST. For example, follow these
+ steps to build for dsp2.
+
+ edit ex02_messageq/makefile
+
+ PROCLIST = dsp2 host
+
+ 2. Edit the client source file and specify the name of the server processor.
+
+ edit ex02_messageq/host/MainHost.c
+
+ /* define server processor name */
+ #define SERVER "DSP2"
+
+ 3. Clean and build your example.
+
+ cd ex02_messageq
+ make clean
+ make
+% } else {
+
+MessageQ Example
+
+Program Logic:
+The slave creates a message to pass data around. The host sends a message to
+the slave core with a dummy payload. The slave then sends the message back to
+the host. This process is repeated 14 times. Then the host a shutdown message
+to the slave. The slave returns the message, shuts itself down and
+reinitializes itself for future runs.
+% }
diff --git a/src/examples/templates/ex02_messageq/shared/AppCommon.h b/src/examples/templates/ex02_messageq/shared/AppCommon.h
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== AppCommon.h ========
+ *
+ */
+
+#ifndef AppCommon__include
+#define AppCommon__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*
+ * ======== Application Configuration ========
+ */
+
+/* notify commands 00 - FF */
+#define App_CMD_MASK 0xFF000000
+#define App_CMD_NOP 0x00000000 /* cc------ */
+#define App_CMD_SHUTDOWN 0x02000000 /* cc------ */
+
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ UInt32 cmd;
+} App_Msg;
+
+#define App_MsgHeapId 0
+#define App_HostMsgQueName "HOST:MsgQ:01"
+#define App_SlaveMsgQueName "%s:MsgQ:01" /* %s is each slave's Proc Name */
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* AppCommon__include */
diff --git a/src/examples/templates/ex02_messageq/shared/config.bld b/src/examples/templates/ex02_messageq/shared/config.bld
--- /dev/null
@@ -0,0 +1,419 @@
+/*
+ * Copyright (c) 2013-2015, 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+% if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Memory Map for ti.platforms.sdp5430:ipu
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
+ * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
+ * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var sdp5430_ExtMemMapIpu = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x005FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00600000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80600000,
+ len: 0x09600000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.sdp5430:ipu"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", sdp5430_ExtMemMapIpu.EXT_CODE ],
+ [ "EXT_DATA", sdp5430_ExtMemMapIpu.EXT_DATA ],
+ [ "EXT_HEAP", sdp5430_ExtMemMapIpu.EXT_HEAP ],
+ [ "TRACE_BUF", sdp5430_ExtMemMapIpu.TRACE_BUF ],
+ [ "EXC_DATA", sdp5430_ExtMemMapIpu.EXC_DATA ],
+ [ "PM_DATA", sdp5430_ExtMemMapIpu.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+/* Memory Map for ti.platforms.sdp5430:dsp
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 2000_0000 ????_???? 10_0000 ( 1 MB) EXT_CODE
+ * 9000_0000 ????_???? 10_0000 ( 1 MB) EXT_DATA
+ * 9010_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var sdp5430_ExtMemMapDsp = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x20000000,
+ len: 0x00100000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x90000000,
+ len: 0x00100000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x90100000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.sdp5430:dsp"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", sdp5430_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", sdp5430_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", sdp5430_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", sdp5430_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", sdp5430_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", sdp5430_ExtMemMapDsp.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+
+/*
+ * ======== IPU ammu configuration ========
+ */
+var ammu = {
+ /* program code/data memory (cacheable) */
+ largePage0: {
+ pa: 0x8A000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ /* SR_0 data memory (non-cacheable) */
+ largePage1: {
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+% } else if (this.platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+/* Memory Map for ti.platforms.evmDRA7XX:dsp1 and ti.platforms.evmDRA7XX:dsp2
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 9500_4000 ????_???? 10_0000 ( ~1 MB) EXT_CODE
+ * 9510_0000 ????_???? 10_0000 ( 1 MB) EXT_DATA
+ * 9520_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapDsp = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x95000000,
+ len: 0x00100000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x95100000,
+ len: 0x00100000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x95200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ },
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ],
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] =
+ Build.platformTable["ti.platforms.evmDRA7XX:dsp1"];
+
+
+
+/* Memory Map for ti.platforms.evmDRA7XX:ipu2
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
+ * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
+ * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu2 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x005FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00600000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80600000,
+ len: 0x09600000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu2.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu2.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu2.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu2.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu2.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu2.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+/* Memory Map for ti.platforms.evmDRA7XX:ipu1
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? F_C000 ( ~1 MB) EXT_CODE
+ * 8000_0000 ????_???? 20_0000 ( 2 MB) EXT_DATA
+ * 8020_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu1 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x000FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00200000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu1.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu1.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu1.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu1.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu1.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu1.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex02_messageq/shared/config_66ak2e.bld b/src/examples/templates/ex02_messageq/shared/config_66ak2e.bld
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map for ti.platforms.evmC66AK2E
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 380_0000 ( 56 MB) --------
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmC66AK2E:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmC66AK2E:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_66ak2e_linux.bld b/src/examples/templates/ex02_messageq/shared/config_66ak2e_linux.bld
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+Build.platformTable["ti.platforms.evmC66AK2E:core0"] = {
+ externalMemoryMap: [ ]
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_66ak2g.bld b/src/examples/templates/ex02_messageq/shared/config_66ak2g.bld
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map for ti.platforms.evmTCI66AK2G02
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 380_0000 ( 56 MB) --------
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmTCI66AK2G02:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI66AK2G02:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_66ak2g_linux.bld b/src/examples/templates/ex02_messageq/shared/config_66ak2g_linux.bld
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+Build.platformTable["ti.platforms.evmTCI66AK2G02:core0"] = {
+ externalMemoryMap: [ ]
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_dra7xx.bld b/src/examples/templates/ex02_messageq/shared/config_dra7xx.bld
--- /dev/null
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_0000 8000_0000 1000 ( 4 KB) EVE1_VECS (vector table)
+ * 8000_1000 3F_F000 ( ~4 MB) EVE1_PROG (code, data)
+ * 0000_0000 8040_0000 1000 ( 4 KB) EVE2_VECS (vector table)
+ * 8040_1000 3F_F000 ( ~4 MB) EVE2_PROG (code, data)
+ * 0000_0000 8080_0000 1000 ( 4 KB) EVE3_VECS (vector table)
+ * 8080_1000 3F_F000 ( ~4 MB) EVE3_PROG (code, data)
+ * 0000_0000 80C0_0000 1000 ( 4 KB) EVE4_VECS (vector table)
+ * 80C0_1000 3F_F000 ( ~4 MB) EVE4_PROG (code, data)
+ * 8100_0000 100_0000 ( 16 MB) --------
+ * 8200_0000 100_0000 ( 16 MB) --------
+ * 8300_0000 100_0000 ( 16 MB) --------
+ * 8400_0000 100_0000 ( 16 MB) --------
+ * 8500_0000 100_0000 ( 16 MB) --------
+ * 8600_0000 100_0000 ( 16 MB) IPU1 (code, data) [1]
+ * 8600_0000 80_0000 ( 8 MB) IPU1-0 (code, data) [1]
+ * 8680_0000 80_0000 ( 8 MB) IPI1-1 (code, data) [1]
+ * 8700_0000 100_0000 ( 16 MB) --------
+ * 8800_0000 100_0000 ( 16 MB) --------
+ * 8900_0000 100_0000 ( 16 MB) --------
+ * 8A00_0000 100_0000 ( 16 MB) IPU2 (code, data) [2]
+ * 8B00_0000 100_0000 ( 16 MB) HOST (code, data)
+ * 8C00_0000 100_0000 ( 16 MB) DSP1 (code, data)
+ * 8D00_0000 100_0000 ( 16 MB) DSP2 (code, data)
+ * 8E00_0000 100_0000 ( 16 MB) SR_0 (ipc)
+ * 8F00_0000 100_0000 ( 16 MB) --------
+ *
+ * Notes
+ * ------------------------------------------------------------------------
+ * [1] IPU1 implies SMP mode; IPU1-0, IPU1-1 implies non-SMP mode. You
+ * cannot use both at the same time.
+ *
+ * [2] IPU2 implies SMP mode.
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x8E000000, len: 0x1000000,
+ comment: "SR#0 Memory (16 MB)"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "DSP1_PROG", {
+ name: "DSP1_PROG", space: "code/data", access: "RWX",
+ base: 0x8C000000, len: 0x1000000,
+ comment: "DSP1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP1_PROG",
+ dataMemory: "DSP1_PROG",
+ stackMemory: "DSP1_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] = {
+ externalMemoryMap: [
+ [ "DSP2_PROG", {
+ name: "DSP2_PROG", space: "code/data", access: "RWX",
+ base: 0x8D000000, len: 0x1000000,
+ comment: "DSP2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP2_PROG",
+ dataMemory: "DSP2_PROG",
+ stackMemory: "DSP2_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve1"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x1000, page: 0,
+ comment: "EVE1 Vector Table (4 KB)"
+ }],
+ [ "EVE1_PROG", {
+ name: "EVE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80001000, len: 0x3FF000, page: 1,
+ comment: "EVE1 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE1_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE1_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve2"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80400000, len: 0x1000, page: 0,
+ comment: "EVE2 Vector Table (4 KB)"
+ }],
+ [ "EVE2_PROG", {
+ name: "EVE2_PROG", space: "code/data", access: "RWX",
+ base: 0x80401000, len: 0x3FF000, page: 1,
+ comment: "EVE2 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE2_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE2_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve3"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x1000, page: 0,
+ comment: "EVE3 Vector Table (4 KB)"
+ }],
+ [ "EVE3_PROG", {
+ name: "EVE3_PROG", space: "code/data", access: "RWX",
+ base: 0x80801000, len: 0x3FF000, page: 1,
+ comment: "EVE3 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE3_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE3_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve4"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80C00000, len: 0x1000, page: 0,
+ comment: "EVE4 Vector Table (4 KB)"
+ }],
+ [ "EVE4_PROG", {
+ name: "EVE4_PROG", space: "code/data", access: "RWX",
+ base: 0x80C01000, len: 0x3FF000, page: 1,
+ comment: "EVE4 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE4_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE4_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE4_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "IPU1_PROG", {
+ name: "IPU1_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x1000000,
+ comment: "IPU1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_PROG",
+ dataMemory: "IPU1_PROG",
+ stackMemory: "IPU1_PROG"
+};
+
+var ipu1_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-0"] = {
+ externalMemoryMap: [
+ [ "IPU1_0_PROG", {
+ name: "IPU1_0_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x800000,
+ comment: "IPU1-0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_0_PROG",
+ dataMemory: "IPU1_0_PROG",
+ stackMemory: "IPU1_0_PROG"
+};
+
+var ipu1_0_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-1"] = {
+ externalMemoryMap: [
+ [ "IPU1_1_PROG", {
+ name: "IPU1_1_PROG", space: "code/data", access: "RWX",
+ base: 0x86800000, len: 0x800000,
+ comment: "IPU1-1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_1_PROG",
+ dataMemory: "IPU1_1_PROG",
+ stackMemory: "IPU1_1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "IPU2_PROG", {
+ name: "IPU2_PROG", space: "code/data", access: "RWX",
+ base: 0x8A000000, len: 0x1000000,
+ comment: "IPU2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU2_PROG",
+ dataMemory: "IPU2_PROG",
+ stackMemory: "IPU2_PROG"
+};
+
+var ipu2_ammu = {
+ prog: { /* program memory */
+ pa: 0x8A000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x8B000000, len: 0x1000000,
+ comment: "HOST Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_linux.bld b/src/examples/templates/ex02_messageq/shared/config_linux.bld
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+
+Build.platformTable["ti.platforms.evmOMAPL138:dsp"] = {
+ externalMemoryMap: [
+ [ "DDR", {
+ name: "DDR", space: "code/data", access: "RWX",
+ base: 0xC3100000, len: 0x800000,
+ comment: "DSP Program Memory (8 MB)"
+ }]
+ ],
+ codeMemory: "DDR",
+ dataMemory: "DDR",
+ stackMemory: "DDR",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "32k"
+};
+
+
+/*
+ * ======== ti.targets.elf.C674 ========
+ */
+var C674 = xdc.useModule('ti.targets.elf.C674');
+C674.ccOpts.suffix += " -mi10 -mo ";
\ No newline at end of file
diff --git a/src/examples/templates/ex02_messageq/shared/config_tci6630.bld b/src/examples/templates/ex02_messageq/shared/config_tci6630.bld
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map for ti.platforms.evm6630K2L
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 80_0000 ( 8 MB) CORE1_PROG (code, data)
+ * 8100_0000 80_0000 ( 8 MB) CORE2_PROG (code, data)
+ * 8180_0000 80_0000 ( 8 MB) CORE3_PROG (code, data)
+ * 8200_0000 200_0000 ( 32 MB) --------
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core1"] = {
+ externalMemoryMap: [
+ [ "CORE1_PROG", {
+ name: "CORE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x800000,
+ comment: "CORE1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE1_PROG",
+ dataMemory: "CORE1_PROG",
+ stackMemory: "CORE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core2"] = {
+ externalMemoryMap: [
+ [ "CORE2_PROG", {
+ name: "CORE2_PROG", space: "code/data", access: "RWX",
+ base: 0x81000000, len: 0x800000,
+ comment: "CORE2 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE2_PROG",
+ dataMemory: "CORE2_PROG",
+ stackMemory: "CORE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core3"] = {
+ externalMemoryMap: [
+ [ "CORE3_PROG", {
+ name: "CORE3_PROG", space: "code/data", access: "RWX",
+ base: 0x81800000, len: 0x800000,
+ comment: "CORE3 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE3_PROG",
+ dataMemory: "CORE3_PROG",
+ stackMemory: "CORE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_tci6630_linux.bld b/src/examples/templates/ex02_messageq/shared/config_tci6630_linux.bld
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core0"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core1"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core2"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core3"] = {
+ externalMemoryMap: [ ]
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_tci6636.bld b/src/examples/templates/ex02_messageq/shared/config_tci6636.bld
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map for ti.platforms.evm6638
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 80_0000 ( 8 MB) CORE1_PROG (code, data)
+ * 8100_0000 80_0000 ( 8 MB) CORE2_PROG (code, data)
+ * 8180_0000 80_0000 ( 8 MB) CORE3_PROG (code, data)
+ * 8200_0000 80_0000 ( 8 MB) CORE4_PROG (code, data)
+ * 8280_0000 80_0000 ( 8 MB) CORE5_PROG (code, data)
+ * 8300_0000 80_0000 ( 8 MB) CORE6_PROG (code, data)
+ * 8380_0000 80_0000 ( 8 MB) CORE7_PROG (code, data)
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core1"] = {
+ externalMemoryMap: [
+ [ "CORE1_PROG", {
+ name: "CORE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x800000,
+ comment: "CORE1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE1_PROG",
+ dataMemory: "CORE1_PROG",
+ stackMemory: "CORE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core2"] = {
+ externalMemoryMap: [
+ [ "CORE2_PROG", {
+ name: "CORE2_PROG", space: "code/data", access: "RWX",
+ base: 0x81000000, len: 0x800000,
+ comment: "CORE2 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE2_PROG",
+ dataMemory: "CORE2_PROG",
+ stackMemory: "CORE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core3"] = {
+ externalMemoryMap: [
+ [ "CORE3_PROG", {
+ name: "CORE3_PROG", space: "code/data", access: "RWX",
+ base: 0x81800000, len: 0x800000,
+ comment: "CORE3 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE3_PROG",
+ dataMemory: "CORE3_PROG",
+ stackMemory: "CORE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core4"] = {
+ externalMemoryMap: [
+ [ "CORE4_PROG", {
+ name: "CORE4_PROG", space: "code/data", access: "RWX",
+ base: 0x82000000, len: 0x800000,
+ comment: "CORE4 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE4_PROG",
+ dataMemory: "CORE4_PROG",
+ stackMemory: "CORE4_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core5"] = {
+ externalMemoryMap: [
+ [ "CORE5_PROG", {
+ name: "CORE5_PROG", space: "code/data", access: "RWX",
+ base: 0x82800000, len: 0x800000,
+ comment: "CORE5 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE5_PROG",
+ dataMemory: "CORE5_PROG",
+ stackMemory: "CORE5_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core6"] = {
+ externalMemoryMap: [
+ [ "CORE6_PROG", {
+ name: "CORE6_PROG", space: "code/data", access: "RWX",
+ base: 0x83000000, len: 0x800000,
+ comment: "CORE6 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE6_PROG",
+ dataMemory: "CORE6_PROG",
+ stackMemory: "CORE6_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core7"] = {
+ externalMemoryMap: [
+ [ "CORE7_PROG", {
+ name: "CORE7_PROG", space: "code/data", access: "RWX",
+ base: 0x83800000, len: 0x800000,
+ comment: "CORE7 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE7_PROG",
+ dataMemory: "CORE7_PROG",
+ stackMemory: "CORE7_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/config_tci6636_linux.bld b/src/examples/templates/ex02_messageq/shared/config_tci6636_linux.bld
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core0"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core1"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core2"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core3"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core4"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core5"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core6"] = {
+ externalMemoryMap: [ ]
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core7"] = {
+ externalMemoryMap: [ ]
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex02_messageq/shared/ipc.cfg.xs b/src/examples/templates/ex02_messageq/shared/ipc.cfg.xs
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012-2015, 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+var procNameAry = ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"];
+% } else if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+var procNameAry = ["HOST", "IPU", "DSP"];
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+var procNameAry = ["HOST", "DSP"];
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
+
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(Program.global.procName, procNameAry);
diff --git a/src/examples/templates/ex02_messageq/shared/ipc_66ak2e.cfg.xs b/src/examples/templates/ex02_messageq/shared/ipc_66ak2e.cfg.xs
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^66AK2E_bios_elf$/)) {
+var procNameAry = ["HOST", "CORE0"];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: 1,
+ isValid: true,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
diff --git a/src/examples/templates/ex02_messageq/shared/ipc_66ak2g.cfg.xs b/src/examples/templates/ex02_messageq/shared/ipc_66ak2g.cfg.xs
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^66AK2G_(bios|linux)_elf$/)) {
+var procNameAry = ["HOST", "CORE0"];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: 1,
+ isValid: true,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
diff --git a/src/examples/templates/ex02_messageq/shared/ipc_dra7xx.cfg.xs b/src/examples/templates/ex02_messageq/shared/ipc_dra7xx.cfg.xs
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+var procNameAry = ["DSP1","DSP2","EVE1","EVE2","EVE3","EVE4","IPU1","IPU2",
+ "HOST"];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: 0,
+ isValid: true,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
diff --git a/src/examples/templates/ex02_messageq/shared/ipc_tci6630.cfg.xs b/src/examples/templates/ex02_messageq/shared/ipc_tci6630.cfg.xs
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^TCI6630_bios_elf$/)) {
+var procNameAry = ["HOST", "CORE0", "CORE1", "CORE2",
+ "CORE3"];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: 1,
+ isValid: true,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
diff --git a/src/examples/templates/ex02_messageq/shared/ipc_tci6636.cfg.xs b/src/examples/templates/ex02_messageq/shared/ipc_tci6636.cfg.xs
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^TCI6636_bios_elf$/)) {
+var procNameAry = ["HOST", "CORE0", "CORE1", "CORE2",
+ "CORE3", "CORE4", "CORE5", "CORE6", "CORE7"];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: 1,
+ isValid: true,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
diff --git a/src/examples/templates/ex02_messageq/slave/Dsp.cfg b/src/examples/templates/ex02_messageq/slave/Dsp.cfg
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if ((platform.match(/^DRA7XX_(linux|qnx|android)_elf$/) && target.match(/\.M4$/)) ||
+% (platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+% if (platform.match(/^OMAPL138_linux_elf$/)) {
+% // single-core, no 'shared' config
+/* describe the processors in the system */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig("DSP", ["HOST", "DSP"]);
+% } else if (platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_linux_elf$/)) {
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig("CORE0", ["HOST", "CORE0"]);
+% } else {
+/* load the configuration shared across cores */
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+% }
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+% if (!platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_linux_elf$/)) {
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+% if (platform.match(/^OMAPL138_linux_elf$/)) {
+Resource.loadSegment = "DDR";
+% } else {
+Resource.loadSegment = "EXT_CODE";
+% }
+% }
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+% if (platform.match(/^(OMAPL138|TCI6636|66AK2E|TCI6630|66AK2G)_linux_elf$/)) {
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+% } else {
+var SysMin = xdc.useModule('ti.trace.SysMin');
+% }
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+% if (platform.match(/^OMAPL138_linux_elf$/)) {
+Program.sectMap[".tracebuf"] = "DDR";
+Program.sectMap[".errorbuf"] = "DDR";
+% } else if (platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_linux_elf$/)) {
+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');
+Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+/* Enable Memory Translation module that operates on the Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = Program.platform.dataMemory;
+% } else {
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+% }
+
+% if (platform.match(/^OMAPL138_linux_elf$/)) {
+var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
+/* Set 0xc4000000 -> 0xc4ffffff to be non-cached for shared memory IPC */
+Cache.MAR192_223 = 0x00000010;
+
+/* Configure the SYS/BIOS clock to use the lower half of Timer 1 */
+var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Timer.timerSettings[1].master = true;
+Timer.defaultHalf = Timer.Half_LOWER;
+Clock.timerId = 1;
+% } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Configure the SYS/BIOS clock to use external timer so that it keeps
+ * running when IPU is in low power mode. Must use TickSource_USER
+ * because we need special instance create parameters on the timer
+ * instance. Use dmTimer0 (GPTimer5) to driver the SYS/BIOS clock.
+ */
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+Clock.timerId = 0;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Switch off Software Reset to make the below settings effective */
+timerParams.tiocpCfg.softreset = 0x0;
+timerParams.tiocpCfg.idlemode = 0x3; /* smart-idle wake-up-capable mode */
+timerParams.twer.ovf_wup_ena = 0x1; /* wake-up generation for overflow */
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* configure the DSP AMMU */
+xdc.loadCapsule("DspAmmu.cfg");
+
+/*
+ * ======== Power Management Configuration ========
+ */
+/* Modules used in Power Management */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.c64p.tesla.Power');
+Power.loadSegment = "PM_DATA";
+
+/* Idle function that periodically flushes the unicache */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+/* power management idle function */
+Idle.addFunc('&IpcPower_idle'); /* must be at the end */
+
+% } else {
+% if (!platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_linux_elf$/)) {
+/* --------------------------- TICK --------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_NULL;
+//Clock.tickSource = Clock.TickSource_USER;
+/* Configure BIOS clock source as GPTimer5 */
+//Clock.timerId = 0;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+
+/* Skip the Timer frequency verification check. Need to remove this later */
+Timer.checkFrequency = false;
+
+/* Match this to the SYS_CLK frequency sourcing the dmTimers.
+ * Not needed once the SYS/BIOS family settings is updated. */
+Timer.intFreq.hi = 0;
+Timer.intFreq.lo = 19200000;
+
+//var timerParams = new Timer.Params();
+//timerParams.period = Clock.tickPeriod;
+//timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Switch off Software Reset to make the below settings effective */
+//timerParams.tiocpCfg.softreset = 0x0;
+/* Smart-idle wake-up-capable mode */
+//timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+//timerParams.twer.ovf_wup_ena = 0x1;
+//Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+% if (platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+% if (lcCore.match(/^dsp1$/)) {
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+var Deh = xdc.useModule('ti.deh.Deh');
+
+/* Must be placed before pwr mgmt */
+Idle.addFunc('&ti_deh_Deh_idleBegin');
+% }
+% }
+% }
+% }
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
diff --git a/src/examples/templates/ex02_messageq/slave/DspAmmu.cfg b/src/examples/templates/ex02_messageq/slave/DspAmmu.cfg
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== DspAmmu.cfg ========
+ *
+ * An example configuration script used by DSP sample applications.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+if (Cache.enableCache) {
+ Cache.ocpL1.wrap = 1;
+ Cache.ocpL1.wrbuffer = 1;
+ Cache.ocpL1.prefetch = 0;
+
+ Cache.ocpL2.wrap = 1;
+ Cache.ocpL2.wrbuffer = 1;
+ Cache.ocpL2.prefetch = 0;
+
+ print("DSP Unicache = ON");
+}
+else {
+ print("DSP Unicache = OFF");
+}
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+
+/*********************** Small Pages *************************/
+/* Work-around for bug in BIOS 6.33.06.50 */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x01c30000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.smallPages[1].size = AMMU.Small_4K;
+AMMU.smallPages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.smallPages[1].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/*********************** Medium Pages *************************/
+/* config medium page[0] to map 1MB VA 0x01d00000 to 0x01dFFFFF */
+/* ABE NC region */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x01d00000;
+AMMU.mediumPages[0].size = AMMU.Medium_1M;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[0].L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[0].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.mediumPages[0].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[0].L2_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[0].L2_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[0].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* config medium page[1] to map 1MB VA 0x01e00000 to 0x01eFFFFF */
+/* IVA-HD (accelerator memories, NC region) */
+AMMU.mediumPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[1].logicalAddress = 0x01e00000;
+AMMU.mediumPages[1].size = AMMU.Medium_1M;
+AMMU.mediumPages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[1].L1_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[1].L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[1].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[1].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[1].L2_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[1].L2_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[1].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[2] to map 128kB VA 0x10800000 to 0x1081FFFF */
+/* SL2->L1 */
+AMMU.mediumPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[2].logicalAddress = 0x10800000;
+AMMU.mediumPages[2].size = AMMU.Medium_128K;
+AMMU.mediumPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[3].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[2].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[2].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[2].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[2].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[3] to map 128kB VA 0x10820000 to 0x1083FFFF */
+/* SL2->L2 */
+AMMU.mediumPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[3].logicalAddress = 0x10820000;
+AMMU.mediumPages[3].size = AMMU.Medium_128K;
+AMMU.mediumPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[3].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[3].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[3].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[3].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[4] to map 1MB VA 0x10900000 to 0x109FFFFF */
+/* SL2 Locked Region */
+AMMU.mediumPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[4].logicalAddress = 0x10900000;
+AMMU.mediumPages[4].size = AMMU.Medium_1M;
+AMMU.mediumPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.mediumPages[4].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[4].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[4].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[4].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[5] to map 1MB VA 0x10d00000 to 0x10dFFFFF */
+/* ABE */
+AMMU.mediumPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[5].logicalAddress = 0x10d00000;
+AMMU.mediumPages[5].size = AMMU.Medium_1M;
+AMMU.mediumPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[5].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[5].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[5].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[5].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[6] to map 1MB VA 0x10e00000 to 0x10eFFFFF */
+/* ABE Locked Region */
+AMMU.mediumPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[6].logicalAddress = 0x10e00000;
+AMMU.mediumPages[6].size = AMMU.Medium_1M;
+AMMU.mediumPages[6].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[6].L1_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[6].L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[6].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.mediumPages[6].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[6].L2_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[6].L2_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[6].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable, posted */
+/* config large page[0] to map 512MB VA 0x20000000 to L3 0x3FFFFFFF */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x20000000;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[0].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[0].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[0].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[0].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[0].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* Peripheral regions: Large Page (512M); non-cacheable, posted */
+/* config large page[1] to map 512MB VA 0x40000000 to L3 0x5FFFFFFF */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x40000000;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[1].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[1].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[1].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[1].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[1].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* TILER region: Large Page (512M); cacheable, posted */
+/* config large page[2] to map 512MB VA 0x60000000 to L3 0x7FFFFFFF */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x60000000;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[2].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[2].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[2].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* Private and Heap Data regions: Large page (512M); cacheable, posted */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x9FFFFFFF */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0x80000000;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[3].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[3].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[3].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* IPC region: Large Page (512M); non-cacheable, posted */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xBFFFFFFF */
+AMMU.largePages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[4].logicalAddress = 0xA0000000;
+AMMU.largePages[4].size = AMMU.Large_512M;
+AMMU.largePages[4].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[4].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[4].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[4].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[4].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
diff --git a/src/examples/templates/ex02_messageq/slave/Ipu.cfg b/src/examples/templates/ex02_messageq/slave/Ipu.cfg
--- /dev/null
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if ((platform.match(/^(VAYUsim|DRA7XX)_(bios|linux|qnx|android)_elf$/) && target.match(/\.M4$/)) ||
+% (platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.gates.GateHwi');
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+BIOS.smpEnabled = true; /* only support SMP mode on IPU */
+
+% if (platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+
+% }
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+% if (platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+/* Remap the interrupt xbar mmr base address to match AMMU settings */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+% }
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+% if (platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+/* dmTimer 0 mapped to GPT1 */
+dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
+/* dmTimer 1 mapped to GPT2 */
+dmTimer.timerSettings[1].baseAddr = 0x68032000;
+/* dmTimer 2 mapped to GPT3 */
+dmTimer.timerSettings[2].baseAddr = 0x68034000;
+/* dmTimer 3 mapped to GPT4 */
+dmTimer.timerSettings[3].baseAddr = 0x68036000;
+/* dmTimer 4 mapped to GPT5 */
+dmTimer.timerSettings[4].baseAddr = 0x68820000;
+/* dmTimer 5 mapped to GPT6 */
+dmTimer.timerSettings[5].baseAddr = 0x68822000;
+/* dmTimer 6 mapped to GPT7 */
+dmTimer.timerSettings[6].baseAddr = 0x68034000;
+/* dmTimer 7 mapped to GPT8 */
+dmTimer.timerSettings[7].baseAddr = 0x68036000;
+/* dmTimer 8 mapped to GPT9 */
+dmTimer.timerSettings[8].baseAddr = 0x6803E000;
+/* dmTimer 9 mapped to GPT10 */
+dmTimer.timerSettings[9].baseAddr = 0x68086000;
+/* dmTimer 10 mapped to GPT11 */
+dmTimer.timerSettings[10].baseAddr = 0x68088000;
+/* dmTimer 11 mapped to GPT12 */
+dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
+/* dmTimer 12 mapped to GPT13 */
+dmTimer.timerSettings[12].baseAddr = 0x68828000;
+/* dmTimer 13 mapped to GPT14 */
+dmTimer.timerSettings[13].baseAddr = 0x6882A000;
+/* dmTimer 14 mapped to GPT15 */
+dmTimer.timerSettings[14].baseAddr = 0x6882C000;
+/* dmTimer 15 mapped to GPT16 */
+dmTimer.timerSettings[15].baseAddr = 0x6882E000;
+% } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ *
+ * 0x48034000 --> 0xA8034000 dmTimer0 mapped to GPT3
+ * 0x48036000 --> 0xA8036000 dmTimer1 mapped to GPT4
+ * 0x4803E000 --> 0xA803E000 dmTimer2 mapped to GPT9
+ * 0x48088000 --> 0xA8088000 dmTimer3 mapped to GPT11
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+dmTimer.timerSettings[0].baseAddr = 0xA8034000;
+dmTimer.timerSettings[1].baseAddr = 0xA8036000;
+dmTimer.timerSettings[2].baseAddr = 0xA803E000;
+dmTimer.timerSettings[3].baseAddr = 0xA8088000;
+% }
+
+/* use external timers because they keep running when IPU is not */
+var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
+halTimer.TimerProxy = dmTimer;
+
+/* ----------------------------- TICK ---------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+% if (platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+% if (lcCore.match(/^ipu1$/)) {
+/* Configure GPTimer11 as BIOS clock source */
+Clock.timerId = 10;
+
+var WD = xdc.useModule('ti.deh.Watchdog');
+WD.timerIds.length = 2;
+WD.timerSettings.length = 2;
+WD.timerIds[0] = "GPTimer7";
+WD.timerSettings[0].intNum = 60;
+WD.timerSettings[0].eventId = -1;
+WD.timerIds[1] = "GPTimer8";
+WD.timerSettings[1].intNum = 61;
+WD.timerSettings[1].eventId = -1;
+
+var Xbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+Xbar.connectIRQMeta(60, 38);
+Xbar.connectIRQMeta(61, 39);
+% } else if (lcCore.match(/^ipu2$/)) {
+/* Configure GPTimer3 as BIOS clock source */
+Clock.timerId = 2;
+% }
+% }
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Smart-idle wake-up-capable mode */
+timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+timerParams.twer.ovf_wup_ena = 0x1;
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* configure the IPU AMMU */
+xdc.loadCapsule("IpuAmmu.cfg");
+
+
+/* idle functions */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+
+/* function to flush unicache on each core */
+Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
+Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
+
+var Deh = xdc.useModule('ti.deh.Deh');
+
+/* Watchdog detection functions in each core */
+/* Must be placed before pwr mgmt */
+Idle.addCoreFunc('&ti_deh_Deh_idleBegin', 0);
+Idle.addCoreFunc('&ti_deh_Deh_idleBegin', 1);
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
+Hwi.nvicCCR.DIV_0_TRP = 1;
diff --git a/src/examples/templates/ex02_messageq/slave/IpuAmmu_dra7xx.cfg b/src/examples/templates/ex02_messageq/slave/IpuAmmu_dra7xx.cfg
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 3 small pages(1 4K and 2 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 16K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_16K;
+
+/* config small page[8] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50020000;
+AMMU.smallPages[8].translatedAddress = 0x55060000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large Page (512M); non-cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* TILER & DMM regions: Large page (512M); cacheable */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L1_posted = AMMU.PostedPolicy_POSTED;
diff --git a/src/examples/templates/ex02_messageq/slave/IpuAmmu_omap5.cfg b/src/examples/templates/ex02_messageq/slave/IpuAmmu_omap5.cfg
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 4 small pages(3 4K and 1 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 4K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_4K;
+
+/* config small page[8] to map 4K VA 0x50011000 to PA 0x55051000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50011000;
+AMMU.smallPages[8].translatedAddress = 0x55051000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/* config small page[9] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[9].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[9].logicalAddress = 0x50020000;
+AMMU.smallPages[9].translatedAddress = 0x55060000;
+AMMU.smallPages[9].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[9].size = AMMU.Small_4K;
+
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* TILER & DMM regions: Large page (512M); cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large Page (512M); non-cacheable, non-posted */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
diff --git a/src/examples/templates/ex02_messageq/slave/Server.c b/src/examples/templates/ex02_messageq/slave/Server.c
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== Server.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+
+#include <stdio.h>
+
+/* package header files */
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+
+/* module header file */
+#include "Server.h"
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; // host processor id
+ MessageQ_Handle slaveQue; // created locally
+} Server_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+
+
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+}
+
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ char msgqName[32];
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ sprintf(msgqName, App_SlaveMsgQueName, MultiProc_getName(MultiProc_self()));
+ Module.slaveQue = MessageQ_create(msgqName, &msgqParams);
+
+ if (Module.slaveQue == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: server is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
+ return (status);
+}
+
+
+
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ Bool running = TRUE;
+ App_Msg * msg;
+ MessageQ_QueueId queId;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd == App_CMD_SHUTDOWN) {
+ running = FALSE;
+ }
+
+ /* process the message */
+ Log_print1(Diags_INFO, "Server_exec: processed cmd=0x%x", msg->cmd);
+
+ /* send message back */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_exec: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Server_delete ========
+ */
+
+Int Server_delete()
+{
+ Int status;
+
+ Log_print0(Diags_ENTRY, "--> Server_delete:");
+
+ /* delete the video message queue */
+ status = MessageQ_delete(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_finish: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- Server_delete: %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+/*
+ * ======== Server_exit ========
+ */
+
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
diff --git a/src/examples/templates/ex02_messageq/slave/Server.h b/src/examples/templates/ex02_messageq/slave/Server.h
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Server.h ========
+ */
+
+#ifndef Server__include
+#define Server__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Server_init(Void);
+Void Server_exit(Void);
+
+Int Server_create(Void);
+Int Server_exec(Void);
+Int Server_delete(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* Server__include */
diff --git a/src/examples/templates/ex02_messageq/slave/Slave.cfg b/src/examples/templates/ex02_messageq/slave/Slave.cfg
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+% if (platform.match(/^DRA7XX_bios_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+% if (platform.match(/(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)/)) {
+xdc.global.SR0_cacheEnable = false;
+% } else {
+% throw new Error("unsupported platform: " + platform);
+% }
+xdc.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+% if (platform.match(/(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)/) && target.match(/\.C66$/)) {
+
+/* make SR_0 non-cacheable */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(ipc_cfg.SR0Mem.base, ipc_cfg.SR0Mem.len, Cache.Mar_DISABLE);
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/ipu[12]/)) {
+
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+% }
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1(?!-1)|ipu2/)) {
+/*
+ * ======== IPU/CORE0 Processor (primary core) ========
+ */
+% if (lcCore == "ipu1-0") {
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 0;
+% }
+
+/* enable the unicache */
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* configure ammu (because unicache is enabled) */
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+
+/* increase small page 0 to 16 KB */
+var entry = AMMU.smallPages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x00000000;
+entry.translatedAddress = 0x55020000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/* increase small page 1 to 16 KB to access timers (non-cacheable) */
+var entry = AMMU.smallPages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x40000000;
+entry.translatedAddress = 0x55080000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* map program code/data memory into ammu (cacheable) */
+var entry = AMMU.largePages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.prog.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.cache];
+
+/* map SR_0 ammu (non-cacheable) */
+var entry = AMMU.largePages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.cache];
+
+/* map L3/L4 peripherals (mailbox, spinlock) into ammu (non-cacheable) */
+var entry = AMMU.largePages[3];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x60000000;
+entry.translatedAddress = 0x40000000;
+entry.size = AMMU.Large_512M;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+% } else {
+/*
+ * ======== IPU/CORE1 Processor (slave core) ========
+ */
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 1;
+
+% }
+/* configure the interrupt cross-bar mmr base address */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+
+/* configure hardware spin lock base address to match ammu mapping of L3/L4 */
+var GateHWSpinlock = xdc.useModule('ti.sdo.ipc.gates.GateHWSpinlock');
+GateHWSpinlock.baseAddr = 0x6A0F6800;
+
+% }
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+% if (lcCore.match(/eve/)) {
+//Program.stack = 0x800; /* small stack needed to fit in DMEM */
+% }
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+% if (lcCore.match(/eve/)) {
+//heapMemParams.size = 0x1400; /* small heap needed to fit in DMEM */
+% }
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+% if (platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* configure SMP-enabled System module */
+var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
+% } else {
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+% }
+% if (lcCore.match(/eve/)) {
+//SysMin.bufSize = 0x200; /* small buffer needed to fit in DMEM */
+% }
+% }
+% else {
+% throw new Error("unsupported platform: " + platform);
+% }
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/eve/)) {
+
+/* place text character table in external memory, too big for DMEM */
+var Text_charTab = new prog.SectionSpec();
+Text_charTab.loadSegment = "`procName`_PROG";
+Program.sectMap[".const:xdc_runtime_Text_charTab__A"] = Text_charTab;
+
+/* reduce size of idle stack, too big for DMEM */
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.idleTaskStackSize = 0x200;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+
+/* Turn off the timer frequency check. The DSP timer does not run when
+ * the host is halted because of the emulation suspend signal.
+ */
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+Timer.checkFrequency = false;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+% if (lcCore == "dsp1") {
+
+/* allocate timers 5 and 6 to DSP1 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x0030;
+% } else {
+
+/* allocate timers 7 and 8 to DSP2 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x00C0;
+% }
+% }
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1-[01]/)) {
+
+BIOS.smpEnabled = false;
+% } else {
+
+BIOS.smpEnabled = true;
+% }
+% }
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+% if (platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* create a SMP-enabled logger instance */
+var LoggerBuf = xdc.useModule('ti.sysbios.smp.LoggerBuf');
+% } else {
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+% }
+% }
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex02_messageq/slave/main_bios.c b/src/examples/templates/ex02_messageq/slave/main_bios.c
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== Main`core`.c ========
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Server.h"
+
+/* private functions */
+Void Server_taskFxn(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char* argv[])
+{
+ Int status;
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Server_taskFxn";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Error_init(&eb);
+
+ Task_create(Server_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== Server_taskFxn ========
+ */
+Void Server_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status;
+ UInt16 remoteProcId;
+
+ Log_print0(Diags_INFO, "Server_taskFxn: -->");
+
+ /*
+ * initialize the ipc layer
+ */
+ status = Ipc_start();
+
+ if (status < 0) {
+ System_abort("Ipc_start failed\n");
+ }
+
+ remoteProcId = MultiProc_getId("HOST");
+ if (remoteProcId == MultiProc_INVALIDID) {
+ System_abort("Improper MultiProc ID\n");
+ }
+ do {
+ status = Ipc_attach(remoteProcId);
+
+ } while ((status < 0) && (status == Ipc_E_NOTREADY));
+
+ Log_print0(Diags_INFO, "Server_taskFxn: ipc ready");
+
+ /* initialize the server module */
+ Server_init();
+ Diags_setMask("Server+F"); /* turn on some trace */
+
+ /* create a server instance */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* start the server */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* finalize the server */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* finalize the server module */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_INFO, "Server_taskFxn: <-- status=%d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex02_messageq/slave/main_slave.c b/src/examples/templates/ex02_messageq/slave/main_slave.c
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%{
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== main_`core`.c ========
+ *
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Server.h"
+
+/* private functions */
+static Void smain(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "smain";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Task_create(smain, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
+
+
+/*
+ * ======== smain ========
+ */
+Void smain(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+ Error_Block eb;
+ Bool running = TRUE;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");
+
+ Error_init(&eb);
+
+ /* initialize modules */
+ Server_init();
+
+ /* turn on Diags_INFO trace */
+ Diags_setMask("Server+F");
+
+ /* loop forever */
+ while (running) {
+
+ /* BEGIN server phase */
+
+ /* server setup phase */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* END server phase */
+
+ } /* while (running) */
+
+ /* finalize modules */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex02_messageq/slave/makefile b/src/examples/templates/ex02_messageq/slave/makefile
--- /dev/null
@@ -0,0 +1,255 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var cfgBldDir = "shared"; /* by default, may be overridden */
+
+ if (platform.match(/^DRA7XX_(linux|qnx|android)_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ platInst = "ti.platforms.sdp5430:" + lcCore;
+ } else if (platform.match(/^OMAPL138_linux_elf$/)) {
+ platInst = "ti.platforms.evmOMAPL138:" + lcCore;
+ cfgBldDir = "dsp";
+ } else if (platform.match(/^TCI6636_(bios|linux)_elf$/)) {
+ platInst = "ti.platforms.evmTCI6636K2H:" + lcCore;
+ } else if (platform.match(/^66AK2E_(bios|linux)_elf$/)) {
+ platInst = "ti.platforms.evmC66AK2E:" + lcCore;
+ } else if (platform.match(/^66AK2G_(bios|linux)_elf$/)) {
+ platInst = "ti.platforms.evmTCI66AK2G02:" + lcCore;
+ } else if (platform.match(/^TCI6630_(bios|linux)_elf$/)) {
+ platInst = "ti.platforms.evmTCI6630K2L:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+ if (target.match(/\.C66$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64P$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64T$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C674$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.ARP32(_far|)$/)) {
+ cc = "bin/cl-arp32";
+ lnk = "bin/cl-arp32 -z";
+ }
+ else if (target.match(/\.M3$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else if (target.match(/\.M4$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Server.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+% if (platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+all: debug
+
+debug:
+ $(MAKE) PROFILE=debug server_`lcCore`.x
+
+release:
+ $(MAKE) PROFILE=release server_`lcCore`.x
+% } else {
+all: debug release
+
+debug:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+release:
+ $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_`lcCore`.x
+% }
+
+server_`lcCore`.x: bin/$(PROFILE)/server_`lcCore`.x`suffix`
+bin/$(PROFILE)/server_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+% if (platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+% } else {
+ $(LD) $(LDFLAGS) -o $@ $(objs) \
+ $(addprefix -l ,$(libs)) $(CONFIG)/linker.cmd $(LDLIBS)
+% }
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+% if (platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: `core`.cfg ../shared/config.bld
+% } else {
+`PCT`/linker.cmd `PCT`/compiler.opt: $(CONFIG)/.config ;
+$(CONFIG)/.config: `core`.cfg ../`cfgBldDir`/config.bld
+% }
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../`cfgBldDir`/config.bld -r $(PROFILE) \
+% if (platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" \
+ `core`.cfg
+% } else {
+% if (target.match(/\.M3$|\.M4$/)) {
+ --cfgArgs "{ configBld: \"../`cfgBldDir`/config.bld\" }" \
+% }
+ `core`.cfg
+ @$(ECHO) "" > $@
+% }
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_`lcCore`.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+% if (platform.match(/^(DRA7XX|TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l $(CGTOOLS)/lib/rts6600_elf.lib
+% } else {
+# entry point is set to an aligned address so that IPC can load the slave
+LDFLAGS = -w -q -u _c_int00 -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+% }
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex11_ping/host/AppHost.c b/src/examples/templates/ex11_ping/host/AppHost.c
--- /dev/null
@@ -0,0 +1,294 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== AppHost.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC AppHost__Desc
+#define MODULE_NAME "AppHost"
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/ipc/SharedRegion.h>
+
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "AppHost.h"
+#include "../shared/SvrMsg.h"
+
+/* module structure */
+typedef struct {
+ IHeap_Handle heap; /* SR_0 heap handle */
+ MessageQ_Handle localMsgQue; /* created locally */
+ MessageQ_QueueId svrQue[10]; /* opened remotely */
+ SvrMsg_Msg * msg;
+} AppHost_Module;
+
+/* friend data */
+extern Semaphore_Handle SvrHost_doneFlag;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Int Mod_curInit = 0;
+static AppHost_Module Module;
+
+
+/*
+ * ======== AppHost_destroy ========
+ */
+Int AppHost_destroy(Void)
+{
+ Int status = 0;
+ UInt16 numProcs;
+ UInt16 procId;
+
+ Log_print0(Diags_ENTRY, "--> AppHost_destroy:");
+
+ /* TODO enter gate */
+
+ /* wait for server thread to finish */
+ while (Semaphore_getCount(SvrHost_doneFlag) > 0) {
+ Task_sleep(10);
+ }
+
+ /* reference count the module usage */
+ if (--Mod_curInit > 0) {
+ goto leave; /* object still in use */
+ }
+
+ /* free the static message buffer */
+ Memory_free(Module.heap, Module.msg, sizeof(SvrMsg_Msg));
+
+ /* close each remote processor's server queue */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ /* close remote message queue */
+ status = MessageQ_close(&Module.svrQue[procId]);
+
+ if (status < 0) {
+ Log_error2("AppHost_destroy: procId=%d, server queue close "
+ "error=%d", (IArg)procId, (IArg)status);
+ goto leave;
+ }
+ }
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.localMsgQue);
+
+ if (status < 0) {
+ Log_error1("AppHost_destroy: queue delete error=%d", (IArg)status);
+ goto leave;
+ }
+
+leave:
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- AppHost_destroy: status=%d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+
+ /* TODO leave gate */
+ return(status);
+}
+
+/*
+ * ======== AppHost_run ========
+ */
+Int AppHost_run(Void)
+{
+ Int status = 0;
+ Int count;
+ UInt16 numProcs;
+ UInt16 procId;
+
+ Log_print0(Diags_ENTRY, "--> AppHost_run:");
+
+ /* ping each remote server */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+ for (count = 1; count <= SvrMsg_NUM_MSGS; count++) {
+ Log_print1(Diags_INFO, "AppHost_run: ping procId=%d", (IArg)procId);
+
+ /* fill and send message */
+ Module.msg->cmd = SvrMsg_Cmd_START;
+ Module.msg->svrProcId = MultiProc_INVALIDID;
+ MessageQ_put(Module.svrQue[procId], (MessageQ_Msg)Module.msg);
+
+ /* wait for return message */
+ status = MessageQ_get(Module.localMsgQue,
+ (MessageQ_Msg *)&Module.msg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ Log_error1("AppHost_run: message receive error=%d",
+ (IArg)status);
+ goto leave;
+ }
+ else if (Module.msg->svrProcId != procId) {
+ Log_error2("AppHost_run: message delivery error, remote "
+ "procId=%d, server procId=%d",
+ (IArg)procId, (IArg)Module.msg->svrProcId);
+ goto leave;
+ }
+
+ Log_print1(Diags_INFO, "AppHost_run: ack received, procId=%d",
+ (IArg)procId);
+ }
+ }
+
+leave:
+ Log_print1(Diags_EXIT, "<-- AppHost_run: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== AppHost_setup ========
+ */
+Int AppHost_setup(Void)
+{
+ Int status = 0;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ UInt16 numProcs;
+ UInt16 procId;
+ Char cbuf[48];
+
+ /* TODO enter gate */
+
+ /* reference count the module usage */
+ if (Mod_curInit >= 1) {
+ goto leave; /* already initialized */
+ }
+
+ /* initialize module state */
+ Module.heap = NULL;
+ Module.localMsgQue = NULL;
+ Module.msg = NULL;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+FEX");
+ Log_print0(Diags_ENTRY, "--> AppHost_setup:");
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.localMsgQue = MessageQ_create(Host_AppMsgQue, &msgqParams);
+
+ if (Module.localMsgQue == NULL) {
+ Log_error0("AppHost_setup: message queue create failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* open each remote processor's server queue */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ /* compute the remote processor server queue name */
+ System_sprintf(cbuf, SvrMsg_SvrQueNameFmt, MultiProc_getName(procId));
+
+ /* open the remote message queue, loop until queue is available */
+ do {
+ status = MessageQ_open(cbuf, &Module.svrQue[procId]);
+ if (status == MessageQ_E_NOTFOUND) {
+ Task_sleep(10);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("AppHost_setup: could not open slave message queue");
+ goto leave;
+ }
+
+ Log_print1(Diags_INFO,"AppHost_setup: procId=%d, opened server queue",
+ (IArg)procId);
+ }
+
+ /* get the SR_0 heap handle */
+ Module.heap = (IHeap_Handle)SharedRegion_getHeap(0);
+
+ /* allocate a static message from SR_0 heap */
+ Module.msg = (SvrMsg_Msg *)Memory_alloc(Module.heap, sizeof(SvrMsg_Msg),
+ 0, NULL);
+
+ if (Module.msg == NULL) {
+ Log_error0("AppHost_setup: could not allocate message");
+ status = -1;
+ goto leave;
+ }
+
+ /* initialize message header */
+ MessageQ_staticMsgInit((MessageQ_Msg)Module.msg, sizeof(SvrMsg_Msg));
+ MessageQ_setReplyQueue(Module.localMsgQue, (MessageQ_Msg)Module.msg);
+
+ Log_print0(Diags_INFO,"AppHost_setup: slave is ready");
+
+leave:
+ /* success, increment reference count */
+ if (status >= 0) {
+ Mod_curInit++;
+ }
+
+ /* error handling */
+ else {
+ /* unregister diags mask */
+ /* release resources */
+ }
+
+ /* TODO leave gate */
+ Log_print0(Diags_EXIT, "<-- AppHost_setup:");
+ return(status);
+}
diff --git a/src/examples/templates/ex11_ping/host/AppHost.h b/src/examples/templates/ex11_ping/host/AppHost.h
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== AppHost.h ========
+ *
+ */
+
+#ifndef AppHost__include
+#define AppHost__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Int AppHost_destroy(Void);
+Int AppHost_run(Void);
+Int AppHost_setup(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex11_ping/host/AppHost_linux.c b/src/examples/templates/ex11_ping/host/AppHost_linux.c
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+ * 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.
+ */
+
+/* NOTE: This example does not protect against concurrent access (not multithread safe). */
+
+/*
+ * ======== AppHost.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC AppHost__Desc
+#define MODULE_NAME "AppHost"
+
+#define HEAPID 0
+
+#include <stdio.h>
+
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "AppHost.h"
+#include "../shared/SvrMsg.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle localMsgQue; /* created locally */
+ MessageQ_QueueId svrQue[10]; /* opened remotely */
+ SvrMsg_Msg * msg;
+} AppHost_Module;
+
+
+/* private data */
+static AppHost_Module Module;
+
+
+/*
+ * ======== AppHost_destroy ========
+ */
+Int AppHost_destroy(Void)
+{
+ Int32 status = 0;
+ UInt16 numProcs;
+ UInt16 procId;
+
+ printf("--> AppHost_destroy:\n");
+
+ /* TODO enter gate */
+
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ if (procId == MultiProc_self()) {
+ /* linux does not currently support intraprocessor communication */
+ }
+ else {
+ /* fill and send message */
+ Module.msg->cmd = SvrMsg_Cmd_STOP;
+ MessageQ_put(Module.svrQue[procId], (MessageQ_Msg)Module.msg);
+ }
+ }
+
+ /* close each remote processor's server queue */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ if (procId == MultiProc_self()) {
+ /* linux does not currently support intraprocessor communication */
+ }
+ else {
+ /* close remote message queue */
+ status = MessageQ_close(&Module.svrQue[procId]);
+
+ if (status < 0) {
+ printf("AppHost_destroy: prodcId=%d, server que close =%d\n",
+ procId, status);
+ goto leave;
+ }
+ }
+ }
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.localMsgQue);
+
+ if (status < 0) {
+ printf("AppHost_destroy: MessageQ_delete failed, que delete error = %d \n", status);
+ goto leave;
+ }
+
+leave:
+
+ /* TODO leave gate */
+ printf("<-- AppHost_destroy:\n");
+ return(status);
+}
+
+/*
+ * ======== AppHost_run ========
+ */
+Int AppHost_run(Void)
+{
+ Int status = 0;
+ Int count;
+ UInt16 numProcs;
+ UInt16 procId;
+
+
+ printf("--> AppHost_run:\n");
+
+ /* ping each remote server */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ if (procId == MultiProc_self()) {
+ /* linux does not currently support intraprocessor communication */
+ }
+ else {
+
+ for (count = 1; count <= SvrMsg_NUM_MSGS; count++) {
+
+ printf("AppHost_run:ping procId=%d\n",procId);
+
+ /* fill and send message */
+ Module.msg->cmd = SvrMsg_Cmd_START;
+ Module.msg->svrProcId = MultiProc_INVALIDID;
+ status = MessageQ_put(Module.svrQue[procId],
+ (MessageQ_Msg)Module.msg);
+
+ /* wait for return message */
+ status = MessageQ_get(Module.localMsgQue,
+ (MessageQ_Msg *)&Module.msg,MessageQ_FOREVER);
+
+ if (status < 0) {
+ printf("AppHost_run: message receive error=%d\n", status);
+ goto leave;
+ }
+ }
+ printf("AppHost_run: ack received, procId=%d \n", procId);
+ }
+ }
+
+leave:
+ printf("<-- AppHost_run:\n");
+ return(status);
+}
+
+/*
+ * ======== AppHost_setup ========
+ */
+Int AppHost_setup(Void)
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ UInt16 numProcs;
+ UInt16 procId;
+ Char cbuf[48];
+
+ /* TODO enter gate */
+
+ /* initialize module state */
+ Module.localMsgQue = NULL;
+ Module.msg = NULL;
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.localMsgQue = MessageQ_create(Host_AppMsgQue, &msgqParams);
+
+
+ if (Module.localMsgQue == NULL) {
+ printf("Apphose_setup: message queue create failed\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* open each remote processor's server queue */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+ if (procId == MultiProc_self()) {
+ /* linux does not currently support intraprocessor communication */
+ }
+ else {
+ sprintf(cbuf, SvrMsg_SvrQueNameFmt, MultiProc_getName(procId));
+
+ do {
+ status = MessageQ_open(cbuf, &Module.svrQue[procId]);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ usleep(1000);
+ }
+ }
+
+ while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("AppHost_setup: could not open slave message que\n");
+ }
+
+ printf("AppHost_setup: opended server queue, value of status is %d \n",
+ status);
+ }
+ }
+
+ /* allocate a message */
+ Module.msg = (SvrMsg_Msg *)MessageQ_alloc(HEAPID, sizeof(SvrMsg_Msg));
+
+ if (Module.msg == NULL) {
+ printf("AppHost_setup: coudl not allocate message\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* initialize message header */
+ MessageQ_setReplyQueue(Module.localMsgQue, (MessageQ_Msg)Module.msg);
+
+ printf("AppHost_setup: slave is ready\n");
+
+leave:
+
+ /* TODO leave gate */
+ printf("<-- AppHost_setup:\n");
+ return(status);
+}
diff --git a/src/examples/templates/ex11_ping/host/Host.cfg b/src/examples/templates/ex11_ping/host/Host.cfg
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+%%}
+
+/*
+ * ======== Host.cfg ========
+ *
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.gates.GateHwi');
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+% if (platform.match(/VAYU|DRA7XX/)) {
+xdc.global.SR0_cacheEnable = true;
+% }
+Program.global.procName = "HOST";
+xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+/*
+ * ======== Operating System Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog_Core1";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex11_ping/host/MainHost.c b/src/examples/templates/ex11_ping/host/MainHost.c
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ this.hostOS = this.arguments[4];
+ var hostOS = this.arguments[4];
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== MainHost.c ========
+ *
+ */
+
+% if (this.hostOS.match(/^bios$/)) {
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "AppHost.h"
+#include "SvrHost.h"
+
+#define PRI_HIGH 5
+#define PRI_MED 3
+% } else if (this.hostOS.match(/^linux$/)) {
+/* Standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+/* local header files */
+#include "AppHost.h"
+#include "SvrHost.h"
+% }
+
+/* private functions */
+static Void MainHost_appTskFxn(UArg arg0, UArg arg1);
+static Void MainHost_svrTskFxn(UArg arg0, UArg arg1);
+static Void MainHost_done(Void);
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+% if (this.hostOS.match(/^bios$/)) {
+ Int status;
+ Error_Block eb;
+ Task_Params taskParams;
+% } else if (this.hostOS.match(/^linux$/)) {
+ int status;
+ int ret;
+ pthread_t thread1;
+ pthread_t thread2;
+% }
+
+% if (this.hostOS.match(/^bios$/)) {
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+% if (this.hostOS.match(/^linux$/)) {
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+% }
+ /* initialize the ipc layer */
+ status = Ipc_start();
+
+ if (status < 0) {
+ System_abort("Ipc_start failed\n");
+ }
+
+ Log_print0(Diags_INFO, "main: ipc ready");
+% } else if (this.hostOS.match(/^linux$/)) {
+ printf("--> main:\n");
+
+ /* initialize the ipc layer */
+ status = Ipc_start();
+
+ if (status < 0) {
+ printf("Ipc_start failed\n");
+ }
+
+ printf("main: ipc ready\n");
+% }
+
+% if (this.hostOS.match(/^bios$/)) {
+ /* create server thread */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Svr";
+ taskParams.priority = PRI_HIGH;
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Task_create(MainHost_svrTskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create server thread");
+ }
+
+ /* create application thread */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "App";
+ taskParams.priority = PRI_MED;
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Task_create(MainHost_appTskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+% } else if (this.hostOS.match(/^linux$/)) {
+ ret = pthread_create(&thread1,NULL,(void *) &MainHost_svrTskFxn, (NULL));
+ if (ret != 0) {
+ printf("Failed to create thread");
+ }
+
+ ret = pthread_create(&thread2, NULL,(void *) &MainHost_appTskFxn,(NULL));
+ if (ret != 0) {
+ printf("Failed to create thread");
+ }
+ ret = pthread_join(thread1,NULL);
+ if (ret != 0) {
+ printf("Failed to join thread");
+ }
+
+ ret = pthread_join(thread2,NULL);
+ if (ret != 0) {
+ printf("Failed to join thread");
+ }
+
+
+ status = Ipc_stop();
+ if (status < 0) {
+ printf("Ipc_stop failed\n");
+ }
+
+ printf("<-- main:");
+% }
+ return (0);
+}
+
+/*
+ * ======== MainHost_appTskFxn ========
+ */
+Void MainHost_appTskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+% if (this.hostOS.match(/^bios$/)) {
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> MainHost_appTskFxn:");
+% } else if (this.hostOS.match(/^linux$/)) {
+ printf("--> MainHost_appTskFxn:\n");
+% }
+
+ /* application setup phase */
+ status = AppHost_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = AppHost_run();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application shutdown phase */
+ status = AppHost_destroy();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+% if (this.hostOS.match(/^bios$/)) {
+ Log_print1(Diags_EXIT | Diags_INFO, "<-- MainHost_appTskFxn: %d",
+ (IArg)status);
+% } else if (this.hostOS.match(/^linux$/)) {
+ printf("<-- MainHost_appTskFxn: %d \n",
+ status);
+% }
+
+ /* ccs debug hook */
+ MainHost_done();
+}
+
+/*
+ * ======== MainHost_svrTskFxn ========
+ */
+Void MainHost_svrTskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+% if (this.hostOS.match(/^bios$/)) {
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> MainHost_svrTskFxn:");
+% } else if (this.hostOS.match(/^linux$/)) {
+
+ printf("--> MainHost_svrTskFxn:\n");
+% }
+
+ /* server setup phase */
+ status = SvrHost_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = SvrHost_run();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = SvrHost_destroy();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+% if (this.hostOS.match(/^bios$/)) {
+ Log_print1(Diags_EXIT | Diags_INFO, "<-- MainHost_svrTskFxn: %d",
+ (IArg)status);
+% } else if (this.hostOS.match(/^linux$/)) {
+ printf("<-- MainHost_svrTskFxn: %d \n",
+ status);
+% }
+}
+
+/*
+ * ======== MainHost_done ========
+ */
+Void MainHost_done(Void)
+{
+% if (this.hostOS.match(/^bios$/)) {
+ Log_print0(Diags_INFO, "MainHost_done:");
+% } else if (this.hostOS.match(/^linux$/)) {
+ printf("MainHost_done:\n");
+% }
+}
diff --git a/src/examples/templates/ex11_ping/host/SvrHost.c b/src/examples/templates/ex11_ping/host/SvrHost.c
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== SvrHost.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC SvrHost__Desc
+#define MODULE_NAME "SvrHost"
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "SvrHost.h"
+#include "../shared/SvrMsg.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle localMsgQue;
+} SvrHost_Module;
+
+/* friend data */
+Semaphore_Handle SvrHost_doneFlag = NULL;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Int Mod_curInit = 0;
+static SvrHost_Module Module;
+
+
+/*
+ * ======== SvrHost_destroy ========
+ */
+Int SvrHost_destroy(Void)
+{
+ Int status = 0;
+
+ Log_print0(Diags_ENTRY, "--> SvrHost_destroy:");
+
+ /* TODO enter gate */
+
+ /* reference count the module usage */
+ if (--Mod_curInit > 0) {
+ goto leave; /* object still in use */
+ }
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.localMsgQue);
+
+ if (status < 0) {
+ Log_error1("SvrIpu1_destroy: message queue delete error=%d",
+ (IArg)status);
+ goto leave;
+ }
+
+ /* delete the done flag */
+ Semaphore_delete(&SvrHost_doneFlag);
+
+leave:
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- SvrHost_delete: status=%d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+
+ /* TODO leave gate */
+ return(status);
+}
+
+/*
+ * ======== SvrHost_run ========
+ */
+Int SvrHost_run(Void)
+{
+ Int status = 0;
+ Bool running = TRUE;
+ SvrMsg_Msg * msg;
+ MessageQ_QueueId queId;
+ UInt16 procId;
+
+ Log_print0(Diags_ENTRY, "--> SvrHost_run:");
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.localMsgQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ Log_error1("SvrHost_run: message get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* process the message */
+ queId = MessageQ_getReplyQueue(msg);
+ procId = MessageQ_getProcId(queId);
+ Log_print2(Diags_INFO, "SvrHost_run: message received, procId=%d, "
+ "cmd=%d", procId, msg->cmd);
+
+ switch (msg->cmd) {
+ case SvrMsg_Cmd_START:
+ msg->svrProcId = MultiProc_self();
+ break;
+
+ case SvrMsg_Cmd_PROCESS:
+ break;
+
+ case SvrMsg_Cmd_STOP:
+ running = FALSE;
+ break;
+
+ default:
+ Log_error1("SvrHost_run: unknown message, cmd=%d",
+ (IArg)(msg->cmd));
+ break;
+ }
+
+ /* send message back */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+
+ /* decrement the done flag */
+ if (Semaphore_getCount(SvrHost_doneFlag) > 0) {
+ Semaphore_pend(SvrHost_doneFlag, BIOS_WAIT_FOREVER);
+ }
+
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "<-- SvrHost_run: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== SvrHost_setup ========
+ */
+Int SvrHost_setup(Void)
+{
+ Int status = 0;
+ Error_Block eb;
+ Int count;
+ Semaphore_Params semParams;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ UInt16 procId;
+ Char cbuf[48];
+
+ /* TODO enter gate */
+
+ /* reference count the module usage */
+ if (Mod_curInit >= 1) {
+ goto leave; /* already initialized */
+ }
+
+ /* initialize module state */
+ Error_init(&eb);
+ Module.localMsgQue = NULL;
+
+ /* initialize the done flag */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_COUNTING;
+ count = MultiProc_getNumProcessors() * SvrMsg_NUM_MSGS;
+
+ SvrHost_doneFlag = Semaphore_create(count, &semParams, &eb);
+
+ if (Error_check(&eb)) {
+ status = -2;
+ goto leave;
+ }
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+FEX");
+ Log_print0(Diags_ENTRY, "--> SvrHost_setup:");
+
+ /* compute the server queue name */
+ procId = MultiProc_self();
+ System_sprintf(cbuf, SvrMsg_SvrQueNameFmt, MultiProc_getName(procId));
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.localMsgQue = MessageQ_create(cbuf, &msgqParams);
+
+ if (Module.localMsgQue == NULL) {
+ Log_error0("SvrHost_setup: message queue create failed");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"SvrHost_setup: slave is ready");
+
+leave:
+ /* success, increment reference count */
+ if (status >= 0) {
+ Mod_curInit++;
+ }
+
+ /* error handling */
+ else {
+ /* unregister diags mask */
+ /* release resources */
+ }
+
+ /* TODO leave gate */
+ Log_print0(Diags_EXIT, "<-- SvrHost_setup:");
+ return(status);
+}
diff --git a/src/examples/templates/ex11_ping/host/SvrHost.h b/src/examples/templates/ex11_ping/host/SvrHost.h
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== SvrHost.h ========
+ *
+ */
+
+#ifndef SvrHost__include
+#define SvrHost__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Int SvrHost_destroy(Void);
+Int SvrHost_run(Void);
+Int SvrHost_setup(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex11_ping/host/SvrHost_linux.c b/src/examples/templates/ex11_ping/host/SvrHost_linux.c
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== SvrHost.c ========
+ *
+ */
+
+#define Registry_CURDESC SvrHost__Desc
+#define MODULE_NAME "SvrHost"
+
+#include <stdio.h>
+
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "SvrHost.h"
+#include "../shared/SvrMsg.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle localMsgQue;
+ MessageQ_QueueId svrQue;
+} SvrHost_Module;
+
+
+/* private data */
+static SvrHost_Module Module;
+
+
+/*
+ * ======== SvrHost_destroy ========
+ */
+Int SvrHost_destroy(Void)
+{
+ Int status = 0;
+
+ /* TODO enter gate */
+ printf("--> SvrHost_destroy\n");
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.localMsgQue);
+
+ if (status < 0) {
+ printf("SvrHost_destroy: message queue delete error\n");
+ goto leave;
+ }
+
+leave:
+ printf("<-- SvrHost_delete: status =%d\n", status);
+
+ return(status);
+}
+
+/*
+ * ======== SvrHost_run ========
+ */
+Int SvrHost_run(Void)
+{
+ Int status = 0;
+ Bool running = TRUE;
+ SvrMsg_Msg * msg;
+ MessageQ_QueueId queId;
+ UInt16 procId;
+ UInt16 numProcs;
+ UInt16 count = 0;
+
+ printf("--> SvrHost_run:\n");
+
+ numProcs = MultiProc_getNumProcessors();
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.localMsgQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ printf("SvrHost_run: MessageQ_get failed\n");
+ goto leave;
+ }
+
+ /* process the message */
+ queId = MessageQ_getReplyQueue(msg);
+ procId = MessageQ_getProcId(queId);
+
+ printf("SvrHost_run: message received, procId=%d, "
+ "cmd=%d \n", procId, msg->cmd);
+
+ switch (msg->cmd) {
+ case SvrMsg_Cmd_START:
+ msg->svrProcId = MultiProc_self();
+ /* send message back */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+ break;
+
+ case SvrMsg_Cmd_PROCESS:
+ break;
+
+ case SvrMsg_Cmd_STOP:
+ count++;
+ /*
+ * When stop commands have been recieved from all procs
+ * terminate server
+ */
+ if (count == numProcs - 1) {
+ running = FALSE;
+ }
+ break;
+
+ default:
+ printf("SvrHost_run: unknown message\n");
+ break;
+ }
+ } /* while (running) */
+
+leave:
+ printf("<-- SvrHost_run\n");
+ return(status);
+}
+
+
+/*
+ * ======== SvrHost_setup ========
+ */
+Int SvrHost_setup(Void)
+{
+ Int status = 0;
+ Int count;
+ MessageQ_Params msgqParams;
+ UInt16 procId;
+ Char cbuf[48];
+
+ /* TODO enter gate */
+ printf("--> SvrHost_setup:\n");
+
+ /* initialize module state */
+ Module.localMsgQue = NULL;
+
+ printf("Initialize Module state\n");
+
+ count = MultiProc_getNumProcessors();
+
+ /* compute the server queue name */
+ procId = MultiProc_self();
+ sprintf(cbuf,SvrMsg_SvrQueNameFmt, MultiProc_getName(procId));
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.localMsgQue = MessageQ_create(cbuf, &msgqParams);
+
+ if (Module.localMsgQue == NULL) {
+ printf("SvrHost_setup: message queue create failed\n");
+ goto leave;
+ }
+
+ printf("SvrHost_setup : slave is ready\n");
+
+leave:
+
+ /* TODO leave gate */
+ printf("<-- SvrHost_setup:\n");
+ return(status);
+}
diff --git a/src/examples/templates/ex11_ping/host/makefile b/src/examples/templates/ex11_ping/host/makefile
--- /dev/null
@@ -0,0 +1,227 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var csprefix = "";
+
+ if (platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^TI814X_bios_elf$/)) {
+ platInst = "ti.platforms.evmTI814X:" + lcCore;
+ } else if (platform.match(/^C6A8149_bios_elf$/)) {
+ platInst = "ti.platforms.evmC6A8149:" + lcCore;
+ } else if (platform.match(/^TCI6636_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI6636K2H:" + lcCore;
+ } else if (platform.match(/^66AK2E_bios_elf$/)) {
+ platInst = "ti.platforms.evmC66AK2E:" + lcCore;
+ } else if (platform.match(/^TCI6630_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI6630K2L:" + lcCore;
+ } else if (platform.match(/^66AK2G_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI66AK2G02:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ if (target.match(/^ti.targets.arm.elf.A8Fnv$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+ } else if (target.match(/^gnu.targets.arm.A15F$/)) {
+ csprefix = "gnu.targets.arm.A15F";
+ cc = "/bin/arm-none-eabi-gcc";
+ lnk = "/bin/arm-none-eabi-gcc";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Svr`core`.c App`core`.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+libs =
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_`lcCore`.x
+# $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+server_`lcCore`.x: bin/$(PROFILE)/server_`lcCore`.x`suffix`
+bin/$(PROFILE)/server_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+% if (cgtools.match(/^ti\./)) {
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+% } else if (cgtools.match(/^gnu\./)) {
+ $(LD) -o $@ $(LDFLAGS) $(objs) $(libs) -Wl,-T,$(CONFIG)/linker.cmd \
+ -lgcc -lc -lm -lnosys $(LDLIBS)
+% } else {
+% throw ("Unrecognized cgtools: " + cgtools);
+% }
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+% if (cgtools.match(/^ti\./)) {
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+% } else if (cgtools.match(/^gnu\./)) {
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+% } else {
+% throw ("Unrecognized cgtools: " + cgtools);
+% }
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: `core`.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ procList: \"$(PROCLIST)\", \
+ profile: \"$(PROFILE)\" \
+ }" `core`.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_`lcCore`.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+% if (cgtools.match(/^ti\./)) {
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+% } else if (cgtools.match(/^gnu\./)) {
+CC = $(`csprefix`)`cc` -c -MD -MF $@.dep
+%// unused
+%// AR = $(CS_A15_PREFIX)ar cr
+LD = $(`csprefix`)`cc`
+
+CPPFLAGS = -Dfar= -D__DYNAMIC_REENT__
+CFLAGS = -Wall -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections $(CCPROFILE_$(PROFILE)) @$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -mfloat-abi=hard -nostartfiles -Wl,-static -Wl,--gc-sections -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -L$(XDC_INSTALL_DIR)/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu
+
+CCPROFILE_debug = -g -ggdb -D_DEBUG_=1
+CCPROFILE_release = -O2
+
+LDPROFILE_debug = -g -ggdb
+LDPROFILE_release =
+% }
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex11_ping/host/makefile_linux b/src/examples/templates/ex11_ping/host/makefile_linux
--- /dev/null
@@ -0,0 +1,143 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+srcs = MainHost.c SvrHost.c AppHost.c
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov5T.dep,$(srcs)))
+
+
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov5T,$(srcs)))
+libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.a \
+ $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.a \
+ $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.a
+
+# Use dynamic or shared libs
+#libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.so \
+# $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.so \
+# $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.so
+
+# Use dynamic or static libraries installed on your linux distribution
+#libs =
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug app_host
+ $(MAKE) PROFILE=release app_host
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+app_host: bin/$(PROFILE)/app_host
+bin/$(PROFILE)/app_host: $(objs) $(libs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov5T: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS =
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I $(IPC_INSTALL_DIR)/linux/include -I $(IPC_INSTALL_DIR)/packages
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex11_ping/makefile b/src/examples/templates/ex11_ping/makefile
--- /dev/null
@@ -0,0 +1,123 @@
+#
+# Copyright (c) 2012-2014, 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+# ipu1: implies smp mode
+# ipu1-0 ipu1-1: implies non-smp mode
+PROCLIST = dsp1 dsp2 eve1 eve2 eve3 eve4 ipu1 ipu2 host
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+% // No HOST on vayu CCS simulator
+PROCLIST = dsp1 dsp2 eve1 eve2 eve3 eve4 ipu1
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+PROCLIST = dsp video-m3 host
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+PROCLIST = dsp eve video-m3 host
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+PROCLIST = dsp host
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+PROCLIST = core0 core1 core2 core3 core4 core5
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+PROCLIST = core0 core1 core2 core3 core4 core5 core6 core7
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+# ipu1: implies smp mode
+# ipu1-0 ipu1-1: implies non-smp mode
+PROCLIST = dsp1 ipu1-0 eve1
+% } else if (this.platform.match(/^TCI6636_bios_elf$/)) {
+PROCLIST = host core0 core1 core2 core3 core4 core5 core6 core7
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+PROCLIST = host core0
+% } else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+PROCLIST = host core0 core1 core2 core3
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+
+all: $(PROCLIST)
+
+$(PROCLIST):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@ PROCLIST="$(PROCLIST)"
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+EXEC_DIR=$(CURDIR)/install
+override EXEC_DIR:=$(EXEC_DIR)/ex11_ping
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+clean: $(addsuffix _clean,$(PROCLIST))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(PROCLIST)):
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex11_ping/mkpkg.xdt b/src/examples/templates/ex11_ping/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,455 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt
+
+%if (this.platform.match(/OMAPL138_linux_elf/)) {
+ shared/config_linux.bld -> `this.example`/dsp/config.bld
+%} else {
+ shared/config.bld -> `this.example`/shared/config.bld
+%}
+
+%if (this.platform.match(/OMAPL138_linux_elf/)) {
+%} else {
+ shared/ipc.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+%}
+
+shared/SvrMsg.h -> `this.example`/shared/SvrMsg.h
+
+%%{
+ var outdir = "";
+
+ if (this.platform.match(/^C6472_bios_elf$/)) {
+ /* CORE0-5 */
+ for (var j = 0; j <= 5; j++) {
+ outdir = "core" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Core" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppCore" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppCore" + j + ".h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrCore" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrCore" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainCore" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Core" + j, "e64P", "ti.targets.elf.C64P");
+ }
+ }
+ }
+ else if (this.platform.match(/^C6678_bios_elf$/)) {
+ /* CORE0-7 */
+ for (var j = 0; j <= 7; j++) {
+ outdir = "core" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Core" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppCore" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppCore" + j + ".h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrCore" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrCore" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainCore" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Core" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+ }
+ else if (this.platform.match(/TI814X_bios_elf/)) {
+ /* host */
+ outdir = "host";
+ var files = [
+ { inFile: "host/Host.cfg" , outFile: outdir + "/Host.cfg" },
+ { inFile: "host/AppHost.c", outFile: outdir + "/AppHost.c" },
+ { inFile: "host/AppHost.h", outFile: outdir + "/AppHost.h" },
+ { inFile: "host/SvrHost.c", outFile: outdir + "/SvrHost.c" },
+ { inFile: "host/SvrHost.h", outFile: outdir + "/SvrHost.h" },
+ { inFile: "host/MainHost.c", outFile: outdir + "/MainHost.c" },
+ { inFile: "host/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Host", "ea8fnv", "ti.targets.arm.elf.A8Fnv", this.hostOS);
+ }
+
+ /* video-m3 */
+ outdir = "video-m3";
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Video.cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppVideo.c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppVideo.h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrVideo.c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrVideo.h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainVideo.c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Video", "em3", "ti.targets.arm.elf.M3");
+ }
+
+ /* DSP */
+ outdir = "dsp";
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Dsp.cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppDsp.c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppDsp.h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrDsp.c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrDsp.h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainDsp.c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp", "e674", "ti.targets.elf.C674");
+ }
+ }
+ else if (this.platform.match(/C6A8149_bios_elf/)) {
+ /* host */
+ outdir = "host";
+ var files = [
+ { inFile: "host/Host.cfg" , outFile: outdir + "/Host.cfg" },
+ { inFile: "host/AppHost.c", outFile: outdir + "/AppHost.c" },
+ { inFile: "host/AppHost.h", outFile: outdir + "/AppHost.h" },
+ { inFile: "host/SvrHost.c", outFile: outdir + "/SvrHost.c" },
+ { inFile: "host/SvrHost.h", outFile: outdir + "/SvrHost.h" },
+ { inFile: "host/MainHost.c", outFile: outdir + "/MainHost.c" },
+ { inFile: "host/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Host", "ea8fnv", "ti.targets.arm.elf.A8Fnv", this.hostOS);
+ }
+
+ /* video-m3 */
+ outdir = "video-m3";
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Video.cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppVideo.c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppVideo.h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrVideo.c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrVideo.h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainVideo.c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Video", "em3", "ti.targets.arm.elf.M3");
+ }
+
+ /* DSP */
+ outdir = "dsp";
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Dsp.cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppDsp.c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppDsp.h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrDsp.c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrDsp.h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainDsp.c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp", "e674", "ti.targets.elf.C674");
+ }
+
+ /* EVE */
+ outdir = "eve";
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Eve.cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppEve.c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppEve.h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrEve.c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrEve.h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainEve.c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Eve", "earp32F", "ti.targets.arp32.elf.ARP32_far");
+ }
+ }
+ else if (this.platform.match(/OMAPL138_linux_elf/)) {
+ /* host */
+ outdir = "host";
+ var files = [
+ { inFile: "host/AppHost_linux.c", outFile: outdir + "/AppHost.c" },
+ { inFile: "host/AppHost.h", outFile: outdir + "/AppHost.h" },
+ { inFile: "host/SvrHost_linux.c", outFile: outdir + "/SvrHost.c" },
+ { inFile: "host/SvrHost.h", outFile: outdir + "/SvrHost.h" },
+ { inFile: "host/MainHost.c", outFile: outdir + "/MainHost.c" },
+ { inFile: "host/makefile_linux", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Host", "ea8fnv", "ti.targets.arm.elf.A8Fnv",this.hostOS);
+ }
+
+ /* DSP */
+ outdir = "dsp";
+ var files = [
+ { inFile: "slave/OMAPL138.cfg", outFile: outdir + "/Dsp.cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppDsp.c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppDsp.h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrDsp.c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrDsp.h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainDsp.c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp", "e674", "ti.targets.elf.C674");
+ }
+ }
+ else if (this.platform.match(/(VAYUsim|DRA7XX)_bios_elf/)) {
+ if (!this.platform.match(/VAYUsim_bios_elf/)) {
+ /* host */
+ outdir = "host";
+ var files = [
+ { inFile: "host/Host.cfg" , outFile: outdir + "/Host.cfg" },
+ { inFile: "host/AppHost.c", outFile: outdir + "/AppHost.c" },
+ { inFile: "host/AppHost.h", outFile: outdir + "/AppHost.h" },
+ { inFile: "host/SvrHost.c", outFile: outdir + "/SvrHost.c" },
+ { inFile: "host/SvrHost.h", outFile: outdir + "/SvrHost.h" },
+ { inFile: "host/MainHost.c", outFile: outdir + "/MainHost.c" },
+ { inFile: "host/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Host", "a15fg", "gnu.targets.arm.A15F", this.hostOS);
+ }
+ }
+
+ /* IPU[1,2] */
+ for (var j = 1; j <= 2; j++) {
+ outdir = "ipu" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Ipu" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppIpu" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppIpu" + j + ".h" },
+ { inFile: "slave/ipu.gel", outFile: outdir + "/ex11_ping_ipu" + j + ".gel" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrIpu" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrIpu" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainIpu" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* IPU1-[0,1]*/
+ for (var j = 0; j <= 1; j++) {
+ outdir = "ipu1-" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Ipu1-" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppIpu1-" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppIpu1-" + j + ".h" },
+ { inFile: "slave/ipu.gel", outFile: outdir + "/ex11_ping_ipu1-" + j + ".gel" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrIpu1-" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrIpu1-" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainIpu1-" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ if (outdir == "ipu1-1") {
+ files.splice(3, 1); /* remove gel file */
+ }
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu1-" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* DSP1-2 */
+ for (var j = 1; j <= 2; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Dsp" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppDsp" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppDsp" + j + ".h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrDsp" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrDsp" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainDsp" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+
+ /* EVE1-4 */
+ for (var j = 1; j <= 4; j++) {
+ outdir = "eve" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Eve" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppEve" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppEve" + j + ".h" },
+ { inFile: "slave/eve.gel", outFile: outdir + "/ex11_ping_eve" + j + ".gel" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrEve" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrEve" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainEve" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Eve" + j, "earp32F", "ti.targets.arp32.elf.ARP32_far");
+ }
+ }
+ }
+ else if (this.platform.match(/TDA3XX_bios_elf/)) {
+ /* DSP1-2 */
+ for (var j = 1; j <= 2; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Dsp" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppDsp" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppDsp" + j + ".h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrDsp" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrDsp" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainDsp" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+
+ /* IPU1 */
+ for (var j = 1; j <= 1; j++) {
+ outdir = "ipu" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Ipu" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppIpu" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppIpu" + j + ".h" },
+ { inFile: "slave/ipu.gel", outFile: outdir + "/ex11_ping_ipu" + j + ".gel" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrIpu" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrIpu" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainIpu" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* IPU1-[0,1]*/
+ for (var j = 0; j <= 1; j++) {
+ outdir = "ipu1-" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Ipu1-" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppIpu1-" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppIpu1-" + j + ".h" },
+ { inFile: "slave/ipu.gel", outFile: outdir + "/ex11_ping_ipu1-" + j + ".gel" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrIpu1-" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrIpu1-" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainIpu1-" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ if (outdir == "ipu1-1") {
+ files.splice(3, 1); /* remove gel file */
+ }
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu1-" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* EVE1 */
+ for (var j = 1; j <= 1; j++) {
+ outdir = "eve" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Eve" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppEve" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppEve" + j + ".h" },
+ { inFile: "slave/eve.gel", outFile: outdir + "/ex11_ping_eve" + j + ".gel" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrEve" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrEve" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainEve" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Eve" + j, "earp32F", "ti.targets.arp32.elf.ARP32_far");
+ }
+ }
+ }
+ else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+ /* CORE0-7 */
+ var coreNum;
+ if (this.platform.match(/^TCI6636_bios_elf$/)) {
+ coreNum = 7;
+ }
+ else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+ coreNum = 0;
+ }
+ else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+ coreNum = 3;
+ }
+ for (var j = 0; j <= coreNum; j++) {
+ outdir = "core" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Core" + j + ".cfg" },
+ { inFile: "slave/App.c", outFile: outdir + "/AppCore" + j + ".c" },
+ { inFile: "slave/App.h", outFile: outdir + "/AppCore" + j + ".h" },
+ { inFile: "slave/Svr.c", outFile: outdir + "/SvrCore" + j + ".c" },
+ { inFile: "slave/Svr.h", outFile: outdir + "/SvrCore" + j + ".h" },
+ { inFile: "slave/Main.c", outFile: outdir + "/MainCore" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Core" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+ /* host */
+ outdir = "host";
+ var files = [
+ { inFile: "host/Host.cfg" , outFile: outdir + "/Host.cfg" },
+ { inFile: "host/AppHost.c", outFile: outdir + "/AppHost.c" },
+ { inFile: "host/AppHost.h", outFile: outdir + "/AppHost.h" },
+ { inFile: "host/SvrHost.c", outFile: outdir + "/SvrHost.c" },
+ { inFile: "host/SvrHost.h", outFile: outdir + "/SvrHost.h" },
+ { inFile: "host/MainHost.c", outFile: outdir + "/MainHost.c" },
+ { inFile: "host/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Host", "a15fg", "gnu.targets.arm.A15F", this.hostOS);
+ }
+ }
+%%}
diff --git a/src/examples/templates/ex11_ping/products.mak b/src/examples/templates/ex11_ping/products.mak
--- /dev/null
@@ -0,0 +1,141 @@
+#
+# Copyright (c) 2012-2014, 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.
+#
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+#gnu.targets.arm.A15F = $(DEPOT)/_your_gnu_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.arp32.elf.ARP32_far = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.arp32.elf.ARP32_far = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+#ti.targets.elf.C674 = $(DEPOT)/_your_ti_dsp_codegen_install_
+
+#### Toolchain for ARM host ####
+#TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_code_sourcery_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+#ti.targets.arm.elf.A8Fnv = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C674 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M3 = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+#ti.targets.arm.elf.A8Fnv = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C674 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M3 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.arp32.elf.ARP32_far = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+#ti.targets.elf.C64P = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.arp32.elf.ARP32_far = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+#gnu.targets.arm.A15F = $(DEPOT)/_your_gnu_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ @echo "gnu.targets.arm.A15F = $(gnu.targets.arm.A15F)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.arp32.elf.ARP32_far = $(ti.targets.arp32.elf.ARP32_far)"
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.arp32.elf.ARP32_far = $(ti.targets.arp32.elf.ARP32_far)"
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ @echo "ti.targets.elf.C674 = $(ti.targets.elf.C674)"
+ @echo "HOST TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+ @echo "ti.targets.arm.elf.A8Fnv = $(ti.targets.arm.elf.A8Fnv)"
+ @echo "ti.targets.elf.C674 = $(ti.targets.elf.C674)"
+ @echo "ti.targets.arm.elf.M3 = $(ti.targets.arm.elf.M3)"
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+ @echo "ti.targets.arm.elf.A8 = $(ti.targets.arm.elf.A8)"
+ @echo "ti.targets.elf.C674 = $(ti.targets.elf.C674)"
+ @echo "ti.targets.arm.elf.M3 = $(ti.targets.arm.elf.M3)"
+ @echo "ti.targets.arp32.elf.ARP32_far = $(ti.targets.arp32.elf.ARP32_far)"
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+ @echo "ti.targets.elf.C64P = $(ti.targets.elf.C64P)"
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.arp32.elf.ARP32_far = $(ti.targets.arp32.elf.ARP32_far)"
+% } else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+ @echo "gnu.targets.arm.A15F = $(gnu.targets.arm.A15F)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex11_ping/readme.txt b/src/examples/templates/ex11_ping/readme.txt
--- /dev/null
@@ -0,0 +1,664 @@
+#
+# ======== readme.txt ========
+#
+
+ping - Send a message between all cores in the system
+
+Overview
+=========================================================================
+This example is used to exercise every communication path between all
+processors in the system (including local delivery on the current
+processor). The example is also organized in a suitable manner to develop
+an application with different compute units on each processor.
+
+Each executable will create two tasks: 1) the server task, and 2) the
+application task. The server task creates a message queue and then waits
+on that queue for incoming messages. When a message is received, the
+server task simply sends it back to the original sender.
+
+The application task creates its own message queue and then opens every
+server message queue in the system (including the server queue on the
+local processor). The task sends a message to a server and waits for the
+message to be returned. This is repeated for each server in the system
+(including the local server).
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+
+IPC Build Instructions
+=========================================================================
+
+The IPC product provides a top level GNU makefile to allow users to easily
+build the various component modules, tests, and sample applications for the
+supported devices. GNU make version 3.81 or greater is required. The XDC
+tools (provided with most SDKs and CCS distributions) includes a pre-compiled
+version of GNU make 3.81 in $(XDC_INSTALL_DIR)/gmake.
+
+1. To build the IPC BIOS-side libraries and test run:
+
+ make -f ipc-bios.mak
+
+2. To configure and build the IPC Linux-side user libraries and tests run:
+
+ make -f ipc.linux.mak
+ make
+
+3. To install the Linux-side test, you can issue the followig command:
+
+ make install prefix=$HOME/ipc_3_00
+
+This will install the files on your local hosts filesystem in /home/<user>/
+ipc_3_00 directory which could then be copies over to the target's
+filesystem for execution.
+
+If your target's filesystem is accessible from your local host, you can set
+the prefix variable to point to your target's filesystem as follows:
+
+ make install prefix=$HOME/targetFS/usr
+
+% } else {
+% }
+
+Build Instructions
+=========================================================================
+
+ 1. Setup a development area. A typical setup might look like this. The
+ Depot folder contains installed products. The work folder contains
+ each of the examples (eg. hello, ping, etc.). Each example contains
+ its own products.mak file which will include a parent products.mak
+ file if it exists. The parent file must be created by you.
+
+ testbench/
+ |_ Depot/
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ gnu_arm_vv_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_arp32_m_m_p/
+ | |_ ti_c6x_m_m_p/
+ | |_ ti_tms470_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_arp32_m_m_p/
+ | |_ ti_c6x_m_m_p/
+ | |_ ti_tms470_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_c6x_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_c6x_m_m_p/
+ | |_ ti_tms470_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+% } else if (this.platform.match(/^(C6472|C6678)_bios_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_c6x_m_m_p/
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_arp32_m_m_p/
+ | |_ ti_c6x_m_m_p/
+ | |_ ti_tms470_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_arp32_m_m_p/
+ | |_ ti_c6x_m_m_p/
+ | |_ ti_tms470_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+% } else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ ti_c6x_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+% } else {
+% throw("Unsupported platform: " + platform);
+% }
+ |
+ |_ work/
+ |_ ping/
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ | |_ dsp1/
+ | |_ dsp2/
+ | |_ eve1/
+ | |_ eve2/
+ | |_ eve3/
+ | |_ eve4/
+ | |_ host/
+ | |_ ipu1/
+ | |_ ipu1-0/
+ | |_ ipu1-1/
+ | |_ ipu2/
+ | |_ shared/
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+ | |_ dsp1/
+ | |_ dsp2/
+ | |_ eve1/
+ | |_ eve2/
+ | |_ eve3/
+ | |_ eve4/
+ | |_ ipu1/
+ | |_ ipu1-0/
+ | |_ ipu1-1/
+ | |_ shared/
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+ | |_ dsp/
+ | |_ host/
+ | |_ shared/
+ | |_ video/
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ | |_ dsp/
+ | |_ host/
+ | |_ shared/
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+ | |_ core0/
+ | |_ core1/
+ | |_ core2/
+ | |_ core3/
+ | |_ core4/
+ | |_ core5/
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+ | |_ core0/
+ | |_ core1/
+ | |_ core2/
+ | |_ core3/
+ | |_ core4/
+ | |_ core5/
+ | |_ core6/
+ | |_ core7/
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+ | |_ dsp/
+ | |_ eve/
+ | |_ host/
+ | |_ shared/
+ | |_ video/
+% } else if (this.platform.match(/^TCI6636_bios_elf$/)) {
+ | |_ core0/
+ | |_ core1/
+ | |_ core2/
+ | |_ core3/
+ | |_ core4/
+ | |_ core5/
+ | |_ core6/
+ | |_ core7/
+ | |_ host/
+ | |_ shared/
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+ | |_ core0/
+ | |_ host/
+ | |_ shared/
+% } else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+ | |_ core0/
+ | |_ core1/
+ | |_ core2/
+ | |_ core3/
+ | |_ host/
+ | |_ shared/
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+ | |_ dsp1/
+ | |_ dsp2/
+ | |_ eve1/
+ | |_ ipu1/
+ | |_ ipu1-0/
+ | |_ ipu1-1/
+ | |_ shared/
+% }
+ | |_ makefile
+ | |_ products.mak
+ | |_ readme.txt
+ |
+ |_ products.mak
+
+ In the ping example, there is a top-level makefile which simply builds
+ each of the lower directories. There is a directory for each processor
+ named by the IPC processor name. The folder named 'shared' contains
+ common files used by all executables, such as config.bld which defines
+ the memory map.
+
+ 2. Unpack the ping.zip file into the work folder.
+
+ cd work
+ unzip <...>/ping.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ DEPOT = /testbench/Depot
+
+ BIOS_INSTALL_DIR = $(DEPOT)/bios_m_mm_pp_bb
+ IPC_INSTALL_DIR = $(DEPOT)/ipc_m_mm_pp_bb
+ XDC_INSTALL_DIR = $(DEPOT)/xdctools_m_mm_pp_bb
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ gnu.targets.arm.A15F = $(DEPOT)/gnu_arm_vv_bb
+ ti.targets.elf.C66 = $(DEPOT)/ti_c6x_m_m_p
+ ti.targets.arm.elf.M4 = $(DEPOT)/ti_tms470_m_m_p
+ ti.targets.arp32.elf.ARP32_far = $(DEPOT)/ti_arp32_m_m_p
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+ ti.targets.elf.C66 = $(DEPOT)/ti_c6x_m_m_p
+ ti.targets.arm.elf.M4 = $(DEPOT)/ti_tms470_m_m_p
+ ti.targets.arp32.elf.ARP32_far = $(DEPOT)/ti_arp32_m_m_p
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+ ti.targets.arm.elf.A8 = $(DEPOT)/ti_tms470_m_m_p
+ ti.targets.elf.C674 = $(DEPOT)/ti_c6x_m_m_p
+ ti.targets.arm.elf.M3 = $(DEPOT)/ti_tms470_m_m_p
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
+ TOOLCHAIN_INSTALL_DIR = $(DEPOT)/CodeSourcery/Sourcery_G++_Lite
+ ti.targets.elf.C674 = $(DEPOT)/ti_c6x_m_m_p
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+ ti.targets.elf.C64P = $(DEPOT)/ti_c6x_m_m_p
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+ ti.targets.elf.C66 = $(DEPOT)/ti_c6x_m_m_p
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+ ti.targets.arm.elf.A8 = $(DEPOT)/ti_tms470_m_m_p
+ ti.targets.elf.C674 = $(DEPOT)/ti_c6x_m_m_p
+ ti.targets.arm.elf.M3 = $(DEPOT)/ti_tms470_m_m_p
+ ti.targets.arp32.elf.ARP32_far = $(DEPOT)/ti_arp32_m_m_p
+% } else if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+ gnu.targets.arm.A15F = $(DEPOT)/gnu_arm_vv_bb
+ ti.targets.elf.C66 = $(DEPOT)/ti_c6x_m_m_p
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+ ti.targets.elf.C66 = $(DEPOT)/ti_c6x_m_m_p
+ ti.targets.arm.elf.M4 = $(DEPOT)/ti_tms470_m_m_p
+ ti.targets.arp32.elf.ARP32_far = $(DEPOT)/ti_arp32_m_m_p
+% }
+
+ 4. Build the example. This will build only debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ping
+ make
+
+ Look in the following folders for the generated files. All executables
+ are copied to these folders for convenience; it makes it easier when
+ loading them into CCS.
+
+ install/ping/debug/
+ install/ping/release/
+
+ 5. Optional. Use the install goal to copy the executables to a specific
+ folder of your choice.
+
+ cd ping
+ make install EXEC_DIR=/<full pathname>/<platform>
+
+ The executables are copied to the following folders.
+
+ /<full pathname>/<platform>/ping/debug
+ /<full pathname>/<platform>/ping/release
+
+
+Build Configuration
+=========================================================================
+
+This example can be built for a subset of all available processors. For
+example, you might want to build and run this example for the following
+% if (this.platform.match(/^(VAYUsim|DRA7XX)_bios_elf$/)) {
+processors: DSP1, EVE1, EVE2. Use the following instructions to configure
+% } else if (this.platform.match(/^TI814X_bios_elf$/) ||
+% (this.platform.match(/^C6A8149_bios_elf$/))) {
+processors: DSP and HOST. Use the following instructions to configure
+% } else if (this.platform.match(/^(C6472|C6678)_bios_elf$/)) {
+processors: CORE0 and CORE1. Use the following instructions to configure
+% } else if (this.platform.match(/^(TCI6636|TCI6630)_bios_elf$/)) {
+processors: HOST, CORE0, CORE1. Use the following instructions to configure
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+processors: HOST, CORE0. Use the following instructions to configure
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+processors: DSP1, DSP2, EVE1. Use the following instructions to configure
+% }
+this example for a subset of processors.
+
+Note: you must always run the set of processors you configured and built.
+% if (this.platform.match(/^(VAYUsim|DRA7XX)_bios_elf$/)) {
+In this example, you must run the DSP1, EVE1, and EVE2 executables; you
+% } else if (this.platform.match(/^TI814X_bios_elf$/) ||
+% (this.platform.match(/^C6A8149_bios_elf$/))) {
+In this example, you must run the DSP and HOST executables; you
+% } else if (this.platform.match(/^(C6472|C6678)_bios_elf$/)) {
+In this example, you must run the CORE0 and CORE1 executables; you
+% } else if (this.platform.match(/^(TCI6636|TCI6630)_bios_elf$/)) {
+In this example, you must run the HOST, CORE0, and CORE1 executables; you
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+In this example, you must run the HOST and CORE0 executables; you
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+In this example, you must run the DSP1, DSP2, and EVE1 executables; you
+% }
+cannot run just one of them. Because the IPC has been configured for
+ProcSync_ALL, all processors must participate in the call to Ipc_start().
+
+ 1. Specify the processor list in the top-level makefile.
+
+ edit ping/makefile
+
+ Edit the list of processors in the PROCLIST variable.
+
+% if (this.platform.match(/^(VAYUsim|DRA7XX)_bios_elf$/)) {
+ PROCLIST = dsp1 eve1 eve2
+% } else if (this.platform.match(/^TI814X_bios_elf$/) ||
+% (this.platform.match(/^C6A8149_bios_elf$/)) || (this.platform.match(/^OMAPL138_linux_elf$/))) {
+ PROCLIST = dsp host
+% } else if (this.platform.match(/^(C6472|C6678)_bios_elf$/)) {
+ PROCLIST = core0 core1
+% } else if (this.platform.match(/^(TCI6636|TCI6630)_bios_elf$/)) {
+ PROCLIST = host core0 core1
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+ PROCLIST = host core0
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+ PROCLIST = dsp1 dsp2 eve1
+% }
+
+ 2. Clean and rebuild the example.
+
+ cd ping
+ make clean
+ make
+
+ Look in the following folders for the generated files.
+
+ ping/install/ping/debug
+ ping/install/ping/release
+
+
+% if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+Running on CCS Vayu Simulator
+=========================================================================
+Use CCS with the Vayu simulator to run this example.
+
+ 1. Create a Vayu_FS launch configuration.
+
+ 2. Launch the Vayu_FS configuration.
+
+ 3. Load each executable onto its respective processor. Note that the CCS
+ processor name may not match exactly with the executable name. Use
+ the following mapping.
+
+ server_dsp1.xe66 --> DSP_1
+ server_dsp2.xe66 --> DSP_2
+ server_eve1.xearp32 --> EVE_1
+ server_eve2.xearp32 --> EVE_2
+ server_eve3.xearp32 --> EVE_3
+ server_eve4.xearp32 --> EVE_4
+ server_ipu1.xem4 --> benelli_core_0
+ server_ipu1.xem4 --> benelli_core_1
+
+ Note that the same executable is loaded onto both Benelli processors.
+ This executable is configured to run SMP/BIOS, so logically the Benelli
+ is referred to as a single processor (IPU1) but due to the nature of
+ the simulator, the executable must be loaded onto each core.
+
+ 4. Set a software breakpoint in each executable's "done" function. Use the
+ CCS Disassembly window. For the Benelli processors, set the same
+ breakpoint on both core_0 and core_1. Use the following mapping of
+ CCS processor names to function names.
+
+ DSP_1 --> MainDsp1_done
+ DSP_2 --> MainDsp2_done
+ EVE_1 --> MainEve1_done
+ EVE_2 --> MainEve2_done
+ EVE_3 --> MainEve3_done
+ EVE_4 --> MainEve4_done
+ benelli_core_0 --> MainIpu1_done
+ benelli_core_1 --> MainIpu1_done
+
+ 5. Run the processors. Place all the processors into a group. Select the
+ group and run them. This should release all the processors and run
+ the example. Wait until each breakpoint is reached. You will still need
+ to halt one of the Benelli processors.
+
+ 6. Use the CCS RTOS Object View (ROV) to inspect the LoggerBuf module for
+ each processor. You should see log events from both the server task
+ and the application task.
+% } else if (this.platform.match(/^TI814X_bios_elf$/) ||
+% (this.platform.match(/^C6A8149_bios_elf$/))) {
+Running on CCS
+=========================================================================
+Use CCS with an emulator hooked up to the CentEVE board to run this example.
+
+ 1. Create a launch configuration for the board + emulator combo.
+% if (this.platform.match(/^TI814X_bios_elf$/)) {
+ For the A8, set it up to use the initialization scripts from the pg1 or pg2 folder in
+ <IPC_INSTALL_DIR>/packages/ti/sdo/ipc/examples/multicore/evmTI81XX, depending
+ on your revision of silicon
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+ For the A8, set it up to use the initialization script DM814x_EVM_PG2_1_HDMI.gel
+ from <IPC_INSTALL_DIR>/packages/ti/sdo/ipc/examples/multicore/evmC6A8149
+ For the EVE, set it up to use script arp32.gel from the same directory.
+% }
+ 2. Launch the configuration.
+
+ 3. Disable the CCS feature to automatically run to main on a program load. In
+ CCS 5.1, you can do this by right-clicking on your newly created target
+ configuration and select properties. The "Auto Run Options" are under the
+ Debug tab, Generic Debugger Options. Uncheck the box next to "On a program
+ load or restart". Do this for each core.
+
+ 4. Load each executable onto its respective processor. Note that the CCS
+ processor name may not match exactly with the executable name. Use
+ the following mapping.
+
+ server_dsp.xe674 --> DSP
+% if (this.platform.match(/^C6A8149_bios_elf$/)) {
+ server_eve.xearp32F --> EVE
+% }
+ server_host.xea8f --> A8
+ server_video.xem3 --> VIDEO-M3 (aka M3 RTOS)
+ server_video.xem3 --> VPSS-M3 (aka M3 ISS)
+
+ Note that the same executable is loaded onto both M3 processors on the
+ Ducati.
+ This executable is configured to run SMP/BIOS, so logically the Ducati
+ is referred to as a single processor (VIDEO-M3) but the executables
+ are loaded twice to ensure the debugger is in the right state and has
+ the debug symbols loaded.
+
+ 5. Clear bit T to 0 in the CPSR register of the Cortex A8 using CCS. The
+ A8 comes up in Thumb mode, hence we need to toggle this bit to get it
+ back to ARM mode.
+
+ 6. Run core 1 of the Ducati (VPSS-M3) first. Then run the other cores.
+
+ 7. Disconnect all cores and power cycle the board between runs of the example.
+% if (this.platform.match(/^TI814X_bios_elf$/)) {
+
+Known issue
+=========================================================================
+When the DSP and the M3's are configured to use the non-debug version of
+BIOS and IPC, it has been seen that sometimes the example does not terminate
+correctly. Hence both cores are currently configured to use the debug
+version of the libraries.
+% }
+% } else if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+Running with CCS on Virtio VPVayu simulator
+=========================================================================
+ 1. Launch Virtio VPVayu
+
+ Start > Innovator
+ File > Open Project or File > C:/Virtio/Platforms/VPVayu/VPVayu.vsp
+
+ Toolbar > vayu_general (Platform)
+
+ If you are using the CortexA15_0 core (with HOST):
+ Params > User Parameters
+ ArmCortexA15_DebugEnable: true
+
+ Params > VPVayu SDP > Vayu > CPU_SS
+ InitValue_Core0: 0
+
+ If you are *not* using the CortexA15_0 core (no host):
+ Params > User Parameters
+ ArmCortexA15_DebugEnable: false
+
+ Params > VPVayu SDP > Vayu > CPU_SS
+ InitValue_Core0: 1
+
+ Build/Run > Start or Go (F5), this launches the Virtio Vayu simulator
+
+ Wait for the following message in the Output Window
+ CortexA15x2CT_FM: CADI Debug Server started
+
+ Minimize the windows.
+ * note: The Cockpit::VPVayu window will indicate '(Not Responding)'.
+
+ 2. Launch CCS
+
+ Start > CCS_5_3_0
+ Launch one of the following target configurations:
+ + VPVayu_5.2
+ + VPVayu_5.2_no_host
+
+ 3. Place HOST in non-secure mode. If you forget this, the SYS/BIOS tick
+ will not run
+
+ In Debug window, select CortexA15_0
+ Scripts > Vayu Configuration > enterNonSecureMode
+
+ 4. Hide unused cores. This just removes clutter from the Debug window.
+ Select any cores you will not be using, then select RMB > Hide Cores.
+
+ 5. Group remaining cores. This is more of a convenience than a necessity.
+
+ In Debug window, select cores:
+ + IPU1_core_0
+ + IPU1_core_1
+ RMB > Group cores
+
+ In Debug window, select cores:
+ + IPU2_core_0
+ + IPU2_core_1
+ RMB > Group cores
+
+ In Debug window, select cores:
+ + DSP_1
+ + DSP_2
+ + EVE_1
+ + EVE_2
+ + EVE_3
+ + EVE_4
+ RMB > Group cores
+
+ 6. Load each executable onto its respective processor. Note that the CCS
+ processor name may not match exactly with the executable name. Use
+ the following mapping.
+
+ server_dsp1.xe66 --> DSP_1
+ server_dsp2.xe66 --> DSP_2
+ server_eve1.xearp32f --> EVE_1
+ server_eve2.xearp32f --> EVE_2
+ server_eve3.xearp32f --> EVE_3
+ server_eve4.xearp32f --> EVE_4
+ server_ipu1.xem4 --> IPU1_core_0
+ server_ipu2.xem4 --> IPU2_core_0
+ server_host.xa15fg --> CortexA15_0
+
+ When loading the executable onto IPU1 or IPU2, you only need to load
+ core_0, not both cores. After loading core_0, select core_1 and just
+ load symbols, then restart the core to update the PC register.
+
+ 7. Set a software breakpoint in each executable's "done" function. Use the
+ CCS Disassembly window. For the Benelli processors, you will need to set
+ the same breakpoint on both cores. Use the following mapping of CCS
+ processor names to function names.
+
+ DSP_1 --> MainDsp1_done
+ DSP_2 --> MainDsp2_done
+ EVE_1 --> MainEve1_done
+ EVE_2 --> MainEve2_done
+ EVE_3 --> MainEve3_done
+ EVE_4 --> MainEve4_done
+ IPU1_core_0 --> MainIpu1_done
+ IPU1_core_1 --> MainIpu1_done
+ IPU2_core_0 --> MainIpu2_done
+ IPU2_core_1 --> MainIpu2_done
+ CortexA15_0 --> MainHost_done
+
+ 8. Run the processors. I recommend running CortexA15_0 first, then other
+ processors. As each processor hits the "done" breakpoint, make a note
+ and let the processor continue. Do this for each processor. If the
+ CortexA15_0 status shows 'Suspended - Cross-triggering', then simply
+ run it again.
+
+ Select CortexA15_0 > Run > Resume (F8)
+ Select Group3 > Run > Resume (F8)
+ Select Group2 (Synchronous) > Run > Resume (F8)
+ Select Group1 (Synchronous) > Run > Resume (F8)
+
+ 9. Inspecting log events. Use the CCS RTOS Object View (ROV) to inspect
+ the LoggerBuf module for each processor. You should see log events from
+ both the server task and the application task.
+
+ Select CortexA15_0 > Run > Suspend
+ Select Group3 > Run > Suspend
+ Select Group2 > Run > Suspend
+ Select Group1 > Run > Suspend
+
+ Select CortexA15_0
+ Open ROV window
+ Select LoggerBuf module
+
+ There should be several log events in window. Repeat this for each
+ processor. The number of events will depend on how many processors
+ are configured into your configuration.
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+Run Instructions
+=========================================================================
+
+1. Edit the variable FIRMWARE in the ./slaveloader script to the name of your dsp firmware:
+
+ FIRMWARE=<name_of_firmware>
+
+This script is used to load and unload the dsp firmware as well as load the rpmsg socket driver.
+
+2. Launch a serial terminal from your console (i.e. minicom).
+
+ minicom -w -D /dev/ttyUSBx
+
+If you have not done so you wil press enter to stop autoboot to configure the bootargs. Once this is done type "print" to see the list of bootargs and use the command editenv <NAME_OF_BOOT_ARG> to make changes. You will want to configure the proper IP address, point to the correct kernel image and filesystem you will use. Once the bootargs are configured type "saveenv" and "boot" to save the args and boot the device.
+
+3. Now we will login to the device. The login is "root" with no password as shown below.
+
+ omapl138-lcdk login:root
+ root@omapl138-lcdk:~#
+
+(Optional): SSH into a another shell by running ifconfig on the target to find the IP address and bring up a different terminal and run: telnet <IP_address>. This can be useful for debugging if necessary.
+
+
+4. Run the following commands to execute the application.
+
+ # /usr/bin/lad_omapl138 log
+
+ # ./slaveloader.sh load
+
+ # ./app_host
+
+The first of these commands starts the NameServer daemon.
+
+The second script allows you to load/unload the dsp firmware (to unload replace load with unload) and rpmsg socket driver.
+
+The third command executes the host side code.
+
+5. To debug you can the DSP side you can display the trace by:
+
+ # cat /debug/remoteproc/remoteproct0/trace0
+
+or to view the LAD log by:
+
+vi /tmp/LAD/log
+
+5. When complete you can unload the firmware and remove the rpmsg socket by:
+
+ # ./slaveloader.sh unload
+
+
+** NOTE: to restart the application, the user must power cycle the device. **
+% }
diff --git a/src/examples/templates/ex11_ping/shared/SvrMsg.h b/src/examples/templates/ex11_ping/shared/SvrMsg.h
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== SvrMsg.h ========
+ *
+ */
+
+#ifndef SvrMsg__include
+#define SvrMsg__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#include <ti/ipc/MessageQ.h>
+
+#define SvrMsg_NUM_MSGS 5 /* number of message to send each server */
+
+#define SvrMsg_SvrQueNameFmt "%s_SvrMsgQ" /* %s = proc name */
+
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+#define Dsp1_AppMsgQue "Dsp1_AppMsgQ"
+#define Dsp2_AppMsgQue "Dsp2_AppMsgQ"
+#define Eve1_AppMsgQue "Eve1_AppMsgQ"
+#define Eve2_AppMsgQue "Eve2_AppMsgQ"
+#define Eve3_AppMsgQue "Eve3_AppMsgQ"
+#define Eve4_AppMsgQue "Eve4_AppMsgQ"
+#define Ipu1_AppMsgQue "Ipu1_AppMsgQ"
+#define Ipu1_0_AppMsgQue "Ipu1-0_AppMsgQ"
+#define Ipu1_1_AppMsgQue "Ipu1-1_AppMsgQ"
+#define Ipu2_AppMsgQue "Ipu2_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+#define Dsp1_AppMsgQue "Dsp1_AppMsgQ"
+#define Dsp2_AppMsgQue "Dsp2_AppMsgQ"
+#define Eve1_AppMsgQue "Eve1_AppMsgQ"
+#define Eve2_AppMsgQue "Eve2_AppMsgQ"
+#define Eve3_AppMsgQue "Eve3_AppMsgQ"
+#define Eve4_AppMsgQue "Eve4_AppMsgQ"
+#define Ipu1_AppMsgQue "Ipu1_AppMsgQ"
+#define Ipu1_AppMsgQue "Ipu1_0_AppMsgQ"
+#define Ipu1_AppMsgQue "Ipu1_1_AppMsgQ"
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+#define Dsp_AppMsgQue "Dsp_AppMsgQ"
+#define Video_AppMsgQue "Video_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+#define Dsp_AppMsgQue "Dsp_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+#define Dsp_AppMsgQue "Dsp_AppMsgQ"
+#define Video_AppMsgQue "Video_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+#define Eve_AppMsgQue "Eve_AppMsgQ"
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+#define Core0_AppMsgQue "Core0_AppMsgQ"
+#define Core1_AppMsgQue "Core1_AppMsgQ"
+#define Core2_AppMsgQue "Core2_AppMsgQ"
+#define Core3_AppMsgQue "Core3_AppMsgQ"
+#define Core4_AppMsgQue "Core4_AppMsgQ"
+#define Core5_AppMsgQue "Core5_AppMsgQ"
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+#define Core0_AppMsgQue "Core0_AppMsgQ"
+#define Core1_AppMsgQue "Core1_AppMsgQ"
+#define Core2_AppMsgQue "Core2_AppMsgQ"
+#define Core3_AppMsgQue "Core3_AppMsgQ"
+#define Core4_AppMsgQue "Core4_AppMsgQ"
+#define Core5_AppMsgQue "Core5_AppMsgQ"
+#define Core6_AppMsgQue "Core6_AppMsgQ"
+#define Core7_AppMsgQue "Core7_AppMsgQ"
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+#define Dsp1_AppMsgQue "Dsp1_AppMsgQ"
+#define Dsp2_AppMsgQue "Dsp2_AppMsgQ"
+#define Eve1_AppMsgQue "Eve1_AppMsgQ"
+#define Ipu1_AppMsgQue "Ipu1_AppMsgQ"
+#define Ipu1_0_AppMsgQue "Ipu1-0_AppMsgQ"
+#define Ipu1_1_AppMsgQue "Ipu1-1_AppMsgQ"
+% } else if (this.platform.match(/^TCI6636_bios_elf$/)) {
+#define Core0_AppMsgQue "Core0_AppMsgQ"
+#define Core1_AppMsgQue "Core1_AppMsgQ"
+#define Core2_AppMsgQue "Core2_AppMsgQ"
+#define Core3_AppMsgQue "Core3_AppMsgQ"
+#define Core4_AppMsgQue "Core4_AppMsgQ"
+#define Core5_AppMsgQue "Core5_AppMsgQ"
+#define Core6_AppMsgQue "Core6_AppMsgQ"
+#define Core7_AppMsgQue "Core7_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+#define Core0_AppMsgQue "Core0_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+% } else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+#define Core0_AppMsgQue "Core0_AppMsgQ"
+#define Core1_AppMsgQue "Core1_AppMsgQ"
+#define Core2_AppMsgQue "Core2_AppMsgQ"
+#define Core3_AppMsgQue "Core3_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+#define SvrMsg_Cmd_START 1
+#define SvrMsg_Cmd_STOP 2
+#define SvrMsg_Cmd_PROCESS 3
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ UInt32 cmd;
+ UInt16 svrProcId;
+ Char buf[32];
+} SvrMsg_Msg;
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex11_ping/shared/config.bld b/src/examples/templates/ex11_ping/shared/config.bld
--- /dev/null
@@ -0,0 +1,1403 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+% if (this.platform.match(/^(VAYUsim|DRA7XX)_bios_elf$/)) {
+/* Memory Map
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_0000 8000_0000 1000 ( 4 KB) EVE1_VECS (vector table)
+ * 8000_1000 3F_F000 ( ~4 MB) EVE1_PROG (code, data)
+ * 0000_0000 8040_0000 1000 ( 4 KB) EVE2_VECS (vector table)
+ * 8040_1000 3F_F000 ( ~4 MB) EVE2_PROG (code, data)
+ * 0000_0000 8080_0000 1000 ( 4 KB) EVE3_VECS (vector table)
+ * 8080_1000 3F_F000 ( ~4 MB) EVE3_PROG (code, data)
+ * 0000_0000 80C0_0000 1000 ( 4 KB) EVE4_VECS (vector table)
+ * 80C0_1000 3F_F000 ( ~4 MB) EVE4_PROG (code, data)
+ * 8100_0000 100_0000 ( 16 MB) --------
+ * 8200_0000 100_0000 ( 16 MB) --------
+ * 8300_0000 100_0000 ( 16 MB) --------
+ * 8400_0000 100_0000 ( 16 MB) --------
+ * 8500_0000 100_0000 ( 16 MB) --------
+ * 8600_0000 100_0000 ( 16 MB) IPU1 (code, data) [1]
+ * 8600_0000 80_0000 ( 8 MB) IPU1-0 (code, data) [1]
+ * 8680_0000 80_0000 ( 8 MB) IPI1-1 (code, data) [1]
+ * 8700_0000 100_0000 ( 16 MB) --------
+ * 8800_0000 100_0000 ( 16 MB) --------
+ * 8900_0000 100_0000 ( 16 MB) --------
+ * 8A00_0000 100_0000 ( 16 MB) IPU2 (code, data) [2]
+ * 8B00_0000 100_0000 ( 16 MB) HOST (code, data)
+ * 8C00_0000 100_0000 ( 16 MB) DSP1 (code, data)
+ * 8D00_0000 100_0000 ( 16 MB) DSP2 (code, data)
+ * 8E00_0000 100_0000 ( 16 MB) SR_0 (ipc)
+ * 8F00_0000 100_0000 ( 16 MB) --------
+ *
+ * Notes
+ * ------------------------------------------------------------------------
+ * [1] IPU1 implies SMP mode; IPU1-0, IPU1-1 implies non-SMP mode. You
+ * cannot use both at the same time.
+ *
+ * [2] IPU2 implies SMP mode.
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x8E000000, len: 0x1000000,
+ comment: "SR#0 Memory (16 MB)"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "DSP1_PROG", {
+ name: "DSP1_PROG", space: "code/data", access: "RWX",
+ base: 0x8C000000, len: 0x1000000,
+ comment: "DSP1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP1_PROG",
+ dataMemory: "DSP1_PROG",
+ stackMemory: "DSP1_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] = {
+ externalMemoryMap: [
+ [ "DSP2_PROG", {
+ name: "DSP2_PROG", space: "code/data", access: "RWX",
+ base: 0x8D000000, len: 0x1000000,
+ comment: "DSP2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP2_PROG",
+ dataMemory: "DSP2_PROG",
+ stackMemory: "DSP2_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve1"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x1000, page: 0,
+ comment: "EVE1 Vector Table (4 KB)"
+ }],
+ [ "EVE1_PROG", {
+ name: "EVE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80001000, len: 0x3FF000, page: 1,
+ comment: "EVE1 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE1_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE1_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve2"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80400000, len: 0x1000, page: 0,
+ comment: "EVE2 Vector Table (4 KB)"
+ }],
+ [ "EVE2_PROG", {
+ name: "EVE2_PROG", space: "code/data", access: "RWX",
+ base: 0x80401000, len: 0x3FF000, page: 1,
+ comment: "EVE2 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE2_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE2_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve3"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x1000, page: 0,
+ comment: "EVE3 Vector Table (4 KB)"
+ }],
+ [ "EVE3_PROG", {
+ name: "EVE3_PROG", space: "code/data", access: "RWX",
+ base: 0x80801000, len: 0x3FF000, page: 1,
+ comment: "EVE3 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE3_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE3_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve4"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80C00000, len: 0x1000, page: 0,
+ comment: "EVE4 Vector Table (4 KB)"
+ }],
+ [ "EVE4_PROG", {
+ name: "EVE4_PROG", space: "code/data", access: "RWX",
+ base: 0x80C01000, len: 0x3FF000, page: 1,
+ comment: "EVE4 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE4_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE4_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE4_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "IPU1_PROG", {
+ name: "IPU1_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x1000000,
+ comment: "IPU1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_PROG",
+ dataMemory: "IPU1_PROG",
+ stackMemory: "IPU1_PROG"
+};
+
+var ipu1_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-0"] = {
+ externalMemoryMap: [
+ [ "IPU1_0_PROG", {
+ name: "IPU1_0_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x800000,
+ comment: "IPU1-0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_0_PROG",
+ dataMemory: "IPU1_0_PROG",
+ stackMemory: "IPU1_0_PROG"
+};
+
+var ipu1_0_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-1"] = {
+ externalMemoryMap: [
+ [ "IPU1_1_PROG", {
+ name: "IPU1_1_PROG", space: "code/data", access: "RWX",
+ base: 0x86800000, len: 0x800000,
+ comment: "IPU1-1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_1_PROG",
+ dataMemory: "IPU1_1_PROG",
+ stackMemory: "IPU1_1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "IPU2_PROG", {
+ name: "IPU2_PROG", space: "code/data", access: "RWX",
+ base: 0x8A000000, len: 0x1000000,
+ comment: "IPU2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU2_PROG",
+ dataMemory: "IPU2_PROG",
+ stackMemory: "IPU2_PROG"
+};
+
+var ipu2_ammu = {
+ prog: { /* program memory */
+ pa: 0x8A000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x8B000000, len: 0x1000000,
+ comment: "HOST Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+/* Memory Map
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_0000 8000_0000 1000 ( 4 KB) EVE1_VECS (vector table)
+ * 8000_1000 3F_F000 ( ~4 MB) EVE1_PROG (code, data)
+ * 8040_0000 40_0000 ( 4 MB) --------
+ * 8080_0000 40_0000 ( 4 MB) --------
+ * 80C0_0000 40_0000 ( 4 MB) --------
+ * 8100_0000 100_0000 ( 16 MB) --------
+ * 8200_0000 100_0000 ( 16 MB) --------
+ * 8300_0000 100_0000 ( 16 MB) --------
+ * 8400_0000 100_0000 ( 16 MB) --------
+ * 8500_0000 100_0000 ( 16 MB) --------
+ * 8600_0000 100_0000 ( 16 MB) IPU1 (code, data) [1]
+ * 8600_0000 80_0000 ( 8 MB) IPU1-0 (code, data) [1]
+ * 8680_0000 80_0000 ( 8 MB) IPI1-1 (code, data) [1]
+ * 8700_0000 100_0000 ( 16 MB) --------
+ * 8800_0000 100_0000 ( 16 MB) --------
+ * 8900_0000 100_0000 ( 16 MB) --------
+ * 8A00_0000 100_0000 ( 16 MB) --------
+ * 8B00_0000 100_0000 ( 16 MB) --------
+ * 8C00_0000 100_0000 ( 16 MB) DSP1 (code, data)
+ * 8D00_0000 100_0000 ( 16 MB) DSP2 (code, data)
+ * 8E00_0000 100_0000 ( 16 MB) SR_0 (ipc)
+ * 8F00_0000 100_0000 ( 16 MB) --------
+ *
+ * Notes
+ * ------------------------------------------------------------------------
+ * [1] IPU1 implies SMP mode; IPU1-0, IPU1-1 implies non-SMP mode. You
+ * cannot use both at the same time.
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x8E000000, len: 0x1000000,
+ comment: "SR#0 Memory (16 MB)"
+};
+
+Build.platformTable["ti.platforms.evmTDA3XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "DSP1_PROG", {
+ name: "DSP1_PROG", space: "code/data", access: "RWX",
+ base: 0x8C000000, len: 0x1000000,
+ comment: "DSP1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP1_PROG",
+ dataMemory: "DSP1_PROG",
+ stackMemory: "DSP1_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmTDA3XX:dsp2"] = {
+ externalMemoryMap: [
+ [ "DSP2_PROG", {
+ name: "DSP2_PROG", space: "code/data", access: "RWX",
+ base: 0x8D000000, len: 0x1000000,
+ comment: "DSP2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP2_PROG",
+ dataMemory: "DSP2_PROG",
+ stackMemory: "DSP2_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmTDA3XX:eve1"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x1000, page: 0,
+ comment: "EVE1 Vector Table (4 KB)"
+ }],
+ [ "EVE1_PROG", {
+ name: "EVE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80001000, len: 0x3FF000, page: 1,
+ comment: "EVE1 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE1_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE1_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTDA3XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "IPU1_PROG", {
+ name: "IPU1_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x1000000,
+ comment: "IPU1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_PROG",
+ dataMemory: "IPU1_PROG",
+ stackMemory: "IPU1_PROG"
+};
+
+var ipu1_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmTDA3XX:ipu1-0"] = {
+ externalMemoryMap: [
+ [ "IPU1_0_PROG", {
+ name: "IPU1_0_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x800000,
+ comment: "IPU1-0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_0_PROG",
+ dataMemory: "IPU1_0_PROG",
+ stackMemory: "IPU1_0_PROG"
+};
+
+var ipu1_0_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmTDA3XX:ipu1-1"] = {
+ externalMemoryMap: [
+ [ "IPU1_1_PROG", {
+ name: "IPU1_1_PROG", space: "code/data", access: "RWX",
+ base: 0x86800000, len: 0x800000,
+ comment: "IPU1-1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_1_PROG",
+ dataMemory: "IPU1_1_PROG",
+ stackMemory: "IPU1_1_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% }
+% else if (this.platform.match(/^TI814X_bios_elf$/)) {
+/* Memory Map for ti.platforms.evmTI814X
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 8000_0000 1000_0000 ( 256 MB) External Memory
+ *
+ * 0 8000_0000 800_0000 ( 128 MB) --------
+ * 8 8800_0000 100_0000 ( 16 MB) HOST (code, data), a8
+ * 9 8900_0000 100_0000 ( 16 MB) --------
+ * A 8A00_0000 100_0000 ( 16 MB) VIDEO (code, data), ducati
+ * B 8B00_0000 100_0000 ( 16 MB) --------
+ * C 8C00_0000 100_0000 ( 16 MB) DSP (code, data)
+ * D 8D00_0000 100_0000 ( 16 MB) --------
+ * E 8E00_0000 100_0000 ( 16 MB) SR_0 (ipc)
+ * F 8F00_0000 100_0000 ( 16 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RWX",
+ base: 0x8E000000, len: 0x1000000,
+ comment: "SR#0 Memory (16 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmTI814X:host"] = {
+ externalMemoryMap: [
+ [ SR_0.name, SR_0 ],
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x88000000, len: 0x1000000,
+ comment: "HOST Program Memory (16 MB)"
+ }]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTI814X:dsp"] = {
+ externalMemoryMap: [
+ [ SR_0.name, SR_0 ],
+ [ "DSP_PROG", {
+ name: "DSP_PROG", space: "code/data", access: "RWX",
+ base: 0x8C000000, len: 0x1000000,
+ comment: "DSP Program Memory (16 MB)"
+ }]
+ ],
+ codeMemory: "DSP_PROG",
+ dataMemory: "DSP_PROG",
+ stackMemory: "DSP_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "256k"
+};
+
+Build.platformTable["ti.platforms.evmTI814X:video"] = {
+ externalMemoryMap: [
+ [ SR_0.name, SR_0 ],
+ [ "VIDEO_PROG", {
+ name: "VIDEO_PROG", space: "code/data", access: "RWX",
+ base: 0x8A000000, len: 0x1000000,
+ comment: "VIDEO Program Memory (16 MB)"
+ }]
+ ],
+ codeMemory: "VIDEO_PROG",
+ dataMemory: "VIDEO_PROG",
+ stackMemory: "VIDEO_PROG"
+};
+
+var ammu = {
+ largePage1: {
+ pa: 0x8A000000,
+ size: "Large_32M"
+ },
+ largePage2: {
+ pa: 0x8E000000,
+ size: "Large_32M"
+ }
+};
+
+/*
+ * ======== ti.targets.elf.C674 ========
+ */
+var C674 = xdc.useModule('ti.targets.elf.C674');
+C674.ccOpts.suffix += " -mi10 -mo ";
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+/* Memory Map for ti.platforms.evmC6A8149
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 4002_0000 2000 ( 8 KB) DMEM - EVE local address
+ * 4002_2000 6000 ( 24 KB) SR0 - EVE local address
+ * 5902_2000 6000 ( 24 KB) SR0 - L3 address
+ *
+ * 8000_0000 1000_0000 ( 256 MB) External Memory
+ *
+ * 0 8000_0000 800_0000 ( 128 MB) --------
+ * 8 8800_0000 100_0000 ( 16 MB) HOST (code, data), a8
+ * 9 8900_0000 100_0000 ( 16 MB) --------
+ * A 8A00_0000 100_0000 ( 16 MB) VIDEO (code, data), ducati
+ * B 8B00_0000 100_0000 ( 16 MB) --------
+ * C 8C00_0000 100_0000 ( 16 MB) DSP (code, data)
+ * D 8D00_0000 100_0000 ( 16 MB) --------
+ * E 8E00_0000 100_0000 ( 16 MB) --------
+ * F 8F00_0000 100_0000 ( 16 MB) --------
+ * 0 9000_0000 100 ( 256 B) DDR3_EVEVECS
+ * 0 9000_0100 F_FF00 ( ~1 MB) EVE (code, data)
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RWX",
+ base: {
+ DSP: {base: 0x59022000},
+ EVE: {base: 0x40022000},
+ HOST: {base: 0x59022000},
+ VIDEO_M3: {base: 0x59022000}
+ },
+ len: 0x6000,
+ comment: "SR#0 Memory (24 KB)"
+ };
+
+Build.platformTable["ti.platforms.evmC6A8149:host"] = {
+ externalMemoryMap: [
+ [ SR_0.name, {
+ name: SR_0.name, space: SR_0.space, access: SR_0.access,
+ base: SR_0.base.HOST.base, len: SR_0.len,
+ comment: SR_0.comment
+ }],
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x88000000, len: 0x1000000,
+ comment: "HOST Program Memory (16 MB)"
+ }]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+Build.platformTable["ti.platforms.evmC6A8149:dsp"] = {
+ externalMemoryMap: [
+ [ SR_0.name, {
+ name: SR_0.name, space: SR_0.space, access: SR_0.access,
+ base: SR_0.base.DSP.base, len: SR_0.len,
+ comment: SR_0.comment
+ }],
+ [ "DSP_PROG", {
+ name: "DSP_PROG", space: "code/data", access: "RWX",
+ base: 0x8C000000, len: 0x1000000,
+ comment: "DSP Program Memory (16 MB)"
+ }]
+ ],
+ codeMemory: "DSP_PROG",
+ dataMemory: "DSP_PROG",
+ stackMemory: "DSP_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "256k"
+};
+
+Build.platformTable["ti.platforms.evmC6A8149:eve"] = {
+ customMemoryMap: [
+ [
+ "DMEM",
+ {
+ comment: "32KB data memory",
+ name: "DMEM",
+ base: 0x40020000,
+ len: 0x800,
+ space: "data",
+ page: 1,
+ access: "RW"
+ }
+ ],
+ [
+ "WBUF",
+ {
+ comment: "VCOP work buffer",
+ name: "WBUF",
+ base: 0x40040000,
+ len: 0x8000,
+ space: "data",
+ page: 1,
+ access: "RW"
+ }
+ ],
+ [
+ "IBUFLA",
+ {
+ comment: "Image buffer low copy A",
+ name: "IBUFLA",
+ base: 0x40050000,
+ len: 0x4000,
+ space: "data",
+ page: 1,
+ access: "RW"
+ }
+ ],
+ [
+ "IBUFHA",
+ {
+ comment: "Image buffer high copy A",
+ name: "IBUFHA",
+ base: 0x40054000,
+ len: 0x4000,
+ space: "data",
+ page: 1,
+ access: "RW"
+ }
+ ],
+ [
+ "IBUFLB",
+ {
+ comment: "Image buffer low copy B",
+ name: "IBUFLB",
+ base: 0x40070000,
+ len: 0x4000,
+ space: "data",
+ page: 1,
+ access: "RW"
+ }
+ ],
+ [
+ "IBUFHB",
+ {
+ comment: "Image buffer high copy B",
+ name: "IBUFHB",
+ base: 0x40074000,
+ len: 0x4000,
+ space: "data",
+ page: 1,
+ access: "RW"
+ }
+ ],
+ [
+ "OCMC",
+ {
+ comment: "128KB L3 OCMC Memory",
+ name: "OCMC",
+ base: 0x40300000,
+ len: 0x00020000,
+ space: "code/data",
+ page: 1,
+ access: "RWX"
+ }
+ ],
+
+ [ SR_0.name, {
+ name: SR_0.name, space: SR_0.space, access: SR_0.access,
+ base: SR_0.base.EVE.base, len: SR_0.len,
+ comment: SR_0.comment
+ }],
+ [ "DDR3_EVEVECS", {
+ name: "DDR3_EVEVECS", access: "RWX",
+ base: 0x90000000, len: 0x100, page: 0,
+ comment: "EVE VECTORS (256 B)"
+ }],
+ [ "DDR3_EVE", {
+ name: "DDR3_EVE", space: "code/data", access: "RWX",
+ base: 0x90000100, len: 0xFFF00, page: 1,
+ comment: "EVE Program Memory (16 MB)"
+ }]
+ ],
+ codeMemory: "DDR3_EVE",
+ dataMemory: "DDR3_EVE",
+ stackMemory: "DDR3_EVE"
+};
+
+Build.platformTable["ti.platforms.evmC6A8149:video"] = {
+ externalMemoryMap: [
+ [ SR_0.name, {
+ name: SR_0.name, space: SR_0.space, access: SR_0.access,
+ base: SR_0.base.VIDEO_M3.base, len: SR_0.len,
+ comment: SR_0.comment
+ }],
+ [ "VIDEO_PROG", {
+ name: "VIDEO_PROG", space: "code/data", access: "RWX",
+ base: 0x8A000000, len: 0x1000000,
+ comment: "VIDEO Program Memory (16 MB)"
+ }]
+ ],
+ codeMemory: "VIDEO_PROG",
+ dataMemory: "VIDEO_PROG",
+ stackMemory: "VIDEO_PROG"
+};
+
+var ammu = {
+ largePage1: {
+ pa: 0x8A000000,
+ size: "Large_32M"
+ },
+ largePage2: {
+ pa: 0x58000000, // contains SR0, aligned to 32MB
+ size: "Large_32M"
+ }
+};
+
+
+/*
+ * ======== ti.targets.elf.C674 ========
+ */
+var C674 = xdc.useModule('ti.targets.elf.C674');
+C674.ccOpts.suffix += " -mi10 -mo ";
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+/* Memory Map for ti.platforms.evm6472
+ *
+ * E000_0000 - EFFF_FFFF (256 MB) External Memory
+ * ----------------------------------------------------
+ * E000_0000 - E5FF_FFFF ( 96 MB) Core 0 .text
+ * E600_0000 - E7FF_FFFF ( 32 MB) Core 1 .text
+ * E800_0000 - E9FF_FFFF ( 32 MB) Core 2 .text
+ * EA00_0000 - EBFF_FFFF ( 32 MB) Core 3 .text
+ * EC00_0000 - EDFF_FFFF ( 32 MB) Core 4 .text
+ * EE00_0000 - EFFF_FFFF ( 32 MB) Core 5 .text
+ */
+var C6472_extMemoryMap_core0 = [
+ [ "DDR2", {
+ name: "DDR2",
+ base: 0xE0000000,
+ len: 0x06000000,
+ space: "code/data"
+ }
+ ]
+];
+
+Build.platformTable["ti.platforms.evm6472:CORE0"] = {
+ externalMemoryMap: C6472_extMemoryMap_core0,
+ codeMemory: "DDR2",
+ dataMemory: "DDR2",
+ stackMemory: "DDR2"
+};
+
+var ti_platforms_evm6472_serverMemoryMap_core1 = [
+ [ "DDR2", {
+ name: "DDR2",
+ base: 0xE6000000,
+ len: 0x2000000, /* 32 MB */
+ space: "code/data"
+ }
+ ]
+];
+Build.platformTable["ti.platforms.evm6472:CORE1"] = {
+ externalMemoryMap: ti_platforms_evm6472_serverMemoryMap_core1,
+ codeMemory: "DDR2",
+ dataMemory: "DDR2",
+ stackMemory: "DDR2"
+};
+
+var ti_platforms_evm6472_serverMemoryMap_core2 = [
+ [ "DDR2", {
+ name: "DDR2",
+ base: 0xE8000000,
+ len: 0x2000000, /* 32 MB */
+ space: "code/data"
+ }
+ ]
+];
+Build.platformTable["ti.platforms.evm6472:CORE2"] = {
+ externalMemoryMap: ti_platforms_evm6472_serverMemoryMap_core2,
+ codeMemory: "DDR2",
+ dataMemory: "DDR2",
+ stackMemory: "DDR2"
+};
+
+var ti_platforms_evm6472_serverMemoryMap_core3 = [
+ [ "DDR2", {
+ name: "DDR2",
+ base: 0xEA000000,
+ len: 0x2000000, /* 32 MB */
+ space: "code/data"
+ }
+ ]
+];
+Build.platformTable["ti.platforms.evm6472:CORE3"] = {
+ externalMemoryMap: ti_platforms_evm6472_serverMemoryMap_core3,
+ codeMemory: "DDR2",
+ dataMemory: "DDR2",
+ stackMemory: "DDR2"
+};
+
+var ti_platforms_evm6472_serverMemoryMap_core4 = [
+ [ "DDR2", {
+ name: "DDR2",
+ base: 0xEC000000,
+ len: 0x2000000, /* 32 MB */
+ space: "code/data"
+ }
+ ]
+];
+Build.platformTable["ti.platforms.evm6472:CORE4"] = {
+ externalMemoryMap: ti_platforms_evm6472_serverMemoryMap_core4,
+ codeMemory: "DDR2",
+ dataMemory: "DDR2",
+ stackMemory: "DDR2"
+};
+
+var ti_platforms_evm6472_serverMemoryMap_core5 = [
+ [ "DDR2", {
+ name: "DDR2",
+ base: 0xEE000000,
+ len: 0x2000000, /* 32 MB */
+ space: "code/data"
+ }
+ ]
+];
+Build.platformTable["ti.platforms.evm6472:CORE5"] = {
+ externalMemoryMap: ti_platforms_evm6472_serverMemoryMap_core5,
+ codeMemory: "DDR2",
+ dataMemory: "DDR2",
+ stackMemory: "DDR2"
+};
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+/* Memory Map for ti.platforms.evm6678
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 80_0000 ( 8 MB) CORE1_PROG (code, data)
+ * 8100_0000 80_0000 ( 8 MB) CORE2_PROG (code, data)
+ * 8180_0000 80_0000 ( 8 MB) CORE3_PROG (code, data)
+ * 8200_0000 80_0000 ( 8 MB) CORE4_PROG (code, data)
+ * 8280_0000 80_0000 ( 8 MB) CORE5_PROG (code, data)
+ * 8300_0000 80_0000 ( 8 MB) CORE6_PROG (code, data)
+ * 8380_0000 80_0000 ( 8 MB) CORE7_PROG (code, data)
+ * 8400_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 8420_0000 BE0_0000 (190 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84000000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evm6678:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evm6678:core1"] = {
+ externalMemoryMap: [
+ [ "CORE1_PROG", {
+ name: "CORE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x800000,
+ comment: "CORE1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE1_PROG",
+ dataMemory: "CORE1_PROG",
+ stackMemory: "CORE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evm6678:core2"] = {
+ externalMemoryMap: [
+ [ "CORE2_PROG", {
+ name: "CORE2_PROG", space: "code/data", access: "RWX",
+ base: 0x81000000, len: 0x800000,
+ comment: "CORE2 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE2_PROG",
+ dataMemory: "CORE2_PROG",
+ stackMemory: "CORE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evm6678:core3"] = {
+ externalMemoryMap: [
+ [ "CORE3_PROG", {
+ name: "CORE3_PROG", space: "code/data", access: "RWX",
+ base: 0x81800000, len: 0x800000,
+ comment: "CORE3 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE3_PROG",
+ dataMemory: "CORE3_PROG",
+ stackMemory: "CORE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evm6678:core4"] = {
+ externalMemoryMap: [
+ [ "CORE4_PROG", {
+ name: "CORE4_PROG", space: "code/data", access: "RWX",
+ base: 0x82000000, len: 0x800000,
+ comment: "CORE4 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE4_PROG",
+ dataMemory: "CORE4_PROG",
+ stackMemory: "CORE4_PROG"
+};
+
+Build.platformTable["ti.platforms.evm6678:core5"] = {
+ externalMemoryMap: [
+ [ "CORE5_PROG", {
+ name: "CORE5_PROG", space: "code/data", access: "RWX",
+ base: 0x82800000, len: 0x800000,
+ comment: "CORE5 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE5_PROG",
+ dataMemory: "CORE5_PROG",
+ stackMemory: "CORE5_PROG"
+};
+
+Build.platformTable["ti.platforms.evm6678:core6"] = {
+ externalMemoryMap: [
+ [ "CORE6_PROG", {
+ name: "CORE6_PROG", space: "code/data", access: "RWX",
+ base: 0x83000000, len: 0x800000,
+ comment: "CORE6 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE6_PROG",
+ dataMemory: "CORE6_PROG",
+ stackMemory: "CORE6_PROG"
+};
+
+Build.platformTable["ti.platforms.evm6678:core7"] = {
+ externalMemoryMap: [
+ [ "CORE7_PROG", {
+ name: "CORE7_PROG", space: "code/data", access: "RWX",
+ base: 0x83800000, len: 0x800000,
+ comment: "CORE7 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE7_PROG",
+ dataMemory: "CORE7_PROG",
+ stackMemory: "CORE7_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% } else if (this.platform.match(/^TCI6636_bios_elf$/)) {
+/* Memory Map for ti.platforms.evm6638
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 80_0000 ( 8 MB) CORE1_PROG (code, data)
+ * 8100_0000 80_0000 ( 8 MB) CORE2_PROG (code, data)
+ * 8180_0000 80_0000 ( 8 MB) CORE3_PROG (code, data)
+ * 8200_0000 80_0000 ( 8 MB) CORE4_PROG (code, data)
+ * 8280_0000 80_0000 ( 8 MB) CORE5_PROG (code, data)
+ * 8300_0000 80_0000 ( 8 MB) CORE6_PROG (code, data)
+ * 8380_0000 80_0000 ( 8 MB) CORE7_PROG (code, data)
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core1"] = {
+ externalMemoryMap: [
+ [ "CORE1_PROG", {
+ name: "CORE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x800000,
+ comment: "CORE1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE1_PROG",
+ dataMemory: "CORE1_PROG",
+ stackMemory: "CORE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core2"] = {
+ externalMemoryMap: [
+ [ "CORE2_PROG", {
+ name: "CORE2_PROG", space: "code/data", access: "RWX",
+ base: 0x81000000, len: 0x800000,
+ comment: "CORE2 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE2_PROG",
+ dataMemory: "CORE2_PROG",
+ stackMemory: "CORE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core3"] = {
+ externalMemoryMap: [
+ [ "CORE3_PROG", {
+ name: "CORE3_PROG", space: "code/data", access: "RWX",
+ base: 0x81800000, len: 0x800000,
+ comment: "CORE3 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE3_PROG",
+ dataMemory: "CORE3_PROG",
+ stackMemory: "CORE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core4"] = {
+ externalMemoryMap: [
+ [ "CORE4_PROG", {
+ name: "CORE4_PROG", space: "code/data", access: "RWX",
+ base: 0x82000000, len: 0x800000,
+ comment: "CORE4 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE4_PROG",
+ dataMemory: "CORE4_PROG",
+ stackMemory: "CORE4_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core5"] = {
+ externalMemoryMap: [
+ [ "CORE5_PROG", {
+ name: "CORE5_PROG", space: "code/data", access: "RWX",
+ base: 0x82800000, len: 0x800000,
+ comment: "CORE5 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE5_PROG",
+ dataMemory: "CORE5_PROG",
+ stackMemory: "CORE5_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core6"] = {
+ externalMemoryMap: [
+ [ "CORE6_PROG", {
+ name: "CORE6_PROG", space: "code/data", access: "RWX",
+ base: 0x83000000, len: 0x800000,
+ comment: "CORE6 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE6_PROG",
+ dataMemory: "CORE6_PROG",
+ stackMemory: "CORE6_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:core7"] = {
+ externalMemoryMap: [
+ [ "CORE7_PROG", {
+ name: "CORE7_PROG", space: "code/data", access: "RWX",
+ base: 0x83800000, len: 0x800000,
+ comment: "CORE7 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE7_PROG",
+ dataMemory: "CORE7_PROG",
+ stackMemory: "CORE7_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6636K2H:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% } else if (this.platform.match(/^66AK2E_bios_elf$/)) {
+/* Memory Map for ti.platforms.evmC66AK2E
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 380_0000 ( 56 MB) --------
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmC66AK2E:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmC66AK2E:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% } else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+/* Memory Map for ti.platforms.evm6630K2L
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 80_0000 ( 8 MB) CORE1_PROG (code, data)
+ * 8100_0000 80_0000 ( 8 MB) CORE2_PROG (code, data)
+ * 8180_0000 80_0000 ( 8 MB) CORE3_PROG (code, data)
+ * 8200_0000 200_0000 ( 32 MB) --------
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core1"] = {
+ externalMemoryMap: [
+ [ "CORE1_PROG", {
+ name: "CORE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x800000,
+ comment: "CORE1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE1_PROG",
+ dataMemory: "CORE1_PROG",
+ stackMemory: "CORE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core2"] = {
+ externalMemoryMap: [
+ [ "CORE2_PROG", {
+ name: "CORE2_PROG", space: "code/data", access: "RWX",
+ base: 0x81000000, len: 0x800000,
+ comment: "CORE2 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE2_PROG",
+ dataMemory: "CORE2_PROG",
+ stackMemory: "CORE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:core3"] = {
+ externalMemoryMap: [
+ [ "CORE3_PROG", {
+ name: "CORE3_PROG", space: "code/data", access: "RWX",
+ base: 0x81800000, len: 0x800000,
+ comment: "CORE3 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE3_PROG",
+ dataMemory: "CORE3_PROG",
+ stackMemory: "CORE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI6630K2L:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% } else if (this.platform.match(/^66AK2G_bios_elf$/)) {
+/* Memory Map for ti.platforms.evmTCI66AK2G02
+ *
+ * Address Size Comment
+ * -------------------------------------------------------------
+ * 8000_0000 80_0000 ( 8 MB) CORE0_PROG (code, data)
+ * 8080_0000 380_0000 ( 56 MB) --------
+ * 8400_0000 80_0000 ( 8 MB) HOST_PROG (code, data)
+ * 8480_0000 20_0000 ( 2 MB) SR_0 (ipc)
+ * 84a0_0000 BE0_0000 (182 MB) --------
+ * 9000_0000 1000_0000 (256 MB) --------
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x84800000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+ };
+
+Build.platformTable["ti.platforms.evmTCI66AK2G02:core0"] = {
+ externalMemoryMap: [
+ [ "CORE0_PROG", {
+ name: "CORE0_PROG", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x800000,
+ comment: "CORE0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "CORE0_PROG",
+ dataMemory: "CORE0_PROG",
+ stackMemory: "CORE0_PROG"
+};
+
+Build.platformTable["ti.platforms.evmTCI66AK2G02:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x84000000, len: 0x800000,
+ comment: "HOST Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
diff --git a/src/examples/templates/ex11_ping/shared/config_linux.bld b/src/examples/templates/ex11_ping/shared/config_linux.bld
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+
+Build.platformTable["ti.platforms.evmOMAPL138:dsp"] = {
+ externalMemoryMap: [
+ [ "DDR", {
+ name: "DDR", space: "code/data", access: "RWX",
+ base: 0xC3100000, len: 0x800000,
+ comment: "DSP Program Memory (8 MB)"
+ }]
+ ],
+ codeMemory: "DDR",
+ dataMemory: "DDR",
+ stackMemory: "DDR",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "32k"
+};
+
+
+/*
+ * ======== ti.targets.elf.C674 ========
+ */
+var C674 = xdc.useModule('ti.targets.elf.C674');
+C674.ccOpts.suffix += " -mi10 -mo ";
\ No newline at end of file
diff --git a/src/examples/templates/ex11_ping/shared/ipc.cfg.xs b/src/examples/templates/ex11_ping/shared/ipc.cfg.xs
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ *
+ */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+//var procNameAry = MultiProc.getDeviceProcNames();
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+//var procNameAry = ["DSP1","DSP2","EVE1","EVE2","EVE3","EVE4","IPU1","HOST"];
+% } else if (this.platform.match(/^VAYUsim_bios_elf$/)) {
+//var procNameAry = ["DSP1", "DSP2", "EVE1", "EVE2", "EVE3", "EVE4", "IPU1"];
+% } else if (this.platform.match(/^TI814X_bios_elf$/)) {
+//var procNameAry = [ "DSP", "VIDEO-M3", "HOST" ];
+% } else if (this.platform.match(/^C6A8149_bios_elf$/)) {
+//var procNameAry = [ "DSP", "EVE", "VIDEO-M3", "HOST" ];
+% } else if (this.platform.match(/^C6472_bios_elf$/)) {
+//var procNameAry = [ "CORE0", "CORE1", "CORE2", "CORE3", "CORE4", "CORE5" ];
+% } else if (this.platform.match(/^C6678_bios_elf$/)) {
+//var procNameAry = [ "CORE0", "CORE1", "CORE2", "CORE3", "CORE4", "CORE5",
+// "CORE6", "CORE7" ];
+% } else if (this.platform.match(/^TDA3XX_bios_elf$/)) {
+//var procNameAry = ["DSP1","DSP2","IPU1","EVE1"];
+% } else if (this.platform.match(/^TCI6636_bios_elf$/)) {
+//var procNameAry = [ "HOST","CORE0", "CORE1", "CORE2", "CORE3", "CORE4", "CORE5",
+// "CORE6", "CORE7" ];
+% } else if (this.platform.match(/^(66AK2E|66AK2G)_bios_elf$/)) {
+//var procNameAry = [ "HOST","CORE0" ];
+% } else if (this.platform.match(/^TCI6630_bios_elf$/)) {
+//var procNameAry = [ "HOST","CORE0", "CORE1", "CORE2", "CORE3" ];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+var procNameAry = cfgArgs.procList.toUpperCase().split(/\s+/);
+
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(Program.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_ALL; /* synchronize all processors in Ipc_start */
+Ipc.sr0MemorySetup = true;
+
+% if (this.platform.match(/^C6A8149_bios_elf$/)) {
+var Notify = xdc.module('ti.sdo.ipc.Notify');
+
+/*
+ * The following line uses a more optimized Notify driver
+ */
+Notify.SetupProxy = xdc.useModule('ti.sdo.ipc.family.c6a8149.NotifyCircSetup');
+
+% }
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+% if (this.platform.match(/^C6472_bios_elf$/)) {
+var SR0Mem = Program.cpu.memoryMap["SL2RAM"];
+% } else {
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+% }
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+% if (this.platform.match(/^(TCI6636|66AK2E|TCI6630|66AK2G)_bios_elf$/)) {
+ ownerProcId: 1,
+% } else {
+ ownerProcId: 0,
+% }
+% if (this.platform.match(/^C6472_bios_elf$/)) {
+ cacheLineSize: 64, /* SL2 memory has a cache line size of 64 */
+% }
+ isValid: true,
+% if (this.platform.match(/VAYU|DRA7XX|TDA3XX/)) {
+ cacheEnable: SR0_cacheEnable
+% } else {
+ cacheEnable: true
+% }
+ })
+);
+
+/* reduce data memory usage */
+var GateMP = xdc.useModule('ti.sdo.ipc.GateMP');
+GateMP.maxRuntimeEntries = 4;
+GateMP.RemoteCustom1Proxy = xdc.useModule('ti.sdo.ipc.gates.GateMPSupportNull');
+
+/* reduce data memory usage */
+var Notify = xdc.useModule('ti.sdo.ipc.Notify');
+Notify.numEvents = 8;
diff --git a/src/examples/templates/ex11_ping/shared/ipcOMAPL138.cfg.xs b/src/examples/templates/ex11_ping/shared/ipcOMAPL138.cfg.xs
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ *
+ */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+var procNameAry = cfgArgs.procList.toUpperCase().split(/\s+/);
+
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(Program.global.procName, procNameAry);
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_ALL; /* synchronize all processors in Ipc_start */
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
\ No newline at end of file
diff --git a/src/examples/templates/ex11_ping/slave/App.c b/src/examples/templates/ex11_ping/slave/App.c
--- /dev/null
@@ -0,0 +1,424 @@
+/*
+ * 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.
+ */
+%%{
+ this.platform = this.arguments[0];
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== App`core`.c ========
+ * Platform: `platform`
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC App`tCore`__Desc
+#define MODULE_NAME "App`tCore`"
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+#define HEAPID 0
+
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/ipc/MessageQ.h>
+% } else {
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/SharedRegion.h>
+% }
+
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "App`core`.h"
+#include "../shared/SvrMsg.h"
+
+/* module structure */
+typedef struct {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ IHeap_Handle heap; /* SR_0 heap handle */
+% }
+ MessageQ_Handle localMsgQue; /* created locally */
+ MessageQ_QueueId svrQue[10]; /* opened remotely */
+ SvrMsg_Msg * msg;
+} App`tCore`_Module;
+
+/* friend data */
+extern Semaphore_Handle Svr`tCore`_doneFlag;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+static Int Mod_curInit = 0;
+% }
+static App`tCore`_Module Module;
+
+
+/*
+ * ======== App`tCore`_destroy ========
+ */
+Int App`tCore`_destroy(Void)
+{
+ Int status = 0;
+ UInt16 numProcs;
+ UInt16 procId;
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> App`tCore`_destroy:\n");
+% } else {
+ Log_print0(Diags_ENTRY, "--> App`tCore`_destroy:");
+% }
+
+ /* TODO enter gate */
+
+ /* wait for server thread to finish */
+ while (Semaphore_getCount(Svr`tCore`_doneFlag) > 0) {
+ Task_sleep(1);
+ }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ /* reference count the module usage */
+ if (--Mod_curInit > 0) {
+ goto leave; /* object still in use */
+ }
+% }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ /* fill and send message */
+ Module.msg->cmd = SvrMsg_Cmd_STOP;
+ MessageQ_put(Module.svrQue[procId], (MessageQ_Msg)Module.msg);
+
+ }
+
+% } else {
+ /* free the static message buffer */
+ Memory_free(Module.heap, Module.msg, sizeof(SvrMsg_Msg));
+%}
+
+ /* close each remote processor's server queue */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ /* close remote message queue */
+ status = MessageQ_close(&Module.svrQue[procId]);
+
+ if (status < 0) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_destroy: procId=%d, server queue close "
+ "error=%d \n", procId, status);
+% } else {
+ Log_error2("App`tCore`_destroy: procId=%d, server queue close "
+ "error=%d", (IArg)procId, (IArg)status);
+% }
+ goto leave;
+ }
+ }
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.localMsgQue);
+
+ if (status < 0) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_destroy: queue delete error=%d \n", status);
+% } else {
+ Log_error1("App`tCore`_destroy: queue delete error=%d", (IArg)status);
+% }
+ goto leave;
+ }
+
+leave:
+ /* disable log events */
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- App`tCore`_destroy: status=%d \n", status);
+% } else {
+ Log_print1(Diags_EXIT, "<-- App`tCore`_destroy: status=%d", (IArg)status);
+% }
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+
+ /* TODO leave gate */
+ return(status);
+}
+
+/*
+ * ======== App`tCore`_run ========
+ */
+Int App`tCore`_run(Void)
+{
+ Int status = 0;
+ Int count;
+ UInt16 numProcs;
+ UInt16 procId;
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> App`tCore`_run: \n");
+% } else {
+ Log_print0(Diags_ENTRY, "--> App`tCore`_run:");
+% }
+
+ /* ping each remote server */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+ for (count = 1; count <= SvrMsg_NUM_MSGS; count++) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_run: ping procId=%d \n", procId);
+% } else {
+ Log_print1(Diags_INFO, "App`tCore`_run: ping procId=%d",
+ (IArg)procId);
+% }
+
+ /* fill and send message */
+ Module.msg->cmd = SvrMsg_Cmd_START;
+ Module.msg->svrProcId = MultiProc_INVALIDID;
+ MessageQ_put(Module.svrQue[procId], (MessageQ_Msg)Module.msg);
+
+ /* wait for return message */
+ status = MessageQ_get(Module.localMsgQue,
+ (MessageQ_Msg *)&Module.msg, MessageQ_FOREVER);
+
+ if (status < 0) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_run: message receive error=%d \n",
+ status);
+% } else {
+ Log_error1("App`tCore`_run: message receive error=%d",
+ (IArg)status);
+% }
+ goto leave;
+ }
+ else if (Module.msg->svrProcId != procId) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_run: message receive error=%d \n",
+ status);
+% } else {
+ Log_error2("App`tCore`_run: message delivery error, remote "
+ "procId=%d, server procId=%d",
+ (IArg)procId, (IArg)Module.msg->svrProcId);
+% }
+ goto leave;
+ }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_run: ack received, procId=%d",
+ procId);
+% } else {
+ Log_print1(Diags_INFO, "App`tCore`_run: ack received, procId=%d",
+ (IArg)procId);
+% }
+ }
+ }
+
+leave:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- App`tCore`_run: %d \n", status);
+% } else {
+ Log_print1(Diags_EXIT, "<-- App`tCore`_run: %d", (IArg)status);
+% }
+ return(status);
+}
+
+/*
+ * ======== App`tCore`_setup ========
+ */
+Int App`tCore`_setup(Void)
+{
+ Int status = 0;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ UInt16 numProcs;
+ UInt16 procId;
+ Char cbuf[48];
+
+ /* TODO enter gate */
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ /* reference count the module usage */
+ if (Mod_curInit >= 1) {
+ goto leave; /* already initialized */
+ }
+% }
+
+ /* initialize module state */
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ Module.heap = NULL;
+% }
+ Module.localMsgQue = NULL;
+ Module.msg = NULL;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+FEX");
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> App`tCore`_setup:\n");
+% } else {
+ Log_print0(Diags_ENTRY, "--> App`tCore`_setup:");
+% }
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.localMsgQue = MessageQ_create(`tCore`_AppMsgQue, &msgqParams);
+
+ if (Module.localMsgQue == NULL) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_setup: message queue create failed");
+% } else {
+ Log_error0("App`tCore`_setup: message queue create failed");
+% }
+ status = -1;
+ goto leave;
+ }
+
+ /* open each remote processor's server queue */
+ numProcs = MultiProc_getNumProcessors();
+ for (procId = 0; procId < numProcs; procId++) {
+
+ /* compute the remote processor server queue name */
+ System_sprintf(cbuf, SvrMsg_SvrQueNameFmt, MultiProc_getName(procId));
+
+ /* open the remote message queue, loop until queue is available */
+ do {
+ status = MessageQ_open(cbuf, &Module.svrQue[procId]);
+ if (status == MessageQ_E_NOTFOUND) {
+ Task_sleep(1);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_setup: could not open slave message queue \n");
+% } else {
+ Log_error0("App`tCore`_setup: could not open slave message queue");
+% }
+ goto leave;
+ }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("App`tCore`_setup: procId=%d, opened server queue \n",
+ procId);
+% } else {
+ Log_print1(Diags_INFO,"App`tCore`_setup: procId=%d, opened server queue",
+ (IArg)procId);
+% }
+ }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ /* allocate a static message */
+ Module.msg = (SvrMsg_Msg *)MessageQ_alloc(HEAPID,sizeof(SvrMsg_Msg));
+
+ if (Module.msg == NULL) {
+ System_printf("AppDsp_setup: could not allocate message\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* initialize message header */
+ MessageQ_setReplyQueue(Module.localMsgQue, (MessageQ_Msg)Module.msg);
+
+ System_printf("AppDsp_setup: slave is ready \n");
+% } else {
+ /* get the SR_0 heap handle */
+ Module.heap = (IHeap_Handle)SharedRegion_getHeap(0);
+
+ /* allocate a static message from SR_0 heap */
+ Module.msg = (SvrMsg_Msg *)Memory_alloc(Module.heap, sizeof(SvrMsg_Msg),
+ 0, NULL);
+
+ if (Module.msg == NULL) {
+ Log_error0("App`tCore`_setup: could not allocate message");
+ status = -1;
+ goto leave;
+ }
+
+ /* initialize message header */
+ MessageQ_staticMsgInit((MessageQ_Msg)Module.msg, sizeof(SvrMsg_Msg));
+ MessageQ_setReplyQueue(Module.localMsgQue, (MessageQ_Msg)Module.msg);
+
+ Log_print0(Diags_INFO,"App`tCore`_setup: slave is ready");
+% }
+
+leave:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ /* success, increment reference count */
+ if (status >= 0) {
+ Mod_curInit++;
+ }
+
+ /* error handling */
+ else {
+ /* unregister diags mask */
+ /* release resources */
+ }
+
+% }
+ /* TODO leave gate */
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- App`tCore`_setup:\n");
+% } else {
+ Log_print0(Diags_EXIT, "<-- App`tCore`_setup:");
+% }
+ return(status);
+}
diff --git a/src/examples/templates/ex11_ping/slave/App.h b/src/examples/templates/ex11_ping/slave/App.h
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== App`tCore`.h ========
+ * Platform: `platform`
+ */
+
+#ifndef App`tCore`__include
+#define App`tCore`__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Int App`tCore`_destroy(Void);
+Int App`tCore`_run(Void);
+Int App`tCore`_setup(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex11_ping/slave/Main.c b/src/examples/templates/ex11_ping/slave/Main.c
--- /dev/null
@@ -0,0 +1,243 @@
+/*
+ * 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.
+ */
+%%{
+ this.platform = this.arguments[0];
+ var platform = this.arguments[0];
+ var core = this.arguments[1]; /* E.g. "Eve1" */
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== Main`core`.c ========
+ * Platform: `platform`
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "App`core`.h"
+#include "Svr`core`.h"
+
+#define PRI_HIGH 5
+#define PRI_MED 3
+
+/* private functions */
+static Void Main`tCore`_appTskFxn(UArg arg0, UArg arg1);
+static Void Main`tCore`_svrTskFxn(UArg arg0, UArg arg1);
+static Void Main`tCore`_done(Void);
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ Int status;
+% }
+ Error_Block eb;
+ Task_Params taskParams;
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> main:\n");
+% } else {
+ Log_print0(Diags_ENTRY, "--> main:");
+% }
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("main: ipc ready\n");
+% } else {
+ /* initialize the ipc layer */
+ status = Ipc_start();
+
+ if (status < 0) {
+ System_abort("Ipc_start failed\n");
+ }
+
+ Log_print0(Diags_INFO, "main: ipc ready");
+% }
+
+ /* create server thread */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Svr";
+ taskParams.priority = PRI_HIGH;
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x600;
+ Task_create(Main`tCore`_svrTskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create server thread");
+ }
+
+ /* create application thread */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "App";
+ taskParams.priority = PRI_MED;
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x600;
+ Task_create(Main`tCore`_appTskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- main:");
+% } else {
+ Log_print0(Diags_EXIT, "<-- main:");
+% }
+ return (0);
+}
+
+/*
+ * ======== Main`tCore`_appTskFxn ========
+ */
+Void Main`tCore`_appTskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> Main`tCore`_appTskFxn:\n");
+% } else {
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Main`tCore`_appTskFxn:");
+% }
+
+ /* application setup phase */
+ status = App`tCore`_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = App`tCore`_run();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application shutdown phase */
+ status = App`tCore`_destroy();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- Main`tCore`_appTskFxn: %d\n",
+ (IArg)status);
+% } else {
+ Log_print1(Diags_EXIT | Diags_INFO, "<-- Main`tCore`_appTskFxn: %d",
+ (IArg)status);
+% }
+
+ /* ccs debug hook */
+ Main`tCore`_done();
+}
+
+/*
+ * ======== Main`tCore`_svrTskFxn ========
+ */
+Void Main`tCore`_svrTskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> Main`tCore`_svrTskFxn:\n");
+% } else {
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Main`tCore`_svrTskFxn:");
+% }
+
+ /* server setup phase */
+ status = Svr`tCore`_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Svr`tCore`_run();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Svr`tCore`_destroy();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- Main`tCore`_svrTskFxn: %d\n",
+ status);
+% } else {
+ Log_print1(Diags_EXIT | Diags_INFO, "<-- Main`tCore`_svrTskFxn: %d",
+ (IArg)status);
+% }
+}
+
+/*
+ * ======== Main`tCore`_done ========
+ */
+Void Main`tCore`_done(Void)
+{
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("Main`tCore`_done:\n");
+% } else {
+ Log_print0(Diags_INFO, "Main`tCore`_done:");
+% }
+}
diff --git a/src/examples/templates/ex11_ping/slave/OMAPL138.cfg b/src/examples/templates/ex11_ping/slave/OMAPL138.cfg
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Dsp.cfg ========
+ * Platform: OMAPL138_linux_elf
+ * Target: ti.targets.elf.C674
+ */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.heapSize = 0x20000;
+BIOS.libType = BIOS.LibType_Custom;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.deleteTerminatedTasks = true;
+
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+System.SupportProxy = SysMin;
+
+var Diags = xdc.useModule('xdc.runtime.Diags');
+
+xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+
+print ("Program.cpu.deviceName = " + Program.cpu.deviceName);
+print ("Program.platformName = " + Program.platformName);
+
+ xdc.useModule('ti.ipc.family.omapl138.VirtQueue');
+ xdc.useModule('ti.sdo.ipc.family.da830.InterruptDsp');
+
+ var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+ MultiProc.setConfig("DSP", ["HOST", "DSP"]);
+
+ /* Enable Memory Translation module that operates on the Resource Table */
+ var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+ Resource.loadSegment = Program.platform.dataMemory;
+
+ Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+ Program.sectMap[".text:_c_int00"].loadSegment = "DDR";
+ Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+ var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+ Hwi.enableException = true;
+
+ var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
+ /* Set 0xc4000000 -> 0xc4ffffff to be non-cached for shared memory IPC */
+ Cache.MAR192_223 = 0x00000010;
+
+ var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
+ var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+ Timer.timerSettings[1].master = true;
+ Timer.defaultHalf = Timer.Half_LOWER;
+ Clock.timerId = 1;
+
+ SysMin.bufSize = 0x8000;
+
+Hwi.enableException = true;
+
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+var Assert = xdc.useModule('xdc.runtime.Assert');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+var Text = xdc.useModule('xdc.runtime.Text');
+Text.isLoaded = true;
+
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+var RpmsgSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+RpmsgSetup.common$.diags_INFO = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+xdc.loadPackage('ti.ipc.transports').profile = 'release';
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+
+MessageQ.SetupTransportProxy = RpmsgSetup;
+
+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/src/examples/templates/ex11_ping/slave/Slave.cfg b/src/examples/templates/ex11_ping/slave/Slave.cfg
--- /dev/null
@@ -0,0 +1,437 @@
+/*
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+% if ((platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && target.match(/\.M4$/)) ||
+% (platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+/* build arguments for this executable */
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.IHeap');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Memory');
+xdc.useModule('xdc.runtime.Registry');
+xdc.useModule('xdc.runtime.System');
+
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1-[01]/)) {
+
+BIOS.smpEnabled = false;
+% } else {
+
+BIOS.smpEnabled = true;
+% }
+% } else if ((platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+
+BIOS.smpEnabled = true;
+% }
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.sdo.ipc.Ipc');
+xdc.useModule('ti.sdo.ipc.MessageQ');
+xdc.useModule('ti.sdo.ipc.SharedRegion');
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+% if (platform.match(/VAYU|DRA7XX|TDA3XX/)) {
+% if (target.match(/\.A15F$/)) {
+xdc.global.SR0_cacheEnable = true;
+% } else {
+xdc.global.SR0_cacheEnable = false;
+% }
+% }
+% if ((platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/))) {
+Program.global.procName = "VIDEO-M3";
+% } else {
+Program.global.procName = "`procName`";
+% }
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+% if (platform.match(/VAYU|DRA7XX|TDA3XX/) && target.match(/\.C66$/)) {
+
+/* make SR_0 non-cacheable */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(ipc_cfg.SR0Mem.base, ipc_cfg.SR0Mem.len, Cache.Mar_DISABLE);
+% }
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && lcCore.match(/ipu[12]/)) {
+
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+% }
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1(?!-1)|ipu2/)) {
+/*
+ * ======== IPU/CORE0 Processor (primary core) ========
+ */
+% if (lcCore == "ipu1-0") {
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 0;
+% }
+
+/* enable the unicache */
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* configure ammu (because unicache is enabled) */
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+
+/* increase small page 0 to 16 KB */
+var entry = AMMU.smallPages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x00000000;
+entry.translatedAddress = 0x55020000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/* increase small page 1 to 16 KB to access timers (non-cacheable) */
+var entry = AMMU.smallPages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x40000000;
+entry.translatedAddress = 0x55080000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* map program code/data memory into ammu (cacheable) */
+var entry = AMMU.largePages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.prog.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.cache];
+
+/* map SR_0 ammu (non-cacheable) */
+var entry = AMMU.largePages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.cache];
+
+/* map L3/L4 peripherals (mailbox, spinlock) into ammu (non-cacheable) */
+var entry = AMMU.largePages[3];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x60000000;
+entry.translatedAddress = 0x40000000;
+entry.size = AMMU.Large_512M;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+% } else {
+/*
+ * ======== IPU/CORE1 Processor (slave core) ========
+ */
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 1;
+
+% }
+/* configure the interrupt cross-bar mmr base address */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+
+/* configure hardware spin lock base address to match ammu mapping of L3/L4 */
+var GateHWSpinlock = xdc.useModule('ti.sdo.ipc.gates.GateHWSpinlock');
+GateHWSpinlock.baseAddr = 0x6A0F6800;
+
+% } else if ((platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))
+% || (platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/))) {
+
+/*
+ * ======== VIDEO-M3 Processor ========
+ */
+
+/* enable the unicache */
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* configure ammu (because unicache is enabled) */
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+
+/* increase small page 1 to 16 KB (to access timers) */
+var entry = AMMU.smallPages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x40000000;
+entry.translatedAddress = 0x55080000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/* map L3 peripherals into ammu (non-cacheable) */
+var entry = AMMU.largePages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = 0x48000000;
+entry.size = AMMU.Large_32M;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/* map program code/data memory into ammu (cacheable) */
+var entry = AMMU.largePages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.ammu.largePage1.pa;
+entry.size = AMMU[configBld.ammu.largePage1.size];
+entry.L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+
+/* map SR_0 data memory into ammu (non-cacheable) */
+var entry = AMMU.largePages[2];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.ammu.largePage2.pa;
+entry.size = AMMU[configBld.ammu.largePage2.size];
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+% }
+/*
+ * ======== Operating System Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+% if (lcCore.match(/eve/)) {
+//Program.stack = 0x800; /* small stack needed to fit in DMEM */
+Program.stack = 0x8000;
+% } else {
+Program.stack = 0x1000;
+% }
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+% if (lcCore.match(/eve/)) {
+//heapMemParams.size = 0x1400; /* small heap needed to fit in DMEM */
+heapMemParams.size = 0x8000;
+% } else {
+heapMemParams.size = 0x8000;
+% }
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1-[01]/)) {
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+% } else {
+/* configure SMP-enabled System module */
+var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
+% }
+% } else if ((platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+/* configure SMP-enabled System module */
+var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
+% } else {
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+% }
+% if (lcCore.match(/eve/)) {
+SysMin.bufSize = 0x200; /* small buffer needed to fit in DMEM */
+% } else {
+SysMin.bufSize = 0x1000;
+% }
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && lcCore.match(/eve/)) {
+
+/* place text character table in external memory, too big for DMEM */
+var Text_charTab = new prog.SectionSpec();
+Text_charTab.loadSegment = "`procName`_PROG";
+Program.sectMap[".const:xdc_runtime_Text_charTab__A"] = Text_charTab;
+
+/* reduce size of idle stack, too big for DMEM */
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.idleTaskStackSize = 0x200;
+% }
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+
+/* Turn off the timer frequency check. The DSP timer does not run when
+ * the host is halted because of the emulation suspend signal.
+ */
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+Timer.checkFrequency = false;
+% }
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+% if (lcCore == "dsp1") {
+
+/* allocate timers 5 and 6 to DSP1 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x0030;
+% } else {
+
+/* allocate timers 7 and 8 to DSP2 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x00C0;
+% }
+% }
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+% if (platform.match(/^(VAYUsim|DRA7XX|TDA3XX)_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1-[01]/)) {
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+% } else {
+/* create a SMP-enabled logger instance */
+var LoggerBuf = xdc.useModule('ti.sysbios.smp.LoggerBuf');
+% }
+% } else if ((platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+/* create a SMP-enabled logger instance */
+var LoggerBuf = xdc.useModule('ti.sysbios.smp.LoggerBuf');
+% } else {
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+% }
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog_Core1";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex11_ping/slave/Svr.c b/src/examples/templates/ex11_ping/slave/Svr.c
--- /dev/null
@@ -0,0 +1,364 @@
+/*
+ * 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.
+ */
+%%{
+ this.platform = this.arguments[0];
+ var platform = this.arguments[0];
+ var core = this.arguments[1]; /* e.g. "Eve1" */
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== Svr`tCore`.c ========
+ * Platform: `platform`
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Svr`tCore`__Desc
+#define MODULE_NAME "Svr`tCore`"
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Registry.h>
+
+% } else {
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+% }
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Svr`core`.h"
+#include "../shared/SvrMsg.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle localMsgQue;
+} Svr`tCore`_Module;
+
+/* friend data */
+Semaphore_Handle Svr`tCore`_doneFlag = NULL;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+static Int Mod_curInit = 0;
+% }
+static Svr`tCore`_Module Module;
+
+
+/*
+ * ======== Svr`tCore`_destroy ========
+ */
+Int Svr`tCore`_destroy(Void)
+{
+ Int status = 0;
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> Svr`tCore`_destroy:");
+% } else {
+ Log_print0(Diags_ENTRY, "--> Svr`tCore`_destroy:");
+% }
+
+ /* TODO enter gate */
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ /* reference count the module usage */
+ if (--Mod_curInit > 0) {
+ goto leave; /* object still in use */
+ }
+
+% }
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.localMsgQue);
+
+ if (status < 0) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("Svr`tCore`_destroy: message queue delete error=%d \n",
+ status);
+% } else {
+ Log_error1("Svr`tCore`_destroy: message queue delete error=%d",
+ (IArg)status);
+% }
+ goto leave;
+ }
+
+ /* delete the done flag */
+ Semaphore_delete(&Svr`tCore`_doneFlag);
+
+leave:
+ /* disable log events */
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- Svr`tCore`_delete: status=%d \n", status);
+% } else {
+ Log_print1(Diags_EXIT, "<-- Svr`tCore`_delete: status=%d", (IArg)status);
+% }
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+
+ /* TODO leave gate */
+ return(status);
+}
+
+/*
+ * ======== Svr`tCore`_run ========
+ */
+Int Svr`tCore`_run(Void)
+{
+ Int status = 0;
+ Bool running = TRUE;
+ SvrMsg_Msg * msg;
+ MessageQ_QueueId queId;
+ UInt16 procId;
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ UInt16 numProcs;
+ UInt16 count = 0;
+% } else {
+% }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> Svr`tCore`_run:\n");
+
+ numProcs = MultiProc_getNumProcessors();
+% } else {
+ Log_print0(Diags_ENTRY, "--> Svr`tCore`_run:");
+% }
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.localMsgQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ % if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("Svr`tCore`_run: message get error=%d \n", status);
+% } else {
+ Log_error1("Svr`tCore`_run: message get error=%d", (IArg)status);
+% }
+ goto leave;
+ }
+
+ /* process the message */
+ queId = MessageQ_getReplyQueue(msg);
+ procId = MessageQ_getProcId(queId);
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("Svr`tCore`_run: message received, procId=%d, "
+ "cmd=%d \n", procId, msg->cmd);
+% } else {
+ Log_print2(Diags_INFO, "Svr`tCore`_run: message received, procId=%d, "
+ "cmd=%d", procId, msg->cmd);
+% }
+
+ switch (msg->cmd) {
+ case SvrMsg_Cmd_START:
+ msg->svrProcId = MultiProc_self();
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ /* send message back */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+% }
+ break;
+
+ case SvrMsg_Cmd_PROCESS:
+ break;
+
+ case SvrMsg_Cmd_STOP:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ count++;
+ /*
+ * When stop commands have been recieved from all procs
+ * terminate server
+ */
+ if (count == numProcs) {
+ /* Free last message */
+ MessageQ_free((MessageQ_Msg)msg);
+ running = FALSE;
+ }
+ break;
+% } else {
+ running = FALSE;
+ break;
+% }
+
+ default:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("Svr`tCore`_run: unknown message, cmd=%d \n",
+ (msg->cmd));
+% } else {
+ Log_error1("Svr`tCore`_run: unknown message, cmd=%d",
+ (IArg)(msg->cmd));
+% }
+ break;
+ }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ /* send message back */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+% }
+
+ /* decrement the done flag */
+ if (Semaphore_getCount(Svr`tCore`_doneFlag) > 0) {
+ Semaphore_pend(Svr`tCore`_doneFlag, BIOS_WAIT_FOREVER);
+ }
+
+ } /* while (running) */
+
+leave:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- Svr`tCore`_run: %d \n", status);
+% } else {
+ Log_print1(Diags_EXIT, "<-- Svr`tCore`_run: %d", (IArg)status);
+% }
+ return(status);
+}
+
+/*
+ * ======== Svr`tCore`_setup ========
+ */
+Int Svr`tCore`_setup(Void)
+{
+ Int status = 0;
+ Error_Block eb;
+ Int count;
+ Semaphore_Params semParams;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ UInt16 procId;
+ Char cbuf[48];
+
+ /* TODO enter gate */
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ /* reference count the module usage */
+ if (Mod_curInit >= 1) {
+ goto leave; /* already initialized */
+ }
+
+% }
+ /* initialize module state */
+ Error_init(&eb);
+ Module.localMsgQue = NULL;
+
+ /* initialize the done flag */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_COUNTING;
+ count = MultiProc_getNumProcessors() * SvrMsg_NUM_MSGS;
+
+ Svr`tCore`_doneFlag = Semaphore_create(count, &semParams, &eb);
+
+ if (Error_check(&eb)) {
+ status = -2;
+ goto leave;
+ }
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+FEX");
+ % if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("--> Svr`tCore`_setup:\n");
+% } else {
+ Log_print0(Diags_ENTRY, "--> Svr`tCore`_setup:");
+% }
+
+ /* compute the server queue name */
+ procId = MultiProc_self();
+ System_sprintf(cbuf, SvrMsg_SvrQueNameFmt, MultiProc_getName(procId));
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.localMsgQue = MessageQ_create(cbuf, &msgqParams);
+
+ if (Module.localMsgQue == NULL) {
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("Svr`tCore`_setup: message queue create failed\n");
+% } else {
+ Log_error0("Svr`tCore`_setup: message queue create failed");
+% }
+ goto leave;
+ }
+
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("Svr`tCore`_setup: slave is ready\n");
+% } else {
+ Log_print0(Diags_INFO,"Svr`tCore`_setup: slave is ready");
+% }
+
+leave:
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+% } else {
+ /* success, increment reference count */
+ if (status >= 0) {
+ Mod_curInit++;
+ }
+
+ /* error handling */
+ else {
+ /* unregister diags mask */
+ /* release resources */
+ }
+% }
+
+ /* TODO leave gate */
+% if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ System_printf("<-- Svr`tCore`_setup:\n");
+% } else {
+ Log_print0(Diags_EXIT, "<-- Svr`tCore`_setup:");
+% }
+ return(status);
+}
diff --git a/src/examples/templates/ex11_ping/slave/Svr.h b/src/examples/templates/ex11_ping/slave/Svr.h
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== Svr`core`.h ========
+ * Platform: `platform`
+ */
+
+#ifndef Svr`tCore`__include
+#define Svr`tCore`__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Int Svr`tCore`_destroy(Void);
+Int Svr`tCore`_run(Void);
+Int Svr`tCore`_setup(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex11_ping/slave/eve.gel b/src/examples/templates/ex11_ping/slave/eve.gel
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2013-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== ex11_ping_`lcCore`.gel ========
+ */
+
+#define UInt32 unsigned int
+#define WR_MEM_32(addr, data) *(UInt32*)(addr) = (UInt32)(data)
+#define RD_MEM_32(addr) *(UInt32*)(addr)
+
+
+/*
+ * TRM 19.5.2 MMU Registers
+ *
+ * 0000_0050 MMU_LOCK Table 19-42
+ * [14:10] BASEVALUE Locked entries base value
+ * [8:4] CURRENTVICTIM Current entry to be updated
+ *
+ * 0000_0058 MMU_CAM Table 19-46
+ * [31:12] VTAG Valid bit
+ * [3] P Preserved bit
+ * 0: TLB entry may be flushed
+ * 1: TLB entry is protected against flush
+ * [2] V Valid bit
+ * 0: TLB entry is invalid
+ * 1: TLB entry is valid
+ * [1:0] PAGESIZE Page size
+ * 0: Section (1 MB)
+ * 1: Large page (64 KB)
+ * 2: Small page (4 KB)
+ * 3: Supersection (16 MB)
+ *
+ * 0000_0058 MMU_RAM Table 19-48
+ * [31:12] PHYSICALADDR Physical address of the page
+ * [11:0] RESERVED
+ */
+
+% if (lcCore == "eve1") {
+#define EVE_MMU0 0x42081000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07B50 /* TRM 3.11.39.1 */
+% } else if (lcCore == "eve2") {
+#define EVE_MMU0 0x42181000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07B90 /* TRM 3.11.40.1 */
+% } else if (lcCore == "eve3") {
+#define EVE_MMU0 0x42281000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07BD0 /* TRM 3.11.41.1 */
+% } else if (lcCore == "eve4") {
+#define EVE_MMU0 0x42381000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07C10 /* TRM 3.11.42.1 */
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+% if (platform.match(/TDA3XX_bios_elf$/)) {
+
+/*******************************************************************************
+ EVESS1 Address Map defines: IPU view
+*******************************************************************************/
+#define L4_WKUP_TARG 0x4AE00000
+#define PRM (L4_WKUP_TARG + 0x6000) //4ae06000
+
+//#define EVE_TARG 0x62000000
+#define EVE_TARG 0x42000000
+#define EVE_PRM (PRM + 0x1B40)
+
+
+#define CM_EVE_CLKSTCTRL (EVE_CM_CORE_AON + 0x0)
+#define CM_EVE_EVE_CLKCTRL (EVE_CM_CORE_AON + 0x20)
+#define RM_EVE_RSTCTRL (EVE_PRM + 0x10)
+#define RM_EVE_RSTST (EVE_PRM + 0x14)
+#define EVE_MMU0_BASE (EVE_TARG + 0x81000)
+#define EVE_MMU1_BASE (EVE_TARG + 0x82000)
+
+#define EVE_MMU_PAGESIZE_1M 0
+#define EVE_MMU_PAGESIZE_64K 1
+#define EVE_MMU_PAGESIZE_4K 2
+#define EVE_MMU_PAGESIZE_16M 3
+#define EVE_MMU_BASE ((mmu_num == 0) ? (EVE_MMU0_BASE) : (EVE_MMU1_BASE))
+#define EVE_MMU_SYSCONFIG ( EVE_MMU_BASE + 0x10 )
+#define EVE_MMU_SYSSTATUS ( EVE_MMU_BASE + 0x14 )
+#define EVE_MMU_CNTL ( EVE_MMU_BASE + 0x44 )
+#define EVE_MMU_FAULT_AD ( EVE_MMU_BASE + 0x48 )
+#define EVE_MMU_CAM ( EVE_MMU_BASE + 0x58 )
+#define EVE_MMU_RAM ( EVE_MMU_BASE + 0x5c )
+#define EVE_MMU_LOCK ( EVE_MMU_BASE + 0x50 )
+#define EVE_MMU_LD_TLB ( EVE_MMU_BASE + 0x54 )
+#define EVE_MMU_EMU_FAULT_AD ( EVE_MMU_BASE + 0x70 )
+
+% }
+
+menuitem "EVE MMU Configuration"
+
+hotmenu ex11_ping_`lcCore`_mmu_config()
+{
+ unsigned int val;
+ unsigned int PHY_ADDR;
+% if (platform.match(/TDA3XX_bios_elf$/)) {
+ UInt32 mmu_num = 0;
+% }
+
+% if (lcCore == "eve1") {
+ PHY_ADDR = 0x80000000;
+% } else if (lcCore == "eve2") {
+ PHY_ADDR = 0x80400000;
+% } else if (lcCore == "eve3") {
+ PHY_ADDR = 0x80800000;
+% } else if (lcCore == "eve4") {
+ PHY_ADDR = 0x80C00000;
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+
+ GEL_TextOut("`procName`_mmu_config start...\n");
+
+% if (platform.match(/TDA3XX_bios_elf$/)) {
+ /* reset the MMU */
+ GEL_TextOut("DEBUG: Resetting EVE MMU ... \n",,,,,,);
+ WR_MEM_32(EVE_MMU_SYSCONFIG, 2);
+
+ /* wait until mmu reset completes */
+ while((RD_MEM_32(EVE_MMU_SYSSTATUS) & 1) == 0);
+
+ /* Configure the MMU */
+
+ /* CAM[1:0] - Page Size: 0=1MB, 1=64kB, 2=4kB, 3=16MB */
+ /* CAM[2] - Valid bit */
+ /* CAM[3] - Preserved (protected against flushs) */
+ /* CAM[31:12] - Virtual address tag */
+
+ /* CAM = 0xC --> 1 MB */
+ /* CAM = 0xF --> 16 MB */
+
+ /* RAM[6] - Mixed page attribute: 0 use TLB element size, 1 use CPU element size */
+ /* RAM[8:7] - Element size 0=8 bits, 1=16 bits, 2=32 bits, 3=no translation */
+ /* RAM[9] - Endianness of the page (0=little, 1=big) */
+ /* RAM[31:12] - Physical address of the page */
+
+ /* RAM = 0x1C0 --> CPU element size, no translation */
+
+% }
+ /* map program vector table */
+ WR_MEM_32(EVE_MMU0+0x58, 0x0000000E); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, PHY_ADDR); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2800); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x0000_0000 --> 0x8000_0000 (4 KB)\n");
+
+ /* map program load address */
+ WR_MEM_32(EVE_MMU0+0x58, 0x8000000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x80000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2810); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x8000_0000 --> 0x8000_0000 (16 MB)\n");
+
+ /* map SR_0 */
+ WR_MEM_32(EVE_MMU0+0x58, 0x8E00000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x8E000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2820); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x8E00_0000 --> 0x8E00_0000 (16 MB)\n");
+
+ /* map L3/L4 */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4800000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x48000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2830); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4800_0000 --> 0x4800_0000 (16 MB)\n");
+
+ /* map Control Module */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4A00000C); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x4A000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2840); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4A00_0000 --> 0x4A00_0000 (1 MB)\n");
+
+ /* map EVE Mailbox */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4200000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x42000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2850); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4200_0000 --> 0x4200_0000 (16 MB)\n");
+
+ /* disable walking logic */
+ val = RD_MEM_32(EVE_MMU0+0x44); /* MMU_CNTL */
+ val &= 4;
+ WR_MEM_32(EVE_MMU0+0x44, val);
+
+ /* enable mmu */
+ val = RD_MEM_32(EVE_MMU0+0x44); /* MMU_CNTL */
+ val |= 2;
+ WR_MEM_32(EVE_MMU0+0x44, val);
+
+ GEL_TextOut("`procName`_mmu_config done\n");
+
+ /* setup reset vectors */
+ *(unsigned int *)(PHY_ADDR + 0x0) = PHY_ADDR + 0x30;
+ *(unsigned int *)(PHY_ADDR + 0x4) = PHY_ADDR + 0x30;
+ *(unsigned int *)(PHY_ADDR + 0x8) = PHY_ADDR + 0x30;
+
+ /* write idle instruction */
+ *(unsigned int *)(PHY_ADDR + 0x30) = 0x0000037F;
+ *(unsigned int *)(PHY_ADDR + 0x34) = 0x0000037F;
+
+ /* release cpu from reset */
+ *(unsigned int *)RM_EVE_RSTCTRL &= ~(0x1);
+
+ GEL_TextOut("`procName` cpu released from reset\n");
+}
diff --git a/src/examples/templates/ex11_ping/slave/ipu.gel b/src/examples/templates/ex11_ping/slave/ipu.gel
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== ex11_ping_`lcCore`.gel ========
+ */
+
+#define UInt32 unsigned int
+#define WR_MEM_32(addr, data) *(UInt32*)(addr) = (UInt32)(data)
+#define RD_MEM_32(addr) *(UInt32*)(addr)
+
+/* AMMU Configuration Registers
+ *
+ * 0x000 Large_0 Page Address
+ * 0x020 Large_0 Page Translated Address
+ * 0x040 Large_0 Page Policy
+ * 0x004 Large_1 Page Address
+ * 0x024 Large_1 Page Translated Address
+ * 0x044 Large_1 Page Policy
+ * 0x008 Large_2 Page Address
+ * 0x028 Large_2 Page Translated Address
+ * 0x048 Large_2 Page Policy
+ * 0x00C Large_3 Page Address
+ * 0x02C Large_3 Page Translated Address
+ * 0x04C Large_3 Page Policy
+
+ * 0x060 Medium_0 Page Address
+ * 0x0A0 Medium_0 Page Translated Address
+ * 0x0E0 Medium_0 Page Policy
+ * 0x064 Medium_1 Page Address
+ * 0x0A4 Medium_1 Page Translated Address
+ * 0x0E4 Medium_1 Page Policy
+
+ * 0x120 - 0x19F Small Page Address
+ * 0x1A0 - 0x21F Small Page Translated Address
+ * 0x220 - 0x29F Small Page Policy
+ * 0x2A0 - 0x31F Small Page Maintenance
+ *
+ * Policy Description
+ * [16] CACHE Cache enable
+ * 0: non-cacheable
+ * 1: cacheable
+ * [1:0] SIZE Page size
+ * 0: mmu entry is disabled
+ * 1: 4 KB - small page
+ * 1: 128 KB - medium page
+ * 1: 32 MB - large page
+ * 3: 16 KB - small page
+ * 3: 256 KB - medium page
+ * 3: 512 MB - large page
+ */
+
+/* TRM 7.4.1 Unicache MMU (AMMU), local address */
+#define IPU1_AMMU_CFG 0x55080800
+
+menuitem "ex11_ping"
+
+hotmenu ex11_ping_`lcCore.replace(/-/,"_")`_ammu_config()
+{
+ GEL_TextOut("`procName` AMMU config\n");
+
+ /* disable all entries */
+ WR_MEM_32(IPU1_AMMU_CFG+0x220, 0x00000000); // Small_0
+ WR_MEM_32(IPU1_AMMU_CFG+0x224, 0x00000000); // Small_1
+ WR_MEM_32(IPU1_AMMU_CFG+0x228, 0x00000000); // Small_2
+ WR_MEM_32(IPU1_AMMU_CFG+0x22C, 0x00000000); // Small_3
+ WR_MEM_32(IPU1_AMMU_CFG+0x230, 0x00000000); // Small_4
+ WR_MEM_32(IPU1_AMMU_CFG+0x234, 0x00000000); // Small_5
+ WR_MEM_32(IPU1_AMMU_CFG+0x238, 0x00000000); // Small_6
+ WR_MEM_32(IPU1_AMMU_CFG+0x23C, 0x00000000); // Small_7
+ WR_MEM_32(IPU1_AMMU_CFG+0x240, 0x00000000); // Small_8
+ WR_MEM_32(IPU1_AMMU_CFG+0x244, 0x00000000); // Small_9
+
+ WR_MEM_32(IPU1_AMMU_CFG+0x0E0, 0x00000000); // Medium_0
+ WR_MEM_32(IPU1_AMMU_CFG+0x0E4, 0x00000000); // Medium_1
+
+ WR_MEM_32(IPU1_AMMU_CFG+0x040, 0x00000000); // Large_0
+ WR_MEM_32(IPU1_AMMU_CFG+0x044, 0x00000000); // Large_1
+ WR_MEM_32(IPU1_AMMU_CFG+0x048, 0x00000000); // Large_2
+ WR_MEM_32(IPU1_AMMU_CFG+0x04C, 0x00000000); // Large_3
+
+ /* Large_0 */
+% if (lcCore.match(/ipu1/)) {
+ WR_MEM_32(IPU1_AMMU_CFG+0x000, 0x86000000); // physical address
+% } else if (lcCore == "ipu2") {
+ WR_MEM_32(IPU1_AMMU_CFG+0x000, 0x8A000000); // physical address
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+ WR_MEM_32(IPU1_AMMU_CFG+0x020, 0xFE000001); // no translate
+ WR_MEM_32(IPU1_AMMU_CFG+0x040, 0x00010001); // 32 MB, cacheable
+
+ /* Medium_0 */
+// WR_MEM_32(IPU1_AMMU_CFG+0x060, 0x8A100000); // virtual address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0A0, 0x40440000); // physical address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0E0, 0x00010001); // 128 KB, cacheable
+
+ /* Medium_1 */
+// WR_MEM_32(IPU1_AMMU_CFG+0x064, 0x8A140000); // virtual address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0A4, 0x40300000); // physical address
+// WR_MEM_32(IPU1_AMMU_CFG+0x0E4, 0x00000003); // 256 KB, non-cacheable
+
+ /* Small_0 (L2 RAM)*/
+ WR_MEM_32(IPU1_AMMU_CFG+0x120, 0x00000000); // virtual address
+ WR_MEM_32(IPU1_AMMU_CFG+0x1A0, 0x55020000); // physical address
+ WR_MEM_32(IPU1_AMMU_CFG+0x220, 0x00000003); // 16 KB, non-cacheable
+
+ /* Small_1 (local config) */
+ WR_MEM_32(IPU1_AMMU_CFG+0x124, 0x40000000); // virtual address
+ WR_MEM_32(IPU1_AMMU_CFG+0x1A4, 0x55080000); // physical address
+ WR_MEM_32(IPU1_AMMU_CFG+0x224, 0x00000003); // 16 KB, non-cacheable
+
+ GEL_TextOut("AMMU config done.\n");
+}
diff --git a/src/examples/templates/ex11_ping/slave/makefile b/src/examples/templates/ex11_ping/slave/makefile
--- /dev/null
@@ -0,0 +1,244 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+
+ if (platform.match(/^(VAYUsim|DRA7XX)_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^TI814X_bios_elf$/)) {
+ platInst = "ti.platforms.evmTI814X:" + lcCore;
+ } else if (platform.match(/^C6A8149_bios_elf$/)) {
+ platInst = "ti.platforms.evmC6A8149:" + lcCore;
+ } else if (platform.match(/^OMAPL138_linux_elf$/)) {
+ platInst = "ti.platforms.evmOMAPL138:" + lcCore;
+ } else if (platform.match(/^C6472_bios_elf$/)) {
+ platInst = "ti.platforms.evm6472:" + lcCore;
+ } else if (platform.match(/^C6678_bios_elf$/)) {
+ platInst = "ti.platforms.evm6678:" + lcCore;
+ } else if (platform.match(/^TDA3XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmTDA3XX:" + lcCore;
+ } else if (platform.match(/^TCI6636_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI6636K2H:" + lcCore;
+ } else if (platform.match(/^66AK2E_bios_elf$/)) {
+ platInst = "ti.platforms.evmC66AK2E:" + lcCore;
+ } else if (platform.match(/^TCI6630_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI6630K2L:" + lcCore;
+ } else if (platform.match(/^66AK2G_bios_elf$/)) {
+ platInst = "ti.platforms.evmTCI66AK2G02:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+ if (target.match(/\.C66$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64P$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C674$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.ARP32(_far|)$/)) {
+ cc = "bin/cl-arp32";
+ lnk = "bin/cl-arp32 -z";
+ }
+ else if (target.match(/\.M3$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else if (target.match(/\.M4$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Svr`core`.c App`core`.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+libs =
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_`lcCore`.x
+# $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+server_`lcCore`.x: bin/$(PROFILE)/server_`lcCore`.x`suffix`
+bin/$(PROFILE)/server_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+% if (platform.match(/^OMAPL138_linux_elf$/)) {
+`PCT`/linker.cmd: `core`.cfg ../dsp/config.bld
+% } else {
+`PCT`/linker.cmd: `core`.cfg ../shared/config.bld
+% }
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+% if (platform.match(/^OMAPL138_linux_elf$/)) {
+ -b ../dsp/config.bld -r release \
+% } else {
+ -b ../shared/config.bld -r release \
+% }
+% if (target.match(/\.M3$|\.M4$/)) {
+ --cfgArgs "{ \
+ procList: \"$(PROCLIST)\", \
+ profile: \"$(PROFILE)\", \
+ configBld: \"../shared/config.bld\" \
+ }" `core`.cfg
+% } else {
+ --cfgArgs "{ \
+ procList: \"$(PROCLIST)\", \
+ profile: \"$(PROFILE)\" \
+ }" `core`.cfg
+% }
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+% if (platform.match(/VAYU|DRA7XX/) && lcCore.match(/eve|ipu1(?!-1)|ipu2/)) {
+ $(CP) ex11_ping_`lcCore`.gel $(EXEC_DIR)/debug
+% } else if (platform.match(/TDA3XX/) && lcCore.match(/eve|ipu1(?!-1)/)) {
+ $(CP) ex11_ping_`lcCore`.gel $(EXEC_DIR)/debug
+% }
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_`lcCore`.x`suffix` $(EXEC_DIR)/release
+% if (platform.match(/VAYU|DRA7XX/) && lcCore.match(/eve|ipu1(?!-1)|ipu2/)) {
+ $(CP) ex11_ping_`lcCore`.gel $(EXEC_DIR)/release
+% } else if (platform.match(/TDA3XX/) && lcCore.match(/eve|ipu1(?!-1)/)) {
+ $(CP) ex11_ping_`lcCore`.gel $(EXEC_DIR)/release
+% }
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex12_mmrpc/host/App.c b/src/examples/templates/ex12_mmrpc/host/App.c
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2013-2015, 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.
+ */
+
+/*
+ * ======== App.c ========
+ *
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#if defined(OS_QNX)
+#include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
+#endif
+
+#include "App.h"
+#include <machvis/MachVis.h>
+
+
+/*
+ * ======== App_main ========
+ */
+int App_main(void)
+{
+ int status;
+ bool initMachVis;
+ int i;
+ int32_t ret;
+ uint32_t val;
+ MachVis_Compute *compute;
+#if defined(OS_QNX)
+ shm_buf shmCompute, shmInBuf, shmOutBuf;
+#endif
+
+
+ /* initialize module (setup rpc connection) */
+ status = MachVis_initialize();
+
+ if (status < 0) {
+ printf("App_main: Error: MachVis_initialize() failed, status=%d",
+ status);
+ initMachVis = false;
+ status = -1;
+ goto leave;
+ }
+ else {
+ initMachVis = true;
+ }
+
+ /* invoke a function with two scalar values */
+ status = MachVis_add(44, 66);
+
+ printf("App_main: MachVis_add(44, 66), status=%d\n", status);
+
+ if (status < 0) {
+ printf("App_main: Error: MachVis_add() failed, status=%d", status);
+ status = -1;
+ goto leave;
+ }
+ else {
+ status = 0;
+ }
+
+ /* allocate a compute structure in shared memory */
+#if defined(OS_QNX)
+ SHM_alloc(sizeof(MachVis_Compute), &shmCompute);
+ compute = (MachVis_Compute *)(shmCompute.vir_addr);
+#else
+ /* Allocate memory here if on Linux */
+ compute = NULL;
+#endif
+
+ if (compute == NULL) {
+ /* temporary: memory alloc not implemented on Linux */
+ goto leave;
+ }
+
+ /* initialize compute structure */
+ compute->coef = 0xE0400000;
+ compute->key = 0xABA0;
+ compute->size = 0x1000;
+ compute->inBuf = NULL;
+ compute->outBuf = NULL;
+
+ /* allocate an input buffer in shared memory */
+#if defined(OS_QNX)
+ SHM_alloc(compute->size * sizeof(uint32_t), &shmInBuf);
+ compute->inBuf = (uint32_t *)(shmInBuf.vir_addr);
+#else
+ /* Allocate memory here if on Linux */
+// compute->inBuf = ...;
+#endif
+
+ if (compute->inBuf == NULL) {
+ printf("App_main: Error: inBuf == NULL\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* fill input buffer with seed value */
+ for (i = 0; i < compute->size; i++) {
+ compute->inBuf[i] = 0x2010;
+ }
+
+ /* allocate an output buffer in shared memory */
+#if defined(OS_QNX)
+ SHM_alloc(compute->size * sizeof(uint32_t), &shmOutBuf);
+ compute->outBuf = (uint32_t *)(shmOutBuf.vir_addr);
+#else
+ /* Allocate memory here if on Linux */
+// compute->outBuf = ...;
+#endif
+
+ if (compute->outBuf == NULL) {
+ printf("App_main: Error: outBuf == NULL\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* clear output buffer */
+ for (i = 0; i < compute->size; i++) {
+ compute->outBuf[i] = 0;
+ }
+
+ /* print some debug info */
+ printf("App_main: compute->coef=0x%x\n", compute->coef);
+ printf("App_main: compute->key=0x%x\n", compute->key);
+ printf("App_main: compute->size=0x%x\n", compute->size);
+ printf("App_main: compute->inBuf=0x%x\n", (unsigned int)compute->inBuf);
+ printf("App_main: compute->outBuf=0x%x\n", (unsigned int)compute->outBuf);
+
+ /* process the buffer */
+ printf("App_main: MachVis_compute(0x%x)\n", (unsigned int)compute);
+ ret = MachVis_compute(compute);
+
+ if (ret < 0) {
+ status = -1;
+ printf("App_main: Error: MachVis_Compute() failed\n");
+ goto leave;
+ }
+
+ printf("App_main: compute->coef=0x%x\n", compute->coef);
+ printf("App_main: compute->key=0x%x (expect 0xa0a0)\n", compute->key);
+ printf("App_main: compute->size=0x%x\n", compute->size);
+ printf("App_main: compute->inBuf=0x%x\n", (unsigned int)compute->inBuf);
+ printf("App_main: compute->outBuf=0x%x\n", (unsigned int)compute->outBuf);
+ printf("App_main: compute->inBuf[0]=0x%x (expect 0x2010)\n",
+ (unsigned int)compute->inBuf[0]);
+ printf("App_main: compute->outBuf[0]=0x%x (expect 0xe0402010)\n",
+ (unsigned int)compute->outBuf[0]);
+
+ /* check the output buffer */
+ for (i = 0; i < compute->size; i++) {
+ val = compute->inBuf[i] | compute->coef;
+ if (compute->outBuf[i] != val) {
+ status = -1;
+ printf("App_main: Error: incorrect outBuf\n");
+ break;
+ }
+ }
+
+ /* free resources */
+#if defined(OS_QNX)
+ SHM_release(&shmOutBuf);
+ SHM_release(&shmInBuf);
+ SHM_release(&shmCompute);
+#else
+ /* Free memory here if on Linux */
+// ...
+#endif
+
+leave:
+ /* finalize module (destroy rpc connection) */
+ if (initMachVis) {
+ MachVis_finalize();
+ }
+
+ return(status);
+}
diff --git a/src/examples/templates/ex12_mmrpc/host/App.h b/src/examples/templates/ex12_mmrpc/host/App.h
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== App.h ========
+ *
+ */
+
+#ifndef App__include
+#define App__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+int App_main(void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif /* App__include */
diff --git a/src/examples/templates/ex12_mmrpc/host/Qnx/app_host.use b/src/examples/templates/ex12_mmrpc/host/Qnx/app_host.use
diff --git a/src/examples/templates/ex12_mmrpc/host/Qnx/arm/makefile b/src/examples/templates/ex12_mmrpc/host/Qnx/arm/makefile
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
diff --git a/src/examples/templates/ex12_mmrpc/host/Qnx/arm/o.g.le.v7/makefile b/src/examples/templates/ex12_mmrpc/host/Qnx/arm/o.g.le.v7/makefile
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+$(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g: \
+ $(PROJECT_ROOT)/../../machvis/Qnx/arm/a.g.le.v7/libmachvis_host_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/mm/arm/a.g.le.v7/libmmrpc_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/libsharedmemallocatorS.a
+
+# these libraries are linked statically
+LIBPREF_machvis_host_g = -Bstatic
+LIBPOST_machvis_host_g = -Bdynamic
+LIBPREF_mmrpc_g = -Bstatic
+LIBPOST_mmrpc_g = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += \
+ $(PROJECT_ROOT)/../../machvis/Qnx/arm/a.g.le.v7 \
+ $(IPC_INSTALL_DIR)/qnx/src/mm/arm/a.g.le.v7 \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/
+
+LIBS += machvis_host_g
+LIBS += mmrpc_g
+LIBS += sharedmemallocatorS
+
+# copy and rename executable
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g \
+ $(PROJECT_ROOT)/../bin/debug/app_host
diff --git a/src/examples/templates/ex12_mmrpc/host/Qnx/arm/o.le.v7/makefile b/src/examples/templates/ex12_mmrpc/host/Qnx/arm/o.le.v7/makefile
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+CCFLAGS += -O3
+
+$(PROJECT_ROOT)/arm/o.le.v7/mmrpc_test: \
+ $(PROJECT_ROOT)/../../machvis/Qnx/arm/a.le.v7/libmachvis_host.a \
+ $(IPC_INSTALL_DIR)/qnx/src/mm/arm/a.le.v7/libmmrpc.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7/libsharedmemallocatorS.a
+
+# these libraries are linked statically
+LIBPREF_machvis_host = -Bstatic
+LIBPOST_machvis_host = -Bdynamic
+LIBPREF_mmrpc = -Bstatic
+LIBPOST_mmrpc = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += \
+ $(PROJECT_ROOT)/../../machvis/Qnx/arm/a.le.v7 \
+ $(IPC_INSTALL_DIR)/qnx/src/mm/arm/a.le.v7 \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/so.le.v7
+
+LIBS += machvis_host
+LIBS += mmrpc
+LIBS += sharedmemallocatorS
+
+# copy and rename executable
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.le.v7/app_host \
+ $(PROJECT_ROOT)/../bin/release/app_host
diff --git a/src/examples/templates/ex12_mmrpc/host/Qnx/common.mk b/src/examples/templates/ex12_mmrpc/host/Qnx/common.mk
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME = app_host
+
+define PINFO
+PINFO DESCRIPTION = MmRpc example
+endef
+
+# don't install the binaries, they are copied in base makefile
+INSTALLDIR = bin/examples
+
+CCOPTS += -DOS_QNX
+
+# source path
+EXTRA_SRCVPATH += $(PROJECT_ROOT)/..
+SRCS = main_host.c App.c
+
+# include path
+EXTRA_INCVPATH += \
+ $(PROJECT_ROOT)/../.. \
+ $(IPC_INSTALL_DIR)/packages \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
+
+include $(MKFILES_ROOT)/qtargets.mk
+
+LDFLAGS += -M
diff --git a/src/examples/templates/ex12_mmrpc/host/Qnx/makefile b/src/examples/templates/ex12_mmrpc/host/Qnx/makefile
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+LIST=CPU
+include recurse.mk
diff --git a/src/examples/templates/ex12_mmrpc/host/main_host.c b/src/examples/templates/ex12_mmrpc/host/main_host.c
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2013 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== main_host.c ========
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "App.h"
+
+#define Main_USAGE "\
+Usage:\n\
+ app_host [options]\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+ l : list the available remote names\n\
+\n\
+Examples:\n\
+ app_host\n\
+ app_host -l\n\
+ app_host -h\n\
+\n"
+
+/* private functions */
+static int parse_args(int argc, char *argv[]);
+
+/* private data */
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char* argv[])
+{
+ int status;
+
+ printf("--> main:\n");
+
+ /* parse command line */
+ status = parse_args(argc, argv);
+
+ if (status < 0) {
+ printf("main: Error: parse_args() failed, status=%d", status);
+ goto leave;
+ }
+
+ /* bootstrap the application */
+ status = App_main();
+
+ if (status < 0) {
+ printf("main: Error: App_main() failed, status=%d\n", status);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ printf("<-- main: status=%d\n", status);
+
+ return (status);
+}
+
+/*
+ * ======== parse_args ========
+ */
+static int parse_args(int argc, char *argv[])
+{
+ int x, cp, opt, argNum;
+ int status = 0;
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ case 'l': /* -l */
+ printf("Available remote processors: DSP, IPU");
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ for (argNum = 1; opt < argc; argNum++, opt++) {
+
+ switch (argNum) {
+#if 0
+ case 1:
+ break;
+#endif
+
+ default:
+ printf(
+ "Error: %s, line %d: too many arguments\n",
+ __FILE__, __LINE__);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+leave:
+ return(status);
+}
diff --git a/src/examples/templates/ex12_mmrpc/host/makefile_linux b/src/examples/templates/ex12_mmrpc/host/makefile_linux
--- /dev/null
@@ -0,0 +1,134 @@
+#
+# Copyright (c) 2013-2014, 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+srcs = main_host.c App.c
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+libs = ../machvis/lib/$(PROFILE)/machvis.av7A \
+ $(IPC_INSTALL_DIR)/linux/src/mm/.libs/libmmrpc.a
+
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug app_host
+ $(MAKE) PROFILE=release app_host
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+app_host: bin/$(PROFILE)/app_host
+bin/$(PROFILE)/app_host: $(objs) $(libs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I.. -I $(IPC_INSTALL_DIR)/packages
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex12_mmrpc/host/makefile_qnx b/src/examples/templates/ex12_mmrpc/host/makefile_qnx
--- /dev/null
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+export PKGPATH
+
+#
+# determine build host OS (Windows or Linux)
+#
+ifeq (,$(BUILDHOSTOS))
+ ifeq (,$(findstring :,$(WINDIR)$(windir)$(COMSPEC)$(comspec)))
+ BUILDHOSTOS := Linux
+ else
+ BUILDHOSTOS := Windows
+ endif
+endif
+
+ifeq (Linux,$(BUILDHOSTOS))
+QNX_PATH := $(QNX_INSTALL_DIR)/host/linux/x86/usr/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/usr/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/linux/x86/usr/photon/appbuilder
+endif
+
+export PATH
+
+export QNX_CONFIGURATION ?= $(QNX_INSTALL_DIR)/etc/qnx
+export QNX_HOST ?= $(QNX_INSTALL_DIR)/host/linux/x86
+export QNX_TARGET ?= $(QNX_INSTALL_DIR)/target/qnx6
+export MAKEFLAGS = -I$(QNX_INSTALL_DIR)/target/qnx6/usr/include
+export LD_LIBRARY_PATH ?= $(QNX_INSTALL_DIR)/host/linux/x86/usr/lib
+export IPC_INSTALL_DIR
+
+all: app
+
+app: PATH:=$(QNX_PATH):$(PATH)
+app:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C Qnx
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean:: PATH:=$(QNX_PATH):$(PATH)
+clean::
+ $(MAKE) -C Qnx clean
+ $(RMDIR) bin
+
+
+#
+# ======== install validation ========
+#
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+#
+# ======== standard macros ========
+#
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+#
+# ======== create output directories ========
+#
+ifneq (clean,$(MAKECMDGOALS))
+ifeq (,$(wildcard bin/debug))
+ $(shell $(MKDIR) -p bin/debug)
+endif
+ifeq (,$(wildcard bin/release))
+ $(shell $(MKDIR) -p bin/release)
+endif
+endif
diff --git a/src/examples/templates/ex12_mmrpc/machvis/MachVis.c b/src/examples/templates/ex12_mmrpc/machvis/MachVis.c
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2013-2015, 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.
+ */
+
+/*
+ * ======== MachVis.c ========
+ */
+#include <stdio.h>
+#include <assert.h>
+
+#include <ti/ipc/mm/MmRpc.h>
+
+#include "MachVis.h"
+#include "MachVis_skel.h"
+
+/* hande used for remote communication */
+static MmRpc_Handle MachVis_mmrpc = NULL;
+
+#define MachVis_OFFSET(base, member) ((uint_t)(member) - (uint_t)(base))
+
+/*
+ * ======== MachVis_initialize ========
+ */
+int MachVis_initialize(void)
+{
+ int status;
+ MmRpc_Params args;
+
+ /* create remote server insance */
+ MmRpc_Params_init(&args);
+
+ status = MmRpc_create(MachVis_SERVICE, &args, &MachVis_mmrpc);
+
+ if (status < 0) {
+ printf("MachVis_initialize: Error: MmRpc_create failed (%d)\n", status);
+ status = -1;
+ }
+ else {
+ status = 0;
+ }
+
+ return(status);
+}
+
+/*
+ * ======== MachVis_finalize ========
+ */
+void MachVis_finalize(void)
+{
+ /* delete remote server instance */
+ if (MachVis_mmrpc != NULL) {
+ MmRpc_delete(&MachVis_mmrpc);
+ }
+}
+
+/*
+ * ======== MachVis_add ========
+ */
+int32_t MachVis_add(int32_t a, int32_t b)
+{
+ MmRpc_FxnCtx *fxnCtx;
+ int32_t fxnRet;
+ char send_buf[512] = {0};
+ int status;
+
+ assert(MachVis_mmrpc != NULL);
+
+ /* marshall function arguments into the send buffer */
+ fxnCtx = (MmRpc_FxnCtx *)send_buf;
+
+ fxnCtx->fxn_id = MachVis_FxnId_add;
+ fxnCtx->num_params = 2;
+ fxnCtx->params[0].type = MmRpc_ParamType_Scalar;
+ fxnCtx->params[0].param.scalar.size = sizeof(int);
+ fxnCtx->params[0].param.scalar.data = a;
+ fxnCtx->params[1].type = MmRpc_ParamType_Scalar;
+ fxnCtx->params[1].param.scalar.size = sizeof(int);
+ fxnCtx->params[1].param.scalar.data = b;
+ fxnCtx->num_xlts = 0;
+
+ /* invoke the remote function call */
+ status = MmRpc_call(MachVis_mmrpc, fxnCtx, &fxnRet);
+
+ if (status < 0) {
+ printf("MachVis_add: Error: MmRpc_call failed\n");
+ fxnRet = -1;
+ }
+
+ return(fxnRet);
+}
+
+/*
+ * ======== MachVis_compute ========
+ */
+int32_t MachVis_compute(MachVis_Compute *compute)
+{
+ MmRpc_FxnCtx *fxnCtx;
+ MmRpc_Xlt xltAry[2];
+ int32_t fxnRet;
+ char send_buf[512] = {0};
+ int status;
+
+ /* marshall function arguments into the send buffer */
+ fxnCtx = (MmRpc_FxnCtx *)send_buf;
+
+ fxnCtx->fxn_id = MachVis_FxnId_compute;
+ fxnCtx->num_params = 1;
+ fxnCtx->params[0].type = MmRpc_ParamType_Ptr;
+ fxnCtx->params[0].param.ptr.size = sizeof(MachVis_Compute);
+ fxnCtx->params[0].param.ptr.addr = (size_t)compute;
+ fxnCtx->params[0].param.ptr.handle = 0;
+#if !defined(OS_QNX)
+ /* In Linux, set this to a valid allocator handle */
+// fxnCtx->params[0].param.ptr.handle = ...;
+ assert(fxnCtx->params[0].param.ptr.handle != 0);
+#endif
+
+ fxnCtx->num_xlts = 2;
+ fxnCtx->xltAry = xltAry;
+
+ fxnCtx->xltAry[0].index = 0;
+ fxnCtx->xltAry[0].offset = MmRpc_OFFSET(compute, &compute->inBuf);
+ fxnCtx->xltAry[0].handle = 0;
+#if !defined(OS_QNX)
+ /* In Linux, set this to a valid allocator handle */
+// fxnCtx->xltAry[0].handle = ...;
+ assert(fxnCtx->xltAry[0].handle != 0);
+#endif
+
+ fxnCtx->xltAry[1].index = 0;
+ fxnCtx->xltAry[1].offset = MmRpc_OFFSET(compute, &compute->outBuf);
+ fxnCtx->xltAry[1].handle = 0;
+#if !defined(OS_QNX)
+ /* In Linux, set this to a valid allocator handle */
+// fxnCtx->xltAry[1].handle = ...;
+ assert(fxnCtx->xltAry[1].handle != 0);
+#endif
+
+ /* invoke the remote function call */
+ status = MmRpc_call(MachVis_mmrpc, fxnCtx, &fxnRet);
+
+ if (status < 0) {
+ printf("MachVis_compute: Error: MmRpc_call failed\n");
+ fxnRet = -1;
+ }
+
+ return(fxnRet);
+}
diff --git a/src/examples/templates/ex12_mmrpc/machvis/MachVis.h b/src/examples/templates/ex12_mmrpc/machvis/MachVis.h
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** ============================================================================
+ * @file MachVis.h
+ *
+ * @brief Example of a host-side module which uses MmRpc to
+ * invoke functions on a remote processor.
+ *
+ * ============================================================================
+ */
+
+#ifndef MachVis__include
+#define MachVis__include
+
+#include <stddef.h>
+#include <stdint.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*!
+ * @brief Operation is successful
+ */
+#define MachVis_S_SUCCESS (0)
+
+/*!
+ * @brief Operation failed
+ */
+#define MachVis_E_FAIL (-1)
+
+/*!
+ * @brief Compute structure
+ */
+typedef struct {
+ uint32_t coef;
+ int key;
+ int size;
+ uint32_t * inBuf;
+ uint32_t * outBuf;
+} MachVis_Compute;
+
+/*!
+ * @brief Initialize the module, must be called first
+ */
+int MachVis_initialize(void);
+
+/*!
+ * @brief Finalize the module, must be called last
+ */
+void MachVis_finalize(void);
+
+/*!
+ * @brief Sample function which addes two arguments
+ */
+int32_t MachVis_add(int32_t a, int32_t b);
+
+/*!
+ * @brief Sample function which has pointer parameter to
+ * a structure with two embedded pointers.
+ */
+int32_t MachVis_compute(MachVis_Compute *compute);
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* MachVis__include */
diff --git a/src/examples/templates/ex12_mmrpc/machvis/MachVis_skel.c b/src/examples/templates/ex12_mmrpc/machvis/MachVis_skel.c
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== MachVis_skel.c ========
+ *
+ * Example of how to integrate the MachVis module with the
+ * MmService manager.
+ */
+#include <stddef.h>
+#include <stdint.h>
+
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/grcm/RcmServer.h>
+#include <ti/ipc/mm/MmType.h>
+#include <ti/ipc/mm/MmServiceMgr.h>
+#include <ti/sysbios/hal/Cache.h>
+
+#include "MachVis.h"
+#include "MachVis_skel.h"
+
+void MachVis_startup(void);
+void (*fp)(void) = MachVis_startup;
+
+/* MachVis skel function declarations */
+static Int32 MachVis_add_skel(UInt32 size, UInt32 *data);
+static Int32 MachVis_compute_skel(UInt32 size, UInt32 *data);
+
+/* skel function array */
+static RcmServer_FxnDesc skelAry[] = {
+ { "MachVis_add", MachVis_add_skel },
+ { "MachVis_compute", MachVis_compute_skel }
+};
+
+/* skel function table */
+static const RcmServer_FxnDescAry skelTab = {
+ (sizeof(skelAry) / sizeof(skelAry[0])),
+ skelAry
+};
+
+/* function signature array */
+static MmType_FxnSig sigAry[] = {
+ { "MxServer_add", 3,
+ {
+ { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+ { MmType_Dir_In, MmType_Param_S32, 1 },
+ { MmType_Dir_In, MmType_Param_S32, 1 }
+ }
+ },
+ { "MxServer_compute", 2,
+ {
+ { MmType_Dir_Out, MmType_Param_S32, 1 }, /* return */
+ { MmType_Dir_In, MmType_PtrType(MmType_Param_VOID), 1 }
+ }
+ }
+};
+
+/* function signature table */
+static MmType_FxnSigTab sigTab = {
+ MmType_NumElem(sigAry), sigAry
+};
+
+/* the server create parameters, must be in persistent memory */
+static RcmServer_Params rcmParams;
+
+
+Void RPC_SKEL_SrvDelNotification(Void)
+{
+ System_printf("RPC_SKEL_SrvDelNotification: Nothing to cleanup for "
+ "Mm service instance id=%d\n", MmServiceMgr_getId());
+}
+
+/*
+ * ======== MachVis_add_skel ========
+ */
+Int32 MachVis_add_skel(UInt32 size, UInt32 *data)
+{
+ MmType_Param *payload = (MmType_Param *)data;
+ Int32 a, b;
+ Int32 result;
+
+ System_printf("skel_add: For mm service instance id %d\n",
+ MmServiceMgr_getId());
+
+ a = (Int32)payload[0].data;
+ b = (Int32)payload[1].data;
+
+ result = MachVis_add(a, b);
+
+ return(result);
+}
+
+/*
+ * ======== MachVis_compute_skel ========
+ */
+Int32 MachVis_compute_skel(UInt32 size, UInt32 *data)
+{
+ MmType_Param *payload;
+ MachVis_Compute *compute;
+ Int32 result = 0;
+
+ payload = (MmType_Param *)data;
+ compute = (MachVis_Compute *)payload[0].data;
+
+ System_printf("skel_compute: For mm service instance id %d\n",
+ MmServiceMgr_getId());
+
+ System_printf("skel_compute: compute=0x%x\n", compute);
+ System_printf("skel_compute: compute size=%d\n", (Int)payload[0].size);
+ System_printf("skel_compute: coef=0x%x\n", compute->coef);
+ System_printf("skel_compute: key=0x%x\n", compute->key);
+ System_printf("skel_compute: size=0x%x\n", compute->size);
+ System_printf("skel_compute: inBuf=0x%x\n", compute->inBuf);
+ System_printf("skel_compute: outBuf=0x%x\n", compute->outBuf);
+
+ Cache_inv(compute->inBuf, compute->size * sizeof(uint32_t),
+ Cache_Type_ALL, TRUE);
+ Cache_inv(compute->outBuf, compute->size * sizeof(uint32_t),
+ Cache_Type_ALL, TRUE);
+
+ /* invoke the implementation function */
+ result = MachVis_compute(compute);
+
+ Cache_wbInv(compute->outBuf, compute->size * sizeof(uint32_t),
+ Cache_Type_ALL, TRUE);
+
+ return(result);
+}
+
+/*
+ * ======== MachVis_startup ========
+ *
+ * Service startup function. This function must be added to the
+ * BIOS.addUserStartupFunctions configuration parameter.
+ */
+void MachVis_startup(void)
+{
+ Int status = MmServiceMgr_S_SUCCESS;
+
+ System_printf("MachVis_startup: -->\n");
+
+ /* must initialize these modules before using them */
+ RcmServer_init();
+ MmServiceMgr_init();
+
+ /* setup the server create params */
+ RcmServer_Params_init(&rcmParams);
+ rcmParams.priority = Thread_Priority_ABOVE_NORMAL;
+ rcmParams.stackSize = 0x1000;
+ rcmParams.fxns.length = skelTab.length;
+ rcmParams.fxns.elem = skelTab.elem;
+
+ /* register an example service */
+ status = MmServiceMgr_register(MachVis_SERVICE, &rcmParams, &sigTab,
+ RPC_SKEL_SrvDelNotification);
+
+ if (status < 0) {
+ System_printf("MachVis_startup: MmServiceMgr_register failed, "
+ "status=%d\n", status);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ System_printf("MachVis_startup: <--, status=%d\n", status);
+}
diff --git a/src/examples/templates/ex12_mmrpc/machvis/MachVis_skel.h b/src/examples/templates/ex12_mmrpc/machvis/MachVis_skel.h
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== MachVis_skel.h ========
+ */
+#ifndef MachVis_skel__include
+#define MachVis_skel__include
+
+#include <stddef.h>
+#include <stdint.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* MmRpc service name */
+#define MachVis_SERVICE "machvis_mmrpc"
+
+/* function id */
+#define MachVis_FxnId_add (0x80000000 | 0)
+#define MachVis_FxnId_compute (0x80000000 | 1)
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* MachVis_skel__include */
diff --git a/src/examples/templates/ex12_mmrpc/machvis/MachVis_slave.c b/src/examples/templates/ex12_mmrpc/machvis/MachVis_slave.c
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+%%{
+ var core = this.arguments[0];
+ var suffix = this.arguments[1];
+%%}
+
+/*
+ * ======== MachVis_`core`.c ========
+ */
+
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+
+#include "MachVis.h"
+
+
+/*
+ * ======== MachVis_add ========
+ */
+int32_t MachVis_add(int32_t a, int32_t b)
+{
+ int32_t result;
+
+ System_printf("MachVis_add: --> a=%d, b=%d\n", a, b);
+
+ result = a + b;
+
+ System_printf("MachVis_add: <-- result=%d\n", result);
+ return(result);
+}
+
+/*
+ * ======== MachVis_compute ========
+ */
+int32_t MachVis_compute(MachVis_Compute *compute)
+{
+ int32_t status = 0;
+ int i;
+
+ /* process inBuf into outBuf */
+ for (i = 0; i < compute->size; i++) {
+ compute->outBuf[i] = compute->coef | compute->inBuf[i];
+ }
+
+ /* write a cookie into the key */
+ compute->key = 0xA0A0;
+
+ return(status);
+}
diff --git a/src/examples/templates/ex12_mmrpc/machvis/Qnx/arm/a.g.le.v7/makefile b/src/examples/templates/ex12_mmrpc/machvis/Qnx/arm/a.g.le.v7/makefile
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+CCFLAGS += -fPIC
diff --git a/src/examples/templates/ex12_mmrpc/machvis/Qnx/arm/a.le.v7/makefile b/src/examples/templates/ex12_mmrpc/machvis/Qnx/arm/a.le.v7/makefile
--- /dev/null
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+CCFLAGS += -fPIC -O3
diff --git a/src/examples/templates/ex12_mmrpc/machvis/Qnx/arm/makefile b/src/examples/templates/ex12_mmrpc/machvis/Qnx/arm/makefile
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
diff --git a/src/examples/templates/ex12_mmrpc/machvis/Qnx/common.mk b/src/examples/templates/ex12_mmrpc/machvis/Qnx/common.mk
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2013-2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME = machvis_host
+
+define PINFO
+PINFO DESCRIPTION = Machine Vision client library
+endef
+
+# don't install the binaries, they are copied in base makefile
+INSTALLDIR = /dev/null
+
+CCOPTS += -DOS_QNX
+
+# source path
+EXTRA_SRCVPATH += $(PROJECT_ROOT)/..
+SRCS = MachVis.c
+
+# include path
+EXTRA_INCVPATH += $(IPC_INSTALL_DIR)/packages
+
+include $(MKFILES_ROOT)/qtargets.mk
+OPTIMIZE__gcc=$(OPTIMIZE_NONE_gcc)
diff --git a/src/examples/templates/ex12_mmrpc/machvis/Qnx/makefile b/src/examples/templates/ex12_mmrpc/machvis/Qnx/makefile
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=CPU
+include recurse.mk
diff --git a/src/examples/templates/ex12_mmrpc/machvis/host_linux.mak b/src/examples/templates/ex12_mmrpc/machvis/host_linux.mak
--- /dev/null
@@ -0,0 +1,110 @@
+#
+# Copyright (c) 2013-2014, 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.
+#
+
+#
+# ======== host.mak ========
+#
+
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix lib/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+
+srcs = MachVis.c
+objs = $(addprefix lib/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+
+PKGPATH := $(IPC_INSTALL_DIR)/packages
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -f host.mak PROFILE=debug machvis.a
+ $(MAKE) -f host.mak PROFILE=release machvis.a
+
+help:
+ @$(ECHO) "make # build library"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) lib
+
+#
+# ======== rules ========
+#
+machvis.a: lib/$(PROFILE)/machvis.av7A
+lib/$(PROFILE)/machvis.av7A: $(objs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(AR) $@ $^
+
+lib/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. $(addprefix -I,$(subst +, ,$(PKGPATH)))
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard lib/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p lib/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex12_mmrpc/machvis/host_qnx.mak b/src/examples/templates/ex12_mmrpc/machvis/host_qnx.mak
--- /dev/null
@@ -0,0 +1,118 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# ======== host.mak ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+.PHONY: lib
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+export PKGPATH
+
+#
+# determine build host OS (Windows or Linux)
+#
+ifeq (,$(BUILDHOSTOS))
+ ifeq (,$(findstring :,$(WINDIR)$(windir)$(COMSPEC)$(comspec)))
+ BUILDHOSTOS := Linux
+ else
+ BUILDHOSTOS := Windows
+ endif
+endif
+
+ifeq (Linux,$(BUILDHOSTOS))
+QNX_PATH := $(QNX_INSTALL_DIR)/host/linux/x86/usr/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/usr/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/linux/x86/usr/photon/appbuilder
+endif
+
+export PATH
+
+export QNX_CONFIGURATION ?= $(QNX_INSTALL_DIR)/etc/qnx
+export QNX_HOST ?= $(QNX_INSTALL_DIR)/host/linux/x86
+export QNX_TARGET ?= $(QNX_INSTALL_DIR)/target/qnx6
+export MAKEFLAGS = -I$(QNX_INSTALL_DIR)/target/qnx6/usr/include
+export LD_LIBRARY_PATH ?= $(QNX_INSTALL_DIR)/host/linux/x86/usr/lib
+export IPC_INSTALL_DIR
+
+#
+# ======== rules ========
+#
+all: lib
+
+lib: PATH:=$(QNX_PATH):$(PATH)
+lib:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C Qnx
+
+clean:: PATH:=$(QNX_PATH):$(PATH)
+clean::
+ $(MAKE) -C Qnx clean
+
+#
+# ======== standard macros ========
+#
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+#
+# ======== create output directories ========
+#
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard lib/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p lib/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex12_mmrpc/machvis/ipu.mak b/src/examples/templates/ex12_mmrpc/machvis/ipu.mak
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+%%{
+ var core = this.arguments[0];
+%%}
+
+#
+# ======== ipu.mak ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = MachVis_skel.c MachVis_ipu.c
+objs = $(addprefix lib/$(PROFILE)/obj/,$(patsubst %.c,%.oem4,$(srcs)))
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oem4.dep,$(srcs)))
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -f ipu.mak PROFILE=debug libmachvis_ipu.a
+ $(MAKE) -f ipu.mak PROFILE=release libmachvis_ipu.a
+
+clean::
+ $(RMDIR) lib
+
+libmachvis_ipu.a: lib/$(PROFILE)/libmachvis_ipu.aem4
+lib/$(PROFILE)/libmachvis_ipu.aem4: $(objs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(AR) $@ $^
+
+lib/$(PROFILE)/obj/%.oem4: %.h
+lib/$(PROFILE)/obj/%.oem4: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+# ======== toolchain macros ========
+CGTOOLS = $(ti.targets.arm.elf.M4)
+
+CC = $(CGTOOLS)/bin/armcl -c --endian=little -mv7M4 --float_support=vfplib \
+ --abi=eabi
+AR = $(CGTOOLS)/bin/armar rq
+
+CPPFLAGS = -Dxdc_target_types__="ti/targets/arm/elf/std.h" \
+ -Dxdc_target_name__=M4
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -I. \
+ $(addprefix -I,$(subst +, ,$(PKGPATH))) -I$(CGTOOLS)/include
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2 -Dxdc_runtime_Log_DISABLE_ALL \
+ -Dxdc_runtime_Assert_DISABLE_ALL
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard lib/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p lib/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex12_mmrpc/machvis/makefile b/src/examples/templates/ex12_mmrpc/machvis/makefile
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -f host.mak
+ $(MAKE) -f ipu.mak
+
+help:
+ @$(ECHO) "make # build libraries"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(MAKE) -f host.mak clean
+ $(RMDIR) lib
+
+#
+# ======== standard macros ========
+#
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex12_mmrpc/makefile b/src/examples/templates/ex12_mmrpc/makefile
--- /dev/null
@@ -0,0 +1,110 @@
+#
+# Copyright (c) 2013-2015, 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+PROCLIST = ipu2 host
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+PROCLIST = ipu2 host
+% } else if (this.platform.match(/^OMAP54XX_(qnx|linux)_elf$/)) {
+PROCLIST = ipu host
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+PROCLIST = dsp host
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+.PHONY: machvis
+
+all: machvis $(PROCLIST)
+
+machvis:
+ $(MAKE) -C machvis all
+
+$(PROCLIST): machvis
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@ PROCLIST="$(PROCLIST)"
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+EXEC_DIR=$(CURDIR)/install
+override EXEC_DIR:=$(EXEC_DIR)/ex12_mmrpc
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+clean: $(addsuffix _clean,$(PROCLIST))
+ $(RMDIR) install
+ $(MAKE) -C machvis clean
+
+$(addsuffix _clean,$(PROCLIST)):
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+#
+# ======== standard macros ========
+#
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex12_mmrpc/mkpkg.xdt b/src/examples/templates/ex12_mmrpc/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,110 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (!this.hostOS.match(/qnx|linux/)) {
+ throw ("Unsupported Host OS: " + this.hostOS);
+% }
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt
+
+host/App.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+host/main_host.c -> `this.example`/host/main_host.c
+
+% if (this.hostOS == "qnx") {
+ host/makefile_qnx -> `this.example`/host/makefile
+ host/Qnx/app_host.use -> `this.example`/host/Qnx/app_host.use
+ host/Qnx/common.mk -> `this.example`/host/Qnx/common.mk
+ host/Qnx/makefile -> `this.example`/host/Qnx/makefile
+ host/Qnx/arm/makefile -> `this.example`/host/Qnx/arm/makefile
+ host/Qnx/arm/o.g.le.v7/makefile -> `this.example`/host/Qnx/arm/o.g.le.v7/makefile
+ host/Qnx/arm/o.le.v7/makefile -> `this.example`/host/Qnx/arm/o.le.v7/makefile
+% } else if (this.hostOS == "linux") {
+ host/makefile_linux -> `this.example`/host/makefile
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+shared/config.bld -> `this.example`/shared/config.bld
+
+%%{
+ /* machvis */
+ var files = [
+ { inFile: "machvis/MachVis.h", outFile: "machvis/MachVis.h" },
+ { inFile: "machvis/MachVis_skel.h", outFile: "machvis/MachVis_skel.h" },
+ { inFile: "machvis/makefile", outFile: "machvis/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile);
+ }
+
+ /* machvis (ipu) */
+ var files = [
+ { inFile: "machvis/ipu.mak", outFile: "machvis/ipu.mak" },
+ { inFile: "machvis/MachVis_slave.c", outFile: "machvis/MachVis_ipu.c" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile, "ipu");
+ }
+
+ if (this.hostOS == "qnx") {
+ var files = [
+ { inFile: "machvis/MachVis.c", outFile: "machvis/MachVis.c" },
+ { inFile: "machvis/MachVis_skel.c", outFile: "machvis/MachVis_skel.c" },
+ { inFile: "machvis/host_qnx.mak", outFile: "machvis/host.mak" },
+ { inFile: "machvis/Qnx/common.mk", outFile: "machvis/Qnx/common.mk" },
+ { inFile: "machvis/Qnx/makefile", outFile: "machvis/Qnx/makefile" },
+ { inFile: "machvis/Qnx/arm/makefile", outFile: "machvis/Qnx/arm/makefile" },
+ { inFile: "machvis/Qnx/arm/a.g.le.v7/makefile", outFile: "machvis/Qnx/arm/a.g.le.v7/makefile" },
+ { inFile: "machvis/Qnx/arm/a.le.v7/makefile", outFile: "machvis/Qnx/arm/a.le.v7/makefile" }
+ ];
+ } else if (this.hostOS == "linux") {
+ var files = [
+ { inFile: "machvis/MachVis.c", outFile: "machvis/MachVis.c" },
+ { inFile: "machvis/MachVis_skel.c", outFile: "machvis/MachVis_skel.c" },
+ { inFile: "machvis/host_linux.mak", outFile: "machvis/host.mak" }
+ ];
+ } else {
+ throw new Error("unsupported platform: " + this.platform);
+ }
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile);
+ }
+ if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ /* ipu */
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: "ipu/IPU.cfg" },
+ { inFile: "slave/IpuAmmu_omap5.cfg", outFile: "ipu/IpuAmmu.cfg" },
+ { inFile: "slave/main_slave.c", outFile: "ipu/main_ipu.c" },
+ { inFile: "slave/makefile_ipu", outFile: "ipu/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "IPU", "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+ else if (this.platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+ /* ipu2 */
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: "ipu2/Ipu2.cfg" },
+ { inFile: "slave/IpuAmmu_dra7xx.cfg", outFile: "ipu2/IpuAmmu.cfg" },
+ { inFile: "slave/main_slave.c", outFile: "ipu2/main_ipu.c" },
+ { inFile: "slave/makefile_ipu", outFile: "ipu2/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu2", "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+%%}
diff --git a/src/examples/templates/ex12_mmrpc/products.mak b/src/examples/templates/ex12_mmrpc/products.mak
--- /dev/null
@@ -0,0 +1,116 @@
+#
+# Copyright (c) 2013-2014, 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.
+#
+%%{
+ var isLinux = this.platform.match(/_linux_/);
+ var isQnx = this.platform.match(/_qnx_/);
+%%}
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+% if (isLinux) {
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+% } else if (isQnx) {
+#### QNX toolchain ####
+#QNX_INSTALL_DIR = $(DEPOT)/_your_qnx_install_
+% }
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+% //not yet
+% // ti.targets.elf.C64T = $(DEPOT)/_your_ti_codegen_install_
+% } else if (this.platform.match(/^OMAP54XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+% //not yet
+% // ti.targets.elf.C64T ?= $(DEPOT)/_your_ti_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+% //not yet
+% // ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+% //not yet
+% // ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+% if (isLinux) {
+ @echo "HOST TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+% } else if (isQnx) {
+ @echo "QNX_INSTALL_DIR = $(QNX_INSTALL_DIR)"
+% }
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+% } else if (this.platform.match(/^OMAP54XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex12_mmrpc/readme.txt b/src/examples/templates/ex12_mmrpc/readme.txt
--- /dev/null
@@ -0,0 +1,188 @@
+#
+# ======== readme.txt ========
+#
+
+mmrpc - Illustrate how to use the MmRcp module to invoke remote functions
+
+Overview
+=========================================================================
+This example illustrates how to use the MmRpc module as an "RPC" framework.
+The application runs on the host processor and the server executable runs
+on a slave processor (the IPU in this example). The application calls into
+a sample module called MachVis (Machine Vision) which has been implemented
+as an RPC stub function. It is the MachVis module which uses the MmRpc module
+to marshal the function parameters into a message and to send the message to
+the remote processor by calling the MmRpc_call API. The application does not
+use MmRpc directly.
+
+
+ HOST Processor | IPU Processor
+ --------------------------------|------------------------------
+ |
+ +---------------+ |
+ | Application | |
+ +---------------+ |
+ | |
+ V |
+ +---------------+ | +---------------+
+ | MachVis | | | MachVis_ipu |
+ +---------------+ | +---------------+
+ | | ^
+ V | |
+ +---------------+ | +---------------+
+ | MmRpc |----------------------->| MachVis_skel |
+ +---------------+ | +---------------+
+
+
+When the message is received on the IPU processor, the framework will
+invoke the appropriate "skel" function and pass the message as an argument.
+The skel function will unmarshal the arguments from the message and invoke
+the actual MachVis library function. In the illustration above, the skel
+function is impelmented in 'MachVis_skel' and the MachVis library functions
+are implemented in 'MachVis_ipu'.
+
+When the MachVis library function returns, the call path unwinds. The skel
+function will marshal the return values into the message and send the
+message back to the HOST processor. When the return message is received on
+the HOST, the MmRpc_call API will return back into the MachVis stub function
+which will unmarshal the return values and finally return to the application.
+
+Discussion Points
+=========================================================================
+The MachVis abstraction is in the folder ex12_mmrpc/machvis. This folder
+contains both the stub and skel functions as well as the actual MachVis
+library implementation. The stub functions are in MachVis.c which is built
+into a library for the application. The skel functions are in MachVis_skel.c
+which is built into a library for the server executable.
+
+The file MachVis_skel.c also contains a startup function, MachVis_startup
+in this example, which is invoked by SYS/BIOS. This function registers the
+MachVis service which allows the MachVis module on the host to establish a
+communication channel between the host and slave processors. Look in
+ex12_mmrpc/ipu/Ipu.cfg to see how the startup function is configured.
+
+The file MachVis_skel.h contains the MachVis service name and the skel
+function identifiers. This header file is used by the MachVis module to
+identify the service name and to specify which skel function to invoke.
+
+
+Build Instructions
+=========================================================================
+
+ 1. Setup a development area. A typical setup might look like this. The
+ Depot folder contains installed products. The work folder contains
+ each of the examples (eg. hello, ping, etc.). Each example contains
+ its own products.mak file which will include a parent products.mak
+ file if it exists. The parent file must be created by you.
+
+ testbench/
+ |_ Depot/
+ | |_ bios_m_mm_pp_bb/
+ | |_ ipc_m_mm_pp_bb/
+ | |_ qnx_m_m_b/
+ | |_ ti_c6x_m_m_p/
+ | |_ ti_tms470_m_m_p/
+ | |_ xdctools_m_mm_pp_bb/
+ |
+ |_ work/
+ |_ ex12_mmrpc/
+ | |_ host/
+ | |_ ipu/
+ | |_ machvis/
+ | |_ makefile
+ | |_ products.mak
+ | |_ readme.txt
+ |
+ |_ products.mak
+
+ In the example, there is a top-level makefile which builds each of the
+ lower directories. Some folders are processor specific, such as 'host'
+ and 'ipu'. Others build code for multiple processors, such as 'machvis'.
+ The folder named 'shared' contains common files used by all executables,
+ such as config.bld which defines the memory map.
+
+ 2. Unpack the ex12_mmrpc.zip file into the work folder.
+
+ cd work
+ unzip <...>/ex12_mmrpc.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ DEPOT = /testbench/Depot
+
+ BIOS_INSTALL_DIR = $(DEPOT)/bios_m_mm_pp_bb
+ IPC_INSTALL_DIR = $(DEPOT)/ipc_m_mm_pp_bb
+ QNX_INSTALL_DIR = $(DEPOT)/qnx_m_m_b
+ XDC_INSTALL_DIR = $(DEPOT)/xdctools_m_mm_pp_bb
+ ti.targets.arm.elf.M4 = $(DEPOT)/ti_tms470_m_m_p
+
+ 4. Build the example. This will build both debug and release versions.
+ The default goal is the 'install' goal. Run 'make help' to see all
+ available options.
+
+ cd ex12_mmrpc
+ make
+
+ Look in the following folders for the generated files. All executables
+ are copied to these folders for convenience; it makes it easier when
+ loading them into CCS.
+
+ install/ex12_mmrpc/debug/
+ install/ex12_mmrpc/release/
+
+ 5. Optional. Use the install goal to copy the executables to a specific
+ folder of your choice.
+
+ cd ex12_mmrpc
+ make install EXEC_DIR=/<destination folder>
+
+ The executables are copied to the following folders.
+
+ /<destination folder>/ex12_mmrpc/debug
+ /<destination folder>/ex12_mmrpc/release
+
+
+Running the example
+=========================================================================
+Copy the example program files to your target file system. Execute the
+following commands in a shell running on your target.
+
+ 1. Launch the shared memory allocator (for QNX only). This example uses
+ the shared memory allocator to illustrate the marshalling of embedded
+ pointers. The shared memory allocator must be running before you run
+ this example.
+
+ cd .../armle-v7/bin
+ ./shmemallocator
+
+ 2. Load the IPU processor with the server program.
+
+ cd .../ex12_mmrpc/debug
+ .../armle-v7/bin/syslink -f server_ipu.xem4
+
+ 3. Run the host side application program.
+
+ cd .../ex12_mmrpc/debug
+ ./app_host
+
+ 4. You should see output on your console similar to the following:
+
+ --> main:
+ App_main: MachVis_add(44, 66), status=110
+ App_main: compute->coef=0xe0400000
+ App_main: compute->key=0xaba0
+ App_main: compute->size=0x1000
+ App_main: compute->inBuf=0x28001000
+ App_main: compute->outBuf=0x28005000
+ App_main: MachVis_compute(0x28000000)
+ App_main: compute->coef=0xe0400000
+ App_main: compute->key=0xa0a0 (expect 0xa0a0)
+ App_main: compute->size=0x1000
+ App_main: compute->inBuf=0x28001000
+ App_main: compute->outBuf=0x28005000
+ App_main: compute->inBuf[0]=0x2010 (expect 0x2010)
+ App_main: compute->outBuf[0]=0xe0402010 (expect 0xe0402010)
+ <-- main: status=0
diff --git a/src/examples/templates/ex12_mmrpc/shared/config.bld b/src/examples/templates/ex12_mmrpc/shared/config.bld
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+% if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Memory Map for ti.platforms.sdp5430:IPU
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
+ * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
+ * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var sdp5430_ExtMemMapIpu = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x005FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00600000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80600000,
+ len: 0x09600000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.sdp5430:IPU"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", sdp5430_ExtMemMapIpu.EXT_CODE ],
+ [ "EXT_DATA", sdp5430_ExtMemMapIpu.EXT_DATA ],
+ [ "EXT_HEAP", sdp5430_ExtMemMapIpu.EXT_HEAP ],
+ [ "TRACE_BUF", sdp5430_ExtMemMapIpu.TRACE_BUF ],
+ [ "EXC_DATA", sdp5430_ExtMemMapIpu.EXC_DATA ],
+ [ "PM_DATA", sdp5430_ExtMemMapIpu.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+/* Memory Map for ti.platforms.sdp5430:DSP
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 2000_0000 ????_???? 10_0000 ( 1 MB) EXT_CODE
+ * 9000_0000 ????_???? 10_0000 ( 1 MB) EXT_DATA
+ * 9010_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var sdp5430_ExtMemMapDsp = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x20000000,
+ len: 0x00100000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x90000000,
+ len: 0x00100000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x90100000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.sdp5430:DSP"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", sdp5430_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", sdp5430_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", sdp5430_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", sdp5430_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", sdp5430_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", sdp5430_ExtMemMapDsp.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+
+/*
+ * ======== IPU ammu configuration ========
+ */
+var ammu = {
+ /* program code/data memory (cacheable) */
+ largePage0: {
+ pa: 0x8A000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ /* SR_0 data memory (non-cacheable) */
+ largePage1: {
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+% } else if (this.platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+/* Memory Map for ti.platforms.evmDRA7XX:ipu2
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
+ * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
+ * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu2 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x005FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00600000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80600000,
+ len: 0x09600000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu2.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu2.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu2.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu2.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu2.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu2.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex12_mmrpc/slave/Ipu.cfg b/src/examples/templates/ex12_mmrpc/slave/Ipu.cfg
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.hal.Cache');
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+var IpcMgr = xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+IpcMgr.transportCombo = IpcMgr.TransCombo_RPMSG;
+
+xdc.useModule('ti.ipc.mm.MmServiceMgr');
+
+/* describe the processors in the system */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+% if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/) && target.match(/\.M4$/)) {
+MultiProc.setConfig("IPU", ["HOST", "IPU", "DSP"]);
+% } else if (platform.match(/^(VAYUsim|DRA7XX)_(linux|qnx)_elf$/) && target.match(/\.M4$/)) {
+MultiProc.setConfig("IPU2", ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);
+% }
+
+/* ti.grcm Configuration */
+var RcmSettings = xdc.useModule('ti.grcm.Settings');
+RcmSettings.ipc = RcmSettings.IpcSupport_ti_sdo_ipc;
+xdc.useModule('ti.grcm.RcmServer');
+
+/* register startup functions for each MmService */
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup'); /* must be first */
+BIOS.addUserStartupFunction('&MachVis_startup'); /* Machine Vision service */
+
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+
+if (Program.build.profile == "debug") {
+// Bug in SYS/BIOS 6.35.01.29, dmtimer missing from pre-built libraries
+// BIOS.libType = BIOS.LibType_Instrumented;
+ BIOS.libType = BIOS.LibType_Custom;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+BIOS.smpEnabled = true; /* only support SMP mode on IPU */
+
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+
+% }
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+/* Remap the interrupt xbar mmr base address to match AMMU settings */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+% }
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapSize = 0x20000;
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+/* dmTimer 0 mapped to GPT1 */
+dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
+/* dmTimer 1 mapped to GPT2 */
+dmTimer.timerSettings[1].baseAddr = 0x68032000;
+/* dmTimer 2 mapped to GPT3 */
+dmTimer.timerSettings[2].baseAddr = 0x68034000;
+/* dmTimer 3 mapped to GPT4 */
+dmTimer.timerSettings[3].baseAddr = 0x68036000;
+/* dmTimer 4 mapped to GPT5 */
+dmTimer.timerSettings[4].baseAddr = 0x68820000;
+/* dmTimer 5 mapped to GPT6 */
+dmTimer.timerSettings[5].baseAddr = 0x68822000;
+/* dmTimer 6 mapped to GPT7 */
+dmTimer.timerSettings[6].baseAddr = 0x68034000;
+/* dmTimer 7 mapped to GPT8 */
+dmTimer.timerSettings[7].baseAddr = 0x68036000;
+/* dmTimer 8 mapped to GPT9 */
+dmTimer.timerSettings[8].baseAddr = 0x6803E000;
+/* dmTimer 9 mapped to GPT10 */
+dmTimer.timerSettings[9].baseAddr = 0x68086000;
+/* dmTimer 10 mapped to GPT11 */
+dmTimer.timerSettings[10].baseAddr = 0x68088000;
+/* dmTimer 11 mapped to GPT12 */
+dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
+/* dmTimer 12 mapped to GPT13 */
+dmTimer.timerSettings[12].baseAddr = 0x68828000;
+/* dmTimer 13 mapped to GPT14 */
+dmTimer.timerSettings[13].baseAddr = 0x6882A000;
+/* dmTimer 14 mapped to GPT15 */
+dmTimer.timerSettings[14].baseAddr = 0x6882C000;
+/* dmTimer 15 mapped to GPT16 */
+dmTimer.timerSettings[15].baseAddr = 0x6882E000;
+% } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ *
+ * 0x48034000 --> 0xA8034000 dmTimer0 mapped to GPT3
+ * 0x48036000 --> 0xA8036000 dmTimer1 mapped to GPT4
+ * 0x4803E000 --> 0xA803E000 dmTimer2 mapped to GPT9
+ * 0x48088000 --> 0xA8088000 dmTimer3 mapped to GPT11
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+dmTimer.timerSettings[0].baseAddr = 0xA8034000;
+dmTimer.timerSettings[1].baseAddr = 0xA8036000;
+dmTimer.timerSettings[2].baseAddr = 0xA803E000;
+dmTimer.timerSettings[3].baseAddr = 0xA8088000;
+% }
+
+/* use external timers because they keep running when IPU is not */
+var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
+halTimer.TimerProxy = dmTimer;
+
+/* Configure the SYS/BIOS clock to use external timer so that it keeps
+ * running when IPU is in low power mode. Must use TickSource_USER
+ * because we need special instance create parameters on the timer
+ * instance. Use dmTimer0 (GPTimer3) to driver the SYS/BIOS clock.
+ */
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+% if (lcCore.match(/^ipu1$/)) {
+/* Configure GPTimer11 as BIOS clock source */
+Clock.timerId = 10;
+% } else if (lcCore.match(/^ipu2$/)) {
+/* Configure GPTimer3 as BIOS clock source */
+Clock.timerId = 2;
+% }
+% }
+% else {
+Clock.timerId = 0;
+% }
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+timerParams.tiocpCfg.idlemode = 0x3; /* smart-idle wake-up-capable mode */
+timerParams.twer.ovf_wup_ena = 0x1; /* wake-up generation for overflow */
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* configure the IPU AMMU */
+xdc.loadCapsule("IpuAmmu.cfg");
+
+
+/*
+ * ======== Power Management Configuration ========
+ */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.arm.ducati.smp.Power');
+Power.loadSegment = "PM_DATA";
+
+/* idle functions, power management functions should be last */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+
+/* function to flush unicache on each core */
+Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
+Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
+
+/* power management idle functions for each core */
+% if ((!platform.match(/^DRA7XX_qnx_elf$/)) || (!core.match(/ipu1/i))) {
+Idle.addCoreFunc('&IpcPower_idle', 0);
+Idle.addCoreFunc('&IpcPower_idle', 1);
+% }
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* TODO: is this really needed */
+var Text = xdc.useModule('xdc.runtime.Text');
+Text.isLoaded = true;
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.ALWAYS_ON;
+Registry.common$.diags_INFO = Diags.ALWAYS_ON;
+Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
+Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+/* enable exception callstack backtrace */
+var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
+if (Program.build.profile == "debug") {
+ Hwi.enableException = true;
+}
+Hwi.nvicCCR.DIV_0_TRP = 1;
diff --git a/src/examples/templates/ex12_mmrpc/slave/IpuAmmu_dra7xx.cfg b/src/examples/templates/ex12_mmrpc/slave/IpuAmmu_dra7xx.cfg
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 3 small pages(1 4K and 2 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 16K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_16K;
+
+/* config small page[8] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50020000;
+AMMU.smallPages[8].translatedAddress = 0x55060000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large Page (512M); non-cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* TILER & DMM regions: Large page (512M); cacheable */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L1_posted = AMMU.PostedPolicy_POSTED;
diff --git a/src/examples/templates/ex12_mmrpc/slave/IpuAmmu_omap5.cfg b/src/examples/templates/ex12_mmrpc/slave/IpuAmmu_omap5.cfg
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 4 small pages(3 4K and 1 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 4K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_4K;
+
+/* config small page[8] to map 4K VA 0x50011000 to PA 0x55051000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50011000;
+AMMU.smallPages[8].translatedAddress = 0x55051000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/* config small page[9] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[9].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[9].logicalAddress = 0x50020000;
+AMMU.smallPages[9].translatedAddress = 0x55060000;
+AMMU.smallPages[9].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[9].size = AMMU.Small_4K;
+
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* TILER & DMM regions: Large page (512M); cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large Page (512M); non-cacheable, non-posted */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
diff --git a/src/examples/templates/ex12_mmrpc/slave/main_slave.c b/src/examples/templates/ex12_mmrpc/slave/main_slave.c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== MainIpu.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <ti/sysbios/BIOS.h>
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
diff --git a/src/examples/templates/ex12_mmrpc/slave/makefile_ipu b/src/examples/templates/ex12_mmrpc/slave/makefile_ipu
--- /dev/null
@@ -0,0 +1,174 @@
+#
+# Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var cfgBldDir = "shared"; /* by default, may be overridden */
+
+ if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ platInst = "ti.platforms.sdp5430:" + core;
+ } else if (platform.match(/^OMAPL138_linux_elf$/)) {
+ platInst = "ti.platforms.evmOMAPL138:" + lcCore;
+ cfgBldDir = "dsp";
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = main_ipu.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oem4,$(srcs)))
+libs = ../machvis/lib/$(PROFILE)/libmachvis_ipu.aem4
+CONFIG = bin/$(PROFILE)/configuro
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oem4.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all: debug release
+
+debug:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_ipu.x
+
+release:
+ $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_ipu.x
+
+server_ipu.x: bin/$(PROFILE)/server_ipu.xem4
+bin/$(PROFILE)/server_ipu.xem4: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ -u MachVis_startup $(objs) \
+ $(addprefix -l ,$(libs)) $(CONFIG)/linker.cmd $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.oem4: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/linker.cmd `PCT`/compiler.opt: $(CONFIG)/.config ;
+$(CONFIG)/.config: `core`.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../shared/config.bld -r $(PROFILE) \
+ --cfgArgs "{ configBld: \"../shared/config.bld\" }" \
+ `core`.cfg
+ @$(ECHO) "" > $@
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_ipu.xem4 $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_ipu.xem4 $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(ti.targets.arm.elf.M4)
+
+CC = $(CGTOOLS)/bin/armcl -c
+LD = $(CGTOOLS)/bin/armcl -z
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l $(CGTOOLS)/lib/rtsv7M4_T_le_eabi.lib
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex13_notifypeer/eve/Alg.c b/src/examples/templates/ex13_notifypeer/eve/Alg.c
--- /dev/null
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== Alg`core`.c ========
+ * Platform: `platform`
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Alg`core`__Desc
+#define MODULE_NAME "Alg`core`"
+
+/* package header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/Timestamp.h>
+#include <xdc/runtime/Types.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/Notify.h>
+
+/* local header files */
+#include "Alg`core`.h"
+#include "../shared/NotifyMsg.h"
+
+/* queue size, must be a power of 2 */
+#define Event_QSZ (1 << 4)
+
+/* queue structure */
+typedef struct
+{
+ UInt32 queue[Event_QSZ]; /* command queue */
+ UInt32 head; /* dequeue from head pointer */
+ UInt32 tail; /* enqueue at tail pointer */
+ UInt32 error; /* error flag */
+ Semaphore_Struct semObj; /* semaphore object */
+ Semaphore_Handle sem; /* semaphore handle */
+} Notify_Queue;
+
+/* module structure */
+typedef struct {
+ UInt16 peerId; /* MultiProc ID */
+ Notify_Queue notifyQ;
+} Alg`core`_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Int Mod_curInit = 0;
+static Alg`core`_Module Module;
+
+/* private functions */
+Void Alg`core`_doWork(UInt usec);
+Void Alg`core`_notifyCB(UInt16, UInt16, UInt32, UArg, UInt32);
+UInt32 Alg`core`_waitForEvent(Notify_Queue *queue);
+
+
+/*
+ * ======== Alg`core`_doWork ========
+ */
+Void Alg`core`_doWork(UInt usec)
+{
+ UInt32 start, now;
+ UInt32 count;
+ Types_FreqHz freq;
+ Task_Handle tid = Task_selfMacro();
+
+ /* latch the start timestamp */
+ start = Timestamp_get32();
+
+ /* compute delay in timestamp counts */
+ Timestamp_getFreq(&freq);
+ count = (freq.lo / 1000000) * usec;
+
+ do {
+ now = Timestamp_get32();
+ } while ((now - start) < count);
+
+}
+
+/*
+ * ======== Alg`core`_waitForEvent ========
+ */
+UInt32 Alg`core`_waitForEvent(Notify_Queue *queue)
+{
+ UInt32 event;
+
+ /* check for queue error */
+ if (queue->error >= NotifyMsg_E_FAILURE) {
+ event = queue->error;
+ }
+ else {
+ /* use counting semaphore to wait for next event */
+ Semaphore_pend(queue->sem, BIOS_WAIT_FOREVER);
+
+ /* remove next command from queue */
+ event = queue->queue[queue->head];
+ queue->head++;
+ }
+
+ return (event);
+}
+
+/*
+ * ======== Alg`core`_destroy ========
+ */
+Int Alg`core`_destroy(Void)
+{
+ Int status = 0;
+
+ Log_print0(Diags_ENTRY, "Alg`core`_destroy: -->");
+
+ /* reference count the module usage */
+ if (--Mod_curInit > 0) {
+ goto leave; /* object still in use */
+ }
+
+ /* unregister notify callback only with remote processors */
+ status = Notify_unregisterEventSingle(Module.peerId, 0, NotifyMsg_Evt_EVE);
+
+ if (status < 0) {
+ Log_error2("Alg`core`_destroy: notify unregister error, "
+ "procId=%d, error=%d", (IArg)Module.peerId, (IArg)status);
+ goto leave;
+ }
+
+ /* destruct the queue's semaphore */
+ Semaphore_destruct(&Module.notifyQ.semObj);
+ Module.notifyQ.sem = NULL;
+
+leave:
+ /* disable log events */
+ Log_print1(Diags_EXIT, "Alg`core`_destroy: <-- status=%d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+
+ return(status);
+}
+
+/*
+ * ======== Alg`core`_notifyCB ========
+ * This function runs with the notify callback disabled. It will not
+ * be preempted by another notify event.
+ */
+Void Alg`core`_notifyCB(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+ UInt32 payload)
+{
+ Notify_Queue *Q = (Notify_Queue *)arg;
+
+ /* handle ping message, reply with pong message */
+ if ((payload & 0xFFFF0000) == Notify_Evt_PING) {
+ Notify_sendEvent(procId, lineId, NotifyMsg_Evt_EVE, Notify_Evt_PONG,
+ FALSE);
+ }
+
+ /* if queue is full, set error flag */
+ else if ((Q->head + Event_QSZ) == Q->tail) {
+ Q->error = NotifyMsg_E_OVERFLOW;
+ }
+
+ /* save payload in queue, release waiting task */
+ else {
+ Q->queue[Q->tail % Event_QSZ] = payload;
+ Q->tail++;
+ Semaphore_post(Q->sem);
+ }
+}
+
+/*
+ * ======== Alg`core`_run ========
+ */
+Int Alg`core`_run(Void)
+{
+ Int status = 0;
+ UInt32 event;
+ Bool running = TRUE;
+ UInt16 procId;
+ UInt8 job;
+
+ Log_print0(Diags_ENTRY, "Alg`core`_run: -->");
+
+ while (running) {
+
+ /* wait for inbound event */
+ event = Alg`core`_waitForEvent(&Module.notifyQ);
+
+ if (event >= NotifyMsg_E_FAILURE) {
+ Log_error1("Alg`core`_run: event error 0x%x", (IArg)event);
+ goto leave;
+ }
+
+ /* extract data from event */
+ job = (UInt8)event;
+
+ Log_print1(Diags_INFO, "Alg`core`_run: event received, job=%d, ",
+ (IArg)job);
+
+ /* process the message */
+ Alg`core`_doWork(10000);
+
+ /* send message back */
+ status = Notify_sendEvent(Module.peerId, 0, NotifyMsg_Evt_EVE,
+ (UInt32)job, TRUE);
+
+ if (status < 0) {
+ Log_error2("Alg`core`_run: Notify_sendEvent error=%d, "
+ "procId=%d", (IArg)status, (IArg)procId);
+ goto leave;
+ }
+
+ Log_print2(Diags_INFO, "Alg`core`_run: event sent, procId=%d, job=%d",
+ (IArg)Module.peerId, (IArg)job);
+
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "Alg`core`_run: <-- status=%d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Alg`core`_setup ========
+ */
+Int Alg`core`_setup(UInt16 remoteProcId)
+{
+ Int status = 0;
+ Semaphore_Params semParams;
+ Registry_Result result;
+
+ /* reference count the module usage */
+ if (Mod_curInit >= 1) {
+ goto leave; /* already initialized */
+ }
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+FEX");
+ Log_print0(Diags_ENTRY, "Alg`core`_setup: -->");
+
+ /* initialize module state */
+ Module.peerId = remoteProcId;
+ Module.notifyQ.head = 0;
+ Module.notifyQ.tail = 0;
+ Module.notifyQ.error = NotifyMsg_S_SUCCESS;
+ Module.notifyQ.sem = NULL;
+
+ /* construct the semaphore for the queue */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_COUNTING;
+ Semaphore_construct(&Module.notifyQ.semObj, 0, &semParams);
+ Module.notifyQ.sem = Semaphore_handle(&Module.notifyQ.semObj);
+
+ /* register notify callback only with remote processors */
+ status = Notify_registerEventSingle(Module.peerId, 0,
+ NotifyMsg_Evt_EVE, Alg`core`_notifyCB, (UArg)(&Module.notifyQ));
+
+ if (status < 0) {
+ Log_error1("App`core`_setup: notify register error=%d", (IArg)status);
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Alg`core`_setup: slave is ready");
+
+leave:
+ /* success, increment reference count */
+ if (status >= 0) {
+ Mod_curInit++;
+ }
+
+ /* error handling */
+ else {
+ /* unregister diags mask */
+ /* release resources */
+ }
+
+ Log_print1(Diags_EXIT, "Alg`core`_setup: <-- status=%d", (IArg)status);
+ return(status);
+}
diff --git a/src/examples/templates/ex13_notifypeer/eve/Alg.h b/src/examples/templates/ex13_notifypeer/eve/Alg.h
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== Alg`core`.h ========
+ * Platform: `platform`
+ */
+
+#ifndef Alg`core`__include
+#define Alg`core`__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Int Alg`core`_destroy(Void);
+Int Alg`core`_run(Void);
+Int Alg`core`_setup(UInt16 procId);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex13_notifypeer/eve/Eve.cfg b/src/examples/templates/ex13_notifypeer/eve/Eve.cfg
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+xdc.useModule('xdc.runtime.Timestamp');
+
+xdc.useModule('ti.sdo.ipc.Notify');
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.global.procName = "`procName`";
+xdc.loadCapsule("../shared/ipc_multiproc.cfg.xs");
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+//Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Instrumented);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+/* configure the notify driver */
+var NotifySetup = xdc.useModule('ti.sdo.ipc.family.vayu.NotifySetup');
+
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "DSP1"
+ })
+);
+
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "DSP2"
+ })
+);
+%if (procName != "Eve1") {
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE1"
+ })
+);
+% }
+%if (procName != "Eve2") {
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE2"
+ })
+);
+% }
+%if (procName != "Eve3") {
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE3"
+ })
+);
+% }
+%if (procName != "Eve4") {
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE4"
+ })
+);
+% }
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "IPU1"
+ })
+);
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "IPU2"
+ })
+);
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "HOST"
+ })
+);
+
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+//Program.stack = 0x800; /* small stack needed to fit in DMEM */
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+//heapMemParams.size = 0x1400; /* small heap needed to fit in DMEM */
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* configure system module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+//SysMin.bufSize = 0x200; /* small buffer needed to fit in DMEM */
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+
+/* place text character table in external memory, too big for DMEM */
+var Text_charTab = new prog.SectionSpec();
+Text_charTab.loadSegment = "`procName`_PROG";
+Program.sectMap[".const:xdc_runtime_Text_charTab__A"] = Text_charTab;
+
+/* reduce size of idle stack, too big for DMEM */
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.idleTaskStackSize = 0x200;
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+BIOS.smpEnabled = false;
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex13_notifypeer/eve/MainEve.c b/src/examples/templates/ex13_notifypeer/eve/MainEve.c
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var tCore = core.replace(/-/,"_");
+%%}
+
+/*
+ * ======== Main`core`.c ========
+ * Platform: `platform`
+ */
+
+/* package header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/Notify.h>
+
+/* local header files */
+#include "Alg`core`.h"
+#include "../shared/NotifyMsg.h"
+
+/* private functions */
+static Void Main`core`_mainTskFxn(UArg arg0, UArg arg1);
+
+String peer = "DSP1"; /* name of peer processor */
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ UInt16 procId;
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* initialize the ipc layer (only with remote processors) */
+ procId = MultiProc_getId(peer);
+ Notify_attach(procId, 0);
+ Log_print0(Diags_INFO, "main: ipc ready");
+
+ /* create main thread */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "AlgTsk";
+ taskParams.priority = 3;
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x600;
+ Error_init(&eb);
+
+ Task_create(Main`core`_mainTskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create server thread");
+ }
+
+ Log_print0(Diags_INFO, "main: --> BIOS_start");
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== Main`core`_mainTskFxn ========
+ */
+Void Main`core`_mainTskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "Main`core`_svrTskFxn: -->");
+
+ /* server setup phase */
+ status = Alg`core`_setup(MultiProc_getId(peer));
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Alg`core`_run();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Alg`core`_destroy();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ Log_print1(Diags_EXIT | Diags_INFO, "Main`core`_svrTskFxn: <-- %d",
+ (IArg)status);
+}
diff --git a/src/examples/templates/ex13_notifypeer/eve/eve.gel b/src/examples/templates/ex13_notifypeer/eve/eve.gel
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2013-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== ex13_notifypeer_`lcCore`.gel ========
+ */
+
+#define UInt32 unsigned int
+#define WR_MEM_32(addr, data) *(UInt32*)(addr) = (UInt32)(data)
+#define RD_MEM_32(addr) *(UInt32*)(addr)
+
+
+/*
+ * TRM 19.5.2 MMU Registers
+ *
+ * 0000_0050 MMU_LOCK Table 19-42
+ * [14:10] BASEVALUE Locked entries base value
+ * [8:4] CURRENTVICTIM Current entry to be updated
+ *
+ * 0000_0058 MMU_CAM Table 19-46
+ * [31:12] VTAG Valid bit
+ * [3] P Preserved bit
+ * 0: TLB entry may be flushed
+ * 1: TLB entry is protected against flush
+ * [2] V Valid bit
+ * 0: TLB entry is invalid
+ * 1: TLB entry is valid
+ * [1:0] PAGESIZE Page size
+ * 0: Section (1 MB)
+ * 1: Large page (64 KB)
+ * 2: Small page (4 KB)
+ * 3: Supersection (16 MB)
+ *
+ * 0000_0058 MMU_RAM Table 19-48
+ * [31:12] PHYSICALADDR Physical address of the page
+ * [11:0] RESERVED
+ */
+
+% if (lcCore == "eve1") {
+#define EVE_MMU0 0x42081000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07B50 /* TRM 3.11.39.1 */
+% } else if (lcCore == "eve2") {
+#define EVE_MMU0 0x42181000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07B90 /* TRM 3.11.40.1 */
+% } else if (lcCore == "eve3") {
+#define EVE_MMU0 0x42281000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07BD0 /* TRM 3.11.41.1 */
+% } else if (lcCore == "eve4") {
+#define EVE_MMU0 0x42381000 /* TRM 19.5 */
+#define RM_EVE_RSTCTRL 0x4AE07C10 /* TRM 3.11.42.1 */
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+
+menuitem "EVE MMU Configuration"
+
+hotmenu ex13_notifypeer_`lcCore`_mmu_config()
+{
+ unsigned int val;
+ unsigned int PHY_ADDR;
+
+% if (lcCore == "eve1") {
+ PHY_ADDR = 0x80000000;
+% } else if (lcCore == "eve2") {
+ PHY_ADDR = 0x80400000;
+% } else if (lcCore == "eve3") {
+ PHY_ADDR = 0x80800000;
+% } else if (lcCore == "eve4") {
+ PHY_ADDR = 0x80C00000;
+% } else {
+% throw new Error("unsupported core: " + lcCore);
+% }
+
+ GEL_TextOut("`procName`_mmu_config start...\n");
+
+ /* map program vector table */
+ WR_MEM_32(EVE_MMU0+0x58, 0x0000000E); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, PHY_ADDR); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2800); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x0000_0000 --> 0x8000_0000 (4 KB)\n");
+
+ /* map program load address */
+ WR_MEM_32(EVE_MMU0+0x58, 0x8000000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x80000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2810); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x8000_0000 --> 0x8000_0000 (16 MB)\n");
+
+ /* map SR_0 */
+ WR_MEM_32(EVE_MMU0+0x58, 0x8E00000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x8E000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2820); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x8E00_0000 --> 0x8E00_0000 (16 MB)\n");
+
+ /* map L3/L4 */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4800000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x48000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2830); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4800_0000 --> 0x4800_0000 (16 MB)\n");
+
+ /* map Control Module */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4A00000C); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x4A000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2840); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4A00_0000 --> 0x4A00_0000 (1 MB)\n");
+
+ /* map EVE Mailbox */
+ WR_MEM_32(EVE_MMU0+0x58, 0x4200000F); /* CAM (va|size) */
+ WR_MEM_32(EVE_MMU0+0x5C, 0x42000000); /* RAM (pa) */
+ WR_MEM_32(EVE_MMU0+0x50, 0x2850); /* MMU LOCK */
+ WR_MEM_32(EVE_MMU0+0x54, 1); /* MMU_LD_TLB */
+ GEL_TextOut("`procName`_mmu_config: 0x4200_0000 --> 0x4200_0000 (16 MB)\n");
+
+ /* disable walking logic */
+ val = RD_MEM_32(EVE_MMU0+0x44); /* MMU_CNTL */
+ val &= 4;
+ WR_MEM_32(EVE_MMU0+0x44, val);
+
+ /* enable mmu */
+ val = RD_MEM_32(EVE_MMU0+0x44); /* MMU_CNTL */
+ val |= 2;
+ WR_MEM_32(EVE_MMU0+0x44, val);
+
+ GEL_TextOut("`procName`_mmu_config done\n");
+
+ /* setup reset vectors */
+ *(unsigned int *)(PHY_ADDR + 0x0) = PHY_ADDR + 0x30;
+ *(unsigned int *)(PHY_ADDR + 0x4) = PHY_ADDR + 0x30;
+ *(unsigned int *)(PHY_ADDR + 0x8) = PHY_ADDR + 0x30;
+
+ /* write idle instruction */
+ *(unsigned int *)(PHY_ADDR + 0x30) = 0x0000037F;
+ *(unsigned int *)(PHY_ADDR + 0x34) = 0x0000037F;
+
+ /* release cpu from reset */
+ *(unsigned int *)RM_EVE_RSTCTRL &= ~(0x1);
+
+ GEL_TextOut("`procName` cpu released from reset\n");
+}
diff --git a/src/examples/templates/ex13_notifypeer/eve/makefile b/src/examples/templates/ex13_notifypeer/eve/makefile
--- /dev/null
@@ -0,0 +1,178 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+
+ if (platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ if (target.match(/\.ARP32(_far|)$/)) {
+ cc = "bin/cl-arp32";
+ lnk = "bin/cl-arp32 -z";
+ ldlibs = "$(CGTOOLS)/lib/rtsarp32_v200.lib"
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Alg`core`.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug alg_`lcCore`.x
+# $(MAKE) PROFILE=release alg_`lcCore`.x
+
+alg_`lcCore`.x: bin/$(PROFILE)/alg_`lcCore`.x`suffix`
+bin/$(PROFILE)/alg_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: `core`.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" `core`.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/alg_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ $(CP) ex01_alg_`lcCore`.gel $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/alg_`lcCore`.x`suffix` $(EXEC_DIR)/release
+ $(CP) ex01_alg_`lcCore`.gel $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex13_notifypeer/host/App.h b/src/examples/templates/ex13_notifypeer/host/App.h
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== App.h ========
+ *
+ */
+
+#ifndef App__include
+#define App__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Int App_create(UInt16 remoteProcId);
+Int App_delete();
+Int App_exec();
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* App__include */
diff --git a/src/examples/templates/ex13_notifypeer/host/App_bios.c b/src/examples/templates/ex13_notifypeer/host/App_bios.c
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== App.c ========
+ */
+
+/* package header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+
+#include <ti/sysbios/heaps/HeapBuf.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+#include "App.h"
+
+/* round up the value 'size' to the next 'align' boundary */
+#define ROUNDUP(size, align) \
+ (UInt32)(((UInt32)(size) + ((UInt32)(align) - 1)) & ~((UInt32)(align) - 1))
+
+#define NUM_MSGS 4
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; // created locally
+ MessageQ_QueueId slaveQue; // opened remotely
+ UInt16 heapId; // MessageQ heapId
+ HeapBuf_Handle heap; // message heap
+ Int msgSize; // aligned size of message
+ Int poolSize; // size of message pool
+ Ptr store; // memory store for message pool
+} App_Module;
+
+/* private data */
+static App_Module Module;
+
+
+/*
+ * ======== App_create ========
+ */
+
+Int App_create(UInt16 remoteProcId)
+{
+ Int status = 0;
+ Int align;
+ Error_Block eb;
+ IHeap_Handle srHeap;
+ HeapBuf_Params heapParams;
+ MessageQ_Params msgqParams;
+
+ Log_print0(Diags_INFO, "App_create: -->");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = App_MsgHeapId;
+ Module.msgSize = 0;
+
+ /* compute message size to fill entire cache lines */
+ align = SharedRegion_getCacheLineSize(0);
+ Module.msgSize = ROUNDUP(sizeof(App_Msg), align);
+
+ /* compute message pool size */
+ Module.poolSize = Module.msgSize * NUM_MSGS;
+
+ /* acquire message pool memory */
+ srHeap = (IHeap_Handle)SharedRegion_getHeap(0);
+ Module.store = Memory_alloc(srHeap, Module.poolSize, align, NULL);
+
+ /* create a heap in shared memory for message pool */
+ HeapBuf_Params_init(&heapParams);
+ heapParams.blockSize = Module.msgSize;
+ heapParams.numBlocks = NUM_MSGS;
+ heapParams.bufSize = Module.poolSize;
+ heapParams.align = align;
+ heapParams.buf = Module.store;
+ Error_init(&eb);
+
+ Module.heap = HeapBuf_create(&heapParams, &eb);
+
+ if (Module.heap == NULL) {
+ Log_error0("App_create: failed creating message pool");
+ status = -1;
+ goto leave;
+ }
+
+ /* bind message pool to heapId */
+ MessageQ_registerHeap((Ptr)(Module.heap), App_MsgHeapId);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(NULL, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ Log_error0("App_create: failed creating MessageQ");
+ status = -1;
+ goto leave;
+ }
+
+ /* open the server message queue */
+ do {
+ status = MessageQ_open(App_ServerQue, &Module.slaveQue);
+ Task_sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("App_create: failed opening MessageQ");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO, "App_create: Host is ready");
+
+leave:
+ Log_print1(Diags_INFO, "App_create: <-- status=%d", (IArg)status);
+ return(status);
+}
+
+
+/*
+ * ======== App_delete ========
+ */
+Int App_delete(Void)
+{
+ Int status;
+ IHeap_Handle srHeap;
+
+ Log_print0(Diags_INFO, "App_delete: -->");
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* unregister message pool heap */
+ MessageQ_unregisterHeap(App_MsgHeapId);
+
+ /* delete the message pool heap */
+ HeapBuf_delete(&Module.heap);
+
+ /* release message pool memory */
+ srHeap = (IHeap_Handle)SharedRegion_getHeap(0);
+ Memory_free(srHeap, Module.store, Module.poolSize);
+
+leave:
+ Log_print1(Diags_INFO, "App_delete: <-- status=%d", (IArg)status);
+ return(status);
+}
+
+
+/*
+ * ======== App_exec ========
+ */
+Int App_exec(Void)
+{
+ Int status;
+ Int i;
+ App_Msg * msg;
+
+ Log_print0(Diags_INFO, "App_exec: -->");
+
+ /* send messages to server */
+ for (i = 1; i <= 11; i++) {
+ Log_print1(Diags_INFO, "App_exec: sending message %d", (IArg)i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ if (i == 11) {
+ /* last message will tell the slave to shutdown */
+ msg->cmd = App_CMD_SHUTDOWN;
+ }
+ else {
+ msg->cmd = App_CMD_PROCESS;
+ msg->job = i;
+ }
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ Log_print1(Diags_INFO, "App_exec: return message received, jobs=%d",
+ (IArg)i);
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+
+leave:
+ Log_print1(Diags_INFO, "App_exec: <-- status=%d", (IArg)status);
+ return(status);
+}
diff --git a/src/examples/templates/ex13_notifypeer/host/Host.cfg b/src/examples/templates/ex13_notifypeer/host/Host.cfg
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.platform;
+%%}
+
+/*
+ * ======== Host.cfg ========
+ * Platform: `platform`
+ * Target: gnu.targets.arm.A15F
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.IHeap');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Memory');
+xdc.useModule('xdc.runtime.System');
+
+xdc.useModule('ti.sdo.ipc.Ipc');
+xdc.useModule('ti.sdo.ipc.MessageQ');
+xdc.useModule('ti.sdo.ipc.SharedRegion');
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+xdc.useModule('ti.sysbios.heaps.HeapBuf');
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.global.procName = "HOST";
+xdc.loadCapsule("../shared/ipc_multiproc.cfg.xs");
+xdc.global.SR0_cacheEnable = true;
+xdc.loadCapsule("../shared/ipc_sr0.cfg.xs");
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+//Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Instrumented);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex13_notifypeer/host/main_bios.c b/src/examples/templates/ex13_notifypeer/host/main_bios.c
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== Main`core`.c ========
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "App.h"
+
+/* private functions */
+Void App_taskFxn(UArg arg0, UArg arg1);
+
+/* define server processor name */
+#define SERVER "DSP1"
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "App_taskFxn";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Error_init(&eb);
+
+ Task_create(App_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== App_taskFxn ========
+ */
+Void App_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status;
+ UInt16 remoteProcId;
+
+ Log_print0(Diags_INFO, "App_taskFxn: -->");
+
+ /*
+ * initialize the ipc layer
+ */
+ status = Ipc_start();
+
+ if (status < 0) {
+ System_abort("Ipc_start failed\n");
+ }
+
+ remoteProcId = MultiProc_getId(SERVER);
+ do {
+ status = Ipc_attach(remoteProcId);
+
+ } while ((status < 0) && (status == Ipc_E_NOTREADY));
+
+ Log_print0(Diags_INFO, "App_taskFxn: ipc ready");
+
+ /* application create phase */
+ status = App_create(remoteProcId);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = App_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = App_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ Log_print1(Diags_INFO, "App_taskFxn: <-- status=%d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex13_notifypeer/host/makefile_bios b/src/examples/templates/ex13_notifypeer/host/makefile_bios
--- /dev/null
@@ -0,0 +1,167 @@
+#
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var suffix = "";
+ var platInst = "";
+ var csprefix = "";
+
+ if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:host";
+ suffix = "a15fg";
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ /* gnu.targets.arm.A15F */
+ csprefix = "gnu.targets.arm.A15F";
+ cc = "/bin/arm-none-eabi-gcc";
+ lnk = "/bin/arm-none-eabi-gcc";
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = MainHost.c App.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug app_host.x
+# $(MAKE) PROFILE=release app_host.x
+
+app_host.x: bin/$(PROFILE)/app_host.x`suffix`
+bin/$(PROFILE)/app_host.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) -o $@ $(LDFLAGS) $(objs) $(libs) -Wl,-T,$(CONFIG)/linker.cmd \
+ -lgcc -lc -lm -lnosys $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: Host.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t gnu.targets.arm.A15F \
+ -c $(gnu.targets.arm.A15F) \
+ -p `platInst` \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" Host.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(`csprefix`)`cc` -c -MD -MF $@.dep
+%// unused
+%// AR = $(CS_A15_PREFIX)ar cr
+LD = $(`csprefix`)`cc`
+
+CPPFLAGS = -Dfar= -D__DYNAMIC_REENT__
+CFLAGS = -Wall -Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections $(CCPROFILE_$(PROFILE)) @$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -mfloat-abi=hard -nostartfiles -Wl,-static -Wl,--gc-sections -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -L$(XDC_INSTALL_DIR)/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/fpu
+
+CCPROFILE_debug = -g -ggdb -D_DEBUG_=1
+CCPROFILE_release = -O2
+
+LDPROFILE_debug = -g -ggdb
+LDPROFILE_release =
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex13_notifypeer/makefile b/src/examples/templates/ex13_notifypeer/makefile
--- /dev/null
@@ -0,0 +1,103 @@
+#
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ALL = dsp1 dsp2 eve1 eve2 eve3 eve4 host
+PROCLIST = dsp1 host
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+
+all: $(PROCLIST)
+
+$(PROCLIST):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+EXEC_DIR=$(CURDIR)/install
+endif
+override EXEC_DIR:=$(EXEC_DIR)/ex02_messageq
+endif
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+clean:: $(addsuffix _clean,$(ALL))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(ALL))::
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex13_notifypeer/mkpkg.xdt b/src/examples/templates/ex13_notifypeer/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,68 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt @verbatim
+
+shared/AppCommon.h -> `this.example`/shared/AppCommon.h
+shared/config_dra7xx.bld -> `this.example`/shared/config.bld
+shared/ipc_multiproc.cfg.xs -> `this.example`/shared/ipc_multiproc.cfg.xs
+shared/ipc_sr0.cfg.xs -> `this.example`/shared/ipc_sr0.cfg.xs
+shared/NotifyMsg.h -> `this.example`/shared/NotifyMsg.h
+
+% if (this.hostOS == "bios") {
+host/main_bios.c -> `this.example`/host/MainHost.c
+host/makefile_bios -> `this.example`/host/makefile
+host/Host.cfg -> `this.example`/host/Host.cfg
+host/App_bios.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+% } else {
+% throw new Error("unsupported host operating system: " + this.hostOS);
+% }
+
+%%{
+ var outdir = "";
+
+ if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+
+ /* DSP1-2 */
+ for (var j = 1; j <= 2; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Slave.cfg", outFile: outdir + "/Dsp" + j + ".cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_bios.c", outFile: outdir + "/MainDsp" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+
+ /* EVE1-4 */
+ for (var j = 1; j <= 4; j++) {
+ outdir = "eve" + j;
+ var files = [
+ { inFile: "eve/Eve.cfg", outFile: outdir + "/Eve" + j + ".cfg" },
+ { inFile: "eve/MainEve.c", outFile: outdir + "/MainEve" + j + ".c" },
+ { inFile: "eve/Alg.c", outFile: outdir + "/AlgEve" + j + ".c" },
+ { inFile: "eve/Alg.h", outFile: outdir + "/AlgEve" + j + ".h" },
+ { inFile: "eve/eve.gel", outFile: outdir + "/ex13_notifypeer_eve" + j + ".gel" },
+ { inFile: "eve/makefile", outFile: outdir + "/makefile" },
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Eve" + j, "earp32F", "ti.targets.arp32.elf.ARP32_far");
+ }
+ }
+ }
+%%}
diff --git a/src/examples/templates/ex13_notifypeer/products.mak b/src/examples/templates/ex13_notifypeer/products.mak
--- /dev/null
@@ -0,0 +1,130 @@
+#
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ var isLinux = this.platform.match(/_linux_/);
+ var isQnx = this.platform.match(/_qnx_/);
+%%}
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+% if (isLinux) {
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+% } else if (isQnx) {
+#### QNX toolchain ####
+#QNX_INSTALL_DIR = $(DEPOT)/_your_qnx_install_
+% }
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C64T = $(DEPOT)/_your_ti_codegen_install_
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+#ti.targets.elf.C674 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^OMAP54XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C64T = $(DEPOT)/_your_ti_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+#gnu.targets.arm.A15F = $(DEPOT)/_your_gnu_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.arp32.elf.ARP32_far = $(DEPOT)/_your_ti_arm_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+% if (isLinux) {
+ @echo "HOST TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+% } else if (isQnx) {
+ @echo "QNX_INSTALL_DIR = $(QNX_INSTALL_DIR)"
+% }
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C64T = $(ti.targets.elf.C64T)"
+% } else if (this.platform.match(/^OMAP54XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C64T = $(ti.targets.elf.C64T)"
+% } else if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ @echo "ti.targets.elf.C674 = $(ti.targets.elf.C674)"
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+ @echo "gnu.targets.arm.A15F = $(gnu.targets.arm.A15F)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.arp32.elf.ARP32_far = $(ti.targets.arp32.elf.ARP32_far)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex13_notifypeer/readme.txt b/src/examples/templates/ex13_notifypeer/readme.txt
--- /dev/null
@@ -0,0 +1,120 @@
+#
+# ======== readme.txt ========
+#
+notify peer - use only notify to communicate to a peer processor
+
+Overview
+=========================================================================
+This is an example of IPC Scalability. It uses the client/server design
+pattern. Initially, the example builds only for two processors: HOST and
+DSP1. The client runs on HOST and the server runs on DSP1.
+
+The client (HOST) creates an anonymous message queue. The client also
+creates and manages its own message pool. And it opens the server message
+queue using its name. The client initiates the data flow by allocating
+a message from the pool, placing its return address in the message header
+and sending the message to the server. It then waits for the message to
+be returned. When it receives the return message, the message is returned
+to the pool. The client repeats this in a loop.
+
+The server (DSP1) creates a named message queue, then waits on it for
+messages. When a message arrives, the server performs the requested work.
+When the work is done, the server extracts the return address from the
+message header and sends the message back to the client. The server never
+opens any message queues and does not access the message pool.
+
+Build and run the example to become familiar with the execution flow.
+
+In part 2, you will add EVE1 as a peer processor to DSP1. However, the
+DSP1 to EVE1 transport will be scaled down to just the notify layer. DSP1
+will use EVE1 to help processes the messages received from the client.
+
+Since DSP1 will need to wait on both the message queue and the notify queue,
+we introduce events. The SYS/BIOS event object can be used to wait on
+multiple input sources.
+
+
+Build Instructions
+=========================================================================
+
+ 1. Create a work folder on your file system.
+
+ mkdir work
+
+ 2. Extract this example into your work folder.
+
+ cd work
+ unzip .../ex13_notifypeer.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ edit ex13_notifypeer/products.mak
+
+ IPC_INSTALL_DIR = .../ipc_m_mm_pp_bb
+ BIOS_INSTALL_DIR = .../bios_m_mm_pp_bb
+ XDC_INSTALL_DIR = .../xdctools_m_mm_pp_bb
+
+ The compilers ship with CCS. You can use them to build this example.
+
+ edit ex13_notifypeer/products.mak
+
+ CCS = .../ccsv6/tools/compiler
+
+ gnu.targets.arm.A15F = $(CCS)/gcc_arm_none_eabi_m_m_p
+ ti.targets.elf.C66 = $(CCS)/c6000_m_m_p
+ ti.targets.arm.elf.M4 = $(CCS)/arm_m_m_p
+ ti.targets.arp32.elf.ARP32_far = $(CCS)/arp32_m_m_p
+
+ 4. Build the example. This will build only debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ex13_notifypeer
+ make
+
+ By default, the example builds for host and dsp1. Look in the following
+ folders for the executables.
+
+ ex13_notifypeer/host/bin/debug/app_host.xa15fg
+ ex13_notifypeer/dsp1/bin/debug/server_dsp1.xe66
+
+ 5. Issue the following commands to clean your example.
+
+ cd ex13_notifypeer
+ make clean
+
+
+Part 2: Adding EVE1
+=========================================================================
+To add EVE1 as a peer processor to DSP1, you will need to modify the
+top-level makefile and the DSP1 source file. Follow the instructions
+below.
+
+ 1. Add eve1 to the processor list. Edit the top-level makefile and
+ add eve1 the the PROCLIST macro. This will instruct make to also
+ build in the eve1 folder.
+
+ edit ex13_notifypeer/makefile
+
+ PROCLIST = dsp1 eve1 host
+
+ 2. Enable eve1 communication in the dsp1 source file. Edit the server
+ source file and uncomment the EVE macro.
+
+ edit ex13_notifypeer/dsp1/Server.c
+
+ /* define the EVE peer */
+ #define EVE "EVE1"
+
+ 3. Rebuild the example.
+
+ cd ex13_notifypeer
+ make
+
+ You should see a rebuild of dsp1 and a new build of eve1. Look for the
+ new eve executable in the following folder.
+
+ ex13_notifypeer/eve1/bin/debug/alg_eve1.xearp32F
diff --git a/src/examples/templates/ex13_notifypeer/shared/AppCommon.h b/src/examples/templates/ex13_notifypeer/shared/AppCommon.h
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== AppCommon.h ========
+ *
+ */
+
+#ifndef AppCommon__include
+#define AppCommon__include
+
+#include <ti/ipc/MessageQ.h>
+#include <ti/sysbios/knl/Queue.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*
+ * ======== Application Configuration ========
+ */
+
+/* notify commands 00 - FF */
+#define App_CMD_MASK 0xFF000000
+#define App_CMD_NOP 0x00000000 /* cc------ */
+#define App_CMD_PROCESS 0x01000000 /* cc------ */
+#define App_CMD_SHUTDOWN 0x02000000 /* cc------ */
+
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ Queue_Elem elem;
+
+ UInt32 cmd;
+ UInt32 job;
+} App_Msg;
+
+#define App_MsgHeapId 0
+#define App_ServerQue "ServerQue"
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* AppCommon__include */
diff --git a/src/examples/templates/ex13_notifypeer/shared/NotifyMsg.h b/src/examples/templates/ex13_notifypeer/shared/NotifyMsg.h
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== NotifyMsg.h ========
+ *
+ */
+
+#ifndef NotifyMsg__include
+#define NotifyMsg__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define NotifyMsg_NUM_JOBS 5 /* number of message to send each server */
+
+#define NotifyMsg_Evt_EVE 7 /* eve event number */
+#define NotifyMsg_Evt_Appl 15 /* application event number */
+
+#define Notify_Evt_PING 0xFFFE0000 /* FFFE eeee */
+#define Notify_Evt_PONG 0xFFFFFFFF
+
+#define NotifyMsg_Cmd_NOP 0x0
+#define NotifyMsg_Cmd_PONG 0x1
+#define NotifyMsg_Cmd_PROCESS 0x2 /* has ack */
+#define NotifyMsg_Cmd_DONE 0x3
+#define NotifyMsg_Cmd_STOP 0x4 /* has ack */
+#define NotifyMsg_Cmd_PROCESSACK 0xA
+#define NotifyMsg_Cmd_STOPACK 0xB
+
+#define NotifyMsg_S_EMPTY 0x00000000
+#define NotifyMsg_S_SUCCESS 0x00000000
+#define NotifyMsg_E_FAILURE 0x80000000
+#define NotifyMsg_E_OVERFLOW 0x90000000
+#define NotifyMsg_E_NOEVENT 0xA0000000
+
+//#define NotifyMsg_CMD_MASK 0xFF000000 /* cc------ */
+//#define NotifyMsg_PAYLOAD_MASK 0x00FFFFFF /* --pppppp */
+
+/* event format
+ *
+ * ssss---- ppppiiii cccc---- yyyyyyyy
+ *
+ * [31:28] (s) success/error code
+ * [27:24] (-) unused
+ * [23:20] (p) sender processor ID
+ * [19:16] (i) reply event ID
+ * [15:12] (c) command
+ * [11:8] (-) unused
+ * [7:0] (y) payload
+ */
+#define NotifyMsg_getProcId(event) (UInt16)((0x00F00000 & (event)) >> 20)
+#define NotifyMsg_getEventId(event) (UInt)((0x000F0000 & (event)) >> 16)
+#define NotifyMsg_getCmd(event) (UInt)((0x0000F000 & (event)) >> 12)
+#define NotifyMsg_getPayload(event) (UInt8)(0x000000FF & (event))
+
+#define NotifyMsg_setProcId(event, procId) \
+ (event = (((event) & 0xFF0FFFFF) | (((UInt32)(procId) & 0xF) << 20)))
+
+#define NotifyMsg_setEventId(event, eventId) \
+ (event = (((event) & 0xFFF0FFFF) | (((UInt32)(eventId) & 0xF) << 16)))
+
+#define NotifyMsg_setCmd(event, cmd) \
+ (event = (((event) & 0xFFFF0FFF) | (((UInt32)(cmd) & 0xF) << 12)))
+
+#define NotifyMsg_setPayload(event, payload) \
+ (event = (((event) & 0xFFFFFF00) | ((UInt32)(payload) & 0xFF)))
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex13_notifypeer/shared/config_dra7xx.bld b/src/examples/templates/ex13_notifypeer/shared/config_dra7xx.bld
--- /dev/null
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_0000 8000_0000 1000 ( 4 KB) EVE1_VECS (vector table)
+ * 8000_1000 3F_F000 ( ~4 MB) EVE1_PROG (code, data)
+ * 0000_0000 8040_0000 1000 ( 4 KB) EVE2_VECS (vector table)
+ * 8040_1000 3F_F000 ( ~4 MB) EVE2_PROG (code, data)
+ * 0000_0000 8080_0000 1000 ( 4 KB) EVE3_VECS (vector table)
+ * 8080_1000 3F_F000 ( ~4 MB) EVE3_PROG (code, data)
+ * 0000_0000 80C0_0000 1000 ( 4 KB) EVE4_VECS (vector table)
+ * 80C0_1000 3F_F000 ( ~4 MB) EVE4_PROG (code, data)
+ * 8100_0000 100_0000 ( 16 MB) --------
+ * 8200_0000 100_0000 ( 16 MB) --------
+ * 8300_0000 100_0000 ( 16 MB) --------
+ * 8400_0000 100_0000 ( 16 MB) --------
+ * 8500_0000 100_0000 ( 16 MB) --------
+ * 8600_0000 100_0000 ( 16 MB) IPU1 (code, data) [1]
+ * 8600_0000 80_0000 ( 8 MB) IPU1-0 (code, data) [1]
+ * 8680_0000 80_0000 ( 8 MB) IPI1-1 (code, data) [1]
+ * 8700_0000 100_0000 ( 16 MB) --------
+ * 8800_0000 100_0000 ( 16 MB) --------
+ * 8900_0000 100_0000 ( 16 MB) --------
+ * 8A00_0000 100_0000 ( 16 MB) IPU2 (code, data) [2]
+ * 8B00_0000 100_0000 ( 16 MB) HOST (code, data)
+ * 8C00_0000 100_0000 ( 16 MB) DSP1 (code, data)
+ * 8D00_0000 100_0000 ( 16 MB) DSP2 (code, data)
+ * 8E00_0000 100_0000 ( 16 MB) SR_0 (ipc)
+ * 8F00_0000 100_0000 ( 16 MB) --------
+ *
+ * Notes
+ * ------------------------------------------------------------------------
+ * [1] IPU1 implies SMP mode; IPU1-0, IPU1-1 implies non-SMP mode. You
+ * cannot use both at the same time.
+ *
+ * [2] IPU2 implies SMP mode.
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x8E000000, len: 0x1000000,
+ comment: "SR#0 Memory (16 MB)"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "DSP1_PROG", {
+ name: "DSP1_PROG", space: "code/data", access: "RWX",
+ base: 0x8C000000, len: 0x1000000,
+ comment: "DSP1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP1_PROG",
+ dataMemory: "DSP1_PROG",
+ stackMemory: "DSP1_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] = {
+ externalMemoryMap: [
+ [ "DSP2_PROG", {
+ name: "DSP2_PROG", space: "code/data", access: "RWX",
+ base: 0x8D000000, len: 0x1000000,
+ comment: "DSP2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "DSP2_PROG",
+ dataMemory: "DSP2_PROG",
+ stackMemory: "DSP2_PROG",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "128k"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve1"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80000000, len: 0x1000, page: 0,
+ comment: "EVE1 Vector Table (4 KB)"
+ }],
+ [ "EVE1_PROG", {
+ name: "EVE1_PROG", space: "code/data", access: "RWX",
+ base: 0x80001000, len: 0x3FF000, page: 1,
+ comment: "EVE1 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE1_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE1_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve2"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80400000, len: 0x1000, page: 0,
+ comment: "EVE2 Vector Table (4 KB)"
+ }],
+ [ "EVE2_PROG", {
+ name: "EVE2_PROG", space: "code/data", access: "RWX",
+ base: 0x80401000, len: 0x3FF000, page: 1,
+ comment: "EVE2 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE2_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE2_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE2_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve3"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80800000, len: 0x1000, page: 0,
+ comment: "EVE3 Vector Table (4 KB)"
+ }],
+ [ "EVE3_PROG", {
+ name: "EVE3_PROG", space: "code/data", access: "RWX",
+ base: 0x80801000, len: 0x3FF000, page: 1,
+ comment: "EVE3 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE3_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE3_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE3_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:eve4"] = {
+ externalMemoryMap: [
+ [ "EVEVECS", { /* name used by SYS/BIOS */
+ name: "EVEVECS", space: "code/data", access: "RWX",
+ base: 0x80C00000, len: 0x1000, page: 0,
+ comment: "EVE4 Vector Table (4 KB)"
+ }],
+ [ "EVE4_PROG", {
+ name: "EVE4_PROG", space: "code/data", access: "RWX",
+ base: 0x80C01000, len: 0x3FF000, page: 1,
+ comment: "EVE4 Program Memory (~4 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "EVE4_PROG",
+// dataMemory: "DMEM",
+ dataMemory: "EVE4_PROG",
+// stackMemory: "DMEM"
+ stackMemory: "EVE4_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "IPU1_PROG", {
+ name: "IPU1_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x1000000,
+ comment: "IPU1 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_PROG",
+ dataMemory: "IPU1_PROG",
+ stackMemory: "IPU1_PROG"
+};
+
+var ipu1_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-0"] = {
+ externalMemoryMap: [
+ [ "IPU1_0_PROG", {
+ name: "IPU1_0_PROG", space: "code/data", access: "RWX",
+ base: 0x86000000, len: 0x800000,
+ comment: "IPU1-0 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_0_PROG",
+ dataMemory: "IPU1_0_PROG",
+ stackMemory: "IPU1_0_PROG"
+};
+
+var ipu1_0_ammu = {
+ prog: { /* program memory */
+ pa: 0x86000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1-1"] = {
+ externalMemoryMap: [
+ [ "IPU1_1_PROG", {
+ name: "IPU1_1_PROG", space: "code/data", access: "RWX",
+ base: 0x86800000, len: 0x800000,
+ comment: "IPU1-1 Program Memory (8 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU1_1_PROG",
+ dataMemory: "IPU1_1_PROG",
+ stackMemory: "IPU1_1_PROG"
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "IPU2_PROG", {
+ name: "IPU2_PROG", space: "code/data", access: "RWX",
+ base: 0x8A000000, len: 0x1000000,
+ comment: "IPU2 Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "IPU2_PROG",
+ dataMemory: "IPU2_PROG",
+ stackMemory: "IPU2_PROG"
+};
+
+var ipu2_ammu = {
+ prog: { /* program memory */
+ pa: 0x8A000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ sr0: { /* SR_0 data memory (non-cacheable) */
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:host"] = {
+ externalMemoryMap: [
+ [ "HOST_PROG", {
+ name: "HOST_PROG", space: "code/data", access: "RWX",
+ base: 0x8B000000, len: 0x1000000,
+ comment: "HOST Program Memory (16 MB)"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "HOST_PROG",
+ dataMemory: "HOST_PROG",
+ stackMemory: "HOST_PROG"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex13_notifypeer/shared/ipc_multiproc.cfg.xs b/src/examples/templates/ex13_notifypeer/shared/ipc_multiproc.cfg.xs
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc_multiproc.cfg.xs ========
+ */
+
+/* configure processor names */
+% if (this.platform.match(/^DRA7XX_bios_elf$/)) {
+var procNameAry = [
+ "DSP1", "DSP2",
+ "EVE1", "EVE2", "EVE3", "EVE4",
+ "IPU1", "IPU2",
+ "HOST"
+];
+% } else {
+% throw ("Unsupported platform: " + platform);
+% }
+
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(xdc.global.procName, procNameAry);
diff --git a/src/examples/templates/ex13_notifypeer/shared/ipc_sr0.cfg.xs b/src/examples/templates/ex13_notifypeer/shared/ipc_sr0.cfg.xs
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+/* ipc configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+Ipc.sr0MemorySetup = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: 0,
+ isValid: true,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
diff --git a/src/examples/templates/ex13_notifypeer/slave/Server.c b/src/examples/templates/ex13_notifypeer/slave/Server.c
--- /dev/null
@@ -0,0 +1,525 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== Server.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/Timestamp.h>
+#include <xdc/runtime/Types.h>
+
+#include <stdio.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/Notify.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/knl/Event.h>
+#include <ti/sysbios/knl/Queue.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/syncs/SyncSem.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+#include "../shared/NotifyMsg.h"
+
+/* module header file */
+#include "Server.h"
+
+/* define the EVE peer */
+//#define EVE "EVE1"
+
+/* queue size, must be a power of 2 */
+#define Event_QSZ (1 << 4)
+
+#if defined(EVE)
+/* ipc handshake object */
+typedef struct {
+ Semaphore_Handle sem;
+ struct Semaphore_Struct semObj; /* block caller until pong recv'd */
+} Handshake;
+#endif
+
+/* queue structure */
+typedef struct {
+ UInt32 queue[Event_QSZ]; /* command queue */
+ UInt32 head; /* dequeue from head pointer */
+ UInt32 tail; /* enqueue at tail pointer */
+ UInt32 error; /* error flag */
+} Notify_Queue;
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; /* host processor id */
+ UInt16 eveProcId; /* eve processor id */
+ MessageQ_Handle messageQ; /* created locally */
+ Notify_Queue notifyQ; /* receive events from eve */
+#if defined(EVE)
+ Queue_Handle holdQ;
+ Event_Handle event;
+ Semaphore_Handle sem;
+ SyncSem_Handle sync;
+#endif
+} Server_Module;
+
+/* private functions */
+Void Server_doWork(Void);
+UInt32 Server_dequeueEvent(Notify_Queue *Q);
+Void Server_notifyCB(UInt16, UInt16, UInt32, UArg, UInt32);
+Void Server_pingFxn(UArg arg);
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+#if defined(EVE)
+static Handshake IpcHandshake;
+#endif
+
+
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+#if defined(EVE)
+ Module.eveProcId = MultiProc_getId(EVE);
+#else
+ Module.eveProcId = MultiProc_INVALIDID;
+#endif
+ Module.messageQ = NULL;
+ Module.notifyQ.head = 0;
+ Module.notifyQ.tail = 0;
+ Module.notifyQ.error = NotifyMsg_S_SUCCESS;
+}
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ UInt16 remoteProcId;
+#if defined(EVE)
+ Event_Params eventP;
+ Semaphore_Params semP;
+ SyncSem_Params syncSemP;
+ Clock_Params clockP;
+ Clock_Handle pingPRD;
+#endif
+ MessageQ_Params msgQueP;
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+#if defined(EVE)
+ /* setup IPC-notify with eve processor */
+ Notify_attach(Module.eveProcId, 0);
+
+ /* register notify callback */
+ status = Notify_registerEventSingle(Module.eveProcId, 0,
+ NotifyMsg_Evt_EVE, Server_notifyCB, (UArg)(&Module.notifyQ));
+
+ if (status < 0) {
+ Log_error1("Server_create: notify register error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* initialize the handshake object */
+ Semaphore_Params_init(&semP);
+ semP.mode = Semaphore_Mode_BINARY;
+ Semaphore_construct(&IpcHandshake.semObj, 0, &semP);
+ IpcHandshake.sem = Semaphore_handle(&IpcHandshake.semObj);
+
+ /* create periodic function to ping eve processor */
+ Clock_Params_init(&clockP);
+ clockP.arg = NULL;
+ clockP.period = 2;
+ clockP.startFlag = TRUE;
+ pingPRD = Clock_create(Server_pingFxn, 1, &clockP, NULL);
+
+ /* block until pong message is received */
+ Semaphore_pend(IpcHandshake.sem, BIOS_WAIT_FOREVER);
+
+ /* stop the ping function */
+ Clock_stop(pingPRD);
+ Task_sleep(5);
+ Clock_delete(&pingPRD);
+#endif
+
+ /* setup IPC-full with host processor */
+ status = Ipc_start();
+
+ if (status < 0) {
+ Log_error1("Server_create: Ipc_start failed, error=%d", (IArg)status);
+ goto leave;
+ }
+
+ remoteProcId = MultiProc_getId("HOST");
+ do {
+ status = Ipc_attach(remoteProcId);
+
+ } while ((status < 0) && (status == Ipc_E_NOTREADY));
+
+ Log_print0(Diags_INFO, "Server_create: ipc to host is ready");
+
+#if defined(EVE)
+ /* create the message holding queue (messages from host) */
+ Module.holdQ = Queue_create(NULL, NULL);
+
+ /* create event object needed by message queue and notify callback */
+ Event_Params_init(&eventP);
+ Module.event = Event_create(&eventP, NULL);
+
+ /* create semaphore needed by synchronizer */
+ Semaphore_Params_init(&semP);
+ semP.event = Module.event;
+ semP.eventId = Event_Id_01; /* message queue */
+ semP.mode = Semaphore_Mode_BINARY;
+
+ Module.sem = Semaphore_create(0, &semP, NULL);
+
+ /* create synchronizer needed by message queue */
+ SyncSem_Params_init(&syncSemP);
+ syncSemP.sem = Module.sem;
+
+ Module.sync = SyncSem_create(&syncSemP, NULL);
+#endif
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgQueP);
+#if defined(EVE)
+ msgQueP.synchronizer = (Void *)(Module.sync);
+#endif
+
+ Module.messageQ = MessageQ_create(App_ServerQue, &msgQueP);
+
+ if (Module.messageQ == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: server is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "Server_create: <-- %d", (IArg)status);
+ return (status);
+}
+
+/*
+ * ======== Server_doWork ========
+ * Simulate some work effort
+ */
+Void Server_doWork(Void)
+{
+ UInt32 start, now;
+ UInt32 count;
+ Types_FreqHz freq;
+ UInt32 usec;
+ Task_Handle tid = Task_selfMacro();
+
+ /* set delay value */
+ usec = 3000; /* 3 ms */
+
+ /* latch the start timestamp */
+ start = Timestamp_get32();
+
+ /* compute delay in timestamp counts */
+ Timestamp_getFreq(&freq);
+ count = (freq.lo / 1000000) * usec;
+
+ do {
+ now = Timestamp_get32();
+ } while ((now - start) < count);
+
+}
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ Bool running = TRUE;
+ App_Msg * msg;
+ MessageQ_QueueId queId;
+#if defined(EVE)
+ UInt32 job;
+ UInt evts;
+ Int offset;
+#endif
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "Server_exec: -->");
+
+ while (running) {
+ msg = NULL;
+#if defined(EVE)
+ job = 0;
+
+ /* wait on next event: notify or message */
+ evts = Event_pend(Module.event, Event_Id_NONE, Event_Id_01|Event_Id_00,
+ BIOS_WAIT_FOREVER);
+
+ if (evts & Event_Id_00) {
+ /* get payload from the notify queue */
+ job = Server_dequeueEvent(&Module.notifyQ);
+ }
+ if (evts & Event_Id_01) {
+ /* get message from message queue */
+ MessageQ_get(Module.messageQ, (MessageQ_Msg *)&msg, BIOS_NO_WAIT);
+ }
+#else
+ /* wait for inbound message */
+ status = MessageQ_get(Module.messageQ, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+#endif
+
+ /* process the message */
+ if ((msg != NULL) && (msg->cmd == App_CMD_PROCESS)) {
+ Log_print1(Diags_INFO, "Server_exec: received from host, job=%d",
+ (IArg)msg->job);
+#if defined(EVE)
+ /* hold the message until job is done */
+ Queue_enqueue(Module.holdQ, &(msg->elem));
+
+ Log_print1(Diags_INFO, "Server_exec: sent to eve, job=%d",
+ (IArg)msg->job);
+
+ /* dispatch work to eve */
+ status = Notify_sendEvent(Module.eveProcId, 0, NotifyMsg_Evt_EVE,
+ msg->job, TRUE);
+
+ if (status < 0) {
+ Log_error2("Server_exec: Notify_sendEvent error=%d, "
+ "procId=%d", (IArg)status, (IArg)Module.eveProcId);
+ goto leave;
+ }
+#else
+ /* do work */
+ Server_doWork();
+
+ /* send message back */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+#endif
+ }
+ else if ((msg != NULL) && (msg->cmd == App_CMD_SHUTDOWN)) {
+ running = FALSE;
+
+ /* send message back */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+ }
+
+#if defined(EVE)
+ /* process the notify event */
+ if (job != 0) {
+
+ Log_print1(Diags_INFO, "Server_exec: received from eve, job=%d",
+ (IArg)job);
+
+ /* retrieve message for the given job */
+ msg = Queue_dequeue(Module.holdQ); /* returns pointer to elem */
+
+ /* compute start address of message */
+ offset = (Int)&(((App_Msg *)0)->elem);
+ msg = (App_Msg *)((Char *)msg - offset);
+
+ Log_print1(Diags_INFO, "Server_exec: send to host, job=%d (done)",
+ (IArg)msg->job);
+
+ /* send message back to client */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+ }
+#endif
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "Server_exec: <-- %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Server_delete ========
+ */
+
+Int Server_delete()
+{
+ Int status;
+
+ Log_print0(Diags_ENTRY, "Server_delete: -->");
+
+#if defined(EVE)
+ Notify_unregisterEventSingle(Module.eveProcId, 0, NotifyMsg_Evt_EVE);
+#endif
+
+ /* delete the server message queue */
+ status = MessageQ_delete(&Module.messageQ);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+#if defined(EVE)
+ SyncSem_delete(&Module.sync);
+ Semaphore_delete(&Module.sem);
+ Event_delete(&Module.event);
+ Queue_delete(&Module.holdQ);
+ IpcHandshake.sem = NULL;
+ Semaphore_destruct(&IpcHandshake.semObj);
+#endif
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_finish: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "Server_delete: <-- %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+/*
+ * ======== Server_exit ========
+ */
+
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+#if defined(EVE)
+/*
+ * ======== Server_dequeueEvent ========
+ */
+UInt32 Server_dequeueEvent(Notify_Queue *Q)
+{
+ UInt32 event;
+
+ /* check for queue error */
+ if (Q->error >= NotifyMsg_E_FAILURE) {
+ event = Q->error;
+ }
+ else {
+ if (Q->head == Q->tail) {
+ /* queue should not be empty */
+ Q->error = NotifyMsg_E_NOEVENT;
+ event = Q->error;
+ }
+ else {
+ /* remove next command from queue */
+ event = Q->queue[Q->head];
+ Q->head++;
+ }
+ }
+
+ return (event);
+}
+
+/*
+ * ======== Server_notifyCB ========
+ * This function runs with the notify callback disabled. It will not
+ * be preempted by another notify event.
+ */
+Void Server_notifyCB(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg,
+ UInt32 payload)
+{
+ Notify_Queue *Q = (Notify_Queue *)arg;
+
+ /* handle pong message, release the waiting task */
+ if (payload == Notify_Evt_PONG) {
+ Semaphore_post(IpcHandshake.sem);
+ }
+
+ /* if queue is full, set error flag */
+ else if ((Q->head + Event_QSZ) == Q->tail) {
+ Q->error = NotifyMsg_E_OVERFLOW;
+ }
+
+ /* save payload in queue, release waiting task */
+ else {
+ Q->queue[Q->tail % Event_QSZ] = payload;
+ Q->tail++;
+ Event_post(Module.event, Event_Id_00);
+ }
+}
+
+/*
+ * ======== Server_pingFxn ========
+ * Send a ping event to the eve processor.
+ */
+Void Server_pingFxn(UArg arg)
+{
+ /* Send ping event. Do not busy-wait if previous event
+ * has not been received (waitClear = FALSE). The eve
+ * processor might not be running, so it is expected that
+ * previous messages will be lost or overwritten.
+ */
+ Notify_sendEvent(Module.eveProcId, 0, NotifyMsg_Evt_EVE,
+ Notify_Evt_PING, FALSE);
+}
+#endif
diff --git a/src/examples/templates/ex13_notifypeer/slave/Server.h b/src/examples/templates/ex13_notifypeer/slave/Server.h
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+# Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Server.h ========
+ */
+
+#ifndef Server__include
+#define Server__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Server_init(Void);
+Void Server_exit(Void);
+
+Int Server_create(Void);
+Int Server_exec(Void);
+Int Server_delete(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* Server__include */
diff --git a/src/examples/templates/ex13_notifypeer/slave/Slave.cfg b/src/examples/templates/ex13_notifypeer/slave/Slave.cfg
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+% if (platform.match(/^DRA7XX_bios_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+xdc.useModule('xdc.runtime.Timestamp');
+xdc.useModule('xdc.runtime.Types');
+
+xdc.useModule('ti.sdo.ipc.Ipc');
+xdc.useModule('ti.sdo.ipc.MessageQ');
+xdc.useModule('ti.sdo.ipc.Notify');
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+xdc.useModule('ti.sysbios.BIOS');
+xdc.useModule('ti.sysbios.knl.Event');
+xdc.useModule('ti.sysbios.knl.Queue');
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+xdc.useModule('ti.sysbios.syncs.SyncSem');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.global.procName = "`procName`";
+xdc.loadCapsule("../shared/ipc_multiproc.cfg.xs");
+% if (!core.match(/eve/i)) {
+xdc.global.SR0_cacheEnable = true;
+xdc.loadCapsule("../shared/ipc_sr0.cfg.xs");
+% }
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+//Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Instrumented);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+/* configure the notify driver */
+var NotifySetup = xdc.useModule('ti.sdo.ipc.family.vayu.NotifySetup');
+
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE1"
+ })
+);
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE2"
+ })
+);
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE3"
+ })
+);
+NotifySetup.connections.$add(
+ new NotifySetup.Connection({
+ driver: NotifySetup.Driver_MAILBOX,
+ procName: "EVE4"
+ })
+);
+
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+
+/* enable event support for semaphores */
+var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
+Semaphore.supportsEvents = true;
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+% if (lcCore.match(/eve/)) {
+//Program.stack = 0x800; /* small stack needed to fit in DMEM */
+% }
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+% if (lcCore.match(/eve/)) {
+//heapMemParams.size = 0x1400; /* small heap needed to fit in DMEM */
+% }
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* configure SMP-enabled System module */
+var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
+% } else {
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+% }
+% if (lcCore.match(/eve/)) {
+//SysMin.bufSize = 0x200; /* small buffer needed to fit in DMEM */
+% }
+% }
+% else {
+% throw new Error("unsupported platform: " + platform);
+% }
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/eve/)) {
+
+/* place text character table in external memory, too big for DMEM */
+var Text_charTab = new prog.SectionSpec();
+Text_charTab.loadSegment = "`procName`_PROG";
+Program.sectMap[".const:xdc_runtime_Text_charTab__A"] = Text_charTab;
+
+/* reduce size of idle stack, too big for DMEM */
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.idleTaskStackSize = 0x200;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+
+/* Turn off the timer frequency check. The DSP timer does not run when
+ * the host is halted because of the emulation suspend signal.
+ */
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+Timer.checkFrequency = false;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+% if (lcCore == "dsp1") {
+
+/* allocate timers 5 and 6 to DSP1 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x0030;
+% } else {
+
+/* allocate timers 7 and 8 to DSP2 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x00C0;
+% }
+% }
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+//BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1-[01]/)) {
+
+BIOS.smpEnabled = false;
+% } else {
+
+BIOS.smpEnabled = true;
+% }
+% }
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* create a SMP-enabled logger instance */
+var LoggerBuf = xdc.useModule('ti.sysbios.smp.LoggerBuf');
+% } else {
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+% }
+% }
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex13_notifypeer/slave/main_bios.c b/src/examples/templates/ex13_notifypeer/slave/main_bios.c
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== Main`core`.c ========
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Server.h"
+
+/* private functions */
+Void Server_taskFxn(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Server_taskFxn";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Error_init(&eb);
+
+ Task_create(Server_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== Server_taskFxn ========
+ */
+Void Server_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status;
+
+ Log_print0(Diags_INFO, "Server_taskFxn: -->");
+
+ /* initialize the server module */
+ Server_init();
+
+ /* create a server instance */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* start the server */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* finalize the server */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* finalize the server module */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_INFO, "Server_taskFxn: <-- status=%d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex13_notifypeer/slave/makefile b/src/examples/templates/ex13_notifypeer/slave/makefile
--- /dev/null
@@ -0,0 +1,247 @@
+#
+# Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var cfgBldDir = "shared"; /* by default, may be overridden */
+
+ if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^DRA7XX_bios_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ platInst = "ti.platforms.sdp5430:" + lcCore;
+ } else if (platform.match(/^OMAPL138_linux_elf$/)) {
+ platInst = "ti.platforms.evmOMAPL138:" + lcCore;
+ cfgBldDir = "dsp";
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+ if (target.match(/\.C66$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64P$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64T$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C674$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.ARP32(_far|)$/)) {
+ cc = "bin/cl-arp32";
+ lnk = "bin/cl-arp32 -z";
+ }
+ else if (target.match(/\.M3$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else if (target.match(/\.M4$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Server.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+all: debug
+
+debug:
+ $(MAKE) PROFILE=debug server_`lcCore`.x
+
+release:
+ $(MAKE) PROFILE=release server_`lcCore`.x
+% } else {
+all: debug release
+
+debug:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+release:
+ $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_`lcCore`.x
+% }
+
+server_`lcCore`.x: bin/$(PROFILE)/server_`lcCore`.x`suffix`
+bin/$(PROFILE)/server_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+% } else {
+ $(LD) $(LDFLAGS) -o $@ $(objs) \
+ $(addprefix -l ,$(libs)) $(CONFIG)/linker.cmd $(LDLIBS)
+% }
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: `core`.cfg ../shared/config.bld
+% } else {
+`PCT`/linker.cmd `PCT`/compiler.opt: $(CONFIG)/.config ;
+$(CONFIG)/.config: `core`.cfg ../`cfgBldDir`/config.bld
+% }
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../`cfgBldDir`/config.bld -r $(PROFILE) \
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" \
+ `core`.cfg
+% } else {
+% if (target.match(/\.M3$|\.M4$/)) {
+ --cfgArgs "{ configBld: \"../`cfgBldDir`/config.bld\" }" \
+% }
+ `core`.cfg
+ @$(ECHO) "" > $@
+% }
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_`lcCore`.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l $(CGTOOLS)/lib/rts6600_elf.lib
+% } else {
+# entry point is set to an aligned address so that IPC can load the slave
+LDFLAGS = -w -q -u _c_int00 -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+% }
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex41_forwardmsg/host/App.c b/src/examples/templates/ex41_forwardmsg/host/App.c
--- /dev/null
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== App.c ========
+ *
+ */
+
+/* host header files */
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+#include "App.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; /* created locally */
+ MessageQ_QueueId slaveQue1; /* opened remotely */
+ MessageQ_QueueId slaveQue2; /* opened remotely */
+ UInt16 heapId; /* MessageQ heapId */
+ UInt32 msgSize;
+} App_Module;
+
+/* private data */
+static App_Module Module;
+
+
+/*
+ * ======== App_create ========
+ */
+
+Int App_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+
+ printf("--> App_create:\n");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue1 = MessageQ_INVALIDMESSAGEQ;
+ Module.slaveQue2 = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = App_MsgHeapId;
+ Module.msgSize = sizeof(App_Msg);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(App_HostMsgQueName, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ printf("App_create: Failed creating MessageQ\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* open the remote message queues */
+ do {
+ status = MessageQ_open(App_SlaveMsgQueName1, &Module.slaveQue1);
+ sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("App_create: Failed opening MessageQ\n");
+ goto leave;
+ }
+
+ do {
+ status = MessageQ_open(App_SlaveMsgQueName2, &Module.slaveQue2);
+ sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("App_create: Failed opening MessageQ\n");
+ goto leave;
+ }
+
+ printf("App_create: Host is ready\n");
+
+leave:
+ printf("<-- App_create:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_delete ========
+ */
+Int App_delete(Void)
+{
+ Int status;
+
+ printf("--> App_delete:\n");
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue1);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ status = MessageQ_close(&Module.slaveQue2);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- App_delete:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_exec ========
+ */
+Int App_exec(Void)
+{
+ Int status;
+ Int i;
+ App_Msg * msg;
+
+ printf("--> App_exec:\n");
+
+ /* fill process pipeline */
+ printf("App_exec: sending 1st message\n");
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = App_CMD_HOST;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue1, (MessageQ_Msg)msg);
+
+ printf("App_exec: sending 2nd message\n");
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = App_CMD_HOST;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue2, (MessageQ_Msg)msg);
+
+ for (i = 0; i < 2; i++) {
+ /* wait for return messages */
+ printf("App_exec: Waiting for message %d...\n", i);
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ printf("App_exec: message %d received\n", i);
+ }
+
+ /* allocate shutdown message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* Last message will tell the slave to shutdown */
+ msg->cmd = App_CMD_SHUTDOWN;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue1, (MessageQ_Msg)msg);
+
+ /* allocate shutdown message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* Last message will tell the slave to shutdown */
+ msg->cmd = App_CMD_SHUTDOWN;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue2, (MessageQ_Msg)msg);
+
+
+leave:
+ printf("<-- App_exec: %d\n", status);
+ return(status);
+}
diff --git a/src/examples/templates/ex41_forwardmsg/host/App.h b/src/examples/templates/ex41_forwardmsg/host/App.h
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== App.h ========
+ *
+ */
+
+#ifndef App__include
+#define App__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Int App_create();
+Int App_delete();
+Int App_exec();
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* App__include */
diff --git a/src/examples/templates/ex41_forwardmsg/host/Qnx/app_host.use b/src/examples/templates/ex41_forwardmsg/host/Qnx/app_host.use
--- /dev/null
@@ -0,0 +1,2 @@
+Usage:
+ app_host
diff --git a/src/examples/templates/ex41_forwardmsg/host/Qnx/arm/makefile b/src/examples/templates/ex41_forwardmsg/host/Qnx/arm/makefile
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2013-2014, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
diff --git a/src/examples/templates/ex41_forwardmsg/host/Qnx/arm/o.g.le.v7/makefile b/src/examples/templates/ex41_forwardmsg/host/Qnx/arm/o.g.le.v7/makefile
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2013-2014, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+$(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g: \
+ $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.g.le.v7/libipc_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.g.le.v7/libutils_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc_g = -Bstatic
+LIBPOST_ipc_g = -Bdynamic
+LIBPREF_utils_g = -Bstatic
+LIBPOST_utils_g = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.g.le.v7
+LIBS += ipc_g
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.g.le.v7
+LIBS += utils_g
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+
+# copy and rename executables to suit our preferences
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g \
+ $(PROJECT_ROOT)/../bin/debug/app_host
diff --git a/src/examples/templates/ex41_forwardmsg/host/Qnx/arm/o.le.v7/makefile b/src/examples/templates/ex41_forwardmsg/host/Qnx/arm/o.le.v7/makefile
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2013-2014, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+CCFLAGS += -O3
+
+$(PROJECT_ROOT)/arm/o.le.v7/app_host: \
+ $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.le.v7/libipc.a \
+ $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.le.v7/libutils.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc = -Bstatic
+LIBPOST_ipc = -Bdynamic
+LIBPREF_utils = -Bstatic
+LIBPOST_utils = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.le.v7
+LIBS += ipc
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.le.v7
+LIBS += utils
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+
+# copy and rename executables to suite our preferences
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.le.v7/app_host \
+ $(PROJECT_ROOT)/../bin/release/app_host
diff --git a/src/examples/templates/ex41_forwardmsg/host/Qnx/common.mk b/src/examples/templates/ex41_forwardmsg/host/Qnx/common.mk
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2013-2014, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME = app_host
+
+define PINFO
+PINFO DESCRIPTION=ex41_forwardmsg example
+endef
+
+# don't install the binaries, they are copied in base makefile
+INSTALLDIR = bin/examples
+
+CCOPTS += -DOS_QNX
+
+# source path
+EXTRA_SRCVPATH += $(PROJECT_ROOT)/..
+SRCS = main_host.c App.c
+
+# include path
+EXTRA_INCVPATH += \
+ $(PROJECT_ROOT)/../.. \
+ $(IPC_INSTALL_DIR)/packages \
+ $(IPC_INSTALL_DIR)/qnx/include \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
+
+include $(MKFILES_ROOT)/qtargets.mk
+
+LDFLAGS += -M
diff --git a/src/examples/templates/ex41_forwardmsg/host/Qnx/makefile b/src/examples/templates/ex41_forwardmsg/host/Qnx/makefile
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2012-2014, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=CPU
+include recurse.mk
diff --git a/src/examples/templates/ex41_forwardmsg/host/main_host.c b/src/examples/templates/ex41_forwardmsg/host/main_host.c
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== main_host.c ========
+ *
+ */
+
+/* cstdlib header files */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+% if (!this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#include <ti/ipc/transports/TransportRpmsg.h>
+% }
+
+/* local header files */
+#include "App.h"
+
+/* private functions */
+static Int Main_main(Void);
+static Int Main_parseArgs(Int argc, Char *argv[]);
+
+
+#define Main_USAGE "\
+Usage:\n\
+ app_host [options] \n\
+\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+\n\
+Examples:\n\
+ app_host -h\n\
+\n"
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Int status;
+
+ printf("--> main:\n");
+
+ /* parse command line */
+ status = Main_parseArgs(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+% if (!this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+% }
+
+ /* Ipc initialization */
+ status = Ipc_start();
+
+ if (status >= 0) {
+ /* application create, exec, delete */
+ status = Main_main();
+
+ /* Ipc finalization */
+ Ipc_stop();
+ }
+ else {
+ printf("Ipc_start failed: status = %d\n", status);
+ goto leave;
+ }
+
+leave:
+ printf("<-- main:\n");
+ status = (status >= 0 ? 0 : status);
+
+ return (status);
+}
+
+
+/*
+ * ======== Main_main ========
+ */
+Int Main_main(Void)
+{
+ Int status = 0;
+
+ printf("--> Main_main:\n");
+
+ /* BEGIN application phase */
+
+ /* application create phase */
+ status = App_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = App_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = App_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- Main_main:\n");
+
+ status = (status >= 0 ? 0 : status);
+ return (status);
+}
+
+
+/*
+ * ======== Main_parseArgs ========
+ */
+Int Main_parseArgs(Int argc, Char *argv[])
+{
+ Int x, cp, opt;
+ UInt16 i, numProcs;
+ String name;
+ Int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ case 'l': /* -l */
+ printf("Processor List\n");
+ status = Ipc_start();
+ if (status >= 0) {
+ numProcs = MultiProc_getNumProcessors();
+ for (i = 0; i < numProcs; i++) {
+ name = MultiProc_getName(i);
+ printf(" procId=%d, procName=%s\n", i, name);
+ }
+ Ipc_stop();
+ }
+ else {
+ printf(
+ "Error: %s, line %d: Ipc_start failed\n",
+ __FILE__, __LINE__);
+ goto leave;
+ }
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (Char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+
+leave:
+ return(status);
+}
diff --git a/src/examples/templates/ex41_forwardmsg/host/makefile_linux b/src/examples/templates/ex41_forwardmsg/host/makefile_linux
--- /dev/null
@@ -0,0 +1,142 @@
+#
+# Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+srcs = main_host.c App.c
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.a \
+ $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.a \
+ $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.a
+
+# Use dynamic or shared libs
+#libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.so \
+# $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.so \
+# $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.so
+
+# Use dynamic or static libraries installed on your linux distribution
+#libs =
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug app_host
+ $(MAKE) PROFILE=release app_host
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+app_host: bin/$(PROFILE)/app_host
+bin/$(PROFILE)/app_host: $(objs) $(libs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I.. -I $(IPC_INSTALL_DIR)/linux/include -I $(IPC_INSTALL_DIR)/packages
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex41_forwardmsg/host/makefile_qnx b/src/examples/templates/ex41_forwardmsg/host/makefile_qnx
--- /dev/null
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2013-2014, 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.
+#
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+export PKGPATH
+
+#
+# Determine build host OS (Windows or Linux)
+#
+ifeq (,$(BUILDHOSTOS))
+ ifeq (,$(findstring :,$(WINDIR)$(windir)$(COMSPEC)$(comspec)))
+ BUILDHOSTOS := Linux
+ else
+ BUILDHOSTOS := Windows
+ endif
+endif
+
+ifeq (Linux,$(BUILDHOSTOS))
+QNX_PATH := $(QNX_INSTALL_DIR)/host/linux/x86/usr/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/usr/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/linux/x86/usr/photon/appbuilder
+endif
+
+export PATH
+
+export QNX_CONFIGURATION ?= $(QNX_INSTALL_DIR)/etc/qnx
+export QNX_HOST ?= $(QNX_INSTALL_DIR)/host/linux/x86
+export QNX_TARGET ?= $(QNX_INSTALL_DIR)/target/qnx6
+export MAKEFLAGS = -I$(QNX_INSTALL_DIR)/target/qnx6/usr/include
+export LD_LIBRARY_PATH ?= $(QNX_INSTALL_DIR)/host/linux/x86/usr/lib
+export IPC_INSTALL_DIR
+
+all: app
+
+app: PATH:=$(QNX_PATH):$(PATH)
+app:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C Qnx
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean:: PATH:=$(QNX_PATH):$(PATH)
+clean::
+ $(MAKE) -C Qnx clean
+ $(RMDIR) bin
+
+
+#
+# ======== install validation ========
+#
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+#
+# ======== standard macros ========
+#
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+#
+# ======== create output directories ========
+#
+ifneq (clean,$(MAKECMDGOALS))
+ifeq (,$(wildcard bin/debug))
+ $(shell $(MKDIR) -p bin/debug)
+endif
+ifeq (,$(wildcard bin/release))
+ $(shell $(MKDIR) -p bin/release)
+endif
+endif
diff --git a/src/examples/templates/ex41_forwardmsg/makefile b/src/examples/templates/ex41_forwardmsg/makefile
--- /dev/null
@@ -0,0 +1,104 @@
+#
+# Copyright (c) 2013-2014, 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_(qnx|linux)_elf$/)) {
+PROCLIST = ipu1 dsp1 host
+% } else if (this.platform.match(/^OMAP54XX_(qnx|linux)_elf$/)) {
+PROCLIST = dsp ipu host
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+
+all: $(PROCLIST)
+
+$(PROCLIST):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@ PROCLIST="$(PROCLIST)"
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+EXEC_DIR=$(CURDIR)/install
+endif
+override EXEC_DIR:=$(EXEC_DIR)/ex41_forwardmsg
+endif
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+clean: $(addsuffix _clean,$(PROCLIST))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(PROCLIST)):
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex41_forwardmsg/mkpkg.xdt b/src/examples/templates/ex41_forwardmsg/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,105 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (!this.hostOS.match(/qnx|linux/)) {
+ throw ("Unsupported Host OS: " + this.hostOS);
+% }
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt @verbatim
+
+shared/AppCommon.h -> `this.example`/shared/AppCommon.h
+shared/config.bld -> `this.example`/shared/config.bld
+shared/ipc.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+
+host/App.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+host/main_host.c -> `this.example`/host/main_host.c
+
+% if (this.hostOS == "qnx") {
+ host/makefile_qnx -> `this.example`/host/makefile
+ host/Qnx/app_host.use -> `this.example`/host/Qnx/app_host.use
+ host/Qnx/common.mk -> `this.example`/host/Qnx/common.mk
+ host/Qnx/makefile -> `this.example`/host/Qnx/makefile
+ host/Qnx/arm/makefile -> `this.example`/host/Qnx/arm/makefile
+ host/Qnx/arm/o.g.le.v7/makefile -> `this.example`/host/Qnx/arm/o.g.le.v7/makefile
+ host/Qnx/arm/o.le.v7/makefile -> `this.example`/host/Qnx/arm/o.le.v7/makefile
+% } else if (this.hostOS == "linux") {
+ host/makefile_linux -> `this.example`/host/makefile
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+%%{
+ var outdir = "";
+
+ if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: "dsp/Dsp.cfg" },
+ { inFile: "slave/DspAmmu.cfg", outFile: "dsp/DspAmmu.cfg" },
+ { inFile: "slave/main_slave.c", outFile: "dsp/MainDsp.c" },
+ { inFile: "slave/makefile", outFile: "dsp/makefile" },
+ { inFile: "slave/Server_owner.c", outFile: "dsp/Server.c" },
+ { inFile: "slave/Server.h", outFile: "dsp/Server.h" },
+ { inFile: "slave/rsc_table_omap5_dsp.h", outFile: "dsp/rsc_table.h" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp", "e64T", "ti.targets.elf.C64T");
+ }
+
+ /* ipu */
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: "ipu/Ipu.cfg" },
+ { inFile: "slave/IpuAmmu_omap5.cfg", outFile: "ipu/IpuAmmu.cfg" },
+ { inFile: "slave/main_slave.c", outFile: "ipu/MainIpu.c" },
+ { inFile: "slave/makefile", outFile: "ipu/makefile" },
+ { inFile: "slave/Server_user.c", outFile: "ipu/Server.c" },
+ { inFile: "slave/Server.h", outFile: "ipu/Server.h" },
+ { inFile: "slave/rsc_table_omap5_ipu.h", outFile: "ipu/rsc_table.h" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu", "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+ else if (this.platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+ var outdir;
+
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: "ipu1/Ipu1.cfg" },
+ { inFile: "slave/IpuAmmu_dra7xx.cfg", outFile: "ipu1/IpuAmmu.cfg" },
+ { inFile: "slave/Server_user.c", outFile: "ipu1/Server.c" },
+ { inFile: "slave/Server.h", outFile: "ipu1/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: "ipu1/MainIpu1.c" },
+ { inFile: "slave/makefile", outFile: "ipu1/makefile" },
+ { inFile: "slave/rsc_table_vayu_ipu.h", outFile: "ipu1/rsc_table.h" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu1", "em4", "ti.targets.arm.elf.M4");
+ }
+
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: "dsp1/Dsp1.cfg" },
+ { inFile: "slave/Server_owner.c", outFile: "dsp1/Server.c" },
+ { inFile: "slave/Server.h", outFile: "dsp1/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: "dsp1/MainDsp1.c" },
+ { inFile: "slave/makefile", outFile: "dsp1/makefile" },
+ { inFile: "slave/rsc_table_vayu_dsp.h", outFile: "dsp1/rsc_table.h" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp1", "e66", "ti.targets.elf.C66");
+ }
+ }
+%%}
\ No newline at end of file
diff --git a/src/examples/templates/ex41_forwardmsg/products.mak b/src/examples/templates/ex41_forwardmsg/products.mak
--- /dev/null
@@ -0,0 +1,110 @@
+#
+# Copyright (c) 2013-2014, 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.
+#
+%%{
+ var isLinux = this.platform.match(/_linux_/);
+ var isQnx = this.platform.match(/_qnx_/);
+%%}
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+% if (isLinux) {
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+% } else if (isQnx) {
+#### QNX toolchain ####
+#QNX_INSTALL_DIR = $(DEPOT)/_your_qnx_install_
+% }
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C64T = $(DEPOT)/_your_ti_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+% if (isLinux) {
+ @echo "HOST TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+% } else if (isQnx) {
+ @echo "QNX_INSTALL_DIR = $(QNX_INSTALL_DIR)"
+% }
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^OMAP54XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C64T = $(ti.targets.elf.C64T)"
+% } else if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex41_forwardmsg/readme.txt b/src/examples/templates/ex41_forwardmsg/readme.txt
--- /dev/null
@@ -0,0 +1,11 @@
+#
+# ======== readme.txt ========
+#
+MessageQ forward message example.
+
+Program Logic:
+The host sends a message to each slave core with a dummy payload. Each
+slave then forwards the message to the other slave. After a slave
+receives a message from both the host and the other slave, it
+allocates a new message that it sends back to the host. The slave
+shuts itself down and reinitializes itself for future runs.
diff --git a/src/examples/templates/ex41_forwardmsg/shared/AppCommon.h b/src/examples/templates/ex41_forwardmsg/shared/AppCommon.h
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== AppCommon.h ========
+ *
+ */
+
+#ifndef AppCommon__include
+#define AppCommon__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*
+ * ======== Application Configuration ========
+ */
+
+/* notify commands 00 - FF */
+#define App_CMD_MASK 0xFF000000
+#define App_CMD_NOP 0x00000000 /* cc------ */
+#define App_CMD_SHUTDOWN 0x02000000 /* cc------ */
+#define App_CMD_HOST 0x03000000
+#define App_CMD_SLAVE 0x04000000
+
+#define MAX_NAMELEN 20
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ UInt32 cmd;
+} App_Msg;
+
+#define App_MsgHeapId 0
+#define App_HostMsgQueName "HOST:MsgQ:01"
+#define App_SlaveMsgQueName1 "SLAVE:MsgQ:01"
+#define App_SlaveMsgQueName2 "SLAVE:MsgQ:02"
+
+#define App_SrHeapId 1
+#define App_SrHeapName "myHeapBuf"
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* AppCommon__include */
diff --git a/src/examples/templates/ex41_forwardmsg/shared/config.bld b/src/examples/templates/ex41_forwardmsg/shared/config.bld
--- /dev/null
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+% if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Shared region definition used in app */
+var sdp5430_SR_0 = {
+ name: "SR_0", space: "data", access: "RWX",
+ base: 0xBFC00000, len: 0x100000,
+ comment: "SR#0 Memory (1 MB)"
+};
+
+% if (false) { /* dunno if this is accurate! */
+/* Memory Map for ti.platforms.sdp5430:ipu
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
+ * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
+ * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+% }
+var sdp5430_ExtMemMapIpu = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x005FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00600000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80600000,
+ len: 0x09600000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ },
+ SR_0: {
+ name: sdp5430_SR_0.name,
+ base: sdp5430_SR_0.base,
+ len: sdp5430_SR_0.len,
+ space: "data",
+ access: "RW"
+ }
+};
+
+Build.platformTable["ti.platforms.sdp5430:ipu"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", sdp5430_ExtMemMapIpu.EXT_CODE ],
+ [ "EXT_DATA", sdp5430_ExtMemMapIpu.EXT_DATA ],
+ [ "EXT_HEAP", sdp5430_ExtMemMapIpu.EXT_HEAP ],
+ [ "TRACE_BUF", sdp5430_ExtMemMapIpu.TRACE_BUF ],
+ [ "EXC_DATA", sdp5430_ExtMemMapIpu.EXC_DATA ],
+ [ "PM_DATA", sdp5430_ExtMemMapIpu.PM_DATA ],
+ [ sdp5430_SR_0.name, sdp5430_ExtMemMapIpu.SR_0 ],
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+% if (false) { /* dunno if this is accurate! */
+/* Memory Map for ti.platforms.sdp5430:dsp
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 2000_0000 ????_???? 10_0000 ( 1 MB) EXT_CODE
+ * 9000_0000 ????_???? 10_0000 ( 1 MB) EXT_DATA
+ * 9010_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+%}
+var sdp5430_ExtMemMapDsp = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x20000000,
+ len: 0x00100000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x90000000,
+ len: 0x00100000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x90100000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ },
+ SR_0: {
+ name: sdp5430_SR_0.name,
+ base: sdp5430_SR_0.base,
+ len: sdp5430_SR_0.len,
+ space: "data",
+ access: "RW"
+ }
+};
+
+Build.platformTable["ti.platforms.sdp5430:dsp"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", sdp5430_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", sdp5430_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", sdp5430_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", sdp5430_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", sdp5430_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", sdp5430_ExtMemMapDsp.PM_DATA ],
+ [ sdp5430_SR_0.name, sdp5430_ExtMemMapDsp.SR_0 ],
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+
+/*
+ * ======== IPU ammu configuration ========
+ */
+var ammu = {
+ /* program code/data memory (cacheable) */
+ largePage0: {
+ pa: 0x8A000000,
+ size: "Large_32M",
+ cache: "CachePolicy_CACHEABLE"
+ },
+ /* SR_0 data memory (non-cacheable) */
+ largePage1: {
+ pa: 0x8E000000,
+ size: "Large_32M",
+ cache: "CachePolicy_NON_CACHEABLE"
+ }
+};
+% } else if (this.platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+/* Shared region definition used in app */
+var evmDRA7XX_SR_0 = {
+ name: "SR_0", space: "data", access: "RWX",
+ base: 0xBFC00000, len: 0x100000,
+ comment: "SR#0 Memory (1 MB)"
+};
+
+/* Memory Map for DSP1
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 9500_0000 ???0_0000 10_0000 ( ~1 MB) EXT_CODE
+ * 9510_0000 ???0_0000 10_0000 ( 1 MB) EXT_DATA
+ * 9520_0000 ???0_0000 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 ???0_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 ???6_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 ???7_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapDsp = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x95000000,
+ len: 0x00100000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x95100000,
+ len: 0x00100000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x95200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ },
+ SR_0: {
+ name: evmDRA7XX_SR_0.name,
+ base: evmDRA7XX_SR_0.base,
+ len: evmDRA7XX_SR_0.len,
+ space: "data",
+ access: "RW"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ],
+ [ evmDRA7XX_SR_0.name, evmDRA7XX_ExtMemMapDsp.SR_0 ],
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+
+/* Memory Map for IPU1
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ???0_4000 F_C000 ( ~1 MB) EXT_CODE
+ * 8000_0000 ???0_0000 20_0000 ( 2 MB) EXT_DATA
+ * 8020_0000 ???0_0000 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 ???0_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 ???6_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 ???7_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu1 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x000FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00200000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ },
+ SR_0: {
+ name: evmDRA7XX_SR_0.name,
+ base: evmDRA7XX_SR_0.base,
+ len: evmDRA7XX_SR_0.len,
+ space: "data",
+ access: "RW"
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu1.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu1.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu1.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu1.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu1.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu1.PM_DATA ],
+ [ evmDRA7XX_SR_0.name, evmDRA7XX_ExtMemMapIpu1.SR_0 ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex41_forwardmsg/shared/ipc.cfg.xs b/src/examples/templates/ex41_forwardmsg/shared/ipc.cfg.xs
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+var procNameAry = ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"];
+var ownerSr0 = "DSP1";
+% } else if (this.platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+var procNameAry = ["HOST", "IPU", "DSP"];
+var ownerSr0 = "DSP";
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
+
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(Program.global.procName, procNameAry);
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: MultiProc.getIdMeta(ownerSr0),
+ cacheEnable: true,
+ isValid: true
+ })
+);
diff --git a/src/examples/templates/ex41_forwardmsg/slave/Dsp.cfg b/src/examples/templates/ex41_forwardmsg/slave/Dsp.cfg
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if ((platform.match(/^DRA7XX_(linux|qnx)_elf$/) && target.match(/\.M4$/)) ||
+% (platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+/* load the configuration shared across cores */
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+BIOS.addUserStartupFunction('&IpcMgr_callIpcStart');
+
+/* Override the default resource table to add SR0 */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.customTable = true;
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+var HeapBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+
+/* create a heap for MessageQ host<->slave messages */
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+//MessageQ.SetupTransportProxy = VirtioSetup; // Commented out to use standard proxy
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+//NameServer.SetupProxy = NsRemote; // Commented out to use standard nsremote
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = "EXT_CODE";
+
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+% if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Configure the SYS/BIOS clock to use external timer so that it keeps
+ * running when IPU is in low power mode. Must use TickSource_USER
+ * because we need special instance create parameters on the timer
+ * instance. Use dmTimer0 (GPTimer5) to driver the SYS/BIOS clock.
+ */
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+Clock.timerId = 0;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Switch off Software Reset to make the below settings effective */
+timerParams.tiocpCfg.softreset = 0x0;
+timerParams.tiocpCfg.idlemode = 0x3; /* smart-idle wake-up-capable mode */
+timerParams.twer.ovf_wup_ena = 0x1; /* wake-up generation for overflow */
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* configure the DSP AMMU */
+xdc.loadCapsule("DspAmmu.cfg");
+
+/*
+ * ======== Power Management Configuration ========
+ */
+/* Modules used in Power Management */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.c64p.tesla.Power');
+Power.loadSegment = "PM_DATA";
+
+/* Idle function that periodically flushes the unicache */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+/* power management idle function */
+Idle.addFunc('&IpcPower_idle'); /* must be at the end */
+
+% } else {
+/* --------------------------- TICK --------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+Clock.timerId = 4;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+
+/* Skip the Timer frequency verification check. Need to remove this later */
+Timer.checkFrequency = false;
+
+/* Match this to the SYS_CLK frequency sourcing the dmTimers.
+ * Not needed once the SYS/BIOS family settings is updated. */
+Timer.intFreq.hi = 0;
+Timer.intFreq.lo = 19200000;
+
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Switch off Software Reset to make the below settings effective */
+timerParams.tiocpCfg.softreset = 0x0;
+/* Smart-idle wake-up-capable mode */
+timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+timerParams.twer.ovf_wup_ena = 0x1;
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+% }
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
diff --git a/src/examples/templates/ex41_forwardmsg/slave/DspAmmu.cfg b/src/examples/templates/ex41_forwardmsg/slave/DspAmmu.cfg
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var target = this.arguments[3];
+%%}
+
+/*
+ * ======== DspAmmu.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+if (Cache.enableCache) {
+ Cache.ocpL1.wrap = 1;
+ Cache.ocpL1.wrbuffer = 1;
+ Cache.ocpL1.prefetch = 0;
+
+ Cache.ocpL2.wrap = 1;
+ Cache.ocpL2.wrbuffer = 1;
+ Cache.ocpL2.prefetch = 0;
+
+ print("DSP Unicache = ON");
+}
+else {
+ print("DSP Unicache = OFF");
+}
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+
+/*********************** Small Pages *************************/
+/* Work-around for bug in BIOS 6.33.06.50 */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x01c30000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.smallPages[1].size = AMMU.Small_4K;
+AMMU.smallPages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.smallPages[1].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/*********************** Medium Pages *************************/
+/* config medium page[0] to map 1MB VA 0x01d00000 to 0x01dFFFFF */
+/* ABE NC region */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x01d00000;
+AMMU.mediumPages[0].size = AMMU.Medium_1M;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[0].L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[0].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.mediumPages[0].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[0].L2_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[0].L2_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[0].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* config medium page[1] to map 1MB VA 0x01e00000 to 0x01eFFFFF */
+/* IVA-HD (accelerator memories, NC region) */
+AMMU.mediumPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[1].logicalAddress = 0x01e00000;
+AMMU.mediumPages[1].size = AMMU.Medium_1M;
+AMMU.mediumPages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[1].L1_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[1].L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[1].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[1].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[1].L2_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[1].L2_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[1].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[2] to map 128kB VA 0x10800000 to 0x1081FFFF */
+/* SL2->L1 */
+AMMU.mediumPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[2].logicalAddress = 0x10800000;
+AMMU.mediumPages[2].size = AMMU.Medium_128K;
+AMMU.mediumPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[3].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[2].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[2].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[2].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[2].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[3] to map 128kB VA 0x10820000 to 0x1083FFFF */
+/* SL2->L2 */
+AMMU.mediumPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[3].logicalAddress = 0x10820000;
+AMMU.mediumPages[3].size = AMMU.Medium_128K;
+AMMU.mediumPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[3].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[3].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[3].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[3].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[4] to map 1MB VA 0x10900000 to 0x109FFFFF */
+/* SL2 Locked Region */
+AMMU.mediumPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[4].logicalAddress = 0x10900000;
+AMMU.mediumPages[4].size = AMMU.Medium_1M;
+AMMU.mediumPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.mediumPages[4].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[4].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[4].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[4].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[5] to map 1MB VA 0x10d00000 to 0x10dFFFFF */
+/* ABE */
+AMMU.mediumPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[5].logicalAddress = 0x10d00000;
+AMMU.mediumPages[5].size = AMMU.Medium_1M;
+AMMU.mediumPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.mediumPages[5].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[5].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.mediumPages[5].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.mediumPages[5].L2_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+
+/* config medium page[6] to map 1MB VA 0x10e00000 to 0x10eFFFFF */
+/* ABE Locked Region */
+AMMU.mediumPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[6].logicalAddress = 0x10e00000;
+AMMU.mediumPages[6].size = AMMU.Medium_1M;
+AMMU.mediumPages[6].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[6].L1_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[6].L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[6].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.mediumPages[6].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.mediumPages[6].L2_posted = AMMU.PostedPolicy_NON_POSTED;
+AMMU.mediumPages[6].L2_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+AMMU.mediumPages[6].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable, posted */
+/* config large page[0] to map 512MB VA 0x20000000 to L3 0x3FFFFFFF */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x20000000;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[0].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[0].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[0].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[0].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[0].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* Peripheral regions: Large Page (512M); non-cacheable, posted */
+/* config large page[1] to map 512MB VA 0x40000000 to L3 0x5FFFFFFF */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x40000000;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[1].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[1].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[1].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[1].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[1].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* TILER region: Large Page (512M); cacheable, posted */
+/* config large page[2] to map 512MB VA 0x60000000 to L3 0x7FFFFFFF */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x60000000;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[2].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[2].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[2].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* Private and Heap Data regions: Large page (512M); cacheable, posted */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x9FFFFFFF */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0x80000000;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[3].L2_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[3].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[3].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* IPC region: Large Page (512M); non-cacheable, posted */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xBFFFFFFF */
+AMMU.largePages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[4].logicalAddress = 0xA0000000;
+AMMU.largePages[4].size = AMMU.Large_512M;
+AMMU.largePages[4].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+AMMU.largePages[4].L2_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[4].L2_posted = AMMU.PostedPolicy_POSTED;
+AMMU.largePages[4].L2_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.largePages[4].L2_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
diff --git a/src/examples/templates/ex41_forwardmsg/slave/Ipu.cfg b/src/examples/templates/ex41_forwardmsg/slave/Ipu.cfg
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if ((platform.match(/^DRA7XX_(linux|qnx)_elf$/) && target.match(/\.M4$/)) ||
+% (platform.match(/^TI814X_bios_elf$/) && target.match(/\.M3$/)) ||
+% (platform.match(/^C6A8149_bios_elf$/) && target.match(/\.M3$/))) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.gates.GateHwi');
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+/* load the configuration shared across cores */
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+BIOS.addUserStartupFunction('&IpcMgr_callIpcStart');
+
+/* Override the default resource table to add SR0 */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.customTable = true;
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+BIOS.smpEnabled = true; /* only support SMP mode on IPU */
+
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.ipuId = 1;
+
+% }
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+/* Remap the interrupt xbar mmr base address to match AMMU settings */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+% }
+
+/* Remap the spinlocks to match AMMU settings */
+var GateHWSpinlock = xdc.useModule('ti.sdo.ipc.gates.GateHWSpinlock');
+GateHWSpinlock.baseAddr = 0x6A0F6800;
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+var HeapBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+
+/* create a heap for MessageQ host<->slave messages */
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+//MessageQ.SetupTransportProxy = VirtioSetup; // Commented out to use standard proxy
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+//NameServer.SetupProxy = NsRemote; // Commented out to use standard nsremote
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+/* dmTimer 0 mapped to GPT1 */
+dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
+/* dmTimer 1 mapped to GPT2 */
+dmTimer.timerSettings[1].baseAddr = 0x68032000;
+/* dmTimer 2 mapped to GPT3 */
+dmTimer.timerSettings[2].baseAddr = 0x68034000;
+/* dmTimer 3 mapped to GPT4 */
+dmTimer.timerSettings[3].baseAddr = 0x68036000;
+/* dmTimer 4 mapped to GPT5 */
+dmTimer.timerSettings[4].baseAddr = 0x68820000;
+/* dmTimer 5 mapped to GPT6 */
+dmTimer.timerSettings[5].baseAddr = 0x68822000;
+/* dmTimer 6 mapped to GPT7 */
+dmTimer.timerSettings[6].baseAddr = 0x68034000;
+/* dmTimer 7 mapped to GPT8 */
+dmTimer.timerSettings[7].baseAddr = 0x68036000;
+/* dmTimer 8 mapped to GPT9 */
+dmTimer.timerSettings[8].baseAddr = 0x6803E000;
+/* dmTimer 9 mapped to GPT10 */
+dmTimer.timerSettings[9].baseAddr = 0x68086000;
+/* dmTimer 10 mapped to GPT11 */
+dmTimer.timerSettings[10].baseAddr = 0x68088000;
+/* dmTimer 11 mapped to GPT12 */
+dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
+/* dmTimer 12 mapped to GPT13 */
+dmTimer.timerSettings[12].baseAddr = 0x68828000;
+/* dmTimer 13 mapped to GPT14 */
+dmTimer.timerSettings[13].baseAddr = 0x6882A000;
+/* dmTimer 14 mapped to GPT15 */
+dmTimer.timerSettings[14].baseAddr = 0x6882C000;
+/* dmTimer 15 mapped to GPT16 */
+dmTimer.timerSettings[15].baseAddr = 0x6882E000;
+% } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ *
+ * 0x48034000 --> 0xA8034000 dmTimer0 mapped to GPT3
+ * 0x48036000 --> 0xA8036000 dmTimer1 mapped to GPT4
+ * 0x4803E000 --> 0xA803E000 dmTimer2 mapped to GPT9
+ * 0x48088000 --> 0xA8088000 dmTimer3 mapped to GPT11
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+dmTimer.timerSettings[0].baseAddr = 0xA8034000;
+dmTimer.timerSettings[1].baseAddr = 0xA8036000;
+dmTimer.timerSettings[2].baseAddr = 0xA803E000;
+dmTimer.timerSettings[3].baseAddr = 0xA8088000;
+% }
+
+/* use external timers because they keep running when IPU is not */
+var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
+halTimer.TimerProxy = dmTimer;
+
+/* ----------------------------- TICK ---------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+% if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+/* Configure GPTimer11 as BIOS clock source */
+Clock.timerId = 10;
+% }
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Smart-idle wake-up-capable mode */
+timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+timerParams.twer.ovf_wup_ena = 0x1;
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* configure the IPU AMMU */
+xdc.loadCapsule("IpuAmmu.cfg");
+
+
+/*
+ * ======== Power Management Configuration ========
+ */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.arm.ducati.smp.Power');
+Power.loadSegment = "PM_DATA";
+
+/* idle functions, power management functions should be last */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+
+/* function to flush unicache on each core */
+Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
+Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
+
+% if ((!platform.match(/^DRA7XX_qnx_elf$/)) || (!core.match(/ipu1/i))) {
+/* power management idle functions for each core */
+Idle.addCoreFunc('&IpcPower_idle', 0);
+Idle.addCoreFunc('&IpcPower_idle', 1);
+% }
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
+Hwi.nvicCCR.DIV_0_TRP = 1;
diff --git a/src/examples/templates/ex41_forwardmsg/slave/IpuAmmu_dra7xx.cfg b/src/examples/templates/ex41_forwardmsg/slave/IpuAmmu_dra7xx.cfg
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 3 small pages(1 4K and 2 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 16K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_16K;
+
+/* config small page[8] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50020000;
+AMMU.smallPages[8].translatedAddress = 0x55060000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large page (512M); non-cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* TILER & DMM regions: Large page (512M); cacheable */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L1_posted = AMMU.PostedPolicy_POSTED;
diff --git a/src/examples/templates/ex41_forwardmsg/slave/IpuAmmu_omap5.cfg b/src/examples/templates/ex41_forwardmsg/slave/IpuAmmu_omap5.cfg
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 4 small pages(3 4K and 1 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 4K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_4K;
+
+/* config small page[8] to map 4K VA 0x50011000 to PA 0x55051000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50011000;
+AMMU.smallPages[8].translatedAddress = 0x55051000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/* config small page[9] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[9].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[9].logicalAddress = 0x50020000;
+AMMU.smallPages[9].translatedAddress = 0x55060000;
+AMMU.smallPages[9].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[9].size = AMMU.Small_4K;
+
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large page (512M); non-cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large Page (512M); non-cacheable, non-posted */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
diff --git a/src/examples/templates/ex41_forwardmsg/slave/Server.h b/src/examples/templates/ex41_forwardmsg/slave/Server.h
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== Server.h ========
+ *
+ */
+
+#ifndef Server__include
+#define Server__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Server_init(Void);
+Void Server_exit(Void);
+
+Int Server_create(Void);
+Int Server_exec(Void);
+Int Server_delete(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* Server__include */
diff --git a/src/examples/templates/ex41_forwardmsg/slave/Server_owner.c b/src/examples/templates/ex41_forwardmsg/slave/Server_owner.c
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== Server.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/IHeap.h>
+
+/* package header files */
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/HeapBufMP.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+
+/* module header file */
+#include "Server.h"
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; // host processor id
+ MessageQ_Handle slaveQue; // created locally
+ MessageQ_QueueId remoteSlaveQueId; // Opened queue handle
+ UInt32 msgSize;
+ HeapBufMP_Handle srHeapHandle;
+} Server_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+
+
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+ Module.msgSize = sizeof(App_Msg);
+ Module.srHeapHandle = NULL;
+ Module.slaveQue = NULL;
+}
+
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ HeapBufMP_Params heapBufParams;
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+ /*
+ * Create the heap that will be used to allocate messages.
+ */
+ Log_print0(Diags_INFO,"Creating HeapBufMP...");
+ HeapBufMP_Params_init(&heapBufParams);
+ heapBufParams.regionId = 0;
+ heapBufParams.name = App_SrHeapName;
+ heapBufParams.numBlocks = 2;
+ heapBufParams.blockSize = sizeof(App_Msg);
+ Module.srHeapHandle = HeapBufMP_create(&heapBufParams);
+ if (Module.srHeapHandle == NULL) {
+ Log_print0(Diags_INFO,"HeapBufMP_create failed\n" );
+ goto leave;
+ }
+
+ /* Register this heap with MessageQ */
+ MessageQ_registerHeap((IHeap_Handle)Module.srHeapHandle, App_SrHeapId);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.slaveQue = MessageQ_create(App_SlaveMsgQueName1, &msgqParams);
+
+ if (Module.slaveQue == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* open the other slave's message queue */
+ do {
+ status = MessageQ_open(App_SlaveMsgQueName2, &Module.remoteSlaveQueId);
+ Task_sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_print0(Diags_INFO,"Server_exec: Failed opening MessageQ");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: Slave is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
+ return (status);
+}
+
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ Bool running = TRUE;
+ App_Msg * msg;
+ MessageQ_QueueId hostQueId;
+ MessageQ_QueueId slaveQueId;
+ Int execMask = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* process the message */
+ Log_print1(Diags_INFO, "Server_exec: processing cmd=0x%x", msg->cmd);
+
+ if (msg->cmd == App_CMD_SHUTDOWN) {
+ running = FALSE;
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+ else if (msg->cmd == App_CMD_HOST) {
+ execMask |= 0x1;
+
+ hostQueId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+
+ MessageQ_free((MessageQ_Msg)msg);
+
+ /* Allocate a new message from SR for slave */
+ Log_print0(Diags_INFO,"Server_exec: Allocating from SR heap");
+ msg = (App_Msg *)MessageQ_alloc(App_SrHeapId, Module.msgSize);
+
+ slaveQueId = Module.remoteSlaveQueId;
+ msg->cmd = App_CMD_SLAVE;
+ /* Send message to other slave */
+ MessageQ_put(slaveQueId, (MessageQ_Msg)msg);
+ }
+ else if (msg->cmd == App_CMD_SLAVE) {
+ execMask |= 0x2;
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+
+ /* send message back */
+ if (execMask == 0x3) {
+ /* allocate message */
+ Log_print0(Diags_INFO,"Server_exec: Replying to host...");
+ msg = (App_Msg *)MessageQ_alloc(App_MsgHeapId, Module.msgSize);
+ MessageQ_put(hostQueId, (MessageQ_Msg)msg); /* say we are done */
+ execMask = 0;
+ }
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_exec: %d", (IArg)status);
+ return(status);
+}
+
+
+/*
+ * ======== Server_delete ========
+ */
+Int Server_delete()
+{
+ Int status;
+
+ Log_print0(Diags_ENTRY, "--> Server_delete:");
+
+ /* close remote message queue */
+ status = MessageQ_close(&Module.remoteSlaveQueId);
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.slaveQue);
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* Unregister the SR heap from MessageQ module */
+ status = MessageQ_unregisterHeap(App_SrHeapId);
+ if (status < 0) {
+ goto leave;
+ }
+
+ status = HeapBufMP_delete(&Module.srHeapHandle);
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_finish: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- Server_delete: %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+
+/*
+ * ======== Server_exit ========
+ */
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
diff --git a/src/examples/templates/ex41_forwardmsg/slave/Server_user.c b/src/examples/templates/ex41_forwardmsg/slave/Server_user.c
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== Server.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/IHeap.h>
+
+/* package header files */
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/HeapBufMP.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+
+/* module header file */
+#include "Server.h"
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; // host processor id
+ MessageQ_Handle slaveQue; // created locally
+ MessageQ_QueueId remoteSlaveQueId; // Opened queue handle
+ UInt32 msgSize;
+ HeapBufMP_Handle srHeapHandle;
+} Server_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+
+
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+ Module.msgSize = sizeof(App_Msg);
+ Module.srHeapHandle = NULL;
+ Module.slaveQue = NULL;
+}
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+
+ Log_print0(Diags_INFO,"Opening HeapBufMP...");
+ /* Open the heap created by the other processor. Loop until opened. */
+ do {
+ status = HeapBufMP_open(App_SrHeapName, &Module.srHeapHandle);
+ /*
+ * Sleep for 1 clock tick to avoid inundating remote processor
+ * with interrupts if open failed
+ */
+ if (status < 0) {
+ Task_sleep(1);
+ }
+ } while (status < 0);
+
+ /* Register this heap with MessageQ */
+ MessageQ_registerHeap((IHeap_Handle)Module.srHeapHandle, App_SrHeapId);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.slaveQue = MessageQ_create(App_SlaveMsgQueName2, &msgqParams);
+
+ if (Module.slaveQue == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* open the remote message queues */
+ do {
+ status = MessageQ_open(App_SlaveMsgQueName1, &Module.remoteSlaveQueId);
+ Task_sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_print0(Diags_INFO,"Server_exec: Failed opening MessageQ");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: Slave is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
+ return (status);
+}
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ Bool running = TRUE;
+ App_Msg * msg;
+ MessageQ_QueueId hostQueId;
+ MessageQ_QueueId slaveQueId;
+ Int execMask = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* process the message */
+ Log_print1(Diags_INFO, "Server_exec: processing cmd=0x%x", msg->cmd);
+
+ if (msg->cmd == App_CMD_SHUTDOWN) {
+ running = FALSE;
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+ else if (msg->cmd == App_CMD_HOST) {
+ execMask |= 0x1;
+
+ hostQueId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+
+ MessageQ_free((MessageQ_Msg)msg);
+
+ /* Allocate a new message from SR for slave */
+ Log_print0(Diags_INFO,"Server_exec: Allocating from SR heap");
+ msg = (App_Msg *)MessageQ_alloc(App_SrHeapId, Module.msgSize);
+
+ slaveQueId = Module.remoteSlaveQueId;
+ msg->cmd = App_CMD_SLAVE;
+ /* Send message to other slave */
+ MessageQ_put(slaveQueId, (MessageQ_Msg)msg);
+ }
+ else if (msg->cmd == App_CMD_SLAVE) {
+ execMask |= 0x2;
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+
+ /* send message back */
+ if (execMask == 0x3) {
+ /* allocate message */
+ Log_print0(Diags_INFO,"Server_exec: Replying to host...");
+ msg = (App_Msg *)MessageQ_alloc(App_MsgHeapId, Module.msgSize);
+ MessageQ_put(hostQueId, (MessageQ_Msg)msg); /* say we are done */
+ execMask = 0;
+ }
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_exec: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Server_delete ========
+ */
+Int Server_delete()
+{
+ Int status;
+
+ Log_print0(Diags_ENTRY, "--> Server_delete:");
+
+ /* close remote message queue */
+ status = MessageQ_close(&Module.remoteSlaveQueId);
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the local message queue */
+ status = MessageQ_delete(&Module.slaveQue);
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* Unregister the SR heap from MessageQ module */
+ status = MessageQ_unregisterHeap(App_SrHeapId);
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* Close the SR heap */
+ if (Module.srHeapHandle) {
+ HeapBufMP_close(&Module.srHeapHandle);
+ }
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_finish: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- Server_delete: %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+/*
+ * ======== Server_exit ========
+ */
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
diff --git a/src/examples/templates/ex41_forwardmsg/slave/main_slave.c b/src/examples/templates/ex41_forwardmsg/slave/main_slave.c
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+
+ var thisCore = core.toUpperCase();
+ var thatCore = ""; /* set below */
+
+ if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+ if (thisCore.match(/^IPU1$/)) {
+ thatCore = "DSP1";
+ } else {
+ thatCore = "IPU1";
+ }
+ } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ if (thisCore.match(/^IPU$/)) {
+ thatCore = "DSP";
+ } else {
+ thatCore = "IPU";
+ }
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+%%}
+
+/*
+ * ======== main_`core`.c ========
+ *
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Server.h"
+#include "rsc_table.h"
+
+/* private functions */
+static Void smain(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "smain";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Task_create(smain, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
+
+
+/*
+ * ======== smain ========
+ */
+Void smain(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+ Error_Block eb;
+ Bool running = TRUE;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");
+
+ Error_init(&eb);
+
+ /* initialize modules */
+ Server_init();
+
+ /* turn on Diags_INFO trace */
+ Diags_setMask("Server+F");
+
+ /* loop forever */
+ while (running) {
+ /* Attach to other slave */
+ do {
+ status = Ipc_attach(MultiProc_getId("`thatCore`"));
+ Task_sleep(1);
+ } while (status == Ipc_E_NOTREADY);
+
+ if (status < 0) {
+ Log_print0(Diags_INFO,"smain: attach failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* BEGIN server phase */
+
+ /* server setup phase */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* END server phase */
+
+ /* Detach from other slave */
+ do {
+ status = Ipc_detach(MultiProc_getId("`thatCore`"));
+ } while (status == Ipc_E_NOTREADY);
+
+ if (status < 0) {
+ Log_print0(Diags_INFO,"smain: detach failed");
+ goto leave;
+ }
+
+ } /* while (running) */
+
+ /* finalize modules */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex41_forwardmsg/slave/makefile b/src/examples/templates/ex41_forwardmsg/slave/makefile
--- /dev/null
@@ -0,0 +1,196 @@
+#
+# Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var cfgBldDir = "shared"; /* by default, may be overridden */
+
+ if (platform.match(/^DRA7XX_(linux|qnx)_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else if (platform.match(/^OMAP54XX_(linux|qnx)_elf$/)) {
+ platInst = "ti.platforms.sdp5430:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+
+ if (target.match(/\.C66$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64T$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.M4$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Server.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all: debug release
+
+debug:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+release:
+ $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+server_`lcCore`.x: bin/$(PROFILE)/server_`lcCore`.x`suffix`
+bin/$(PROFILE)/server_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $(objs) \
+ $(addprefix -l ,$(libs)) $(CONFIG)/linker.cmd $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/linker.cmd `PCT`/compiler.opt: $(CONFIG)/.config ;
+$(CONFIG)/.config: `core`.cfg ../`cfgBldDir`/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../`cfgBldDir`/config.bld -r $(PROFILE) \
+% if (target.match(/\.M3$|\.M4$/)) {
+ --cfgArgs "{ configBld: \"../`cfgBldDir`/config.bld\" }" \
+% }
+ `core`.cfg
+ @$(ECHO) "" > $@
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_`lcCore`.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+# entry point is set to an aligned address so that IPC can load the slave
+LDFLAGS = -w -q -u _c_int00 -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex41_forwardmsg/slave/rsc_table_omap5_dsp.h b/src/examples/templates/ex41_forwardmsg/slave/rsc_table_omap5_dsp.h
--- /dev/null
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/*
+ * ======== rsc_table_omap5_dsp.h ========
+ *
+ * Define the resource table entries for all DSP cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_DSP_H_
+#define _RSC_TABLE_DSP_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* DSP Memory Map */
+#define L4_44XX_BASE 0x4A000000
+
+#define L4_PERIPHERAL_L4CFG (L4_44XX_BASE)
+#define DSP_PERIPHERAL_L4CFG 0x4A000000
+
+#define L4_PERIPHERAL_L4PER 0x48000000
+#define DSP_PERIPHERAL_L4PER 0x48000000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define DSP_PERIPHERAL_L4EMU 0x54000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define DSP_PERIPHERAL_DMM 0x4E000000
+
+#define L3_PERIPHERAL_ISS 0x52000000
+#define DSP_PERIPHERAL_ISS 0x52000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define DSP_TILER_MODE_0_1 0x60000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define DSP_TILER_MODE_2 0x70000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define DSP_TILER_MODE_3 0x78000000
+
+#define DSP_MEM_TEXT 0x20000000
+/* Co-locate alongside TILER region for easier flushing */
+#define DSP_MEM_IOBUFS 0x80000000
+#define DSP_MEM_DATA 0x90000000
+#define DSP_MEM_HEAP 0x90100000
+
+//0x85900000
+#define DSP_SR0_VIRT 0xBFC00000
+#define DSP_SR0 0xBFC00000
+
+#define DSP_MEM_IPC_DATA 0x9F000000
+#define DSP_MEM_IPC_VRING 0xA0000000
+#define DSP_MEM_RPMSG_VRING0 0xA0000000
+#define DSP_MEM_RPMSG_VRING1 0xA0004000
+#define DSP_MEM_VRING_BUFS0 0xA0040000
+#define DSP_MEM_VRING_BUFS1 0xA0080000
+
+#define DSP_MEM_IPC_VRING_SIZE SZ_1M
+#define DSP_MEM_IPC_DATA_SIZE SZ_1M
+#define DSP_MEM_TEXT_SIZE SZ_1M
+#define DSP_MEM_DATA_SIZE SZ_1M
+#define DSP_MEM_HEAP_SIZE (SZ_1M * 3)
+#define DSP_MEM_IOBUFS_SIZE (SZ_1M * 89)
+#define DSP_SR0_SIZE (SZ_1M * 1)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ */
+/* This address is derived from current IPU & ION carveouts */
+#define PHYS_MEM_IPC_VRING 0x95000000
+
+/* Need to be identical to that of IPU */
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define DSP_RPMSG_VQ0_SIZE 256
+#define DSP_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_DSP_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[17]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* heap carveout entry */
+ struct fw_rsc_carveout heap_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 17, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, heap_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_DSP_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { DSP_MEM_RPMSG_VRING0, 4096, DSP_RPMSG_VQ0_SIZE, 1, 0 },
+ { DSP_MEM_RPMSG_VRING1, 4096, DSP_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_TEXT, 0,
+ DSP_MEM_TEXT_SIZE, 0, 0, "DSP_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_DATA, 0,
+ DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_HEAP, 0,
+ DSP_MEM_HEAP_SIZE, 0, 0, "DSP_MEM_HEAP",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_IPC_DATA, 0,
+ DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:dsp",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ DSP_MEM_IPC_VRING_SIZE, 0, 0, "DSP_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ DSP_MEM_IOBUFS_SIZE, 0, 0, "DSP_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "DSP_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER, L4_PERIPHERAL_L4PER,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4PER",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "DSP_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_ISS, L3_PERIPHERAL_ISS,
+ SZ_256K, 0, 0, "DSP_PERIPHERAL_ISS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_SR0_VIRT, DSP_SR0,
+ DSP_SR0_SIZE, 0, 0, "DSP_SR0",
+ },
+
+};
+
+#endif /* _RSC_TABLE_DSP_H_ */
diff --git a/src/examples/templates/ex41_forwardmsg/slave/rsc_table_omap5_ipu.h b/src/examples/templates/ex41_forwardmsg/slave/rsc_table_omap5_ipu.h
--- /dev/null
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/*
+ * ======== rsc_table_omap5_ipu.h ========
+ *
+ * Define the resource table entries for all IPU cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_IPU_H_
+#define _RSC_TABLE_IPU_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* IPU Memory Map */
+#define L4_44XX_BASE 0x4a000000
+
+#define L4_PERIPHERAL_L4CFG (L4_44XX_BASE)
+#define IPU_PERIPHERAL_L4CFG 0xAA000000
+
+#define L4_PERIPHERAL_L4PER 0x48000000
+#define IPU_PERIPHERAL_L4PER 0xA8000000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define IPU_PERIPHERAL_L4EMU 0xB4000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define IPU_PERIPHERAL_DMM 0xAE000000
+
+#define L3_IVAHD_CONFIG 0x5A000000
+#define IPU_IVAHD_CONFIG 0xBA000000
+
+#define L3_IVAHD_SL2 0x5B000000
+#define IPU_IVAHD_SL2 0xBB000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define IPU_TILER_MODE_0_1 0x60000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define IPU_TILER_MODE_2 0x70000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define IPU_TILER_MODE_3 0x78000000
+
+#define IPU_MEM_TEXT 0x0
+#define IPU_MEM_DATA 0x80000000
+
+#define IPU_MEM_IOBUFS 0x90000000
+
+#define IPU_SR0_VIRT 0xBFC00000
+#define IPU_SR0 0xBFC00000
+
+#define IPU_MEM_IPC_DATA 0x9F000000
+#define IPU_MEM_IPC_VRING 0xA0000000
+#define IPU_MEM_RPMSG_VRING0 0xA0000000
+#define IPU_MEM_RPMSG_VRING1 0xA0004000
+#define IPU_MEM_VRING_BUFS0 0xA0040000
+#define IPU_MEM_VRING_BUFS1 0xA0080000
+
+#define IPU_MEM_IPC_VRING_SIZE SZ_1M
+#define IPU_MEM_IPC_DATA_SIZE SZ_1M
+#define IPU_MEM_TEXT_SIZE (SZ_1M * 6)
+#define IPU_MEM_DATA_SIZE (SZ_1M * 156)
+#define IPU_MEM_IOBUFS_SIZE (SZ_1M * 89)
+#define IPU_SR0_SIZE (SZ_1M * 1)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ * PHYS_MEM_IPC_VRING & PHYS_MEM_IPC_DATA MUST be together.
+ */
+#define PHYS_MEM_IPC_VRING 0x95800000
+
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define IPU_RPMSG_VQ0_SIZE 256
+#define IPU_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_IPU_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[17]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem11;
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 17, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, devmem11),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { IPU_MEM_RPMSG_VRING0, 4096, IPU_RPMSG_VQ0_SIZE, 1, 0 },
+ { IPU_MEM_RPMSG_VRING1, 4096, IPU_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_TEXT, 0,
+ IPU_MEM_TEXT_SIZE, 0, 0, "IPU_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_DATA, 0,
+ IPU_MEM_DATA_SIZE, 0, 0, "IPU_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_IPC_DATA, 0,
+ IPU_MEM_IPC_DATA_SIZE, 0, 0, "IPU_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:sysm3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ IPU_MEM_IPC_VRING_SIZE, 0, 0, "IPU_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ IPU_MEM_IOBUFS_SIZE, 0, 0, "IPU_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "IPU_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "IPU_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "IPU_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "IPU_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER, L4_PERIPHERAL_L4PER,
+ SZ_16M, 0, 0, "IPU_PERIPHERAL_L4PER",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "IPU_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_IVAHD_CONFIG, L3_IVAHD_CONFIG,
+ SZ_16M, 0, 0, "IPU_IVAHD_CONFIG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_IVAHD_SL2, L3_IVAHD_SL2,
+ SZ_16M, 0, 0, "IPU_IVAHD_SL2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "IPU_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_SR0_VIRT, IPU_SR0,
+ IPU_SR0_SIZE, 0, 0, "IPU_SR0",
+ },
+};
+
+#endif /* _RSC_TABLE_IPU_H_ */
diff --git a/src/examples/templates/ex41_forwardmsg/slave/rsc_table_vayu_dsp.h b/src/examples/templates/ex41_forwardmsg/slave/rsc_table_vayu_dsp.h
--- /dev/null
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2013-2014, 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.
+ */
+
+/*
+ * ======== rsc_table.h ========
+ *
+ * Define the resource table entries for all DSP cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ */
+
+#ifndef _RSC_TABLE_DSP_H_
+#define _RSC_TABLE_DSP_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* DSP Memory Map */
+#define L4_DRA7XX_BASE 0x4A000000
+
+#define L4_PERIPHERAL_L4CFG (L4_DRA7XX_BASE)
+#define DSP_PERIPHERAL_L4CFG 0x4A000000
+
+#define L4_PERIPHERAL_L4PER1 0x48000000
+#define DSP_PERIPHERAL_L4PER1 0x48000000
+
+#define L4_PERIPHERAL_L4PER2 0x48400000
+#define DSP_PERIPHERAL_L4PER2 0x48400000
+
+#define L4_PERIPHERAL_L4PER3 0x48800000
+#define DSP_PERIPHERAL_L4PER3 0x48800000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define DSP_PERIPHERAL_L4EMU 0x54000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define DSP_PERIPHERAL_DMM 0x4E000000
+
+#define L3_PERIPHERAL_ISS 0x52000000
+#define DSP_PERIPHERAL_ISS 0x52000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define DSP_TILER_MODE_0_1 0x60000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define DSP_TILER_MODE_2 0x70000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define DSP_TILER_MODE_3 0x78000000
+
+#define DSP_MEM_TEXT 0x95000000
+/* Co-locate alongside TILER region for easier flushing */
+#define DSP_MEM_IOBUFS 0x80000000
+#define DSP_MEM_DATA 0x95100000
+#define DSP_MEM_HEAP 0x95200000
+
+//0x85900000
+#define DSP_SR0_VIRT 0xBFC00000
+#define DSP_SR0 0xBFC00000
+
+#define DSP_MEM_IPC_DATA 0x9F000000
+#define DSP_MEM_IPC_VRING 0xA0000000
+#define DSP_MEM_RPMSG_VRING0 0xA0000000
+#define DSP_MEM_RPMSG_VRING1 0xA0004000
+#define DSP_MEM_VRING_BUFS0 0xA0040000
+#define DSP_MEM_VRING_BUFS1 0xA0080000
+
+#define DSP_MEM_IPC_VRING_SIZE SZ_1M
+#define DSP_MEM_IPC_DATA_SIZE SZ_1M
+#define DSP_MEM_TEXT_SIZE SZ_1M
+#define DSP_MEM_DATA_SIZE SZ_1M
+#define DSP_MEM_HEAP_SIZE (SZ_1M * 3)
+#define DSP_MEM_IOBUFS_SIZE (SZ_1M * 89)
+#define DSP_SR0_SIZE (SZ_1M * 1)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ */
+/* This address is derived from current IPU & ION carveouts */
+#define PHYS_MEM_IPC_VRING 0x99000000
+
+/* Need to be identical to that of IPU */
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define DSP_RPMSG_VQ0_SIZE 256
+#define DSP_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_DSP_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[19]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* heap carveout entry */
+ struct fw_rsc_carveout heap_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem11;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem12;
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 19, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, heap_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, devmem11),
+ offsetof(struct my_resource_table, devmem12),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_DSP_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { DSP_MEM_RPMSG_VRING0, 4096, DSP_RPMSG_VQ0_SIZE, 1, 0 },
+ { DSP_MEM_RPMSG_VRING1, 4096, DSP_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_TEXT, 0,
+ DSP_MEM_TEXT_SIZE, 0, 0, "DSP_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_DATA, 0,
+ DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_HEAP, 0,
+ DSP_MEM_HEAP_SIZE, 0, 0, "DSP_MEM_HEAP",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_IPC_DATA, 0,
+ DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:dsp",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ DSP_MEM_IPC_VRING_SIZE, 0, 0, "DSP_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ DSP_MEM_IOBUFS_SIZE, 0, 0, "DSP_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "DSP_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER1, L4_PERIPHERAL_L4PER1,
+ SZ_2M, 0, 0, "DSP_PERIPHERAL_L4PER1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER2, L4_PERIPHERAL_L4PER2,
+ SZ_4M, 0, 0, "DSP_PERIPHERAL_L4PER2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER3, L4_PERIPHERAL_L4PER3,
+ SZ_8M, 0, 0, "DSP_PERIPHERAL_L4PER3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "DSP_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_ISS, L3_PERIPHERAL_ISS,
+ SZ_256K, 0, 0, "DSP_PERIPHERAL_ISS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_SR0_VIRT, DSP_SR0,
+ DSP_SR0_SIZE, 0, 0, "DSP_SR0",
+ },
+
+};
+
+#endif /* _RSC_TABLE_DSP_H_ */
diff --git a/src/examples/templates/ex41_forwardmsg/slave/rsc_table_vayu_ipu.h b/src/examples/templates/ex41_forwardmsg/slave/rsc_table_vayu_ipu.h
--- /dev/null
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/*
+ * ======== rsc_table.h ========
+ *
+ * Define the resource table entries for all IPU cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ */
+
+#ifndef _RSC_TABLE_IPU_H_
+#define _RSC_TABLE_IPU_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* IPU Memory Map */
+#define L4_DRA7XX_BASE 0x4A000000
+
+/* L4_CFG & L4_WKUP */
+#define L4_PERIPHERAL_L4CFG (L4_DRA7XX_BASE)
+#define IPU_PERIPHERAL_L4CFG 0x6A000000
+
+#define L4_PERIPHERAL_L4PER1 0x48000000
+#define IPU_PERIPHERAL_L4PER1 0x68000000
+
+#define L4_PERIPHERAL_L4PER2 0x48400000
+#define IPU_PERIPHERAL_L4PER2 0x68400000
+
+#define L4_PERIPHERAL_L4PER3 0x48800000
+#define IPU_PERIPHERAL_L4PER3 0x68800000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define IPU_PERIPHERAL_L4EMU 0x74000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define IPU_PERIPHERAL_DMM 0x6E000000
+
+#define L3_IVAHD_CONFIG 0x5A000000
+#define IPU_IVAHD_CONFIG 0x7A000000
+
+#define L3_IVAHD_SL2 0x5B000000
+#define IPU_IVAHD_SL2 0x7B000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define IPU_TILER_MODE_0_1 0xA0000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define IPU_TILER_MODE_2 0xB0000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define IPU_TILER_MODE_3 0xB8000000
+
+#define IPU_MEM_TEXT 0x0
+#define IPU_MEM_DATA 0x80000000
+
+#define IPU_MEM_IOBUFS 0x90000000
+
+#define IPU_SR0_VIRT 0xBFC00000
+#define IPU_SR0 0xBFC00000
+
+#define IPU_MEM_IPC_DATA 0x9F000000
+#define IPU_MEM_IPC_VRING 0x60000000
+#define IPU_MEM_RPMSG_VRING0 0x60000000
+#define IPU_MEM_RPMSG_VRING1 0x60004000
+#define IPU_MEM_VRING_BUFS0 0x60040000
+#define IPU_MEM_VRING_BUFS1 0x60080000
+
+#define IPU_MEM_IPC_VRING_SIZE SZ_1M
+#define IPU_MEM_IPC_DATA_SIZE SZ_1M
+
+#define IPU_MEM_TEXT_SIZE (SZ_1M)
+#define IPU_MEM_DATA_SIZE (SZ_1M * 5)
+
+#define IPU_MEM_IOBUFS_SIZE (SZ_1M * 89)
+#define IPU_SR0_SIZE (SZ_1M * 1)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ * PHYS_MEM_IPC_VRING & PHYS_MEM_IPC_DATA MUST be together.
+ */
+#define PHYS_MEM_IPC_VRING 0x9D000000
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define IPU_RPMSG_VQ0_SIZE 256
+#define IPU_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_IPU_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[19]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem11;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem12;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem13;
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 19, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, devmem11),
+ offsetof(struct my_resource_table, devmem12),
+ offsetof(struct my_resource_table, devmem13),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { IPU_MEM_RPMSG_VRING0, 4096, IPU_RPMSG_VQ0_SIZE, 1, 0 },
+ { IPU_MEM_RPMSG_VRING1, 4096, IPU_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_TEXT, 0,
+ IPU_MEM_TEXT_SIZE, 0, 0, "IPU_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_DATA, 0,
+ IPU_MEM_DATA_SIZE, 0, 0, "IPU_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_IPC_DATA, 0,
+ IPU_MEM_IPC_DATA_SIZE, 0, 0, "IPU_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:sysm3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ IPU_MEM_IPC_VRING_SIZE, 0, 0, "IPU_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ IPU_MEM_IOBUFS_SIZE, 0, 0, "IPU_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "IPU_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "IPU_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "IPU_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "IPU_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER1, L4_PERIPHERAL_L4PER1,
+ SZ_2M, 0, 0, "IPU_PERIPHERAL_L4PER1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER2, L4_PERIPHERAL_L4PER2,
+ SZ_4M, 0, 0, "IPU_PERIPHERAL_L4PER2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER3, L4_PERIPHERAL_L4PER3,
+ SZ_8M, 0, 0, "IPU_PERIPHERAL_L4PER3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "IPU_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_IVAHD_CONFIG, L3_IVAHD_CONFIG,
+ SZ_16M, 0, 0, "IPU_IVAHD_CONFIG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_IVAHD_SL2, L3_IVAHD_SL2,
+ SZ_16M, 0, 0, "IPU_IVAHD_SL2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "IPU_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_SR0_VIRT, IPU_SR0,
+ IPU_SR0_SIZE, 0, 0, "IPU_SR0",
+ },
+};
+
+#endif /* _RSC_TABLE_IPU_H_ */
diff --git a/src/examples/templates/ex44_compute/Makefile b/src/examples/templates/ex44_compute/Makefile
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+TARGETS = host dsp transport/hlos transport/rtos
+
+EXBASE = .
+include $(EXBASE)/products.mak
+
+.PHONY: all $(TARGETS)
+
+all: dsp host
+dsp: transport/rtos
+host: transport/hlos
+
+$(TARGETS):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@
+
+help:
+ @$(ECHO) "make # build example"
+ @$(ECHO) "make clean # clean everything"
+
+clean:: $(addsuffix _clean,$(TARGETS))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(TARGETS))::
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex44_compute/dsp/Compute.c b/src/examples/templates/ex44_compute/dsp/Compute.c
--- /dev/null
@@ -0,0 +1,562 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Compute.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Compute__Desc
+#define MODULE_NAME "Compute"
+
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/HeapBufMP.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "Compute.h"
+#include "../shared/Compute_shared.h"
+#include "../shared/SvrMsg.h"
+
+#define CLSZ MultiProc_clusterSize
+
+typedef struct {
+ MessageQ_QueueId cmd;
+ MessageQ_QueueId data;
+} Compute_Queues;
+
+/* module structure */
+typedef struct {
+ Bool run; /* main loop run flag */
+ Semaphore_Handle ipcReady; /* IPC synchronizing object */
+ UInt16 myHeapId; /* this processor's clusterId */
+ HeapBufMP_Handle heaps[CLSZ]; /* message heaps (local and remote) */
+ MessageQ_Handle cmdQue; /* command queue (inbound messages) */
+ MessageQ_Handle dataQue; /* data queue (inbound messages) */
+ Compute_Queues peer[CLSZ]; /* message queue IDs (outbound) */
+} Compute_Module;
+
+/* private functions */
+Void Compute_data(Compute_Msg *msg);
+Void Compute_hello(Void);
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Int Mod_curInit = 0;
+static Compute_Module Compute_module;
+static volatile Bool Compute_ipcReady = FALSE;
+static volatile Bool Compute_taskWaiting = FALSE;
+
+
+/*
+ * ======== Compute_data ========
+ */
+Void Compute_data(Compute_Msg *msg)
+{
+ switch (msg->arg1) {
+ case Compute_Data_HELLO:
+ Log_print1(Diags_INFO, "Compute_data: message received, HELLO, "
+ "sender=%d", (IArg)msg->arg2);
+ break;
+
+ default:
+ Log_error1("unknown command: arg1=%d", (IArg)msg->arg1);
+ break;
+ }
+}
+
+/*
+ * ======== Compute_destroy ========
+ */
+Void Compute_destroy(Void)
+{
+ Int status = 0;
+ UInt16 selfId, hostId, procId;
+ UInt16 clusterBase, clusterId;
+
+ Log_print0(Diags_INFO, "Compute_destroy: -->");
+
+
+ /* reference count the module usage */
+ if (--Mod_curInit > 0) {
+ goto leave; /* object still in use */
+ }
+
+ /* needed to iterate over members of the cluster */
+ selfId = MultiProc_self();
+ hostId = MultiProc_getId("HOST");
+ clusterBase = MultiProc_getBaseIdOfCluster();
+
+ /* close all remote queues */
+ for (clusterId = 0; clusterId < MultiProc_clusterSize; clusterId++) {
+ procId = clusterBase + clusterId;
+
+ /* skip myself and the host (not a compute processor) */
+ if ((procId == selfId) || (procId == hostId)) {
+ continue;
+ }
+
+ MessageQ_close(&Compute_module.peer[clusterId].data);
+ MessageQ_close(&Compute_module.peer[clusterId].cmd);
+ }
+
+ /* delete the local message queues */
+ status = MessageQ_delete(&Compute_module.dataQue);
+
+ if (status < 0) {
+ Log_error1("Compute_destroy: data queue delete error=%d", (IArg)status);
+ goto leave;
+ }
+
+ status = MessageQ_delete(&Compute_module.cmdQue);
+
+ if (status < 0) {
+ Log_error1("Compute_destroy: command queue delete error=%d",
+ (IArg)status);
+ goto leave;
+ }
+
+ /* close all remote message heaps */
+ for (clusterId = 0; clusterId < MultiProc_clusterSize; clusterId++) {
+
+ /* compute global MultiProc_ID */
+ procId = clusterBase + clusterId;
+
+ /* skip myself and the host (not a compute processor) */
+ if ((procId == selfId) || (procId == hostId)) {
+ continue;
+ }
+
+ /* finalize the remote heap */
+ MessageQ_unregisterHeap(clusterId);
+ HeapBufMP_close(&Compute_module.heaps[clusterId]);
+ }
+
+ /* finalize the local message heap */
+ MessageQ_unregisterHeap(Compute_module.myHeapId);
+ HeapBufMP_delete(&Compute_module.heaps[Compute_module.myHeapId]);
+
+ /* delete the semaphore */
+ Semaphore_delete(&Compute_module.ipcReady);
+
+leave:
+ /* disable log events */
+ Log_print1(Diags_INFO, "Compute_delete: <-- status=%d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+/*
+ * ======== Compute_isReady ========
+ */
+Bool Compute_isReady(Void)
+{
+ return (Compute_module.run);
+}
+
+/*
+ * ======== Compute_exec ========
+ */
+Int Compute_exec(Void)
+{
+ Int status = 0;
+ MessageQ_Msg mqMsg;
+ Compute_Msg *msg;
+
+ Log_print0(Diags_INFO, "Compute_exec: -->");
+ Compute_module.run = TRUE;
+
+ /* main loop */
+ while (Compute_module.run) {
+
+ /* wait for inbound message */
+ Log_print0(Diags_INFO, "waiting for command");
+ status = MessageQ_get(Compute_module.cmdQue, &mqMsg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ Log_error1("Compute_exec: message get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (Compute_Msg *)mqMsg;
+ Log_print1(Diags_INFO, "message received, cmd=%d", (IArg)msg->command);
+
+ switch (msg->command) {
+ case Compute_Cmd_PROCESS:
+ Log_print1(Diags_INFO, "processed message from procId=%d",
+ (IArg)msg->arg1);
+ break;
+
+ case Compute_Cmd_DATA:
+ Compute_data(msg);
+ break;
+
+ default:
+ Log_error1("unknown command, cmd=%d", (IArg)msg->command);
+ break;
+ }
+
+ /* return the message to its heap */
+ MessageQ_free(mqMsg);
+
+ } /* while (run) */
+
+leave:
+ Log_print1(Diags_INFO, "Compute_exec: <-- %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Compute_hello ========
+ */
+Void Compute_hello(Void)
+{
+ Int status;
+ UInt16 selfId, hostId, procId;
+ UInt16 clusterBase, clusterId;
+
+ MessageQ_QueueId qid;
+ MessageQ_Msg mqMsg;
+ Compute_Msg *msg;
+
+
+ /* needed to iterate over members of the cluster */
+ selfId = MultiProc_self();
+ hostId = MultiProc_getId("HOST");
+ clusterBase = MultiProc_getBaseIdOfCluster();
+
+ /* send a command to every other compute processor in the cluster */
+ for (clusterId = 0; clusterId < MultiProc_clusterSize; clusterId++) {
+
+ /* compute global MultiProc_ID */
+ procId = clusterBase + clusterId;
+
+ /* skip myself and the host (not a compute processor) */
+ if ((procId == selfId) || (procId == hostId)) {
+ continue;
+ }
+
+ /* allocate the message */
+ mqMsg = MessageQ_alloc(Compute_module.myHeapId, sizeof(Compute_Msg));
+
+ if (mqMsg == NULL) {
+ Log_error0("Error in MessageQ_alloc");
+ status = -1;
+ goto leave;
+ }
+
+ /* fill in message payload */
+ msg = (Compute_Msg *)mqMsg;
+ msg->command = Compute_Cmd_DATA;
+ msg->arg1 = Compute_Data_HELLO;
+ msg->arg2 = selfId;
+ qid = Compute_module.peer[clusterId].cmd;
+
+ /* send message */
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ Log_error0("Error in MessageQ_put");
+ goto leave;
+ }
+ Log_print2(Diags_INFO, "Comput_hello: message sent: procId=%d, "
+ "qid=0x%08x\n", (IArg)procId, (IArg)qid);
+ }
+leave:
+ return;
+}
+
+/*
+ * ======== Compute_ipcIsReady ========
+ * Signal the Compute task that IPC is ready.
+ *
+ * This function is called from another execution context. Must be
+ * careful to ensure local resources have been created.
+ */
+Void Compute_ipcIsReady(Void)
+{
+ Compute_ipcReady = TRUE;
+
+ /* semaphore might not yet exist, must check if task is waiting */
+ if (Compute_taskWaiting) {
+ Semaphore_post(Compute_module.ipcReady);
+ }
+}
+
+/*
+ * ======== Compute_taskFxn ========
+ */
+Void Compute_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+ Log_print0(Diags_INFO, "Compute_taskFxn: -->");
+
+ /* setup phase */
+ status = Compute_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Compute_exec();
+
+leave:
+ /* shutdown phase */
+ Compute_destroy();
+
+ Log_print1(Diags_INFO, "Compute_taskFxn: <-- %d", (IArg)status);
+}
+
+/*
+ * ======== Compute_setup ========
+ */
+Int Compute_setup(Void)
+{
+ #define CBUF_SZ 48
+
+ Int status = 0;
+ Int i;
+ Error_Block eb;
+ Semaphore_Params semParams;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ Char cbuf[CBUF_SZ];
+ HeapBufMP_Params heapParams;
+ HeapBufMP_Handle heap;
+ UInt16 selfId, hostId, procId;
+ UInt16 clusterBase, clusterId;
+ MessageQ_QueueId qid;
+
+
+ /* reference count the module usage */
+ if (Mod_curInit >= 1) {
+ goto leave; /* already initialized */
+ }
+
+ /* initialize module state */
+ Error_init(&eb);
+ Compute_module.run = FALSE;
+ Compute_module.ipcReady = NULL;
+ Compute_module.myHeapId = MultiProc_self() - MultiProc_getBaseIdOfCluster();
+ Compute_module.cmdQue = NULL;
+ Compute_module.dataQue = NULL;
+
+ for (i = 0; i < CLSZ; i++) {
+ Compute_module.heaps[i] = NULL;
+ Compute_module.peer[i].cmd = MessageQ_INVALIDMESSAGEQ;
+ Compute_module.peer[i].data = MessageQ_INVALIDMESSAGEQ;
+ }
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+F");
+ Log_print0(Diags_INFO, "Compute_setup: -->");
+
+ /* initialize the semaphore */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_BINARY;
+
+ Compute_module.ipcReady = Semaphore_create(0, &semParams, &eb);
+
+ if (Error_check(&eb)) {
+ status = -2;
+ goto leave;
+ }
+
+ /* wait here until IPC is ready */
+ Compute_taskWaiting = TRUE;
+
+ if (!Compute_ipcReady) {
+ Log_print0(Diags_INFO, "Compute_setup: waiting for IPC");
+ Semaphore_pend(Compute_module.ipcReady, BIOS_WAIT_FOREVER);
+ }
+ Compute_taskWaiting = FALSE;
+ Log_print0(Diags_INFO, "Compute_setup: IPC ready");
+
+ /* create a heap for outbound message pool (to cluster members only) */
+ HeapBufMP_Params_init(&heapParams);
+ System_snprintf(cbuf, CBUF_SZ, "COMPUTE_HEAP_%d", MultiProc_self());
+ heapParams.name = cbuf;
+ heapParams.regionId = 0;
+ heapParams.blockSize = Compute_Msg_BLOCK;
+ heapParams.numBlocks = MultiProc_clusterSize;
+
+ heap = HeapBufMP_create(&heapParams);
+
+ if (heap == NULL) {
+ Log_error0("Compute_setup: heap create failed");
+ status = -3;
+ goto leave;
+ }
+ Compute_module.heaps[Compute_module.myHeapId] = heap;
+
+ /* register heap with MessageQ */
+ status = MessageQ_registerHeap(heap, Compute_module.myHeapId);
+
+ if (status < 0) {
+ Log_error0("Compute_setup: heap already exists");
+ status = -4;
+ goto leave;
+ }
+
+ /* needed to iterate over members of the cluster */
+ selfId = MultiProc_self();
+ hostId = MultiProc_getId("HOST");
+ clusterBase = MultiProc_getBaseIdOfCluster();
+
+ /* open remote message pools to recycle inbound messages */
+ for (clusterId = 0; clusterId < MultiProc_clusterSize; clusterId++) {
+
+ /* compute global MultiProc_ID */
+ procId = clusterBase + clusterId;
+
+ /* skip myself and the host (not a compute processor) */
+ if ((procId == selfId) || (procId == hostId)) {
+ continue;
+ }
+
+ System_snprintf(cbuf, CBUF_SZ, "COMPUTE_HEAP_%d", procId);
+
+ do {
+ status = HeapBufMP_open(cbuf, &heap);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ Task_sleep(1);
+ }
+ } while(status == MessageQ_E_NOTFOUND);
+
+ Compute_module.heaps[clusterId] = heap;
+ Log_print1(Diags_INFO, "opened compute heap %d", (IArg)procId);
+
+ /* register the remote message pool for message recycling */
+ status = MessageQ_registerHeap(heap, clusterId);
+
+ if (status < 0) {
+ Log_error0("Compute_setup: heap already exists");
+ status = -5;
+ goto leave;
+ }
+ }
+
+ /* create command queue (reserved queue index) */
+ MessageQ_Params_init(&msgqParams);
+ msgqParams.queueIndex = Compute_CMD_QUE;
+ Compute_module.cmdQue = MessageQ_create(NULL, &msgqParams);
+
+ if (Compute_module.cmdQue == NULL) {
+ Log_error0("Compute_setup: command queue create failed");
+ status = -6;
+ goto leave;
+ }
+
+ /* create data queue (reserved queue index) */
+ MessageQ_Params_init(&msgqParams);
+ msgqParams.queueIndex = Compute_DATA_QUE;
+ Compute_module.dataQue = MessageQ_create(NULL, &msgqParams);
+
+ if (Compute_module.dataQue == NULL) {
+ Log_error0("Compute_setup: data queue create failed");
+ status = -7;
+ goto leave;
+ }
+
+ /* open compute message queues (only for peers in the cluster) */
+ for (clusterId = 0; clusterId < MultiProc_clusterSize; clusterId++) {
+ procId = clusterBase + clusterId;
+
+ /* skip myself and the host (not a compute processor) */
+ if ((procId == selfId) || (procId == hostId)) {
+ continue;
+ }
+
+ /* compute queueId for remote queues */
+ qid = MessageQ_openQueueId(Compute_CMD_QUE, procId);
+ Compute_module.peer[clusterId].cmd = qid;
+ Log_print1(Diags_INFO, "opened command queue 0x%x", (IArg)qid);
+
+ qid = MessageQ_openQueueId(Compute_DATA_QUE, procId);
+ Compute_module.peer[clusterId].data = qid;
+ Log_print1(Diags_INFO, "opened data queue 0x%x", (IArg)qid);
+ }
+
+leave:
+ /* success, increment reference count */
+ if (status >= 0) {
+ Mod_curInit++;
+ }
+
+ /* error handling */
+ else {
+ /* unregister diags mask */
+ /* release resources */
+ }
+
+ Log_print0(Diags_INFO, "Compute_setup: <--");
+ return (status);
+}
+
+/*
+ * ======== Compute_stop ========
+ */
+Void Compute_stop(Void)
+{
+ Compute_module.run = FALSE;
+}
diff --git a/src/examples/templates/ex44_compute/dsp/Compute.h b/src/examples/templates/ex44_compute/dsp/Compute.h
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Compute.h ========
+ */
+
+#ifndef Compute__include
+#define Compute__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Compute_destroy(Void);
+Void Compute_ipcIsReady(Void);
+Bool Compute_isReady(Void);
+Int Compute_exec(Void);
+Void Compute_taskFxn(UArg arg0, UArg arg1);
+Int Compute_setup(Void);
+Void Compute_stop(Void);
+
+
+Void Compute_hello(Void);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/dsp/Control.c b/src/examples/templates/ex44_compute/dsp/Control.c
--- /dev/null
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Control.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Control__Desc
+#define MODULE_NAME "Control"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/ipcmgr/IpcMgr.h>
+#include <ti/sdo/ipc/interfaces/INetworkTransport.h>
+#include <ti/sdo/ipc/interfaces/ITransport.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Compute.h"
+#include "Control.h"
+#include "PEB.h"
+#include "../shared/Control_shared.h"
+#include "../shared/ResMgr_shared.h"
+#include <transport/rtos/TransportQMSS.h>
+
+#define TRANSPORT_QMSS_ID 1
+
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+Semaphore_Handle Control_sem;
+MessageQ_Handle Control_queue; /* inbound messages */
+MessageQ_QueueId Control_rmQue; /* resoure manager queue */
+TransportQMSS_Handle Control_transQMSS;
+
+
+/*
+ * ======== Control_taskFxn ========
+ */
+Void Control_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+ Error_Block eb;
+ Char cbuf[48];
+ Bool ready;
+
+ Registry_Result result;
+ Semaphore_Params semParams;
+ MessageQ_Params msgqParams;
+ MessageQ_Msg mqMsg, appMsg;
+ MessageQ_QueueId qid;
+ Control_Msg *msg;
+ ResMgr_Msg *rmMsg;
+ UInt16 hostProcId;
+
+ ITransport_Handle transport;
+ INetworkTransport_Handle transNetwork;
+ TransportQMSS_Params transQmssParams;
+
+ Error_init(&eb);
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+F");
+ Log_print0(Diags_INFO, "Control_taskFxn: -->");
+
+ /* initialize the semaphore */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_BINARY;
+
+ Control_sem = Semaphore_create(0, &semParams, &eb);
+
+ if (Error_check(&eb)) {
+ status = -2;
+ goto leave;
+ }
+
+ /* setup IPC */
+ Log_print0(Diags_INFO, "Control_taskFxn: initializing IPC");
+
+ /* setup TransportRpmsg for host communication */
+ IpcMgr_ipcStartup();
+
+ /* setup IPC for slave to slave communication */
+ status = Ipc_start();
+
+ if (status < 0) {
+ Log_error0("Control_TaskFxn: Ipc_start failed");
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO, "Control_taskFxn: IPC startup complete");
+
+ /* compute the message queue name */
+ System_sprintf(cbuf, Control_QueNameFmt, MultiProc_self());
+
+ /* create message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Control_queue = MessageQ_create(cbuf, &msgqParams);
+
+ if (Control_queue == NULL) {
+ Log_error0("Control_TaskFxn: message queue create failed");
+ goto leave;
+ }
+
+ /* inform other modules that IPC is ready */
+ Compute_ipcIsReady();
+ PEB_ipcIsReady();
+
+ /* busy wait until other modules are ready */
+ do {
+ ready = TRUE;
+
+ if (!Compute_isReady()) {
+ ready = FALSE;
+ }
+
+ if (!PEB_isReady()) {
+ ready = FALSE;
+ }
+
+ if (!ready) {
+ Task_sleep(10);
+ }
+
+ } while (!ready);
+
+ Log_print0(Diags_INFO, "Control_taskFxn: peer modules are ready");
+
+ /* wait for application start message */
+ Log_print0(Diags_INFO, "Control_taskFxn: waiting for start message");
+ status = MessageQ_get(Control_queue, &appMsg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ Log_error1("Control_taskFxn: message get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (Control_Msg *)appMsg;
+
+ if (msg->command != Control_Cmd_INITIALIZE) {
+ Log_print1(Diags_INFO, "Control_taskFxn: Warning: "
+ "discarding message, cmd=%d", (IArg)msg->command);
+ status = -1;
+ goto leave;
+ }
+
+ /* open the resource manager message queue on the host */
+ hostProcId = MultiProc_getId("HOST");
+ Control_rmQue = MessageQ_openQueueId(ResMgr_QueIndex, hostProcId);
+
+ /* request resource from the resource manager */
+ mqMsg = MessageQ_alloc(0, sizeof(ResMgr_Msg));
+
+ if (mqMsg == NULL) {
+ status = -1;
+ Log_error0("Control_taskFxn: message alloc failed");
+ goto leave;
+ }
+
+ rmMsg = (ResMgr_Msg *)mqMsg;
+ rmMsg->cmd = ResMgr_Cmd_REQUEST;
+ rmMsg->arg1 = MultiProc_self();
+ rmMsg->arg2 = 8;
+
+ /* set return address */
+ MessageQ_setReplyQueue(Control_queue, mqMsg);
+
+ /* send request to resource manager */
+ status = MessageQ_put(Control_rmQue, mqMsg);
+
+ if (status < 0) {
+ Log_error1("message put error=%d", (IArg)status);
+ status = -2;
+ goto leave;
+ }
+ Log_print0(Diags_INFO, "Control_taskFxn: RM message sent");
+
+ /* wait for reply message from resource manager */
+ status = MessageQ_get(Control_queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ Log_error1("Control_taskFxn: message get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ MessageQ_free(mqMsg);
+
+ /* create the qmss transport instance */
+ TransportQMSS_Params_init(&transQmssParams);
+
+ Control_transQMSS = TransportQMSS_create(&transQmssParams, &eb);
+
+ if (Error_check(&eb)) {
+ Log_error0("transport qmss create failed");
+ status = -3;
+ goto leave;
+ }
+
+ /* register qmss transport with MessageQ */
+ transNetwork = TransportQMSS_Handle_upCast(Control_transQMSS);
+ transport = INetworkTransport_Handle_upCast(transNetwork);
+ MessageQ_registerTransportId(TRANSPORT_QMSS_ID, transport);
+ Log_print0(Diags_INFO, "TransportQMSS instance created");
+
+ /* return application start message */
+ qid = MessageQ_getReplyQueue(appMsg);
+
+ status = MessageQ_put(qid, appMsg);
+
+ if (status < 0) {
+ Log_error1("Control_taskFxn: message put error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* wait here */
+ Log_print0(Diags_INFO, "Control_taskFxn: waiting for work");
+ Semaphore_pend(Control_sem, BIOS_WAIT_FOREVER);
+
+
+ /* finalize phase */
+
+ /* delete the message queue */
+ MessageQ_delete(&Control_queue);
+
+leave:
+ Log_print1(Diags_INFO, "Control_taskFxn: <-- %d", (IArg)status);
+}
diff --git a/src/examples/templates/ex44_compute/dsp/Control.h b/src/examples/templates/ex44_compute/dsp/Control.h
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Control.h ========
+ */
+
+#ifndef Control__include
+#define Control__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Control_taskFxn(UArg arg0, UArg arg1);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/dsp/DspN.cfg b/src/examples/templates/ex44_compute/dsp/DspN.cfg
--- /dev/null
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Dsp1.cfg ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+var Diags = xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Task');
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+
+xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.global.SR0_cacheEnable = true;
+Program.global.SR0_owner = "CORE0"; /* DSP1 is owner of SR #0 */
+
+/* register a startup first function to set SR#0 owner */
+var Startup = xdc.useModule('xdc.runtime.Startup');
+Startup.firstFxns.$add('&MainDspN_startupFirst');
+
+/* configure processor names */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.procAddrMode = MultiProc.ProcAddrMode_Cluster;
+
+/* these must match host side configuration: MultiProcCfg_tci6638.c */
+
+/* single device configuration */
+//var procNameAry = MultiProc.getDeviceProcNames();
+
+/* development configuration */
+var procNameAry = [ "HOST", "CORE0", "CORE1", "CORE2", "CORE3", "CORE4",
+ "CORE5", "CORE6", "CORE7" ];
+MultiProc.numProcessors = 4608;
+MultiProc.baseIdOfCluster = MultiProc.INVALIDID;
+
+/* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+MultiProc.setConfig(null, procNameAry);
+Program.global.MultiProc_clusterSize = MultiProc.numProcsInCluster;
+
+var MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.tci663x.MultiProcSetup');
+MultiProcSetup.configureProcId = false;
+
+/* ipc startup configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_ALL;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+// ownerProcId: MultiProc.getIdMeta(Program.global.SR0_owner),
+ isValid: false,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
+
+/* make SR_0 non-cacheable */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(SR0Mem.base, SR0Mem.len, Cache.Mar_DISABLE);
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+/* used to write SysMin trace buffer to memory */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+/* should be done internally */
+xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+
+xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+/* why doe we need this? */
+Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+/* is this not enabled by default? */
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+Hwi.enableException = true;
+
+/* This makes the vrings address range 0xA000_0000 to 0xA1FF_FFFF 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');
+Cache.setMarMeta(0xA0000000, 0x2000000, 0); /* 32 MB, value should be enum */
+
+/* Enable Memory Translation module that operates on the Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = Program.platform.dataMemory;
+
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+/* MessageQ application specific configuration */
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.numReservedEntries = 8;
+MessageQ.numHeaps = 9; /* 1 for transport, 1 for each dsp (8x) */
+
+/* this heap is used by RPMsgTransport */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var heapBufP = new HeapBuf.Params;
+heapBufP.align = 8;
+heapBufP.blockSize = 512;
+heapBufP.numBlocks = 64;
+var msgHeap = HeapBuf.create(heapBufP);
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+VirtioSetup.common$.diags_INFO = Diags.RUNTIME_OFF;
+
+//xdc.loadPackage('ti.ipc.transports').profile = 'release';
+xdc.loadPackage('ti.ipc.transports');
+
+/* why is this not done internally? */
+var NotifyDriverCirc =
+ xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+NotifyDriverCirc.InterruptProxy = Interrupt;
+
+/* Notify brings in the ti.sdo.ipc.family.Settings module, which does
+ * lots of config magic which will need to be UNDONE later, or setup
+ * earlier, to get the necessary overrides to various IPC module proxies!
+ */
+var Notify = xdc.module('ti.sdo.ipc.Notify');
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+
+/*
+ * ======== transport ========
+ */
+var TransportQMSS = xdc.useModule('transport.rtos.TransportQMSS');
+
+
+/*
+ * ======== Operating System Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog_Core1";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex44_compute/dsp/MainDspN.c b/src/examples/templates/ex44_compute/dsp/MainDspN.c
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== MainDspN.c ========
+ * Platform: DRA7XX_bios_elf
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h> /* Program.global in cfg script */
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Compute.h"
+#include "Control.h"
+#include "PEB.h"
+
+#define PRI_LOW 2
+#define PRI_MED 3
+#define PRI_HIGH 5
+
+
+Void MainDspN_startupFirst(Void);
+
+UInt8 MainDspN_configData[20] = {
+ 0x98, 0x07, 0xfc, 0x20, 0x3e,
+ 0xe7, 0x2e, 0x68, 0x57, 0xda,
+ 0x95, 0xec, 0xd6, 0x19, 0xfe,
+ 0xed, 0x55, 0xf0, 0x50, 0xe6
+};
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+// { volatile Int spin=1; while (spin); }
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create the IPC task */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Ipc";
+ taskParams.priority = PRI_LOW;
+ taskParams.stackSize = 0x600;
+ Task_create(Control_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create ipc task");
+ }
+
+ /* create the PEB task */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "PEB";
+ taskParams.priority = PRI_MED;
+ taskParams.stackSize = 0x600;
+ Task_create(PEB_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create peb task");
+ }
+
+ /* create the compute task */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Compute";
+ taskParams.priority = PRI_HIGH;
+ taskParams.stackSize = 0x1000;
+ Task_create(Compute_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create compute task");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== MainDspN_startupFirst ========
+ */
+Void MainDspN_startupFirst(Void)
+{
+ Int status;
+ UInt16 baseId;
+ SharedRegion_Entry *sre;
+
+
+ /* Extract the cluster baseId from the config data array
+ *
+ * Before loading the program, the config data array was
+ * "patched" with the correct cluster baseId. Use that value
+ * now to set the cluster baseId in the MultiProc module.
+ */
+ baseId = *(UInt16 *)(MainDspN_configData + 2);
+
+ /* run-time configuration of the cluster baseId */
+ status = MultiProc_setBaseIdOfCluster(baseId);
+
+ if (status < 0) {
+ System_abort("MainDspN_startupFirst: failed to set baseId");
+ }
+
+ /* Internal IPC cluster configuration
+ *
+ * This function will perform run-time configuration of IPC
+ * internal data structures related to the cluster baseId.
+ */
+ status = Ipc_clusterConfig();
+
+ if (status < 0) {
+ System_abort("MainDspN_startupFirst: ipc cluster config failed");
+ }
+
+ /* Define the shared region owner
+ *
+ * Now that we have a valid cluster baseId, we can look up the
+ * procId by name and assign the shared region owner. This example
+ * uses only SR #0. Do this for each region you have configured.
+ */
+ sre = SharedRegion_getEntryPtr(0);
+ sre->ownerProcId = MultiProc_getId(SR0_owner); /* DSP1 is owner */
+ sre->isValid = TRUE;
+}
diff --git a/src/examples/templates/ex44_compute/dsp/Makefile b/src/examples/templates/ex44_compute/dsp/Makefile
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = MainDspN.c Control.c PEB.c Compute.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66,$(srcs)))
+libs =
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug compute_dspN.x
+# $(MAKE) PROFILE=release compute_dspN.x
+
+compute_dspN.x: bin/$(PROFILE)/compute_dspN.xe66
+bin/$(PROFILE)/compute_dspN.xe66: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.oe66: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: DspN.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -Dxdc.platform.custom.check=false \
+ -t ti.targets.elf.C66 \
+ -c $(ti.targets.elf.C66) \
+ -p ti.platforms.evmTCI6638K2K:coreN \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" DspN.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/compute_dspN.xe66 $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/compute_dspN.xe66 $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+EXAMPLE = $(word 1,$(subst /dsp, dsp,$(CURDIR)))
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(EXAMPLE)
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(ti.targets.elf.C66)
+
+CC = $(CGTOOLS)/bin/cl6x -c
+LD = $(CGTOOLS)/bin/cl6x -z
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map --cinit_compression=off
+LDLIBS = -l $(CGTOOLS)/lib/rts6600_elf.lib
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex44_compute/dsp/PEB.c b/src/examples/templates/ex44_compute/dsp/PEB.c
--- /dev/null
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== PEB.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC PEB__Desc
+#define MODULE_NAME "PEB"
+
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "Compute.h"
+#include "PEB.h"
+#include "../shared/PE_Msg.h"
+#include "../shared/PEB_shared.h"
+
+/* module structure */
+typedef struct {
+ Bool running; /* main loop run flag */
+ Semaphore_Handle ipcReady; /* IPC synchronizing object */
+ MessageQ_Handle queue; /* message queue (inbound) */
+} PEB_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Int Mod_curInit = 0;
+static PEB_Module PEB_module;
+static volatile Bool PEB_ipcReady = FALSE;
+static volatile Bool PEB_taskWaiting = FALSE;
+
+
+/*
+ * ======== PEB_destroy ========
+ */
+Void PEB_destroy(Void)
+{
+ Int status = 0;
+
+ Log_print0(Diags_INFO, "PEB_destroy: -->");
+
+ /* TODO enter gate */
+
+ /* reference count the module usage */
+ if (--Mod_curInit > 0) {
+ goto leave; /* object still in use */
+ }
+
+ /* delete the message queue */
+ status = MessageQ_delete(&PEB_module.queue);
+
+ if (status < 0) {
+ Log_error1("PEB_destroy: message queue delete error=%d",
+ (IArg)status);
+ goto leave;
+ }
+
+ /* delete the semaphore */
+ Semaphore_delete(&PEB_module.ipcReady);
+
+leave:
+ /* disable log events */
+ Log_print1(Diags_INFO, "PEB_delete: <-- status=%d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+
+ /* TODO leave gate */
+}
+
+/*
+ * ======== PEB_ipcIsReady ========
+ * Signal the PEB task that IPC is ready.
+ *
+ * This function is called from another execution context. Must be
+ * careful to ensure local resources have been created.
+ */
+Void PEB_ipcIsReady(Void)
+{
+ PEB_ipcReady = TRUE;
+
+ /* semaphore might not yet exist, must check if task is waiting */
+ if (PEB_taskWaiting) {
+ Semaphore_post(PEB_module.ipcReady);
+ }
+}
+
+/*
+ * ======== PEB_isReady ========
+ */
+Bool PEB_isReady(Void)
+{
+ return (PEB_module.running);
+}
+
+/*
+ * ======== PEB_exec ========
+ */
+Int PEB_exec(Void)
+{
+ Int status = 0;
+ MessageQ_Msg mqMsg;
+ PE_Msg *msg;
+
+ Log_print0(Diags_INFO, "PEB_exec: -->");
+ PEB_module.running = TRUE;
+
+ /* main loop */
+ while (PEB_module.running) {
+
+ /* wait for inbound message */
+ Log_print0(Diags_INFO, "PEB_exec: waiting for message");
+ status = MessageQ_get(PEB_module.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ Log_error1("PEB_exec: message get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (PE_Msg *)mqMsg;
+ Log_print1(Diags_INFO, "PEB_exec: message received, cmd=%d",
+ (IArg)msg->command);
+
+ switch (msg->command) {
+ case PE_Command_HELLO:
+ Log_print1(Diags_INFO, "PEB_exec: cmd=HELLO, sender=%d",
+ (IArg)msg->arg1);
+ Compute_hello();
+ break;
+ }
+
+ /* free the message back */
+ MessageQ_free(mqMsg);
+
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_INFO, "PEB_exec: <-- %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== PEB_taskFxn ========
+ */
+Void PEB_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+ Log_print0(Diags_INFO, "PEB_taskFxn: -->");
+
+ /* setup phase */
+ status = PEB_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = PEB_exec();
+
+leave:
+ /* shutdown phase */
+ PEB_destroy();
+
+ Log_print1(Diags_INFO, "PEB_taskFxn: <-- %d", (IArg)status);
+}
+
+/*
+ * ======== PEB_setup ========
+ */
+Int PEB_setup(Void)
+{
+ Int status = 0;
+ Error_Block eb;
+ Semaphore_Params semParams;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ Char cbuf[48];
+
+ /* TODO enter gate */
+
+ /* reference count the module usage */
+ if (Mod_curInit >= 1) {
+ goto leave; /* already initialized */
+ }
+
+ /* initialize module state */
+ Error_init(&eb);
+ PEB_module.running = FALSE;
+ PEB_module.ipcReady = NULL;
+ PEB_module.queue = NULL;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+F");
+ Log_print0(Diags_INFO, "PEB_setup: -->");
+
+ /* initialize the semaphore */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_BINARY;
+
+ PEB_module.ipcReady = Semaphore_create(0, &semParams, &eb);
+
+ if (Error_check(&eb)) {
+ status = -2;
+ goto leave;
+ }
+
+ /* wait here until IPC is ready */
+ PEB_taskWaiting = TRUE;
+
+ if (!PEB_ipcReady) {
+ Log_print0(Diags_INFO, "PEB_setup: waiting for IPC");
+ Semaphore_pend(PEB_module.ipcReady, BIOS_WAIT_FOREVER);
+ }
+ PEB_taskWaiting = FALSE;
+ Log_print0(Diags_INFO, "PEB_setup: IPC ready");
+
+ /* compute the message queue name */
+ System_sprintf(cbuf, PEB_QueNameFmt, MultiProc_self());
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ PEB_module.queue = MessageQ_create(cbuf, &msgqParams);
+
+ if (PEB_module.queue == NULL) {
+ Log_error0("PEB_setup: message queue create failed");
+ goto leave;
+ }
+
+leave:
+ /* success, increment reference count */
+ if (status >= 0) {
+ Mod_curInit++;
+ }
+
+ /* error handling */
+ else {
+ /* unregister diags mask */
+ /* release resources */
+ }
+
+ /* TODO leave gate */
+ Log_print0(Diags_INFO, "PEB_setup: <--");
+ return(status);
+}
+
+/*
+ * ======== PEB_stop ========
+ */
+Void PEB_stop(Void)
+{
+ PEB_module.running = FALSE;
+}
diff --git a/src/examples/templates/ex44_compute/dsp/PEB.h b/src/examples/templates/ex44_compute/dsp/PEB.h
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== PEB.h ========
+ */
+
+#ifndef PEB__include
+#define PEB__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void PEB_destroy(Void);
+Void PEB_ipcIsReady(Void);
+Bool PEB_isReady(Void);
+Int PEB_exec(Void);
+Void PEB_taskFxn(UArg arg0, UArg arg1);
+Int PEB_setup(Void);
+Void PEB_stop(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/host/App.c b/src/examples/templates/ex44_compute/host/App.c
--- /dev/null
@@ -0,0 +1,447 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== App.c ========
+ */
+
+/* Standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+#include "ResMgr.h"
+#include "../shared/Compute_shared.h"
+#include "../shared/Control_shared.h"
+#include "../shared/PE_Msg.h"
+#include "../shared/PEB_shared.h"
+#include "../transport/hlos/TransportQMSS.h"
+
+/* App defines: Must match on remote proc side: */
+#define HEAPID 0u
+
+#define TRANSPORT_QMSS_ID 1
+
+typedef struct {
+ UInt16 procId;
+ MessageQ_QueueId pebQue;
+ MessageQ_QueueId controlQue;
+} App_DSP;
+
+/* module structure */
+typedef struct {
+ Bool ipcReady;
+ Int dspCount; /* number of elements in dsp array */
+ App_DSP *dspAry; /* array of dsp objects */
+
+ MessageQ_Handle queue; /* inbound messages */
+ TransportQMSS_Handle transQMSS;
+} App_Module;
+
+/* private functions */
+Void App_destroy(Void);
+Int App_setup(Void);
+
+/* private data */
+static App_Module App_module;
+
+
+/*
+ * ======== App_destroy ========
+ */
+Void App_destroy(Void)
+{
+ Int i;
+
+ printf("App_destroy: -->\n");
+
+ /* finalize the secondary transport */
+ MessageQ_unregisterTransportId(TRANSPORT_QMSS_ID);
+ TransportQMSS_delete(&App_module.transQMSS);
+
+ /* close the message queues */
+ for (i = 0; i < App_module.dspCount; i++) {
+ MessageQ_close(&App_module.dspAry[i].pebQue);
+ MessageQ_close(&App_module.dspAry[i].controlQue);
+ }
+
+ free(App_module.dspAry);
+ App_module.dspAry = NULL;
+
+ /* delete the local message queue */
+ MessageQ_delete(&App_module.queue);
+
+ /* finalize IPC */
+ App_module.ipcReady = FALSE;
+ Ipc_stop();
+
+ printf("App_destroy: <--\n");
+}
+
+/*
+ * ======== App_exec ========
+ */
+Int App_exec(Void)
+{
+ Int status;
+ Int i;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ PE_Msg *msg;
+ Compute_Msg *compMsg;
+ UInt16 procId;
+
+ printf("App_exec: -->\n");
+
+ /* send each PEB a single message (one-way) */
+ for (i = 0; i < App_module.dspCount; i++) {
+
+ qid = App_module.dspAry[i].pebQue;
+
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(PE_Msg));
+
+ if (mqMsg == NULL) {
+ printf("Error in MessageQ_alloc\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* fill in message payload */
+ msg = (PE_Msg *)mqMsg;
+ msg->command = PE_Command_HELLO;
+ msg->arg1 = MultiProc_self();
+ msg->arg2 = 0;
+
+ /* send message */
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ printf("Error in MessageQ_put\n");
+ status = -2;
+ goto leave;
+ }
+ printf("App_exec: message sent to PEB queue: qid=0x%08x\n", qid);
+ }
+
+ /* send each Compute CMD queue a single message (one-way) */
+ for (i = 0; i < App_module.dspCount; i++) {
+
+ /* open queue by queueId */
+ procId = App_module.dspAry[i].procId;
+ qid = MessageQ_openQueueId(Compute_CMD_QUE, procId);
+
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Compute_Msg));
+
+ if (mqMsg == NULL) {
+ printf("Error in MessageQ_alloc\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* fill in message payload */
+ compMsg = (Compute_Msg *)mqMsg;
+ compMsg->command = Compute_Cmd_PROCESS;
+ compMsg->arg1 = MultiProc_self();
+ compMsg->arg2 = 0;
+
+ /* send message */
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ printf("Error in MessageQ_put\n");
+ status = -2;
+ goto leave;
+ }
+ printf("App_exec: message sent to Compute queue: qid=0x%08x\n", qid);
+
+ /* close queue */
+ MessageQ_close(&qid);
+ }
+
+leave:
+ printf("App_exec: <-- status=%d\n", status);
+
+ return (status);
+}
+
+/*
+ * ======== App_setup ========
+ */
+Int App_setup(Void)
+{
+ Int status = 0;
+ Int i;
+ UInt16 clSize;
+ UInt16 clBase;
+ UInt16 procId;
+ Char name[48];
+ Bool ready;
+
+ MessageQ_QueueId queueId;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ Control_Msg *ctrlMsg;
+ ITransport_Handle transport;
+ INetworkTransport_Handle transNetwork;
+ TransportQMSS_Params transQmssParams;
+
+
+ printf("App_setup: -->\n");
+
+ /* initialize module state */
+ App_module.ipcReady = FALSE;
+ App_module.dspCount = 0;
+ App_module.dspAry = NULL;
+ App_module.queue = NULL;
+ App_module.transQMSS = NULL;
+
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+ /* initialize IPC */
+ printf("App_setup: initalizing IPC\n");
+ status = Ipc_start();
+
+ if (status < 0) {
+ printf("Error: failed to initialize IPC, error=%d\n", status);
+ goto leave;
+ }
+ App_module.ipcReady = TRUE;
+ printf("App_setup: IPC ready, status=%d\n", status);
+
+ /* create an anonymous message queue (inbound) */
+ App_module.queue = MessageQ_create(NULL, NULL);
+
+ if (App_module.queue == NULL) {
+ status = -2;
+ printf("Error: message queue create failed\n");
+ goto leave;
+ }
+
+ /* needed to enumerate processors in cluster */
+ clSize = MultiProc_getNumProcsInCluster();
+ clBase = MultiProc_getBaseIdOfCluster();
+
+ /* print cluster members */
+ printf("App_setup: cluster baseId=%d, cluster members:\n", clBase);
+
+ for (i = 0, procId = clBase; i < clSize; i++, procId++) {
+ printf("App_setup: %2d %s\n", procId, MultiProc_getName(procId));
+ }
+
+ /* allocate memory for dsp array (only for peers in the cluster) */
+ App_module.dspCount = clSize - 1; /* exclude the HOST */
+ App_module.dspAry = malloc(App_module.dspCount * sizeof(App_DSP));
+
+ if (App_module.dspAry == NULL) {
+ printf("Error: %s:%d\n", __FILE__, __LINE__);
+ goto leave;
+ }
+
+ for (i = 0; i < App_module.dspCount; i++) {
+ App_module.dspAry[i].procId = MultiProc_INVALIDID;
+ App_module.dspAry[i].pebQue = MessageQ_INVALIDMESSAGEQ;
+ App_module.dspAry[i].controlQue = MessageQ_INVALIDMESSAGEQ;
+ }
+
+ /* open the message queues on each DSP processor */
+ for (i = 0, procId = clBase; i < App_module.dspCount; procId++) {
+
+ if (procId == MultiProc_self()) {
+ continue;
+ }
+
+ App_module.dspAry[i].procId = procId;
+
+ /* open the bookkeeper message queue */
+ sprintf(name, PEB_QueNameFmt, procId);
+
+ do {
+ printf("App_setup: MessageQ_open(%s)\n", name);
+ status = MessageQ_open(name, &queueId);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ sleep(1);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("Error: MessageQ_open, name=%s error=%d\n", name, status);
+ goto leave;
+ }
+
+ App_module.dspAry[i].pebQue = queueId;
+ printf("App_setup: PEB queue: proc=%s, qid=0x%08x\n",
+ MultiProc_getName(procId), queueId);
+
+ /* open the control message queue */
+ sprintf(name, Control_QueNameFmt, procId);
+
+ do {
+ printf("App_setup: MessageQ_open(%s)\n", name);
+ status = MessageQ_open(name, &queueId);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ sleep(1);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("Error: MessageQ_open, name=%s error=%d\n", name, status);
+ goto leave;
+ }
+
+ App_module.dspAry[i].controlQue = queueId;
+ printf("App_setup: Control queue: proc=%s, qid=0x%08x\n",
+ MultiProc_getName(procId), queueId);
+
+ /* increment the dsp index here (not in the for loop above) */
+ i++;
+ }
+
+ /* busy wait until resource manager is ready */
+ do {
+ ready = TRUE;
+
+ if (!ResMgr_isReady()) {
+ ready = FALSE;
+ }
+
+ if (!ready) {
+ usleep(20000); /* 20 milliseconds */
+ }
+
+ } while (!ready);
+
+ /* send each control task a start message */
+ for (i = 0; i < App_module.dspCount; i++) {
+
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Control_Msg));
+
+ if (mqMsg == NULL) {
+ printf("Error in MessageQ_alloc\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* fill in message payload */
+ ctrlMsg = (Control_Msg *)mqMsg;
+ ctrlMsg->command = Control_Cmd_INITIALIZE;
+ ctrlMsg->arg1 = MultiProc_self();
+ ctrlMsg->arg2 = 0;
+
+ /* set return address and send the message */
+ MessageQ_setReplyQueue(App_module.queue, mqMsg);
+ qid = App_module.dspAry[i].controlQue;
+
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ printf("Error in MessageQ_put\n");
+ status = -2;
+ goto leave;
+ }
+ printf("App_setup: start message sent: procId=%d qid=0x%08x\n",
+ App_module.dspAry[i].procId, qid);
+
+ /* wait for reply message */
+ status = MessageQ_get(App_module.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ printf("Error in MessageQ_get\n");
+ status = -3;
+ goto leave;
+ }
+
+ /* TODO validate message content? */
+
+ /* return the message to the pool */
+ MessageQ_free(mqMsg);
+ }
+
+ /* create the qmss transport instance */
+ TransportQMSS_Params_init(&transQmssParams);
+
+ App_module.transQMSS = TransportQMSS_create(&transQmssParams);
+
+ if (App_module.transQMSS == NULL) {
+ status = -1;
+ printf("Error: TransportQMSS create failed\n");
+ goto leave;
+ }
+ printf("App_setup: TransportQMSS instance created\n");
+
+ /* register qmss transport with MessageQ */
+ transNetwork = TransportQMSS_upCast(App_module.transQMSS);
+ transport = INetworkTransport_upCast(transNetwork);
+ MessageQ_registerTransportId(TRANSPORT_QMSS_ID, transport);
+
+leave:
+ printf("App_setup: <-- status=%d\n", status);
+ return (status);
+}
+
+/*
+ * ======== App_threadFxn ========
+ */
+Void *App_threadFxn(Void *arg)
+{
+ Int status = 0;
+
+ printf("App_threadFxn: -->\n");
+
+ /* setup phase */
+ status = App_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = App_exec();
+
+leave:
+ /* shutdown phase */
+ App_destroy();
+
+ printf("App_threadFxn: <-- status=%d\n", status);
+ return ((Void *)status);
+}
diff --git a/src/examples/templates/ex44_compute/host/App.h b/src/examples/templates/ex44_compute/host/App.h
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== App.h ========
+ */
+
+#ifndef App__include
+#define App__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Void *App_threadFxn(Void *arg);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/host/MainHost.c b/src/examples/templates/ex44_compute/host/MainHost.c
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== MainHost.c ========
+ */
+
+/* standard headers */
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+
+#include "App.h"
+#include "ResMgr.h"
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ Int status;
+ pthread_t rmThr; /* resource manager */
+ Int rmArg;
+ Int rmStatus;
+ pthread_t appThr; /* application */
+ Int appArg;
+ Int appStatus;
+
+ /* start the resource manager thread */
+ status = pthread_create(&rmThr, NULL, &ResMgr_threadFxn, &rmArg);
+
+ if (status < 0) {
+ printf("Error: resource manager thread create failed\n");
+ goto leave;
+ }
+
+ /* run the application in its own thread */
+ status = pthread_create(&appThr, NULL, &App_threadFxn, &appArg);
+
+ if (status < 0) {
+ printf("Error: application thread create failed\n");
+ goto leave;
+ }
+
+ /* wait for the application thread to shutdown */
+ pthread_join(appThr, (void **)(&appStatus));
+ printf("main: application thread as terminated\n");
+
+ /* shutdown the resource manager thread */
+ ResMgr_shutdown();
+ pthread_join(rmThr, (void **)(&rmStatus));
+
+ /* application status */
+ status = ((appStatus < 0) || (rmStatus < 0)) ? -1 : 0;
+
+leave:
+ printf("main: appStatus=%d\n", appStatus);
+ printf("main: rmStatus=%d\n", rmStatus);
+ printf("main: <-- status=%d\n", status);
+ return(status);
+}
diff --git a/src/examples/templates/ex44_compute/host/Makefile b/src/examples/templates/ex44_compute/host/Makefile
--- /dev/null
@@ -0,0 +1,132 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+
+srcs = MainHost.c App.c ResMgr.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+libs = ../transport/hlos/lib/$(PROFILE)/transport_qmss.av7A \
+ -L$(DESTDIR)/lib -ltitransportrpmsg -ltiipc -ltiipcutils
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug app_host
+# $(MAKE) PROFILE=release app_host
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+app_host: bin/$(PROFILE)/app_host
+bin/$(PROFILE)/app_host: $(objs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I$(DESTDIR)/include
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex44_compute/host/ResMgr.c b/src/examples/templates/ex44_compute/host/ResMgr.c
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ResMgr.c ========
+ */
+
+/* Standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+#include "ResMgr.h"
+#include "../shared/ResMgr_shared.h"
+
+/* module structure */
+typedef struct {
+ Bool run; /* main loop run flag */
+ Bool ipcReady;
+ MessageQ_Handle queue; /* inbound messages */
+} ResMgr_Module;
+
+/* private functions */
+Void ResMgr_destroy(Void);
+Int ResMgr_setup(Void);
+
+/* private data */
+static ResMgr_Module ResMgr_module = {
+ .run = FALSE,
+ .ipcReady = FALSE,
+ .queue = NULL
+};
+
+
+/*
+ * ======== ResMgr_destroy ========
+ */
+Void ResMgr_destroy(Void)
+{
+
+ printf("ResMgr_destroy: -->\n");
+
+ /* delete the message queue */
+ MessageQ_delete(&ResMgr_module.queue);
+
+ /* finalize IPC */
+ ResMgr_module.ipcReady = FALSE;
+ Ipc_stop();
+
+ printf("ResMgr_destroy: <--\n");
+}
+
+/*
+ * ======== ResMgr_exec ========
+ */
+Int ResMgr_exec(Void)
+{
+ Int status;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ ResMgr_Msg *msg;
+
+ printf("ResMgr_exec: -->\n");
+ ResMgr_module.run = TRUE;
+
+ /* main loop */
+ while (ResMgr_module.run) {
+
+ printf("ResMgr_exec: waiting for message\n");
+
+ /* wait for inbound message */
+ status = MessageQ_get(ResMgr_module.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ ResMgr_module.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ printf("Error: ResMgr_exec: message get error=%d\n", status);
+ goto leave;
+ }
+
+ msg = (ResMgr_Msg *)mqMsg;
+ printf("ResMgr_exec: message received, cmd=%d\n", msg->cmd);
+
+ /* process the message */
+ switch (msg->cmd) {
+
+ case ResMgr_Cmd_REQUEST:
+ printf("ResMgr_exec: cmd=REQUEST, sender=%d\n", msg->arg1);
+ break;
+
+ case ResMgr_Cmd_RELEASE:
+ printf("ResMgr_exec: cmd=RELEASE, sender=%d\n", msg->arg1);
+ break;
+
+ default:
+ printf("Error: ResMgr_exec: unknown command: cmd=%d", msg->cmd);
+ break;
+ }
+
+ /* return the message to sender */
+ qid = MessageQ_getReplyQueue(mqMsg);
+
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ printf("Error in MessageQ_put\n");
+ status = -2;
+ goto leave;
+ }
+ printf("ResMgr_exec: message sent: qid=0x%08x\n", qid);
+ }
+
+leave:
+ printf("ResMgr_exec: <-- status=%d\n", status);
+
+ return (status);
+}
+
+/*
+ * ======== ResMgr_isReady ========
+ */
+Bool ResMgr_isReady(Void)
+{
+ return (ResMgr_module.run);
+}
+
+/*
+ * ======== ResMgr_setup ========
+ */
+Int ResMgr_setup(Void)
+{
+ Int status = 0;
+
+ MessageQ_Params msgqParams;
+
+ printf("ResMgr_setup: -->\n");
+
+ /* initialize module state */
+ ResMgr_module.run = FALSE;
+ ResMgr_module.ipcReady = FALSE;
+ ResMgr_module.queue = NULL;
+
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+ /* initialize IPC */
+ printf("ResMgr_setup: initalizing IPC\n");
+ status = Ipc_start();
+
+ if (status < 0) {
+ printf("Error: failed to initialize IPC, error=%d\n", status);
+ goto leave;
+ }
+ ResMgr_module.ipcReady = TRUE;
+ printf("ResMgr_setup: IPC ready, status=%d\n", status);
+
+ /* create message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ msgqParams.queueIndex = ResMgr_QueIndex;
+ ResMgr_module.queue = MessageQ_create(NULL, &msgqParams);
+
+ if (ResMgr_module.queue == NULL) {
+ status = -2;
+ printf("Error: message queue create failed\n");
+ goto leave;
+ }
+
+leave:
+ printf("ResMgr_setup: <-- status=%d\n", status);
+ return (status);
+}
+
+/*
+ * ======== ResMgr_shutdown ========
+ */
+Void ResMgr_shutdown(Void)
+{
+
+ /* unblock resource manager thread waiting in message queue */
+ MessageQ_unblock(ResMgr_module.queue);
+}
+
+/*
+ * ======== ResMgr_threadFxn ========
+ */
+Void *ResMgr_threadFxn(Void *arg)
+{
+ Int status = 0;
+
+ printf("ResMgr_threadFxn: -->\n");
+
+ /* setup phase */
+ status = ResMgr_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = ResMgr_exec();
+
+leave:
+ /* shutdown phase */
+ ResMgr_destroy();
+
+ printf("ResMgr_threadFxn: <-- status=%d\n", status);
+ return ((Void *)status);
+}
diff --git a/src/examples/templates/ex44_compute/host/ResMgr.h b/src/examples/templates/ex44_compute/host/ResMgr.h
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ResMgr.h ========
+ */
+
+#ifndef ResMgr__include
+#define ResMgr__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Void ResMgr_shutdown(Void);
+Void *ResMgr_threadFxn(Void *arg);
+Bool ResMgr_isReady(Void);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/mkpkg.xdt b/src/examples/templates/ex44_compute/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,61 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (this.platform.match(/^TCI6638_linux_elf$/)) {
+% /* OK */
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
+
+Makefile -> `this.example`/Makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt @verbatim
+
+dsp/Compute.c -> `this.example`/dsp/Compute.c
+dsp/Compute.h -> `this.example`/dsp/Compute.h
+dsp/Control.c -> `this.example`/dsp/Control.c
+dsp/Control.h -> `this.example`/dsp/Control.h
+dsp/DspN.cfg -> `this.example`/dsp/DspN.cfg
+dsp/MainDspN.c -> `this.example`/dsp/MainDspN.c
+dsp/Makefile -> `this.example`/dsp/Makefile
+dsp/PEB.c -> `this.example`/dsp/PEB.c
+dsp/PEB.h -> `this.example`/dsp/PEB.h
+
+host/App.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+host/MainHost.c -> `this.example`/host/MainHost.c
+host/Makefile -> `this.example`/host/Makefile
+host/ResMgr.c -> `this.example`/host/ResMgr.c
+host/ResMgr.h -> `this.example`/host/ResMgr.h
+
+scripts/patchExec.pl -> `this.example`/scripts/patchExec.pl @verbatim
+scripts/run_dsp.sh -> `this.example`/scripts/run_dsp.sh
+scripts/run_host.sh -> `this.example`/scripts/run_host.sh
+scripts/run_lad.sh -> `this.example`/scripts/run_lad.sh
+scripts/run_patch.sh -> `this.example`/scripts/run_patch.sh
+scripts/stop_dsp.sh -> `this.example`/scripts/stop_dsp.sh
+
+shared/Compute_shared.h -> `this.example`/shared/Compute_shared.h
+shared/config.bld -> `this.example`/shared/config.bld
+shared/Control_shared.h -> `this.example`/shared/Control_shared.h
+shared/PE_Msg.h -> `this.example`/shared/PE_Msg.h
+shared/PEB_shared.h -> `this.example`/shared/PEB_shared.h
+shared/ResMgr_shared.h -> `this.example`/shared/ResMgr_shared.h
+shared/SvrMsg.h -> `this.example`/shared/SvrMsg.h
+shared/SysCfg.h -> `this.example`/shared/SysCfg.h
+
+transport/hlos/Makefile -> `this.example`/transport/hlos/Makefile
+transport/hlos/TransportQMSS.c -> `this.example`/transport/hlos/TransportQMSS.c
+transport/hlos/TransportQMSS.h -> `this.example`/transport/hlos/TransportQMSS.h
+transport/rtos/config.bld -> `this.example`/transport/rtos/config.bld
+transport/rtos/Makefile -> `this.example`/transport/rtos/Makefile
+transport/rtos/package.bld -> `this.example`/transport/rtos/package.bld
+transport/rtos/package.xdc -> `this.example`/transport/rtos/package.xdc
+transport/rtos/package.xs -> `this.example`/transport/rtos/package.xs
+transport/rtos/TransportQMSS.c -> `this.example`/transport/rtos/TransportQMSS.c
+transport/rtos/TransportQMSS.xdc -> `this.example`/transport/rtos/TransportQMSS.xdc
+transport/rtos/TransportQMSS.xs -> `this.example`/transport/rtos/TransportQMSS.xs
diff --git a/src/examples/templates/ex44_compute/products.mak b/src/examples/templates/ex44_compute/products.mak
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-linux-gnueabihf
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+#DESTDIR = $(DEPOT)/_your_destdir__
+
+#### BIOS-side toolchains ####
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+
+# Use this goal to print your product variables.
+.show:
+ @echo "TOOLCHAIN_LONGNAME = $(TOOLCHAIN_LONGNAME)"
+ @echo "TOOLCHAIN_INSTALL_DIR = $(TOOLCHAIN_INSTALL_DIR)"
+ @echo "TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+ @echo "DESTDIR = $(DESTDIR)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
diff --git a/src/examples/templates/ex44_compute/readme.txt b/src/examples/templates/ex44_compute/readme.txt
--- /dev/null
@@ -0,0 +1,219 @@
+#
+# ======== readme.txt ========
+#
+
+Overview
+=========================================================================
+This example illustrates how to configure IPC for a large scale system.
+It also provides a starting point for implementing a secondary transport.
+
+We consider a hypothetical system which contains over 4000 processors.
+This system contains 16 boards each with 32 devices for a total of 512
+devices. Each device contains 9 processors; one HOST and eight DSPs. This
+make a total of 4,608 processors.
+
+To manage such a large processor pool, we define a cluster which partitions
+the processor pool into small local groups. Each device will define a
+single cluster. The primary transports will be used to communicate within
+a cluster; secondary transports are used to communicate between clusters.
+
+Reserved message queues are introduced. These require special handling
+in configuration. They are efficient for large scale systems because they
+do not require a run-time lookup. You can use direct messaging when using
+reserved message queues.
+
+This example builds a single DSP executable which is loaded onto every
+processor. Before loading the DSP, the executable is patched with the
+cluster baseId for that device. The patched executable is then loaded
+onto each of the DSP processors of that device. This would be repeated
+for each device in the system.
+
+A single LAD executable is used on all the devices. When starting LAD,
+command line arguments are used to specify the number of reserved message
+queues, the total number of processors in the system, and the cluster
+baseId. Optionally, you can build LAD with the number of reserved queues
+and total number of processors built-in, because these values are the same
+on all devices. However, the cluster baseId should always be specified on
+the command line. LAD is built in the IPC product.
+
+
+Build Instructions
+=========================================================================
+
+ 1. Create a work folder on your file system.
+
+ mkdir work
+
+ 2. Extract this example into your work folder.
+
+ cd work
+ unzip ex44_compute.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ edit ex44_compute/products.mak
+
+ TOOLCHAIN_INSTALL_DIR = <...>/_your_linux_gcc_toolchain_install_
+ BIOS_INSTALL_DIR = <...>/bios_m_mm_pp_bb
+ IPC_INSTALL_DIR = <...>/ipc_m_mm_pp_bb
+ XDC_INSTALL_DIR = <...>/xdctools_m_mm_pp_bb
+ ti.targets.elf.C66 = <...>/c6000_m_m_p
+
+ Your DESTDIR must point to your IPC "install" location. In other words,
+ the location you specified when you ran 'make install' within the IPC
+ product.
+
+ DESTDIR = <...>
+
+ 4. Build the example. This will build only debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ex44_compute
+ make
+
+ Use the following commands to clean your example.
+
+ cd ex44_compute
+ make clean
+
+ 5. Copy the HOST executable, the DSP executable, and the supporting
+ scripts to your target file system.
+
+ ex44_compute/host/bin/debug/app_host
+ ex44_compute/dsp/bin/debug/compute_dspN.xe66
+ ex44_compute/scripts/patchExec.pl
+ ex44_compute/scripts/run_dsp.sh
+ ex44_compute/scripts/run_host.sh
+ ex44_compute/scripts/run_lad.sh
+ ex44_compute/scripts/run_patch.sh
+ ex44_compute/scripts/stop_dsp.sh
+
+ 6. Optional. This example uses command line arguments to launch LAD.
+ These instructions are here for reference.
+
+ Configure and build LAD. This examples builds for the TCI6638 device.
+ Use the appropriate config file for your device.
+
+ cd <IPC Install>/linux/src/daemon/cfg
+ edit MultiProcCfg_tci6638.c
+
+ Add the following header file:
+
+ #include <ti/ipc/MultiProc.h>
+
+ Make the following changes:
+
+ .numProcessors = 4608,
+ .id = MultiProc_INVALIDID,
+ .baseIdOfCluster = MultiProc_INVALIDID
+
+ Configure LAD to set aside reserved message queues. This example
+ uses 8 reserved message queues. Edit the following file to reserve
+ message queues in LAD.
+
+ cd <IPC Install>/linux/src/daemon/cfg
+ edit MessageQCfg.c
+
+ Make the following changes:
+
+ .numReservedEntries = 8
+
+ Rebuild your LAD executable. Copy the LAD executable to your
+ target file system.
+
+ <IPC Install>/linux/src/daemon/lad_tci6638
+
+
+Running The Example
+=========================================================================
+This example illustrates how to use one DSP executable and one LAD
+executable for all your devices. To achieve this, the DSP executable
+must be patched for each device and the LAD daemon must be started
+with a command line option to specify the cluster baseId.
+
+In our hypothetical system, we use one cluster for each device. Each
+cluster has 9 members (to match the number of processors on the device).
+The cluster baseId is the processor number of the first processor in
+the cluster (base-zero).
+
+For example, the clusters would be mapped out as follows:
+
+ Device # BaseId Cluster Members
+ =========================================================================
+ 1 0 HOST (0), DSP1 (1), DSP2 (2), ..., DSP8 (8)
+ 2 9 HOST (9), DSP1 (10), DSP2 (11), ..., DSP8 (17)
+ 3 18 HOST (18), DSP1 (19), DSP2 (20), ..., DSP8 (26)
+ : : :
+ 511 4590 HOST (4590), DSP1 (4591), DSP2 (4592), ..., DSP8 (4598)
+ 512 4599 HOST (4599), DSP1 (4600), DSP2 (4601), ..., DSP8 (4607)
+
+To load and run on any given device, use the BaseId for that device when
+you patch your DSP executable and when starting LAD.
+
+ 1. Patch the DSP executable with the cluster baseId. For example, if
+ running on Device #3, the BaseId would be 18 (see table above). The
+ perl script makes a copy of the DSP executable file.
+
+ perl patchExec.pl 18 compute_dspN.xe66 compute_dspN_patched.xe66
+
+ You can also use the helper script provided with the example.
+
+ run_patch.sh 18
+
+ This will generate a new patched DSP executable.
+
+ compute_dspN_patched.xe66
+
+ 2. Start LAD. You must start the LAD daemon before running any IPC
+ program. Use the same BaseId that you used above when patching
+ the DSP executable.
+
+ lad_tci6638 -r 8 -n 4608 -b 18 -l log.txt
+
+ You can also use the helper script provided with the example.
+
+ run_lad.sh 18
+
+ Note: If you rebuilt LAD with the specified number of reserved
+ message queues and total processors in the system, you should omit
+ the '-r' and '-n' options above.
+
+ 3. Load and run the DSP processors. You must load the same patched DSP
+ executable onto each of the DSP processors of your device. Use the
+ loader provided with the MCSDK (mpmcl).
+
+ mpmcl load dsp0 compute_dspN_patched.xe66
+ mpmcl load dsp1 compute_dspN_patched.xe66
+ ...
+
+ Finally, run all the DSP processors.
+
+ mpmcl run dsp0
+ mpmcl run dsp1
+ ...
+
+ You can also use the helper script provided with the example.
+
+ run_dsp.sh
+
+ 4. Run the HOST application program. The application program runs on
+ the host processor. It will exchange a few messages with each DSP
+ and then shutdown.
+
+ app_host
+
+ 5. Use CCS to inspect the DSP logs. Load the DSP symbols into CCS and
+ then attach to each of the DSP processors. Open the Real-Time Object
+ Viewer (ROV) and select the LoggerBuf module. Inspect the log events.
+
+ 6. If you wish to run the example again, you must first stop and reload
+ the DSP processors. Use the helper scripts to make this easier. Note:
+ you do not need to restart the LAD daemon.
+
+ stop_dsp.sh
+ run_dsp.sh
+ run_host.sh
diff --git a/src/examples/templates/ex44_compute/scripts/patchExec.pl b/src/examples/templates/ex44_compute/scripts/patchExec.pl
--- /dev/null
@@ -0,0 +1,132 @@
+#!/usr/bin/perl
+
+#
+# Copyright (c) 2015, 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.
+#
+
+# patchExec.pl
+#
+# This script patches a DSP ELF executable with a cluster base id,
+# at the location with the magic binary pattern
+# 74efdb7760e9bf8961d98b7368d8f5b73506064a
+# in the executable's .cinit records.
+#
+# Command line arguments:
+# $ARGV[0]: cluster base id
+# $ARGV[1]: input executable
+# $ARGV[2]: path to patched output executable
+#
+
+use strict;
+use warnings;
+
+# Set the input and output file names
+my $execFile = $ARGV[1];
+my $patchedFile = $ARGV[2];
+
+my $sections = 0;
+my $skip = 0;
+my $fileOff;
+my $sizeCInit;
+my $b;
+
+my $usage = "Usage: perl patchExec.pl <cluster base id> <input executable>" .
+ " <patched executable>\n\n";
+
+# Verify arguments
+die "Wrong number of command-line arguments.\n" . $usage
+ unless (@ARGV == 3);
+die "Invalid cluster base id.\n" . $usage unless ($ARGV[0] >= 0);
+die "Cannot read from input file.\n" . $usage unless -r $ARGV[1];
+
+# Parse the objdump
+my @resultLines = split("\n", `objdump -h $ARGV[1]`);
+die "Error when running objdump.\n" unless (@resultLines != 0);
+
+foreach (@resultLines) {
+ if (index($_, "Sections:") != -1) { #Look for sections header
+ $sections = 1;
+ }
+ elsif ($sections eq 1) {
+ $skip = $skip + 1;
+ if (($skip % 2) eq 0) {
+ my @cols = split; # split into columns
+ if ($cols[1] eq ".cinit") {
+ $fileOff = hex($cols[5]); # file offset of .cinit
+ $sizeCInit = hex($cols[2]); # size of .cinit
+ }
+ }
+ }
+}
+
+open(IN, "< $execFile") or die "Cannot open input file\n" . $usage;
+binmode(IN);
+open(OUT, "> $patchedFile") or die "Cannot open output file\n" . $usage;
+binmode(OUT);
+
+#skip over everything before .cinit
+read(IN, $b, $fileOff);
+print(OUT $b);
+
+#
+# Look for magic value of 9807fc203ee72e6857da95ecd619feed55f050e6
+# in .cinit and modify it with base cluster id, We ignore the first
+# and last byte in the magic value in case they have been encoded
+# using RLE, and store the cluster id in the 3rd and 4th byte.
+#
+read(IN, $b, $sizeCInit);
+my $hex = unpack('H*', $b); #unpack binary into string
+my $id = sprintf("%04x", $ARGV[0]); #convert id into 16-bit hex string
+
+#convert cluster id to little endian
+my @chars = reverse(split("", $id));
+$id = reverse(@chars[0..1]) . reverse(@chars[2..3]);
+
+my $newString = "07" . $id . "3ee72e6857da95ecd619feed55f050";
+my $magic = "07fc203ee72e6857da95ecd619feed55f050";
+$hex =~ s/$magic/$newString/g;
+die "Magic pattern not found" unless scalar @+ != 0;
+die "Too many patterns found" unless scalar @+ == 1;
+my $out = pack('H*', $hex); #pack string into binary
+print(OUT $out);
+
+#copy the rest of the file
+my $filesize = -s $execFile;
+read(IN, $b, $filesize - $sizeCInit - $fileOff);
+print(OUT $b);
+
+close(IN);
+close(OUT);
+
+#TODO: remove temporary files
+
+# Exit script
+exit;
diff --git a/src/examples/templates/ex44_compute/scripts/run_dsp.sh b/src/examples/templates/ex44_compute/scripts/run_dsp.sh
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# must have lad running
+# lad_tci6638 -l log.txt -b ###
+
+set -x
+
+prog="compute_dspN_patched.xe66"
+
+# load the dsp processors
+mpmcl load dsp0 $prog
+mpmcl load dsp1 $prog
+mpmcl load dsp2 $prog
+mpmcl load dsp3 $prog
+mpmcl load dsp4 $prog
+mpmcl load dsp5 $prog
+mpmcl load dsp6 $prog
+mpmcl load dsp7 $prog
+
+# run the dsp processors
+mpmcl run dsp0
+mpmcl run dsp1
+mpmcl run dsp2
+mpmcl run dsp3
+mpmcl run dsp4
+mpmcl run dsp5
+mpmcl run dsp6
+mpmcl run dsp7
diff --git a/src/examples/templates/ex44_compute/scripts/run_host.sh b/src/examples/templates/ex44_compute/scripts/run_host.sh
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -x
+
+# run host application
+app_host
diff --git a/src/examples/templates/ex44_compute/scripts/run_lad.sh b/src/examples/templates/ex44_compute/scripts/run_lad.sh
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Error: must specify cluster baseId"
+ exit -1
+fi
+
+baseId=$1
+
+set -x
+./lad_tci6638 -r 8 -n 4608 -b $baseId -l log.txt
diff --git a/src/examples/templates/ex44_compute/scripts/run_patch.sh b/src/examples/templates/ex44_compute/scripts/run_patch.sh
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Error: must specify cluster baseId"
+ exit -1
+fi
+
+baseId=$1
+
+set -x
+perl patchExec.pl $baseId compute_dspN.xe66 compute_dspN_patched.xe66
diff --git a/src/examples/templates/ex44_compute/scripts/stop_dsp.sh b/src/examples/templates/ex44_compute/scripts/stop_dsp.sh
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -x
+mpmcl reset dsp0
+mpmcl reset dsp1
+mpmcl reset dsp2
+mpmcl reset dsp3
+mpmcl reset dsp4
+mpmcl reset dsp5
+mpmcl reset dsp6
+mpmcl reset dsp7
diff --git a/src/examples/templates/ex44_compute/shared/Compute_shared.h b/src/examples/templates/ex44_compute/shared/Compute_shared.h
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Compute_shared.h ========
+ */
+
+#ifndef Compute_shared__include
+#define Compute_shared__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#include "SysCfg.h"
+
+
+#define Compute_CMD_QUE SysCfg_Compute_CMD_QUE
+#define Compute_DATA_QUE SysCfg_Compute_DATA_QUE
+#define Compute_CBUF_SIZE 48
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ Int command;
+ Int arg1;
+ UInt arg2;
+} Compute_Msg;
+
+#define Compute_Msg_BLOCK ((sizeof(Compute_Msg) + 3) & (~3))
+
+#define Compute_Cmd_PROCESS 1
+#define Compute_Cmd_DATA 2
+
+#define Compute_Data_HELLO 1
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/shared/Control_shared.h b/src/examples/templates/ex44_compute/shared/Control_shared.h
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Control_shared.h ========
+ */
+
+#ifndef Control_shared__include
+#define Control_shared__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* message queue name syntax */
+#define Control_QueNameFmt "Control_Proc%d"
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ Int command;
+ Int arg1;
+ UInt arg2;
+} Control_Msg;
+
+#define Control_Msg_BLOCK ((sizeof(Control_Msg) + 3) & (~3))
+
+#define Control_Cmd_INITIALIZE 1
+#define Control_Cmd_FINALIZE 2
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/shared/PEB_shared.h b/src/examples/templates/ex44_compute/shared/PEB_shared.h
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== PEB_shared.h ========
+ */
+
+#ifndef PEB_shared__include
+#define PEB_shared__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* message queue name syntax */
+#define PEB_QueNameFmt "PEB_Proc%d"
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/shared/PE_Msg.h b/src/examples/templates/ex44_compute/shared/PE_Msg.h
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== PE_Msg.h ========
+ */
+
+#ifndef PE_Msg__include
+#define PE_Msg__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ Int command;
+ Int arg1;
+ UInt arg2;
+} PE_Msg;
+
+#define PE_Msg_BLOCK ((sizeof(PE_Msg) + 3) & (~3))
+
+#define PE_Command_HELLO 1
+#define PE_Command_PROCESS 2
+#define PE_Command_DATA 3
+
+#define PE_Data_HELLO 1
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/shared/ResMgr_shared.h b/src/examples/templates/ex44_compute/shared/ResMgr_shared.h
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ResMgr_shared.h ========
+ */
+
+#ifndef ResMgr_shared__include
+#define ResMgr_shared__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#include "SysCfg.h"
+
+
+/* reserved message queue */
+#define ResMgr_QueIndex SysCfg_ResMgr
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ Int cmd;
+ Int arg1;
+ UInt arg2;
+} ResMgr_Msg;
+
+#define ResMgr_Msg_BLOCK ((sizeof(ResMgr_Msg) + 3) & (~3))
+
+#define ResMgr_Cmd_REQUEST 1
+#define ResMgr_Cmd_RELEASE 2
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/shared/SvrMsg.h b/src/examples/templates/ex44_compute/shared/SvrMsg.h
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== SvrMsg.h ========
+ *
+ */
+
+#ifndef SvrMsg__include
+#define SvrMsg__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#include <ti/ipc/MessageQ.h>
+
+#define SvrMsg_NUM_MSGS 5 /* number of message to send each server */
+
+#define SvrMsg_SvrQueNameFmt "%s_SvrMsgQ" /* %s = proc name */
+
+#define DspN_AppMsgQue "DspN_AppMsgQ"
+#define Dsp1_AppMsgQue "Dsp1_AppMsgQ"
+#define Dsp2_AppMsgQue "Dsp2_AppMsgQ"
+#define Eve1_AppMsgQue "Eve1_AppMsgQ"
+#define Eve2_AppMsgQue "Eve2_AppMsgQ"
+#define Eve3_AppMsgQue "Eve3_AppMsgQ"
+#define Eve4_AppMsgQue "Eve4_AppMsgQ"
+#define Ipu1_AppMsgQue "Ipu1_AppMsgQ"
+#define Ipu1_0_AppMsgQue "Ipu1-0_AppMsgQ"
+#define Ipu1_1_AppMsgQue "Ipu1-1_AppMsgQ"
+#define Ipu2_AppMsgQue "Ipu2_AppMsgQ"
+#define Host_AppMsgQue "Host_AppMsgQ"
+
+#define SvrMsg_Cmd_START 1
+#define SvrMsg_Cmd_STOP 2
+#define SvrMsg_Cmd_PROCESS 3
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ UInt32 cmd;
+ UInt16 svrProcId;
+ Char buf[32];
+} SvrMsg_Msg;
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/shared/SysCfg.h b/src/examples/templates/ex44_compute/shared/SysCfg.h
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== SysCfg_shared.h ========
+ */
+
+#ifndef SysCfg_shared__include
+#define SysCfg_shared__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* HOST reserved message queues */
+#define SysCfg_PER_MsgQ 0 /* Processor Endpoint Registrar */
+#define SysCfg_PEC_MsgQ 1 /* Processor Endpoint Client */
+#define SysCfg_ResMgr 2 /* Resource Manager */
+
+/* DSP reserved message queues */
+#define SysCfg_Compute_CMD_QUE 2
+#define SysCfg_Compute_DATA_QUE 3
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex44_compute/shared/config.bld b/src/examples/templates/ex44_compute/shared/config.bld
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map - TCI6638K2K
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0080_0000 10_0000 ( 1 MB) DSP L2 Cache/SRAM
+ * 00E0_0000 8000 ( 32 KB) DSP L1P Cache/SRAM
+ * 00F0_0000 8000 ( 32 KB) DSP L1D Cache/SRAM
+ * 0C00_0000 60_0000 ( 6 MB) MSMCSRAM
+ * -------------------------------------------------------------------------
+ * 0080_0000 10_0000 ( 1 MB) DSP_PROG (L2 SRAM) [1]
+ * 00E0_0000 8000 ( 32 KB) DSP L1P Cache
+ * 00F0_0000 8000 ( 32 KB) DSP L1D Cache
+ * 0C00_0000 40_0000 ( 4 MB) MSMCSRAM
+ * 0C40_0000 20_0000 ( 2 MB) SR_0 [2]
+ *
+ * 8000_0000 1000_0000 ( 256 MB) Linux
+ * 9000_0000 1000_0000 ( 256 MB) Linux
+ * A000_0000 1000_0000 ( 256 MB) Linux
+ * B000_0000 1000_0000 ( 256 MB) Linux
+ * C000_0000 1000_0000 ( 256 MB) Linux
+ * D000_0000 1000_0000 ( 256 MB) Linux
+ * E000_0000 1000_0000 ( 256 MB) --------
+ * F000_0000 1000_0000 ( 256 MB) --------
+ *
+ * Notes
+ * ------------------------------------------------------------------------
+ * [1] Each DSP program is loaded to private L2 SRAM (local address)
+ * [2] SR-Zero owner=DSP1
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x0C400000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+};
+
+Build.platformTable["ti.platforms.evmTCI6638K2K:coreN"] = {
+ customMemoryMap: [
+ [ "L2SRAM", {
+ name: "L2SRAM", space: "code/data", access: "RWX",
+ base: 0x00800000, len: 0x100000,
+ comment: "DSP Program"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "L2SRAM",
+ dataMemory: "L2SRAM",
+ stackMemory: "L2SRAM",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "0k"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex44_compute/transport/hlos/Makefile b/src/examples/templates/ex44_compute/transport/hlos/Makefile
--- /dev/null
@@ -0,0 +1,115 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ../..
+include $(EXBASE)/products.mak
+-include $(addprefix lib/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+
+srcs = TransportQMSS.c
+objs = $(addprefix lib/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug transport_qmss.a
+# $(MAKE) PROFILE=release transport_qmss.a
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) lib
+
+
+#
+# ======== rules ========
+#
+transport_qmss.a: lib/$(PROFILE)/transport_qmss.av7A
+lib/$(PROFILE)/transport_qmss.av7A: $(objs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(AR) $@ $^
+
+lib/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I$(IPC_INSTALL_DIR)/linux/include -I$(IPC_INSTALL_DIR)/packages
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard lib/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p lib/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex44_compute/transport/hlos/TransportQMSS.c b/src/examples/templates/ex44_compute/transport/hlos/TransportQMSS.c
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportQMSS.c ========
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <ti/ipc/Std.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include "TransportQMSS.h"
+
+
+/*
+ * ======== params structure evolution ========
+ */
+typedef struct {
+ Int __version;
+ /* ... */
+} TransportQMSS_Params_Version1;
+
+/*
+ * ======== TransportQMSS_Object ========
+ * The instance object definition
+ */
+typedef struct {
+ INetworkTransport_Object base; /* inheritance */
+ Int status; /* if needed */
+ /* ... */ /* add additional members here */
+} TransportQMSS_Object;
+
+/*
+ * ======== instance function declarations ========
+ */
+Int TransportQMSS_bind(Void *handle, UInt32 queueId);
+Int TransportQMSS_unbind(Void *handle, UInt32 queueId);
+Bool TransportQMSS_put(Void *handle, Ptr msg);
+
+/*
+ * ======== TransportQMSS_Fxns ========
+ * The instance function table
+ */
+INetworkTransport_Fxns TransportQMSS_Fxns = {
+ TransportQMSS_bind,
+ TransportQMSS_unbind,
+ TransportQMSS_put
+};
+
+/*
+ * ======== TransportQMSS_Params_init__S ========
+ */
+Void TransportQMSS_Params_init__S(TransportQMSS_Params *params, Int version)
+{
+ TransportQMSS_Params_Version1 *params1;
+
+ switch (version) {
+
+ case TransportQMSS_Params_VERSION_1:
+ params1 = (TransportQMSS_Params_Version1 *)params;
+ params1->__version = TransportQMSS_Params_VERSION_1;
+ /* ... */
+ break;
+
+ default:
+ assert(FALSE);
+ break;
+ }
+}
+
+/*
+ * ======== TransportQMSS_create ========
+ */
+TransportQMSS_Handle TransportQMSS_create(TransportQMSS_Params *pp)
+{
+ TransportQMSS_Params_Version1 *pp1;
+ TransportQMSS_Params params;
+ TransportQMSS_Object *obj;
+
+ /* initialize local params structure */
+ TransportQMSS_Params_init(¶ms);
+
+ /* initialize local params using caller's given params */
+ switch (pp->__version) {
+
+ case TransportQMSS_Params_VERSION_1:
+ pp1 = (TransportQMSS_Params_Version1 *)pp;
+ /* params.foobar = pp1->foobar; */
+ break;
+ }
+
+ /* allocate the instance object */
+ obj = malloc(sizeof(TransportQMSS_Object));
+
+ /* initialize the inherited interface */
+ obj->base.base.interfaceType = INetworkTransport_TypeId;
+ obj->base.fxns = &TransportQMSS_Fxns;
+
+ /* ... */
+
+ return ((TransportQMSS_Handle)obj);
+}
+
+/*
+ * ======== TransportQMSS_delete ========
+ */
+Void TransportQMSS_delete(TransportQMSS_Handle *hp)
+{
+ TransportQMSS_Object *obj;
+
+ obj = *(TransportQMSS_Object **)hp;
+
+ /* ... */
+
+ free(obj);
+ *hp = NULL;
+}
+
+/*
+ * ======== TransportQMSS_upCast ========
+ */
+INetworkTransport_Handle TransportQMSS_upCast(TransportQMSS_Handle inst)
+{
+ return ((INetworkTransport_Handle)inst);
+}
+
+/*
+ * ======== TransportQMSS_downCast ========
+ */
+TransportQMSS_Handle TransportQMSS_downCast(INetworkTransport_Handle base)
+{
+ return ((TransportQMSS_Handle)base);
+}
+
+/*
+ * ======== TransportQMSS_bind ========
+ */
+Int TransportQMSS_bind(Void *handle, UInt32 queueId)
+{
+ TransportQMSS_Object *obj;
+ Int status;
+
+ obj = (TransportQMSS_Object *)handle;
+
+ /* ... */
+
+ status = 0;
+
+ return (status);
+}
+
+/*
+ * ======== TransportQMSS_unbind ========
+ */
+Int TransportQMSS_unbind(Void *handle, UInt32 queueId)
+{
+ TransportQMSS_Object *obj;
+ Int status;
+
+ obj = (TransportQMSS_Object *)handle;
+
+ /* ... */
+
+ status = 0;
+
+ return (status);
+}
+
+/*
+ * ======== TransportQMSS_put ========
+ */
+Bool TransportQMSS_put(Void *handle, Ptr msg)
+{
+ TransportQMSS_Object *obj;
+ Bool status;
+
+ obj = (TransportQMSS_Object *)handle;
+
+ /* ... */
+
+ status = TRUE;
+
+ return (status);
+}
diff --git a/src/examples/templates/ex44_compute/transport/hlos/TransportQMSS.h b/src/examples/templates/ex44_compute/transport/hlos/TransportQMSS.h
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportQMSS.h ========
+ */
+
+#include <ti/ipc/interfaces/INetworkTransport.h>
+
+
+/*
+ * ======== TransportQMSS_Params ========
+ * Optional create parameters
+ *
+ * The '__version' parameter is used internally. You may omit this if
+ * you wish. This parameter can be used to support binary compatibility
+ * of old call sites with new library implementations.
+ */
+typedef struct {
+ Int __version; /* used for tracking implementation evolution */
+
+ /* ... */ /* add your specific create parameters here */
+} TransportQMSS_Params;
+
+/*
+ * ======== TransportQMSS_Params_VERSION_1 ========
+ * Date: 07 Jan 2015
+ *
+ * Initial implementation of the params structure.
+ */
+#define TransportQMSS_Params_VERSION_1 1
+
+/*
+ * ======== TransportQMSS_Params_VERSION ========
+ * Defines the current params structure version
+ *
+ * Internal use only.
+ */
+#define TransportQMSS_Params_VERSION TransportQMSS_Params_VERSION_1
+
+/*
+ * ======== TransportQMSS_Params_init__S ========
+ * Actual function which initializes the params structure
+ *
+ * This function is called indirectly from TransportQMSS_Params_init.
+ * It uses params version to support binary compatibility with old
+ * call sites.
+ */
+Void TransportQMSS_Params_init__S(TransportQMSS_Params *params, Int version);
+
+/*
+ * ======== TransportQMSS_Params_init ========
+ * Initialize the parameter structure to its default values
+ *
+ * Using a static inline method binds the parameter structure version
+ * at the calls site. This allows new library implementations to recognize
+ * old call sites and thus to dereference the parameter structure correctly.
+ */
+static inline Void TransportQMSS_Params_init(TransportQMSS_Params *params)
+{
+ if (params != NULL) {
+ TransportQMSS_Params_init__S(params, TransportQMSS_Params_VERSION);
+ }
+}
+
+/*
+ * ======== TransportQMSS_Handle ========
+ * Opaque handle to transport instance object
+ */
+typedef struct TransportQMSS_Object *TransportQMSS_Handle;
+
+/*
+ * ======== TransportQMSS_create ========
+ * Create an instance of this transport
+ *
+ * If your create function has required arguments, add them to the
+ * function signature before 'params'. The params are typically
+ * considered as optional. You can also add a return status code
+ * to your function signature.
+ */
+TransportQMSS_Handle TransportQMSS_create(TransportQMSS_Params *params);
+
+/*
+ * ======== TransportQMSS_delete ========
+ * Finalize an instance object
+ *
+ * If you delete function can fail, change the function signature to
+ * return a status code.
+ */
+Void TransportQMSS_delete(TransportQMSS_Handle *hp);
+
+/*
+ * ======== TransportQMSS_upCast ========
+ * Instance converter, return a handle to the inherited interface
+ */
+INetworkTransport_Handle TransportQMSS_upCast(TransportQMSS_Handle inst);
+
+/*
+ * ======== TransportQMSS_downCast ========
+ * Instance converter, return an opaque handle to the instance object
+ *
+ * It is the caller's responsibility to ensure the underlying object
+ * is of the correct type.
+ */
+TransportQMSS_Handle TransportQMSS_downCast(INetworkTransport_Handle base);
diff --git a/src/examples/templates/ex44_compute/transport/rtos/Makefile b/src/examples/templates/ex44_compute/transport/rtos/Makefile
--- /dev/null
@@ -0,0 +1,81 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ../..
+include $(EXBASE)/products.mak
+
+# define the package path
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH);$(IPC_INSTALL_DIR)/packages
+
+# define arguments passed to xdc build config
+ARGS = ti.targets.elf.C66=$(ti.targets.elf.C66)
+
+# define the xdc command line arguments
+XCLA = XDCPATH="$(PKGPATH)" XDCBUILDCFG="./config.bld" XDCARGS="$(ARGS)"
+
+# define build goals
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC) $(XCLA) all
+
+help:
+ @$(ECHO) "make # build package"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(XDC) -r clean
+
+
+# ======== standard macros ========
+XDC = $(XDC_INSTALL_DIR)/xdc
+
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex44_compute/transport/rtos/TransportQMSS.c b/src/examples/templates/ex44_compute/transport/rtos/TransportQMSS.c
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportQMSS.c ========
+ */
+#include <xdc/std.h>
+#include <xdc/runtime/Log.h>
+
+#include "package/internal/TransportQMSS.xdc.h"
+
+
+/*
+ * ======== TransportQMSS_Instance_init ========
+ */
+Void TransportQMSS_Instance_init(TransportQMSS_Object *obj,
+ const TransportQMSS_Params *params)
+{
+
+ obj->type = params->type;
+ Log_write1(TransportQMSS_L_type, (UArg)obj->type);
+
+ switch (obj->type) {
+ case TransportQMSS_Type_7:
+ /* ... */
+ break;
+
+ case TransportQMSS_Type_11:
+ /* ... */
+ break;
+ }
+
+ return;
+}
+
+/*
+ * ======== TransportQMSS_bind ========
+ */
+Int TransportQMSS_bind(TransportQMSS_Object *obj, UInt32 queueId)
+{
+ Int status = 0;
+
+ /* ... */
+
+ return (status);
+}
+
+/*
+ * ======== TransportQMSS_unbind ========
+ */
+Int TransportQMSS_unbind(TransportQMSS_Object *obj, UInt32 queueId)
+{
+ Int status = 0;
+
+ /* ... */
+
+ return (status);
+}
+
+/*
+ * ======== TransportQMSS_put ========
+ */
+Bool TransportQMSS_put(TransportQMSS_Object *obj, Ptr msg)
+{
+ Bool status = TRUE;
+
+ /* ... */
+
+ return (status);
+}
diff --git a/src/examples/templates/ex44_compute/transport/rtos/TransportQMSS.xdc b/src/examples/templates/ex44_compute/transport/rtos/TransportQMSS.xdc
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportQMSS.xdc ========
+ */
+package transport.rtos;
+
+import xdc.runtime.Diags;
+import xdc.runtime.Log;
+
+/*!
+ * ======== TransportQMSS ========
+ * Sample implementation of an INetworkTransport interface
+ */
+module TransportQMSS inherits ti.sdo.ipc.interfaces.INetworkTransport
+{
+
+ /*!
+ * ======== Type ========
+ * Enumerate the hardware types supported by this transport
+ */
+ enum Type {
+ Type_7, /*! optimized for small messages (command) */
+ Type_11 /*! optimized for large messages (data) */
+ };
+
+ /*!
+ * ======== L_type ========
+ */
+ config Log.Event L_type = {
+ mask: Diags.INFO,
+ msg: "L_type: type=%d"
+ };
+
+instance:
+
+ /*!
+ * ======== type ========
+ * Hardware type binding
+ */
+ config Type type = TransportQMSS.Type_7;
+
+ /*!
+ * ======== create ========
+ * Create a transport instance
+ */
+ create();
+
+internal:
+
+ /* instance object */
+ struct Instance_State {
+ Type type;
+ };
+
+ /* module object */
+ struct Module_State {
+ UInt serial; /* packet serial number */
+ }
+}
diff --git a/src/examples/templates/ex44_compute/transport/rtos/TransportQMSS.xs b/src/examples/templates/ex44_compute/transport/rtos/TransportQMSS.xs
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportQMSS.xs ========
+ */
+
+/*
+ * ======== module$use ========
+ */
+function module$use()
+{
+ xdc.useModule('xdc.runtime.Log');
+}
+
+/*
+ * ======== module$static$init ========
+ */
+function module$static$init(state, mod)
+{
+ /* initialize the module object */
+ state.serial = 0;
+}
diff --git a/src/examples/templates/ex44_compute/transport/rtos/config.bld b/src/examples/templates/ex44_compute/transport/rtos/config.bld
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+/* compiler options used for all C6x targets */
+var c6xOpts = " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 -g ";
+
+/* -mi10 => maximum cycles that interrupts may be disabled is 10
+ * -mo => place each function in subsection
+ * -pdr => show remarks
+ * -pden => show remark ids
+ * -pds=238 => ignore "controlling expression is constant"
+ * -pds=880 => ignore "unused parameter"
+ */
+
+var ccOpts = {
+ "ti.targets.elf.C64P" : c6xOpts,
+};
+
+var lnkOpts = {
+ "ti.targets.elf.C66" : " --cinit_compression=off",
+ "ti.targets.arm.elf.M4" : " --retain=.resource_table" +
+ " --cinit_compression=off"
+};
+
+/* parse XDCARGS set in makefile */
+for (arg = 1; arg < arguments.length; arg++) {
+
+ /* set toolchain install path */
+ var targetName = arguments[arg].split("=")[0];
+ var rootDir = arguments[arg].split("=")[1];
+
+ var target = xdc.useModule(targetName);
+ target.rootDir = rootDir;
+
+ /* add common options defined above */
+ if (ccOpts[targetName] != undefined) {
+ target.ccOpts.suffix += ccOpts[targetName];
+ }
+ if (lnkOpts[targetName] != undefined) {
+ target.lnkOpts.suffix += lnkOpts[targetName];
+ }
+
+ /* add target to build array */
+ Build.targets.$add(target);
+}
+
+/* remove generated folders */
+Pkg.generatedFiles.$add("lib/");
+
+/* remove all target profiles except debug and release */
+for (var target = 0; target < Build.targets.length; target++) {
+ for (var profile in Build.targets[target].profiles) {
+ if ((profile != 'release') && (profile != 'debug')) {
+ delete Build.targets[target].profiles[profile];
+ }
+ }
+}
+
+/* catch inadvertant use of unsupported data types */
+Pkg.attrs.defs = "-Dxdc__strict";
diff --git a/src/examples/templates/ex44_compute/transport/rtos/package.bld b/src/examples/templates/ex44_compute/transport/rtos/package.bld
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== package.bld ========
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+var Pkg = xdc.useModule('xdc.bld.PackageContents');
+
+var source = [ "TransportQMSS.c" ];
+
+for (var i = 0; i < Build.targets.length; i++) {
+ var target = Build.targets[i];
+
+ for (var profile in target.profiles) {
+ var libName = "lib/" + profile + "/" + Pkg.name.replace(/\./g, "_");
+ var attrs = { profile: profile };
+
+ var lib = Pkg.addLibrary(libName, target, attrs);
+ lib.addObjects(source);
+ }
+}
diff --git a/src/examples/templates/ex44_compute/transport/rtos/package.xdc b/src/examples/templates/ex44_compute/transport/rtos/package.xdc
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== package.xdc ========
+ */
+
+/*!
+ * ======== transport.rtos ========
+ * Custom transport package
+ *
+ * Example package on how to implement the IPC transport interface.
+ */
+package transport.rtos [1,0,0,0] {
+ module TransportQMSS;
+}
diff --git a/src/examples/templates/ex44_compute/transport/rtos/package.xs b/src/examples/templates/ex44_compute/transport/rtos/package.xs
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== package.xs ========
+ */
+
+/*
+ * ======== getLibs ========
+ */
+function getLibs(prog)
+{
+ var suffix;
+ var name;
+ var libPath;
+
+ /* find a compatible suffix */
+ suffix = prog.build.target.findSuffix(this);
+
+ /* compute the library base name */
+ name = this.$name.replace(/\./g, "_");
+
+ /* compute the full library pathname */
+ libPath = "lib/" + prog.build.profile + "/" + name + ".a" + suffix;
+
+ return (libPath);
+}
diff --git a/src/examples/templates/ex45_host/Makefile b/src/examples/templates/ex45_host/Makefile
--- /dev/null
@@ -0,0 +1,80 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+TARGETS = host transport/hlos
+
+EXBASE = .
+include $(EXBASE)/products.mak
+
+.PHONY: all $(TARGETS)
+
+all: host
+host: transport/hlos
+
+$(TARGETS):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@
+
+help:
+ @$(ECHO) "make # build example"
+ @$(ECHO) "make clean # clean everything"
+
+clean:: $(addsuffix _clean,$(TARGETS))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(TARGETS))::
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex45_host/host/Makefile b/src/examples/templates/ex45_host/host/Makefile
--- /dev/null
@@ -0,0 +1,143 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs1)))
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs2)))
+
+srcs1 = Thing1.c
+objs1 = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs1)))
+srcs2 = Thing2.c
+objs2 = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs2)))
+transport = ../transport/hlos/lib/$(PROFILE)/transport_pmq.av7A
+libs = -L$(DESTDIR)/lib -ltitransportrpmsg -ltiipc -ltiipcutils
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug thing1
+# $(MAKE) PROFILE=release thing1
+ $(MAKE) PROFILE=debug thing2
+# $(MAKE) PROFILE=release thing2
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/thing1 $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/thing1 $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+thing1: bin/$(PROFILE)/thing1
+bin/$(PROFILE)/thing1: $(objs1) $(transport)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
+
+thing2: bin/$(PROFILE)/thing2
+bin/$(PROFILE)/thing2: $(objs2) $(transport)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I$(DESTDIR)/include
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex45_host/host/Thing1.c b/src/examples/templates/ex45_host/host/Thing1.c
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Thing1.c ========
+ */
+
+/* standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+extern FILE *stderr;
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+#include "../shared/Thing.h"
+#include "../transport/hlos/TransportPMQ.h"
+
+/* App defines: Must match on remote proc side: */
+#define HEAPID 0
+
+/* module structure */
+typedef struct {
+ pid_t pid; /* my process ID */
+ MessageQ_QueueId outQue; /* outbound messages */
+ TransportPMQ_Handle transPMQ;
+} Thing1_Module;
+
+/* private functions */
+Int Thing1_setup(Void);
+Int Thing1_exec(Void);
+Void Thing1_destroy(Void);
+Int Thing1_parseArgs(Int argc, Char *argv[]);
+
+#define Main_USAGE "\
+Usage:\n\
+ thing1 [options]\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+ n : no shutdown message\n\
+\n"
+
+/* private data */
+static Thing1_Module Thing1_module;
+static Bool Thing1_n_opt = FALSE; /* no shutdown message */
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ Int status;
+
+
+ printf("Thing1_main: -->\n");
+
+ /* parse command line */
+ status = Thing1_parseArgs(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* setup phase */
+ status = Thing1_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Thing1_exec();
+
+leave:
+ /* shutdown phase */
+ Thing1_destroy();
+
+ printf("Thing1_main: <-- status=%d\n", status);
+ return (status);
+}
+
+/*
+ * ======== Thing1_setup ========
+ */
+Int Thing1_setup(Void)
+{
+ Int status = 0;
+ ITransport_Handle transport;
+ INetworkTransport_Handle transNetwork;
+
+
+ printf("Thing1_setup: -->\n");
+
+ /* initialize module state */
+ Thing1_module.pid = getpid();
+ Thing1_module.outQue = MessageQ_INVALIDMESSAGEQ;
+ Thing1_module.transPMQ = NULL;
+
+ printf("Thing1_setup: pid=%d\n", Thing1_module.pid);
+
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+ /* initialize IPC */
+ printf("Thing1_setup: initalizing IPC\n");
+ status = Ipc_start();
+
+ if (status < 0) {
+ fprintf(stderr, "Error: failed to initialize IPC, error=%d\n", status);
+ goto leave;
+ }
+ printf("Thing1_setup: IPC ready, status=%d\n", status);
+
+ /* setup the TransportPMQ module */
+ status = TransportPMQ_setup();
+
+ if (status < 0) {
+ status = -1;
+ fprintf(stderr, "Error: TransportPMQ setup failed\n");
+ goto leave;
+ }
+ printf("Thing1_setup: TransportPMQ module initialized\n");
+ Thing1_module.transPMQ = TransportPMQ_handle();
+
+ /* register qmss transport with MessageQ */
+ transNetwork = TransportPMQ_upCast(Thing1_module.transPMQ);
+ transport = INetworkTransport_upCast(transNetwork);
+ MessageQ_registerTransportId(TRANSPORT_PMQ_ID, transport);
+
+ /* open the remote message queue */
+ do {
+ status = MessageQ_open(Thing2_QUEUE_NAME, &Thing1_module.outQue);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ sleep(1);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: Thing1_setup: MessageQ_open failed, "
+ "error=%d\n", status);
+ goto leave;
+ }
+ printf("Thing1_setup: opened message queue %s\n", Thing2_QUEUE_NAME);
+
+leave:
+ printf("Thing1_setup: <-- status=%d\n", status);
+ return (status);
+}
+
+/*
+ * ======== Thing1_exec ========
+ */
+Int Thing1_exec(Void)
+{
+ Int status = 0;
+ Int i;
+ MessageQ_Msg mqMsg;
+ Thing_Msg *msg;
+
+ printf("Thing1_exec: -->\n");
+
+ /* send messages to destination queue */
+ for (i = 1; i <= 4; i++) {
+
+ /* allocate a new messate */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Thing_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error in MessageQ_alloc\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* use posix message queue transport for message delivery */
+ MessageQ_setTransportId(mqMsg, TRANSPORT_PMQ_ID);
+
+ /* fill in message payload */
+ msg = (Thing_Msg *)mqMsg;
+ msg->cmd = Thing_Cmd_HELLO;
+ msg->arg1 = Thing1_module.pid;
+ msg->arg2 = 0;
+
+ /* send message */
+ status = MessageQ_put(Thing1_module.outQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error in MessageQ_put\n");
+ status = -2;
+ goto leave;
+ }
+ printf("Thing1_exec: message sent: %d\n", i);
+
+ /* delay */
+ sleep(1);
+ }
+
+ /* send shutdown message */
+ if (!Thing1_n_opt) {
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Thing_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error in MessageQ_alloc\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* use posix message queue transport for message delivery */
+ MessageQ_setTransportId(mqMsg, TRANSPORT_PMQ_ID);
+
+ /* fill in message payload */
+ msg = (Thing_Msg *)mqMsg;
+ msg->cmd = Thing_Cmd_GOODBYE;
+ msg->arg1 = Thing1_module.pid;
+ msg->arg2 = 0;
+
+ /* send message */
+ status = MessageQ_put(Thing1_module.outQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error in MessageQ_put\n");
+ status = -2;
+ goto leave;
+ }
+ printf("Thing1_exec: shutdown message sent\n");
+ }
+
+leave:
+ printf("Thing1_exec: <-- status=%d\n", status);
+
+ return (status);
+}
+
+/*
+ * ======== Thing1_destroy ========
+ */
+Void Thing1_destroy(Void)
+{
+
+ printf("Thing1_destroy: -->\n");
+
+ /* finalize the secondary transport */
+ MessageQ_unregisterTransportId(TRANSPORT_PMQ_ID);
+ TransportPMQ_destroy();
+
+ /* close the outbound message queue */
+ MessageQ_close(&Thing1_module.outQue);
+
+ /* finalize IPC */
+ Ipc_stop();
+
+ printf("Thing1_destroy: <--\n");
+}
+
+/*
+ * ======== Thing1_parseArgs ========
+ */
+Int Thing1_parseArgs(Int argc, Char *argv[])
+{
+ Int x, cp, opt, argNum;
+ Int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ case 'n': /* -n */
+ Thing1_n_opt = TRUE;
+ break;
+
+ default:
+ printf("Error: invalid option, %c\n", (Char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ for (argNum = 1; opt < argc; argNum++, opt++) {
+
+ switch (argNum) {
+ default:
+ printf("Error: too many arguments\n");
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+leave:
+ return(status);
+}
diff --git a/src/examples/templates/ex45_host/host/Thing2.c b/src/examples/templates/ex45_host/host/Thing2.c
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Thing_2.c ========
+ */
+
+/* standard headers */
+#include <stdio.h>
+
+extern FILE *stderr;
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+#include "../shared/Thing.h"
+#include "../transport/hlos/TransportPMQ.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle inQue; /* inbound messages */
+ TransportPMQ_Handle transPMQ;
+} Thing2_Module;
+
+/* private functions */
+Int Thing2_setup(Void);
+Int Thing2_exec(Void);
+Void Thing2_destroy(Void);
+
+/* private data */
+static Thing2_Module Thing2_module;
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ Int status;
+
+
+ printf("Thing2_main: -->\n");
+
+ /* setup phase */
+ status = Thing2_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Thing2_exec();
+
+leave:
+ /* shutdown phase */
+ Thing2_destroy();
+
+ printf("Thing2_main: <-- status=%d\n", status);
+ return(status);
+}
+
+/*
+ * ======== Thing2_setup ========
+ */
+Int Thing2_setup(Void)
+{
+ Int status = 0;
+ ITransport_Handle transport;
+ INetworkTransport_Handle transNetwork;
+
+
+ printf("Thing2_setup: -->\n");
+
+ /* initialize module state */
+ Thing2_module.inQue = NULL;
+
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+ /* initialize IPC */
+ printf("Thing2_setup: initalizing IPC\n");
+ status = Ipc_start();
+
+ if (status < 0) {
+ fprintf(stderr, "Error: failed to initialize IPC, error=%d\n", status);
+ goto leave;
+ }
+ printf("Thing2_setup: IPC ready, status=%d\n", status);
+
+ /* setup the TransportPMQ module */
+ status = TransportPMQ_setup();
+
+ if (status < 0) {
+ status = -1;
+ fprintf(stderr, "Error: TransportPMQ setup failed\n");
+ goto leave;
+ }
+ printf("Thing2_setup: TransportPMQ module initialized\n");
+ Thing2_module.transPMQ = TransportPMQ_handle();
+
+ /* register qmss transport with MessageQ */
+ transNetwork = TransportPMQ_upCast(Thing2_module.transPMQ);
+ transport = INetworkTransport_upCast(transNetwork);
+ MessageQ_registerTransportId(TRANSPORT_PMQ_ID, transport);
+
+ /* create the message queue (inbound) */
+ Thing2_module.inQue = MessageQ_create(Thing2_QUEUE_NAME, NULL);
+
+ if (Thing2_module.inQue == NULL) {
+ status = -1;
+ fprintf(stderr, "Error: message queue create failed\n");
+ goto leave;
+ }
+
+leave:
+ printf("Thing2_setup: <-- status=%d\n", status);
+ return (status);
+}
+
+/*
+ * ======== Thing2_exec ========
+ */
+Int Thing2_exec(Void)
+{
+ Int status;
+ MessageQ_Msg mqMsg;
+ Thing_Msg *msg;
+ Bool run = TRUE;
+
+
+ printf("Thing2_exec: -->\n");
+
+ /* main loop */
+ while (run) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Thing2_module.inQue, &mqMsg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message get failed, error=%d\n", status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (Thing_Msg *)mqMsg;
+
+ switch (msg->cmd) {
+ case Thing_Cmd_HELLO:
+ printf("Thing2_exec: message received, pid=%d\n", msg->arg1);
+ break;
+
+ case Thing_Cmd_GOODBYE:
+ run = FALSE;
+ printf("Thing2_exec: shutdown received, pid=%d\n", msg->arg1);
+ break;
+
+ default:
+ fprintf(stderr, "Error: Thing2_exec: unknown command %d\n",
+ msg->cmd);
+ break;
+ }
+
+ /* return the message to its heap */
+ MessageQ_free(mqMsg);
+ }
+
+leave:
+ printf("Thing2_exec: <-- status=%d\n", status);
+
+ return (status);
+}
+
+/*
+ * ======== Thing2_destroy ========
+ */
+Void Thing2_destroy(Void)
+{
+
+ printf("Thing2_destroy: -->\n");
+
+ /* finalize the secondary transport */
+ MessageQ_unregisterTransportId(TRANSPORT_PMQ_ID);
+ TransportPMQ_destroy();
+
+ /* delete the inbound message queue */
+ MessageQ_delete(&Thing2_module.inQue);
+
+ /* finalize IPC */
+ Ipc_stop();
+
+ printf("Thing2_destroy: <--\n");
+}
diff --git a/src/examples/templates/ex45_host/mkpkg.xdt b/src/examples/templates/ex45_host/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,30 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (this.platform.match(/^TCI6638_linux_elf$/)) {
+% /* OK */
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
+
+Makefile -> `this.example`/Makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt @verbatim
+
+host/Makefile -> `this.example`/host/Makefile
+host/Thing1.c -> `this.example`/host/Thing1.c
+host/Thing2.c -> `this.example`/host/Thing2.c
+
+scripts/run_all.sh -> `this.example`/scripts/run_all.sh
+scripts/run_lad.sh -> `this.example`/scripts/run_lad.sh
+
+shared/Thing.h -> `this.example`/shared/Thing.h
+
+transport/hlos/Makefile -> `this.example`/transport/hlos/Makefile
+transport/hlos/TransportPMQ.c -> `this.example`/transport/hlos/TransportPMQ.c
+transport/hlos/TransportPMQ.h -> `this.example`/transport/hlos/TransportPMQ.h
+transport/hlos/TransportPMQCfg.c -> `this.example`/transport/hlos/TransportPMQCfg.c
diff --git a/src/examples/templates/ex45_host/products.mak b/src/examples/templates/ex45_host/products.mak
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-linux-gnueabihf
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+#DESTDIR = $(DEPOT)/_your_destdir_
+
+#### BIOS-side toolchains ####
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+
+# Use this goal to print your product variables.
+.show:
+ @echo "TOOLCHAIN_LONGNAME = $(TOOLCHAIN_LONGNAME)"
+ @echo "TOOLCHAIN_INSTALL_DIR = $(TOOLCHAIN_INSTALL_DIR)"
+ @echo "TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+ @echo "DESTDIR = $(DESTDIR)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
diff --git a/src/examples/templates/ex45_host/readme.txt b/src/examples/templates/ex45_host/readme.txt
--- /dev/null
@@ -0,0 +1,113 @@
+#
+# ======== readme.txt ========
+#
+
+Overview
+=========================================================================
+This example illustrates IPC communication between two host applications.
+It also provides a transport implementation using POSIX message queue.
+
+There are two programs: thing1 and thing2. The program thing2 creates
+an IPC message queue and then waits on the queue for messages to arrive.
+The program thing1 opens the IPC message queue created by thing2 and then
+sends a few messages.
+
+The last message sent by thing1 is a shutdown message. This causes thing2
+to delete its message queue and exit. You can suppress the shutdown message
+with a command linen option when invoking thing1. In this case thing2 will
+not exit. You can invoke thing1 again and repeat the cycle.
+
+The host folder contains the source files for the thing1 and thing2programs.
+The transport folder contains the source files for the TransportPMQ module.
+Both thing1 and thing2 enable this transport and register it with MessageQ.
+When sending a message, the corresponding transport ID is used which will
+cause MessageQ to invoke the TransportPMQ module when delivering the message.
+
+
+Build Instructions
+=========================================================================
+
+ 1. Create a work folder on your file system.
+
+ mkdir work
+
+ 2. Extract this example into your work folder.
+
+ cd work
+ unzip ex45_host.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ edit ex45_compute/products.mak
+
+ TOOLCHAIN_LONGNAME = arm-linux-gnueabihf
+ TOOLCHAIN_INSTALL_DIR = <...>/linaro-arm-gnueabihf_4_7_2013_03
+ TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+
+ IPC_INSTALL_DIR = <...>/ipc_m_mm_pp_bb
+
+ Your DESTDIR must point to your IPC "install" location. In other words,
+ the location you specified when you ran 'make install' within the IPC
+ product.
+
+ DESTDIR = <...>
+
+ Note: To build this example, you must install IPC into DESTDIR.
+
+ 4. Build the example. This will build only debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ex45_host
+ make
+
+ 5. Issue the following commands to clean your example.
+
+ cd ex45_host
+ make clean
+
+ 6. Copy the HOST executables, and the supporting scripts to your target
+ file system.
+
+ ex45_host/host/bin/debug/thing1
+ ex45_host/host/bin/debug/thing2
+ ex45_host/scripts/run_all.sh
+ ex45_host/scripts/run_lad.sh
+
+
+Running The Example
+=========================================================================
+A typical way to run this example is to run thing2 in the background and
+then to run thing1 in the foreground. But this is not required. You can
+run thing1 first if you prefer. It will spin in a loop trying to open the
+message queue created by thing2. Once the queue is created by thing2, both
+programs proceed as usual.
+
+ 1. Start LAD. You must start the LAD daemon before running any IPC
+ program. If it is not already running, use the following command
+ to start it.
+
+ lad_tci6638 -l log.txt
+
+ You can also use the helper script provided with the example.
+
+ run_lad.sh
+
+ Note: The LAD daemon is built with the IPC product and is available
+ in the DESTDIR folder. Copy it to your target file system.
+
+ DESTDIR/bin/lad_tci6638
+
+ 2. You must run both thing1 and thing2 concurrently. To do this from
+ one shell, run the first program in the background. It does not matter
+ which one is run first. Then run the second program in the foreground.
+
+ thing2 &
+ thing1
+
+ You can also use the helper script provided with the example.
+
+ run_all.sh
diff --git a/src/examples/templates/ex45_host/scripts/run_all.sh b/src/examples/templates/ex45_host/scripts/run_all.sh
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -x
+
+./thing2 &
+
+./thing1 -n
+./thing1
+
+wait
diff --git a/src/examples/templates/ex45_host/scripts/run_lad.sh b/src/examples/templates/ex45_host/scripts/run_lad.sh
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+set -x
+./lad_tci6638 -l log.txt
diff --git a/src/examples/templates/ex45_host/shared/Thing.h b/src/examples/templates/ex45_host/shared/Thing.h
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Thing_Msg.h ========
+ */
+
+#ifndef Thing_Msg__include
+#define Thing_Msg__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define Thing_Cmd_HELLO 1
+#define Thing_Cmd_GOODBYE 2
+
+#define Thing2_QUEUE_NAME "Thing_2"
+#define TRANSPORT_PMQ_ID 1
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+
+ Int cmd;
+ Int arg1;
+ UInt arg2;
+} Thing_Msg;
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex45_host/transport/hlos/Makefile b/src/examples/templates/ex45_host/transport/hlos/Makefile
--- /dev/null
@@ -0,0 +1,115 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ../..
+include $(EXBASE)/products.mak
+-include $(addprefix lib/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+
+srcs = TransportPMQ.c TransportPMQCfg.c
+objs = $(addprefix lib/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug transport_pmq.a
+# $(MAKE) PROFILE=release transport_pmq.a
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) lib
+
+
+#
+# ======== rules ========
+#
+transport_pmq.a: lib/$(PROFILE)/transport_pmq.av7A
+lib/$(PROFILE)/transport_pmq.av7A: $(objs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(AR) $@ $^
+
+lib/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT -D_GNU_SOURCE
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I$(IPC_INSTALL_DIR)/linux/include -I$(IPC_INSTALL_DIR)/packages
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard lib/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p lib/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex45_host/transport/hlos/TransportPMQ.c b/src/examples/templates/ex45_host/transport/hlos/TransportPMQ.c
--- /dev/null
@@ -0,0 +1,565 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportPMQ.c ========
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+extern FILE *stderr;
+
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include "TransportPMQ.h"
+
+#define MQ_NAME_FMT "/TransportPMQ_mq_%d"
+#define MQ_MAXQUE_SIZE 10
+#define MQ_MAXMSG_SIZE 128
+#define SEM_NAME_FMT "/TransportPMQ_sem_%d"
+#define NAME_LEN 32
+#define NS_NAME "TransportPMQ"
+#define NS_KEY_LEN 16
+
+
+/*
+ * ======== TransportPMQ_Module ========
+ */
+typedef struct {
+ INetworkTransport_Object base; /* inheritance */
+ UInt16 heapId; /* heap for message pool */
+ int pid; /* my process ID */
+ NameServer_Handle ns; /* transport name server instance */
+ mqd_t mque; /* message queue */
+ struct mq_attr mqattr; /* message queue attributes */
+ unsigned int priority; /* message priority (fixed) */
+ sem_t *sem; /* semaphore to serialize writers */
+ pthread_t threadId; /* worker thread, the mailman */
+ Bool threadStarted; /* mailman has been started */
+ pthread_mutex_t gate; /* module gate */
+ int refCount; /* user reference count */
+} TransportPMQ_Module;
+
+/*
+ * ======== private functions ========
+ */
+void *TransportPMQ_mailman(void *arg);
+
+/*
+ * ======== instance function declarations ========
+ */
+Int TransportPMQ_bind(Void *handle, UInt32 queueId);
+Int TransportPMQ_unbind(Void *handle, UInt32 queueId);
+Bool TransportPMQ_put(Void *handle, Ptr msg);
+
+/*
+ * ======== TransportPMQ_Fxns ========
+ * The instance function table
+ */
+INetworkTransport_Fxns TransportPMQ_Fxns = {
+ TransportPMQ_bind,
+ TransportPMQ_unbind,
+ TransportPMQ_put
+};
+
+/*
+ * ======== TransportPMQ_module ========
+ * The module state object
+ */
+static TransportPMQ_Module TransportPMQ_module = {
+ .base.base.interfaceType = INetworkTransport_TypeId,
+ .base.fxns = &TransportPMQ_Fxns,
+ .heapId = 0xFFFF,
+ .pid = -1,
+ .ns = NULL,
+ .mque = (mqd_t)-1,
+ .priority = 1,
+ .sem = NULL,
+ .threadStarted = FALSE,
+ // only _NP (non-portable) type available in CG tools which we're using
+ .gate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
+ .refCount = 0
+};
+
+/*
+ * ======== TransportPMQ_setup ========
+ */
+Int TransportPMQ_setup(Void)
+{
+ int status = 0;
+ NameServer_Params nsParams;
+ char name[NAME_LEN];
+ int flags;
+ mode_t mode;
+ struct mq_attr attr;
+
+
+ /* enter critical section */
+ pthread_mutex_lock(&TransportPMQ_module.gate);
+
+ /* only first thread performs setup procedure */
+ if (TransportPMQ_module.refCount >= 1) {
+ TransportPMQ_module.refCount++;
+ status = 1;
+ goto done;
+ }
+
+ /* configure the module */
+ TransportPMQ_module.heapId = TransportPMQ_cfg.heapId;
+
+ /* identify myself */
+ TransportPMQ_module.pid = (int)getpid();
+
+ /* name server instance for mapping queues to owners */
+ NameServer_Params_init(&nsParams);
+ nsParams.maxValueLen = sizeof(int);
+ nsParams.maxNameLen = NS_KEY_LEN;
+
+ TransportPMQ_module.ns = NameServer_create("TransportPMQ", &nsParams);
+
+ if (TransportPMQ_module.ns == NULL) {
+ status = -1;
+ goto done;
+ }
+
+ /* create the message queue for all inbound messages */
+ snprintf(name, NAME_LEN - 1, MQ_NAME_FMT, TransportPMQ_module.pid);
+ flags = O_RDWR | O_CREAT | O_EXCL;
+ mode = S_IWUSR | S_IWGRP | S_IWOTH;
+ attr.mq_maxmsg = MQ_MAXQUE_SIZE;
+ attr.mq_msgsize = MQ_MAXMSG_SIZE;
+
+ TransportPMQ_module.mque = mq_open(name, flags, mode, &attr);
+
+ if (TransportPMQ_module.mque == (mqd_t)-1) {
+ perror("Error: TransportPMQ_create: mq_open failed");
+ status = -1;
+ goto done;
+ }
+
+ /* create a named semaphore to serialize message queue writers */
+ snprintf(name, NAME_LEN - 1, SEM_NAME_FMT, TransportPMQ_module.pid);
+ flags = O_CREAT | O_EXCL;
+ mode = S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+
+ TransportPMQ_module.sem = sem_open(name, flags, mode, 1);
+
+ if (TransportPMQ_module.sem == SEM_FAILED) {
+ perror("Error: TransportPMQ_create: sem_open failed");
+ TransportPMQ_module.sem = NULL;
+ status = -1;
+ goto done;
+ }
+
+ /* create a worker thread for delivering inbound messages */
+ status = pthread_create(&TransportPMQ_module.threadId, NULL,
+ &TransportPMQ_mailman, (void *)&TransportPMQ_module);
+
+ if (status < 0) {
+ perror("Error: TransportPMQ_create: pthread_create failed");
+ status = -1;
+ goto done;
+ }
+ TransportPMQ_module.threadStarted = TRUE;
+
+ /* getting here means we have successfully started */
+ TransportPMQ_module.refCount++;
+
+done:
+ if (status < 0) {
+ TransportPMQ_destroy();
+ }
+
+ /* leave critical section */
+ pthread_mutex_unlock(&TransportPMQ_module.gate);
+
+ return (status);
+}
+
+/*
+ * ======== TransportPMQ_destroy ========
+ */
+Void TransportPMQ_destroy(Void)
+{
+ Int status = 0;
+ char name[NAME_LEN];
+
+
+ /* enter critical section */
+ pthread_mutex_lock(&TransportPMQ_module.gate);
+
+ /* only last thread performs stop procedure */
+ if (TransportPMQ_module.refCount > 1) {
+ TransportPMQ_module.refCount--;
+ goto done;
+ }
+
+ if (TransportPMQ_module.threadStarted) {
+ TransportPMQ_module.threadStarted = FALSE;
+
+ status = sem_wait(TransportPMQ_module.sem);
+
+ if (status == -1) {
+ perror("Error: TransportPMQ_delete: sem_wait failed");
+ /* report error, and keep going */
+ }
+
+ /* send empty message to unblock worker thread */
+ mq_send(TransportPMQ_module.mque, name, 0,
+ TransportPMQ_module.priority);
+
+ /* wait for worker thread to exit */
+ pthread_join(TransportPMQ_module.threadId, NULL);
+ }
+
+ if (TransportPMQ_module.sem != NULL) {
+ snprintf(name, NAME_LEN - 1, SEM_NAME_FMT, TransportPMQ_module.pid);
+ sem_unlink(name);
+ TransportPMQ_module.sem = NULL;
+ }
+
+ if (TransportPMQ_module.mque != (mqd_t)-1) {
+ snprintf(name, NAME_LEN - 1, MQ_NAME_FMT, TransportPMQ_module.pid);
+ mq_unlink(name);
+ TransportPMQ_module.mque = -1;
+ }
+
+ if (TransportPMQ_module.ns != NULL) {
+ NameServer_delete(&TransportPMQ_module.ns);
+ }
+
+ /* If the count is already zero, it probably means that the setup
+ * method failed and we are doing cleanup. If this method was called
+ * too many times, then its a don't care because all resources have
+ * already been released. Otherwise, decrement the count (should go
+ * to zero).
+ */
+ if (TransportPMQ_module.refCount > 0) {
+ TransportPMQ_module.refCount--;
+ }
+
+done:
+ /* leave critical section */
+ pthread_mutex_unlock(&TransportPMQ_module.gate);
+}
+
+/*
+ * ======== TransportPMQ_handle ========
+ */
+TransportPMQ_Handle TransportPMQ_handle(Void)
+{
+ TransportPMQ_Handle handle;
+
+ handle = (TransportPMQ_Handle)&TransportPMQ_module;
+ return (handle);
+}
+
+/*
+ * ======== TransportPMQ_upCast ========
+ */
+INetworkTransport_Handle TransportPMQ_upCast(TransportPMQ_Handle inst)
+{
+ return ((INetworkTransport_Handle)inst);
+}
+
+/*
+ * ======== TransportPMQ_downCast ========
+ */
+TransportPMQ_Handle TransportPMQ_downCast(INetworkTransport_Handle base)
+{
+ return ((TransportPMQ_Handle)base);
+}
+
+/*
+ * ======== TransportPMQ_bind ========
+ */
+Int TransportPMQ_bind(Void *handle, UInt32 queueId)
+{
+ Int status = 0;
+ TransportPMQ_Module *mod;
+ Char key[NS_KEY_LEN];
+ Ptr entry;
+
+ mod = (TransportPMQ_Module *)handle;
+
+ /* make the queueId into a string */
+ snprintf(key, NS_KEY_LEN - 1, "0x%08x", queueId);
+
+ /* bind the queueId to our process ID */
+ entry = NameServer_add(mod->ns, key, &mod->pid, sizeof(int));
+
+ if (entry == NULL) {
+ fprintf(stderr, "Error: TransportPMQ_bind: "
+ "NameServer_add failed, key=%s\n", key);
+ status = -1;
+ goto done;
+ }
+
+done:
+ return (status);
+}
+
+/*
+ * ======== TransportPMQ_unbind ========
+ */
+Int TransportPMQ_unbind(Void *handle, UInt32 queueId)
+{
+ Int status = 0;
+ TransportPMQ_Module *mod;
+ Char key[NS_KEY_LEN];
+
+ mod = (TransportPMQ_Module *)handle;
+
+ /* make the queueId into a string */
+ snprintf(key, NS_KEY_LEN - 1, "0x%08x", queueId);
+
+ /* unbind the queueId from our process ID */
+ status = NameServer_remove(mod->ns, key);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: TransportPMQ_unbind: "
+ "NameServer_remove failed, key=%s\n", key);
+ status = -1;
+ goto done;
+ }
+
+done:
+ return (status);
+}
+
+/*
+ * ======== TransportPMQ_put ========
+ */
+Bool TransportPMQ_put(Void *handle, Ptr msg)
+{
+ Int status = 0;
+ Bool rval = TRUE;
+ TransportPMQ_Module *mod;
+ MessageQ_Msg mqMsg;
+ UInt32 dstQue;
+ Char key[NS_KEY_LEN];
+ char name[NAME_LEN];
+ int dstPID;
+ int flags;
+ sem_t *sem;
+ mqd_t mqueue;
+ char *ptr;
+ UInt32 size;
+ size_t nbytes;
+
+ mod = (TransportPMQ_Module *)handle;
+ mqMsg = (MessageQ_Msg)msg;
+
+ /* extract the destination address */
+ dstQue = MessageQ_getDstQueue(mqMsg);
+
+ /* make the destination queue into a key name */
+ snprintf(key, NS_KEY_LEN - 1, "0x%08x", dstQue);
+ size = sizeof(int);
+
+ /* ask name server for the owner process */
+ status = NameServer_getLocal(mod->ns, key, &dstPID, &size);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: TransportPMQ_put: "
+ "NameServer_getLocal failed, key=%s\n", key);
+ rval = FALSE;
+ goto done;
+ }
+
+ /* open the semaphore */
+ snprintf(name, NAME_LEN - 1, SEM_NAME_FMT, dstPID);
+ flags = O_RDWR;
+ sem = sem_open(name, flags);
+
+ if (sem == SEM_FAILED) {
+ perror("Error: TransportPMQ_put: sem_open failed");
+ rval = FALSE;
+ goto done;
+ }
+
+ /* open message queue */
+ snprintf(name, NAME_LEN - 1, MQ_NAME_FMT, dstPID);
+ flags = O_WRONLY;
+ mqueue = mq_open(name, flags);
+
+ if (mqueue == (mqd_t)-1) {
+ perror("Error: TransportPMQ_put: mq_open failed");
+ rval = FALSE;
+ goto done_sem;
+ }
+
+ /* acquire exclusive use of the message queue */
+ status = sem_wait(sem);
+
+ if (status == -1) {
+ perror("Error: TransportPMQ_put: sem_wait failed");
+ rval = FALSE;
+ goto done_mq;
+ }
+
+ /* send only the message header */
+ status = mq_send(mqueue, msg, sizeof(MessageQ_MsgHeader), mod->priority);
+
+ if (status == -1) {
+ perror("Error: TransportPMQ_put: mq_send header failed");
+ rval = FALSE;
+ goto done_post;
+ }
+
+ /* send the message payload */
+ ptr = (char *)msg + sizeof(MessageQ_MsgHeader);
+ size = MessageQ_getMsgSize(mqMsg) - sizeof(MessageQ_MsgHeader);
+
+ do {
+ nbytes = (size < MQ_MAXMSG_SIZE ? size : MQ_MAXMSG_SIZE);
+
+ status = mq_send(mqueue, ptr, nbytes, mod->priority);
+
+ if (status == -1) {
+ perror("Error: TransportPMQ_put: mq_send payload failed");
+ rval = FALSE;
+ goto done_post;
+ }
+
+ ptr += nbytes;
+ size -= nbytes;
+ } while (size > 0);
+
+ /* message successfully delivered, free local copy */
+ MessageQ_free(mqMsg);
+
+done_post:
+ status = sem_post(sem);
+
+done_mq:
+ mq_close(mqueue);
+
+done_sem:
+ sem_close(sem);
+
+done:
+ return (rval);
+}
+
+/*
+ * ======== TransportPMQ_mailman ========
+ */
+void *TransportPMQ_mailman(void *arg)
+{
+ Int status = 0;
+ Bool run = TRUE;
+ TransportPMQ_Module *mod;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId queueId;
+ Int size;
+ ssize_t nbytes;
+ char *ptr;
+ char buf[MQ_MAXMSG_SIZE];
+
+ mod = (TransportPMQ_Module *)arg;
+
+ while (run) {
+
+ /* wait for new message, expecting only the header */
+ nbytes = mq_receive(mod->mque, buf, MQ_MAXMSG_SIZE, NULL);
+
+ if (nbytes == -1) {
+ perror("Error: TransportPMQ_mailman: mq_receive header failed");
+ status = -1;
+ goto done;
+ }
+
+ if ((nbytes == 0) && (!mod->threadStarted)) {
+ run = FALSE;
+ goto done;
+ }
+
+ if (nbytes == 0) {
+ fprintf(stderr, "Warning: TransportPMQ_mailman: "
+ "received empty message\n");
+ continue;
+ }
+
+ /* allocate a local message to hold inbound data */
+ size = MessageQ_getMsgSize((MessageQ_MsgHeader *)buf);
+
+ mqMsg = MessageQ_alloc(mod->heapId, size);
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: TransportPMQ_mailman: "
+ "MessageQ_alloc failed\n");
+ status = -1;
+ goto done;
+ }
+
+ /* copy header into message, then fill message with payload */
+ memcpy(mqMsg, buf, sizeof(MessageQ_MsgHeader));
+
+ ptr = (char *)mqMsg + sizeof(MessageQ_MsgHeader);
+ size -= sizeof(MessageQ_MsgHeader);
+
+ do {
+ nbytes = mq_receive(mod->mque, ptr, MQ_MAXMSG_SIZE, NULL);
+
+ if (nbytes == -1) {
+ perror("Error: TransportPMQ_mailman: mq_receive payload "
+ "failed");
+ status = -1;
+ goto done;
+ }
+
+ ptr += nbytes;
+ size -= nbytes;
+ } while (size > 0);
+
+ /* place message on destination queue */
+ queueId = MessageQ_getDstQueue(mqMsg);
+ MessageQ_put(queueId, mqMsg);
+ }
+
+done:
+ return ((void *)status);
+}
diff --git a/src/examples/templates/ex45_host/transport/hlos/TransportPMQ.h b/src/examples/templates/ex45_host/transport/hlos/TransportPMQ.h
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportPMQ.h ========
+ */
+
+#include <ti/ipc/interfaces/INetworkTransport.h>
+
+/*
+ * ======== TransportPMQ_Config ========
+ */
+typedef struct {
+ UInt16 heapId; /* heap used for message pool */
+} TransportPMQ_Config;
+
+/*
+ * ======== TransportPMQ_Handle ========
+ * Opaque handle to transport instance object
+ */
+typedef struct TransportPMQ_Module *TransportPMQ_Handle;
+
+/*
+ * ======== TransportPMQ_setup ========
+ * Initialize the transport
+ */
+Int TransportPMQ_setup(Void);
+
+/*
+ * ======== TransportPMQ_destroy ========
+ * Finalize the transport
+ */
+Void TransportPMQ_destroy(Void);
+
+/*
+ * ======== TransportPMQ_handle ========
+ * Return the transport handle
+ *
+ * This module does not support instance creation. When the module
+ * is initialized, a single implicit instance is created. This method
+ * returns the handle to this implicit instance.
+ */
+TransportPMQ_Handle TransportPMQ_handle(Void);
+
+/*
+ * ======== TransportPMQ_upCast ========
+ * Instance converter, return a handle to the inherited interface
+ */
+INetworkTransport_Handle TransportPMQ_upCast(TransportPMQ_Handle inst);
+
+/*
+ * ======== TransportPMQ_downCast ========
+ * Instance converter, return an opaque handle to the instance object
+ *
+ * It is the caller's responsibility to ensure the underlying object
+ * is of the correct type.
+ */
+TransportPMQ_Handle TransportPMQ_downCast(INetworkTransport_Handle base);
+
+/*
+ * ======== TransportPMQ_cfg ========
+ * The module configuration object
+ */
+extern TransportPMQ_Config TransportPMQ_cfg;
diff --git a/src/examples/templates/ex45_host/transport/hlos/TransportPMQCfg.c b/src/examples/templates/ex45_host/transport/hlos/TransportPMQCfg.c
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransportPMQCfg.c ========
+ */
+
+#include <ti/ipc/Std.h>
+#include "TransportPMQ.h"
+
+/*
+ * ======== TransportPMQ_cfg ========
+ * The module configuration object
+ *
+ * This object defines the module configuration values. Edit this file
+ * and rebuild your transport library to change the module configuration.
+ */
+TransportPMQ_Config TransportPMQ_cfg = {
+ .heapId = 0
+};
diff --git a/src/examples/templates/ex46_graph/IPC_Example_ex46_graph.pptx b/src/examples/templates/ex46_graph/IPC_Example_ex46_graph.pptx
new file mode 100644 (file)
index 0000000..2de89b0
Binary files /dev/null and b/src/examples/templates/ex46_graph/IPC_Example_ex46_graph.pptx differ
index 0000000..2de89b0
Binary files /dev/null and b/src/examples/templates/ex46_graph/IPC_Example_ex46_graph.pptx differ
diff --git a/src/examples/templates/ex46_graph/Makefile b/src/examples/templates/ex46_graph/Makefile
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+TARGETS = manager producer consumer transformer combiner
+
+EXBASE = .
+include $(EXBASE)/products.mak
+
+.PHONY: all $(TARGETS)
+
+all: $(TARGETS)
+
+$(TARGETS):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@
+
+help:
+ @$(ECHO) "make # build example"
+ @$(ECHO) "make clean # clean everything"
+
+clean:: $(addsuffix _clean,$(TARGETS))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(TARGETS))::
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex46_graph/combiner/CombinerN.cfg b/src/examples/templates/ex46_graph/combiner/CombinerN.cfg
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== CombinerN.cfg ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+var Diags = xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Task');
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+// BIOS.libType = BIOS.LibType_Debug;
+
+xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.global.SR0_cacheEnable = true;
+Program.global.Global_SR0_OWNER = "CORE0"; /* DSP1 is owner of SR #0 */
+
+/* register a startup first function to set SR#0 owner */
+var Startup = xdc.useModule('xdc.runtime.Startup');
+Startup.firstFxns.$add('&MainDspN_startupFirst');
+
+/* configure processor names */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.procAddrMode = MultiProc.ProcAddrMode_Cluster;
+
+/* these must match host side configuration: MultiProcCfg_tci6638.c */
+var procNameAry = [ "HOST", "CORE0", "CORE1", "CORE2", "CORE3", "CORE4",
+ "CORE5", "CORE6", "CORE7" ];
+MultiProc.numProcessors = 4608;
+MultiProc.baseIdOfCluster = MultiProc.INVALIDID;
+
+/* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+MultiProc.setConfig(null, procNameAry);
+Program.global.Global_CLUSTERSZ = MultiProc.numProcsInCluster;
+var MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.tci663x.MultiProcSetup');
+MultiProcSetup.configureProcId = false;
+
+/* ipc startup configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ isValid: false,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
+
+/* make SR_0 non-cacheable */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(SR0Mem.base, SR0Mem.len, Cache.Mar_DISABLE);
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+/* used to write SysMin trace buffer to memory */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+/* should be done internally */
+xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+
+xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+/* why doe we need this? */
+Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+/* is this not enabled by default? */
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+Hwi.enableException = true;
+
+/* This makes the vrings address range 0xA000_0000 to 0xA1FF_FFFF 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');
+Cache.setMarMeta(0xA0000000, 0x2000000, 0); /* 32 MB, value should be enum */
+
+/* Enable Memory Translation module that operates on the Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = Program.platform.dataMemory;
+
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+/* MessageQ application specific configuration */
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.numReservedEntries = 8;
+MessageQ.numHeaps = 9; /* 1 for transport, 1 for each dsp (8x) */
+
+/* this heap is used by RPMsgTransport */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var heapBufP = new HeapBuf.Params;
+heapBufP.align = 8;
+heapBufP.blockSize = 512;
+heapBufP.numBlocks = 64;
+var msgHeap = HeapBuf.create(heapBufP);
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+VirtioSetup.common$.diags_INFO = Diags.RUNTIME_OFF;
+
+xdc.loadPackage('ti.ipc.transports');
+
+/* why is this not done internally? */
+var NotifyDriverCirc =
+ xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+NotifyDriverCirc.InterruptProxy = Interrupt;
+
+/* Notify brings in the ti.sdo.ipc.family.Settings module, which does
+ * lots of config magic which will need to be UNDONE later, or setup
+ * earlier, to get the necessary overrides to various IPC module proxies!
+ */
+var Notify = xdc.module('ti.sdo.ipc.Notify');
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+
+/*
+ * ======== Operating System Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex46_graph/combiner/CombinerN.h b/src/examples/templates/ex46_graph/combiner/CombinerN.h
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== CombinerN.h ========
+ */
+
+#ifndef CombinerN__include
+#define CombinerN__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#define CombinerN_CMDQUE_FMT "Ctrl_Proc%d"
+#define CombinerN_LOAD_FMT "mpmcl load dsp%d combinerN_p.xe66"
+#define CombinerN_RESET_FMT "mpmcl reset dsp%d"
+#define CombinerN_RUN_FMT "mpmcl run dsp%d"
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/combiner/Ctrl.c b/src/examples/templates/ex46_graph/combiner/Ctrl.c
--- /dev/null
@@ -0,0 +1,551 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Ctrl__Desc
+#define MODULE_NAME "Ctrl"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/sysbios/BIOS.h>
+//#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/HeapBufMP.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/SharedRegion.h>
+#include <ti/ipc/ipcmgr/IpcMgr.h>
+
+/* example header files */
+#include "Ctrl.h"
+#include "Xfm.h"
+#include "../shared/Graph.h"
+#include "../shared/SysCfg.h"
+
+#define NAMESZ 48
+
+
+/* module structure */
+typedef struct {
+ Bool run; /* main loop run flag */
+ UInt16 srZeroProc; /* SR-Zero owner processor ID */
+ MessageQ_QueueId srZeroQue; /* SR-Zero owner control queue */
+ MessageQ_Handle queue; /* inbound messages */
+ HeapBufMP_Handle heap; /* control message pool */
+} Ctrl_Module;
+
+/* private functions */
+static void Ctrl_destroy(void);
+static void Ctrl_detachSRZero(void);
+static int Ctrl_exec(void);
+static int Ctrl_setup(void);
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+
+static Ctrl_Module Ctrl_mod = {
+ FALSE, /* run */
+ MultiProc_INVALIDID, /* srZeroProcId */
+ NULL, /* srZeroQue */
+ NULL, /* queue */
+ NULL /* heap */
+};
+
+
+/*
+ * ======== Ctrl_taskFxn ========
+ */
+Void Ctrl_taskFxn(UArg arg0, UArg arg1)
+{
+ int status = 0;
+
+ Log_print0(Diags_INFO, "Ctrl_taskFxn: -->");
+
+ /* setup phase */
+ status = Ctrl_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Ctrl_exec();
+
+leave:
+ /* shutdown phase */
+ Ctrl_destroy();
+
+ Log_print1(Diags_INFO, "Ctrl_threadFxn: <-- status=%d", (IArg)status);
+}
+
+/*
+ * ======== Ctrl_destroy ========
+ */
+static void Ctrl_destroy(void)
+{
+ int status = 0;
+
+ /* wait until the xfm module is finished using IPC */
+ while (!Xfm_ipcDone()) {
+ Task_sleep(100); /* 0.1 seconds */
+ }
+
+ /* if not SR-Zero owner, close its message queue */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ MessageQ_close(&Ctrl_mod.srZeroQue);
+ }
+
+ /* delete my own message queue */
+ MessageQ_delete(&Ctrl_mod.queue);
+
+ /* unregister the message heap */
+ MessageQ_unregisterHeap(SysCfg_CtrlMsg_HeapID);
+
+ /* if SR-Zero owner, delete the message heap */
+ if (MultiProc_self() == Ctrl_mod.srZeroProc) {
+ HeapBufMP_delete(&Ctrl_mod.heap);
+ }
+ else {
+ /* else, close the message heap */
+ HeapBufMP_close(&Ctrl_mod.heap);
+ }
+
+ /* If not SR-Zero owner, must detach now.
+ *
+ * We have already aranged for SR-Zero to be in the Ipc_detach
+ * loop (see Ctrl_detachSRZero). All IPC resources have now been
+ * release, so we finally enter the detach loop here.
+ */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ do {
+ status = Ipc_detach(Ctrl_mod.srZeroProc);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+ }
+
+ /* finalize IPC */
+ Ipc_stop();
+
+ /* disable log events */
+ Log_print1(Diags_INFO, "Ctrl_delete: <-- status=%d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+/*
+ * ======== Ctrl_detachSRZero ========
+ */
+static void Ctrl_detachSRZero(void)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ /* allocate a message queue message to contain the graph message */
+ mqMsg = MessageQ_alloc(SysCfg_CtrlMsg_HeapID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ Log_error0("message alloc failed");
+ goto leave;
+ }
+
+ /* identify the message type */
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+
+ /* fill in message payload */
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_DETACH;
+ msg->uarg1 = MultiProc_self();
+ msg->reply = FALSE;
+
+ /* send the message */
+ status = MessageQ_put(Ctrl_mod.srZeroQue, mqMsg);
+
+ if (status < 0) {
+ Log_error0("message send failed");
+ goto leave;
+ }
+
+ /* SR-Zero owner will now go into Ipc_detach loop. However, before
+ * this processor can detach, it must first release all IPC resources.
+ * This is done in Ctrl_destory.
+ */
+
+ Log_print1(Diags_INFO, "Ctrl_detachSRZero: IPC detached from proc=%d",
+ Ctrl_mod.srZeroProc);
+
+leave:
+ return;
+}
+
+/*
+ * ======== Ctrl_exec ========
+ */
+static int Ctrl_exec(void)
+{
+ int status = 0;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ Graph_Msg *msg;
+
+ Log_print0(Diags_INFO, "Ctrl_exec: -->");
+ Ctrl_mod.run = TRUE;
+
+ /* main loop */
+ while (Ctrl_mod.run) {
+
+ /* wait for inbound message */
+ Log_print0(Diags_INFO, "waiting for message");
+ status = MessageQ_get(Ctrl_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Ctrl_mod.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ Log_error1("Ctrl_exec: message get error=%d", status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (Graph_Msg *)mqMsg;
+ Log_print1(Diags_INFO, "message received, cmd=%d", msg->cmd);
+
+ switch (msg->cmd) {
+
+ case Graph_Cmd_ATTACH:
+ /* dsp attach to dsp */
+ do {
+ status = Ipc_attach(msg->uarg1);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+
+ if (status < 0) {
+ Log_error1("Ipc_attach failed, error=%d", status);
+ status = -1;
+ goto leave;
+ }
+
+ Log_print1(Diags_INFO, "IPC attached proc=%d", msg->uarg1);
+ break;
+
+ case Graph_Cmd_DETACH:
+ do {
+ status = Ipc_detach(msg->uarg1);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+
+ if (status < 0) {
+ Log_error1("Ipc_detach failed, error=%d", status);
+ status = -1;
+ goto leave;
+ }
+
+ Log_print1(Diags_INFO, "IPC detached proc=%d", msg->uarg1);
+ break;
+
+ case Graph_Cmd_FLUSH: {
+ int rval = Xfm_flush(msg->arg1, msg->arg2);
+ msg->status = (rval < 0 ? Graph_E_FAIL : Graph_S_SUCCESS);
+ break;
+ }
+
+ case Graph_Cmd_INPUTCONNECT: {
+ int rval;
+ Log_print2(Diags_INFO, "connect input from proc=%d qidx=%d",
+ msg->uarg1, msg->uarg2);
+ rval = Xfm_inputConnect(msg->uarg1, msg->uarg2);
+ msg->status = (rval < 0 ? Graph_E_FAIL : Graph_S_SUCCESS);
+ break;
+ }
+
+ case Graph_Cmd_INPUTDISCONNECT: {
+ int rval;
+ Log_print2(Diags_INFO, "disconnect output proc=%d qidx=%d",
+ msg->uarg1, msg->uarg2);
+ rval = Xfm_inputDisconnect(msg->uarg1, msg->uarg2);
+ msg->status = (rval < 0 ? Graph_E_FAIL : Graph_S_SUCCESS);
+ break;
+ }
+
+ case Graph_Cmd_OUTPUTCONNECT:
+ Log_print2(Diags_INFO, "connect output to proc=%d qidx=%d",
+ msg->uarg1, msg->uarg2);
+ Xfm_outputConnect(msg->uarg1, msg->uarg2);
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_OUTPUTDISCONNECT: {
+ int rval;
+ Log_print2(Diags_INFO, "disconnect output proc=%d qidx=%d",
+ msg->uarg1, msg->uarg2);
+ rval = Xfm_outputDisconnect(msg->uarg1, msg->uarg2);
+ msg->status = (rval < 0 ? Graph_E_FAIL : Graph_S_SUCCESS);
+ break;
+ }
+
+ case Graph_Cmd_SHUTDOWN:
+ Log_print0(Diags_INFO, "shutdown message received");
+ Xfm_shutdown();
+ Ctrl_mod.run = FALSE; /* stop the idle function */
+
+ /* if SR-Zero owner, give idle function a chance to unwind */
+ /* TODO - this should be a do-while loop */
+ if (MultiProc_self() == Ctrl_mod.srZeroProc) {
+ Task_sleep(1);
+ }
+ else {
+ /* send detach request to SR-Zero owner */
+ Ctrl_detachSRZero();
+ }
+ break;
+
+ default:
+ Log_error1("unknown command, cmd=%d", (IArg)msg->cmd);
+ break;
+ }
+
+ if (msg->reply) {
+ /* return the message to sender */
+ msg->reply = FALSE;
+ msg->ack = TRUE;
+ qid = MessageQ_getReplyQueue(mqMsg);
+
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ Log_error0("Ctrl_exec: message send failed");
+ status = -2;
+ goto leave;
+ }
+ }
+ else {
+ /* free message here */
+ MessageQ_free(mqMsg);
+ }
+
+ } /* while (run) */
+
+leave:
+ Log_print1(Diags_INFO, "Ctrl_exec: <-- %d", (IArg)status);
+ return (status);
+}
+
+/*
+ * ======== Ctrl_setup ========
+ */
+static int Ctrl_setup(void)
+{
+ Int status = 0;
+ Error_Block eb;
+ Char cbuf[NAMESZ];
+ Bool ready;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ SharedRegion_Entry entry;
+ HeapBufMP_Params heapParams;
+
+ Error_init(&eb);
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+F");
+ Log_print0(Diags_INFO, "Ctrl_setup: -->");
+
+ /* setup IPC */
+ Log_print0(Diags_INFO, "initializing IPC");
+
+ /* setup TransportRpmsg for host communication */
+ IpcMgr_ipcStartup();
+
+ /* setup IPC for dsp to dsp communication */
+ status = Ipc_start();
+
+ if (status < 0) {
+ Log_error0("Ipc_start failed");
+ goto leave;
+ }
+
+ /* get SR-Zero information */
+ SharedRegion_getEntry(0, &entry);
+ Ctrl_mod.srZeroProc = entry.ownerProcId;
+
+ /* if this processor is not owner, attach to SR-Zero owner */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ Log_print1(Diags_INFO, "attach to proc=%d", Ctrl_mod.srZeroProc);
+
+ do {
+ status = Ipc_attach(Ctrl_mod.srZeroProc);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+ }
+
+ System_snprintf(cbuf, sizeof(cbuf), SysCfg_CtrlHeapNameFmt,
+ Ctrl_mod.srZeroProc);
+
+ /* if SR-Zero owner, create the message heap (control messages) */
+ if (MultiProc_self() == Ctrl_mod.srZeroProc) {
+ HeapBufMP_Params_init(&heapParams);
+ heapParams.name = cbuf;
+ heapParams.regionId = 0;
+ heapParams.blockSize = Graph_HEAPBLOCKSIZE;
+ heapParams.numBlocks = SysCfg_CtrlHeapNumBlocks;
+
+ Ctrl_mod.heap = HeapBufMP_create(&heapParams);
+
+ if (Ctrl_mod.heap == NULL) {
+ Log_error0("heap create failed");
+ status = -3;
+ goto leave;
+ }
+ }
+ else {
+ /* else, open the message heap */
+ status = HeapBufMP_open(cbuf, &Ctrl_mod.heap);
+
+ if (status < 0) {
+ Log_error0("heap create failed");
+ status = -3;
+ goto leave;
+ }
+ }
+
+ /* register heap with MessageQ */
+ status = MessageQ_registerHeap(Ctrl_mod.heap, SysCfg_CtrlMsg_HeapID);
+
+ if (status < 0) {
+ Log_error0("heap already exists");
+ status = -4;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO, "IPC startup complete");
+
+ /* compute the message queue name */
+ System_snprintf(cbuf, sizeof(cbuf), Ctrl_QueNameFmt, MultiProc_self());
+
+ /* create message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Ctrl_mod.queue = MessageQ_create(cbuf, &msgqParams);
+
+ if (Ctrl_mod.queue == NULL) {
+ Log_error0("message queue create failed");
+ goto leave;
+ }
+
+ /* if not SR-Zero owner, open its message queue (control messages) */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ System_snprintf(cbuf, sizeof(cbuf), Ctrl_QueNameFmt,
+ Ctrl_mod.srZeroProc);
+
+ do {
+ status = MessageQ_open(cbuf, &Ctrl_mod.srZeroQue);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ Task_sleep(5);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("message queue open failed");
+ }
+ }
+
+ /* inform other modules that IPC is ready */
+ Xfm_ipcIsReady();
+
+ /* busy wait until other modules are ready */
+ do {
+ ready = TRUE;
+
+ if (!Xfm_isReady()) {
+ ready = FALSE;
+ }
+
+ /* check other modules here
+ *
+ * if (!<Mod>_isReady()) {
+ * ready = FALSE;
+ * }
+ */
+
+ if (!ready) {
+ Task_sleep(10);
+ }
+
+ } while (!ready);
+
+ Log_print0(Diags_INFO, "peer modules are ready");
+
+leave:
+ Log_print1(Diags_INFO, "Ctrl_setup: <-- %d", (IArg)status);
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/combiner/Ctrl.h b/src/examples/templates/ex46_graph/combiner/Ctrl.h
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.h ========
+ */
+
+#ifndef Ctrl__include
+#define Ctrl__include
+
+#include "CombinerN.h"
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define Ctrl_QueNameFmt CombinerN_CMDQUE_FMT
+
+Void Ctrl_taskFxn(UArg arg0, UArg arg1);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/combiner/MainDspN.c b/src/examples/templates/ex46_graph/combiner/MainDspN.c
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== MainDspN.c ========
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h> /* Program.global in cfg script */
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* example header files */
+#include "Ctrl.h"
+#include "Xfm.h"
+
+#define PRI_LOW 2
+#define PRI_MED 3
+#define PRI_HIGH 5
+
+Void MainDspN_startupFirst(Void);
+
+UInt8 MainDspN_configData[20] = {
+ 0x98, 0x07, 0xfc, 0x20, 0x3e,
+ 0xe7, 0x2e, 0x68, 0x57, 0xda,
+ 0x95, 0xec, 0xd6, 0x19, 0xfe,
+ 0xed, 0x55, 0xf0, 0x50, 0xe6
+};
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create the control task */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Ctrl";
+ taskParams.priority = PRI_HIGH;
+ taskParams.stackSize = 0x600;
+ Task_create(Ctrl_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create ipc task");
+ }
+
+ /* create the data task */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Xfm";
+ taskParams.priority = PRI_MED;
+ taskParams.stackSize = 0x1000;
+ Task_create(Xfm_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create compute task");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== MainDspN_startupFirst ========
+ */
+Void MainDspN_startupFirst(Void)
+{
+ Int status;
+ UInt16 baseId;
+ SharedRegion_Entry *sre;
+
+ /* Extract the cluster baseId from the config data array
+ *
+ * Before loading the program, the config data array was
+ * "patched" with the correct cluster baseId. Use that value
+ * now to set the cluster baseId in the MultiProc module.
+ */
+ baseId = *(UInt16 *)(MainDspN_configData + 2);
+
+ /* run-time configuration of the cluster baseId */
+ status = MultiProc_setBaseIdOfCluster(baseId);
+
+ if (status < 0) {
+ System_abort("MainDspN_startupFirst: failed to set baseId");
+ }
+
+ /* Internal IPC cluster configuration
+ *
+ * This function will perform run-time configuration of IPC
+ * internal data structures related to the cluster baseId.
+ */
+ status = Ipc_clusterConfig();
+
+ if (status < 0) {
+ System_abort("MainDspN_startupFirst: ipc cluster config failed");
+ }
+
+ /* Define the shared region owner
+ *
+ * Now that we have a valid cluster baseId, we can look up the
+ * procId by name and assign the shared region owner. This example
+ * uses only SR-Zero. Do this for each region you have configured.
+ */
+ sre = SharedRegion_getEntryPtr(0);
+ sre->ownerProcId = MultiProc_getId(Global_SR0_OWNER);
+ sre->isValid = TRUE;
+}
diff --git a/src/examples/templates/ex46_graph/combiner/Makefile b/src/examples/templates/ex46_graph/combiner/Makefile
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = MainDspN.c Ctrl.c Xfm.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66,$(srcs)))
+libs =
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug combinerN.x
+# $(MAKE) PROFILE=release combinerN.x
+
+combinerN.x: bin/$(PROFILE)/combinerN.xe66
+bin/$(PROFILE)/combinerN.xe66: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.oe66: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: CombinerN.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -Dxdc.platform.custom.check=false \
+ -t ti.targets.elf.C66 \
+ -c $(ti.targets.elf.C66) \
+ -p ti.platforms.evmTCI6638K2K:coreN \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" CombinerN.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/combinerN.xe66 $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/combinerN.xe66 $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+EXAMPLE = $(word 1,$(subst /dsp, dsp,$(CURDIR)))
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(EXAMPLE)
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(ti.targets.elf.C66)
+
+CC = $(CGTOOLS)/bin/cl6x -c
+LD = $(CGTOOLS)/bin/cl6x -z
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map --cinit_compression=off
+LDLIBS = -l $(CGTOOLS)/lib/rts6600_elf.lib
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex46_graph/combiner/Xfm.c b/src/examples/templates/ex46_graph/combiner/Xfm.c
--- /dev/null
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Xfm.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Xfm__Desc
+#define MODULE_NAME "Xfm"
+
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Registry.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/heaps/HeapBuf.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Queue.h>
+
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+
+/* local header files */
+#include "Xfm.h"
+#include "../shared/Data.h"
+#include "../shared/SysCfg.h"
+
+#define MESSAGE_POOLSZ 4 /* message pool size */
+#define PIPELINE_POOLSZ 2 /* message pipeline pool, min = 2 */
+#define DESC_POOLSZ 6
+
+typedef struct {
+ Queue_Elem link;
+ Data_Msg *msg;
+} Xfm_Desc;
+
+typedef struct {
+ MessageQ_QueueIndex queueIndex; /* reserved queue index */
+ MessageQ_Handle queue; /* data queue, inbound messages */
+ MessageQ_QueueId myQID; /* used to identify my messages */
+} Xfm_InputQue;
+
+typedef struct {
+ UInt16 procId; /* destination node processor ID */
+ UInt16 queueIndex; /* destination queue index */
+ Int transId; /* message transport ID */
+ MessageQ_QueueId queue; /* destination data queue */
+} Xfm_OutputNode;
+
+typedef struct {
+ MessageQ_QueueId qid;
+ UInt16 procId;
+ UInt16 queueIndex;
+ Queue_Handle que;
+ Queue_Struct queObj;
+} Xfm_InputNode;
+
+/* module structure */
+typedef struct {
+ Bool run; /* main loop run flag */
+ volatile Bool ipcReady; /* IPC ready flag */
+ Semaphore_Handle ipcSem; /* IPC synchronizing object */
+ Queue_Handle descriptors; /* available buffer descriptors */
+ Xfm_InputNode inputA;
+ Xfm_InputNode inputB;
+ Queue_Handle outputQue;
+ Ptr heapMem; /* heap memory from SR-Zero */
+ SizeT heapSize;
+ HeapBuf_Handle msgHeap; /* message pool */
+ Xfm_InputQue inputQue; /* input end-point */
+ Xfm_OutputNode output;
+ Semaphore_Struct ipcSemObj;
+ Queue_Struct descQueObj;
+ Queue_Struct outputQueObj;
+ Xfm_Desc descPool[DESC_POOLSZ];
+} Xfm_Module;
+
+/* private functions */
+static void Xfm_destroy(void);
+static int Xfm_exec(void);
+static int Xfm_setup(void);
+static void Xfm_transform(Data_Buffer *inputA, Data_Buffer *inputB,
+ Data_Buffer *output);
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+
+static Xfm_Module Xfm_mod = {
+ FALSE, /* run */
+ FALSE, /* ipcReady */
+ NULL, /* ipcSem */
+ NULL, /* descriptors */
+ { MultiProc_INVALIDID, /* inputA.procId */
+ MessageQ_INVALIDMESSAGEQ, /* inputA.queueIndex */
+ NULL }, /* inputA.que */
+ { MultiProc_INVALIDID, /* inputB.procId */
+ MessageQ_INVALIDMESSAGEQ, /* inputB.qid */
+ NULL }, /* inputB.que */
+ NULL, /* outputQue */
+ NULL, /* heapMem */
+ 0, /* heapSize */
+ NULL, /* msgHeap */
+ { SysCfg_DATA_RQUE, /* input.queueIndex */
+ NULL, /* input.queue */
+ MessageQ_INVALIDMESSAGEQ }, /* input.myQID */
+ { MultiProc_INVALIDID, /* output.procId */
+ MessageQ_INVALIDMESSAGEQ, /* output.queueIndex */
+ -1, /* output.transId */
+ MessageQ_INVALIDMESSAGEQ } /* output.queue */
+};
+
+
+/*
+ * ======== Xfm_taskFxn ========
+ */
+Void Xfm_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+ Log_print0(Diags_INFO, "Xfm_taskFxn: -->");
+
+ /* setup phase */
+ status = Xfm_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Xfm_exec();
+
+leave:
+ /* shutdown phase */
+ Xfm_destroy();
+
+ Log_print1(Diags_INFO, "Xfm_taskFxn: <-- %d", (IArg)status);
+}
+
+/*
+ * ======== Xfm_flush ========
+ * Return all pending input buffers for given input source
+ */
+int Xfm_flush(int procId, int queueIndex)
+{
+ int status = 0;
+ Xfm_InputNode *inputA = &Xfm_mod.inputA;
+ Xfm_InputNode *inputB = &Xfm_mod.inputB;
+ Xfm_InputNode *input;
+ Xfm_Desc *desc;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId replyQID;
+
+ /* find input connection */
+ if ((inputA->procId == procId) && (inputA->queueIndex == queueIndex)) {
+ input = inputA;
+ }
+ else if ((inputB->procId == procId) && (inputB->queueIndex == queueIndex)) {
+ input = inputB;
+ }
+ else {
+ Log_error2("Xfm_flush: cannot find given connection:"
+ "procId=%d, queueIndex=%d", procId, queueIndex);
+ status = -1;
+ goto leave;
+ }
+
+ /* return all pending input buffers */
+ while (!Queue_empty(input->que)) {
+ desc = (Xfm_Desc *)Queue_dequeue(input->que);
+ mqMsg = (MessageQ_Msg)desc->msg;
+ replyQID = MessageQ_getReplyQueue(mqMsg);
+ MessageQ_put(replyQID, mqMsg);
+
+ /* recycle the descriptor */
+ desc->msg = NULL;
+ Queue_enqueue(Xfm_mod.descriptors, &desc->link);
+ }
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== Xfm_inputConnect ========
+ */
+int Xfm_inputConnect(UInt16 procId, UInt16 queueIndex)
+{
+ int status = 0;
+
+ /* save connection information in first available slot */
+ if (Xfm_mod.inputA.procId == MultiProc_INVALIDID) {
+ Xfm_mod.inputA.procId = procId;
+ Xfm_mod.inputA.queueIndex = queueIndex;
+ }
+ else if (Xfm_mod.inputB.procId == MultiProc_INVALIDID) {
+ Xfm_mod.inputB.procId = procId;
+ Xfm_mod.inputB.queueIndex = queueIndex;
+ }
+ else {
+ Log_error0("Xfm_inputConnect: all input connections in use");
+ status = -1;
+ }
+
+ return (status);
+}
+
+/*
+ * ======== Xfm_inputDisconnect ========
+ */
+int Xfm_inputDisconnect(UInt16 procId, UInt16 queueIndex)
+{
+ int status = 0;
+ Xfm_InputNode *inputA = &Xfm_mod.inputA;
+ Xfm_InputNode *inputB = &Xfm_mod.inputB;
+
+ /* find input connection, reset connection information */
+ if ((inputA->procId == procId) && (inputA->queueIndex == queueIndex)) {
+ inputA->procId = MultiProc_INVALIDID;
+ inputA->queueIndex = MessageQ_INVALIDMESSAGEQ;
+ }
+ else if ((inputB->procId == procId) && (inputB->queueIndex == queueIndex)) {
+ inputB->procId = MultiProc_INVALIDID;
+ inputB->queueIndex = MessageQ_INVALIDMESSAGEQ;
+ }
+ else {
+ Log_error2("Xfm_inputDisconnect: cannot find given connection:"
+ "procId=%d, queueIndex=%d", procId, queueIndex);
+ status = -1;
+ }
+
+ return (status);
+}
+
+/*
+ * ======== Xfm_ipcDone ========
+ */
+int Xfm_ipcDone(void)
+{
+ return (Xfm_mod.ipcReady ? 0 : 1);
+}
+
+/*
+ * ======== Xfm_ipcIsReady ========
+ * Inform this module that IPC is ready
+ *
+ * This function is called from another execution context. Must
+ * be careful to ensure local resources have been created.
+ */
+void Xfm_ipcIsReady(void)
+{
+ Xfm_mod.ipcReady = TRUE;
+
+ /* semaphore might not yet exist, check create flag */
+ if (Xfm_mod.ipcSem != NULL) {
+ Semaphore_post(Xfm_mod.ipcSem);
+ }
+}
+
+/*
+ * ======== Xfm_isReady ========
+ */
+Bool Xfm_isReady(void)
+{
+ return (Xfm_mod.run);
+}
+
+/*
+ * ======== Xfm_outputConnect ========
+ */
+void Xfm_outputConnect(UInt16 procId, UInt16 queueIndex)
+{
+ /* save connection information */
+ Xfm_mod.output.procId = procId;
+ Xfm_mod.output.queueIndex = queueIndex;
+ Xfm_mod.output.transId = 0;
+
+ /* open the destination message queue (reserved ) */
+ Xfm_mod.output.queue = MessageQ_openQueueId(queueIndex, procId);
+}
+
+/*
+ * ======== Xfm_outputDisconnect ========
+ */
+int Xfm_outputDisconnect(UInt16 procId, UInt16 queueIndex)
+{
+ Xfm_OutputNode *output = &Xfm_mod.output;
+
+ /* if already disconnected, nothing left to do */
+ if (output->queue == MessageQ_INVALIDMESSAGEQ) {
+ return (0);
+ }
+
+ /* validate connection information */
+ if ((output->procId != procId) || (output->queueIndex != queueIndex)) {
+ return (-1);
+ }
+
+ /* close destination message queue */
+ MessageQ_close(&output->queue);
+
+ /* reset connection information */
+ output->procId = MultiProc_INVALIDID;
+ output->queueIndex = MessageQ_INVALIDMESSAGEQ;
+ output->transId = -1;
+ return (0);
+}
+
+/*
+ * ======== Xfm_shutdown ========
+ */
+void Xfm_shutdown(void)
+{
+ Xfm_mod.run = FALSE;
+ MessageQ_unblock(Xfm_mod.inputQue.queue);
+}
+
+/*
+ * ======== Xfm_destroy ========
+ */
+static void Xfm_destroy(void)
+{
+ int msgCount;
+ Xfm_Desc *desc;
+ MessageQ_Msg mqMsg;
+ IHeap_Handle heap;
+
+ Log_print0(Diags_INFO, "Xfm_destroy: -->");
+
+ /* close destination queue if needed */
+ if (Xfm_mod.output.queue != MessageQ_INVALIDMESSAGEQ) {
+ Xfm_outputDisconnect(Xfm_mod.output.procId, Xfm_mod.output.queueIndex);
+ }
+
+ /* reclaim data messages */
+ msgCount = 0;
+
+ /* look for data messages on output queue */
+ while (!Queue_empty(Xfm_mod.outputQue)) {
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.outputQue);
+ mqMsg = (MessageQ_Msg)desc->msg;
+ MessageQ_free(mqMsg);
+ msgCount++;
+ }
+
+ if (msgCount != PIPELINE_POOLSZ) {
+ Log_error1("Xfm_destroy: missing %d data messages",
+ PIPELINE_POOLSZ - msgCount);
+ }
+
+ /* delete the local message queue */
+ MessageQ_delete(&Xfm_mod.inputQue.queue);
+ Xfm_mod.inputQue.myQID = MessageQ_INVALIDMESSAGEQ;
+
+ /* finalize the message heap */
+ MessageQ_unregisterHeap(SysCfg_DataMsg_HeapID);
+ HeapBuf_delete(&Xfm_mod.msgHeap);
+
+ /* free heap memory back to SR-Zero heap */
+ heap = (IHeap_Handle)SharedRegion_getHeap(0);
+ Memory_free(heap, Xfm_mod.heapMem, Xfm_mod.heapSize);
+
+ /* done using IPC */
+ Xfm_mod.ipcReady = FALSE;
+
+ /* destruct the semaphore */
+ Xfm_mod.ipcSem = NULL;
+ Semaphore_destruct(&Xfm_mod.ipcSemObj);
+
+ /* disable log events */
+ Log_print0(Diags_INFO, "Xfm_delete: <--");
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+/*
+ * ======== Xfm_exec ========
+ */
+static int Xfm_exec(void)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId replyQID;
+ UInt16 replyProcId;
+ UInt16 replyQueueIndex;
+ Xfm_Desc *desc;
+ Data_Msg *dataMsg;
+ Data_Msg *inputADataMsg;
+ Data_Msg *inputBDataMsg;
+ Data_Msg *outputDataMsg;
+ Data_Buffer *inputBufA;
+ Data_Buffer *inputBufB;
+ Data_Buffer *outputBuf;
+ Bool inputAReady = FALSE;
+ Bool inputBReady = FALSE;
+ Bool outputReady = FALSE;
+
+ Log_print0(Diags_INFO, "Xfm_exec: -->");
+ Xfm_mod.run = TRUE;
+
+ /* main loop */
+ while (Xfm_mod.run) {
+
+ /* wait for inbound message, expect only Data_Msg type */
+ status = MessageQ_get(Xfm_mod.inputQue.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Xfm_mod.run = FALSE;
+ status = 0;
+ continue;
+ }
+ else if (status < 0) {
+ Log_error1("Xfm_exec: message get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* get next available descriptor */
+ if (Queue_empty(Xfm_mod.descriptors)) {
+ Log_error0("Xfm_exec: descriptor pool is empty");
+ status = -3;
+ goto leave;
+ }
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.descriptors);
+
+ /* bind descriptor to data message */
+ dataMsg = (Data_Msg *)mqMsg;
+ desc->msg = dataMsg;
+
+ /* determine message ownership */
+ replyQID = MessageQ_getReplyQueue(mqMsg);
+ replyProcId = MessageQ_getProcId(replyQID);
+ replyQueueIndex = MessageQ_getQueueIndex(replyQID);
+
+ /* if my buffer, put empty buffer onto output queue */
+ if (replyQID == Xfm_mod.inputQue.myQID) {
+ Queue_enqueue(Xfm_mod.outputQue, &desc->link);
+ outputReady = TRUE;
+ Log_print0(Diags_INFO, "received empty output buffer");
+ }
+ else if ((replyProcId == Xfm_mod.inputA.procId)
+ && (replyQueueIndex == Xfm_mod.inputA.queueIndex)) {
+
+ /* put new full buffer onto inputA queue */
+ Queue_enqueue(Xfm_mod.inputA.que, &desc->link);
+ inputAReady = TRUE;
+ Log_print1(Diags_INFO, "received buffer from proc=%d", replyProcId);
+ }
+ else if ((replyProcId == Xfm_mod.inputB.procId)
+ && (replyQueueIndex == Xfm_mod.inputB.queueIndex)) {
+
+ /* put new full buffer onto inputB queue */
+ Queue_enqueue(Xfm_mod.inputB.que, &desc->link);
+ inputBReady = TRUE;
+ Log_print1(Diags_INFO, "received buffer from proc=%d", replyProcId);
+ }
+ else {
+ /* recycle the descriptor */
+ desc->msg = NULL;
+ Queue_enqueue(Xfm_mod.descriptors, &desc->link);
+
+ /* return buffer to sender */
+ MessageQ_put(replyQID, mqMsg);
+
+ /* log error, restart the loop */
+ Log_error0("Xfm_exec: received buffer from unknown source");
+ continue;
+ }
+
+ /* if input and output buffers are available, transform the data */
+ if (inputAReady && inputBReady && outputReady) {
+
+ /* remove next buffer from inputA queue */
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.inputA.que);
+ inputAReady = (Queue_empty(Xfm_mod.inputA.que) ? FALSE : TRUE);
+ inputADataMsg = desc->msg;
+ inputBufA = &inputADataMsg->data;
+
+ /* recycle the descriptor */
+ desc->msg = NULL;
+ Queue_enqueue(Xfm_mod.descriptors, &desc->link);
+
+ /* remove next buffer from inputB queue */
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.inputB.que);
+ inputBReady = (Queue_empty(Xfm_mod.inputB.que) ? FALSE : TRUE);
+ inputBDataMsg = desc->msg;
+ inputBufB = &inputBDataMsg->data;
+
+ /* recycle the descriptor */
+ desc->msg = NULL;
+ Queue_enqueue(Xfm_mod.descriptors, &desc->link);
+
+ /* remove next buffer from output queue */
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.outputQue);
+ outputReady = (Queue_empty(Xfm_mod.outputQue) ? FALSE : TRUE);
+ outputDataMsg = desc->msg;
+ outputBuf = &outputDataMsg->data;
+
+ /* recycle the descriptor */
+ desc->msg = NULL;
+ Queue_enqueue(Xfm_mod.descriptors, &desc->link);
+
+ /* transform input data to output buffer */
+ Log_print0(Diags_INFO, "process data");
+ Xfm_transform(inputBufA, inputBufB, outputBuf);
+
+ mqMsg = (MessageQ_Msg)outputDataMsg;
+
+ /* send the output buffer to the downsteam node */
+ if (Xfm_mod.output.queue != MessageQ_INVALIDMESSAGEQ) {
+ MessageQ_setTransportId(mqMsg, Xfm_mod.output.transId);
+ MessageQ_put(Xfm_mod.output.queue, mqMsg);
+ }
+ else {
+ /* output not connected, recycle output buffer */
+ MessageQ_put(Xfm_mod.inputQue.myQID, mqMsg);
+ }
+
+ /* return input buffers to the upstream nodes */
+ mqMsg = (MessageQ_Msg)inputADataMsg;
+ replyQID = MessageQ_getReplyQueue(mqMsg);
+ MessageQ_put(replyQID, mqMsg);
+ mqMsg = (MessageQ_Msg)inputBDataMsg;
+ replyQID = MessageQ_getReplyQueue(mqMsg);
+ MessageQ_put(replyQID, mqMsg);
+ }
+ }
+
+leave:
+ Log_print1(Diags_INFO, "Xfm_exec: <-- %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Xfm_setup ========
+ */
+static int Xfm_setup(void)
+{
+ int status = 0;
+ int i;
+ Error_Block eb;
+ Semaphore_Params semParams;
+ Registry_Result result;
+ IHeap_Handle heap;
+ SizeT align;
+ SizeT blockSize;
+ HeapBuf_Params heapParams;
+ MessageQ_Params msgqParams;
+ MessageQ_Msg mqMsg;
+
+ Error_init(&eb);
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+F");
+ Log_print0(Diags_INFO, "Xfm_setup: -->");
+
+ /* put descriptors onto the available list */
+ Queue_construct(&Xfm_mod.descQueObj, NULL);
+ Xfm_mod.descriptors = Queue_handle(&Xfm_mod.descQueObj);
+
+ for (i = 0; i < DESC_POOLSZ; i++) {
+ Queue_enqueue(Xfm_mod.descriptors, &(Xfm_mod.descPool[i].link));
+ }
+
+ /* construct the input and output holding queues */
+ Queue_construct(&Xfm_mod.inputA.queObj, NULL);
+ Xfm_mod.inputA.que = Queue_handle(&Xfm_mod.inputA.queObj);
+ Queue_construct(&Xfm_mod.inputB.queObj, NULL);
+ Xfm_mod.inputB.que = Queue_handle(&Xfm_mod.inputB.queObj);
+ Queue_construct(&Xfm_mod.outputQueObj, NULL);
+ Xfm_mod.outputQue = Queue_handle(&Xfm_mod.outputQueObj);
+
+ /* construct the semaphore */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_BINARY;
+
+ Semaphore_construct(&Xfm_mod.ipcSemObj, 0, &semParams);
+
+ if (Error_check(&eb)) {
+ status = -1;
+ goto leave;
+ }
+ Xfm_mod.ipcSem = Semaphore_handle(&Xfm_mod.ipcSemObj);
+
+ /* wait here until IPC is ready */
+ if (!Xfm_mod.ipcReady) {
+ Semaphore_pend(Xfm_mod.ipcSem, BIOS_WAIT_FOREVER);
+ }
+ Log_print0(Diags_INFO, "Xfm_setup: IPC ready");
+
+ /* acquire heap memory from SR-Zero, pad the block size to alignment */
+ heap = (IHeap_Handle)SharedRegion_getHeap(0);
+ align = Memory_getMaxDefaultTypeAlign();
+ blockSize = (sizeof(Data_Msg) + (align-1)) & ~(align-1);
+ Xfm_mod.heapSize = MESSAGE_POOLSZ * blockSize;
+
+ Xfm_mod.heapMem = Memory_alloc(heap, Xfm_mod.heapSize, align, &eb);
+
+ if (Error_check(&eb)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* create a heap for data message pool */
+ HeapBuf_Params_init(&heapParams);
+ heapParams.align = align;
+ heapParams.blockSize = blockSize;
+ heapParams.numBlocks = MESSAGE_POOLSZ;
+ heapParams.buf = Xfm_mod.heapMem;
+ heapParams.bufSize = Xfm_mod.heapSize;
+
+ Xfm_mod.msgHeap = HeapBuf_create(&heapParams, &eb);
+
+ if (Error_check(&eb)) {
+ Log_error0("Xfm_setup: heap create failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* register heap with MessageQ */
+ status = MessageQ_registerHeap(Xfm_mod.msgHeap, SysCfg_DataMsg_HeapID);
+
+ if (status < 0) {
+ Log_error0("Xfm_setup: heap already exists");
+ status = -1;
+ goto leave;
+ }
+
+ /* create reserved message queue (data queue) */
+ MessageQ_Params_init(&msgqParams);
+ msgqParams.queueIndex = Xfm_mod.inputQue.queueIndex;
+
+ Xfm_mod.inputQue.queue = MessageQ_create(NULL, &msgqParams);
+
+ if (Xfm_mod.inputQue.queue == NULL) {
+ status = -1;
+ Log_error0("Xfm_setup: message queue create failed");
+ goto leave;
+ }
+
+ Xfm_mod.inputQue.myQID = MessageQ_getQueueId(Xfm_mod.inputQue.queue);
+
+ /* allocate output buffers to prime the pipeline */
+ for (i = 1; i <= PIPELINE_POOLSZ; i++) {
+ mqMsg = MessageQ_alloc(SysCfg_DataMsg_HeapID, sizeof(Data_Msg));
+
+ if (mqMsg == NULL) {
+ Log_error0("Xfm_setup: message alloc failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* put message onto my own input queue */
+ MessageQ_setMsgId(mqMsg, Data_MSGID);
+ MessageQ_setReplyQueue(Xfm_mod.inputQue.queue, mqMsg);
+ MessageQ_put(Xfm_mod.inputQue.myQID, mqMsg);
+ }
+
+leave:
+ Log_print1(Diags_INFO, "Xfm_setup: <-- status=%d", status);
+ return (status);
+}
+
+/*
+ * ======== Xfm_transform ========
+ */
+static void Xfm_transform(Data_Buffer *inputA, Data_Buffer *inputB,
+ Data_Buffer *output)
+{
+ int i;
+ int count;
+ UInt *inDatumA, *inDatumB, *outDatum;
+
+ count = inputA->count; /* all buffers are the same size */
+ inDatumA = inputA->buffer;
+ inDatumB = inputB->buffer;
+ outDatum = output->buffer;
+
+ for (i = 0; i < count; i++) {
+ *outDatum++ = *inDatumA++ | *inDatumB++;
+ }
+
+ output->count = count;
+}
diff --git a/src/examples/templates/ex46_graph/combiner/Xfm.h b/src/examples/templates/ex46_graph/combiner/Xfm.h
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Xfm.h ========
+ */
+
+#ifndef Xfm__include
+#define Xfm__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Xfm_taskFxn(UArg arg0, UArg arg1);
+
+int Xfm_flush(int procId, int queueIndex);
+int Xfm_inputConnect(UInt16 procId, UInt16 queueIndex);
+int Xfm_inputDisconnect(UInt16 procId, UInt16 queueIndex);
+int Xfm_ipcDone(void);
+void Xfm_ipcIsReady(void);
+Bool Xfm_isReady(void);
+void Xfm_outputConnect(UInt16 procId, UInt16 queueIndex);
+int Xfm_outputDisconnect(UInt16 procId, UInt16 queueIndex);
+void Xfm_shutdown(void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/consumer/Consumer.h b/src/examples/templates/ex46_graph/consumer/Consumer.h
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Consumer.h ========
+ */
+
+#ifndef Consumer__include
+#define Consumer__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#define Consumer_CMDQUE_FMT "ConsumerCmdQue%c"
+#define Consumer_LAUNCH_FMT "./consumer %c %d"
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/consumer/Ctrl.c b/src/examples/templates/ex46_graph/consumer/Ctrl.c
--- /dev/null
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.c ========
+ */
+
+/* Standard headers */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+/* example header files */
+#include <ex45_host/transport/hlos/TransportPMQ.h>
+#include "Consumer.h"
+#include "Ctrl.h"
+#include "Sink.h"
+#include "../shared/Graph.h"
+#include "../shared/SysCfg.h"
+
+#define BUFSZ 64
+
+/* module structure */
+typedef struct {
+ Char node; /* node name */
+ Bool run; /* main loop run flag */
+ MessageQ_Handle queue; /* inbound messages */
+} Ctrl_Module;
+
+/* private functions */
+void Ctrl_destroy(void);
+int Ctrl_exec(void);
+int Ctrl_setup(Ctrl_Arg *arg);
+
+/* private data */
+static Ctrl_Module Ctrl_mod = {
+ .node = '-',
+ .run = FALSE,
+ .queue = NULL
+};
+
+
+/*
+ * ======== Ctrl_threadFxn ========
+ */
+void *Ctrl_threadFxn(void *param)
+{
+ int status = 0;
+ Ctrl_Arg *arg = (Ctrl_Arg *)param;
+
+ /* setup phase */
+ status = Ctrl_setup(arg);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Ctrl_exec();
+
+leave:
+ /* shutdown phase */
+ Ctrl_destroy();
+
+ return ((void *)status);
+}
+
+/*
+ * ======== Ctrl_destroy ========
+ */
+void Ctrl_destroy(void)
+{
+
+ /* wait until the pump module is finished using IPC */
+ while (!Sink_ipcDone()) {
+ usleep(100000); /* 0.1 seconds */
+ }
+
+ /* delete the message queue */
+ MessageQ_delete(&Ctrl_mod.queue);
+
+ /* finalize the secondary transport */
+ MessageQ_unregisterTransportId(SysCfg_TRANSPORT_PMQ_ID);
+ TransportPMQ_destroy();
+
+ /* finalize IPC */
+ Ipc_stop();
+}
+
+/*
+ * ======== Ctrl_exec ========
+ */
+int Ctrl_exec(void)
+{
+ Int status;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ Graph_Msg *msg;
+
+ Ctrl_mod.run = TRUE;
+
+ /* main loop */
+ while (Ctrl_mod.run) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Ctrl_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Ctrl_mod.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ fprintf(stderr, "Error: Ctrl_exec: message receive failed, "
+ "error=%d\n", status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (Graph_Msg *)mqMsg;
+
+ switch (msg->cmd) {
+
+ case Graph_Cmd_ATTACH:
+ /* host attach to dsp */
+ status = Ipc_attach(msg->uarg1);
+ if (status < 0) {
+ fprintf(stderr, "Error: Ipc_attach(%d) failed\n",
+ msg->uarg1);
+ }
+ break;
+
+ case Graph_Cmd_DETACH:
+ /* host detach from dsp */
+ status = Ipc_detach(msg->uarg1);
+ if (status < 0) {
+ fprintf(stderr, "Error: Ipc_detach(%d) failed\n",
+ msg->uarg1);
+ }
+ break;
+
+ case Graph_Cmd_FLUSH:
+ msg->status = Graph_S_SUCCESS; /* nothing to do */
+ break;
+
+ case Graph_Cmd_INPUTCONNECT:
+ msg->status = Graph_S_SUCCESS; /* nothing to do */
+ break;
+
+ case Graph_Cmd_INPUTDISCONNECT:
+ msg->status = Graph_S_SUCCESS; /* nothing to do */
+ break;
+
+ case Graph_Cmd_OUTPUTCONNECT:
+ msg->status = Graph_E_FAIL;
+ break;
+
+ case Graph_Cmd_OUTPUTDISCONNECT:
+ msg->status = Graph_E_FAIL;
+ break;
+
+ case Graph_Cmd_SHUTDOWN:
+ Sink_shutdown();
+ Ctrl_mod.run = FALSE;
+ break;
+
+ default:
+ fprintf(stderr, "Error: Ctrl_exec: unknown command, cmd=%d\n",
+ msg->cmd);
+ break;
+ }
+
+ if (msg->reply) {
+ /* return the message to sender */
+ msg->reply = FALSE;
+ msg->ack = TRUE;
+ qid = MessageQ_getReplyQueue(mqMsg);
+
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ status = -2;
+ goto leave;
+ }
+ }
+ else {
+ /* free message here */
+ MessageQ_free(mqMsg);
+ }
+ }
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== Ctrl_setup ========
+ */
+int Ctrl_setup(Ctrl_Arg *arg)
+{
+ Int status = 0;
+ TransportPMQ_Handle transPMQ;
+ ITransport_Handle transport;
+ INetworkTransport_Handle transNetwork;
+ char qname[BUFSZ];
+ MessageQ_Params msgqParams;
+
+ /* initialize module state */
+ Ctrl_mod.node = arg->n;
+ Ctrl_mod.run = FALSE;
+ Ctrl_mod.queue = NULL;
+
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+ /* initialize IPC */
+ status = Ipc_start();
+
+ if (status < 0) {
+ fprintf(stderr, "Error: IPC init failed, error=%d\n", status);
+ goto leave;
+ }
+
+ /* setup the TransportPMQ module */
+ status = TransportPMQ_setup();
+
+ if (status < 0) {
+ status = -1;
+ fprintf(stderr, "Error: TransportPMQ setup failed\n");
+ goto leave;
+ }
+ transPMQ = TransportPMQ_handle();
+
+ /* register transport with MessageQ */
+ transNetwork = TransportPMQ_upCast(transPMQ);
+ transport = INetworkTransport_upCast(transNetwork);
+ MessageQ_registerTransportId(SysCfg_TRANSPORT_PMQ_ID, transport);
+
+ /* inform data module that IPC is ready */
+ Sink_ipcIsReady();
+
+ /* create message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ snprintf(qname, BUFSZ, Consumer_CMDQUE_FMT, Ctrl_mod.node);
+
+ Ctrl_mod.queue = MessageQ_create(qname, &msgqParams);
+
+ if (Ctrl_mod.queue == NULL) {
+ status = -2;
+ fprintf(stderr, "Error: message queue create failed\n");
+ goto leave;
+ }
+
+leave:
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/consumer/Ctrl.h b/src/examples/templates/ex46_graph/consumer/Ctrl.h
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.h ========
+ */
+
+#ifndef Ctrl__include
+#define Ctrl__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct {
+ char n; /* node name */
+} Ctrl_Arg;
+
+void *Ctrl_threadFxn(void *arg);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/consumer/Makefile b/src/examples/templates/ex46_graph/consumer/Makefile
--- /dev/null
@@ -0,0 +1,139 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+%%}
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+EXDIR = ../..
+
+.PHONY: consumer
+srcs = Ctrl.c Sink.c main.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+transport = $(EXDIR)/ex45_host/transport/hlos/lib/$(PROFILE)/transport_pmq.av7A
+libs = -L$(DESTDIR)/lib -ltitransportrpmsg -ltiipc -ltiipcutils
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug consumer
+# $(MAKE) PROFILE=release consumer
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/consumer $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/consumer $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+consumer: bin/$(PROFILE)/consumer
+bin/$(PROFILE)/consumer: $(objs) $(transport)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I$(DESTDIR)/include -I$(EXDIR)
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex46_graph/consumer/Sink.c b/src/examples/templates/ex46_graph/consumer/Sink.c
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Sink.c ========
+ */
+
+/* Standard headers */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/eventfd.h> /* eventfd */
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+/* example header files */
+#include "Sink.h"
+#include "Consumer.h"
+#include "../shared/Data.h"
+
+#define BUFSZ 64
+
+/* module structure */
+typedef struct {
+ Char node; /* node name */
+ Bool run; /* main loop run flag */
+ Bool okayToSignal; /* indicates eventfd is created */
+ Bool ipcReady; /* IPC ready flag */
+ int waitEvent;
+ MessageQ_QueueIndex queIndex; /* reserved queue index */
+ MessageQ_Handle queue; /* data queue, inbound messages */
+} Sink_Module;
+
+/* private functions */
+void Sink_destroy(void);
+int Sink_exec(void);
+int Sink_setup(Sink_Arg *arg);
+
+static void Sink_process(Data_Buffer *dataBuf);
+
+/* private data */
+static Sink_Module Sink_mod = {
+ .node = '-',
+ .run = FALSE,
+ .okayToSignal = FALSE,
+ .ipcReady = FALSE,
+ .waitEvent = -1,
+ .queIndex = MessageQ_INVALIDMESSAGEQ,
+ .queue = NULL
+};
+
+/*
+ * ======== Sink_threadFxn ========
+ */
+void *Sink_threadFxn(void *param)
+{
+ int status = 0;
+ Sink_Arg *arg = (Sink_Arg *)param;
+
+ /* setup phase */
+ status = Sink_setup(arg);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Sink_exec();
+
+leave:
+ /* shutdown phase */
+ Sink_destroy();
+
+ return ((void *)status);
+}
+
+/*
+ * ======== Sink_ipcDone ========
+ */
+int Sink_ipcDone(void)
+{
+ return (Sink_mod.ipcReady ? 0 : 1);
+}
+
+/*
+ * ======== Sink_ipcIsReady ========
+ * Inform this task that IPC is ready
+ *
+ * This function is called from another execution context. Must
+ * be careful to ensure local resources have been created.
+ */
+void Sink_ipcIsReady(void)
+{
+ uint64_t value = 1;
+
+ Sink_mod.ipcReady = TRUE;
+
+ /* event might not yet exist, must check if okay to signal */
+ if (Sink_mod.okayToSignal) {
+ write(Sink_mod.waitEvent, &value, sizeof(value));
+ }
+}
+
+/*
+ * ======== Sink_shutdown ========
+ */
+void Sink_shutdown(void)
+{
+ Sink_mod.run = FALSE;
+ MessageQ_unblock(Sink_mod.queue);
+}
+
+/*
+ * ======== Sink_destroy ========
+ */
+void Sink_destroy(void)
+{
+
+ /* delete the message queue */
+ MessageQ_delete(&Sink_mod.queue);
+
+ /* done using IPC */
+ Sink_mod.ipcReady = FALSE;
+
+ /* close wait event */
+ Sink_mod.okayToSignal = FALSE;
+ close(Sink_mod.waitEvent);
+}
+
+/*
+ * ======== Sink_exec ========
+ */
+int Sink_exec(void)
+{
+ Int status;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ Data_Buffer *dataBuf;
+
+ Sink_mod.run = TRUE;
+
+ /* main loop */
+ while (Sink_mod.run) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Sink_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Sink_mod.run = FALSE;
+ status = 0;
+ continue;
+ }
+ else if (status < 0) {
+ fprintf(stderr, "Error: Sink_exec: message receive failed, "
+ "error=%d\n", status);
+ goto leave;
+ }
+
+ /* process the message */
+ dataBuf = &((Data_Msg *)mqMsg)->data;
+ Sink_process(dataBuf);
+
+ /* return the message to sender */
+ qid = MessageQ_getReplyQueue(mqMsg);
+
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ status = -2;
+ goto leave;
+ }
+ }
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== Sink_setup ========
+ */
+int Sink_setup(Sink_Arg *arg)
+{
+ Int status = 0;
+ uint64_t value;
+ MessageQ_Params msgqParams;
+
+ /* initialize module state */
+ Sink_mod.node = arg->node;
+ Sink_mod.queIndex = arg->queIdx;
+
+ /* create event object */
+ Sink_mod.waitEvent = eventfd(0, 0);
+
+ if (Sink_mod.waitEvent == -1) {
+ perror("Sink_setup: create eventfd failed");
+ status = -1;
+ goto leave;
+ }
+
+ Sink_mod.okayToSignal = TRUE;
+
+ /* wait here until IPC is ready */
+ if (!Sink_mod.ipcReady) {
+ read(Sink_mod.waitEvent, &value, sizeof(value));
+ }
+
+ /* create reserved message queue (data queue) */
+ MessageQ_Params_init(&msgqParams);
+ msgqParams.queueIndex = Sink_mod.queIndex;
+
+ Sink_mod.queue = MessageQ_create(NULL, &msgqParams);
+
+ if (Sink_mod.queue == NULL) {
+ status = -2;
+ fprintf(stderr, "Error: message queue create failed\n");
+ goto leave;
+ }
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== Sink_process ========
+ */
+static void Sink_process(Data_Buffer *dataBuf)
+{
+ Int count;
+ UInt *buffer;
+ int i;
+
+ count = dataBuf->count;
+ buffer = dataBuf->buffer;
+
+ for (i = 0; i < count; i++) {
+ buffer[i] = buffer[i] | 1;
+ }
+}
diff --git a/src/examples/templates/ex46_graph/consumer/Sink.h b/src/examples/templates/ex46_graph/consumer/Sink.h
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Sink.h ========
+ */
+
+#ifndef Sink__include
+#define Sink__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct {
+ char node; /* node name */
+ int queIdx; /* reserved queue index */
+} Sink_Arg;
+
+void *Sink_threadFxn(void *arg);
+
+int Sink_ipcDone(void);
+void Sink_ipcIsReady(void);
+void Sink_shutdown(void);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/consumer/main.c b/src/examples/templates/ex46_graph/consumer/main.c
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== main.c ========
+ */
+
+/* standard headers */
+#include <pthread.h> /* pthread_create, pthread_join */
+#include <stdio.h> /* printf */
+#include <stdlib.h> /* exit, atoi */
+
+/* package header files */
+#include <ti/ipc/Std.h>
+
+/* example header files */
+#include "Ctrl.h"
+#include "Sink.h"
+
+#define Main_USAGE "\
+Usage:\n\
+ consumer n r\n\
+ consumer -h\n\
+\n\
+Arguments:\n\
+ n : single character node name [A-Z]\n\
+ r : reserved message queue number\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+\n"
+
+/* private functions */
+int parse_args(int argc, char *argv[]);
+
+/* private data */
+static char main_n_arg = ' '; /* node name */
+static int main_r_arg = -1; /* reserved queue index */
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ int status = 0;
+ pthread_t ctrlThr; /* control thread */
+ Ctrl_Arg ctrlArg;
+ int ctrlStatus = 0;
+ pthread_t sinkThr; /* sink thread */
+ Sink_Arg sinkArg;
+ int sinkStatus = 0;
+
+ /* parse command line */
+ status = parse_args(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* start the control thread */
+ ctrlArg.n = main_n_arg;
+ status = pthread_create(&ctrlThr, NULL, Ctrl_threadFxn, &ctrlArg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: control thread failed\n");
+ goto leave;
+ }
+
+ /* start the sink thread */
+ sinkArg.node = main_n_arg;
+ sinkArg.queIdx = main_r_arg;
+ status = pthread_create(&sinkThr, NULL, Sink_threadFxn, &sinkArg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: sink thread failed\n");
+ goto leave;
+ }
+
+ /* wait for sink thread to exit */
+ pthread_join(sinkThr, (void **)(&sinkStatus));
+
+ /* wait for control thread to exit */
+ pthread_join(ctrlThr, (void **)(&ctrlStatus));
+
+ status = ((ctrlStatus < 0) || (sinkStatus < 0)) ? -1 : 0;
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== parse_args ========
+ */
+int parse_args(int argc, char *argv[])
+{
+ int x, cp, opt, argNum;
+ int status = 0;
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ fprintf(stderr, "%s", Main_USAGE);
+ exit(0);
+ break;
+
+ default:
+ fprintf(stderr, "Error: invalid option, %c\n", (char)x);
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ for (argNum = 1; opt < argc; argNum++, opt++) {
+
+ switch (argNum) {
+ case 1:
+ main_n_arg = argv[opt][0];
+ break;
+
+ case 2:
+ main_r_arg = atoi(argv[opt]);
+ break;
+
+ default:
+ fprintf(stderr, "Error: too many arguments\n");
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ if (main_n_arg == ' ') {
+ fprintf(stderr, "Error: missing node argument\n");
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+ if (main_r_arg == -1) {
+ fprintf(stderr, "Error: missing queue index argument\n");
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/manager/ClusterMgr.c b/src/examples/templates/ex46_graph/manager/ClusterMgr.c
--- /dev/null
@@ -0,0 +1,2226 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ClusterMgr.c ========
+ */
+
+/* Standard headers */
+#include <assert.h> /* assert */
+#include <dirent.h> /* opendir */
+#include <errno.h> /* errno, sys_errlist[] */
+#include <stdio.h> /* fprintf, sprintf */
+#include <stdlib.h> /* system, malloc, free, atoi */
+#include <string.h> /* strcpy, strdup, strtok */
+#include <unistd.h> /* usleep, fork */
+#include <sys/queue.h> /* LIST macros */
+#include <sys/types.h> /* opendir, wait, WEXITSTATUS */
+#include <sys/wait.h> /* wait, WEXITSTATUS */
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+/* example header files */
+#include "../combiner/CombinerN.h"
+#include "../consumer/Consumer.h"
+#include "../transformer/TransformerN.h"
+#include "../producer/Producer.h"
+#include "../shared/ClusterMgr_shared.h"
+#include "../shared/Graph.h"
+#include "../shared/SysCfg.h"
+#include "ClusterMgr.h"
+#include "Cmd.h"
+
+#define HEAPID 0
+#define DSPCOUNT 8 /* Keystone 2 Hawking has 8 DSPs */
+#define BUFSZ 64
+
+#define PRODUCER_QUEUES 0x0E /* reserved queues: 1, 2, 3 */
+#define CONSUMER_QUEUES 0x70 /* reserved queues: 4, 5, 6 */
+#define NUM_RESERVED_QUEUES 8 /* number of reserved queues */
+
+#define SR_ZERO_OWNER "CORE0"
+#define MAXARGS 15
+
+/* program type */
+typedef enum {
+ ClusterMgr_COMBINER,
+ ClusterMgr_CONSUMER,
+ ClusterMgr_PRODUCER,
+ ClusterMgr_TRANSFORMER,
+ ClusterMgr_UNKNOWN
+} ProgType;
+
+/* program context */
+typedef struct ProgCtx {
+ Char node; /* node name */
+ Char dstNode; /* destination node */
+ ProgType type; /* program type */
+ pid_t pid; /* pid if Linux program */
+ MessageQ_QueueId cmdQue; /* command message queue */
+ MessageQ_QueueIndex dataQueIdx; /* data queue index */
+ UInt8 transId; /* transport ID, manager to node */
+ UInt16 procId; /* processor ID */
+ Bool attached; /* ipc attach state */
+ Bool dataOn; /* data flow state (producer only) */
+ LIST_ENTRY(ProgCtx) link; /* list link */
+} ProgCtx;
+
+LIST_HEAD(ListHead, ProgCtx);
+LIST_HEAD(DclHead, Cmd_Command);
+
+/* module structure */
+typedef struct {
+ Char naNode; /* next available node */
+ Bool run; /* main loop run flag */
+ UInt8 prodQueMask; /* producer available queues */
+ UInt8 consQueMask; /* consumer available queues */
+ MessageQ_Handle queue; /* inbound messages */
+ struct ListHead consumer; /* list of consumer programs */
+ struct ListHead producer; /* list of producer programs */
+ ProgCtx *dsp[DSPCOUNT]; /* dsp context array */
+ int dfrCmdReady; /* deferred command ready count */
+ struct DclHead dfrCmdList; /* deferred command list */
+} ClusterMgr_Module;
+
+/* private functions */
+static Cmd_Command *ClusterMgr_completeCommand(Cmd_Command *cmd);
+static void ClusterMgr_destroy(void);
+static int ClusterMgr_exec(void);
+static Cmd_Command *ClusterMgr_processCommand(Cmd_Command *cmd);
+static int ClusterMgr_processGraph(Graph_Msg *msg);
+static int ClusterMgr_setup(void);
+static pid_t ClusterMgr_system(char *cmd, bool wait);
+
+//static int Prog_dataState(ProgCtx *prog);
+static ProgCtx *Prog_findNode(struct ListHead *head, Char node);
+static ProgCtx *Prog_findAllNode(Char node);
+static ProgCtx *Prog_findDspNode(Char node);
+
+static Cmd_Command *Prog_findCmd(struct DclHead *head, UInt dcid);
+static Cmd_Command *Prog_getReadyCmd(struct DclHead *head);
+
+static Void List_insert_alpha(struct ListHead *list, ProgCtx *item);
+
+/* command functions */
+static Cmd_Command *doConnectCmd(Cmd_Command *cmd);
+static Cmd_Command *doDisconnectCmd(Cmd_Command *cmd);
+static Cmd_Command *doInfoCmd(Cmd_Command *cmd);
+static Cmd_Command *doLaunchCmd(Cmd_Command *cmd);
+static Cmd_Command *doPauseCmd(Cmd_Command *cmd);
+static Cmd_Command *doRunCmd(Cmd_Command *cmd);
+static Cmd_Command *doShutdownCmd(Cmd_Command *cmd);
+static Cmd_Command *doStatusCmd(Cmd_Command *cmd);
+
+static Cmd_Command *completeConnectCmd(Cmd_Command *cmd);
+static Cmd_Command *completeDisconnectCmd(Cmd_Command *cmd);
+static Cmd_Command *completePauseCmd(Cmd_Command *cmd);
+static Cmd_Command *completeShutdownCmd(Cmd_Command *cmd);
+static Cmd_Command *completeStatusCmd(Cmd_Command *cmd);
+
+static void sendAttachCmd(ProgCtx *prog, UInt16 procId, UInt dcid);
+static void sendConnectCmd(ProgCtx *progSource, ProgCtx *progSink);
+static void sendDetachCmd(ProgCtx *prog, UInt16 procId, UInt dcid);
+static void sendDisconnectCmd(ProgCtx *progSrc, ProgCtx *progSink, UInt dcid);
+
+/* log helpers */
+extern FILE *cmlog;
+#define LOG fprintf(cmlog,
+#define LOGF ); fflush(cmlog);
+
+/* private data */
+static ClusterMgr_Module ClusterMgr_mod = {
+ .naNode = 'A',
+ .run = FALSE,
+ .prodQueMask = PRODUCER_QUEUES,
+ .consQueMask = CONSUMER_QUEUES,
+ .queue = NULL,
+ .dfrCmdReady = 0
+};
+
+static char CM_combiner[] = "combiner";
+static char CM_transformer[] = "transformer";
+
+
+/*
+ * ======== ClusterMgr_completeCommand ========
+ */
+static Cmd_Command *ClusterMgr_completeCommand(Cmd_Command *cmd)
+{
+
+ switch (cmd->cmd) {
+ case Cmd_CONNECT:
+ cmd = completeConnectCmd(cmd);
+ break;
+
+ case Cmd_DISCONNECT:
+ cmd = completeDisconnectCmd(cmd);
+ break;
+
+ case Cmd_PAUSE:
+ cmd = completePauseCmd(cmd);
+ break;
+
+ case Cmd_SHUTDOWN:
+ cmd = completeShutdownCmd(cmd);
+ break;
+
+ case Cmd_STATUS:
+ cmd = completeStatusCmd(cmd);
+ break;
+ }
+
+ return (cmd);
+}
+
+/*
+ * ======== ClusterMgr_destroy ========
+ */
+void ClusterMgr_destroy(void)
+{
+ LOG "ClusterMgr_destroy: -->\n" LOGF
+
+ /* delete the message queue */
+ MessageQ_delete(&ClusterMgr_mod.queue);
+
+ LOG "ClusterMgr_destroy: <--\n" LOGF
+}
+
+/*
+ * ======== ClusterMgr_exec ========
+ */
+int ClusterMgr_exec(void)
+{
+ int status = 0;
+ MessageQ_Msg mqMsg;
+ Cmd_Command *cmd;
+ Graph_Msg *graph;
+ MessageQ_QueueId qid;
+ Bool reply;
+
+ typedef struct {
+ MessageQ_MsgHeader reserved;
+ Cmd_Command cmd;
+ } CommandMsg;
+
+#define CmdOffset ((Int)&((CommandMsg *)0)->cmd)
+#define MessageQ_Msg_Addr(cmd) (MessageQ_Msg)((Char *)cmd - CmdOffset)
+
+ LOG "ClusterMgr_exec: -->\n" LOGF
+ ClusterMgr_mod.run = TRUE;
+
+ /* main loop */
+ while (ClusterMgr_mod.run) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(ClusterMgr_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ ClusterMgr_mod.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ fprintf(stderr, "Error: ClusterMgr_exec: message receive failed, "
+ "error=%d\n", status);
+ goto leave;
+ }
+
+ /* decode the message type, invoke process method */
+ switch (MessageQ_getMsgId(mqMsg)) {
+
+ case Cmd_MSGID:
+ cmd = &((CommandMsg *)mqMsg)->cmd;
+ cmd = ClusterMgr_processCommand(cmd);
+
+ if (cmd != NULL) {
+ reply = cmd->reply;
+ cmd->reply = FALSE;
+ }
+ else {
+ mqMsg = NULL;
+ }
+ break;
+
+ case Graph_MSGID:
+ graph = (Graph_Msg *)mqMsg;
+ ClusterMgr_processGraph(graph);
+ reply = graph->reply;
+ graph->reply = FALSE;
+ break;
+ }
+
+ do {
+ if (mqMsg != NULL) {
+ if (reply) {
+ /* return the message to sender */
+ qid = MessageQ_getReplyQueue(mqMsg);
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ status = -2;
+ goto leave;
+ }
+ }
+ else {
+ MessageQ_free(mqMsg);
+ }
+ }
+ mqMsg = NULL;
+
+ /* process all deferred commands which are ready for completion */
+ if (ClusterMgr_mod.dfrCmdReady > 0) {
+ ClusterMgr_mod.dfrCmdReady--;
+
+ cmd = Prog_getReadyCmd(&ClusterMgr_mod.dfrCmdList);
+ cmd = ClusterMgr_completeCommand(cmd);
+
+ if (cmd != NULL) {
+ reply = cmd->reply;
+ cmd->reply = FALSE;
+ mqMsg = MessageQ_Msg_Addr(cmd);
+ }
+ else {
+ mqMsg = NULL;
+ }
+ }
+ } while (mqMsg != NULL);
+ } /* main loop */
+
+leave:
+ LOG "ClusterMgr_exec: <-- status=%d\n", status LOGF
+
+ return (status);
+}
+
+/*
+ * ======== ClusterMgr_processCommand ========
+ */
+static Cmd_Command *ClusterMgr_processCommand(Cmd_Command *cmd)
+{
+
+ switch (cmd->cmd) {
+
+ case Cmd_CONNECT:
+ cmd = doConnectCmd(cmd);
+ break;
+
+ case Cmd_DISCONNECT:
+ cmd = doDisconnectCmd(cmd);
+ break;
+
+ case Cmd_EXIT:
+ ClusterMgr_mod.run = FALSE;
+ break;
+
+ case Cmd_INFO:
+ cmd = doInfoCmd(cmd);
+ break;
+
+ case Cmd_LAUNCH:
+ cmd = doLaunchCmd(cmd);
+ break;
+
+ case Cmd_PAUSE:
+ cmd = doPauseCmd(cmd);
+ break;
+
+ case Cmd_RUN:
+ cmd = doRunCmd(cmd);
+ break;
+
+ case Cmd_SHUTDOWN:
+ cmd = doShutdownCmd(cmd);
+ break;
+
+ case Cmd_STATUS:
+ cmd = doStatusCmd(cmd);
+ break;
+ }
+
+ return (cmd);
+}
+
+/*
+ * ======== ClusterMgr_processGraph ========
+ */
+int ClusterMgr_processGraph(Graph_Msg *msg)
+{
+ int status = 0;
+ Cmd_Command *cmd;
+ ProgCtx *prog;
+
+ switch (msg->cmd) {
+
+ case Graph_Cmd_ATTACH:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: ATTACH reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+ assert(cmd != NULL);
+
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_DETACH:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: DETACH reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+ assert(cmd != NULL);
+
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_DATAQUERY:
+ /* acknowledgement message */
+ if (msg->ack) {
+ prog = (ProgCtx *)(msg->uarg1);
+
+ if (msg->status >= 0) {
+ LOG "ClusterMgr: DATAQUERY success (reply from %c)\n",
+ prog->node LOGF
+
+ /* store query result */
+ prog->dataOn = (msg->arg1 > 0 ? TRUE : FALSE);
+ }
+ else {
+ LOG "ClusterMgr: DATAQUERY failure (reply from %c)\n",
+ prog->node LOGF
+ /* TODO dataOn should be tri-state */
+ }
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_FLUSH:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: FLUSH reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_INFO: {
+ Char node = (Char)(msg->arg1);
+ UInt blockSN = msg->uarg1;
+ LOG "ClusterMgr: producer %c, block: %5d\n", node, blockSN LOGF
+ break;
+ }
+
+ case Graph_Cmd_INPUTCONNECT:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: INPUT-CONNECT reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+
+ /* TODO - How to handle an error? */
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+ assert(cmd != NULL);
+
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_INPUTDISCONNECT:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: input-disconnect reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+ assert(cmd != NULL);
+
+ /* decrement deferred count but leave command on list */
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_OUTPUTCONNECT:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: OUTPUT-CONNECT reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+
+ /* TODO - How to handle an error? */
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+ assert(cmd != NULL);
+
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_OUTPUTDISCONNECT:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: output-disconnect reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+ assert(cmd != NULL);
+
+ /* decrement deferred count but leave command on list */
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_PAUSE:
+ /* acknowledgement message */
+ if (msg->ack) {
+ LOG "ClusterMgr: PAUSE reply message, status %s\n",
+ msg->status < 0 ? "failure" : "success" LOGF
+
+ /* search the deferred command list for given ID */
+ if (msg->dcid != 0) {
+ cmd = Prog_findCmd(&ClusterMgr_mod.dfrCmdList, msg->dcid);
+ assert(cmd != NULL);
+
+ /* decrement deferred count but leave command on list */
+ if (--cmd->deferredCount == 0) {
+ /* this command is ready for completion */
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ case Graph_Cmd_RUN:
+ /* acknowledgement message */
+ if (msg->ack) {
+ prog = (ProgCtx *)(msg->uarg1);
+
+ if (msg->status >= 0) {
+ LOG "ClusterMgr: RUN success (reply from %c)\n",
+ prog->node LOGF
+
+ /* store query result */
+ prog->dataOn = TRUE;
+ }
+ else {
+ LOG "ClusterMgr: RUN failure (reply from %c)\n",
+ prog->node LOGF
+ prog->dataOn = FALSE;
+ }
+ }
+ else {
+ fprintf(stderr, "Error: unexpected command message\n");
+ status = -1;
+ }
+ break;
+
+ }
+
+ return (status);
+}
+
+/*
+ * ======== ClusterMgr_setup ========
+ */
+int ClusterMgr_setup(void)
+{
+ int status = 0;
+ int i;
+ MessageQ_Params msgqParams;
+
+ LOG "ClusterMgr_setup: -->\n" LOGF
+
+ /* initialize module state */
+ ClusterMgr_mod.naNode = 'A';
+ ClusterMgr_mod.run = FALSE;
+ ClusterMgr_mod.queue = NULL;
+ ClusterMgr_mod.dfrCmdReady = 0;
+ LIST_INIT(&ClusterMgr_mod.consumer);
+ LIST_INIT(&ClusterMgr_mod.producer);
+ LIST_INIT(&ClusterMgr_mod.dfrCmdList);
+
+ for (i = 0; i < DSPCOUNT; i++) {
+ ClusterMgr_mod.dsp[i] = NULL;
+ }
+
+ /* create message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ ClusterMgr_mod.queue = MessageQ_create(ClusterMgr_CMDQUE, &msgqParams);
+
+ if (ClusterMgr_mod.queue == NULL) {
+ status = -2;
+ fprintf(stderr, "Error: message queue create failed\n");
+ goto leave;
+ }
+
+leave:
+ LOG "ClusterMgr_setup: <-- status=%d\n", status LOGF
+ return (status);
+}
+
+/*
+ * ======== ClusterMgr_system ========
+ */
+static pid_t ClusterMgr_system(char *cmd, bool wait)
+{
+ int status = 0;
+ int wstat;
+ pid_t pid;
+ char *cp, *savecp;
+ int argc;
+ char cbuf[BUFSZ];
+ char *argv[MAXARGS];
+
+ /* argument validation */
+ if ((strlen(cmd) + 1) > BUFSZ) {
+ LOG "CM_system: Error: command too long: %s\n", cmd LOGF
+ status = -2;
+ goto leave;
+ }
+
+ /* parse command string into argument array */
+ cp = strcpy(cbuf, cmd);
+
+ for (argc = 0; argc < MAXARGS; argc++, cp = NULL) {
+ argv[argc] = strtok_r(cp, " ", &savecp);
+ if (argv[argc] == NULL) {
+ break;
+ }
+ }
+
+ if (argc == MAXARGS) {
+ LOG "CM_system: Error: too many arguments: %s\n", cmd LOGF
+ status = -3;
+ goto leave;
+ }
+
+ /* fork a new process */
+ pid = fork();
+
+ if (pid == -1) {
+ LOG "CM_system: fork error: %s\n", sys_errlist[errno] LOGF
+ status = -1;
+ goto leave;
+ }
+
+ /* parent */
+ else if (pid > 0) {
+
+ if (wait) {
+ /* wait on child to exit */
+ waitpid(pid, &wstat, 0);
+ wstat = WEXITSTATUS(wstat);
+
+ if ((wstat < 0) || (wstat >= 127)) {
+ LOG "CM_system: waitpid error: %d\n", wstat LOGF
+ }
+
+ pid = 0;
+ }
+ }
+
+ /* child */
+ else {
+ /* overlay a new executable */
+ execvp(argv[0], argv);
+ LOG "CM_system: execvp error: %s\n", sys_errlist[errno] LOGF
+ status = -1;
+ }
+
+leave:
+ return (status == 0 ? pid : status);
+}
+
+/*
+ * ======== ClusterMgr_threadFxn ========
+ */
+void *ClusterMgr_threadFxn(void *arg)
+{
+ int status = 0;
+
+ LOG "ClusterMgr_threadFxn: -->\n" LOGF
+
+ /* setup phase */
+ status = ClusterMgr_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = ClusterMgr_exec();
+
+leave:
+ /* shutdown phase */
+ ClusterMgr_destroy();
+
+ LOG "ClusterMgr_threadFxn: <-- status=%d\n", status LOGF
+ return ((Void *)status);
+}
+
+/*
+ * ======== Prog_findNode ========
+ */
+static ProgCtx *Prog_findNode(struct ListHead *head, Char node)
+{
+ ProgCtx *prog;
+
+ /* search the given list */
+ for (prog = head->lh_first; prog != NULL; prog = prog->link.le_next) {
+ if (prog->node == node) {
+ return (prog);
+ }
+ }
+
+ return (NULL);
+}
+
+/*
+ * ======== Prog_findAllNode ========
+ */
+static ProgCtx *Prog_findAllNode(Char node)
+{
+ ProgCtx *prog;
+
+ /* search the producer list */
+ prog = Prog_findNode(&ClusterMgr_mod.producer, node);
+ if (prog != NULL) return (prog);
+
+ /* search the consumer list */
+ prog = Prog_findNode(&ClusterMgr_mod.consumer, node);
+ if (prog != NULL) return (prog);
+
+ /* search the dsp array */
+ prog = Prog_findDspNode(node);
+ return (prog);
+}
+
+/*
+ * ======== Prog_findDspNode ========
+ */
+static ProgCtx *Prog_findDspNode(Char node)
+{
+ int i;
+
+ /* search the dsp array */
+ for (i = 0; i < DSPCOUNT; i++) {
+
+ /* skip unused entries */
+ if (ClusterMgr_mod.dsp[i] == NULL) {
+ continue;
+ }
+
+ if (ClusterMgr_mod.dsp[i]->node == node) {
+ return (ClusterMgr_mod.dsp[i]);
+ }
+ }
+
+ return (NULL);
+}
+
+/*
+ * ======== Prog_findCmd ========
+ */
+static Cmd_Command *Prog_findCmd(struct DclHead *head, UInt dcid)
+{
+ Cmd_Command *cmd;
+
+ /* search the given list */
+ for (cmd = head->lh_first; cmd != NULL; cmd = cmd->link.le_next) {
+ if ((UInt)cmd == dcid) {
+ return (cmd);
+ }
+ }
+
+ /* should never get here */
+ assert(FALSE);
+}
+
+/*
+ * ======== Prog_getReadyCmd ========
+ */
+static Cmd_Command *Prog_getReadyCmd(struct DclHead *head)
+{
+ Cmd_Command *cmd;
+
+ /* search the given list for a command which is ready for completion */
+ for (cmd = head->lh_first; cmd != NULL; cmd = cmd->link.le_next) {
+ if (cmd->deferredCount == 0) {
+ LIST_REMOVE(cmd, link);
+ return (cmd);
+ }
+ }
+
+ return (NULL);
+}
+
+/*
+ * ======== List_insert_alpha ========
+ * Insert in alphabetical order using node name
+ */
+static Void List_insert_alpha(struct ListHead *list, ProgCtx *newItem)
+{
+ ProgCtx *item;
+
+
+ item = list->lh_first;
+
+ /* if list is empty or first item comes after new item, insert */
+ if ((item == NULL) || (item->node > newItem->node)) {
+ LIST_INSERT_HEAD(list, newItem, link);
+ }
+ else {
+ /* seach list for insertion point */
+ do {
+ /* if last item in list, insert */
+ if (item->link.le_next == NULL) {
+ LIST_INSERT_AFTER(item, newItem, link);
+ break;
+ }
+ /* if following item comes after new item, insert */
+ else if (item->link.le_next->node > newItem->node) {
+ LIST_INSERT_AFTER(item, newItem, link);
+ break;
+ }
+ else {
+ item = item->link.le_next;
+ }
+ } while (item != NULL);
+ }
+}
+
+/*
+ * ======== doConnectCmd ========
+ */
+static Cmd_Command *doConnectCmd(Cmd_Command *cmd)
+{
+ struct connect *connect;
+ ProgCtx *progSource;
+ ProgCtx *progSink;
+
+ /* clear the deferred count */
+ cmd->deferredCount = 0;
+
+ /* setup a convenience alias */
+ connect = &cmd->args.connect;
+
+ /* find program object for data-source */
+ progSource = Prog_findAllNode(connect->source);
+
+ if (progSource == NULL) {
+ fprintf(stderr, "Error: node not found: %c\n", connect->source);
+ goto leave;
+ }
+
+ /* find program object for data-sink */
+ progSink = Prog_findAllNode(connect->sink);
+
+ if (progSink == NULL) {
+ fprintf(stderr, "Error: node not found: %c\n", connect->sink);
+ goto leave;
+ }
+
+ /* a producer can never be a data-sink endpoint */
+ if (progSink->type == ClusterMgr_PRODUCER) {
+ fprintf(stderr, "Error: producer cannot be data-sink endpoint\n");
+ goto leave;
+ }
+
+ /* track data-sink endpoint */
+ progSource->dstNode = progSink->node;
+
+ /* If either endpoint is at least one of HOST or SR_ZERO_OWNER,
+ * then the attach has already been done. Just send the connect
+ * command.
+ */
+ if ((progSource->procId == MultiProc_getId("HOST"))
+ || (progSource->procId == MultiProc_getId(SR_ZERO_OWNER))
+ || (progSink->procId == MultiProc_getId("HOST"))
+ || (progSink->procId == MultiProc_getId(SR_ZERO_OWNER))) {
+
+ /* send the connect messages */
+ LOG "doConnectCmd: send output-connect message to source: %c\n",
+ connect->source LOGF
+ LOG "doConnectCmd: send input-connect message to sink: %c\n",
+ connect->sink LOGF
+ sendConnectCmd(progSource, progSink);
+ }
+ else {
+ /* This is a data-only connection, which implies the two endpoint
+ * have not yet attached to each other. Send each endpoint an attach
+ * command and defer the completion of the connect command.
+ */
+ cmd->deferredCount++;
+ sendAttachCmd(progSource, progSink->procId, (UInt)cmd);
+ cmd->deferredCount++;
+ sendAttachCmd(progSink, progSource->procId, (UInt)cmd);
+
+ /* save the program context pointers for use in command epiloque */
+ connect->progSource = (void *)progSource;
+ connect->progSink = (void *)progSink;
+
+ /* this command must be deferred until we hear back from both nodes */
+ LIST_INSERT_HEAD(&ClusterMgr_mod.dfrCmdList, cmd, link);
+ cmd = NULL;
+
+ LOG "doConnectCmd: attach messages sent, command deferred\n" LOGF
+ }
+
+leave:
+ return (cmd);
+}
+
+/*
+ * ======== completeConnectCmd ========
+ */
+static Cmd_Command *completeConnectCmd(Cmd_Command *cmd)
+{
+ struct connect *connect;
+ ProgCtx *progSource;
+ ProgCtx *progSink;
+
+ /* setup aliases */
+ connect = &cmd->args.connect;
+ progSource = (ProgCtx *)connect->progSource;
+ progSink = (ProgCtx *)connect->progSink;
+
+ /* send the connect messages */
+ LOG "doConnectCmd: send output-connect message to source: %c\n",
+ progSource->node LOGF
+ LOG "doConnectCmd: send input-connect message to sink: %c\n",
+ progSink->node LOGF
+ sendConnectCmd(progSource, progSink);
+
+ return (cmd);
+}
+
+/*
+ * ======== doDisconnectCmd ========
+ */
+static Cmd_Command *doDisconnectCmd(Cmd_Command *cmd)
+{
+ struct disconnect *disconnect;
+ ProgCtx *progSource;
+ ProgCtx *progSink;
+
+ /* clear the deferred count */
+ cmd->deferredCount = 0;
+
+ /* setup a convenience alias */
+ disconnect = &cmd->args.disconnect;
+
+ /* find program object for data-source */
+ progSource = Prog_findAllNode(disconnect->source);
+
+ if (progSource == NULL) {
+ fprintf(stderr, "Error: node not found: %c\n", disconnect->source);
+ goto leave;
+ }
+
+ /* find program object for data-sink */
+ progSink = Prog_findAllNode(disconnect->sink);
+
+ if (progSink == NULL) {
+ fprintf(stderr, "Error: node not found: %c\n", disconnect->sink);
+ goto leave;
+ }
+
+ /* validate connection information */
+ if (progSource->dstNode != progSink->node) {
+ fprintf(stderr, "Error: connection %c %c does not exist\n",
+ disconnect->source, disconnect->sink);
+ goto leave;
+ }
+
+ /* remove connection tracking information */
+ progSource->dstNode = '-';
+
+ /* If either endpoint is at least one of HOST or SR_ZERO_OWNER,
+ * then to not instruct the endpoints to detach. Just send the
+ * disconnect command.
+ */
+ if ((progSource->procId == MultiProc_getId("HOST"))
+ || (progSource->procId == MultiProc_getId(SR_ZERO_OWNER))
+ || (progSink->procId == MultiProc_getId("HOST"))
+ || (progSink->procId == MultiProc_getId(SR_ZERO_OWNER))) {
+
+ /* send disconnect message to source */
+ LOG "doDisconnectCmd: send output-disconnect message to source: %c\n",
+ disconnect->source LOGF
+ LOG "doDisconnectCmd: send input-disconnect message to sink: %c\n",
+ disconnect->sink LOGF
+ sendDisconnectCmd(progSource, progSink, 0);
+ }
+ else {
+ /* This is a data-only connection, which implies the two
+ * endpoints must detach from each other after diconnecting.
+ * Send each node the disconnect command but defer the detach
+ * commands to ensure the disconnect has completed.
+ */
+ LOG "doDisconnectCmd: send output-disconnect message to source: %c\n",
+ disconnect->source LOGF
+ LOG "doDisconnectCmd: send input-disconnect message to sink: %c\n",
+ disconnect->sink LOGF
+ sendDisconnectCmd(progSource, progSink, (UInt)cmd);
+
+ /* save program context pointers for use in command epilogue */
+ cmd->deferredCount += 2;
+ disconnect->progSource = (void *)progSource;
+ disconnect->progSink = (void *)progSink;
+
+ /* put command on deferred list */
+ LIST_INSERT_HEAD(&ClusterMgr_mod.dfrCmdList, cmd, link);
+ cmd = NULL;
+
+ LOG "doDisconnectCmd: disconnect messages sent, command deferred\n" LOGF
+ }
+
+leave:
+ return (cmd);
+}
+
+/*
+ * ======== completeDisconnectCmd ========
+ */
+static Cmd_Command *completeDisconnectCmd(Cmd_Command *cmd)
+{
+ struct disconnect *disconnect;
+ ProgCtx *progSource;
+ ProgCtx *progSink;
+
+ /* setup aliases */
+ disconnect = &cmd->args.disconnect;
+ progSource = (ProgCtx *)disconnect->progSource;
+ progSink = (ProgCtx *)disconnect->progSink;
+
+ /* send detach commands */
+ sendDetachCmd(progSource, progSink->procId, 0);
+ sendDetachCmd(progSink, progSource->procId, 0);
+
+ LOG "completeDisconnectCmd: detach messages sent\n" LOGF
+
+ return (cmd);
+}
+
+/*
+ * ======== doInfoCmd ========
+ */
+static Cmd_Command *doInfoCmd(Cmd_Command *cmd)
+{
+ struct info *info;
+ int i;
+ int procId;
+ String name;
+
+ info = &cmd->args.info;
+
+ if (info->item == Cmd_BASEID) {
+ info->baseId = MultiProc_getBaseIdOfCluster();
+ }
+ else if (info->item == Cmd_CLUSTER) {
+ info->size = MultiProc_getNumProcsInCluster();
+ info->baseId = MultiProc_getBaseIdOfCluster();
+
+ for (i = 0; i < info->size; i++) {
+ procId = info->baseId + i;
+ name = MultiProc_getName(procId);
+ strcpy(info->names[i], name);
+ }
+ }
+
+ return (cmd);
+}
+
+/*
+ * ======== doLaunchCmd ========
+ */
+static Cmd_Command *doLaunchCmd(Cmd_Command *cmd)
+{
+ int status = 0;
+ pid_t pid;
+ ProgCtx *prog = NULL;
+ struct launch *launch;
+ char scmd[BUFSZ];
+ char qname[BUFSZ];
+ MessageQ_QueueId qid;
+ int mpmId;
+ UInt16 procId;
+ int i;
+ UInt8 bit;
+ Bool dspAttach = FALSE;
+ Bool hostAttach = FALSE;
+ ProgCtx *host;
+ ProgCtx *dsp;
+ ProgCtx *srzero;
+
+ launch = &cmd->args.launch;
+
+ /* allocate a new program context object */
+ prog = malloc(sizeof(ProgCtx));
+ prog->node = '-';
+ prog->dstNode = '-';
+ prog->type = ClusterMgr_UNKNOWN;
+ prog->pid = 0;
+ prog->cmdQue = MessageQ_INVALIDMESSAGEQ;
+ prog->transId = 0;
+ prog->procId = MultiProc_INVALIDID;
+ prog->attached = FALSE;
+ prog->dataOn = FALSE;
+
+ /* assign next available node name */
+ prog->node = ClusterMgr_mod.naNode++;
+
+ switch (launch->program) {
+ case Cmd_CONSUMER:
+ /* compute the command message queue name */
+ snprintf(qname, BUFSZ, Consumer_CMDQUE_FMT, prog->node);
+
+ /* determine the next available reserved message queue index */
+ prog->dataQueIdx = -1;
+
+ for (i = 0; i < NUM_RESERVED_QUEUES; i++) {
+ bit = 1 << i;
+ if (bit & ClusterMgr_mod.consQueMask) {
+ prog->dataQueIdx = i;
+ ClusterMgr_mod.consQueMask &= ~bit; /* clear the bit */
+ break;
+ }
+ }
+
+ if (prog->dataQueIdx < 0) {
+ fprintf(stderr, "Error: no available message queues\n");
+ goto leave;
+ }
+
+ /* compute the launch command, launch program */
+ snprintf(scmd, BUFSZ, Consumer_LAUNCH_FMT, prog->node,
+ prog->dataQueIdx);
+
+ pid = ClusterMgr_system(scmd, FALSE);
+
+ if (pid < 0) {
+ fprintf(stderr, "Error: system call failed: %s\n", scmd);
+ goto leave;
+ }
+
+ /* save child process ID */
+ prog->pid = pid;
+ break;
+
+ case Cmd_COMBINER:
+ /* for dsp, reserved queues are pre-determined */
+ prog->dataQueIdx = SysCfg_DATA_RQUE;
+
+ /* mpmcl names are base-zero, must subtract 1 from clusterId */
+ mpmId = launch->processor - 1;
+
+ /* load the dsp */
+ snprintf(scmd, BUFSZ, CombinerN_LOAD_FMT, mpmId);
+ status = ClusterMgr_system(scmd, TRUE);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: system call failed: %s\n", scmd);
+ goto leave;
+ }
+
+ /* run the dsp */
+ snprintf(scmd, BUFSZ, CombinerN_RUN_FMT, mpmId);
+ status = ClusterMgr_system(scmd, TRUE);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: system call failed: %s\n", scmd);
+ goto leave;
+ }
+
+ /* TODO: wait to allow rpmsg driver to setup */
+ usleep(300000); /* 0.3 second */
+
+ procId = MultiProc_getBaseIdOfCluster() + launch->processor;
+
+ /* send attach command to SR-Zero owner */
+ if (launch->processor != 1) {
+ srzero = ClusterMgr_mod.dsp[0];
+ sendAttachCmd(srzero, procId, 0);
+ }
+
+ /* attach to dsp */
+ status = Ipc_attach(procId);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: Ipc_attach(%d) failed\n", procId);
+ goto leave;
+ }
+
+ /* compute name of combiner control message queue */
+ snprintf(qname, BUFSZ, CombinerN_CMDQUE_FMT, procId);
+ break;
+
+ case Cmd_PRODUCER:
+ /* compute the message queue name */
+ snprintf(qname, BUFSZ, Producer_CMDQUE_FMT, prog->node);
+
+ /* determine the next available reserved message queue index */
+ prog->dataQueIdx = -1;
+
+ for (i = 0; i < NUM_RESERVED_QUEUES; i++) {
+ bit = 1 << i;
+ if (bit & ClusterMgr_mod.prodQueMask) {
+ prog->dataQueIdx = i;
+ ClusterMgr_mod.prodQueMask &= ~bit; /* clear the bit */
+ break;
+ }
+ }
+
+ if (prog->dataQueIdx < 0) {
+ fprintf(stderr, "Error: no available message queues\n");
+ goto leave;
+ }
+
+ /* compute the launch command, launch program */
+ snprintf(scmd, BUFSZ, Producer_LAUNCH_FMT, prog->node,
+ prog->dataQueIdx);
+
+ pid = ClusterMgr_system(scmd, FALSE);
+
+ if (pid < 0) {
+ fprintf(stderr, "Error: system call failed: %s\n", scmd);
+ goto leave;
+ }
+
+ /* save child process ID */
+ prog->pid = pid;
+ break;
+
+ case Cmd_TRANSFORMER:
+ /* for dsp, reserved queues are pre-determined */
+ prog->dataQueIdx = SysCfg_DATA_RQUE;
+
+ /* mpmcl names are base-zero, must subtract 1 from clusterId */
+ mpmId = launch->processor - 1;
+
+ /* load the dsp */
+ snprintf(scmd, BUFSZ, TransformerN_LOAD_FMT, mpmId);
+ status = ClusterMgr_system(scmd, TRUE);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: system call failed: %s\n", scmd);
+ goto leave;
+ }
+
+ /* run the dsp */
+ snprintf(scmd, BUFSZ, TransformerN_RUN_FMT, mpmId);
+ status = ClusterMgr_system(scmd, TRUE);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: system call failed: %s\n", scmd);
+ goto leave;
+ }
+
+ /* TODO: wait to allow rpmsg driver to setup */
+ usleep(300000); /* 0.3 second */
+
+ procId = MultiProc_getBaseIdOfCluster() + launch->processor;
+
+ /* send attach command to SR-Zero owner */
+ if (launch->processor != 1) {
+ srzero = ClusterMgr_mod.dsp[0];
+ sendAttachCmd(srzero, procId, 0);
+ }
+
+ /* attach to dsp */
+ status = Ipc_attach(procId);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: Ipc_attach(%d) failed\n", procId);
+ goto leave;
+ }
+
+ /* compute name of transformer control message queue */
+ snprintf(qname, BUFSZ, TransformerN_CMDQUE_FMT, procId);
+ break;
+ }
+
+ /* TODO: wait to allow new program to create message queue */
+ usleep(400000); /* 0.4 second */
+
+ /* open the destination message queue */
+ do {
+ status = MessageQ_open(qname, &qid);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ usleep(60000); /* 60 milliseconds */
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: cannot open queue, name=%s error=%d\n",
+ qname, status);
+ goto leave;
+ }
+
+ /* update local database with connection details */
+ switch (launch->program) {
+ case Cmd_COMBINER:
+ prog->type = ClusterMgr_COMBINER;
+ prog->cmdQue = qid;
+ prog->transId = 0; /* use primary transport (i.e. default) */
+ prog->procId = procId;
+ prog->attached = TRUE;
+ ClusterMgr_mod.dsp[mpmId] = prog;
+ dspAttach = TRUE;
+ break;
+
+ case Cmd_CONSUMER:
+ prog->type = ClusterMgr_CONSUMER;
+ prog->cmdQue = qid;
+ prog->transId = SysCfg_TRANSPORT_PMQ_ID; /* posix message queue */
+ prog->procId = MultiProc_self();
+ prog->attached = FALSE;
+ List_insert_alpha(&ClusterMgr_mod.consumer, prog);
+ hostAttach = TRUE;
+ break;
+
+ case Cmd_PRODUCER:
+ prog->type = ClusterMgr_PRODUCER;
+ prog->cmdQue = qid;
+ prog->transId = SysCfg_TRANSPORT_PMQ_ID; /* posix message queue */
+ prog->procId = MultiProc_self();
+ prog->attached = FALSE;
+ List_insert_alpha(&ClusterMgr_mod.producer, prog);
+ hostAttach = TRUE;
+ break;
+
+ case Cmd_TRANSFORMER:
+ prog->type = ClusterMgr_TRANSFORMER;
+ prog->cmdQue = qid;
+ prog->transId = 0; /* use primary transport (i.e. default) */
+ prog->procId = procId;
+ prog->attached = TRUE;
+ ClusterMgr_mod.dsp[mpmId] = prog;
+ dspAttach = TRUE;
+ break;
+ }
+
+#if 0
+ /* Optional: In the current implementation, the SR-Zero owner has
+ * an idle function which attempts to attach to all remaining DSP
+ * processors. An althernative would be to remove the idle function
+ * and send an explicit attach message to the SR-Zero owner from here.
+ */
+ if (dspAttach) {
+ /* send SR-Zero owner attach message */
+ }
+#endif
+
+ /* all host programs must attach to new dsp */
+ if (dspAttach) {
+
+ /* walk list of producers */
+ for (host = ClusterMgr_mod.producer.lh_first;
+ host != NULL; host = host->link.le_next) {
+ sendAttachCmd(host, prog->procId, 0);
+ }
+
+ /* walk list of consumers */
+ for (host = ClusterMgr_mod.consumer.lh_first;
+ host != NULL; host = host->link.le_next) {
+ sendAttachCmd(host, prog->procId, 0);
+ }
+ }
+
+ /* new host program must attach to all running dsp processors */
+ if (hostAttach) {
+ for (i = 0; i < DSPCOUNT; i++) {
+ dsp = ClusterMgr_mod.dsp[i];
+ if (dsp != NULL) {
+ sendAttachCmd(prog, dsp->procId, 0);
+ }
+ }
+ }
+
+ LOG "doLaunchCmd: queueId = 0x%08x\n", (unsigned int)qid LOGF
+
+leave:
+ return (cmd);
+}
+
+/*
+ * ======== doPauseCmd ========
+ */
+static Cmd_Command *doPauseCmd(Cmd_Command *cmd)
+{
+ int status = 0;
+ struct pause *pause = &cmd->args.pause;
+ ProgCtx *producer;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ /* search the producer list for the give node */
+ producer = Prog_findNode(&ClusterMgr_mod.producer, pause->node);
+
+ if (producer == NULL) {
+ fprintf(stderr, "Error: node not found: %c\n", pause->node);
+ status = -1;
+ goto leave;
+ }
+
+ /* send message to producer */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, producer->transId);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_PAUSE;
+ msg->reply = TRUE;
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+ msg->ack = FALSE;
+ msg->dcid = (UInt)cmd; /* store the deferred command ID */
+
+ status = MessageQ_put(producer->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+ LOG "doPauseCmd: message sent to producer: %c\n", pause->node LOGF
+
+ /* add command to deferred command list */
+ cmd->deferredCount = 1;
+ pause->producer = (void *)producer;
+ LIST_INSERT_HEAD(&ClusterMgr_mod.dfrCmdList, cmd, link);
+
+leave:
+ return (status < 0 ? cmd : NULL);
+}
+
+/*
+ * ======== completePauseCmd ========
+ */
+static Cmd_Command *completePauseCmd(Cmd_Command *cmd)
+{
+ int status;
+ struct pause *pause;
+ ProgCtx *prog;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+ UInt16 procId;
+ UInt16 queueIndex;
+
+ pause = &cmd->args.pause;
+ prog = (ProgCtx *)pause->producer;
+
+ /* send each node in data flow a flush command */
+ while (prog->dstNode != '-') {
+
+ /* save source connection information */
+ procId = prog->procId;
+ queueIndex = prog->dataQueIdx;
+
+ /* find next downstream node */
+ prog = Prog_findAllNode(prog->dstNode);
+ assert(prog != NULL);
+
+ /* flush message */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, prog->transId);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_FLUSH;
+ msg->dcid = 0;
+ msg->reply = TRUE;
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+ msg->ack = FALSE;
+ msg->arg1 = procId;
+ msg->arg2 = queueIndex;
+
+ status = MessageQ_put(prog->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+ LOG "completePauseCmd: flush message sent to node %c\n", prog->node LOGF
+ }
+
+leave:
+ return (cmd);
+}
+
+/*
+ * ======== doRunCmd ========
+ */
+static Cmd_Command *doRunCmd(Cmd_Command *cmd)
+{
+ int status;
+ struct run *run = &cmd->args.run;
+ ProgCtx *producer;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ /* search the producer list for the give node */
+ producer = Prog_findNode(&ClusterMgr_mod.producer, run->node);
+
+ if (producer == NULL) {
+ fprintf(stderr, "Error: node not found: %c\n", run->node);
+ goto leave;
+ }
+
+ /* send message to producer */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, producer->transId);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_RUN;
+ msg->dcid = 0;
+ msg->reply = TRUE;
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+ msg->ack = FALSE;
+ msg->uarg1 = (UInt)producer;
+
+ status = MessageQ_put(producer->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+ LOG "doRunCmd: message sent to producer: %c\n", run->node LOGF
+
+leave:
+ return (cmd);
+}
+
+/*
+ * ======== doShutdownCmd ========
+ */
+static Cmd_Command *doShutdownCmd(Cmd_Command *cmd)
+{
+ int status = 0;
+ struct shutdown *shutdown;
+ MessageQ_Msg mqMsg = NULL;
+ struct ProgCtx *prog;
+ Bool shutdownDSP = FALSE;
+ Bool shutdownHOST = FALSE;
+ int i;
+ ProgCtx *host;
+ ProgCtx *dsp;
+
+ /* clear the deferred count */
+ cmd->deferredCount = 0;
+
+ /* setup a convenience alias */
+ shutdown = &cmd->args.shutdown;
+ shutdown->msg = NULL;
+ shutdown->prog = NULL;
+
+ switch (shutdown->program) {
+ case Cmd_DSP1:
+ case Cmd_DSP2:
+ case Cmd_DSP3:
+ case Cmd_DSP4:
+ case Cmd_DSP5:
+ case Cmd_DSP6:
+ case Cmd_DSP7:
+ case Cmd_DSP8: {
+ int index = shutdown->program - 1;
+ prog = ClusterMgr_mod.dsp[index];
+ ClusterMgr_mod.dsp[index] = NULL;
+ if (prog == NULL) {
+ fprintf(stderr, "Error: dsp in reset\n");
+ status = -1;
+ goto leave;
+ }
+ shutdown->prog = (void *)prog;
+ shutdownDSP = TRUE;
+ break;
+ }
+
+ default:
+ prog = Prog_findNode(&ClusterMgr_mod.consumer, shutdown->node);
+ if (prog != NULL) {
+ shutdown->program = Cmd_CONSUMER;
+ shutdown->prog = (void *)prog;
+ }
+
+ prog = Prog_findNode(&ClusterMgr_mod.producer, shutdown->node);
+ if (prog != NULL) {
+ shutdown->program = Cmd_PRODUCER;
+ shutdown->prog = (void *)prog;
+ }
+
+ if (shutdown->prog == NULL) {
+ fprintf(stderr, "Error: node %c not found\n", shutdown->node);
+ status = -2;
+ goto leave;
+ }
+
+ prog = (struct ProgCtx *)(shutdown->prog);
+ LIST_REMOVE(prog, link);
+ shutdownHOST = TRUE;
+ break;
+ }
+
+ /* allocate a graph message */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* store message pointer in command object */
+ shutdown->msg = (void *)mqMsg;
+
+ /* identify the message type */
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, prog->transId);
+
+ /* target host program must detach from all running dsp processors */
+ if (shutdownHOST) {
+ for (i = 0; i < DSPCOUNT; i++) {
+ dsp = ClusterMgr_mod.dsp[i];
+ if (dsp != NULL) {
+ sendDetachCmd(prog, dsp->procId, (UInt)cmd);
+ cmd->deferredCount++;
+ }
+ }
+ }
+
+ /* all host programs must detach from target dsp */
+ if (shutdownDSP) {
+
+ /* walk list of producers */
+ for (host = ClusterMgr_mod.producer.lh_first;
+ host != NULL; host = host->link.le_next) {
+ sendDetachCmd(host, prog->procId, (UInt)cmd);
+ cmd->deferredCount++;
+ }
+
+ /* walk list of consumers */
+ for (host = ClusterMgr_mod.consumer.lh_first;
+ host != NULL; host = host->link.le_next) {
+ sendDetachCmd(host, prog->procId, (UInt)cmd);
+ cmd->deferredCount++;
+ }
+ }
+
+ /* add command to deferred command list */
+ LIST_INSERT_HEAD(&ClusterMgr_mod.dfrCmdList, cmd, link);
+
+ /* if no sub-command, then this command is ready for completion */
+ if (cmd->deferredCount == 0) {
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+
+leave:
+ if (status < 0) {
+ if (mqMsg != NULL) {
+ MessageQ_free(mqMsg);
+ mqMsg = NULL;
+ }
+ }
+
+ return (status < 0 ? cmd : NULL);
+}
+
+/*
+ * ======== completeShutdownCmd ========
+ */
+static Cmd_Command *completeShutdownCmd(Cmd_Command *cmd)
+{
+ int status = 0;
+ int wstat;
+ struct shutdown *shutdown;
+ struct ProgCtx *prog;
+ Graph_Msg *msg;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId *pqid;
+ char scmd[BUFSZ];
+
+ /* setup aliases */
+ shutdown = &cmd->args.shutdown;
+ prog = (struct ProgCtx *)(shutdown->prog);
+ mqMsg = (MessageQ_Msg)shutdown->msg;
+
+ /* fill in message payload */
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_SHUTDOWN;
+ msg->reply = FALSE;
+
+ /* send the message */
+ pqid = &prog->cmdQue;
+ status = MessageQ_put(*pqid, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ status = -2;
+ goto leave;
+ }
+ LOG "completeShutdownCmd: shutdown message sent, qid=0x%x\n", *pqid LOGF
+
+ /* close the remote message queue */
+ MessageQ_close(pqid);
+
+ switch (shutdown->program) {
+ case Cmd_CONSUMER:
+ /* reclaim the reserved message queue index */
+ ClusterMgr_mod.consQueMask |= (1 << prog->dataQueIdx);
+
+ /* wait until child has terminated */
+ waitpid(prog->pid, &wstat, 0);
+ wstat = WEXITSTATUS(wstat);
+
+ if ((wstat < 0) || (wstat >= 127)) {
+ LOG "CM_system: waitpid error: %d\n", wstat LOGF
+ }
+ break;
+
+ case Cmd_PRODUCER:
+ /* reclaim the reserved message queue index */
+ ClusterMgr_mod.prodQueMask |= (1 << prog->dataQueIdx);
+
+ /* wait until child has terminated */
+ waitpid(prog->pid, &wstat, 0);
+ wstat = WEXITSTATUS(wstat);
+
+ if ((wstat < 0) || (wstat >= 127)) {
+ LOG "CM_system: waitpid error: %d\n", wstat LOGF
+ }
+ break;
+
+ case Cmd_DSP1:
+ case Cmd_DSP2:
+ case Cmd_DSP3:
+ case Cmd_DSP4:
+ case Cmd_DSP5:
+ case Cmd_DSP6:
+ case Cmd_DSP7:
+ case Cmd_DSP8: {
+ /* the dsp processor must be placed into reset */
+ UInt16 procId;
+ int dspId;
+
+ /* detach from the dsp */
+ procId = MultiProc_getBaseIdOfCluster() + shutdown->program;
+
+ status = Ipc_detach(procId);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: Ipc_detach(%d) failed\n", procId);
+ goto leave;
+ }
+
+ dspId = shutdown->program - 1;
+ prog->attached = FALSE;
+
+ /* wait to let dsp go to idle task */
+ usleep(300000); /* 0.3 sec */
+
+ /* construct the system command */
+ snprintf(scmd, BUFSZ, TransformerN_RESET_FMT, dspId);
+ status = ClusterMgr_system(scmd, TRUE);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: system call failed: %s\n", scmd);
+ goto leave;
+ }
+ break;
+ }
+ }
+
+ /* free the program context object */
+ free(prog);
+
+leave:
+ return (cmd);
+}
+
+/*
+ * ======== doStatusCmd ========
+ */
+static Cmd_Command *doStatusCmd(Cmd_Command *cmd)
+{
+ int status;
+ ProgCtx *prog;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ /* clear the deferred count */
+ cmd->deferredCount = 0;
+
+ /* send each producer a data query message */
+ for (prog = ClusterMgr_mod.producer.lh_first;
+ prog != NULL; prog = prog->link.le_next) {
+
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ /* fill in message payload */
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, prog->transId);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_DATAQUERY;
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+ msg->reply = TRUE;
+ msg->ack = FALSE;
+ msg->uarg1 = (UInt)prog;
+ msg->dcid = (UInt)cmd; /* store the deferred command ID */
+
+ /* send the message */
+ status = MessageQ_put(prog->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+ LOG "doStatusCmd: sent data query, node=%c\n", prog->node LOGF
+
+ cmd->deferredCount++;
+ }
+
+leave:
+ /* add command to deferred command list */
+ LIST_INSERT_HEAD(&ClusterMgr_mod.dfrCmdList, cmd, link);
+
+ /* if no sub-command, then this command is ready for completion */
+ if (cmd->deferredCount == 0) {
+ ClusterMgr_mod.dfrCmdReady++;
+ }
+
+ return (NULL);
+}
+
+/*
+ * ======== completeStatusCmd ========
+ */
+static Cmd_Command *completeStatusCmd(Cmd_Command *cmd)
+{
+ ProgCtx *prog;
+ int i;
+ char *type;
+
+
+ printf("\nProgram Status:\n");
+ printf("----------------------------------------\n");
+
+ for (prog = ClusterMgr_mod.producer.lh_first;
+ prog != NULL; prog = prog->link.le_next) {
+ printf(" %-2c %-14s %-4s: cqid=0x%08x %-4s\n", prog->node, "producer",
+ "host", prog->cmdQue, (prog->dataOn ? "on" : "off"));
+ }
+
+ for (prog = ClusterMgr_mod.consumer.lh_first;
+ prog != NULL; prog = prog->link.le_next) {
+ printf(" %-2c %-14s %-4s: cqid=0x%08x\n", prog->node, "consumer",
+ "host", prog->cmdQue);
+ }
+
+ for (i = 0; i < DSPCOUNT; i++) {
+ prog = ClusterMgr_mod.dsp[i];
+
+ if (prog == NULL) {
+ printf(" %-2c %-14s dsp%d: cqid=0x%08x\n", '-', "--------",
+ i + 1, MessageQ_INVALIDMESSAGEQ);
+ }
+ else {
+ switch (prog->type) {
+ case ClusterMgr_COMBINER:
+ type = CM_combiner;
+ break;
+ case ClusterMgr_TRANSFORMER:
+ type = CM_transformer;
+ break;
+ default:
+ /* TODO: report error */
+ break;
+ }
+ printf(" %-2c %-14s dsp%d: cqid=0x%08x\n", prog->node, type,
+ i + 1, prog->cmdQue);
+ }
+ }
+
+ printf("\nConnections:\n");
+ printf("----------------------------------------\n");
+ for (prog = ClusterMgr_mod.producer.lh_first;
+ prog != NULL; prog = prog->link.le_next) {
+
+ if (prog->dstNode != '-') {
+ printf(" %-2c --> %-2c\n", prog->node, prog->dstNode);
+ }
+ }
+
+ for (i = 0; i < DSPCOUNT; i++) {
+ prog = ClusterMgr_mod.dsp[i];
+
+ if ((prog != NULL) && (prog->dstNode != '-')) {
+ printf(" %-2c --> %-2c\n", prog->node, prog->dstNode);
+ }
+ }
+
+ printf("\n");
+
+ return (cmd);
+}
+
+/*
+ * ======== sendAttachCmd ========
+ */
+static void sendAttachCmd(ProgCtx *prog, UInt16 procId, UInt dcid)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ /* message delivery details */
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, prog->transId);
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+
+ /* command details */
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_ATTACH;
+ msg->uarg1 = procId;
+ msg->dcid = dcid; /* store the deferred command ID */
+ msg->reply = TRUE;
+ msg->ack = FALSE;
+
+ /* send message */
+ status = MessageQ_put(prog->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+ LOG "attach message sent to node %c, procId %d\n", prog->node, procId LOGF
+
+leave:
+ return;
+}
+
+/*
+ * ======== sendDetachCmd ========
+ */
+static void sendDetachCmd(ProgCtx *prog, UInt16 procId, UInt dcid)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ /* message delivery details */
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, prog->transId);
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+
+ /* command details */
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_DETACH;
+ msg->uarg1 = procId;
+ msg->dcid = dcid; /* store the deferred command ID */
+ msg->reply = TRUE;
+ msg->ack = FALSE;
+
+ /* send message */
+ status = MessageQ_put(prog->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+ LOG "detach message sent to node %c, procId %d\n", prog->node, procId LOGF
+
+leave:
+ return;
+}
+
+/*
+ * ======== sendConnectCmd ========
+ */
+static void sendConnectCmd(ProgCtx *progSource, ProgCtx *progSink)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ /* allocate graph message to send output-connect command to source node */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, progSource->transId);
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_OUTPUTCONNECT;
+ msg->uarg1 = progSink->procId;
+ msg->uarg2 = progSink->dataQueIdx;
+ msg->dcid = 0;
+ msg->reply = TRUE;
+ msg->ack = FALSE;
+
+ /* send message to source node */
+ status = MessageQ_put(progSource->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+
+ /* allocate graph message to send input-connect command to sink node */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, progSink->transId);
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_INPUTCONNECT;
+ msg->uarg1 = progSource->procId;
+ msg->uarg2 = progSource->dataQueIdx;
+ msg->dcid = 0;
+ msg->reply = TRUE;
+ msg->ack = FALSE;
+
+ /* send message to source */
+ status = MessageQ_put(progSink->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+
+leave:
+ return;
+}
+
+/*
+ * ======== sendDisconnectCmd ========
+ */
+static void sendDisconnectCmd(ProgCtx *progSource, ProgCtx *progSink, UInt dcid)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ /* graph message to send output-disconnect command to source node */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, progSource->transId);
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_OUTPUTDISCONNECT;
+ msg->uarg1 = progSink->procId;
+ msg->uarg2 = progSink->dataQueIdx;
+ msg->dcid = dcid; /* store the deferred command ID */
+ msg->reply = TRUE;
+ msg->ack = FALSE;
+
+ /* send message to source node */
+ status = MessageQ_put(progSource->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+
+ /* allocate graph message to send input-disconnect command to sink node */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, progSink->transId);
+ MessageQ_setReplyQueue(ClusterMgr_mod.queue, mqMsg);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_INPUTDISCONNECT;
+ msg->uarg1 = progSource->procId;
+ msg->uarg2 = progSource->dataQueIdx;
+ msg->dcid = dcid; /* store the deferred command ID */
+ msg->reply = TRUE;
+ msg->ack = FALSE;
+
+ /* send message to source */
+ status = MessageQ_put(progSink->cmdQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ goto leave;
+ }
+
+leave:
+ return;
+}
diff --git a/src/examples/templates/ex46_graph/manager/ClusterMgr.h b/src/examples/templates/ex46_graph/manager/ClusterMgr.h
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ClusterMgr.h ========
+ */
+
+#ifndef ClusterMgr__include
+#define ClusterMgr__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+void *ClusterMgr_threadFxn(void *arg);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/manager/Cmd.c b/src/examples/templates/ex46_graph/manager/Cmd.c
--- /dev/null
@@ -0,0 +1,356 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Cmd.c ========
+ */
+
+/* Standard headers */
+#include <stdio.h> /* printf, sscanf */
+#include <string.h> /* strcpy, strcmp, strlen */
+
+/* example header files */
+#include "Cmd.h"
+
+#define FALSE 0
+#define TRUE 1
+
+/* log helpers */
+extern FILE *cmlog;
+#define LOG fprintf(cmlog,
+#define LOGF ); fflush(cmlog);
+
+/* parser data structures */
+#define Lexeme_LEN 32
+
+typedef struct {
+ char lexeme[Lexeme_LEN];
+ int value;
+} Token;
+
+typedef struct {
+ Token *tab;
+ int size;
+} PTable;
+
+/* private functions */
+int TokenInt(PTable *table, char *word, int *tokerr);
+
+
+/* commands */
+Token Cmd_tokens[] = {
+ { "connect", Cmd_CONNECT },
+ { "disconnect", Cmd_DISCONNECT },
+ { "exit", Cmd_EXIT },
+ { "help", Cmd_HELP },
+ { "info", Cmd_INFO },
+ { "launch", Cmd_LAUNCH },
+ { "pause", Cmd_PAUSE },
+ { "run", Cmd_RUN },
+ { "shutdown", Cmd_SHUTDOWN },
+ { "status", Cmd_STATUS }
+};
+PTable CmdTab = {
+ Cmd_tokens,
+ sizeof(Cmd_tokens) / sizeof(Token)
+};
+
+/* cmd: info */
+Token Info_tokens[] = {
+ { "baseId", Cmd_BASEID },
+ { "cluster", Cmd_CLUSTER }
+};
+PTable InfoTab = {
+ Info_tokens,
+ sizeof(Info_tokens) / sizeof(Token)
+};
+
+/* cmd: launch */
+Token Launch_tokens[] = {
+ { "combiner", Cmd_COMBINER },
+ { "consumer", Cmd_CONSUMER },
+ { "producer", Cmd_PRODUCER },
+ { "transformer", Cmd_TRANSFORMER }
+};
+PTable LaunchTab = {
+ Launch_tokens,
+ sizeof(Launch_tokens) / sizeof(Token)
+};
+
+/* cmd: shutdown */
+Token Node_tokens[] = {
+ { "dsp1", Cmd_DSP1 },
+ { "dsp2", Cmd_DSP2 },
+ { "dsp3", Cmd_DSP3 },
+ { "dsp4", Cmd_DSP4 },
+ { "dsp5", Cmd_DSP5 },
+ { "dsp6", Cmd_DSP6 },
+ { "dsp7", Cmd_DSP7 },
+ { "dsp8", Cmd_DSP8 }
+};
+PTable NodeTab = {
+ Node_tokens,
+ sizeof(Node_tokens) / sizeof(Token)
+};
+
+/* processor names */
+Token Processor_tokens[] = {
+ { "host", Cmd_HOST },
+ { "dsp1", Cmd_DSP1 },
+ { "dsp2", Cmd_DSP2 },
+ { "dsp3", Cmd_DSP3 },
+ { "dsp4", Cmd_DSP4 },
+ { "dsp5", Cmd_DSP5 },
+ { "dsp6", Cmd_DSP6 },
+ { "dsp7", Cmd_DSP7 },
+ { "dsp8", Cmd_DSP8 }
+};
+PTable ProcessorTab = {
+ Processor_tokens,
+ sizeof(Processor_tokens) / sizeof(Token)
+};
+
+/* help text */
+char Cmd_helpTextBuf[] =
+ "NAME\n"
+ " connect - create a data path between two nodes\n"
+ " disconnect - delete a data path\n"
+ " exit - shutdown the cluster manager\n"
+ " help - print this message\n"
+ " info - display information about objects\n"
+ " launch - start a program\n"
+ " pause - stop data flow\n"
+ " run - start data flow\n"
+ " shutdown - terminate a program\n"
+ " status - display system state\n"
+ "\n"
+ "SYNOPSIS\n"
+ " connect sourceNode sinkNode\n"
+ " disconnect sourceNode sinkNode\n"
+ " exit\n"
+ " help\n"
+ " info baseId | cluster\n"
+ " launch producer|consumer\n"
+ " launch transformer|combiner dsp1|dsp2|...|dsp8\n"
+ " pause nodeX\n"
+ " run nodeX\n"
+ " shutdown nodeX\n"
+ " shutdown dsp1|dsp2|...|dsp8\n"
+ " status\n"
+ "\n"
+ "OPTIONS\n"
+ " nodeX - specify node name (e.g. 'A')\n"
+ " sourceNode, sinkNode - specify node name (e.g. 'A')\n"
+ "\n"
+; /* statement terminator, don't delete */
+
+int Cmd_helpTextLen = sizeof(Cmd_helpTextBuf);
+
+
+/*
+ * ======== Cmd_help ========
+ */
+int Cmd_help(char *buf, int size, int seek)
+{
+ char *cp;
+ int nbytes;
+
+ /* reserve space for string terminator */
+ size -= 1;
+
+ /* set current pointer into source buffer */
+ cp = Cmd_helpTextBuf + seek;
+
+ /* compute transfer size */
+ nbytes = Cmd_helpTextLen - seek;
+ nbytes = nbytes > size ? size : nbytes;
+
+ /* copy help text to destination buffer, add string terminator */
+ strncpy(buf, cp, nbytes);
+ buf[nbytes] = '\0';
+
+ return (nbytes);
+}
+
+/*
+ * ======== Cmd_parse ========
+ */
+void Cmd_parse(char *buf, Cmd_Command *cmd)
+{
+ int num;
+ int tokerr = FALSE;
+ char word[32];
+ char arg1[32];
+ char arg2[32];
+
+ /* assume success */
+ cmd->status = 0;
+
+ /* extract first word */
+ num = sscanf(buf, "%s", word);
+
+ if (num == 0) {
+ /* sscan error */
+ cmd->cmd = -1;
+ tokerr = TRUE;
+ goto leave;
+ }
+
+ /* tokenize the command */
+ cmd->cmd = TokenInt(&CmdTab, word, &tokerr);
+
+ switch (cmd->cmd) {
+
+ case Cmd_CONNECT:
+ {
+ struct connect *connect = &cmd->args.connect;
+ num = sscanf(buf, "%*s %s %s", &arg1[0], &arg2[0]);
+ if (num != 2) goto lexerr;
+ connect->source = arg1[0];
+ connect->sink = arg2[0];
+ } break;
+
+ case Cmd_DISCONNECT:
+ {
+ struct disconnect *disconnect = &cmd->args.disconnect;
+ num = sscanf(buf, "%*s %s %s", &arg1[0], &arg2[0]);
+ if (num != 2) goto lexerr;
+ disconnect->source = arg1[0];
+ disconnect->sink = arg2[0];
+ } break;
+
+ case Cmd_EXIT:
+ break;
+
+ case Cmd_HELP:
+ break;
+
+ case Cmd_INFO:
+ num = sscanf(buf, "%*s %s", word);
+ if (num != 1) goto lexerr;
+ cmd->args.info.item = TokenInt(&InfoTab, word, &tokerr);
+ break;
+
+ case Cmd_LAUNCH:
+ {
+ struct launch *launch = &cmd->args.launch;
+ num = sscanf(buf, "%*s %s", word);
+ if (num != 1) goto lexerr;
+ launch->program = TokenInt(&LaunchTab, word, &tokerr);
+ if (!tokerr) {
+ strcpy(launch->name, word);
+ }
+ if ((launch->program == Cmd_TRANSFORMER)
+ || (launch->program == Cmd_COMBINER)) {
+ num = sscanf(buf, "%*s %*s %s", word);
+ if (num != 1) goto lexerr;
+ launch->processor = TokenInt(&ProcessorTab, word, &tokerr);
+ }
+ } break;
+
+ case Cmd_PAUSE:
+ {
+ struct pause *pause = &cmd->args.pause;
+ char node;
+ num = sscanf(buf, "%*s %c", &node);
+ if (num != 1) goto lexerr;
+ pause->node = node;
+ } break;
+
+ case Cmd_RUN:
+ {
+ struct run *run = &cmd->args.run;
+ char node;
+ num = sscanf(buf, "%*s %c", &node);
+ if (num != 1) goto lexerr;
+ run->node = node;
+ } break;
+
+ case Cmd_SHUTDOWN:
+ {
+ struct shutdown *shutdown = &cmd->args.shutdown;
+ num = sscanf(buf, "%*s %s", word);
+ if (num != 1) goto lexerr;
+
+ if (strlen(word) == 1) {
+ shutdown->node = word[0];
+ shutdown->program = -1;
+ }
+ else {
+ shutdown->program = TokenInt(&NodeTab, word, &tokerr);
+ if (tokerr) goto lexerr;
+ }
+ } break;
+
+ case Cmd_STATUS:
+ break;
+
+ default:
+ printf("Cmd_parser: Error: command not implemented\n");
+ break;
+ }
+
+ if ((cmd->cmd == -1) || tokerr) {
+lexerr:
+ printf("Error: invalid argument\n");
+ cmd->cmd = -1;
+ cmd->status = -1;
+ goto leave;
+ }
+
+leave:
+ return;
+}
+
+/*
+ * ======== TokenInt ========
+ */
+int TokenInt(PTable *table, char *word, int *tokerr)
+{
+ int i;
+
+ /* if in error state, do nothing */
+ if (*tokerr) {
+ return (-1);
+ }
+
+ /* search parse table for given word */
+ for (i = 0; i < table->size; i++) {
+ if (strcmp(word, table->tab[i].lexeme) == 0) {
+ return (table->tab[i].value);
+ }
+ }
+
+ /* word not found, enter error state */
+ *tokerr = TRUE;
+ return (-1);
+}
diff --git a/src/examples/templates/ex46_graph/manager/Cmd.h b/src/examples/templates/ex46_graph/manager/Cmd.h
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Cmd.h ========
+ */
+
+#ifndef Cmd__include
+#define Cmd__include
+
+#include <sys/queue.h>
+#include "../shared/SysCfg.h"
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* commands */
+#define Cmd_CONNECT 0xC02 /* source node only, MessageQ_openQueueId */
+#define Cmd_DISCONNECT 0xC04 /* source node only, MessageQ_close */
+#define Cmd_EXIT 0xC05 /* manager only, exit program */
+#define Cmd_HELP 0xC06 /* command object only, list all commands */
+#define Cmd_INFO 0xC07
+#define Cmd_LAUNCH 0xC08 /* manager only, attach host programs */
+#define Cmd_PAUSE 0xC09 /* producer only, stop data pump */
+#define Cmd_RUN 0xC0A /* producer only, start data pump */
+#define Cmd_SHUTDOWN 0xC0B /* one-way message to all nodes */
+#define Cmd_STATUS 0xC0C /* deferred command, ping all nodes */
+
+/* arguments */
+#define Cmd_BASEID 0xA01
+#define Cmd_COMBINER 0xA02
+#define Cmd_CONSUMER 0xA03
+#define Cmd_CLUSTER 0xA04
+#define Cmd_PRODUCER 0xA05
+#define Cmd_START 0xA06
+#define Cmd_STOP 0xA07
+#define Cmd_TRANSFORMER 0xA08
+
+#define Cmd_HOST 0 /* token value matches clusterId */
+#define Cmd_DSP1 1
+#define Cmd_DSP2 2
+#define Cmd_DSP3 3
+#define Cmd_DSP4 4
+#define Cmd_DSP5 5
+#define Cmd_DSP6 6
+#define Cmd_DSP7 7
+#define Cmd_DSP8 8
+
+/* command object */
+typedef struct Cmd_Command {
+ int cmd; /* command token */
+ int reply; /* send reply message */
+ int deferredCount; /* number of replies needed to complete */
+ int status; /* command result status */
+
+ union {
+ struct connect {
+ char source; /* node name */
+ char sink; /* node name */
+ void *progSource; /* source node program context */
+ void *progSink; /* sink node program context */
+ } connect;
+
+ struct disconnect {
+ char source; /* node name */
+ char sink; /* node name */
+ void *progSource; /* deferred command */
+ void *progSink; /* deferred command */
+ } disconnect;
+
+ struct info {
+ int item;
+ int baseId;
+ int size;
+ char names[10][16];
+ } info;
+
+ struct launch {
+ int program;
+ int processor; /* IPC cluster ID */
+ char name[32];
+ } launch;
+
+ struct pause {
+ char node; /* must be a producer node */
+ void *producer; /* deferred command */
+ } pause;
+
+ struct run {
+ char node; /* must be a producer node */
+ } run;
+
+ struct shutdown {
+ int program; /* dsp only: IPC cluster ID */
+ char node; /* only for producer and consumer */
+ void *msg; /* message allocated in command prologue */
+ void *prog; /* program object */
+ } shutdown;
+
+ } args;
+
+ LIST_ENTRY(Cmd_Command) link;
+} Cmd_Command;
+
+/* reserved message queue ID */
+#define Cmd_MSGID SysCfg_Cmd_MSGID
+
+int Cmd_help(char *buf, int size, int seek);
+void Cmd_parse(char *buf, Cmd_Command *cmd);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/manager/Console.c b/src/examples/templates/ex46_graph/manager/Console.c
--- /dev/null
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Console.c ========
+ */
+
+/* standard headers */
+#include <stdio.h> /* printf, fprintf, getline */
+#include <string.h> /* strcpy */
+#include <unistd.h> /* usleep */
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+/* example header files */
+#include <ex45_host/transport/hlos/TransportPMQ.h>
+#include "../shared/ClusterMgr_shared.h"
+#include "Cmd.h"
+
+#define HEAPID 0
+
+/* log helpers */
+extern FILE *cmlog;
+#define LOG fprintf(cmlog,
+#define LOGF ); fflush(cmlog);
+
+/* private functions */
+void doBaseId(Cmd_Command *cmd);
+void doCluster(Cmd_Command *cmd);
+
+/*
+ * ======== Console_threadFxn ========
+ */
+void *Console_threadFxn(void *arg)
+{
+ int status = 0;
+ Bool run = TRUE;
+ char *buf = NULL;
+ size_t nbytes;
+ MessageQ_Handle queue;
+ MessageQ_QueueId cmQue;
+ Cmd_Command *cmd;
+ MessageQ_Msg mqMsg;
+ char text[64];
+ int seek;
+
+ typedef struct {
+ MessageQ_MsgHeader reserved;
+ Cmd_Command cmd;
+ } CommandMsg;
+
+ LOG "Console_threadFxn: -->\n" LOGF
+
+ /* create an anonymous message queue (for reply messages) */
+ queue = MessageQ_create(NULL, NULL);
+
+ if (queue == NULL) {
+ fprintf(stderr, "Error: cannot create message queues\n");
+ goto leave;
+ }
+
+ /* open the cluster manager message queue */
+ do {
+ status = MessageQ_open(ClusterMgr_CMDQUE, &cmQue);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ usleep(60000); /* 60 milliseconds */
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: cannot open cluster manager queue, name=%s "
+ "error=%d\n", ClusterMgr_CMDQUE, status);
+ goto leave;
+ }
+
+ /* main loop */
+ while (run) {
+
+ /* read the next input string */
+ printf("[cm]> ");
+ nbytes = getline(&buf, &nbytes, stdin);
+
+ if (nbytes == 0) {
+ fprintf(stderr, "Error: Console_threadFxn: getline failed\n");
+ status = -1;
+ goto leave;
+ }
+ else if ((nbytes == 1) && (strcmp(buf, "\n") == 0)) {
+ continue;
+ }
+
+ LOG "Console_threadFxn: input: %s", buf LOGF
+
+ /* allocate message to contain command object */
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(CommandMsg));
+
+ /* set return address, identify message type */
+ MessageQ_setReplyQueue(queue, mqMsg);
+ MessageQ_setMsgId(mqMsg, Cmd_MSGID);
+
+ /* all command messages should come back here */
+ cmd = &((CommandMsg *)mqMsg)->cmd;
+ cmd->reply = TRUE;
+
+ /* parse input string into the command object */
+ Cmd_parse(buf, cmd);
+
+ if (cmd->cmd == -1) {
+ /* bad input, try again */
+ MessageQ_free(mqMsg);
+ continue;
+ }
+
+ /* check for exit command */
+ if (cmd->cmd == Cmd_EXIT) {
+ run = FALSE;
+ }
+
+ /* get help text and print to user */
+ else if (cmd->cmd == Cmd_HELP) {
+ seek = 0;
+ do {
+ nbytes = Cmd_help(text, sizeof(text), seek);
+
+ seek += nbytes;
+ if (nbytes > 0) {
+ printf("%s", text);
+ }
+ } while (nbytes > 0);
+
+ /* don't send this command to manager */
+ MessageQ_free(mqMsg);
+ continue;
+ }
+
+ /* send command to manager thread */
+ status = MessageQ_put(cmQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ status = -2;
+ goto leave;
+ }
+
+ /* wait for reply message */
+ status = MessageQ_get(queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message receive failed\n");
+ goto leave;
+ }
+
+ /* process the reply message */
+ cmd = &((CommandMsg *)mqMsg)->cmd;
+
+ if (cmd->status < 0) {
+ printf("Error: invalid input\n");
+ }
+ else if (cmd->cmd == Cmd_INFO) {
+ if (cmd->args.info.item == Cmd_BASEID) {
+ doBaseId(cmd);
+ }
+ else if (cmd->args.info.item == Cmd_CLUSTER) {
+ doCluster(cmd);
+ }
+ }
+
+ MessageQ_free(mqMsg);
+ }
+
+leave:
+ LOG "Console_threadFxn: <-- status=%d\n", status LOGF
+ return ((Void *)status);
+}
+
+/*
+ * ======== doBaseId ========
+ */
+void doBaseId(Cmd_Command *cmd)
+{
+ int baseId;
+
+ baseId = cmd->args.info.baseId;
+ printf("baseId = %d\n", baseId);
+}
+
+/*
+ * ======== doCluster ========
+ */
+void doCluster(Cmd_Command *cmd)
+{
+ struct info *info;
+ int i;
+ int procId;
+ String name;
+
+ info = &cmd->args.info;
+
+ printf("cluster size = %d\n", info->size);
+
+ for (i = 0; i < info->size; i++) {
+ procId = info->baseId + i;
+ name = info->names[i];
+ printf("ProcId %d = \"%s\"\n", procId, name);
+ }
+}
diff --git a/src/examples/templates/ex46_graph/manager/Console.h b/src/examples/templates/ex46_graph/manager/Console.h
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Console.h ========
+ */
+
+#ifndef Console__include
+#define Console__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+void *Console_threadFxn(void *arg);
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/manager/Makefile b/src/examples/templates/ex46_graph/manager/Makefile
--- /dev/null
@@ -0,0 +1,139 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+%%}
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+EXDIR = ../..
+
+.PHONY: manager
+srcs = ClusterMgr.c Cmd.c Console.c manager.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+transport = $(EXDIR)/ex45_host/transport/hlos/lib/$(PROFILE)/transport_pmq.av7A
+libs = $(transport) -L$(DESTDIR)/lib -ltitransportrpmsg -ltiipc -ltiipcutils
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug manager
+# $(MAKE) PROFILE=release manager
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/manager $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/manager $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+manager: bin/$(PROFILE)/manager
+bin/$(PROFILE)/manager: $(objs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I$(DESTDIR)/include -I$(EXDIR)
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex46_graph/manager/manager.c b/src/examples/templates/ex46_graph/manager/manager.c
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== manager.c ========
+ */
+
+/* standard headers */
+#include <fcntl.h>
+#include <pthread.h> /* pthread_create, pthread_join */
+#include <stdio.h> /* fopen, fclose, fileno, fprintf */
+#include <unistd.h> /* fcntl */
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+/* example header files */
+#include <ex45_host/transport/hlos/TransportPMQ.h>
+#include "../shared/SysCfg.h"
+#include "ClusterMgr.h"
+#include "Console.h"
+
+/* log helpers */
+#define CMLOG "/tmp/cmlog.txt"
+#define LOG fprintf(cmlog,
+#define LOGF ); fflush(cmlog);
+FILE *cmlog = NULL;
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ int status = 0;
+ pthread_t cmThr; /* cluster manager */
+ int cmArg;
+ int cmStatus = 0;
+ pthread_t conThr; /* console */
+ int conArg;
+ int conStatus = 0;
+ int fdlog;
+ int flags;
+ ITransport_Handle transport;
+ INetworkTransport_Handle transNetwork;
+ TransportPMQ_Handle transPMQ;
+
+ /* open log file */
+ cmlog = fopen(CMLOG, "w");
+
+ if (cmlog == NULL) {
+ fprintf(stderr, "Error: unable to open log file, %s\n", CMLOG);
+ status = -1;
+ goto leave;
+ }
+
+ /* set the close on exec flag for the log file */
+ fdlog = fileno(cmlog);
+ flags = fcntl(fdlog, F_GETFD);
+
+ if (flags == -1) {
+ fprintf(stderr, "Error: unable to read log flags\n");
+ status = -1;
+ goto leave;
+ }
+
+ status = fcntl(fdlog, F_SETFD, flags | FD_CLOEXEC);
+
+ if (status == -1) {
+ fprintf(stderr, "Error: unable to write log flags\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+ /* initialize IPC */
+ LOG "main: IPC init\n" LOGF
+ status = Ipc_start();
+
+ if (status < 0) {
+ fprintf(stderr, "Error: IPC init failed, error=%d\n", status);
+ goto leave;
+ }
+
+ /* setup the TransportPMQ module */
+ LOG "main: TransportPMQ setup\n" LOGF
+ status = TransportPMQ_setup();
+
+ if (status < 0) {
+ status = -1;
+ fprintf(stderr, "Error: TransportPMQ setup failed\n");
+ goto leave;
+ }
+ transPMQ = TransportPMQ_handle();
+
+ /* register transport with MessageQ */
+ transNetwork = TransportPMQ_upCast(transPMQ);
+ transport = INetworkTransport_upCast(transNetwork);
+ MessageQ_registerTransportId(SysCfg_TRANSPORT_PMQ_ID, transport);
+
+ /* IPC is now ready */
+ LOG "main: IPC ready, status=%d\n", status LOGF
+
+ /* start the manager thread */
+ status = pthread_create(&cmThr, NULL, &ClusterMgr_threadFxn, &cmArg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: cluster manager failed\n");
+ goto leave;
+ }
+
+ /* start the console thread */
+ status = pthread_create(&conThr, NULL, &Console_threadFxn, &conArg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: console failed\n");
+ goto leave;
+ }
+
+ /* wait for manager thread to shutdown */
+ pthread_join(cmThr, (void **)(&cmStatus));
+
+ /* wait for console thread to shutdown */
+ pthread_join(conThr, (void **)(&conStatus));
+
+ status = ((cmStatus < 0) || (conStatus < 0)) ? -1 : 0;
+
+ /* finalize the secondary transport */
+ MessageQ_unregisterTransportId(SysCfg_TRANSPORT_PMQ_ID);
+ TransportPMQ_destroy();
+
+ /* finalize IPC */
+ Ipc_stop();
+
+leave:
+ LOG "main: cmStatus=%d\n", cmStatus LOGF
+ LOG "main: conStatus=%d\n", conStatus LOGF
+ LOG "main: <-- status=%d\n", status LOGF
+ fclose(cmlog);
+
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/mkpkg.xdt b/src/examples/templates/ex46_graph/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,73 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (this.platform.match(/^TCI6638_linux_elf$/)) {
+% /* OK */
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
+
+Makefile -> `this.example`/Makefile
+products.mak -> `this.example`/products.mak
+readme.txt -> `this.example`/readme.txt @verbatim
+IPC_Example_ex46_graph.pptx -> `this.example`/IPC_Example_ex46_graph.pptx @verbatim
+
+combiner/CombinerN.cfg -> `this.example`/combiner/CombinerN.cfg
+combiner/CombinerN.h -> `this.example`/combiner/CombinerN.h
+combiner/Ctrl.c -> `this.example`/combiner/Ctrl.c
+combiner/Ctrl.h -> `this.example`/combiner/Ctrl.h
+combiner/MainDspN.c -> `this.example`/combiner/MainDspN.c
+combiner/Makefile -> `this.example`/combiner/Makefile
+combiner/Xfm.c -> `this.example`/combiner/Xfm.c
+combiner/Xfm.h -> `this.example`/combiner/Xfm.h
+
+consumer/Consumer.h -> `this.example`/consumer/Consumer.h
+consumer/Ctrl.c -> `this.example`/consumer/Ctrl.c
+consumer/Ctrl.h -> `this.example`/consumer/Ctrl.h
+consumer/Makefile -> `this.example`/consumer/Makefile
+consumer/Sink.c -> `this.example`/consumer/Sink.c
+consumer/Sink.h -> `this.example`/consumer/Sink.h
+consumer/main.c -> `this.example`/consumer/main.c
+
+manager/ClusterMgr.c -> `this.example`/manager/ClusterMgr.c
+manager/ClusterMgr.h -> `this.example`/manager/ClusterMgr.h
+manager/Cmd.c -> `this.example`/manager/Cmd.c
+manager/Cmd.h -> `this.example`/manager/Cmd.h
+manager/Console.c -> `this.example`/manager/Console.c
+manager/Console.h -> `this.example`/manager/Console.h
+manager/Makefile -> `this.example`/manager/Makefile
+manager/manager.c -> `this.example`/manager/manager.c
+
+producer/Ctrl.c -> `this.example`/producer/Ctrl.c
+producer/Ctrl.h -> `this.example`/producer/Ctrl.h
+producer/main.c -> `this.example`/producer/main.c
+producer/Makefile -> `this.example`/producer/Makefile
+producer/Producer.h -> `this.example`/producer/Producer.h
+producer/Pump.c -> `this.example`/producer/Pump.c
+producer/Pump.h -> `this.example`/producer/Pump.h
+producer/Sensor.c -> `this.example`/producer/Sensor.c
+producer/Sensor.h -> `this.example`/producer/Sensor.h
+
+scripts/patchExec.pl -> `this.example`/scripts/patchExec.pl @verbatim
+scripts/run_lad.sh -> `this.example`/scripts/run_lad.sh
+scripts/run_patch_combiner.sh -> `this.example`/scripts/run_patch_combiner.sh
+scripts/run_patch_transformer.sh -> `this.example`/scripts/run_patch_transformer.sh
+
+shared/ClusterMgr_shared.h -> `this.example`/shared/ClusterMgr_shared.h
+shared/Data.h -> `this.example`/shared/Data.h
+shared/Graph.h -> `this.example`/shared/Graph.h
+shared/SysCfg.h -> `this.example`/shared/SysCfg.h
+shared/config.bld -> `this.example`/shared/config.bld
+
+transformer/Ctrl.c -> `this.example`/transformer/Ctrl.c
+transformer/Ctrl.h -> `this.example`/transformer/Ctrl.h
+transformer/MainDspN.c -> `this.example`/transformer/MainDspN.c
+transformer/Makefile -> `this.example`/transformer/Makefile
+transformer/TransformerN.cfg -> `this.example`/transformer/TransformerN.cfg
+transformer/TransformerN.h -> `this.example`/transformer/TransformerN.h
+transformer/Xfm.c -> `this.example`/transformer/Xfm.c
+transformer/Xfm.h -> `this.example`/transformer/Xfm.h
diff --git a/src/examples/templates/ex46_graph/producer/Ctrl.c b/src/examples/templates/ex46_graph/producer/Ctrl.c
--- /dev/null
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.c ========
+ */
+
+/* standard headers */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+/* example header files */
+#include <ex45_host/transport/hlos/TransportPMQ.h>
+#include "Ctrl.h"
+#include "Pump.h"
+#include "Producer.h"
+#include "../shared/Graph.h"
+#include "../shared/SysCfg.h"
+
+#define BUFSZ 64
+
+
+/* module structure */
+typedef struct {
+ Char node; /* node name */
+ Bool run; /* main loop run flag */
+ Bool dataOn; /* data flowing flag */
+ MessageQ_Handle queue; /* inbound message queue */
+} Ctrl_Module;
+
+/* private functions */
+void Ctrl_destroy(void);
+int Ctrl_exec(void);
+int Ctrl_setup(Ctrl_Arg *arg);
+
+/* private data */
+static Ctrl_Module Ctrl_mod = {
+ .node = '-',
+ .run = FALSE,
+ .dataOn = FALSE,
+ .queue = NULL
+};
+
+/*
+ * ======== Ctrl_threadFxn ========
+ */
+void *Ctrl_threadFxn(void *param)
+{
+ int status = 0;
+ Ctrl_Arg *arg = (Ctrl_Arg *)param;
+
+ /* setup phase */
+ status = Ctrl_setup(arg);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Ctrl_exec();
+
+leave:
+ /* shutdown phase */
+ Ctrl_destroy();
+
+ return ((void *)status);
+}
+
+/*
+ * ======== Ctrl_destroy ========
+ */
+void Ctrl_destroy(void)
+{
+ /* wait until the pump module is finished using IPC */
+ while (!Pump_ipcDone()) {
+ usleep(100000); /* 0.1 seconds */
+ }
+
+ /* delete the message queue */
+ MessageQ_delete(&Ctrl_mod.queue);
+
+ /* finalize the secondary transport */
+ MessageQ_unregisterTransportId(SysCfg_TRANSPORT_PMQ_ID);
+ TransportPMQ_destroy();
+
+ /* finalize IPC */
+ Ipc_stop();
+}
+
+/*
+ * ======== Ctrl_exec ========
+ */
+int Ctrl_exec(void)
+{
+ Int status;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ Graph_Msg *msg;
+
+ Ctrl_mod.run = TRUE;
+
+ /* main loop */
+ while (Ctrl_mod.run) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Ctrl_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Ctrl_mod.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ fprintf(stderr, "Error: Ctrl_exec: message receive failed, "
+ "error=%d\n", status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (Graph_Msg *)mqMsg;
+
+ switch (msg->cmd) {
+
+ case Graph_Cmd_ATTACH:
+ /* host attach to dsp */
+ status = Ipc_attach(msg->uarg1);
+ if (status < 0) {
+ fprintf(stderr, "Error: Ipc_attach(%d) failed\n",
+ msg->uarg1);
+ }
+ break;
+
+ case Graph_Cmd_DATAQUERY:
+ msg->arg1 = (Ctrl_mod.dataOn ? 1 : 0);
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_DETACH:
+ /* host detach from dsp */
+ status = Ipc_detach(msg->uarg1);
+ if (status < 0) {
+ fprintf(stderr, "Error: Ipc_detach(%d) failed\n",
+ msg->uarg1);
+ }
+ break;
+
+ case Graph_Cmd_INPUTCONNECT:
+ msg->status = Graph_E_FAIL;
+ break;
+
+ case Graph_Cmd_INPUTDISCONNECT:
+ msg->status = Graph_E_FAIL;
+ break;
+
+ case Graph_Cmd_OUTPUTCONNECT:
+ Pump_openDataSink(msg->uarg1, msg->uarg2);
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_OUTPUTDISCONNECT:
+ Pump_closeDataSink();
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_PAUSE:
+ Ctrl_mod.dataOn = FALSE;
+ Pump_stop();
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_RUN:
+ Ctrl_mod.dataOn = TRUE;
+ Pump_go();
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_SHUTDOWN:
+ Pump_shutdown();
+ Ctrl_mod.run = FALSE;
+ break;
+
+ default:
+ fprintf(stderr, "Error: Ctrl_exec: unknown command, "
+ "cmd=%d", msg->cmd);
+ break;
+ }
+
+ if (msg->reply) {
+ /* return the message to sender */
+ msg->reply = FALSE;
+ msg->ack = TRUE;
+ qid = MessageQ_getReplyQueue(mqMsg);
+
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ status = -2;
+ goto leave;
+ }
+ }
+ else {
+ /* free message here */
+ MessageQ_free(mqMsg);
+ }
+ }
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== Ctrl_setup ========
+ */
+int Ctrl_setup(Ctrl_Arg *arg)
+{
+ Int status = 0;
+ TransportPMQ_Handle transPMQ;
+ ITransport_Handle transport;
+ INetworkTransport_Handle transNetwork;
+ char qname[BUFSZ];
+ MessageQ_Params msgqParams;
+
+ /* initialize module state */
+ Ctrl_mod.node = arg->n;
+ Ctrl_mod.run = FALSE;
+ Ctrl_mod.dataOn = FALSE;
+ Ctrl_mod.queue = NULL;
+
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+
+ /* initialize IPC */
+ status = Ipc_start();
+
+ if (status < 0) {
+ fprintf(stderr, "Error: IPC init failed, error=%d\n", status);
+ goto leave;
+ }
+
+ /* setup the TransportPMQ module */
+ status = TransportPMQ_setup();
+
+ if (status < 0) {
+ status = -1;
+ fprintf(stderr, "Error: TransportPMQ setup failed\n");
+ goto leave;
+ }
+ transPMQ = TransportPMQ_handle();
+
+ /* register transport with MessageQ */
+ transNetwork = TransportPMQ_upCast(transPMQ);
+ transport = INetworkTransport_upCast(transNetwork);
+ MessageQ_registerTransportId(SysCfg_TRANSPORT_PMQ_ID, transport);
+
+ /* inform pump module that IPC is ready */
+ Pump_ipcIsReady();
+
+ /* create message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ snprintf(qname, BUFSZ, Producer_CMDQUE_FMT, Ctrl_mod.node);
+ Ctrl_mod.queue = MessageQ_create(qname, &msgqParams);
+
+ if (Ctrl_mod.queue == NULL) {
+ status = -2;
+ fprintf(stderr, "Error: message queue create failed\n");
+ goto leave;
+ }
+
+leave:
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/producer/Ctrl.h b/src/examples/templates/ex46_graph/producer/Ctrl.h
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.h ========
+ */
+
+#ifndef Ctrl__include
+#define Ctrl__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct {
+ char n; /* node name */
+} Ctrl_Arg;
+
+void *Ctrl_threadFxn(void *arg);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/producer/Makefile b/src/examples/templates/ex46_graph/producer/Makefile
--- /dev/null
@@ -0,0 +1,139 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+%%}
+
+#
+# ======== Makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
+EXDIR = ../..
+
+.PHONY: producer
+srcs = Ctrl.c Pump.c Sensor.c main.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
+transport = $(EXDIR)/ex45_host/transport/hlos/lib/$(PROFILE)/transport_pmq.av7A
+libs = -L$(DESTDIR)/lib -ltitransportrpmsg -ltiipc -ltiipcutils
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug producer
+# $(MAKE) PROFILE=release producer
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/producer $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/producer $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+producer: bin/$(PROFILE)/producer
+bin/$(PROFILE)/producer: $(objs) $(transport)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(libs) $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.ov7A: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I$(DESTDIR)/include -I$(EXDIR)
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$(@D)/obj/$(@F).map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex46_graph/producer/Producer.h b/src/examples/templates/ex46_graph/producer/Producer.h
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Producer.h ========
+ */
+
+#ifndef Producer__include
+#define Producer__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#define Producer_CMDQUE_FMT "ProducerCmdQue%c"
+#define Producer_LAUNCH_FMT "./producer %c %d"
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/producer/Pump.c b/src/examples/templates/ex46_graph/producer/Pump.c
--- /dev/null
@@ -0,0 +1,553 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Pump.c ========
+ */
+
+/* Standard headers */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/eventfd.h> /* eventfd */
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/interfaces/ITransport.h>
+#include <ti/ipc/interfaces/INetworkTransport.h>
+#include <ti/ipc/transports/TransportRpmsg.h>
+
+/* example header files */
+#include "Pump.h"
+#include "Sensor.h"
+#include "Producer.h"
+#include "../shared/ClusterMgr_shared.h"
+#include "../shared/Graph.h"
+#include "../shared/Data.h"
+#include "../shared/SysCfg.h"
+
+
+#define HEAPID 0
+
+#define SENSOR_POOLSZ 3 /* sensor message pool, min = 3 */
+#define PIPELINE_POOLSZ 1 /* message pipeline pool, min = 1 */
+#define DESC_POOLSZ (SENSOR_POOLSZ + PIPELINE_POOLSZ)
+
+/* data sink context */
+typedef struct {
+ UInt16 procId;
+ MessageQ_QueueIndex qidx; /* queue index value */
+ MessageQ_QueueId dstQue; /* data-sink message queue */
+ Int transId; /* message transport ID */
+} DataSink;
+
+TAILQ_HEAD(DescList, Sensor_BufDesc);
+
+/* module structure */
+typedef struct {
+ Char node; /* node name */
+ Bool run; /* main loop run flag */
+ Bool dataOn; /* data flowing flag */
+ Bool okayToSignal; /* indicates eventfd is created */
+ Bool ipcReady; /* IPC ready flag */
+ int waitEvent;
+ MessageQ_QueueIndex queIndex; /* reserved queue index */
+ MessageQ_Handle queue; /* return message queue */
+ MessageQ_QueueId cmQue; /* cluster manager message queue */
+ struct DescList descList; /* list of available descriptors */
+ DataSink sink; /* data-sink object */
+ unsigned int dataBlockSN; /* data block serial number */
+} Pump_Module;
+
+/* private functions */
+static void Pump_destroy(void);
+static int Pump_exec(void);
+static void Pump_sendInfoMsg(void);
+static int Pump_setup(Pump_Arg *arg);
+
+static Sensor_BufDesc bufDescPool[DESC_POOLSZ];
+
+/* private data */
+static Pump_Module Pump_mod = {
+ .node = '-',
+ .run = FALSE,
+ .dataOn = FALSE,
+ .okayToSignal = FALSE,
+ .ipcReady = FALSE,
+ .waitEvent = -1,
+ .queue = NULL,
+ .cmQue = MessageQ_INVALIDMESSAGEQ,
+ .sink.procId = MultiProc_INVALIDID,
+ .sink.qidx = MessageQ_INVALIDMESSAGEQ,
+ .sink.dstQue = MessageQ_INVALIDMESSAGEQ,
+ .sink.transId = 0,
+ .dataBlockSN = 0
+};
+
+/*
+ * ======== Pump_threadFxn ========
+ */
+void *Pump_threadFxn(void *param)
+{
+ int status = 0;
+ Pump_Arg *arg = (Pump_Arg *)param;
+
+ /* setup phase */
+ status = Pump_setup(arg);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Pump_exec();
+
+leave:
+ /* shutdown phase */
+ Pump_destroy();
+
+ return ((void *)status);
+}
+
+/*
+ * ======== Pump_closeDataSink ========
+ */
+int Pump_closeDataSink(void)
+{
+ int status = 0;
+
+ MessageQ_close(&Pump_mod.sink.dstQue);
+
+ Pump_mod.sink.procId = MultiProc_INVALIDID;
+ Pump_mod.sink.qidx = MessageQ_INVALIDMESSAGEQ;
+ Pump_mod.sink.transId = 0;
+
+ return (status);
+}
+
+/*
+ * ======== Pump_go ========
+ */
+void Pump_go(void)
+{
+ Pump_mod.dataOn = TRUE;
+ Sensor_start();
+}
+
+/*
+ * ======== Pump_ipcDone ========
+ */
+int Pump_ipcDone(void)
+{
+ return (Pump_mod.ipcReady ? 0 : 1);
+}
+
+/*
+ * ======== Pump_ipcIsReady ========
+ * Inform this module that IPC is ready
+ *
+ * This function is called from another execution context. Must
+ * be careful to ensure local resources have been created.
+ */
+void Pump_ipcIsReady(void)
+{
+ uint64_t value = 1;
+
+ Pump_mod.ipcReady = TRUE;
+
+ /* event might not yet exist, must check if okay to signal */
+ if (Pump_mod.okayToSignal) {
+ write(Pump_mod.waitEvent, &value, sizeof(value));
+ }
+}
+
+/*
+ * ======== Pump_openDataSink ========
+ */
+int Pump_openDataSink(UInt16 procId, UInt16 queueIndex)
+{
+ int status = 0;
+
+ Pump_mod.sink.procId = procId;
+ Pump_mod.sink.qidx = queueIndex;
+
+ /* determine which transport to use */
+ if (procId == MultiProc_getId("HOST")) {
+ Pump_mod.sink.transId = SysCfg_TRANSPORT_PMQ_ID;
+ }
+ else {
+ Pump_mod.sink.transId = 0;
+ }
+
+ /* open the destination message queue (reserved ) */
+ Pump_mod.sink.dstQue = MessageQ_openQueueId(queueIndex, procId);
+
+ return (status);
+}
+
+/*
+ * ======== Pump_shutdown ========
+ */
+void Pump_shutdown(void)
+{
+ Pump_mod.run = FALSE;
+}
+
+/*
+ * ======== Pump_stop ========
+ */
+void Pump_stop(void)
+{
+ Sensor_stop();
+ Pump_mod.dataOn = FALSE;
+}
+
+/*
+ * ======== Pump_destroy ========
+ */
+static void Pump_destroy(void)
+{
+ int status;
+ int i;
+ MessageQ_Msg mqMsg;
+ Sensor_BufDesc *bufDesc;
+ Data_Buffer *dataBuf;
+
+ /* reclaim messages from the pipeline */
+ for (i = 1; i <= PIPELINE_POOLSZ; i++) {
+ status = MessageQ_get(Pump_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Pump_mod.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ fprintf(stderr, "Error: Pump_exec: message receive failed, "
+ "error=%d\n", status);
+ goto leave;
+ }
+ MessageQ_free(mqMsg);
+ }
+
+ /* reclaim messages from the sensor buffer pool */
+ for (i = 1; i <= SENSOR_POOLSZ; i++) {
+
+ /* recall buffer from sensor */
+ Sensor_recall(&bufDesc);
+
+ /* unbind descriptor from buffer */
+ dataBuf = Data_DBADDR(bufDesc->buffer);
+ mqMsg = Data_MQADDR(dataBuf);
+ bufDesc->buffer = NULL;
+ bufDesc->size = 0;
+ bufDesc->count = 0;
+
+ /* put buffer descriptor back onto the available list */
+ TAILQ_INSERT_HEAD(&Pump_mod.descList, bufDesc, link);
+
+ /* free the buffer */
+ MessageQ_free(mqMsg);
+ }
+
+ /* tell sensor module we are done with it */
+ Sensor_done();
+
+ /* delete the message queue */
+ MessageQ_delete(&Pump_mod.queue);
+
+ /* done using IPC */
+ Pump_mod.ipcReady = FALSE;
+
+ /* close wait event */
+ close(Pump_mod.waitEvent);
+
+leave:
+ return;
+}
+
+/*
+ * ======== Pump_exec ========
+ */
+static int Pump_exec(void)
+{
+ Int status;
+ MessageQ_Msg mqMsg;
+ Data_Buffer *dataBuf;
+ Sensor_BufDesc *bufDesc;
+
+ /* start the sensor running */
+ Pump_mod.run = TRUE;
+
+ /* main loop */
+ while (Pump_mod.run) {
+
+ /* wait for go command */
+ if (!Pump_mod.dataOn) {
+ usleep(500000); /* 0.5 seconds */
+ continue;
+ }
+
+ /* ensure we have a valid connection */
+ if (Pump_mod.sink.dstQue == MessageQ_INVALIDMESSAGEQ) {
+ /* TODO raise error */
+ continue;
+ }
+
+ /* wait for return message */
+ status = MessageQ_get(Pump_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Pump_mod.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ fprintf(stderr, "Error: Pump_exec: message receive failed, "
+ "error=%d\n", status);
+ goto leave;
+ }
+
+ /* get next available buffer descriptor */
+ bufDesc = Pump_mod.descList.tqh_first;
+ TAILQ_REMOVE(&Pump_mod.descList, bufDesc, link);
+
+ /* bind descriptor to empty buffer */
+ dataBuf = &((Data_Msg *)mqMsg)->data;
+ bufDesc->buffer = dataBuf->buffer;
+ bufDesc->size = Data_BUFSZ;
+ bufDesc->count = 0;
+
+ /* submit empty buffer to sensor */
+ Sensor_issue(bufDesc);
+
+ /* request full buffer from sensor module */
+ Sensor_reclaim(&bufDesc);
+ Pump_mod.dataBlockSN++;
+
+ /* update data buffer with number of elements returned */
+ dataBuf = Data_DBADDR(bufDesc->buffer);
+ dataBuf->count = bufDesc->count;
+
+ /* unbind descriptor from buffer */
+ bufDesc->buffer = NULL;
+ bufDesc->size = 0;
+ bufDesc->count = 0;
+
+ /* put buffer descriptor back onto the available list */
+ TAILQ_INSERT_HEAD(&Pump_mod.descList, bufDesc, link);
+
+ /* send data message to destination queue for processing */
+ mqMsg = Data_MQADDR(dataBuf);
+ MessageQ_setMsgId(mqMsg, Data_MSGID);
+ MessageQ_setTransportId(mqMsg, Pump_mod.sink.transId);
+ MessageQ_setReplyQueue(Pump_mod.queue, mqMsg);
+
+ status = MessageQ_put(Pump_mod.sink.dstQue, mqMsg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: message send failed\n");
+ /* TODO */
+ continue;
+ }
+
+ /* send info message to cluster manager */
+ if ((Pump_mod.dataBlockSN % 10) == 0) {
+ Pump_sendInfoMsg();
+ }
+ }
+
+ /* shutdown the sensor */
+ Sensor_shutdown();
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== Pump_sendInfoMsg ========
+ */
+static void Pump_sendInfoMsg(void)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ /* TODO */
+ goto leave;
+ }
+
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+ MessageQ_setTransportId(mqMsg, SysCfg_TRANSPORT_PMQ_ID);
+
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_INFO;
+ msg->dcid = 0;
+ msg->reply = FALSE;
+ msg->arg1 = (Int)Pump_mod.node;
+ msg->uarg1 = Pump_mod.dataBlockSN;
+
+ status = MessageQ_put(Pump_mod.cmQue, mqMsg);
+
+ if (status < 0) {
+ /* TODO */
+ goto leave;
+ }
+
+leave:
+ return;
+}
+
+/*
+ * ======== Pump_setup ========
+ */
+static int Pump_setup(Pump_Arg *arg)
+{
+ int status = 0;
+ int i;
+ Data_Buffer *data;
+ uint64_t value;
+ Sensor_BufDesc *bufDesc;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ MessageQ_Params msgqParams;
+
+ /* ensure dependencies are ready */
+ while (!Sensor_isReady()) {
+ usleep(60000); /* 60 milliseconds */
+ }
+
+ /* initialize module state */
+ Pump_mod.node = arg->node;
+ Pump_mod.queIndex = arg->queIdx;
+
+ /* put buffer descriptors onto the available list */
+ for (i = 0; i < DESC_POOLSZ; i++) {
+ bufDesc = &bufDescPool[i];
+ TAILQ_INSERT_HEAD(&Pump_mod.descList, bufDesc, link);
+ }
+
+ /* create event object */
+ Pump_mod.waitEvent = eventfd(0, 0);
+
+ if (Pump_mod.waitEvent == -1) {
+ perror("Pump_setup: create eventfd failed");
+ status = -1;
+ goto leave;
+ }
+
+ Pump_mod.okayToSignal = TRUE;
+
+ /* wait here until IPC is ready */
+ if (!Pump_mod.ipcReady) {
+ read(Pump_mod.waitEvent, &value, sizeof(value));
+ }
+
+ /* create reserved message queue (return messages) */
+ MessageQ_Params_init(&msgqParams);
+ msgqParams.queueIndex = Pump_mod.queIndex;
+
+ Pump_mod.queue = MessageQ_create(NULL, &msgqParams);
+
+ if (Pump_mod.queue == NULL) {
+ status = -2;
+ fprintf(stderr, "Error: message queue create failed\n");
+ goto leave;
+ }
+
+ /* open the cluster manager message queue */
+ do {
+ status = MessageQ_open(ClusterMgr_CMDQUE, &Pump_mod.cmQue);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ usleep(60000); /* 60 milliseconds */
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: cannot open cluster manager queue, name=%s "
+ "error=%d\n", ClusterMgr_CMDQUE, status);
+ goto leave;
+ }
+
+ /* allocate messages for the sensor buffer pool */
+ for (i = 1; i <= SENSOR_POOLSZ; i++) {
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Data_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* get next available buffer descriptor */
+ bufDesc = Pump_mod.descList.tqh_first;
+ TAILQ_REMOVE(&Pump_mod.descList, bufDesc, link);
+
+ /* bind descriptor to empty buffer */
+ data = &((Data_Msg *)mqMsg)->data;
+ bufDesc->size = Data_BUFSZ;
+ bufDesc->buffer = data->buffer;
+ bufDesc->count = 0; /* empty buffer */
+
+ /* submit empty buffer to sensor */
+ Sensor_issue(bufDesc);
+ }
+
+ /* allocate messages to prime the pipeline */
+ qid = MessageQ_getQueueId(Pump_mod.queue);
+
+ for (i = 1; i <= PIPELINE_POOLSZ; i++) {
+ mqMsg = MessageQ_alloc(HEAPID, sizeof(Data_Msg));
+
+ if (mqMsg == NULL) {
+ fprintf(stderr, "Error: message alloc failed\n");
+ status = -1;
+ goto leave;
+ }
+
+ MessageQ_put(qid, mqMsg);
+ }
+
+leave:
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/producer/Pump.h b/src/examples/templates/ex46_graph/producer/Pump.h
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Pump.h ========
+ */
+
+#ifndef Pump__include
+#define Pump__include
+
+#include <ti/ipc/MessageQ.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct {
+ char node; /* node name */
+ int queIdx; /* reserved queue index */
+} Pump_Arg;
+
+void *Pump_threadFxn(void *arg);
+
+int Pump_closeDataSink(void);
+void Pump_go(void);
+int Pump_ipcDone(void);
+void Pump_ipcIsReady(void);
+int Pump_openDataSink(UInt16 procId, UInt16 queueIndex);
+void Pump_shutdown(void);
+void Pump_stop(void);
+
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/producer/Sensor.c b/src/examples/templates/ex46_graph/producer/Sensor.c
--- /dev/null
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Sensor.c ========
+ */
+
+/* Standard headers */
+#include <assert.h> /* assert */
+#include <errno.h>
+#include <pthread.h> /* mutex */
+#include <stdio.h>
+#include <stdlib.h> /* malloc */
+#include <unistd.h>
+#include <sys/eventfd.h> /* event object */
+#include <sys/queue.h> /* LIST macros */
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+/* example header files */
+#include "Sensor.h"
+#include "../shared/ClusterMgr_shared.h"
+#include "../shared/Data.h"
+#include "../shared/Graph.h"
+#include "../shared/SysCfg.h"
+
+#define HEAPID 0
+
+#define Event_DONE (1 << 0)
+#define Event_SHUTDOWN (1 << 1)
+#define Event_START (1 << 2)
+
+
+TAILQ_HEAD(DataList, Sensor_BufDesc);
+
+/* module structure */
+typedef struct {
+ Bool ready; /* module is ready for use */
+ Int refCount; /* reference count */
+ pthread_mutex_t gate; /* module gate */
+ Bool run; /* main loop control */
+ Bool dataOn; /* data flow flag */
+ /* TODO make this into a LIST object */
+ struct DataList empty; /* list of empty buffers */
+ struct DataList full; /* queue of full buffers */
+ int availCount; /* counting semaphore (fd) */
+ int waitEvent; /* event object */
+} Sensor_Module;
+
+/* private functions */
+static int Sensor_exec(void);
+
+/* private data */
+static Sensor_Module Sensor_mod = {
+ .ready = FALSE,
+ .refCount = 0,
+ .gate = PTHREAD_MUTEX_INITIALIZER,
+ .run = FALSE,
+ .dataOn = FALSE,
+ .availCount = -1,
+ .waitEvent = -1
+};
+
+
+/*
+ * ======== Sensor_threadFxn ========
+ */
+void *Sensor_threadFxn(void *arg)
+{
+ int status = 0;
+
+ /* setup phase */
+ status = Sensor_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Sensor_exec();
+
+leave:
+ /* shutdown phase */
+ Sensor_destroy();
+
+ return ((void *)status);
+}
+
+/*
+ * ======== Sensor_done ========
+ */
+void Sensor_done(void)
+{
+ uint64_t value = Event_DONE;
+
+ write(Sensor_mod.waitEvent, &value, sizeof(value));
+}
+
+/*
+ * ======== Sensor_isReady ========
+ */
+int Sensor_isReady(void)
+{
+ return (Sensor_mod.ready ? 1 : 0);
+}
+
+/*
+ * ======== Sensor_issue ========
+ */
+void Sensor_issue(Sensor_BufDesc *desc)
+{
+ pthread_mutex_lock(&Sensor_mod.gate);
+ TAILQ_INSERT_HEAD(&Sensor_mod.empty, desc, link);
+ pthread_mutex_unlock(&Sensor_mod.gate);
+}
+
+/*
+ * ======== Sensor_recall ========
+ */
+void Sensor_recall(Sensor_BufDesc **pdesc)
+{
+ /* same work as reclaim, but different semantics */
+ Sensor_reclaim(pdesc);
+}
+
+/*
+ * ======== Sensor_reclaim ========
+ */
+void Sensor_reclaim(Sensor_BufDesc **pdesc)
+{
+ uint64_t count;
+ Sensor_BufDesc *desc;
+
+ /* wait on counting semaphore until there is an available buffer */
+ read(Sensor_mod.availCount, &count, sizeof(count));
+
+ pthread_mutex_lock(&Sensor_mod.gate);
+
+ /* remove next full buffer */
+ desc = Sensor_mod.full.tqh_first;
+ TAILQ_REMOVE(&Sensor_mod.full, desc, link);
+
+ pthread_mutex_unlock(&Sensor_mod.gate);
+
+ /* return buffer */
+ *pdesc = desc;
+}
+
+/*
+ * ======== Sensor_shutdown ========
+ */
+void Sensor_shutdown(void)
+{
+ uint64_t value = Event_SHUTDOWN;
+
+ Sensor_mod.run = FALSE;
+ write(Sensor_mod.waitEvent, &value, sizeof(value));
+}
+
+/*
+ * ======== Sensor_start ========
+ */
+void Sensor_start(void)
+{
+ uint64_t value = Event_START;
+
+ Sensor_mod.dataOn = TRUE;
+ write(Sensor_mod.waitEvent, &value, sizeof(value));
+}
+
+/*
+ * ======== Sensor_stop ========
+ */
+void Sensor_stop(void)
+{
+ Sensor_mod.dataOn = FALSE;
+}
+
+/*
+ * ======== Sensor_destroy ========
+ */
+void Sensor_destroy(void)
+{
+ pthread_mutex_lock(&Sensor_mod.gate);
+
+ /* ensure only last thread performs stop procedure */
+ if (--Sensor_mod.refCount > 0) {
+ goto leave;
+ }
+
+ /* close the event objects */
+ close(Sensor_mod.waitEvent);
+ close(Sensor_mod.availCount);
+
+leave:
+ pthread_mutex_unlock(&Sensor_mod.gate);
+ return;
+}
+
+/*
+ * ======== Sensor_exec ========
+ */
+static int Sensor_exec(void)
+{
+ int status = 0;
+ int emptyBuf;
+ int i;
+ uint64_t value;
+ Sensor_BufDesc *desc;
+
+ /* wait here until the application buffers have been submitted */
+ read(Sensor_mod.waitEvent, &value, sizeof(value));
+
+ /* never got started, shutdown requested */
+ if (value & Event_SHUTDOWN) {
+ goto transfer;
+ }
+
+ /* prime the pipeline */
+ pthread_mutex_lock(&Sensor_mod.gate);
+ desc = Sensor_mod.empty.tqh_first;
+ TAILQ_REMOVE(&Sensor_mod.empty, desc, link);
+ pthread_mutex_unlock(&Sensor_mod.gate);
+
+ Sensor_mod.run = TRUE;
+
+ /* ==== main loop ==== */
+ while (Sensor_mod.run) {
+
+ /* wait for start command */
+ if (!Sensor_mod.dataOn) {
+ read(Sensor_mod.waitEvent, &value, sizeof(value));
+
+ if (value & Event_SHUTDOWN) {
+ /* todo */
+ }
+ continue;
+ }
+
+ /* ==== simulate the time it takes to collect the data ==== */
+ usleep(200000); /* 0.2 seconds */
+
+ for (i = 0; i < desc->size; i++) {
+ desc->buffer[i] = 0x10002000;
+ }
+ desc->count = i;
+
+ /* enter the data gate */
+ pthread_mutex_lock(&Sensor_mod.gate);
+
+ /* ==== place the sensor buffer on full list ====
+ *
+ * If the buffer came from the empty list, then set flag
+ * to increment available count.
+ */
+ TAILQ_INSERT_TAIL(&Sensor_mod.full, desc, link);
+
+ /* ==== acquire a new buffer to fill ====
+ *
+ * Take from the empty buffer list if available. Otherwise,
+ * recycle an unused buffer from the full list. The buffer
+ * at the head of the queue is the oldest.
+ */
+ if ((desc = Sensor_mod.empty.tqh_first) != NULL) {
+ TAILQ_REMOVE(&Sensor_mod.empty, desc, link);
+ emptyBuf = TRUE;
+ }
+ else {
+ desc = Sensor_mod.full.tqh_first;
+ TAILQ_REMOVE(&Sensor_mod.full, desc, link);
+ emptyBuf = FALSE;
+ }
+
+ /* leave the data gate */
+ pthread_mutex_unlock(&Sensor_mod.gate);
+
+ /* increment the semaphore if buffer came from empty list */
+ if (emptyBuf) {
+ value = 1;
+ write(Sensor_mod.availCount, &value, sizeof(value));
+ }
+ }
+
+ pthread_mutex_lock(&Sensor_mod.gate);
+
+ /* put unused buffer onto full list */
+ desc->count = 0;
+ TAILQ_INSERT_HEAD(&Sensor_mod.full, desc, link);
+ value = 1;
+ write(Sensor_mod.availCount, &value, sizeof(value));
+ pthread_mutex_unlock(&Sensor_mod.gate);
+
+transfer:
+ pthread_mutex_lock(&Sensor_mod.gate);
+
+ /* transfer all remaining buffers from the empty list to the full list */
+ while ((desc = Sensor_mod.empty.tqh_first) != NULL) {
+ desc->count = 0;
+ TAILQ_REMOVE(&Sensor_mod.empty, desc, link);
+ TAILQ_INSERT_HEAD(&Sensor_mod.full, desc, link);
+ value = 1;
+ write(Sensor_mod.availCount, &value, sizeof(value));
+ }
+
+ pthread_mutex_unlock(&Sensor_mod.gate);
+
+ /* wait until the client is done, needs to reclaim buffers */
+ read(Sensor_mod.waitEvent, &value, sizeof(value));
+
+ return (status);
+}
+
+/*
+ * ======== Sensor_setup ========
+ */
+int Sensor_setup(void)
+{
+ int status = 0;
+
+ pthread_mutex_lock(&Sensor_mod.gate);
+
+ /* ensure only first thread performs setup procedure */
+ if (Sensor_mod.refCount >= 1) {
+ Sensor_mod.refCount++;
+ status = 1; /* already setup */
+ goto leave;
+ }
+
+ /* initialize module state */
+ TAILQ_INIT(&Sensor_mod.empty);
+ TAILQ_INIT(&Sensor_mod.full);
+
+ /* create counting semaphore, initial value = 0 */
+ Sensor_mod.availCount = eventfd(0, EFD_SEMAPHORE);
+
+ if (Sensor_mod.availCount == -1) {
+ perror("Sensor_setup: create eventfd failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* create event object, initial value = un-signaled */
+ Sensor_mod.waitEvent = eventfd(0, 0);
+
+ if (Sensor_mod.waitEvent == -1) {
+ perror("Sensor_setup: create eventfd failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* getting here means we have successfully started */
+ Sensor_mod.refCount++;
+
+ /* module is ready */
+ Sensor_mod.ready = TRUE;
+
+leave:
+ pthread_mutex_unlock(&Sensor_mod.gate);
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/producer/Sensor.h b/src/examples/templates/ex46_graph/producer/Sensor.h
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Sensor.h ========
+ */
+
+#ifndef Sensor__include
+#define Sensor__include
+
+#include <sys/queue.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct Sensor_BufDesc {
+ int size; /* size of buffer (in elements) */
+ int count; /* number of elements in buffer */
+ unsigned int *buffer; /* buffer address */
+ TAILQ_ENTRY(Sensor_BufDesc) link;
+} Sensor_BufDesc;
+
+
+void *Sensor_threadFxn(void *arg);
+int Sensor_setup(void);
+void Sensor_destroy(void);
+
+void Sensor_done(void);
+int Sensor_isReady(void);
+void Sensor_issue(Sensor_BufDesc *desc);
+void Sensor_recall(Sensor_BufDesc **desc);
+void Sensor_reclaim(Sensor_BufDesc **desc);
+void Sensor_shutdown(void);
+void Sensor_start(void);
+void Sensor_stop(void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/producer/main.c b/src/examples/templates/ex46_graph/producer/main.c
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== main.c ========
+ */
+
+/* standard headers */
+#include <pthread.h> /* pthread_create, pthread_join */
+#include <stdio.h> /* printf */
+#include <stdlib.h> /* exit */
+
+/* package header files */
+#include <ti/ipc/Std.h>
+
+/* example header files */
+#include "Ctrl.h"
+#include "Pump.h"
+#include "Sensor.h"
+
+#define Main_USAGE "\
+Usage:\n\
+ producer n r\n\
+ producer -h\n\
+\n\
+Arguments:\n\
+ n : single character node name [A-Z]\n\
+ r : reserved message queue number\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+\n"
+
+/* private functions */
+int parse_args(int argc, char *argv[]);
+
+/* private data */
+static char main_n_arg = ' '; /* node name */
+static int main_r_arg = -1; /* reserved queue index */
+
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ int status = 0;
+ pthread_t ctrlThr; /* control thread */
+ Ctrl_Arg ctrlArg;
+ int ctrlStatus = 0;
+ pthread_t pumpThr; /* pump thread */
+ Pump_Arg pumpArg;
+ int pumpStatus = 0;
+ pthread_t sensorThr; /* sensor thread */
+ int sensorStatus = 0;
+
+ /* parse command line */
+ status = parse_args(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* start the control thread */
+ ctrlArg.n = main_n_arg;
+ status = pthread_create(&ctrlThr, NULL, Ctrl_threadFxn, &ctrlArg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: control thread failed\n");
+ goto leave;
+ }
+
+ /* start the pump thread */
+ pumpArg.node = main_n_arg;
+ pumpArg.queIdx = main_r_arg;
+ status = pthread_create(&pumpThr, NULL, Pump_threadFxn, &pumpArg);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: pump thread failed\n");
+ goto leave;
+ }
+
+ /* start the sensor thread */
+ status = pthread_create(&sensorThr, NULL, Sensor_threadFxn, NULL);
+
+ if (status < 0) {
+ fprintf(stderr, "Error: sensor thread failed\n");
+ goto leave;
+ }
+
+ /* wait for sensor thread to exit */
+ pthread_join(sensorThr, (void **)(&sensorStatus));
+
+ /* wait for pump thread to exit */
+ pthread_join(pumpThr, (void **)(&pumpStatus));
+
+ /* wait for control thread to exit */
+ pthread_join(ctrlThr, (void **)(&ctrlStatus));
+
+ status = ((ctrlStatus < 0) || (pumpStatus < 0) || (sensorStatus < 0))
+ ? -1 : 0;
+
+leave:
+ return (status);
+}
+
+/*
+ * ======== parse_args ========
+ */
+int parse_args(int argc, char *argv[])
+{
+ int x, cp, opt, argNum;
+ int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ fprintf(stderr, "%s", Main_USAGE);
+ exit(0);
+ break;
+
+ default:
+ fprintf(stderr, "Error: invalid option, %c\n", (char)x);
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ for (argNum = 1; opt < argc; argNum++, opt++) {
+
+ switch (argNum) {
+ case 1:
+ main_n_arg = argv[opt][0];
+ break;
+
+ case 2:
+ main_r_arg = atoi(argv[opt]);
+ break;
+
+ default:
+ fprintf(stderr, "Error: too many arguments\n");
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ if (main_n_arg == ' ') {
+ fprintf(stderr, "Error: missing node argument\n");
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+ if (main_r_arg == -1) {
+ fprintf(stderr, "Error: missing queue index argument\n");
+ fprintf(stderr, "%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/products.mak b/src/examples/templates/ex46_graph/products.mak
--- /dev/null
@@ -0,0 +1,79 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-linux-gnueabihf
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+#DESTDIR = $(DEPOT)/_your_destdir_
+
+#### BIOS-side toolchains ####
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+
+# Use this goal to print your product variables.
+.show:
+ @echo "TOOLCHAIN_LONGNAME = $(TOOLCHAIN_LONGNAME)"
+ @echo "TOOLCHAIN_INSTALL_DIR = $(TOOLCHAIN_INSTALL_DIR)"
+ @echo "TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+ @echo "DESTDIR = $(DESTDIR)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
diff --git a/src/examples/templates/ex46_graph/readme.txt b/src/examples/templates/ex46_graph/readme.txt
--- /dev/null
@@ -0,0 +1,230 @@
+#
+# ======== readme.txt ========
+#
+
+Overview
+=========================================================================
+This example performs on-demand loading of DSP processors and illustrates
+how to establish IPC communication.
+
+There are three host programs: the manager, consumer, and producer. The
+manager program must be started first. It is used to start and stop all
+other programs in the example. The manager is also used for sending commands
+to the other programs. The producer simply generates data in order to
+exercise the connections. The consumer is used for terminating the data
+path. You can start only one manager, but you can have multiple producers
+and consumers running concurrently.
+
+There are two DSP programs: the combiner and transformer. The transformer
+has one input and one output. It is used to process the input data and to
+generate new output data. The combiner has two inputs and one output. Its
+purpose is simply to combine two data paths into one.
+
+With these programs, you can build multiple data graphs. Starting and
+stopping a program illustrates how to initialize and finalize the IPC
+framework. Making connections illustrates how to attach IPC to various
+end points. Starting and stopping the data flow illustrates how to send
+messages.
+
+For example, the following data graph illustrates how to run IPC programs
+on the host only (without any programs running on the DSP).
+
+ producer [HOST] --> consumer [HOST]
+
+The following graph adds the DSP.
+
+ producer [HOST] --> transformer [DSP1] --> consumer [HOST]
+
+Here is an example with two producers. The combiner is used to join the
+two data streams into one.
+
+ producer --> transformer --
+ \
+ +--> combiner --> consumer
+ /
+ producer --> transformer --
+
+
+Known Issues
+
+ A. Producer node will hang in shutdown phase if connected to a combiner
+ node. Connect the producer to either a consumer or a transformer.
+
+ The pause command is not handled correctly. The pump thread in the
+ producer node will send a message downstream after having received
+ the pause command. This creates a deadlock in the shutdown phase.
+ This is not a problem when connected to a consumer or transformer
+ because those nodes automatically return the message after processing
+ the data. However, the combiner node might not return the message
+ because it needs a corresponding data message on the other input
+ connection.
+
+
+Build Instructions
+=========================================================================
+
+ 1. Create a work folder on your file system.
+
+ mkdir work
+
+ 2. This example uses the transport built in the ex45_host example. You
+ must install and build the ex45_host example first.
+
+ cd work
+ unzip ex45_host.zip
+
+ Follow the instructions in ex45_host/readme.txt to build the example.
+
+ 3. Extract this example into your work folder.
+
+ cd work
+ unzip ex46_graph.zip
+
+ 4. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create a products.mak file in the parent
+ directory which will be used by all examples.
+
+ edit ex46_graph/products.mak
+
+ TOOLCHAIN_LONGNAME = arm-linux-gnueabihf
+ TOOLCHAIN_INSTALL_DIR = <...>/linaro-arm-gnueabihf_4_7_2013_03
+ TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+
+ IPC_INSTALL_DIR = <...>/ipc_m_mm_pp_bb
+
+ Your DESTDIR must point to your IPC "install" location. In other words,
+ the location you specified when you ran 'make install' within the IPC
+ product.
+
+ DESTDIR = <...>
+
+ Note: To build this example, you must install IPC into DESTDIR.
+
+ 5. Build the example. This will build only debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ex46_graph
+ make
+
+ 6. Issue the following commands to clean your example.
+
+ cd ex46_graph
+ make clean
+
+ 7. Copy the executables and supporting scripts to your target file system.
+
+ ex46_graph/combiner/bin/debug/combinerN.xe66
+ ex46_graph/consumer/bin/debug/consumer
+ ex46_graph/manager/bin/debug/manager
+ ex46_graph/producer/bin/debug/producer
+ ex46_graph/scripts/patchExec.pl
+ ex46_graph/scripts/run_lad.sh
+ ex46_graph/scripts/run_patch_combiner.sh
+ ex46_graph/scripts/run_patch_transformer.sh
+ ex46_graph/scripts/vritio.awk
+ ex46_graph/transformer/bin/debug/transformerN.xe66
+
+ 8. Copy the LAD executable from the IPC product to your target file system.
+
+ <DESTDIR>/usr/bin/lad_tci6638
+
+
+Patching The DSP Executables
+=========================================================================
+This example illustrates how to use one DSP executable and one LAD
+executable for all your devices. To achieve this, the DSP executable
+must be patched for each device and the LAD daemon must be started
+with a command line option to specify the cluster baseId.
+
+In our hypothetical system, we use one cluster for each device. Each
+cluster has 9 members (to match the number of process on the device).
+The cluster baseId is the processor number of the first processor in
+the cluster (base-zero).
+
+For example, the clusters would be mapped out as follows:
+
+ Device # BaseId Cluster Members
+ =========================================================================
+ 1 0 HOST (0), DSP1 (1), DSP2 (2), ..., DSP8 (8)
+ 2 9 HOST (9), DSP1 (10), DSP2 (11), ..., DSP8 (17)
+ 3 18 HOST (18), DSP1 (19), DSP2 (20), ..., DSP8 (26)
+ : : :
+ 511 4590 HOST (4590), DSP1 (4591), DSP2 (4592), ..., DSP8 (4598)
+ 512 4599 HOST (4599), DSP1 (4600), DSP2 (4601), ..., DSP8 (4607)
+
+To load and run on any given device, use the BaseId for that device when
+you patch your DSP executable and when starting LAD.
+
+ 1. Patch the combiner executable with the cluster baseId. For example, if
+ running on Device #3, the BaseId would be 18 (see table above). The
+ perl script makes a copy of the DSP executable file.
+
+ perl patchExec.pl 18 combinerN.xe66 combinerN_p.xe66
+
+ You can also use the helper script provided with the example.
+
+ run_patch_combiner.sh 18
+
+ This will generate a new patched DSP executable.
+
+ combinerN_p.xe66
+
+ 2. Patch the transformer executable as above.
+
+ perl patchExec.pl 18 transformerN.xe66 transformerN_p.xe66
+
+ You can also use the helper script provided with the example.
+
+ run_patch_transformer.sh 18
+
+ This will generate a new patched DSP executable.
+
+ transformerN_p.xe66
+
+
+Running The Example
+=========================================================================
+ 1. Start LAD. You must start the LAD daemon before running any IPC
+ program. If it is not already running, use the following command
+ to start it.
+
+ lad_tci6638 -s PAIR -n 4608 -b <baseId> -r 8 -l log.txt
+
+ You can also use the helper script provided with the example.
+
+ run_lad.sh <baseId>
+
+ 2. Run the manager program in an interactive shell on your target.
+ The manager will accept keyboard input from the shell. Use the
+ manager to interact with the rest of this example.
+
+
+Focus Points
+=========================================================================
+
+ *. Control thread must start IPC first. User thread must wait until
+ IPC has been started.
+
+ *. Control thread must wait to stop IPC until user thread is finished.
+
+ *. Command loop cannot have nested loops. Must use deferred commands.
+
+ *. On host, you call Ipc_attach only once. Not in a loop as you would
+ on the DSP.
+
+ *. After starting a new DSP, all running host IPC programs must attach
+ to new DSP (if they want to communicate with it).
+
+ Before shutting down a DSP, all host IPC programs must detach from DSP.
+
+ *. When starting a new host IPC program, it must attach to all running
+ DSPs (if it wants to communicate with it).
+
+ Before shutting down a host program, it must detach from all DSPs.
+
+ *. Each DSP creates its own message pool for output data buffers. Use a
+ SYS/BIOS heap because all messages are round-trip. Place heap in
+ shared memory. Acquire memory from shared region heap. When computing
+ heap size, must account for alignment.
diff --git a/src/examples/templates/ex46_graph/scripts/patchExec.pl b/src/examples/templates/ex46_graph/scripts/patchExec.pl
--- /dev/null
@@ -0,0 +1,132 @@
+#!/usr/bin/perl
+
+#
+# Copyright (c) 2015, 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.
+#
+
+# patchExec.pl
+#
+# This script patches a DSP ELF executable with a cluster base id,
+# at the location with the magic binary pattern
+# 74efdb7760e9bf8961d98b7368d8f5b73506064a
+# in the executable's .cinit records.
+#
+# Command line arguments:
+# $ARGV[0]: cluster base id
+# $ARGV[1]: input executable
+# $ARGV[2]: path to patched output executable
+#
+
+use strict;
+use warnings;
+
+# Set the input and output file names
+my $execFile = $ARGV[1];
+my $patchedFile = $ARGV[2];
+
+my $sections = 0;
+my $skip = 0;
+my $fileOff;
+my $sizeCInit;
+my $b;
+
+my $usage = "Usage: perl patchExec.pl <cluster base id> <input executable>" .
+ " <patched executable>\n\n";
+
+# Verify arguments
+die "Wrong number of command-line arguments.\n" . $usage
+ unless (@ARGV == 3);
+die "Invalid cluster base id.\n" . $usage unless ($ARGV[0] >= 0);
+die "Cannot read from input file.\n" . $usage unless -r $ARGV[1];
+
+# Parse the objdump
+my @resultLines = split("\n", `objdump -h $ARGV[1]`);
+die "Error when running objdump.\n" unless (@resultLines != 0);
+
+foreach (@resultLines) {
+ if (index($_, "Sections:") != -1) { #Look for sections header
+ $sections = 1;
+ }
+ elsif ($sections eq 1) {
+ $skip = $skip + 1;
+ if (($skip % 2) eq 0) {
+ my @cols = split; # split into columns
+ if ($cols[1] eq ".cinit") {
+ $fileOff = hex($cols[5]); # file offset of .cinit
+ $sizeCInit = hex($cols[2]); # size of .cinit
+ }
+ }
+ }
+}
+
+open(IN, "< $execFile") or die "Cannot open input file\n" . $usage;
+binmode(IN);
+open(OUT, "> $patchedFile") or die "Cannot open output file\n" . $usage;
+binmode(OUT);
+
+#skip over everything before .cinit
+read(IN, $b, $fileOff);
+print(OUT $b);
+
+#
+# Look for magic value of 9807fc203ee72e6857da95ecd619feed55f050e6
+# in .cinit and modify it with base cluster id, We ignore the first
+# and last byte in the magic value in case they have been encoded
+# using RLE, and store the cluster id in the 3rd and 4th byte.
+#
+read(IN, $b, $sizeCInit);
+my $hex = unpack('H*', $b); #unpack binary into string
+my $id = sprintf("%04x", $ARGV[0]); #convert id into 16-bit hex string
+
+#convert cluster id to little endian
+my @chars = reverse(split("", $id));
+$id = reverse(@chars[0..1]) . reverse(@chars[2..3]);
+
+my $newString = "07" . $id . "3ee72e6857da95ecd619feed55f050";
+my $magic = "07fc203ee72e6857da95ecd619feed55f050";
+$hex =~ s/$magic/$newString/g;
+die "Magic pattern not found" unless scalar @+ != 0;
+die "Too many patterns found" unless scalar @+ == 1;
+my $out = pack('H*', $hex); #pack string into binary
+print(OUT $out);
+
+#copy the rest of the file
+my $filesize = -s $execFile;
+read(IN, $b, $filesize - $sizeCInit - $fileOff);
+print(OUT $b);
+
+close(IN);
+close(OUT);
+
+#TODO: remove temporary files
+
+# Exit script
+exit;
diff --git a/src/examples/templates/ex46_graph/scripts/run_lad.sh b/src/examples/templates/ex46_graph/scripts/run_lad.sh
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Error: must specify cluster baseId"
+ exit -1
+fi
+
+baseId=$1
+
+set -x
+./lad_tci6638 -s PAIR -n 4608 -b $baseId -r 8 -l log.txt
diff --git a/src/examples/templates/ex46_graph/scripts/run_patch_combiner.sh b/src/examples/templates/ex46_graph/scripts/run_patch_combiner.sh
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Error: must specify cluster baseId"
+ exit -1
+fi
+
+baseId=$1
+prog=combinerN
+
+set -x
+perl patchExec.pl $baseId ${prog}.xe66 ${prog}_p.xe66
diff --git a/src/examples/templates/ex46_graph/scripts/run_patch_transformer.sh b/src/examples/templates/ex46_graph/scripts/run_patch_transformer.sh
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Error: must specify cluster baseId"
+ exit -1
+fi
+
+baseId=$1
+prog=transformerN
+
+set -x
+perl patchExec.pl $baseId ${prog}.xe66 ${prog}_p.xe66
diff --git a/src/examples/templates/ex46_graph/shared/ClusterMgr_shared.h b/src/examples/templates/ex46_graph/shared/ClusterMgr_shared.h
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== ClusterMgr_shared.h ========
+ */
+
+#ifndef ClusterMgr_shared__include
+#define ClusterMgr_shared__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* reserved message queue */
+#define ClusterMgr_CMDQUE "ClusterMgrQue"
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/shared/Data.h b/src/examples/templates/ex46_graph/shared/Data.h
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Data.h ========
+ */
+
+#ifndef Data__include
+#define Data__include
+
+#include <ti/ipc/MessageQ.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#define Data_BUFSZ 50
+
+typedef struct {
+ Int count; /* number of elements in buffer */
+ UInt buffer[Data_BUFSZ]; /* data buffer */
+} Data_Buffer;
+
+#define DB_buffer_offset ((UInt)&((Data_Buffer *)0)->buffer)
+#define Data_DBADDR(buffer) (Data_Buffer *)((Char *)buffer - DB_buffer_offset)
+
+typedef struct {
+ MessageQ_MsgHeader header;
+ Data_Buffer data;
+} Data_Msg;
+
+#define Data_Msg__header(header) (Data_Msg *)(header)
+
+#define DM_data_offset ((UInt)&((Data_Msg *)0)->data)
+#define Data_MQADDR(data) (MessageQ_Msg)((Char *)data - DM_data_offset)
+
+/* reserved message queue ID */
+#define Data_MSGID SysCfg_Data_MSGID
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/shared/Graph.h b/src/examples/templates/ex46_graph/shared/Graph.h
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Graph_shared.h ========
+ */
+
+#ifndef Graph_shared__include
+#define Graph_shared__include
+
+#include <ti/ipc/MessageQ.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ Int cmd;
+ Int arg1;
+ Int arg2;
+ UInt uarg1;
+ UInt uarg2;
+ UInt dcid; /* deferred command ID */
+ Int reply; /* send reply message */
+ Int ack; /* acknowledgement message */
+ Int status;
+} Graph_Msg;
+
+#define Graph_HEAPBLOCKSIZE ((sizeof(Graph_Msg) + 3) & (~3))
+
+#define Graph_Cmd_ATTACH 1
+#define Graph_Cmd_DATAQUERY 2
+#define Graph_Cmd_DETACH 3
+#define Graph_Cmd_FLUSH 4
+#define Graph_Cmd_INFO 5
+#define Graph_Cmd_INPUTCONNECT 6 /* connect input from upstream node */
+#define Graph_Cmd_INPUTDISCONNECT 7 /* disconnect from upstream node */
+#define Graph_Cmd_OUTPUTCONNECT 8 /* connect output to downstream node */
+#define Graph_Cmd_OUTPUTDISCONNECT 9 /* disconnect to downstream node */
+#define Graph_Cmd_PAUSE 10
+#define Graph_Cmd_RELEASE 11
+#define Graph_Cmd_REQUEST 12
+#define Graph_Cmd_RUN 13
+#define Graph_Cmd_SHUTDOWN 14
+
+/* reserved message queue ID */
+#define Graph_MSGID SysCfg_Graph_MSGID
+
+#define Graph_S_SUCCESS (0)
+#define Graph_E_FAIL (-1)
+
+#define Graph_Info_DATASRC 1
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/shared/SysCfg.h b/src/examples/templates/ex46_graph/shared/SysCfg.h
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== SysCfg_shared.h ========
+ */
+
+#ifndef SysCfg_shared__include
+#define SysCfg_shared__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/* HOST reserved message queues */
+#define SysCfg_PER_MsgQ 0 /* Processor Endpoint Registrar */
+#define SysCfg_PEC_MsgQ 1 /* Processor Endpoint Client */
+#define SysCfg_ResMgr 2 /* Resource Manager */
+
+/* DSP reserved message queue */
+#define SysCfg_Compute_CMD_RQUE 2
+#define SysCfg_DATA_RQUE 3
+
+/* transport message queue ID */
+#define SysCfg_TRANSPORT_PMQ_ID 1
+
+/* reserved message queue IDs */
+#define SysCfg_Cmd_MSGID 1
+#define SysCfg_Graph_MSGID 2
+#define SysCfg_Data_MSGID 3
+
+/* MessageQ Heap ID */
+#define SysCfg_RPMsg_HeapID 0
+#define SysCfg_CtrlMsg_HeapID 1
+#define SysCfg_DataMsg_HeapID 2
+
+#define SysCfg_CtrlHeapNameFmt "CtrlHeap_Proc%d"
+#define SysCfg_CtrlHeapNumBlocks 12
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/shared/config.bld b/src/examples/templates/ex46_graph/shared/config.bld
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== config.bld ========
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+/* Memory Map - TCI6638K2K
+ *
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0080_0000 10_0000 ( 1 MB) DSP L2 Cache/SRAM
+ * 00E0_0000 8000 ( 32 KB) DSP L1P Cache/SRAM
+ * 00F0_0000 8000 ( 32 KB) DSP L1D Cache/SRAM
+ * 0C00_0000 60_0000 ( 6 MB) MSMCSRAM
+ * -------------------------------------------------------------------------
+ * 0080_0000 10_0000 ( 1 MB) DSP_PROG (L2 SRAM) [1]
+ * 00E0_0000 8000 ( 32 KB) DSP L1P Cache
+ * 00F0_0000 8000 ( 32 KB) DSP L1D Cache
+ * 0C00_0000 40_0000 ( 4 MB) MSMCSRAM
+ * 0C40_0000 20_0000 ( 2 MB) SR_0 [2]
+ *
+ * 8000_0000 1000_0000 ( 256 MB) Linux
+ * 9000_0000 1000_0000 ( 256 MB) Linux
+ * A000_0000 1000_0000 ( 256 MB) Linux
+ * B000_0000 1000_0000 ( 256 MB) Linux
+ * C000_0000 1000_0000 ( 256 MB) Linux
+ * D000_0000 1000_0000 ( 256 MB) Linux
+ * E000_0000 1000_0000 ( 256 MB) --------
+ * F000_0000 1000_0000 ( 256 MB) --------
+ *
+ * Notes
+ * ------------------------------------------------------------------------
+ * [1] Each DSP program is loaded to private L2 SRAM (local address)
+ * [2] SR-Zero owner=DSP1
+ */
+
+var SR_0 = {
+ name: "SR_0", space: "data", access: "RW",
+ base: 0x0C400000, len: 0x200000,
+ comment: "SR#0 Memory (2 MB)"
+};
+
+Build.platformTable["ti.platforms.evmTCI6638K2K:coreN"] = {
+ customMemoryMap: [
+ [ "L2SRAM", {
+ name: "L2SRAM", space: "code/data", access: "RWX",
+ base: 0x00800000, len: 0x100000,
+ comment: "DSP Program"
+ }],
+ [ "SR_0", SR_0 ]
+ ],
+ codeMemory: "L2SRAM",
+ dataMemory: "L2SRAM",
+ stackMemory: "L2SRAM",
+ l1DMode: "32k",
+ l1PMode: "32k",
+ l2Mode: "0k"
+};
+
+/*
+ * ======== ti.targets.elf.C66 ========
+ */
+var C66 = xdc.useModule('ti.targets.elf.C66');
+C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
+Build.targets.$add(C66);
diff --git a/src/examples/templates/ex46_graph/transformer/Ctrl.c b/src/examples/templates/ex46_graph/transformer/Ctrl.c
--- /dev/null
@@ -0,0 +1,536 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Ctrl__Desc
+#define MODULE_NAME "Ctrl"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/HeapBufMP.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/SharedRegion.h>
+#include <ti/ipc/ipcmgr/IpcMgr.h>
+
+/* example header files */
+#include "Ctrl.h"
+#include "Xfm.h"
+#include "../shared/Graph.h"
+#include "../shared/SysCfg.h"
+
+#define NAMESZ 48
+
+
+/* module structure */
+typedef struct {
+ Bool run; /* main loop run flag */
+ UInt16 srZeroProc; /* SR-Zero owner processor ID */
+ MessageQ_QueueId srZeroQue; /* SR-Zero owner control queue */
+ MessageQ_Handle queue; /* inbound messages */
+ HeapBufMP_Handle heap; /* control message pool */
+} Ctrl_Module;
+
+/* private functions */
+static void Ctrl_destroy(void);
+static void Ctrl_detachSRZero(void);
+static int Ctrl_exec(void);
+static int Ctrl_setup(void);
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+
+static Ctrl_Module Ctrl_mod = {
+ FALSE, /* run */
+ MultiProc_INVALIDID, /* srZeroProcId */
+ NULL, /* srZeroQue */
+ NULL, /* queue */
+ NULL /* heap */
+};
+
+
+/*
+ * ======== Ctrl_taskFxn ========
+ */
+Void Ctrl_taskFxn(UArg arg0, UArg arg1)
+{
+ int status = 0;
+
+ Log_print0(Diags_INFO, "Ctrl_taskFxn: -->");
+
+ /* setup phase */
+ status = Ctrl_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Ctrl_exec();
+
+leave:
+ /* shutdown phase */
+ Ctrl_destroy();
+
+ Log_print1(Diags_INFO, "Ctrl_threadFxn: <-- status=%d", (IArg)status);
+}
+
+/*
+ * ======== Ctrl_destroy ========
+ */
+static void Ctrl_destroy(void)
+{
+ int status = 0;
+
+ /* wait until the xfm module is finished using IPC */
+ while (!Xfm_ipcDone()) {
+ Task_sleep(100); /* 0.1 seconds */
+ }
+
+ /* if not SR-Zero owner, close its message queue */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ MessageQ_close(&Ctrl_mod.srZeroQue);
+ }
+
+ /* delete my own message queue */
+ MessageQ_delete(&Ctrl_mod.queue);
+
+ /* unregister the message heap */
+ MessageQ_unregisterHeap(SysCfg_CtrlMsg_HeapID);
+
+ /* if SR-Zero owner, delete the message heap */
+ if (MultiProc_self() == Ctrl_mod.srZeroProc) {
+ HeapBufMP_delete(&Ctrl_mod.heap);
+ }
+ else {
+ /* else, close the message heap */
+ HeapBufMP_close(&Ctrl_mod.heap);
+ }
+
+ /* If not SR-Zero owner, must detach now.
+ *
+ * We have already aranged for SR-Zero to be in the Ipc_detach
+ * loop (see Ctrl_detachSRZero). All IPC resources have now been
+ * release, so we finally enter the detach loop here.
+ */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ do {
+ status = Ipc_detach(Ctrl_mod.srZeroProc);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+ }
+
+ /* finalize IPC */
+ Ipc_stop();
+
+ /* disable log events */
+ Log_print1(Diags_INFO, "Ctrl_delete: <-- status=%d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+/*
+ * ======== Ctrl_detachSRZero ========
+ */
+static void Ctrl_detachSRZero(void)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ Graph_Msg *msg;
+
+ /* allocate a message queue message to contain the graph message */
+ mqMsg = MessageQ_alloc(SysCfg_CtrlMsg_HeapID, sizeof(Graph_Msg));
+
+ if (mqMsg == NULL) {
+ Log_error0("message alloc failed");
+ goto leave;
+ }
+
+ /* identify the message type */
+ MessageQ_setMsgId(mqMsg, Graph_MSGID);
+
+ /* fill in message payload */
+ msg = (Graph_Msg *)mqMsg;
+ msg->cmd = Graph_Cmd_DETACH;
+ msg->uarg1 = MultiProc_self();
+ msg->reply = FALSE;
+
+ /* send the message */
+ status = MessageQ_put(Ctrl_mod.srZeroQue, mqMsg);
+
+ if (status < 0) {
+ Log_error0("message send failed");
+ goto leave;
+ }
+
+ /* SR-Zero owner will now go into Ipc_detach loop. However, before
+ * this processor can detach, it must first release all IPC resources.
+ * This is done in Ctrl_destory.
+ */
+
+ Log_print1(Diags_INFO, "Ctrl_detachSRZero: IPC detached from proc=%d",
+ Ctrl_mod.srZeroProc);
+
+leave:
+ return;
+}
+
+/*
+ * ======== Ctrl_exec ========
+ */
+static int Ctrl_exec(void)
+{
+ int status = 0;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId qid;
+ Graph_Msg *msg;
+
+ Log_print0(Diags_INFO, "Ctrl_exec: -->");
+ Ctrl_mod.run = TRUE;
+
+ /* main loop */
+ while (Ctrl_mod.run) {
+
+ /* wait for inbound message */
+ Log_print0(Diags_INFO, "waiting for message");
+ status = MessageQ_get(Ctrl_mod.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Ctrl_mod.run = FALSE;
+ status = 0;
+ goto leave;
+ }
+ else if (status < 0) {
+ Log_error1("Ctrl_exec: message get error=%d", status);
+ goto leave;
+ }
+
+ /* process the message */
+ msg = (Graph_Msg *)mqMsg;
+ Log_print1(Diags_INFO, "message received, cmd=%d", msg->cmd);
+
+ switch (msg->cmd) {
+
+ case Graph_Cmd_ATTACH:
+ /* dsp attach to dsp */
+ do {
+ status = Ipc_attach(msg->uarg1);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+
+ if (status < 0) {
+ Log_error1("Ipc_attach failed, error=%d", status);
+ status = -1;
+ goto leave;
+ }
+
+ Log_print1(Diags_INFO, "IPC attached proc=%d", msg->uarg1);
+ break;
+
+ case Graph_Cmd_DETACH:
+ do {
+ status = Ipc_detach(msg->uarg1);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+
+ if (status < 0) {
+ Log_error1("Ipc_detach failed, error=%d", status);
+ status = -1;
+ goto leave;
+ }
+
+ Log_print1(Diags_INFO, "IPC detached proc=%d", msg->uarg1);
+ break;
+
+ case Graph_Cmd_FLUSH:
+ msg->status = Graph_S_SUCCESS; /* nothing to do */
+ break;
+
+ case Graph_Cmd_INPUTCONNECT:
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_INPUTDISCONNECT:
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_OUTPUTCONNECT:
+ Log_print2(Diags_INFO, "connect output to proc=%d qidx=%d",
+ msg->uarg1, msg->uarg2);
+ Xfm_connect(msg->uarg1, msg->uarg2);
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_OUTPUTDISCONNECT:
+ Log_print2(Diags_INFO, "disconnect output proc=%d qidx=%d",
+ msg->uarg1, msg->uarg2);
+ Xfm_disconnect(msg->uarg1, msg->uarg2);
+ msg->status = Graph_S_SUCCESS;
+ break;
+
+ case Graph_Cmd_SHUTDOWN:
+ Log_print0(Diags_INFO, "shutdown message received");
+ Xfm_shutdown();
+ Ctrl_mod.run = FALSE; /* stop the idle function */
+
+ /* if SR-Zero owner, give idle function a chance to unwind */
+ /* TODO - this should be a do-while loop */
+ if (MultiProc_self() == Ctrl_mod.srZeroProc) {
+ Task_sleep(1);
+ }
+ else {
+ /* send detach request to SR-Zero owner */
+ Ctrl_detachSRZero();
+ }
+ break;
+
+ default:
+ Log_error1("unknown command, cmd=%d", (IArg)msg->cmd);
+ break;
+ }
+
+ if (msg->reply) {
+ /* return the message to sender */
+ msg->reply = FALSE;
+ msg->ack = TRUE;
+ qid = MessageQ_getReplyQueue(mqMsg);
+
+ status = MessageQ_put(qid, mqMsg);
+
+ if (status < 0) {
+ Log_error0("Ctrl_exec: message send failed");
+ status = -2;
+ goto leave;
+ }
+ }
+ else {
+ /* free message here */
+ MessageQ_free(mqMsg);
+ }
+
+ } /* while (run) */
+
+leave:
+ Log_print1(Diags_INFO, "Ctrl_exec: <-- %d", (IArg)status);
+ return (status);
+}
+
+/*
+ * ======== Ctrl_setup ========
+ */
+static int Ctrl_setup(void)
+{
+ Int status = 0;
+ Error_Block eb;
+ Char cbuf[NAMESZ];
+ Bool ready;
+ Registry_Result result;
+ MessageQ_Params msgqParams;
+ SharedRegion_Entry entry;
+ HeapBufMP_Params heapParams;
+
+ Error_init(&eb);
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+F");
+ Log_print0(Diags_INFO, "Ctrl_setup: -->");
+
+ /* setup IPC */
+ Log_print0(Diags_INFO, "initializing IPC");
+
+ /* setup TransportRpmsg for host communication */
+ IpcMgr_ipcStartup();
+
+ /* setup IPC for dsp to dsp communication */
+ status = Ipc_start();
+
+ if (status < 0) {
+ Log_error0("Ipc_start failed");
+ goto leave;
+ }
+
+ /* get SR-Zero information */
+ SharedRegion_getEntry(0, &entry);
+ Ctrl_mod.srZeroProc = entry.ownerProcId;
+
+ /* if this processor is not owner, attach to SR-Zero owner */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ Log_print1(Diags_INFO, "attach to proc=%d", Ctrl_mod.srZeroProc);
+
+ do {
+ status = Ipc_attach(Ctrl_mod.srZeroProc);
+
+ if (status == Ipc_E_NOTREADY) {
+ Task_sleep(1);
+ }
+ } while (status == Ipc_E_NOTREADY);
+ }
+
+ System_snprintf(cbuf, sizeof(cbuf), SysCfg_CtrlHeapNameFmt,
+ Ctrl_mod.srZeroProc);
+
+ /* if SR-Zero owner, create the message heap (control messages) */
+ if (MultiProc_self() == Ctrl_mod.srZeroProc) {
+ HeapBufMP_Params_init(&heapParams);
+ heapParams.name = cbuf;
+ heapParams.regionId = 0;
+ heapParams.blockSize = Graph_HEAPBLOCKSIZE;
+ heapParams.numBlocks = SysCfg_CtrlHeapNumBlocks;
+
+ Ctrl_mod.heap = HeapBufMP_create(&heapParams);
+
+ if (Ctrl_mod.heap == NULL) {
+ Log_error0("heap create failed");
+ status = -3;
+ goto leave;
+ }
+ }
+ else {
+ /* else, open the message heap */
+ status = HeapBufMP_open(cbuf, &Ctrl_mod.heap);
+
+ if (status < 0) {
+ Log_error0("heap create failed");
+ status = -3;
+ goto leave;
+ }
+ }
+
+ /* register heap with MessageQ */
+ status = MessageQ_registerHeap(Ctrl_mod.heap, SysCfg_CtrlMsg_HeapID);
+
+ if (status < 0) {
+ Log_error0("heap already exists");
+ status = -4;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO, "IPC startup complete");
+
+ /* compute the message queue name */
+ System_snprintf(cbuf, sizeof(cbuf), Ctrl_QueNameFmt, MultiProc_self());
+
+ /* create message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Ctrl_mod.queue = MessageQ_create(cbuf, &msgqParams);
+
+ if (Ctrl_mod.queue == NULL) {
+ Log_error0("message queue create failed");
+ goto leave;
+ }
+
+ /* if not SR-Zero owner, open its message queue (control messages) */
+ if (MultiProc_self() != Ctrl_mod.srZeroProc) {
+ System_snprintf(cbuf, sizeof(cbuf), Ctrl_QueNameFmt,
+ Ctrl_mod.srZeroProc);
+
+ do {
+ status = MessageQ_open(cbuf, &Ctrl_mod.srZeroQue);
+
+ if (status == MessageQ_E_NOTFOUND) {
+ Task_sleep(5);
+ }
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("message queue open failed");
+ }
+ }
+
+ /* inform other modules that IPC is ready */
+ Xfm_ipcIsReady();
+
+ /* busy wait until other modules are ready */
+ do {
+ ready = TRUE;
+
+ if (!Xfm_isReady()) {
+ ready = FALSE;
+ }
+
+ /* check other modules here
+ *
+ * if (!<Mod>_isReady()) {
+ * ready = FALSE;
+ * }
+ */
+
+ if (!ready) {
+ Task_sleep(10);
+ }
+
+ } while (!ready);
+
+ Log_print0(Diags_INFO, "peer modules are ready");
+
+leave:
+ Log_print1(Diags_INFO, "Ctrl_setup: <-- %d", (IArg)status);
+ return (status);
+}
diff --git a/src/examples/templates/ex46_graph/transformer/Ctrl.h b/src/examples/templates/ex46_graph/transformer/Ctrl.h
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Ctrl.h ========
+ */
+
+#ifndef Ctrl__include
+#define Ctrl__include
+
+#include "TransformerN.h"
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define Ctrl_QueNameFmt TransformerN_CMDQUE_FMT
+
+Void Ctrl_taskFxn(UArg arg0, UArg arg1);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/transformer/MainDspN.c b/src/examples/templates/ex46_graph/transformer/MainDspN.c
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== MainDspN.c ========
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/cfg/global.h> /* Program.global in cfg script */
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* example header files */
+#include "Ctrl.h"
+#include "Xfm.h"
+
+#define PRI_LOW 2
+#define PRI_MED 3
+#define PRI_HIGH 5
+
+Void MainDspN_startupFirst(Void);
+
+UInt8 MainDspN_configData[20] = {
+ 0x98, 0x07, 0xfc, 0x20, 0x3e,
+ 0xe7, 0x2e, 0x68, 0x57, 0xda,
+ 0x95, 0xec, 0xd6, 0x19, 0xfe,
+ 0xed, 0x55, 0xf0, 0x50, 0xe6
+};
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "main: -->");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create the control task */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Ctrl";
+ taskParams.priority = PRI_HIGH;
+ taskParams.stackSize = 0x600;
+ Task_create(Ctrl_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create ipc task");
+ }
+
+ /* create the data task */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "Xfm";
+ taskParams.priority = PRI_MED;
+ taskParams.stackSize = 0x1000;
+ Task_create(Xfm_taskFxn, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create compute task");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "main: <--");
+ return (0);
+}
+
+/*
+ * ======== MainDspN_startupFirst ========
+ */
+Void MainDspN_startupFirst(Void)
+{
+ Int status;
+ UInt16 baseId;
+ SharedRegion_Entry *sre;
+
+ /* Extract the cluster baseId from the config data array
+ *
+ * Before loading the program, the config data array was
+ * "patched" with the correct cluster baseId. Use that value
+ * now to set the cluster baseId in the MultiProc module.
+ */
+ baseId = *(UInt16 *)(MainDspN_configData + 2);
+
+ /* run-time configuration of the cluster baseId */
+ status = MultiProc_setBaseIdOfCluster(baseId);
+
+ if (status < 0) {
+ System_abort("MainDspN_startupFirst: failed to set baseId");
+ }
+
+ /* Internal IPC cluster configuration
+ *
+ * This function will perform run-time configuration of IPC
+ * internal data structures related to the cluster baseId.
+ */
+ status = Ipc_clusterConfig();
+
+ if (status < 0) {
+ System_abort("MainDspN_startupFirst: ipc cluster config failed");
+ }
+
+ /* Define the shared region owner
+ *
+ * Now that we have a valid cluster baseId, we can look up the
+ * procId by name and assign the shared region owner. This example
+ * uses only SR-Zero. Do this for each region you have configured.
+ */
+ sre = SharedRegion_getEntryPtr(0);
+ sre->ownerProcId = MultiProc_getId(Global_SR0_OWNER);
+ sre->isValid = TRUE;
+}
diff --git a/src/examples/templates/ex46_graph/transformer/Makefile b/src/examples/templates/ex46_graph/transformer/Makefile
--- /dev/null
@@ -0,0 +1,151 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = MainDspN.c Ctrl.c Xfm.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66,$(srcs)))
+libs =
+CONFIG = bin/$(PROFILE)/configuro
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.oe66.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all:
+ $(MAKE) PROFILE=debug transformerN.x
+# $(MAKE) PROFILE=release transformerN.x
+
+transformerN.x: bin/$(PROFILE)/transformerN.xe66
+bin/$(PROFILE)/transformerN.xe66: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.oe66: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/compiler.opt: `PCT`/linker.cmd ;
+`PCT`/linker.cmd: TransformerN.cfg ../shared/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -Dxdc.platform.custom.check=false \
+ -t ti.targets.elf.C66 \
+ -c $(ti.targets.elf.C66) \
+ -p ti.platforms.evmTCI6638K2K:coreN \
+ -b ../shared/config.bld -r release \
+ --cfgArgs "{ \
+ profile: \"$(PROFILE)\" \
+ }" TransformerN.cfg
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/transformerN.xe66 $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/transformerN.xe66 $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+EXAMPLE = $(word 1,$(subst /dsp, dsp,$(CURDIR)))
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(EXAMPLE)
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(ti.targets.elf.C66)
+
+CC = $(CGTOOLS)/bin/cl6x -c
+LD = $(CGTOOLS)/bin/cl6x -z
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+LDFLAGS = -w -q -c -m $(@D)/obj/$(@F).map --cinit_compression=off
+LDLIBS = -l $(CGTOOLS)/lib/rts6600_elf.lib
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex46_graph/transformer/TransformerN.cfg b/src/examples/templates/ex46_graph/transformer/TransformerN.cfg
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransformerN.cfg ========
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+var Diags = xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Task');
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+// BIOS.libType = BIOS.LibType_Debug;
+
+xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.global.SR0_cacheEnable = true;
+Program.global.Global_SR0_OWNER = "CORE0"; /* DSP1 is owner of SR #0 */
+
+/* register a startup first function to set SR#0 owner */
+var Startup = xdc.useModule('xdc.runtime.Startup');
+Startup.firstFxns.$add('&MainDspN_startupFirst');
+
+/* configure processor names */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.procAddrMode = MultiProc.ProcAddrMode_Cluster;
+
+/* these must match host side configuration: MultiProcCfg_tci6638.c */
+var procNameAry = [ "HOST", "CORE0", "CORE1", "CORE2", "CORE3", "CORE4",
+ "CORE5", "CORE6", "CORE7" ];
+MultiProc.numProcessors = 4608;
+MultiProc.baseIdOfCluster = MultiProc.INVALIDID;
+
+/* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+MultiProc.setConfig(null, procNameAry);
+Program.global.Global_CLUSTERSZ = MultiProc.numProcsInCluster;
+var MultiProcSetup = xdc.useModule('ti.sdo.ipc.family.tci663x.MultiProcSetup');
+MultiProcSetup.configureProcId = false;
+
+/* ipc startup configuration */
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+Ipc.procSync = Ipc.ProcSync_PAIR;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR_0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ isValid: false,
+ cacheEnable: xdc.global.SR0_cacheEnable
+ })
+);
+
+/* make SR_0 non-cacheable */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(SR0Mem.base, SR0Mem.len, Cache.Mar_DISABLE);
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+/* used to write SysMin trace buffer to memory */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+/* should be done internally */
+xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+
+xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+/* why doe we need this? */
+Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+/* is this not enabled by default? */
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+Hwi.enableException = true;
+
+/* This makes the vrings address range 0xA000_0000 to 0xA1FF_FFFF 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');
+Cache.setMarMeta(0xA0000000, 0x2000000, 0); /* 32 MB, value should be enum */
+
+/* Enable Memory Translation module that operates on the Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = Program.platform.dataMemory;
+
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+/* MessageQ application specific configuration */
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.numReservedEntries = 8;
+MessageQ.numHeaps = 9; /* 1 for transport, 1 for each dsp (8x) */
+
+/* this heap is used by RPMsgTransport */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var heapBufP = new HeapBuf.Params;
+heapBufP.align = 8;
+heapBufP.blockSize = 512;
+heapBufP.numBlocks = 64;
+var msgHeap = HeapBuf.create(heapBufP);
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+VirtioSetup.common$.diags_INFO = Diags.RUNTIME_OFF;
+
+xdc.loadPackage('ti.ipc.transports');
+
+/* why is this not done internally? */
+var NotifyDriverCirc =
+ xdc.useModule('ti.sdo.ipc.notifyDrivers.NotifyDriverCirc');
+var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+NotifyDriverCirc.InterruptProxy = Interrupt;
+
+/* Notify brings in the ti.sdo.ipc.family.Settings module, which does
+ * lots of config magic which will need to be UNDONE later, or setup
+ * earlier, to get the necessary overrides to various IPC module proxies!
+ */
+var Notify = xdc.module('ti.sdo.ipc.Notify');
+var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
+
+/*
+ * ======== Operating System Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex46_graph/transformer/TransformerN.h b/src/examples/templates/ex46_graph/transformer/TransformerN.h
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== TransformerN.h ========
+ */
+
+#ifndef TransformerN__include
+#define TransformerN__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#define TransformerN_CMDQUE_FMT "Ctrl_Proc%d"
+#define TransformerN_LOAD_FMT "mpmcl load dsp%d transformerN_p.xe66"
+#define TransformerN_RESET_FMT "mpmcl reset dsp%d"
+#define TransformerN_RUN_FMT "mpmcl run dsp%d"
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex46_graph/transformer/Xfm.c b/src/examples/templates/ex46_graph/transformer/Xfm.c
--- /dev/null
@@ -0,0 +1,575 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Xfm.c ========
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Xfm__Desc
+#define MODULE_NAME "Xfm"
+
+#include <xdc/std.h>
+#include <xdc/cfg/global.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/IHeap.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Memory.h>
+#include <xdc/runtime/Registry.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/heaps/HeapBuf.h>
+#include <ti/sysbios/knl/Semaphore.h>
+#include <ti/sysbios/knl/Queue.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/SharedRegion.h>
+
+/* local header files */
+#include "Xfm.h"
+#include "../shared/Data.h"
+#include "../shared/SysCfg.h"
+
+#define MESSAGE_POOLSZ 4 /* message pool size */
+#define PIPELINE_POOLSZ 2 /* message pipeline pool, min = 2 */
+#define DESC_POOLSZ MESSAGE_POOLSZ
+
+typedef struct {
+ Queue_Elem link;
+ Data_Msg *msg;
+} Xfm_Desc;
+
+typedef struct {
+ MessageQ_QueueIndex queueIndex; /* reserved queue index */
+ MessageQ_Handle queue; /* data queue, inbound messages */
+ MessageQ_QueueId myQID; /* used to identify my messages */
+} Xfm_Input;
+
+typedef struct {
+ UInt16 procId; /* destination node processor ID */
+ UInt16 queueIndex; /* destination queue index */
+ Int transId; /* message transport ID */
+ MessageQ_QueueId queue; /* destination data queue */
+} Xfm_OutputNode;
+
+/* module structure */
+typedef struct {
+ Bool run; /* main loop run flag */
+ volatile Bool ipcReady; /* IPC ready flag */
+ Semaphore_Handle ipcSem; /* IPC synchronizing object */
+ Queue_Handle descriptors;
+ Queue_Handle inputQue;
+ Queue_Handle outputQue;
+ Ptr heapMem; /* heap memory from SR-Zero */
+ SizeT heapSize;
+ HeapBuf_Handle msgHeap; /* message pool */
+ Xfm_Input input; /* input end-point */
+ Xfm_OutputNode output;
+ Semaphore_Struct ipcSemObj;
+ Queue_Struct descQueObj;
+ Queue_Struct inputQueObj;
+ Queue_Struct outputQueObj;
+} Xfm_Module;
+
+/* private functions */
+static void Xfm_destroy(void);
+static int Xfm_exec(void);
+static int Xfm_setup(void);
+static void Xfm_transform(Data_Buffer *input, Data_Buffer *output);
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+//static Int Mod_curInit = 0;
+
+static Xfm_Desc descPool[DESC_POOLSZ];
+
+static Xfm_Module Xfm_mod = {
+ FALSE, /* run */
+ FALSE, /* ipcReady */
+ NULL, /* ipcSem */
+ NULL, /* descriptors */
+ NULL, /* inputQue */
+ NULL, /* outputQue */
+ NULL, /* heapMem */
+ 0, /* heapSize */
+ NULL, /* msgHeap */
+ { SysCfg_DATA_RQUE, /* input.queueIndex */
+ NULL, /* input.queue */
+ MessageQ_INVALIDMESSAGEQ }, /* input.myQID */
+ { MultiProc_INVALIDID, /* output.procId */
+ MessageQ_INVALIDMESSAGEQ, /* output.queueIndex */
+ -1, /* output.transId */
+ MessageQ_INVALIDMESSAGEQ } /* output.queue */
+};
+
+
+/*
+ * ======== Xfm_taskFxn ========
+ */
+Void Xfm_taskFxn(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+ Log_print0(Diags_INFO, "Xfm_taskFxn: -->");
+
+ /* setup phase */
+ status = Xfm_setup();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* execute phase */
+ status = Xfm_exec();
+
+leave:
+ /* shutdown phase */
+ Xfm_destroy();
+
+ Log_print1(Diags_INFO, "Xfm_taskFxn: <-- %d", (IArg)status);
+}
+
+/*
+ * ======== Xfm_connect ========
+ */
+void Xfm_connect(UInt16 procId, UInt16 queueIndex)
+{
+ /* save connection information */
+ Xfm_mod.output.procId = procId;
+ Xfm_mod.output.queueIndex = queueIndex;
+ Xfm_mod.output.transId = 0;
+
+ /* open the destination message queue (reserved ) */
+ Xfm_mod.output.queue = MessageQ_openQueueId(queueIndex, procId);
+}
+
+/*
+ * ======== Xfm_disconnect ========
+ */
+void Xfm_disconnect(UInt16 procId, UInt16 queueIndex)
+{
+ Xfm_OutputNode *output = &Xfm_mod.output;
+
+ /* if already disconnected, nothing left to do */
+ if (output->queue == MessageQ_INVALIDMESSAGEQ) {
+ return;
+ }
+
+ /* validate connection information */
+ if ((output->procId != procId) || (output->queueIndex != queueIndex)) {
+ return;
+ }
+
+ /* close destination message queue */
+ MessageQ_close(&output->queue);
+
+ /* reset connection information */
+ output->procId = MultiProc_INVALIDID;
+ output->queueIndex = MessageQ_INVALIDMESSAGEQ;
+ output->transId = -1;
+}
+
+/*
+ * ======== Xfm_ipcDone ========
+ */
+int Xfm_ipcDone(void)
+{
+ return (Xfm_mod.ipcReady ? 0 : 1);
+}
+
+/*
+ * ======== Xfm_ipcIsReady ========
+ * Inform this module that IPC is ready
+ *
+ * This function is called from another execution context. Must
+ * be careful to ensure local resources have been created.
+ */
+void Xfm_ipcIsReady(void)
+{
+ Xfm_mod.ipcReady = TRUE;
+
+ /* semaphore might not yet exist, check create flag */
+ if (Xfm_mod.ipcSem != NULL) {
+ Semaphore_post(Xfm_mod.ipcSem);
+ }
+}
+
+/*
+ * ======== Xfm_isReady ========
+ */
+Bool Xfm_isReady(void)
+{
+ return (Xfm_mod.run);
+}
+
+/*
+ * ======== Xfm_shutdown ========
+ */
+void Xfm_shutdown(void)
+{
+ Xfm_mod.run = FALSE;
+ MessageQ_unblock(Xfm_mod.input.queue);
+}
+
+/*
+ * ======== Xfm_destroy ========
+ */
+static void Xfm_destroy(void)
+{
+ int msgCount;
+ Xfm_Desc *desc;
+ MessageQ_Msg mqMsg;
+ IHeap_Handle heap;
+
+ Log_print0(Diags_INFO, "Xfm_destroy: -->");
+
+ /* close destination queue if needed */
+ if (Xfm_mod.output.queue != MessageQ_INVALIDMESSAGEQ) {
+ Xfm_disconnect(Xfm_mod.output.procId, Xfm_mod.output.queueIndex);
+ }
+
+ /* reclaim data messages */
+ msgCount = 0;
+
+ /* look for data messages on output queue */
+ while (!Queue_empty(Xfm_mod.outputQue)) {
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.outputQue);
+ mqMsg = (MessageQ_Msg)desc->msg;
+ MessageQ_free(mqMsg);
+ msgCount++;
+ }
+
+ if (msgCount != PIPELINE_POOLSZ) {
+ Log_error1("Xfm_destroy: missing %d data messages",
+ PIPELINE_POOLSZ - msgCount);
+ }
+
+ /* delete the local message queue */
+ MessageQ_delete(&Xfm_mod.input.queue);
+ Xfm_mod.input.myQID = MessageQ_INVALIDMESSAGEQ;
+
+ /* finalize the message heap */
+ MessageQ_unregisterHeap(SysCfg_DataMsg_HeapID);
+ HeapBuf_delete(&Xfm_mod.msgHeap);
+
+ /* free heap memory back to SR-Zero heap */
+ heap = (IHeap_Handle)SharedRegion_getHeap(0);
+ Memory_free(heap, Xfm_mod.heapMem, Xfm_mod.heapSize);
+
+ /* done using IPC */
+ Xfm_mod.ipcReady = FALSE;
+
+ /* destruct the semaphore */
+ Xfm_mod.ipcSem = NULL;
+ Semaphore_destruct(&Xfm_mod.ipcSemObj);
+
+ /* disable log events */
+ Log_print0(Diags_INFO, "Xfm_delete: <--");
+ Diags_setMask(MODULE_NAME"-FEX");
+
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+/*
+ * ======== Xfm_exec ========
+ */
+static int Xfm_exec(void)
+{
+ int status;
+ MessageQ_Msg mqMsg;
+ MessageQ_QueueId replyQID;
+ Xfm_Desc *desc;
+ Data_Msg *dataMsg;
+ Data_Msg *inputDataMsg;
+ Data_Msg *outputDataMsg;
+ Data_Buffer *inputBuf;
+ Data_Buffer *outputBuf;
+ Bool inputReady = FALSE;
+ Bool outputReady = FALSE;
+
+ Log_print0(Diags_INFO, "Xfm_exec: -->");
+ Xfm_mod.run = TRUE;
+
+ /* main loop */
+ while (Xfm_mod.run) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Xfm_mod.input.queue, &mqMsg, MessageQ_FOREVER);
+
+ if (status == MessageQ_E_UNBLOCKED) {
+ Xfm_mod.run = FALSE;
+ status = 0;
+ continue;
+ }
+ else if (status < 0) {
+ Log_error1("Xfm_exec: message get error=%d", (IArg)status);
+ goto leave;
+ }
+
+ /* get available descriptor */
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.descriptors);
+
+ /* bind descriptor to data message */
+ dataMsg = (Data_Msg *)mqMsg;
+ desc->msg = dataMsg;
+
+ /* determine message ownership */
+ replyQID = MessageQ_getReplyQueue(mqMsg);
+
+ /* if my buffer, put empty return buffer onto output queue */
+ if (replyQID == Xfm_mod.input.myQID) {
+ Queue_enqueue(Xfm_mod.outputQue, &desc->link);
+ Log_print0(Diags_INFO, "received output buffer");
+ outputReady = TRUE;
+ }
+ else {
+ /* put new full buffer onto input queue */
+ Queue_enqueue(Xfm_mod.inputQue, &desc->link);
+ Log_print0(Diags_INFO, "received input buffer");
+ inputReady = TRUE;
+ }
+
+ /* if both input and output buffers available, transform data */
+ if (inputReady && outputReady) {
+
+ /* remove next buffer from input queue */
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.inputQue);
+ inputReady = (Queue_empty(Xfm_mod.inputQue) ? FALSE : TRUE);
+ inputDataMsg = desc->msg;
+ inputBuf = &inputDataMsg->data;
+
+ /* recycle descriptor */
+ desc->msg = NULL;
+ Queue_enqueue(Xfm_mod.descriptors, &desc->link);
+
+ /* remove next buffer from output queue */
+ desc = (Xfm_Desc *)Queue_dequeue(Xfm_mod.outputQue);
+ outputReady = (Queue_empty(Xfm_mod.outputQue) ? FALSE : TRUE);
+ outputDataMsg = desc->msg;
+ outputBuf = &outputDataMsg->data;
+
+ /* recycle descriptor */
+ desc->msg = NULL;
+ Queue_enqueue(Xfm_mod.descriptors, &desc->link);
+
+ /* transform input data to output buffer */
+ Log_print0(Diags_INFO, "process data");
+ Xfm_transform(inputBuf, outputBuf);
+
+ mqMsg = (MessageQ_Msg)outputDataMsg;
+ if (Xfm_mod.output.queue != MessageQ_INVALIDMESSAGEQ) {
+ /* send the output buffer to the downsteam node */
+ MessageQ_setTransportId(mqMsg, Xfm_mod.output.transId);
+ MessageQ_put(Xfm_mod.output.queue, mqMsg);
+ }
+ else {
+ /* recycle output buffer */
+ MessageQ_put(Xfm_mod.input.myQID, mqMsg);
+ }
+
+ /* return input buffer to the upstream node */
+ mqMsg = (MessageQ_Msg)inputDataMsg;
+ replyQID = MessageQ_getReplyQueue(mqMsg);
+ MessageQ_put(replyQID, mqMsg);
+ }
+ }
+
+leave:
+ Log_print1(Diags_INFO, "Xfm_exec: <-- %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Xfm_setup ========
+ */
+static int Xfm_setup(void)
+{
+ int status = 0;
+ int i;
+ Error_Block eb;
+ Semaphore_Params semParams;
+ Registry_Result result;
+ IHeap_Handle heap;
+ SizeT align;
+ SizeT blockSize;
+ HeapBuf_Params heapParams;
+ MessageQ_Params msgqParams;
+ MessageQ_Msg mqMsg;
+
+ Error_init(&eb);
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+
+ if ((result != Registry_SUCCESS) && (result != Registry_ALREADY_ADDED)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* enable some trace */
+ Diags_setMask(MODULE_NAME"+F");
+ Log_print0(Diags_INFO, "Xfm_setup: -->");
+
+ /* put descriptors onto the available list */
+ Queue_construct(&Xfm_mod.descQueObj, NULL);
+ Xfm_mod.descriptors = Queue_handle(&Xfm_mod.descQueObj);
+
+ for (i = 0; i < DESC_POOLSZ; i++) {
+ Queue_enqueue(Xfm_mod.descriptors, &(descPool[i].link));
+ }
+
+ /* construct the input and output holding queues */
+ Queue_construct(&Xfm_mod.inputQueObj, NULL);
+ Xfm_mod.inputQue = Queue_handle(&Xfm_mod.inputQueObj);
+ Queue_construct(&Xfm_mod.outputQueObj, NULL);
+ Xfm_mod.outputQue = Queue_handle(&Xfm_mod.outputQueObj);
+
+ /* construct the semaphore */
+ Semaphore_Params_init(&semParams);
+ semParams.mode = Semaphore_Mode_BINARY;
+
+ Semaphore_construct(&Xfm_mod.ipcSemObj, 0, &semParams);
+
+ if (Error_check(&eb)) {
+ status = -1;
+ goto leave;
+ }
+ Xfm_mod.ipcSem = Semaphore_handle(&Xfm_mod.ipcSemObj);
+
+ /* wait here until IPC is ready */
+ if (!Xfm_mod.ipcReady) {
+ Semaphore_pend(Xfm_mod.ipcSem, BIOS_WAIT_FOREVER);
+ }
+ Log_print0(Diags_INFO, "Xfm_setup: IPC ready");
+
+ /* acquire heap memory from SR-Zero, pad the block size to alignment */
+ heap = (IHeap_Handle)SharedRegion_getHeap(0);
+ align = Memory_getMaxDefaultTypeAlign();
+ blockSize = (sizeof(Data_Msg) + (align-1)) & ~(align-1);
+ Xfm_mod.heapSize = MESSAGE_POOLSZ * blockSize;
+
+ Xfm_mod.heapMem = Memory_alloc(heap, Xfm_mod.heapSize, align, &eb);
+
+ if (Error_check(&eb)) {
+ status = -1;
+ goto leave;
+ }
+
+ /* create a heap for data message pool */
+ HeapBuf_Params_init(&heapParams);
+ heapParams.align = align;
+ heapParams.blockSize = blockSize;
+ heapParams.numBlocks = MESSAGE_POOLSZ;
+ heapParams.buf = Xfm_mod.heapMem;
+ heapParams.bufSize = Xfm_mod.heapSize;
+
+ Xfm_mod.msgHeap = HeapBuf_create(&heapParams, &eb);
+
+ if (Error_check(&eb)) {
+ Log_error0("Xfm_setup: heap create failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* register heap with MessageQ */
+ status = MessageQ_registerHeap(Xfm_mod.msgHeap, SysCfg_DataMsg_HeapID);
+
+ if (status < 0) {
+ Log_error0("Xfm_setup: heap already exists");
+ status = -1;
+ goto leave;
+ }
+
+ /* create reserved message queue (data queue) */
+ MessageQ_Params_init(&msgqParams);
+ msgqParams.queueIndex = Xfm_mod.input.queueIndex;
+
+ Xfm_mod.input.queue = MessageQ_create(NULL, &msgqParams);
+
+ if (Xfm_mod.input.queue == NULL) {
+ status = -1;
+ Log_error0("Xfm_setup: message queue create failed");
+ goto leave;
+ }
+
+ Xfm_mod.input.myQID = MessageQ_getQueueId(Xfm_mod.input.queue);
+
+ /* allocate output buffers to prime the pipeline */
+ for (i = 1; i <= PIPELINE_POOLSZ; i++) {
+ mqMsg = MessageQ_alloc(SysCfg_DataMsg_HeapID, sizeof(Data_Msg));
+
+ if (mqMsg == NULL) {
+ Log_error0("Xfm_setup: message alloc failed");
+ status = -1;
+ goto leave;
+ }
+
+ /* put message onto my own input queue */
+ MessageQ_setMsgId(mqMsg, Data_MSGID);
+ MessageQ_setReplyQueue(Xfm_mod.input.queue, mqMsg);
+ MessageQ_put(Xfm_mod.input.myQID, mqMsg);
+ }
+
+leave:
+ Log_print1(Diags_INFO, "Xfm_setup: <-- status=%d", status);
+ return (status);
+}
+
+/*
+ * ======== Xfm_transform ========
+ */
+static void Xfm_transform(Data_Buffer *input, Data_Buffer *output)
+{
+ int i;
+ int count;
+ UInt *inDatum, *outDatum;
+
+ count = input->count;
+ inDatum = input->buffer;
+ outDatum = output->buffer;
+
+ for (i = 0; i < count; i++) {
+ *outDatum++ = *inDatum++;
+ }
+
+ output->count = count;
+}
diff --git a/src/examples/templates/ex46_graph/transformer/Xfm.h b/src/examples/templates/ex46_graph/transformer/Xfm.h
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Xfm.h ========
+ */
+
+#ifndef Xfm__include
+#define Xfm__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Xfm_taskFxn(UArg arg0, UArg arg1);
+
+void Xfm_connect(UInt16 procId, UInt16 queueIndex);
+void Xfm_disconnect(UInt16 procId, UInt16 queueIndex);
+int Xfm_ipcDone(void);
+void Xfm_ipcIsReady(void);
+Bool Xfm_isReady(void);
+void Xfm_shutdown(void);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/src/examples/templates/ex67_buffer/host/App.c b/src/examples/templates/ex67_buffer/host/App.c
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== App.c ========
+ *
+ */
+
+/* host header files */
+#include <stdio.h>
+#include <unistd.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+#include "App.h"
+
+#define BUFFERSIZE 128 /* Size of data buffers (32-bit elements) */
+#define NUMPRIMEBUFS 3 /* Number of buffers used to prime the pipeline */
+#define NUMBUFS 15 /* total number of buffers sent to slave core */
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; /* created locally */
+ MessageQ_QueueId slaveQue; /* opened remotely */
+ UInt16 heapId; /* MessageQ heapId */
+ UInt32 msgSize; /* size of a message */
+ shm_buf bufs[NUMPRIMEBUFS]; /* priming buffers */
+} App_Module;
+
+/* private data */
+static App_Module Module;
+
+/*
+ * ======== verify ========
+ */
+static Int verify(UInt32 * buf, UInt32 size)
+{
+ UInt32 i;
+
+ if (buf == NULL) {
+ return -1;
+ }
+
+ for (i = 0; i < size; i++) {
+ if (buf[i] != i) {
+ /* Bad data */
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * ======== initBuf ========
+ */
+static Int initBuf(UInt32 * buf, UInt32 size)
+{
+ UInt32 i;
+
+ if (buf == NULL) {
+ return -1;
+ }
+
+ for (i = 0; i < size; i++) {
+ buf[i] = 0xC0FFEE;
+ }
+
+ return 0;
+}
+
+/*
+ * ======== physToVirt ========
+ */
+static UInt32 physToVirt(UInt32 pa)
+{
+ UInt32 i;
+
+ for (i = 0; i < NUMPRIMEBUFS; i++) {
+ if (pa == Module.bufs[i].phy_addr) {
+ return Module.bufs[i].vir_addr;
+ }
+ }
+
+ printf("physToVirt: Invalid physical address 0x%x\n", pa);
+ return 0;
+}
+
+/*
+ * ======== App_create ========
+ */
+
+Int App_create(UInt16 remoteProcId)
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ char msgqName[32];
+ UInt i;
+
+ printf("--> App_create:\n");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = App_MsgHeapId;
+ Module.msgSize = sizeof(App_Msg);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(App_HostMsgQueName, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ printf("App_create: Failed creating MessageQ\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* open the remote message queue */
+ sprintf(msgqName, App_SlaveMsgQueName, MultiProc_getName(remoteProcId));
+
+ do {
+ status = MessageQ_open(msgqName, &Module.slaveQue);
+ sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("App_create: Failed opening MessageQ\n");
+ goto leave;
+ }
+
+ /* allocate and initialize data buffers */
+ for (i = 0; i < NUMPRIMEBUFS; i++) {
+ status = SHM_alloc_aligned(BUFFERSIZE * sizeof(UInt32), sizeof(UInt32),
+ &Module.bufs[i]);
+ if (status < 0) {
+ printf("App_create: Could not allocate shared memory\n");
+ goto leave;
+ }
+ status = initBuf((UInt32 *)Module.bufs[i].vir_addr, BUFFERSIZE);
+ if (status < 0) {
+ printf("App_create: Could not initialize buffer\n");
+ goto leave;
+
+ }
+ }
+
+ printf("App_create: Host is ready\n");
+
+leave:
+ printf("<-- App_create:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_delete ========
+ */
+Int App_delete(Void)
+{
+ Int status;
+ UInt i;
+
+ printf("--> App_delete:\n");
+
+ /* free data buffers */
+ for (i = 0; i < NUMPRIMEBUFS; i++) {
+ status = SHM_release(&Module.bufs[i]);
+ if (status < 0) {
+ printf("App_delete: Failed to release shared memory\n");
+ goto leave;
+ }
+ }
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- App_delete:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_exec ========
+ */
+Int App_exec(Void)
+{
+ Int status;
+ Int i;
+ App_Msg * msg;
+ UInt32 bufferVA;
+ UInt32 bufferPA;
+
+ printf("--> App_exec:\n");
+
+ /* fill process pipeline */
+ for (i = 1; i <= NUMPRIMEBUFS; i++) {
+ printf("App_exec: sending message %d\n", i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = App_CMD_BUF;
+ msg->bufferSize = BUFFERSIZE;
+ msg->bufferPA = (UInt32)Module.bufs[i - 1].phy_addr;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* process steady state (keep pipeline full) */
+ for (i = NUMPRIMEBUFS + 1; i <= NUMBUFS; i++) {
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* verify the data buffer */
+ bufferPA = msg->bufferPA;
+ bufferVA = physToVirt(bufferPA);
+ status = verify((UInt32 *)bufferVA, BUFFERSIZE);
+ if (status < 0) {
+ printf("App_exec: Data verification failed!\n");
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ printf("App_exec: message received, sending message %d\n", i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ if (i == 15) {
+ /* Last message will tell the slave to shutdown */
+ msg->cmd = App_CMD_SHUTDOWN;
+ }
+ else {
+ msg->cmd = App_CMD_BUF;
+ msg->bufferSize = BUFFERSIZE;
+ msg->bufferPA = bufferPA;
+
+ /* Initialize the data buffer */
+ status = initBuf((UInt32 *)bufferVA, BUFFERSIZE);
+ if (status < 0) {
+ printf("App_exec: Failed to initialize buffer\n");
+ goto leave;
+ }
+ }
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* drain process pipeline */
+ for (i = 1; i <= NUMPRIMEBUFS; i++) {
+ printf("App_exec: message received\n");
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd == App_CMD_BUF) {
+ /* verify the data buffer */
+ bufferVA = physToVirt(msg->bufferPA);
+ status = verify((UInt32 *)bufferVA, BUFFERSIZE);
+ if (status < 0) {
+ printf("App_exec: Data verification failed!\n");
+ }
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+
+leave:
+ printf("<-- App_exec: %d\n", status);
+ return(status);
+}
diff --git a/src/examples/templates/ex67_buffer/host/App.h b/src/examples/templates/ex67_buffer/host/App.h
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== App.h ========
+ *
+ */
+
+#ifndef App__include
+#define App__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Int App_create(UInt16 remoteProcId);
+Int App_delete();
+Int App_exec();
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* App__include */
diff --git a/src/examples/templates/ex67_buffer/host/Qnx/app_host.use b/src/examples/templates/ex67_buffer/host/Qnx/app_host.use
--- /dev/null
@@ -0,0 +1,14 @@
+Usage:
+ app_host [options] procName
+
+Arguments:
+ procName : the name of the remote processor
+
+Options:
+ h : print this help message
+ l : list the available remote names
+
+Examples:
+ app_host DSP1
+ app_host -l
+ app_host -h
diff --git a/src/examples/templates/ex67_buffer/host/Qnx/arm/makefile b/src/examples/templates/ex67_buffer/host/Qnx/arm/makefile
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
diff --git a/src/examples/templates/ex67_buffer/host/Qnx/arm/o.g.le.v7/makefile b/src/examples/templates/ex67_buffer/host/Qnx/arm/o.g.le.v7/makefile
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+$(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g: \
+ $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.g.le.v7/libipc_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.g.le.v7/libutils_g.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc_g = -Bstatic
+LIBPOST_ipc_g = -Bdynamic
+LIBPREF_utils_g = -Bstatic
+LIBPOST_utils_g = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.g.le.v7
+LIBS += ipc_g
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.g.le.v7
+LIBS += utils_g
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7
+LIBS += sharedmemallocator
+
+# copy and rename executables to suit our preferences
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.g.le.v7/app_host_g \
+ $(PROJECT_ROOT)/../bin/debug/app_host
diff --git a/src/examples/templates/ex67_buffer/host/Qnx/arm/o.le.v7/makefile b/src/examples/templates/ex67_buffer/host/Qnx/arm/o.le.v7/makefile
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../../common.mk
+
+CCFLAGS += -O3
+
+$(PROJECT_ROOT)/arm/o.le.v7/app_host: \
+ $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.le.v7/libipc.a \
+ $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.le.v7/libutils.a \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc = -Bstatic
+LIBPOST_ipc = -Bdynamic
+LIBPREF_utils = -Bstatic
+LIBPOST_utils = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/api/arm/a.le.v7
+LIBS += ipc
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/utils/arm/a.le.v7
+LIBS += utils
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+EXTRA_LIBVPATH += $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7
+LIBS += sharedmemallocator
+
+# copy and rename executables to suite our preferences
+POST_BUILD = \
+ $(CP_HOST) \
+ $(PROJECT_ROOT)/arm/o.le.v7/app_host \
+ $(PROJECT_ROOT)/../bin/release/app_host
diff --git a/src/examples/templates/ex67_buffer/host/Qnx/common.mk b/src/examples/templates/ex67_buffer/host/Qnx/common.mk
--- /dev/null
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME = app_host
+
+define PINFO
+PINFO DESCRIPTION=MessageQ Example
+endef
+
+# don't install the binaries, they are copied in base makefile
+INSTALLDIR = bin/examples
+
+CCOPTS += -DOS_QNX
+
+# source path
+EXTRA_SRCVPATH += $(PROJECT_ROOT)/..
+SRCS = main_host.c App.c
+
+# include path
+EXTRA_INCVPATH += \
+ $(PROJECT_ROOT)/../.. \
+ $(IPC_INSTALL_DIR)/packages \
+ $(IPC_INSTALL_DIR)/qnx/include \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+ $(IPC_INSTALL_DIR)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
+
+include $(MKFILES_ROOT)/qtargets.mk
+
+LDFLAGS += -M
diff --git a/src/examples/templates/ex67_buffer/host/Qnx/makefile b/src/examples/templates/ex67_buffer/host/Qnx/makefile
--- /dev/null
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+LIST=CPU
+include recurse.mk
diff --git a/src/examples/templates/ex67_buffer/host/main_host.c b/src/examples/templates/ex67_buffer/host/main_host.c
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/*
+ * ======== main_host.c ========
+ *
+ */
+
+/* cstdlib header files */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "App.h"
+
+/* private functions */
+static Int Main_main(Void);
+static Int Main_parseArgs(Int argc, Char *argv[]);
+
+
+#define Main_USAGE "\
+Usage:\n\
+ app_host [options] procName\n\
+\n\
+Arguments:\n\
+ procName : the name of the remote processor\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+ l : list the available remote names\n\
+\n\
+Examples:\n\
+ app_host DSP1\n\
+ app_host -l\n\
+ app_host -h\n\
+\n"
+
+/* private data */
+static String Main_remoteProcName = NULL;
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Int status;
+
+ printf("--> main:\n");
+
+ /* parse command line */
+ status = Main_parseArgs(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* Ipc initialization */
+ status = Ipc_start();
+
+ if (status >= 0) {
+ /* application create, exec, delete */
+ status = Main_main();
+
+ /* Ipc finalization */
+ Ipc_stop();
+ }
+ else {
+ printf("Ipc_start failed: status = %d\n", status);
+ goto leave;
+ }
+
+leave:
+ printf("<-- main:\n");
+ status = (status >= 0 ? 0 : status);
+
+ return (status);
+}
+
+
+/*
+ * ======== Main_main ========
+ */
+Int Main_main(Void)
+{
+ UInt16 remoteProcId;
+ Int status = 0;
+
+ printf("--> Main_main:\n");
+
+ remoteProcId = MultiProc_getId(Main_remoteProcName);
+
+ if (remoteProcId == MultiProc_INVALIDID) {
+ printf("Error: %s, line %d: unrecognized core name: %s\n",
+ __FILE__, __LINE__, Main_remoteProcName);
+ goto leave;
+ }
+
+ /* application create phase */
+ status = App_create(remoteProcId);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = App_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = App_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- Main_main:\n");
+
+ status = (status >= 0 ? 0 : status);
+ return (status);
+}
+
+
+/*
+ * ======== Main_parseArgs ========
+ */
+Int Main_parseArgs(Int argc, Char *argv[])
+{
+ Int x, cp, opt, argNum;
+ UInt16 i, numProcs;
+ String name;
+ Int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ case 'l': /* -l */
+ printf("Processor List\n");
+ status = Ipc_start();
+ if (status >= 0) {
+ numProcs = MultiProc_getNumProcessors();
+ for (i = 0; i < numProcs; i++) {
+ name = MultiProc_getName(i);
+ printf(" procId=%d, procName=%s\n", i, name);
+ }
+ Ipc_stop();
+ }
+ else {
+ printf(
+ "Error: %s, line %d: Ipc_start failed\n",
+ __FILE__, __LINE__);
+ goto leave;
+ }
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (Char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ for (argNum = 1; opt < argc; argNum++, opt++) {
+
+ switch (argNum) {
+ case 1: /* name of proc #1 */
+ Main_remoteProcName = argv[opt];
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: too many arguments\n",
+ __FILE__, __LINE__);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* validate command line arguments */
+ if (Main_remoteProcName == NULL) {
+ printf("Error: missing procName argument\n");
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ return(status);
+}
diff --git a/src/examples/templates/ex67_buffer/host/makefile_qnx b/src/examples/templates/ex67_buffer/host/makefile_qnx
--- /dev/null
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+export PKGPATH
+
+#
+# Determine build host OS (Windows or Linux)
+#
+ifeq (,$(BUILDHOSTOS))
+ ifeq (,$(findstring :,$(WINDIR)$(windir)$(COMSPEC)$(comspec)))
+ BUILDHOSTOS := Linux
+ else
+ BUILDHOSTOS := Windows
+ endif
+endif
+
+ifeq (Linux,$(BUILDHOSTOS))
+QNX_PATH := $(QNX_INSTALL_DIR)/host/linux/x86/usr/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/bin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/host/linux/x86/usr/sbin
+QNX_PATH := $(QNX_PATH):$(QNX_INSTALL_DIR)/linux/x86/usr/photon/appbuilder
+endif
+
+export PATH
+
+export QNX_CONFIGURATION ?= $(QNX_INSTALL_DIR)/etc/qnx
+export QNX_HOST ?= $(QNX_INSTALL_DIR)/host/linux/x86
+export QNX_TARGET ?= $(QNX_INSTALL_DIR)/target/qnx6
+export MAKEFLAGS = -I$(QNX_INSTALL_DIR)/target/qnx6/usr/include
+export LD_LIBRARY_PATH ?= $(QNX_INSTALL_DIR)/host/linux/x86/usr/lib
+export IPC_INSTALL_DIR
+
+all: app
+
+app: PATH:=$(QNX_PATH):$(PATH)
+app:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C Qnx
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean:: PATH:=$(QNX_PATH):$(PATH)
+clean::
+ $(MAKE) -C Qnx clean
+ $(RMDIR) bin
+
+
+#
+# ======== install validation ========
+#
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+#
+# ======== standard macros ========
+#
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+#
+# ======== create output directories ========
+#
+ifneq (clean,$(MAKECMDGOALS))
+ifeq (,$(wildcard bin/debug))
+ $(shell $(MKDIR) -p bin/debug)
+endif
+ifeq (,$(wildcard bin/release))
+ $(shell $(MKDIR) -p bin/release)
+endif
+endif
diff --git a/src/examples/templates/ex67_buffer/makefile b/src/examples/templates/ex67_buffer/makefile
--- /dev/null
@@ -0,0 +1,102 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+PROCLIST = dsp1 dsp2 ipu1 ipu2 host
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+
+all: $(PROCLIST)
+
+$(PROCLIST):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@ PROCLIST="$(PROCLIST)"
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+EXEC_DIR=$(CURDIR)/install
+endif
+override EXEC_DIR:=$(EXEC_DIR)/ex67_buffer
+endif
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+clean: $(addsuffix _clean,$(PROCLIST))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(PROCLIST)):
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex67_buffer/mkpkg.xdt b/src/examples/templates/ex67_buffer/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,89 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (!this.hostOS.match(/qnx/)) {
+ throw ("Unsupported Host OS: " + this.hostOS);
+% }
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+% // readme.txt -> `this.example`/readme.txt @verbatim
+readme.txt -> `this.example`/readme.txt
+
+shared/AppCommon.h -> `this.example`/shared/AppCommon.h
+shared/config.bld -> `this.example`/shared/config.bld
+shared/ipc.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+
+% if (this.hostOS == "qnx") {
+host/main_host.c -> `this.example`/host/main_host.c
+host/App.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+% } else {
+% throw new Error("unsupported host operating system: " + this.hostOS);
+% }
+
+% if (this.hostOS == "qnx") {
+ host/makefile_qnx -> `this.example`/host/makefile
+ host/Qnx/app_host.use -> `this.example`/host/Qnx/app_host.use
+ host/Qnx/common.mk -> `this.example`/host/Qnx/common.mk
+ host/Qnx/makefile -> `this.example`/host/Qnx/makefile
+ host/Qnx/arm/makefile -> `this.example`/host/Qnx/arm/makefile
+ host/Qnx/arm/o.g.le.v7/makefile -> `this.example`/host/Qnx/arm/o.g.le.v7/makefile
+ host/Qnx/arm/o.le.v7/makefile -> `this.example`/host/Qnx/arm/o.le.v7/makefile
+% } else {
+% throw new Error("unsupported host operating system: " + this.hostOS);
+% }
+
+%%{
+ var outdir = "";
+
+ var baseIpu, maxIpu;
+ var baseDsp, maxDsp;
+ var outdir;
+
+ if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ baseIpu = 1;
+ maxIpu = 2;
+ baseDsp = 1;
+ maxDsp = 2;
+ }
+
+ /* IPU[1,2] */
+ for (var j = baseIpu; j <= maxIpu; j++) {
+ outdir = "ipu" + j;
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: outdir + "/Ipu" + j + ".cfg" },
+ { inFile: "slave/IpuAmmu_dra7xx.cfg", outFile: outdir + "/IpuAmmu.cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: outdir + "/MainIpu" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* DSP[1,2] */
+ for (var j = baseDsp; j <= maxDsp; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: outdir + "/Dsp" + j + ".cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: outdir + "/MainDsp" + j + ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+%%}
diff --git a/src/examples/templates/ex67_buffer/products.mak b/src/examples/templates/ex67_buffer/products.mak
--- /dev/null
@@ -0,0 +1,91 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ var isLinux = this.platform.match(/_linux_/);
+ var isQnx = this.platform.match(/_qnx_/);
+%%}
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+% if (isQnx) {
+#### QNX toolchain ####
+#QNX_INSTALL_DIR = $(DEPOT)/_your_qnx_install_
+% }
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+% if (isQnx) {
+ @echo "QNX_INSTALL_DIR = $(QNX_INSTALL_DIR)"
+% }
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex67_buffer/readme.txt b/src/examples/templates/ex67_buffer/readme.txt
--- /dev/null
@@ -0,0 +1,124 @@
+#
+# ======== readme.txt ========
+#
+buffer - Send buffer allocated with a custom allocator from client to
+server and back
+
+
+Overview
+=========================================================================
+This is a MessageQ-based example using the client/server pattern. It is a two
+processor example, where a host processor communicates with a slave processor,
+by sending pointers to buffers allocated using a custom allocation mechanism
+% if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+(shmemallocator) in the message payload.
+% } else {
+in the message payload.
+% }
+
+The slave processor is the server. It will create a named message queue.
+The server does not open any queues because it will extract the return
+address from the message header. The server returns all messages to the
+sender after inspecting and modifying the buffer. It does not access
+the message pool.
+
+The HOST processor is the client application. The client creates a named
+message queue. The client also creates and manages the message
+pool and the buffer pool. The client's return address, the physical address
+of an initialized data buffer and its size are set in the message header for
+each message before sending it to the server. The client then waits for a reply
+message from the server. When it receives the reply it checks the data buffer
+for the expected payload before sending another message down to the server.
+
+Messages are sent from host to slave and back 14 times. Then the host
+issues a shutdown message to the slave. The slave returns the message,
+shuts itself down and reinitializes itself for future runs.
+
+
+Build Instructions
+=========================================================================
+
+ 1. Create a work folder on your file system.
+
+ mkdir work
+
+ 2. Extract this example into your work folder.
+
+ cd work
+ unzip <...>/ex67_buffer.zip
+
+ 3. Setup the build environment. Edit products.mak and set the install paths
+ as defined by your physical development area. Each example has its own
+ products.mak file; you may also create/reuse a products.mak file in the
+ parent directory which will be used by all examples.
+
+ edit ex67_buffer/products.mak
+
+ IPC_INSTALL_DIR = <...>/ipc_m_mm_pp_bb
+ BIOS_INSTALL_DIR = <...>/bios_m_mm_pp_bb
+ XDC_INSTALL_DIR = <...>/xdctools_m_mm_pp_bb
+
+ The compilers ship with CCS. You can use them to build this example,
+ or download them separately from TI.
+
+ edit ex67_buffer/products.mak
+
+ DEPOT = <...>/ccsv6/tools/compiler
+
+ gnu.targets.arm.A15F = $(DEPOT)/gcc_arm_none_eabi_m_m_p
+ ti.targets.elf.C66 = $(DEPOT)/c6000_m_m_p
+ ti.targets.arm.elf.M4 = $(DEPOT)/arm_m_m_p
+
+ 4. Build the example. This will build only debug versions of the executables.
+ Edit the lower makefiles and uncomment the release goals to build both
+ debug and release executables.
+
+ cd ex67_buffer
+ make
+
+ By default, the example builds for host and dsp1. Look in the following
+ folders for the executables.
+
+ ex67_buffer/host/bin/debug/app_host.xa15fg
+ ex67_buffer/dsp1/bin/debug/server_dsp1.xe66
+
+ 5. Issue the following commands to clean your example.
+
+ cd ex67_buffer
+ make clean
+
+
+Build Configuration
+=========================================================================
+When building, you can choose which processors you wish to build for. Use these
+instructions to specify which processor to build and to configure the host to
+use the correct server.
+
+ 1. Specify which two processors to build. Edit the top-level makefile and
+ modify the PROCLIST macro to specify which processors to build. The
+ list of available processors in defined in the ALL macro. However,
+ the client must always run on the HOST. For example, follow these
+ steps to build for dsp1.
+
+ edit ex67_buffer/makefile
+
+ PROCLIST = dsp1 host
+
+ 2. Clean and build your example.
+
+ cd ex67_buffer
+ make clean
+ make
+
+% if (this.platform.match(/^DRA7XX_qnx_elf$/)) {
+Run instructions
+=========================================================================
+ 1. Launch memory allocator
+ shmemallocator
+
+ 2. Launch IPC for the core of your choice, e.g. DSP1
+ ipc DSP1 ex67_buffer/debug/server_dsp1.xe66
+
+ 3. Launch the application example to communicate with the core
+ ex67_buffer/debug/app_host DSP1
+% }
diff --git a/src/examples/templates/ex67_buffer/shared/AppCommon.h b/src/examples/templates/ex67_buffer/shared/AppCommon.h
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== AppCommon.h ========
+ *
+ */
+
+#ifndef AppCommon__include
+#define AppCommon__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*
+ * ======== Application Configuration ========
+ */
+
+/* notify commands 00 - FF */
+#define App_CMD_MASK 0xFF000000
+#define App_CMD_BUF 0x00000000 /* cc------ */
+#define App_CMD_SHUTDOWN 0x02000000 /* cc------ */
+
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ UInt32 cmd; /* command to slave core */
+ UInt32 bufferPA; /* data buffer physical address */
+ UInt32 bufferSize; /* data buffer size in 32-bit elements */
+} App_Msg;
+
+#define App_MsgHeapId 0
+#define App_HostMsgQueName "HOST:MsgQ:01"
+#define App_SlaveMsgQueName "%s:MsgQ:01" /* %s is each slave's Proc Name */
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* AppCommon__include */
diff --git a/src/examples/templates/ex67_buffer/shared/config.bld b/src/examples/templates/ex67_buffer/shared/config.bld
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+% if (this.platform.match(/^DRA7XX_(qnx)_elf$/)) {
+/* Memory Map for ti.platforms.evmDRA7XX:dsp1 and ti.platforms.evmDRA7XX:dsp2
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 9500_4000 ????_???? 10_0000 ( ~1 MB) EXT_CODE
+ * 9510_0000 ????_???? 10_0000 ( 1 MB) EXT_DATA
+ * 9520_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapDsp = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x95000000,
+ len: 0x00100000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x95100000,
+ len: 0x00100000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x95200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ },
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ],
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] =
+ Build.platformTable["ti.platforms.evmDRA7XX:dsp1"];
+
+
+
+/* Memory Map for ti.platforms.evmDRA7XX:ipu2
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
+ * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
+ * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu2 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x005FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00600000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80600000,
+ len: 0x09600000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu2.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu2.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu2.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu2.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu2.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu2.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+/* Memory Map for ti.platforms.evmDRA7XX:ipu1
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? F_C000 ( ~1 MB) EXT_CODE
+ * 8000_0000 ????_???? 20_0000 ( 2 MB) EXT_DATA
+ * 8020_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu1 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x000FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00200000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu1.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu1.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu1.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu1.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu1.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu1.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex67_buffer/shared/ipc.cfg.xs b/src/examples/templates/ex67_buffer/shared/ipc.cfg.xs
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^DRA7XX_(qnx)_elf$/)) {
+var procNameAry = ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"];
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
+
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(Program.global.procName, procNameAry);
diff --git a/src/examples/templates/ex67_buffer/slave/Dsp.cfg b/src/examples/templates/ex67_buffer/slave/Dsp.cfg
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if (platform.match(/^DRA7XX_(qnx)_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+/* load the configuration shared across cores */
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = "EXT_CODE";
+
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+/* --------------------------- TICK --------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_NULL;
+//Clock.tickSource = Clock.TickSource_USER;
+/* Configure BIOS clock source as GPTimer5 */
+//Clock.timerId = 0;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+
+/* Skip the Timer frequency verification check. Need to remove this later */
+Timer.checkFrequency = false;
+
+/* Match this to the SYS_CLK frequency sourcing the dmTimers.
+ * Not needed once the SYS/BIOS family settings is updated. */
+Timer.intFreq.hi = 0;
+Timer.intFreq.lo = 19200000;
+
+//var timerParams = new Timer.Params();
+//timerParams.period = Clock.tickPeriod;
+//timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Switch off Software Reset to make the below settings effective */
+//timerParams.tiocpCfg.softreset = 0x0;
+/* Smart-idle wake-up-capable mode */
+//timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+//timerParams.twer.ovf_wup_ena = 0x1;
+//Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* Turn on the cache for shared memory */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(0x80000000, 0x5A00000, 1);
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
diff --git a/src/examples/templates/ex67_buffer/slave/Ipu.cfg b/src/examples/templates/ex67_buffer/slave/Ipu.cfg
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if (platform.match(/^(DRA7XX)_(qnx)_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.gates.GateHwi');
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+BIOS.smpEnabled = true; /* only support SMP mode on IPU */
+
+% if (platform.match(/^DRA7XX_(qnx)_elf$/)) {
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+
+% }
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+% if (platform.match(/^DRA7XX_(qnx)_elf$/)) {
+/* Remap the interrupt xbar mmr base address to match AMMU settings */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+% }
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+% if (platform.match(/^DRA7XX_(qnx)_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+/* dmTimer 0 mapped to GPT1 */
+dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
+/* dmTimer 1 mapped to GPT2 */
+dmTimer.timerSettings[1].baseAddr = 0x68032000;
+/* dmTimer 2 mapped to GPT3 */
+dmTimer.timerSettings[2].baseAddr = 0x68034000;
+/* dmTimer 3 mapped to GPT4 */
+dmTimer.timerSettings[3].baseAddr = 0x68036000;
+/* dmTimer 4 mapped to GPT5 */
+dmTimer.timerSettings[4].baseAddr = 0x68820000;
+/* dmTimer 5 mapped to GPT6 */
+dmTimer.timerSettings[5].baseAddr = 0x68822000;
+/* dmTimer 6 mapped to GPT7 */
+dmTimer.timerSettings[6].baseAddr = 0x68034000;
+/* dmTimer 7 mapped to GPT8 */
+dmTimer.timerSettings[7].baseAddr = 0x68036000;
+/* dmTimer 8 mapped to GPT9 */
+dmTimer.timerSettings[8].baseAddr = 0x6803E000;
+/* dmTimer 9 mapped to GPT10 */
+dmTimer.timerSettings[9].baseAddr = 0x68086000;
+/* dmTimer 10 mapped to GPT11 */
+dmTimer.timerSettings[10].baseAddr = 0x68088000;
+/* dmTimer 11 mapped to GPT12 */
+dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
+/* dmTimer 12 mapped to GPT13 */
+dmTimer.timerSettings[12].baseAddr = 0x68828000;
+/* dmTimer 13 mapped to GPT14 */
+dmTimer.timerSettings[13].baseAddr = 0x6882A000;
+/* dmTimer 14 mapped to GPT15 */
+dmTimer.timerSettings[14].baseAddr = 0x6882C000;
+/* dmTimer 15 mapped to GPT16 */
+dmTimer.timerSettings[15].baseAddr = 0x6882E000;
+% }
+
+/* use external timers because they keep running when IPU is not */
+var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
+halTimer.TimerProxy = dmTimer;
+
+/* ----------------------------- TICK ---------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+% if (platform.match(/^DRA7XX_(qnx)_elf$/)) {
+% if (lcCore.match(/^ipu1$/)) {
+/* Configure GPTimer11 as BIOS clock source */
+Clock.timerId = 10;
+% } else if (lcCore.match(/^ipu2$/)) {
+/* Configure GPTimer3 as BIOS clock source */
+Clock.timerId = 2;
+% }
+% }
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Smart-idle wake-up-capable mode */
+timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+timerParams.twer.ovf_wup_ena = 0x1;
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* configure the IPU AMMU */
+xdc.loadCapsule("IpuAmmu.cfg");
+
+
+/*
+ * ======== Power Management Configuration ========
+ */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.arm.ducati.smp.Power');
+Power.loadSegment = "PM_DATA";
+
+/* idle functions, power management functions should be last */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+
+/* function to flush unicache on each core */
+Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
+Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
+
+/* power management idle functions for each core */
+% if ((!platform.match(/^DRA7XX_qnx_elf$/)) || (!core.match(/ipu1/i))) {
+Idle.addCoreFunc('&IpcPower_idle', 0);
+Idle.addCoreFunc('&IpcPower_idle', 1);
+% }
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
+Hwi.nvicCCR.DIV_0_TRP = 1;
diff --git a/src/examples/templates/ex67_buffer/slave/IpuAmmu_dra7xx.cfg b/src/examples/templates/ex67_buffer/slave/IpuAmmu_dra7xx.cfg
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 3 small pages(1 4K and 2 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 16K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_16K;
+
+/* config small page[8] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50020000;
+AMMU.smallPages[8].translatedAddress = 0x55060000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large Page (512M); non-cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* TILER & DMM regions: Large page (512M); cacheable */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L1_posted = AMMU.PostedPolicy_POSTED;
diff --git a/src/examples/templates/ex67_buffer/slave/Server.c b/src/examples/templates/ex67_buffer/slave/Server.c
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== Server.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+
+#include <stdio.h>
+
+/* package header files */
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/remoteproc/Resource.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/sysbios/hal/Cache.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+
+/* module header file */
+#include "Server.h"
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; // host processor id
+ MessageQ_Handle slaveQue; // created locally
+} Server_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+
+/*
+ * ======== verify ========
+ * Perform data verification
+ */
+static Int verify(UInt32 * buffer, UInt32 size)
+{
+ UInt32 i;
+
+ if (buffer == NULL) {
+ return -1;
+ }
+
+ for (i = 0; i < size; i++) {
+ if (buffer[i] != 0xC0FFEE) {
+ /* Unexpected data received */
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * ======== fill ========
+ * Fill data buffer
+ */
+static Int fill(UInt32 * buffer, UInt32 size)
+{
+ UInt32 i;
+
+ if (buffer == NULL) {
+ return -1;
+ }
+
+ for (i = 0; i < size; i++) {
+ buffer[i] = i;
+ }
+
+ return 0;
+}
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+}
+
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ char msgqName[32];
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ sprintf(msgqName, App_SlaveMsgQueName, MultiProc_getName(MultiProc_self()));
+ Module.slaveQue = MessageQ_create(msgqName, &msgqParams);
+
+ if (Module.slaveQue == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: server is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
+ return (status);
+}
+
+
+
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ Bool running = TRUE;
+ App_Msg * msg;
+ MessageQ_QueueId queId;
+ UInt32 bufferVA;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd == App_CMD_SHUTDOWN) {
+ running = FALSE;
+ }
+ else {
+ /* Translate buffer address to virtual address on local core */
+ if (Resource_physToVirt((UInt32)msg->bufferPA, &bufferVA) !=
+ Resource_S_SUCCESS) {
+ Log_error0("Server_exec: Failed to translate buffer address");
+ goto leave;
+ }
+ /* Invalidate buffer prior to accessing it */
+ Cache_inv((Ptr)bufferVA, msg->bufferSize * sizeof(UInt32),
+ Cache_Type_ALL, TRUE);
+ /* Verify integrity of buffer */
+ status = verify((UInt32 *)bufferVA, msg->bufferSize);
+ if (status < 0) {
+ Log_error0("Server_exec: Data verification failed");
+ goto leave;
+ }
+ /* Fill buffer with data */
+ status = fill((UInt32 *)bufferVA, msg->bufferSize);
+ if (status < 0) {
+ Log_error0("Server_exec: Failed to fill buffer");
+ goto leave;
+ }
+ /* Writeback buffer after filling it */
+ Cache_wbInv((Ptr)bufferVA, msg->bufferSize * sizeof(UInt32),
+ Cache_Type_ALL, TRUE);
+ }
+
+ /* process the message */
+ Log_print1(Diags_INFO, "Server_exec: processed cmd=0x%x", msg->cmd);
+
+ /* send message back */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_exec: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Server_delete ========
+ */
+
+Int Server_delete()
+{
+ Int status;
+
+ Log_print0(Diags_ENTRY, "--> Server_delete:");
+
+ /* delete the video message queue */
+ status = MessageQ_delete(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_finish: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- Server_delete: %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+/*
+ * ======== Server_exit ========
+ */
+
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
diff --git a/src/examples/templates/ex67_buffer/slave/Server.h b/src/examples/templates/ex67_buffer/slave/Server.h
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Server.h ========
+ */
+
+#ifndef Server__include
+#define Server__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Server_init(Void);
+Void Server_exit(Void);
+
+Int Server_create(Void);
+Int Server_exec(Void);
+Int Server_delete(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* Server__include */
diff --git a/src/examples/templates/ex67_buffer/slave/Slave.cfg b/src/examples/templates/ex67_buffer/slave/Slave.cfg
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+var RB = (cfgArgs.profile == "release" ? true : false);
+
+% if (platform.match(/^DRA7XX_bios_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sdo.utils.MultiProc');
+
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+% if (platform.match(/DRA7XX/)) {
+xdc.global.SR0_cacheEnable = false;
+% } else {
+% throw new Error("unsupported platform: " + platform);
+% }
+xdc.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+% if (platform.match(/DRA7XX/) && target.match(/\.C66$/)) {
+
+/* make SR_0 non-cacheable */
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(ipc_cfg.SR0Mem.base, ipc_cfg.SR0Mem.len, Cache.Mar_DISABLE);
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/ipu[12]/)) {
+
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+% }
+
+/* select ipc libraries */
+var Build = xdc.useModule('ti.sdo.ipc.Build');
+Build.libType = (RB ? Build.LibType_NonInstrumented : Build.LibType_Debug);
+Build.assertsEnabled = (RB ? false : true);
+Build.logsEnabled = (RB ? false : true);
+
+
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1(?!-1)|ipu2/)) {
+/*
+ * ======== IPU/CORE0 Processor (primary core) ========
+ */
+% if (lcCore == "ipu1-0") {
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 0;
+% }
+
+/* enable the unicache */
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* configure ammu (because unicache is enabled) */
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+
+/* increase small page 0 to 16 KB */
+var entry = AMMU.smallPages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x00000000;
+entry.translatedAddress = 0x55020000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+
+/* increase small page 1 to 16 KB to access timers (non-cacheable) */
+var entry = AMMU.smallPages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x40000000;
+entry.translatedAddress = 0x55080000;
+entry.size = AMMU.Small_16K;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+/* map program code/data memory into ammu (cacheable) */
+var entry = AMMU.largePages[0];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.prog.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.prog.cache];
+
+/* map SR_0 ammu (non-cacheable) */
+var entry = AMMU.largePages[1];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_NO;
+entry.logicalAddress = configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.pa;
+entry.size = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.size];
+entry.L1_cacheable = AMMU[configBld.`lcCore.replace(/-/,"_")`_ammu.sr0.cache];
+
+/* map L3/L4 peripherals (mailbox, spinlock) into ammu (non-cacheable) */
+var entry = AMMU.largePages[3];
+entry.pageEnabled = AMMU.Enable_YES;
+entry.translationEnabled = AMMU.Enable_YES;
+entry.logicalAddress = 0x60000000;
+entry.translatedAddress = 0x40000000;
+entry.size = AMMU.Large_512M;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.volatileQualifier = AMMU.Volatile_FOLLOW;
+entry.executeOnly = AMMU.Enable_NO;
+entry.readOnly = AMMU.Enable_NO;
+entry.prefetch = AMMU.Enable_NO;
+entry.exclusion = AMMU.Enable_YES;
+entry.L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+entry.L1_posted = AMMU.PostedPolicy_NON_POSTED;
+entry.L1_allocate = AMMU.AllocatePolicy_NON_ALLOCATE;
+entry.L1_writePolicy = AMMU.WritePolicy_WRITE_THROUGH;
+
+% } else {
+/*
+ * ======== IPU/CORE1 Processor (slave core) ========
+ */
+
+/* must match hardware core id */
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+Core.id = 1;
+
+% }
+/* configure the interrupt cross-bar mmr base address */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+
+/* configure hardware spin lock base address to match ammu mapping of L3/L4 */
+var GateHWSpinlock = xdc.useModule('ti.sdo.ipc.gates.GateHWSpinlock');
+GateHWSpinlock.baseAddr = 0x6A0F6800;
+
+% }
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+
+/* no rts heap */
+Program.heap = 0;
+Program.argSize = 100; /* minimum size */
+% if (lcCore.match(/eve/)) {
+//Program.stack = 0x800; /* small stack needed to fit in DMEM */
+% }
+Program.stack = 0x1000;
+
+/* create a default heap */
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+% if (lcCore.match(/eve/)) {
+//heapMemParams.size = 0x1400; /* small heap needed to fit in DMEM */
+% }
+heapMemParams.size = 0x8000;
+
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* configure SMP-enabled System module */
+var SysMin = xdc.useModule('ti.sysbios.smp.SysMin');
+% } else {
+/* configure System module */
+var SysMin = xdc.useModule('xdc.runtime.SysMin');
+% }
+% if (lcCore.match(/eve/)) {
+//SysMin.bufSize = 0x200; /* small buffer needed to fit in DMEM */
+% }
+% }
+% else {
+% throw new Error("unsupported platform: " + platform);
+% }
+SysMin.bufSize = 0x1000;
+SysMin.flushAtExit = false;
+
+var System = xdc.useModule('xdc.runtime.System');
+System.SupportProxy = SysMin;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/eve/)) {
+
+/* place text character table in external memory, too big for DMEM */
+var Text_charTab = new prog.SectionSpec();
+Text_charTab.loadSegment = "`procName`_PROG";
+Program.sectMap[".const:xdc_runtime_Text_charTab__A"] = Text_charTab;
+
+/* reduce size of idle stack, too big for DMEM */
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.idleTaskStackSize = 0x200;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+
+/* Turn off the timer frequency check. The DSP timer does not run when
+ * the host is halted because of the emulation suspend signal.
+ */
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+Timer.checkFrequency = false;
+% }
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && lcCore.match(/dsp/)) {
+% if (lcCore == "dsp1") {
+
+/* allocate timers 5 and 6 to DSP1 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x0030;
+% } else {
+
+/* allocate timers 7 and 8 to DSP2 */
+var TimerSupport = xdc.useModule('ti.sysbios.family.shared.vayu.TimerSupport');
+TimerSupport.availMask = 0x00C0;
+% }
+% }
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = (RB ? BIOS.LibType_NonInstrumented : BIOS.LibType_Instrumented);
+// BIOS.libType = BIOS.LibType_Custom;
+// BIOS.libType = BIOS.LibType_Debug;
+% if (platform.match(/^DRA7XX_bios_elf$/)
+% && target.match(/\.M4$/)) {
+% if (lcCore.match(/ipu1-[01]/)) {
+
+BIOS.smpEnabled = false;
+% } else {
+
+BIOS.smpEnabled = true;
+% }
+% }
+
+
+/*
+ * ======== Miscellaneous Configuration ========
+ */
+
+/* set default diags mask */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+Defaults.common$.diags_ENTRY = Diags.ALWAYS_OFF;
+Defaults.common$.diags_EXIT = Diags.ALWAYS_OFF;
+Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INTERNAL = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_ASSERT = (RB ? Diags.ALWAYS_OFF : Diags.ALWAYS_ON);
+Defaults.common$.diags_STATUS = Diags.RUNTIME_ON;
+Defaults.common$.diags_USER1 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER2 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER3 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER4 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER5 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_USER6 = Diags.ALWAYS_OFF;
+Defaults.common$.diags_INFO = Diags.ALWAYS_OFF;
+Defaults.common$.diags_ANALYSIS = Diags.ALWAYS_OFF;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta(
+ "xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO,
+ Diags.RUNTIME_ON
+);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_ANALYSIS = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+
+% if (platform.match(/^DRA7XX_bios_elf$/)) {
+% if (lcCore.match(/ipu1$|ipu2/)) {
+/* create a SMP-enabled logger instance */
+var LoggerBuf = xdc.useModule('ti.sysbios.smp.LoggerBuf');
+% } else {
+/* create a logger instance */
+var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
+% }
+% }
+var loggerBufP = new LoggerBuf.Params();
+loggerBufP.numEntries = 256; /* 256 entries = 8 KB of memory */
+loggerBufP.bufType = LoggerBuf.BufType_FIXED;
+
+var appLogger = LoggerBuf.create(loggerBufP);
+appLogger.instance.name = "AppLog";
+Defaults.common$.logger = appLogger;
diff --git a/src/examples/templates/ex67_buffer/slave/main_slave.c b/src/examples/templates/ex67_buffer/slave/main_slave.c
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+%%{
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== main_`core`.c ========
+ *
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Server.h"
+
+/* private functions */
+static Void smain(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "smain";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Task_create(smain, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
+
+
+/*
+ * ======== smain ========
+ */
+Void smain(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+ Error_Block eb;
+ Bool running = TRUE;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");
+
+ Error_init(&eb);
+
+ /* initialize modules */
+ Server_init();
+
+ /* turn on Diags_INFO trace */
+ Diags_setMask("Server+F");
+
+ /* loop forever */
+ while (running) {
+
+ /* BEGIN server phase */
+
+ /* server setup phase */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* END server phase */
+
+ } /* while (running) */
+
+ /* finalize modules */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex67_buffer/slave/makefile b/src/examples/templates/ex67_buffer/slave/makefile
--- /dev/null
@@ -0,0 +1,209 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var cfgBldDir = "shared"; /* by default, may be overridden */
+
+ if (platform.match(/^DRA7XX_(qnx)_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+ if (target.match(/\.C66$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64P$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64T$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C674$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.ARP32(_far|)$/)) {
+ cc = "bin/cl-arp32";
+ lnk = "bin/cl-arp32 -z";
+ }
+ else if (target.match(/\.M3$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else if (target.match(/\.M4$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Server.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all: debug release
+
+debug:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+release:
+ $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+server_`lcCore`.x: bin/$(PROFILE)/server_`lcCore`.x`suffix`
+bin/$(PROFILE)/server_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $(objs) \
+ $(addprefix -l ,$(libs)) $(CONFIG)/linker.cmd $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/linker.cmd `PCT`/compiler.opt: $(CONFIG)/.config ;
+$(CONFIG)/.config: `core`.cfg ../`cfgBldDir`/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../`cfgBldDir`/config.bld -r $(PROFILE) \
+% if (target.match(/\.M3$|\.M4$/)) {
+ --cfgArgs "{ configBld: \"../`cfgBldDir`/config.bld\" }" \
+% }
+ `core`.cfg
+ @$(ECHO) "" > $@
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_`lcCore`.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+# entry point is set to an aligned address so that IPC can load the slave
+LDFLAGS = -w -q -u _c_int00 -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex68_power/host/App.c b/src/examples/templates/ex68_power/host/App.c
--- /dev/null
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== App.c ========
+ *
+ */
+
+/* host header files */
+#include <stdio.h>
+#include <unistd.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+#include "App.h"
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; // created locally
+ MessageQ_QueueId slaveQue; // opened remotely
+ UInt16 heapId; // MessageQ heapId
+ UInt32 msgSize;
+} App_Module;
+
+/* private data */
+static App_Module Module;
+
+
+/*
+ * ======== App_create ========
+ */
+
+Int App_create(UInt16 remoteProcId)
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ char msgqName[32];
+
+ printf("--> App_create:\n");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = App_MsgHeapId;
+ Module.msgSize = sizeof(App_Msg);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(App_HostMsgQueName, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ printf("App_create: Failed creating MessageQ\n");
+ status = -1;
+ goto leave;
+ }
+
+ /* open the remote message queue */
+ sprintf(msgqName, App_SlaveMsgQueName, MultiProc_getName(remoteProcId));
+
+ do {
+ status = MessageQ_open(msgqName, &Module.slaveQue);
+ sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("App_create: Failed opening MessageQ\n");
+ goto leave;
+ }
+
+ printf("App_create: Host is ready\n");
+
+leave:
+ printf("<-- App_create:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_delete ========
+ */
+Int App_delete(Void)
+{
+ Int status;
+
+ printf("--> App_delete:\n");
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- App_delete:\n");
+ return(status);
+}
+
+
+/*
+ * ======== App_exec ========
+ */
+Int App_exec(Void)
+{
+ Int status;
+ Int i;
+ App_Msg * msg;
+
+ printf("--> App_exec:\n");
+
+ /* fill process pipeline */
+ for (i = 1; i <= 3; i++) {
+ printf("App_exec: sending message %d\n", i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = App_CMD_NOP;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* process steady state (keep pipeline full) */
+ for (i = 4; i <= 15; i++) {
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* extract message payload */
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ printf("App_exec: message received, sending message %d\n", i);
+
+ /* allocate message */
+ msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ if (i == 15) {
+ /* Last message will tell the slave to shutdown */
+ msg->cmd = App_CMD_SHUTDOWN;
+ }
+ else {
+ msg->cmd = App_CMD_NOP;
+ }
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+ }
+
+ /* drain process pipeline */
+ for (i = 1; i <= 3; i++) {
+ printf("App_exec: message received\n");
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* extract message payload */
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+ }
+
+leave:
+ printf("<-- App_exec: %d\n", status);
+ return(status);
+}
diff --git a/src/examples/templates/ex68_power/host/App.h b/src/examples/templates/ex68_power/host/App.h
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== App.h ========
+ *
+ */
+
+#ifndef App__include
+#define App__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Int App_create(UInt16 remoteProcId);
+Int App_delete();
+Int App_exec();
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* App__include */
diff --git a/src/examples/templates/ex68_power/host/main_host.c b/src/examples/templates/ex68_power/host/main_host.c
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/*
+ * ======== main_host.c ========
+ *
+ */
+
+/* cstdlib header files */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+% if (!this.platform.match(/^DRA7XX_qnx_elf$/)) {
+#include <ti/ipc/transports/TransportRpmsg.h>
+% }
+
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "App.h"
+
+/* private functions */
+static Int Main_main(Void);
+static Int Main_parseArgs(Int argc, Char *argv[]);
+
+
+#define Main_USAGE "\
+Usage:\n\
+ app_host [options] procName\n\
+\n\
+Arguments:\n\
+ procName : the name of the remote processor\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+ l : list the available remote names\n\
+\n\
+Examples:\n\
+ app_host DSP1\n\
+ app_host -l\n\
+ app_host -h\n\
+\n"
+
+/* private data */
+static String Main_remoteProcName = NULL;
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Int status;
+
+ printf("--> main:\n");
+
+ /* parse command line */
+ status = Main_parseArgs(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+% if (!this.platform.match(/^DRA7XX_qnx_elf$/)) {
+ /* configure the transport factory */
+ Ipc_transportConfig(&TransportRpmsg_Factory);
+% }
+
+ /* Ipc initialization */
+ status = Ipc_start();
+
+ if (status >= 0) {
+ /* application create, exec, delete */
+ status = Main_main();
+
+ /* Ipc finalization */
+ Ipc_stop();
+ }
+ else {
+ printf("Ipc_start failed: status = %d\n", status);
+ goto leave;
+ }
+
+leave:
+ printf("<-- main:\n");
+ status = (status >= 0 ? 0 : status);
+
+ return (status);
+}
+
+
+/*
+ * ======== Main_main ========
+ */
+Int Main_main(Void)
+{
+ UInt16 remoteProcId;
+ Int status = 0;
+
+ printf("--> Main_main:\n");
+
+ remoteProcId = MultiProc_getId(Main_remoteProcName);
+
+ if (remoteProcId == MultiProc_INVALIDID) {
+ printf("Error: %s, line %d: unrecognized core name: %s\n",
+ __FILE__, __LINE__, Main_remoteProcName);
+ goto leave;
+ }
+
+ /* application create phase */
+ status = App_create(remoteProcId);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = App_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = App_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- Main_main:\n");
+
+ status = (status >= 0 ? 0 : status);
+ return (status);
+}
+
+
+/*
+ * ======== Main_parseArgs ========
+ */
+Int Main_parseArgs(Int argc, Char *argv[])
+{
+ Int x, cp, opt, argNum;
+ UInt16 i, numProcs;
+ String name;
+ Int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ case 'l': /* -l */
+ printf("Processor List\n");
+ status = Ipc_start();
+ if (status >= 0) {
+ numProcs = MultiProc_getNumProcessors();
+ for (i = 0; i < numProcs; i++) {
+ name = MultiProc_getName(i);
+ printf(" procId=%d, procName=%s\n", i, name);
+ }
+ Ipc_stop();
+ }
+ else {
+ printf(
+ "Error: %s, line %d: Ipc_start failed\n",
+ __FILE__, __LINE__);
+ goto leave;
+ }
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (Char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ for (argNum = 1; opt < argc; argNum++, opt++) {
+
+ switch (argNum) {
+ case 1: /* name of proc #1 */
+ Main_remoteProcName = argv[opt];
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: too many arguments\n",
+ __FILE__, __LINE__);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* validate command line arguments */
+ if (Main_remoteProcName == NULL) {
+ printf("Error: missing procName argument\n");
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ return(status);
+}
diff --git a/src/examples/templates/ex68_power/host/makefile_linux b/src/examples/templates/ex68_power/host/makefile_linux
--- /dev/null
@@ -0,0 +1,146 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== Makefile ========
+#
+%%{
+ if (this.platform.match(/^OMAPL138_linux_elf$/)) {
+ var suffix = 'ov5T';
+ } else {
+ var suffix = 'ov7A';
+ }
+%%}
+
+srcs = main_host.c App.c
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.`suffix`.dep,$(srcs)))
+
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.`suffix`,$(srcs)))
+libs = $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.a \
+ $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.a \
+ $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.a
+
+# Use dynamic or shared libs
+#libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.so \
+# $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.so \
+# $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.so
+
+all:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) PROFILE=debug app_host
+ $(MAKE) PROFILE=release app_host
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/app_host $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/app_host $(EXEC_DIR)/release
+
+clean::
+ $(RMDIR) bin
+
+
+#
+# ======== rules ========
+#
+app_host: bin/$(PROFILE)/app_host
+bin/$(PROFILE)/app_host: $(objs) $(libs)
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.`suffix`: %.c
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CC = $(TOOLCHAIN_PREFIX)gcc -c -MD -MF $@.dep
+AR = $(TOOLCHAIN_PREFIX)ar cr
+LD = $(TOOLCHAIN_PREFIX)gcc
+
+CPPFLAGS = -D_REENTRANT
+
+CFLAGS = -Wall -ffloat-store -fPIC -Wunused -Dfar= $(CCPROFILE_$(PROFILE)) \
+ -I. -I.. -I $(IPC_INSTALL_DIR)/linux/include -I $(IPC_INSTALL_DIR)/packages
+
+LDFLAGS = $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
+LDLIBS = -lpthread -lc -lrt
+
+CCPROFILE_debug = -ggdb -D DEBUG
+CCPROFILE_release = -O3 -D NDEBUG
+
+LDPROFILE_debug = -ggdb
+LDPROFILE_release = -O3
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex68_power/makefile b/src/examples/templates/ex68_power/makefile
--- /dev/null
@@ -0,0 +1,102 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+
+#
+# ======== makefile ========
+#
+
+# edit PROCLIST list to control how many executables to build
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+PROCLIST = dsp1 dsp2 ipu1 ipu2 host
+% } else {
+% throw new Error("unsupported platform: " + this.platform);
+% }
+
+EXBASE = .
+include $(EXBASE)/products.mak
+.PHONY: $(PROCLIST)
+
+.PHONY: install
+
+all: $(PROCLIST)
+
+$(PROCLIST):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(MAKE) -C $@ PROCLIST="$(PROCLIST)"
+
+help:
+ @$(ECHO) "make # build executables"
+ @$(ECHO) "make clean # clean everything"
+ @$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
+
+# setup install goal
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+EXEC_DIR=$(CURDIR)/install
+endif
+override EXEC_DIR:=$(EXEC_DIR)/ex68_power
+endif
+
+install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
+$(addsuffix _install,$(PROCLIST)):
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(MAKE) -C $(subst _install,,$@) EXEC_DIR=$(EXEC_DIR) install
+
+clean: $(addsuffix _clean,$(PROCLIST))
+ $(RMDIR) install
+
+$(addsuffix _clean,$(PROCLIST)):
+ $(MAKE) -C $(subst _clean,,$@) clean
+
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ INSTALL = $(XDC_INSTALL_DIR)/bin/cp
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ INSTALL = install
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
diff --git a/src/examples/templates/ex68_power/mkpkg.xdt b/src/examples/templates/ex68_power/mkpkg.xdt
--- /dev/null
@@ -0,0 +1,89 @@
+%%{
+ this.example = this.arguments[0];
+ this.platform = this.arguments[1]['platform'];
+ this.hostOS = this.arguments[1]['hostos'];
+ var MkPkg = xdc.module('xdc.tools.mkpkg.Main');
+%%}
+
+% if (!this.hostOS.match(/linux/)) {
+ throw ("Unsupported Host OS: " + this.hostOS);
+% }
+
+makefile -> `this.example`/makefile
+products.mak -> `this.example`/products.mak
+% // readme.txt -> `this.example`/readme.txt @verbatim
+readme.txt -> `this.example`/readme.txt
+
+shared/AppCommon.h -> `this.example`/shared/AppCommon.h
+shared/config.bld -> `this.example`/shared/config.bld
+shared/ipc.cfg.xs -> `this.example`/shared/ipc.cfg.xs
+
+% if (this.hostOS == "linux") {
+host/main_host.c -> `this.example`/host/main_host.c
+host/App.c -> `this.example`/host/App.c
+host/App.h -> `this.example`/host/App.h
+% } else {
+% throw new Error("unsupported host operating system: " + this.hostOS);
+% }
+
+% if (this.hostOS == "linux") {
+ host/makefile_linux -> `this.example`/host/makefile
+% } else {
+% throw new Error("unsupported host operating system: " + this.hostOS);
+% }
+
+%%{
+ var outdir = "";
+
+ var baseIpu, maxIpu;
+ var baseDsp, maxDsp;
+ var outdir;
+
+ if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+ baseIpu = 1;
+ maxIpu = 2;
+ baseDsp = 1;
+ maxDsp = 2;
+ }
+ /* IPU[1,2] */
+ for (var j = baseIpu; j <= maxIpu; j++) {
+ outdir = "ipu" + j;
+ var files = [
+ { inFile: "slave/Ipu.cfg", outFile: outdir + "/Ipu" + j +
+ ".cfg" },
+ { inFile: "slave/IpuAmmu_dra7xx.cfg", outFile: outdir +
+ "/IpuAmmu.cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/main_slave.c", outFile: outdir + "/MainIpu" + j +
+ ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Ipu" + j, "em4", "ti.targets.arm.elf.M4");
+ }
+ }
+
+ /* DSP[1,2] */
+ for (var j = baseDsp; j <= maxDsp; j++) {
+ outdir = "dsp" + j;
+ var files = [
+ { inFile: "slave/Dsp.cfg", outFile: outdir + "/Dsp" + j +
+ ".cfg" },
+ { inFile: "slave/Server.c", outFile: outdir + "/Server.c" },
+ { inFile: "slave/Server.h", outFile: outdir + "/Server.h" },
+ { inFile: "slave/power_rsc_table_dra7xx_dsp.h",
+ outFile: outdir + "/power_rsc_table_dra7xx_dsp.h" },
+ { inFile: "slave/main_slave.c", outFile: outdir + "/MainDsp" + j +
+ ".c" },
+ { inFile: "slave/makefile", outFile: outdir + "/makefile" }
+ ];
+ for (var i = 0; i < files.length; i++) {
+ MkPkg.mkpkg(this.input + "/" + files[i].inFile,
+ this.output + "/" + this.example + "/" + files[i].outFile,
+ this.platform, "Dsp" + j, "e66", "ti.targets.elf.C66");
+ }
+ }
+%%}
diff --git a/src/examples/templates/ex68_power/products.mak b/src/examples/templates/ex68_power/products.mak
--- /dev/null
@@ -0,0 +1,93 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ var isLinux = this.platform.match(/_linux_/);
+ var isQnx = this.platform.match(/_qnx_/);
+%%}
+
+#
+# ======== products.mak ========
+#
+
+# look for other products.mak file to override local settings
+ifneq (,$(wildcard $(EXBASE)/../products.mak))
+include $(EXBASE)/../products.mak
+else
+ifneq (,$(wildcard $(EXBASE)/../../products.mak))
+include $(EXBASE)/../../products.mak/
+# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
+IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
+endif
+endif
+
+# By default, the necessary build variables are found/assigned via
+# ../products.mak or ../../products.mak, included above. If you want to
+# override these variables, or are building this example without
+# ../products.mak or ../../products.mak, uncomment and assign the variables
+# below.
+
+#DEPOT = _your_depot_folder_
+
+% if (isLinux) {
+#### Linux toolchain ####
+#TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
+#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
+#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+% }
+
+#### BIOS-side dependencies ####
+#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
+#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
+#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+
+#### BIOS-side toolchains ####
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
+#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
+
+# Use this goal to print your product variables.
+.show:
+% if (isLinux) {
+ @echo "HOST TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
+% }
+ @echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
+ @echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
+ @echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+ @echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
+ @echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+% } else {
+% throw("Unrecognized platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex68_power/readme.txt b/src/examples/templates/ex68_power/readme.txt
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# ======== readme.txt ========
+#
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+MessageQ Example with power management enabled
+
+Program Logic:
+This is a MessageQ example using the client/server pattern. It is a two
+processor example - messages are only sent between the host processor (client)
+and the selected slave core (server).
+
+The slave creates a message to pass data around. The host sends a
+message to the slave core with a dummy payload. The slave then sends the
+message back to the host. This process is repeated 14 times. Then the host a
+shutdown message to the slave. The slave returns the message, shuts itself
+down and reinitializes itself for future runs.
+
+Power management is enabled on all slave cores in their corresponding
+BIOS configuration files.
+% }
diff --git a/src/examples/templates/ex68_power/shared/AppCommon.h b/src/examples/templates/ex68_power/shared/AppCommon.h
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== AppCommon.h ========
+ *
+ */
+
+#ifndef AppCommon__include
+#define AppCommon__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*
+ * ======== Application Configuration ========
+ */
+
+/* notify commands 00 - FF */
+#define App_CMD_MASK 0xFF000000
+#define App_CMD_NOP 0x00000000 /* cc------ */
+#define App_CMD_SHUTDOWN 0x02000000 /* cc------ */
+
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ UInt32 cmd;
+} App_Msg;
+
+#define App_MsgHeapId 0
+#define App_HostMsgQueName "HOST:MsgQ:01"
+#define App_SlaveMsgQueName "%s:MsgQ:01" /* %s is each slave's Proc Name */
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* AppCommon__include */
diff --git a/src/examples/templates/ex68_power/shared/config.bld b/src/examples/templates/ex68_power/shared/config.bld
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== config.bld ========
+ *
+ */
+var Build = xdc.useModule('xdc.bld.BuildEnvironment');
+
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+/* Memory Map for ti.platforms.evmDRA7XX:dsp1 and ti.platforms.evmDRA7XX:dsp2
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 9500_4000 ????_???? 10_0000 ( ~1 MB) EXT_CODE
+ * 9510_0000 ????_???? 10_0000 ( 1 MB) EXT_DATA
+ * 9520_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 7_0000 ( 448 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapDsp = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x95000000,
+ len: 0x00100000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x95100000,
+ len: 0x00100000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x95200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00070000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ },
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapDsp.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapDsp.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapDsp.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapDsp.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ],
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] =
+ Build.platformTable["ti.platforms.evmDRA7XX:dsp1"];
+
+
+
+/* Memory Map for ti.platforms.evmDRA7XX:ipu2
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? 5F_C000 ( ~6 MB) EXT_CODE
+ * 8000_0000 ????_???? 60_0000 ( 6 MB) EXT_DATA
+ * 8060_0000 ????_???? 960_0000 ( 86 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu2 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x005FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00600000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80600000,
+ len: 0x09600000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu2.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu2.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu2.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu2.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu2.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu2.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+
+/* Memory Map for ti.platforms.evmDRA7XX:ipu1
+ *
+ * --- External Memory ---
+ * Virtual Physical Size Comment
+ * ------------------------------------------------------------------------
+ * 0000_4000 ????_???? F_C000 ( ~1 MB) EXT_CODE
+ * 8000_0000 ????_???? 20_0000 ( 2 MB) EXT_DATA
+ * 8020_0000 ????_???? 30_0000 ( 3 MB) EXT_HEAP
+ * 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
+ * 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
+ * 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ */
+var evmDRA7XX_ExtMemMapIpu1 = {
+ EXT_CODE: {
+ name: "EXT_CODE",
+ base: 0x00004000,
+ len: 0x000FC000,
+ space: "code",
+ access: "RWX"
+ },
+ EXT_DATA: {
+ name: "EXT_DATA",
+ base: 0x80000000,
+ len: 0x00200000,
+ space: "data",
+ access: "RW"
+ },
+ EXT_HEAP: {
+ name: "EXT_HEAP",
+ base: 0x80200000,
+ len: 0x00300000,
+ space: "data",
+ access: "RW"
+ },
+ TRACE_BUF: {
+ name: "TRACE_BUF",
+ base: 0x9F000000,
+ len: 0x00060000,
+ space: "data",
+ access: "RW"
+ },
+ EXC_DATA: {
+ name: "EXC_DATA",
+ base: 0x9F060000,
+ len: 0x00010000,
+ space: "data",
+ access: "RW"
+ },
+ PM_DATA: {
+ name: "PM_DATA",
+ base: 0x9F070000,
+ len: 0x00020000,
+ space: "data",
+ access: "RWX" /* should this have execute perm? */
+ }
+};
+
+Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
+ externalMemoryMap: [
+ [ "EXT_CODE", evmDRA7XX_ExtMemMapIpu1.EXT_CODE ],
+ [ "EXT_DATA", evmDRA7XX_ExtMemMapIpu1.EXT_DATA ],
+ [ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu1.EXT_HEAP ],
+ [ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu1.TRACE_BUF ],
+ [ "EXC_DATA", evmDRA7XX_ExtMemMapIpu1.EXC_DATA ],
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu1.PM_DATA ]
+ ],
+ codeMemory: "EXT_CODE",
+ dataMemory: "EXT_DATA",
+ stackMemory: "EXT_DATA",
+};
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
diff --git a/src/examples/templates/ex68_power/shared/ipc.cfg.xs b/src/examples/templates/ex68_power/shared/ipc.cfg.xs
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * ======== ipc.cfg.xs ========
+ */
+var Program = xdc.useModule('xdc.cfg.Program');
+var cfgArgs = Program.build.cfgArgs;
+
+/* configure processor names */
+% if (this.platform.match(/^DRA7XX_linux_elf$/)) {
+var procNameAry = ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"];
+% } else {
+% throw ("Unsupported platform: " + this.platform);
+% }
+
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig(Program.global.procName, procNameAry);
diff --git a/src/examples/templates/ex68_power/slave/Dsp.cfg b/src/examples/templates/ex68_power/slave/Dsp.cfg
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if (platform.match(/^DRA7XX_linux_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+/* load the configuration shared across cores */
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = "EXT_CODE";
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+/* --------------------------- TICK --------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+/* Configure BIOS clock source */
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+% if (lcCore.match(/^dsp1$/)) {
+/* Configure GPTimer5 as BIOS clock source */
+Clock.timerId = 4;
+% } else if (lcCore.match(/^dsp2$/)) {
+/* Configure GPTimer6 as BIOS clock source */
+Clock.timerId = 5;
+% }
+% }
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+
+/* Skip the Timer frequency verification check. Need to remove this later */
+Timer.checkFrequency = false;
+
+/* Match this to the SYS_CLK frequency sourcing the dmTimers.
+ * Not needed once the SYS/BIOS family settings is updated. */
+Timer.intFreq.hi = 0;
+Timer.intFreq.lo = 19200000;
+
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Switch off Software Reset to make the below settings effective */
+timerParams.tiocpCfg.softreset = 0x0;
+/* Smart-idle wake-up-capable mode */
+timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+timerParams.twer.ovf_wup_ena = 0x1;
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+% if (lcCore.match(/^dsp1$/)) {
+var Deh = xdc.useModule('ti.deh.Deh');
+
+/* Must be placed before pwr mgmt */
+Idle.addFunc('&ti_deh_Deh_idleBegin');
+% }
+% }
+
+/*
+ * ======== Power Management Configuration ========
+ */
+/* Bring in modules used in Power Management */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.c66.vayu.Power');
+Power.loadSegment = "PM_DATA";
+
+/*
+ * Workaround for silicon bug
+ *
+ * IpcPower_callIdle must be placed in L2SRAM and not external memory
+ * to avoid CPU hang when going into idle. We do so by adding an entry
+ * into the resource table so that the loader can load to internal L2.
+ */
+Resource.customTable = true;
+Program.sectMap[".text:IpcPower_callIdle"] = "L2SRAM";
+
+/*
+ * Add function to support Power Management in the Idle loop
+ * Must be added after all other Idle functions
+ */
+Idle.addFunc('&IpcPower_idle');
+/* ============================================================= */
+
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
diff --git a/src/examples/templates/ex68_power/slave/Ipu.cfg b/src/examples/templates/ex68_power/slave/Ipu.cfg
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+
+/*
+ * ======== `core`.cfg ========
+ * Platform: `platform`
+ * Target: `target`
+ */
+
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+% if (platform.match(/^DRA7XX_linux_elf$/) && target.match(/\.M4$/)) {
+/* build arguments for this executable */
+var cfgArgs = Program.build.cfgArgs;
+var configBld = xdc.loadCapsule(cfgArgs.configBld);
+
+% }
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.gates.GateHwi');
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
+
+Program.global.procName = "`procName`";
+var ipc_cfg = xdc.loadCapsule("../shared/ipc.cfg.xs");
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+BIOS.smpEnabled = true; /* only support SMP mode on IPU */
+
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+var Core = xdc.useModule('ti.sysbios.family.arm.ducati.Core');
+% if (core.match(/ipu1/i)) {
+Core.ipuId = 1;
+% } else {
+Core.ipuId = 2;
+% }
+
+% }
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+/* Remap the interrupt xbar mmr base address to match AMMU settings */
+var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+IntXbar.mmrBaseAddr = 0x6A002000;
+% }
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var heapMemParams = new HeapMem.Params();
+heapMemParams.size = 0x8000;
+Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+/* Setup MessageQ transport */
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x8000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+/* Configure external timer base address to match resource table mapping.
+ */
+var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+/* dmTimer 0 mapped to GPT1 */
+dmTimer.timerSettings[0].baseAddr = 0x6AE18000;
+/* dmTimer 1 mapped to GPT2 */
+dmTimer.timerSettings[1].baseAddr = 0x68032000;
+/* dmTimer 2 mapped to GPT3 */
+dmTimer.timerSettings[2].baseAddr = 0x68034000;
+/* dmTimer 3 mapped to GPT4 */
+dmTimer.timerSettings[3].baseAddr = 0x68036000;
+/* dmTimer 4 mapped to GPT5 */
+dmTimer.timerSettings[4].baseAddr = 0x68820000;
+/* dmTimer 5 mapped to GPT6 */
+dmTimer.timerSettings[5].baseAddr = 0x68822000;
+/* dmTimer 6 mapped to GPT7 */
+dmTimer.timerSettings[6].baseAddr = 0x68034000;
+/* dmTimer 7 mapped to GPT8 */
+dmTimer.timerSettings[7].baseAddr = 0x68036000;
+/* dmTimer 8 mapped to GPT9 */
+dmTimer.timerSettings[8].baseAddr = 0x6803E000;
+/* dmTimer 9 mapped to GPT10 */
+dmTimer.timerSettings[9].baseAddr = 0x68086000;
+/* dmTimer 10 mapped to GPT11 */
+dmTimer.timerSettings[10].baseAddr = 0x68088000;
+/* dmTimer 11 mapped to GPT12 */
+dmTimer.timerSettings[11].baseAddr = 0x6AE20000;
+/* dmTimer 12 mapped to GPT13 */
+dmTimer.timerSettings[12].baseAddr = 0x68828000;
+/* dmTimer 13 mapped to GPT14 */
+dmTimer.timerSettings[13].baseAddr = 0x6882A000;
+/* dmTimer 14 mapped to GPT15 */
+dmTimer.timerSettings[14].baseAddr = 0x6882C000;
+/* dmTimer 15 mapped to GPT16 */
+dmTimer.timerSettings[15].baseAddr = 0x6882E000;
+% }
+
+/* use external timers because they keep running when IPU is not */
+var halTimer = xdc.useModule('ti.sysbios.hal.Timer');
+halTimer.TimerProxy = dmTimer;
+
+/* ----------------------------- TICK ---------------------------------------*/
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_USER;
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+% if (lcCore.match(/^ipu1$/)) {
+/* Configure GPTimer11 as BIOS clock source */
+Clock.timerId = 10;
+
+var WD = xdc.useModule('ti.deh.Watchdog');
+WD.timerIds.length = 2;
+WD.timerSettings.length = 2;
+WD.timerIds[0] = "GPTimer7";
+WD.timerSettings[0].intNum = 60;
+WD.timerSettings[0].eventId = -1;
+WD.timerIds[1] = "GPTimer8";
+WD.timerSettings[1].intNum = 61;
+WD.timerSettings[1].eventId = -1;
+
+var Xbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
+Xbar.connectIRQMeta(60, 38);
+Xbar.connectIRQMeta(61, 39);
+% } else if (lcCore.match(/^ipu2$/)) {
+/* Configure GPTimer3 as BIOS clock source */
+Clock.timerId = 2;
+% }
+% }
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+var timerParams = new Timer.Params();
+timerParams.period = Clock.tickPeriod;
+timerParams.periodType = Timer.PeriodType_MICROSECS;
+/* Smart-idle wake-up-capable mode */
+timerParams.tiocpCfg.idlemode = 0x3;
+/* Wake-up generation for Overflow */
+timerParams.twer.ovf_wup_ena = 0x1;
+Timer.create(Clock.timerId, Clock.doTick, timerParams);
+
+/* configure the IPU AMMU */
+xdc.loadCapsule("IpuAmmu.cfg");
+
+/* idle functions, power management functions should be last */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+
+/* function to flush unicache on each core */
+Idle.addCoreFunc('&VirtQueue_cacheWb', 0);
+Idle.addCoreFunc('&VirtQueue_cacheWb', 1);
+
+var Deh = xdc.useModule('ti.deh.Deh');
+
+/* Watchdog detection functions in each core */
+/* Must be placed before pwr mgmt */
+Idle.addCoreFunc('&ti_deh_Deh_idleBegin', 0);
+Idle.addCoreFunc('&ti_deh_Deh_idleBegin', 1);
+
+/*
+ * ======== Power Management Configuration ========
+ */
+/* Bring in modules used in Power Management */
+xdc.loadPackage('ti.pm');
+var Power = xdc.useModule('ti.sysbios.family.arm.ducati.smp.Power');
+Power.loadSegment = "PM_DATA";
+
+/*
+ * Add function to support Power Management in the Idle loop for each core
+ * Must be added after all other Idle functions
+ */
+Idle.addCoreFunc('&IpcPower_idle', 0);
+Idle.addCoreFunc('&IpcPower_idle', 1);
+/* ================================================ */
+
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.RUNTIME_OFF;
+Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;
+Registry.common$.diags_LIFECYCLE = Diags.RUNTIME_OFF;
+Registry.common$.diags_STATUS = Diags.RUNTIME_OFF;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
+Hwi.nvicCCR.DIV_0_TRP = 1;
diff --git a/src/examples/templates/ex68_power/slave/IpuAmmu_dra7xx.cfg b/src/examples/templates/ex68_power/slave/IpuAmmu_dra7xx.cfg
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/* -------------------------------- Cache ----------------------------------*/
+var Cache = xdc.useModule('ti.sysbios.hal.unicache.Cache');
+Cache.enableCache = true;
+
+/* -------------------------------- AMMU -----------------------------------*/
+var AMMU = xdc.useModule('ti.sysbios.hal.ammu.AMMU');
+/*********************** Small Pages *************************/
+/* smallPages[0] & smallPages[1] are auto-programmed by h/w */
+
+/* Overwrite smallPage[1] so that 16K is covered. H/w reset value configures
+ * only 4K */
+AMMU.smallPages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].logicalAddress = 0x40000000;
+AMMU.smallPages[1].translatedAddress = 0x55080000;
+AMMU.smallPages[1].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[1].size = AMMU.Small_16K;
+
+/* L2RAM: 64K mapped using 4 smallPages(16K); cacheable; translated */
+/* config small page[2] to map 16K VA 0x20000000 to PA 0x55020000 */
+AMMU.smallPages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].logicalAddress = 0x20000000;
+AMMU.smallPages[2].translatedAddress = 0x55020000;
+AMMU.smallPages[2].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[2].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[2].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[2].size = AMMU.Small_16K;
+
+/* config small page[3] to map 16K VA 0x20004000 to PA 0x55024000 */
+AMMU.smallPages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].logicalAddress = 0x20004000;
+AMMU.smallPages[3].translatedAddress = 0x55024000;
+AMMU.smallPages[3].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[3].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[3].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[3].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[3].size = AMMU.Small_16K;
+
+/* config small page[4] to map 16K VA 0x20008000 to PA 0x55028000 */
+AMMU.smallPages[4].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].logicalAddress = 0x20008000;
+AMMU.smallPages[4].translatedAddress = 0x55028000;
+AMMU.smallPages[4].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[4].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[4].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[4].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[4].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[4].size = AMMU.Small_16K;
+
+/* config small page[5] to map 16K VA 0x2000C000 to PA 0x5502C000 */
+AMMU.smallPages[5].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].logicalAddress = 0x2000C000;
+AMMU.smallPages[5].translatedAddress = 0x5502C000;
+AMMU.smallPages[5].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[5].L1_writePolicy = AMMU.WritePolicy_WRITE_BACK;
+AMMU.smallPages[5].L1_allocate = AMMU.AllocatePolicy_ALLOCATE;
+AMMU.smallPages[5].L1_posted = AMMU.PostedPolicy_POSTED;
+AMMU.smallPages[5].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.smallPages[5].size = AMMU.Small_16K;
+
+/* ISS: Use 3 small pages(1 4K and 2 16K) for various ISP registers; non-cacheable; translated */
+/* config small page[6] to map 16K VA 0x50000000 to PA 0x55040000 */
+/* non cacheable by default */
+AMMU.smallPages[6].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].logicalAddress = 0x50000000;
+AMMU.smallPages[6].translatedAddress = 0x55040000;
+AMMU.smallPages[6].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[6].size = AMMU.Small_16K;
+
+/* config small page[7] to map 16K VA 0x50010000 to PA 0x55050000 */
+/* non cacheable by default */
+AMMU.smallPages[7].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].logicalAddress = 0x50010000;
+AMMU.smallPages[7].translatedAddress = 0x55050000;
+AMMU.smallPages[7].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[7].size = AMMU.Small_16K;
+
+/* config small page[8] to map 4K VA 0x50020000 to PA 0x55060000 */
+/* non cacheable by default */
+AMMU.smallPages[8].pageEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].logicalAddress = 0x50020000;
+AMMU.smallPages[8].translatedAddress = 0x55060000;
+AMMU.smallPages[8].translationEnabled = AMMU.Enable_YES;
+AMMU.smallPages[8].size = AMMU.Small_4K;
+
+/*********************** Medium Pages *************************/
+/* ISS: The entire ISS register space using a medium page (256K); cacheable; translated */
+/* config medium page[0] to map 256K VA 0x50000000 to PA 0x55040000 */
+/* Make it L1 cacheable */
+AMMU.mediumPages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].logicalAddress = 0x50000000;
+AMMU.mediumPages[0].translatedAddress = 0x55040000;
+AMMU.mediumPages[0].translationEnabled = AMMU.Enable_YES;
+AMMU.mediumPages[0].size = AMMU.Medium_256K;
+AMMU.mediumPages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.mediumPages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+
+/*********************** Large Pages *************************/
+/* Instruction Code: Large page (512M); cacheable */
+/* config large page[0] to map 512MB VA 0x0 to L3 0x0 */
+AMMU.largePages[0].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[0].logicalAddress = 0x0;
+AMMU.largePages[0].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[0].size = AMMU.Large_512M;
+AMMU.largePages[0].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[0].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Peripheral regions: Large Page (512M); non-cacheable */
+/* config large page[1] to map 512MB VA 0x60000000 to L3 0x60000000 */
+AMMU.largePages[1].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[1].logicalAddress = 0x60000000;
+AMMU.largePages[1].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[1].size = AMMU.Large_512M;
+AMMU.largePages[1].L1_cacheable = AMMU.CachePolicy_NON_CACHEABLE;
+AMMU.largePages[1].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* Private, Shared and IPC Data regions: Large page (512M); cacheable */
+/* config large page[2] to map 512MB VA 0x80000000 to L3 0x80000000 */
+AMMU.largePages[2].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[2].logicalAddress = 0x80000000;
+AMMU.largePages[2].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[2].size = AMMU.Large_512M;
+AMMU.largePages[2].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[2].L1_posted = AMMU.PostedPolicy_POSTED;
+
+/* TILER & DMM regions: Large page (512M); cacheable */
+/* config large page[3] to map 512MB VA 0xA0000000 to L3 0xA0000000 */
+AMMU.largePages[3].pageEnabled = AMMU.Enable_YES;
+AMMU.largePages[3].logicalAddress = 0xA0000000;
+AMMU.largePages[3].translationEnabled = AMMU.Enable_NO;
+AMMU.largePages[3].size = AMMU.Large_512M;
+AMMU.largePages[3].L1_cacheable = AMMU.CachePolicy_CACHEABLE;
+AMMU.largePages[3].L1_posted = AMMU.PostedPolicy_POSTED;
diff --git a/src/examples/templates/ex68_power/slave/Server.c b/src/examples/templates/ex68_power/slave/Server.c
--- /dev/null
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+/*
+ * ======== Server.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/Registry.h>
+
+#include <stdio.h>
+
+/* package header files */
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "../shared/AppCommon.h"
+
+/* module header file */
+#include "Server.h"
+
+% if ((platform.match(/^DRA7XX_linux_elf$/)) && ((lcCore.match(/^dsp1$/))
+% || (lcCore.match(/^dsp2$/)))) {
+/* Custom resource table to add L2 RAM resource entry for PM workaround */
+#include "power_rsc_table_dra7xx_dsp.h"
+% }
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; // host processor id
+ MessageQ_Handle slaveQue; // created locally
+} Server_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+
+
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+}
+
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ char msgqName[32];
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ sprintf(msgqName, App_SlaveMsgQueName, MultiProc_getName(MultiProc_self()));
+ Module.slaveQue = MessageQ_create(msgqName, &msgqParams);
+
+ if (Module.slaveQue == NULL) {
+ status = -1;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: server is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
+ return (status);
+}
+
+
+
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ Bool running = TRUE;
+ App_Msg * msg;
+ MessageQ_QueueId queId;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
+
+ while (running) {
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd == App_CMD_SHUTDOWN) {
+ running = FALSE;
+ }
+
+ /* process the message */
+ Log_print1(Diags_INFO, "Server_exec: processed cmd=0x%x", msg->cmd);
+
+ /* send message back */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+ } /* while (running) */
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_exec: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Server_delete ========
+ */
+
+Int Server_delete()
+{
+ Int status;
+
+ Log_print0(Diags_ENTRY, "--> Server_delete:");
+
+ /* delete the video message queue */
+ status = MessageQ_delete(&Module.slaveQue);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_finish: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- Server_delete: %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+/*
+ * ======== Server_exit ========
+ */
+
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
diff --git a/src/examples/templates/ex68_power/slave/Server.h b/src/examples/templates/ex68_power/slave/Server.h
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * 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.
+ */
+
+/*
+ * ======== Server.h ========
+ */
+
+#ifndef Server__include
+#define Server__include
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+Void Server_init(Void);
+Void Server_exit(Void);
+
+Int Server_create(Void);
+Int Server_exec(Void);
+Int Server_delete(Void);
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* Server__include */
diff --git a/src/examples/templates/ex68_power/slave/main_slave.c b/src/examples/templates/ex68_power/slave/main_slave.c
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+%%{
+ var core = this.arguments[1];
+%%}
+
+/*
+ * ======== main_`core`.c ========
+ *
+ */
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* local header files */
+#include "Server.h"
+
+/* private functions */
+static Void smain(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "smain";
+ taskParams.arg0 = (UArg)argc;
+ taskParams.arg1 = (UArg)argv;
+ taskParams.stackSize = 0x1000;
+ Task_create(smain, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
+
+
+/*
+ * ======== smain ========
+ */
+Void smain(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+ Error_Block eb;
+ Bool running = TRUE;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");
+
+ Error_init(&eb);
+
+ /* initialize modules */
+ Server_init();
+
+ /* turn on Diags_INFO trace */
+ Diags_setMask("Server+F");
+
+ /* loop forever */
+ while (running) {
+
+ /* BEGIN server phase */
+
+ /* server setup phase */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* END server phase */
+
+ } /* while (running) */
+
+ /* finalize modules */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
+ return;
+}
diff --git a/src/examples/templates/ex68_power/slave/makefile b/src/examples/templates/ex68_power/slave/makefile
--- /dev/null
@@ -0,0 +1,209 @@
+#
+# Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+# 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.
+#
+%%{
+ // used to 'escape' the percent and backtick chars throughout
+ var PCT = '%';
+ var BKTK = '`';
+
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+
+ var lcCore = core.toLowerCase();
+ var platInst = "";
+ var cgtools = target;
+ var cfgBldDir = "shared"; /* by default, may be overridden */
+
+ if (platform.match(/^DRA7XX_linux_elf$/)) {
+ platInst = "ti.platforms.evmDRA7XX:" + lcCore;
+ } else {
+ throw new Error("unsupported platform: " + platform);
+ }
+
+ ldlibs = "$(CGTOOLS)/lib/libc.a"
+ if (target.match(/\.C66$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64P$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C64T$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.C674$/)) {
+ cc = "bin/cl6x";
+ lnk = "bin/cl6x -z";
+ }
+ else if (target.match(/\.ARP32(_far|)$/)) {
+ cc = "bin/cl-arp32";
+ lnk = "bin/cl-arp32 -z";
+ }
+ else if (target.match(/\.M3$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else if (target.match(/\.M4$/)) {
+ cc = "bin/armcl";
+ lnk = "bin/armcl -z";
+ }
+ else {
+ throw new Error("unsupported target: " + target);
+ }
+
+%%}
+
+#
+# ======== makefile ========
+#
+
+EXBASE = ..
+include $(EXBASE)/products.mak
+
+srcs = Main`core`.c Server.c
+objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`,$(srcs)))
+CONFIG = bin/$(PROFILE)/configuro
+
+PKGPATH := $(BIOS_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(IPC_INSTALL_DIR)/packages
+PKGPATH := $(PKGPATH)+$(XDC_INSTALL_DIR)/packages
+
+-include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.o`suffix`.dep,$(srcs)))
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+all: debug release
+
+debug:
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+release:
+ $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_`lcCore`.x
+
+server_`lcCore`.x: bin/$(PROFILE)/server_`lcCore`.x`suffix`
+bin/$(PROFILE)/server_`lcCore`.x`suffix`: $(objs) $(libs) $(CONFIG)/linker.cmd
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(LD) $(LDFLAGS) -o $@ $(objs) \
+ $(addprefix -l ,$(libs)) $(CONFIG)/linker.cmd $(LDLIBS)
+
+bin/$(PROFILE)/obj/%.o`suffix`: %.c $(CONFIG)/compiler.opt
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(CC) $(CPPFLAGS) $(CFLAGS) --output_file=$@ -fc $<
+
+`PCT`/linker.cmd `PCT`/compiler.opt: $(CONFIG)/.config ;
+$(CONFIG)/.config: `core`.cfg ../`cfgBldDir`/config.bld
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(subst +,;,$(PKGPATH))" \
+ xdc.tools.configuro -o $(CONFIG) \
+ -t `target` \
+ -c $(`cgtools`) \
+ -p `platInst` \
+ -b ../`cfgBldDir`/config.bld -r $(PROFILE) \
+% if (target.match(/\.M3$|\.M4$/)) {
+ --cfgArgs "{ configBld: \"../`cfgBldDir`/config.bld\" }" \
+% }
+ `core`.cfg
+ @$(ECHO) "" > $@
+
+install:
+ @$(ECHO) "#"
+ @$(ECHO) "# Making $@ ..."
+ @$(MKDIR) $(EXEC_DIR)/debug
+ $(CP) bin/debug/server_`lcCore`.x`suffix` $(EXEC_DIR)/debug
+ @$(MKDIR) $(EXEC_DIR)/release
+ $(CP) bin/release/server_`lcCore`.x`suffix` $(EXEC_DIR)/release
+
+help:
+ @$(ECHO) "make # build executable"
+ @$(ECHO) "make clean # clean everything"
+
+clean::
+ $(RMDIR) bin
+
+# ======== install validation ========
+ifeq (install,$(MAKECMDGOALS))
+ifeq (,$(EXEC_DIR))
+$(error must specify EXEC_DIR)
+endif
+endif
+
+# ======== toolchain macros ========
+CGTOOLS = $(`cgtools`)
+
+CC = $(CGTOOLS)/`cc` -c
+%// unused
+%// AR = $(CGTOOLS)/`ar`
+LD = $(CGTOOLS)/`lnk`
+%// unused
+%// ST = $(CGTOOLS)/`strip`
+
+CPPFLAGS =
+CFLAGS = -qq -pdsw225 -ppd=$@.dep -ppa $(CCPROFILE_$(PROFILE)) -@$(CONFIG)/compiler.opt -I.
+
+# entry point is set to an aligned address so that IPC can load the slave
+LDFLAGS = -w -q -u _c_int00 -c -m $(@D)/obj/$(@F).map
+LDLIBS = -l `ldlibs`
+
+CCPROFILE_debug = -D_DEBUG_=1 --symdebug:dwarf
+CCPROFILE_release = -O2
+
+# ======== standard macros ========
+ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
+ # use these on Windows
+ CP = $(XDC_INSTALL_DIR)/bin/cp
+ ECHO = $(XDC_INSTALL_DIR)/bin/echo
+ MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
+ RM = $(XDC_INSTALL_DIR)/bin/rm -f
+ RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
+else
+ # use these on Linux
+ CP = cp
+ ECHO = echo
+ MKDIR = mkdir -p
+ RM = rm -f
+ RMDIR = rm -rf
+endif
+
+# ======== create output directories ========
+ifneq (clean,$(MAKECMDGOALS))
+ifneq (,$(PROFILE))
+ifeq (,$(wildcard bin/$(PROFILE)/obj))
+ $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
+endif
+endif
+endif
diff --git a/src/examples/templates/ex68_power/slave/power_rsc_table_dra7xx_dsp.h b/src/examples/templates/ex68_power/slave/power_rsc_table_dra7xx_dsp.h
--- /dev/null
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+%%{
+ var platform = this.arguments[0];
+ var core = this.arguments[1];
+ var suffix = this.arguments[2];
+ var target = this.arguments[3];
+ var procName = core.toUpperCase();
+ var lcCore = core.toLowerCase();
+%%}
+/*
+ * ======== power_rsc_table_dra7xx_dsp.h ========
+ *
+ * Customized resource table to add an entry for L2SRAM.
+ */
+
+#ifndef _POWER_RSC_TABLE_DRA7XX_DSP_H_
+#define _POWER_RSC_TABLE_DRA7XX_DSP_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* DSP Memory Map */
+#define L4_DRA7XX_BASE 0x4A000000
+
+#define L4_PERIPHERAL_L4CFG (L4_DRA7XX_BASE)
+#define DSP_PERIPHERAL_L4CFG 0x4A000000
+
+#define L4_PERIPHERAL_L4PER1 0x48000000
+#define DSP_PERIPHERAL_L4PER1 0x48000000
+
+#define L4_PERIPHERAL_L4PER2 0x48400000
+#define DSP_PERIPHERAL_L4PER2 0x48400000
+
+#define L4_PERIPHERAL_L4PER3 0x48800000
+#define DSP_PERIPHERAL_L4PER3 0x48800000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define DSP_PERIPHERAL_L4EMU 0x54000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define DSP_PERIPHERAL_DMM 0x4E000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define DSP_TILER_MODE_0_1 0x60000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define DSP_TILER_MODE_2 0x70000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define DSP_TILER_MODE_3 0x78000000
+
+#define DSP_MEM_TEXT 0x95000000
+/* Co-locate alongside TILER region for easier flushing */
+#define DSP_MEM_IOBUFS 0x80000000
+#define DSP_MEM_DATA 0x95100000
+#define DSP_MEM_HEAP 0x95200000
+
+#define DSP_INTMEM_L2 0x00800000
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+% if (lcCore.match(/^dsp1$/)) {
+#define PHYS_MEM_L2_RAM 0x40800000
+% } else if (lcCore.match(/^dsp2$/)) {
+#define PHYS_MEM_L2_RAM 0x41000000
+% }
+% }
+% else {
+% throw ("Unsupported platform: " + platform);
+% }
+
+#define DSP_MEM_L2_RAM_SIZE 0x00040000
+
+#define DSP_MEM_IPC_DATA 0x9F000000
+#define DSP_MEM_IPC_VRING 0xA0000000
+#define DSP_MEM_RPMSG_VRING0 0xA0000000
+#define DSP_MEM_RPMSG_VRING1 0xA0004000
+#define DSP_MEM_VRING_BUFS0 0xA0040000
+#define DSP_MEM_VRING_BUFS1 0xA0080000
+
+#define DSP_MEM_IPC_VRING_SIZE SZ_1M
+#define DSP_MEM_IPC_DATA_SIZE SZ_1M
+#define DSP_MEM_TEXT_SIZE SZ_1M
+#define DSP_MEM_DATA_SIZE SZ_1M
+#define DSP_MEM_HEAP_SIZE (SZ_1M * 3)
+#define DSP_MEM_IOBUFS_SIZE (SZ_1M * 90)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ */
+/* See CMA BASE addresses in Linux side: arch/arm/mach-omap2/remoteproc.c */
+% if (platform.match(/^DRA7XX_linux_elf$/)) {
+% if (lcCore.match(/^dsp1$/)) {
+#define PHYS_MEM_IPC_VRING 0x99000000
+% } else if (lcCore.match(/^dsp2$/)) {
+#define PHYS_MEM_IPC_VRING 0x9F000000
+% }
+% }
+% else {
+% throw ("Unsupported platform: " + platform);
+% }
+
+/* Need to be identical to that of IPU */
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define DSP_RPMSG_VQ0_SIZE 256
+#define DSP_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_DSP_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[18]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* heap carveout entry */
+ struct fw_rsc_carveout heap_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+ /* L2 intmem entry */
+ struct fw_rsc_intmem l2_intmem;
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 18, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, heap_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, l2_intmem),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_DSP_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { DSP_MEM_RPMSG_VRING0, 4096, DSP_RPMSG_VQ0_SIZE, 1, 0 },
+ { DSP_MEM_RPMSG_VRING1, 4096, DSP_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_TEXT, 0,
+ DSP_MEM_TEXT_SIZE, 0, 0, "DSP_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_DATA, 0,
+ DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_HEAP, 0,
+ DSP_MEM_HEAP_SIZE, 0, 0, "DSP_MEM_HEAP",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_IPC_DATA, 0,
+ DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:dsp",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ DSP_MEM_IPC_VRING_SIZE, 0, 0, "DSP_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ DSP_MEM_IOBUFS_SIZE, 0, 0, "DSP_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "DSP_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER1, L4_PERIPHERAL_L4PER1,
+ SZ_2M, 0, 0, "DSP_PERIPHERAL_L4PER1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER2, L4_PERIPHERAL_L4PER2,
+ SZ_4M, 0, 0, "DSP_PERIPHERAL_L4PER2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER3, L4_PERIPHERAL_L4PER3,
+ SZ_8M, 0, 0, "DSP_PERIPHERAL_L4PER3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "DSP_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_INTMEM, 1,
+ DSP_INTMEM_L2, PHYS_MEM_L2_RAM,
+ DSP_MEM_L2_RAM_SIZE, 0, "DSP_MEM_L2_RAM",
+ },
+};
+
+#endif /* _POWER_RSC_TABLE_DRA7XX_DSP_H_ */
diff --git a/src/examples/templates/makefile b/src/examples/templates/makefile
--- /dev/null
@@ -0,0 +1,205 @@
+#
+# ======== makefile ========
+#
+
+help:
+ @echo "make release"
+ @echo "make clobber"
+ @echo "make DRA7XX_bios_elf"
+ @echo "make DRA7XX_linux_elf"
+ @echo "make DRA7XX_qnx_elf"
+ @echo "make DRA7XX_android_elf"
+ @echo "make TI814X_bios_elf"
+ @echo "make C6A8149_bios_elf"
+ @echo "make OMAPL138_linux_elf"
+ @echo "make OMAP54XX_qnx_elf"
+ @echo "make OMAP54XX_linux_elf"
+ @echo "make C6472_bios_elf"
+ @echo "make C6678_bios_elf"
+ @echo "make TDA3XX_bios_elf"
+ @echo "make TCI6638_linux_elf"
+ @echo "make TCI6636_bios_elf"
+ @echo "make TCI6636_linux_elf"
+ @echo "make 66AK2E_bios_elf"
+ @echo "make 66AK2E_linux_elf"
+ @echo "make 66AK2G_bios_elf"
+ @echo "make 66AK2G_linux_elf"
+ @echo "make TCI6630_bios_elf"
+ @echo "make TCI6630_linux_elf"
+
+release: DRA7XX_bios_elf
+release: DRA7XX_linux_elf
+release: DRA7XX_qnx_elf
+release: DRA7XX_android_elf
+release: TI814X_bios_elf
+release: C6A8149_bios_elf
+release: OMAPL138_linux_elf
+#release: OMAP54XX_qnx_elf
+#release: OMAP54XX_linux_elf
+release: C6472_bios_elf
+release: C6678_bios_elf
+release: TDA3XX_bios_elf
+release: TCI6638_linux_elf
+release: TCI6636_bios_elf
+release: TCI6636_linux_elf
+release: 66AK2E_bios_elf
+release: 66AK2E_linux_elf
+release: 66AK2G_bios_elf
+release: 66AK2G_linux_elf
+release: TCI6630_bios_elf
+release: TCI6630_linux_elf
+
+%_ex01_hello:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex01_hello .zip
+%_ex02_messageq:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex02_messageq .zip
+%_ex11_ping:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex11_ping .zip
+%_ex12_mmrpc:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex12_mmrpc .zip
+%_ex13_notifypeer:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex13_notifypeer .zip
+%_ex41_forwardmsg:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex41_forwardmsg .zip
+%_ex44_compute:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex44_compute .zip
+%_ex45_host:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex45_host .zip
+%_ex46_graph:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex46_graph .zip
+%_ex67_buffer:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex67_buffer .zip
+%_ex68_power:
+ @$(MAKE) PLATFORM=$(P) HOSTOS=$(O) NAME=ex68_power .zip
+
+
+DRA7XX_bios_elf: P=DRA7XX_bios_elf
+DRA7XX_bios_elf: O=bios
+DRA7XX_bios_elf: DRA7XX_bios_elf_ex01_hello
+DRA7XX_bios_elf: DRA7XX_bios_elf_ex02_messageq
+DRA7XX_bios_elf: DRA7XX_bios_elf_ex11_ping
+DRA7XX_bios_elf: DRA7XX_bios_elf_ex13_notifypeer
+
+DRA7XX_linux_elf: P=DRA7XX_linux_elf
+DRA7XX_linux_elf: O=linux
+DRA7XX_linux_elf: DRA7XX_linux_elf_ex02_messageq
+DRA7XX_linux_elf: DRA7XX_linux_elf_ex12_mmrpc
+DRA7XX_linux_elf: DRA7XX_linux_elf_ex41_forwardmsg
+DRA7XX_linux_elf: DRA7XX_linux_elf_ex68_power
+
+DRA7XX_qnx_elf: P=DRA7XX_qnx_elf
+DRA7XX_qnx_elf: O=qnx
+DRA7XX_qnx_elf: DRA7XX_qnx_elf_ex02_messageq
+DRA7XX_qnx_elf: DRA7XX_qnx_elf_ex41_forwardmsg
+DRA7XX_qnx_elf: DRA7XX_qnx_elf_ex12_mmrpc
+DRA7XX_qnx_elf: DRA7XX_qnx_elf_ex67_buffer
+
+DRA7XX_android_elf: P=DRA7XX_android_elf
+DRA7XX_android_elf: O=android
+DRA7XX_android_elf: DRA7XX_android_elf_ex02_messageq
+
+TI814X_bios_elf: P=TI814X_bios_elf
+TI814X_bios_elf: O=bios
+TI814X_bios_elf: TI814X_bios_elf_ex11_ping
+
+C6A8149_bios_elf: P=C6A8149_bios_elf
+C6A8149_bios_elf: O=bios
+C6A8149_bios_elf: C6A8149_bios_elf_ex11_ping
+
+C6472_bios_elf: P=C6472_bios_elf
+C6472_bios_elf: O=bios
+C6472_bios_elf: C6472_bios_elf_ex11_ping
+
+C6678_bios_elf: P=C6678_bios_elf
+C6678_bios_elf: O=bios
+C6678_bios_elf: 6678_bios_elf_ex11_ping
+
+OMAPL138_linux_elf: P=OMAPL138_linux_elf
+OMAPL138_linux_elf: O=linux
+OMAPL138_linux_elf: OMAPL138_linux_elf_ex11_ping
+OMAPL138_linux_elf: OMAPL138_linux_elf_ex02_messageq
+
+OMAP54XX_qnx_elf: P=OMAP54XX_qnx_elf
+OMAP54XX_qnx_elf: O=qnx
+OMAP54XX_qnx_elf: OMAP54XX_qnx_elf_ex12_mmrpc
+OMAP54XX_qnx_elf: OMAP54XX_qnx_elf_ex02_messageq
+
+OMAP54XX_linux_elf: P=OMAP54XX_linux_elf
+OMAP54XX_linux_elf: O=linux
+OMAP54XX_linux_elf: OMAP54XX_linux_elf_ex12_mmrpc
+OMAP54XX_linux_elf: OMAP54XX_linux_elf_ex02_messageq
+
+TDA3XX_bios_elf: P=TDA3XX_bios_elf
+TDA3XX_bios_elf: O=bios
+TDA3XX_bios_elf: TDA3XX_bios_elf_ex11_ping
+
+TCI6638_linux_elf: P=TCI6638_linux_elf
+TCI6638_linux_elf: O=linux
+TCI6638_linux_elf: TCI6638_linux_elf_ex44_compute
+TCI6638_linux_elf: TCI6638_linux_elf_ex45_host
+TCI6638_linux_elf: TCI6638_linux_elf_ex46_graph
+
+TCI6636_bios_elf: P=TCI6636_bios_elf
+TCI6636_bios_elf: O=bios
+TCI6636_bios_elf: TCI6636_bios_elf_ex11_ping
+TCI6636_bios_elf: TCI6636_bios_elf_ex02_messageq
+
+TCI6636_linux_elf: P=TCI6636_linux_elf
+TCI6636_linux_elf: O=linux
+TCI6636_linux_elf: TCI6636_linux_elf_ex02_messageq
+
+66AK2E_bios_elf: P=66AK2E_bios_elf
+66AK2E_bios_elf: O=bios
+66AK2E_bios_elf: 66AK2E_bios_elf_ex11_ping
+66AK2E_bios_elf: 66AK2E_bios_elf_ex02_messageq
+
+66AK2E_linux_elf: P=66AK2E_linux_elf
+66AK2E_linux_elf: O=linux
+66AK2E_linux_elf: 66AK2E_linux_elf_ex02_messageq
+
+66AK2G_bios_elf: P=66AK2G_bios_elf
+66AK2G_bios_elf: O=bios
+66AK2G_bios_elf: 66AK2G_bios_elf_ex11_ping
+66AK2G_bios_elf: 66AK2G_bios_elf_ex02_messageq
+
+66AK2G_linux_elf: P=66AK2G_linux_elf
+66AK2G_linux_elf: O=linux
+66AK2G_linux_elf: 66AK2G_bios_linux_ex02_messageq
+
+TCI6630_bios_elf: P=TCI6630_bios_elf
+TCI6630_bios_elf: O=bios
+TCI6630_bios_elf: TCI6630_bios_elf_ex11_ping
+TCI6630_bios_elf: TCI6630_bios_elf_ex02_messageq
+
+TCI6630_linux_elf: P=TCI6630_linux_elf
+TCI6630_linux_elf: O=linux
+TCI6630_linux_elf: TCI6630_linux_elf_ex02_messageq
+.zip:
+ @echo "#"
+ @echo "# Making $@ ..."
+ $(XDC_INSTALL_DIR)/xs --xdcpath="$(IPCTOOLS)/packages;." \
+ ti.ipc.utils.genbundle $(PLATFORM)_$(HOSTOS)_$(NAME)_out $(NAME) \
+ $(NAME) \
+ platform=$(PLATFORM) \
+ hostos=$(HOSTOS)
+ mkdir -p ../$(PLATFORM)
+ cd $(PLATFORM)_$(HOSTOS)_$(NAME)_out/; \
+ zip -r ../../$(PLATFORM)/$(NAME).zip $(NAME)
+ @rm -rf $(PLATFORM)_$(HOSTOS)_$(NAME)_out
+
+clobber:
+ @echo "#"
+ @echo "# Making $@ ..."
+ rm -rf ../OMAP*
+ rm -rf ../TI81*
+ rm -rf ../C6A81*
+ rm -rf ../VAYU*
+ rm -rf ../DRA7XX*
+ rm -rf ../C6472*
+ rm -rf ../C6678*
+ rm -rf ../TDA3XX*
+ rm -rf ../TCI6638*
+ rm -rf ../TCI6636*
+ rm -rf ../66AK2E*
+ rm -rf ../66AK2G*
+ rm -rf ../TCI6630*
diff --git a/src/examples/templates/readme.txt b/src/examples/templates/readme.txt
--- /dev/null
@@ -0,0 +1,50 @@
+IPC Examples Templates
+============================
+
+
+Example Categories
+------------------------------------------------------------------------
+ 1 - 10: Fundamental examples to illustrate basic module use.
+11 - 20: Fundamental examples to illustrate basic module use.
+21 - 30: --------
+31 - 40: Performance examples
+41 - 50: Application specific examples
+51 - 60: Application specific examples
+61 - 70: Specialty examples
+71 - 80: --------
+81 - 90: --------
+91 - 99: --------
+
+
+Example List
+------------------------------------------------------------------------
+ex01_helloworld The IPC hello world example
+ex02_messageq Use MessageQ module between host and slave.
+ex11_ping All-to-all core MessageQ example
+ex12_mmrpc MmRpc example between host and slave
+ex13_notifypeer Add peer using only notify driver
+
+ex31_fastboot Improvements for a fast boot time.
+ex32_footprint Improvements for a minimal code and data footprint.
+ex33_umsg Unidirectional message library.
+ex34_radar Example to illustrate umsg usage.
+ex35_perf Add performance instrumentation to ex34_radar example.
+
+ex41_forwardmsg Dual transport example that forwards received host
+ message to another slave core
+ex42_radio Radio receiver running on dsp. With UIA config.
+ex43_server Slave runs a server with application terminate support.
+ex44_compute Foundational architecture for processing node network.
+ex45_host Host-only IPC communiation.
+ex46_graph Interactive management of data-flow graph.
+ex54_execgraph Integrate the SA Execution Graph into executable
+
+ex61_dspmmu Build dsp executable with a virtual memory map.
+ex62_videoammu Build video executable with a virtual memory map.
+ex63_vpssammu Build vpss executable with a virtual memory map.
+ex64_metal Load and run a non-bios executable.
+ex65_overlay Use section overlays to run code from internal memory.
+ex66_overlaydma Copy sections to run address using dma.
+ex67_buffer Example that shows how to send buffers allocated by
+ a custom allocator using MessageQ
+ex68_power MessageQ example with power management enabled
diff --git a/src/makefile b/src/makefile
--- /dev/null
+++ b/src/makefile
@@ -0,0 +1,51 @@
+#
+# ======== makefile ========
+#
+export XDC_INSTALL_DIR
+
+j = 1
+
+MYMAKE=make --jobs=$(j)
+
+.examples: $(IPCTOOLS)/packages/ti/ipc/utils/genbundle/package
+ @echo "#"
+ @echo "# (makefile) Making $@ ..."
+ @$(MYMAKE) -C examples/templates release
+
+$(IPCTOOLS)/packages/ti/ipc/utils/genbundle/package:
+ $(XDC_INSTALL_DIR)/xdc XDCPATH="$(XDC_INSTALL_DIR)/packages;$(IPCTOOLS)/packages" release -Pr $(IPCTOOLS)/packages
+
+.clean:
+ @$(MYMAKE) -C examples/templates clobber
+
+extract:
+ @$(MYMAKE) -C examples extract \
+ PLATFORM=$(PLATFORM)
+
+clobber:
+ @$(MYMAKE) -C examples clobber
+ echo test1:
+
+tmp:
+ PLATFORM=$(PLATFORM) \
+ HOSTOS=$(HOSTOS)
+
+build:
+ @$(MYMAKE) -C examples all \
+ BIOS_INSTALL_DIR=$(BIOS_INSTALL_DIR) \
+ IPC_INSTALL_DIR=$(IPC_INSTALL_DIR) \
+ gnu.targets.arm.A15=$(gnu.targets.arm.A15) \
+ gnu.targets.arm.A15F=$(gnu.targets.arm.A15F) \
+ ti.targets.elf.C66=$(ti.targets.elf.C66) \
+ ti.targets.arm.elf.M3=$(ti.targets.arm.elf.M3) \
+ ti.targets.arm.elf.M4=$(ti.targets.arm.elf.M4) \
+ ti.targets.arm.elf.M4F=$(ti.targets.arm.elf.M4F) \
+ ti.targets.arp32.elf.ARP32_far=$(ti.targets.arp32.elf.ARP32_far) \
+ PLATFORM=$(PLATFORM)
+
+clean:
+ @$(MYMAKE) -C examples clean \
+ PLATFORM=$(PLATFORM) \
+ HOSTOS=$(HOSTOS)
+
+