summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 82e4969)
raw | patch | inline | side by side (parent: 82e4969)
author | vwan@ti.com <vwan@ti.com> | |
Mon, 26 Aug 2013 21:21:47 +0000 (14:21 -0700) | ||
committer | Chris Ring <cring@ti.com> | |
Wed, 28 Aug 2013 23:46:50 +0000 (16:46 -0700) |
Signed-off-by: VW <vwan@ti.com>
14 files changed:
diff --git a/packages/ti/ipc/tests/GateMPAppCommon.h b/packages/ti/ipc/tests/GateMPAppCommon.h
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+/*
+ * ======== GateMPAppCommon.h ========
+ *
+ */
+
+#ifndef GateMPAppCommon__include
+#define GateMPAppCommon__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+/*
+ * ======== Application Configuration ========
+ */
+
+/* notify commands 00 - FF */
+#define GATEMPAPP_CMD_MASK 0xFF000000
+
+/* used by host and remote device to synchronize states with each other*/
+#define GATEMPAPP_CMD_SPTR_ADDR 0x10000000
+#define GATEMPAPP_CMD_SPTR_ADDR_ACK 0x12000000
+#define GATEMPAPP_CMD_SHUTDOWN_ACK 0x20000000
+#define GATEMPAPP_CMD_SHUTDOWN 0x21000000
+#define GATEMPAPP_CMD_SYNC 0x30000000
+
+/* GateMP instance created on host */
+#define GATEMP_HOST_NAME "GATE_MP1"
+/* GateMP instance created on slave */
+#define GATEMP_SLAVE_NAME "GATE_MP2"
+
+/* queue error message*/
+#define GATEMPAPP_E_FAILURE 0xF0000000
+#define GATEMPAPP_E_UNEXPECTEDMSG 0xF2000000
+
+/* Number of times to lock/unlock */
+#define LOOP_ITR 300
+
+typedef struct {
+ MessageQ_MsgHeader reserved;
+ UInt32 cmd;
+ UInt32 payload;
+} GateMPApp_Msg;
+
+#define GateMPApp_MsgHeapId 0
+#define GateMPApp_HostMsgQueName "HOST:MsgQ:01"
+#define GateMPApp_SlaveMsgQueName "SLAVE:MsgQ:01"
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* GateMPAppCommon__include */
diff --git a/packages/ti/ipc/tests/gatempapp.c b/packages/ti/ipc/tests/gatempapp.c
--- /dev/null
@@ -0,0 +1,457 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== gatempapp.c ========
+ *
+ */
+
+/* this define must precede inclusion of any xdc header file */
+#define Registry_CURDESC Test__Desc
+#define MODULE_NAME "Server"
+
+/* xdctools header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Registry.h>
+
+/* package header files */
+#include <ti/ipc/Ipc.h>
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/GateMP.h>
+
+/* sytem header files */
+#include <stdlib.h>
+
+/* local header files */
+#include "gatempapp_rsc_table_vayu_dsp.h"
+#include "GateMPAppCommon.h"
+
+#define PHYSICAL_OFFSET 0xBA300000 /* base physical address of shared mem */
+#define VIRTUAL_OFFSET 0x80000000 /* base virtual address of shared mem */
+
+/* module structure */
+typedef struct {
+ UInt16 hostProcId; /* host processor id */
+ MessageQ_Handle slaveQue; /* created locally */
+ GateMP_Handle hostGateMPHandle; /* host created gate */
+ GateMP_Handle slaveGateMPHandle; /* slave created gate */
+} Server_Module;
+
+/* private data */
+Registry_Desc Registry_CURDESC;
+static Server_Module Module;
+
+/* private functions */
+static Void smain(UArg arg0, UArg arg1);
+
+
+/*
+ * ======== Server_init ========
+ */
+Void Server_init(Void)
+{
+ Registry_Result result;
+
+ /* register with xdc.runtime to get a diags mask */
+ result = Registry_addModule(&Registry_CURDESC, MODULE_NAME);
+ Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
+
+ /* initialize module object state */
+ Module.hostProcId = MultiProc_getId("HOST");
+ Module.slaveQue = NULL;
+ Module.hostGateMPHandle = NULL;
+ Module.slaveGateMPHandle = NULL;
+}
+
+
+/*
+ * ======== Server_create ========
+ */
+Int Server_create()
+{
+ Int status = 0;
+ MessageQ_Params msgqParams;
+ GateMP_Params gateParams;
+
+ /* enable some log events */
+ Diags_setMask(MODULE_NAME"+EXF");
+
+ /* create GateMP */
+ GateMP_Params_init(&gateParams);
+
+ gateParams.name = GATEMP_SLAVE_NAME;
+ gateParams.localProtect = GateMP_LocalProtect_PROCESS;
+ gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+
+ Module.slaveGateMPHandle = GateMP_create (&gateParams);
+
+ if (Module.slaveGateMPHandle == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ Log_print0(Diags_INFO, "Server_create: Failed to create GateMP");
+ goto leave;
+ }
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+ Module.slaveQue = MessageQ_create(GateMPApp_SlaveMsgQueName, &msgqParams);
+
+ if (Module.slaveQue == NULL) {
+ status = -1;
+ Log_print0(Diags_INFO, "Server_create: Failed to create MessageQ");
+ GateMP_delete(&Module.slaveGateMPHandle);
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_create: Slave is ready");
+
+leave:
+ Log_print1(Diags_EXIT, "<-- Server_create: %d", (IArg)status);
+ return (status);
+}
+
+
+
+
+/*
+ * ======== Server_exec ========
+ */
+Int Server_exec()
+{
+ Int status;
+ GateMPApp_Msg * msg;
+ MessageQ_QueueId queId;
+ UInt32 physAddr;
+ volatile UInt32 * intPtr = 0;
+ Int num = 0;
+ UInt i = 0;
+ IArg gateKey = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SPTR_ADDR) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* Get physical address of shared memory */
+ physAddr = msg->payload;
+
+ /* translate the physical address to slave virtual addr */
+ intPtr = (volatile UInt32 *)(physAddr - PHYSICAL_OFFSET + VIRTUAL_OFFSET);
+
+ /* process the message */
+ //Log_print1(Diags_INFO, "Server_exec: processed cmd=0x%x", msg->cmd);
+ /* send message back */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ msg->cmd = GATEMPAPP_CMD_SPTR_ADDR_ACK;
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+
+ Log_print0(Diags_INFO,"Server_exec: Modifying shared variable "
+ "value");
+
+ /* open host-created GateMP */
+ do {
+ status = GateMP_open(GATEMP_HOST_NAME, &Module.hostGateMPHandle);
+ } while (status == GateMP_E_NOTFOUND);
+
+ if (status < 0) {
+ Log_error0("Server_exec: Failed to open host-created GateMP");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ Log_print0(Diags_INFO,"Server_exec: Opened GateMP successfully");
+
+ Log_print0(Diags_INFO,"Server_exec: Using host-created gate");
+ for (i = 0;i < LOOP_ITR; i++) {
+
+ /* modify the shared variable as long as no one else is currently
+ * accessing it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.hostGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if ( rand() % 2) {
+ *intPtr -= 1;
+ }
+ else {
+ *intPtr += 1;
+ }
+
+ /* copy shared variable value */
+ num = *intPtr;
+
+ Log_print2(Diags_INFO, "Server_exec: Current shared variable "
+ "value %d, read value=%d", *intPtr, num);
+
+ if (*intPtr != num) {
+ Log_print0(Diags_INFO, "Server_exec: mismatch in variable value." \
+ "Test failed.");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* leave Gate */
+ GateMP_leave(Module.hostGateMPHandle, gateKey);
+ }
+
+ /* wait for sync message before we switch gates */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SYNC) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ queId = MessageQ_getReplyQueue(msg);
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+
+ Log_print0(Diags_INFO,"Server_exec: Using slave-created gate");
+
+ for (i = 0;i < LOOP_ITR; i++) {
+
+ /* modify the shared variable as long as no one else is currently
+ * accessing it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.slaveGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if ( rand() % 2) {
+ *intPtr -= 1;
+ }
+ else {
+ *intPtr += 1;
+ }
+
+ /* copy shared variable value */
+ num = *intPtr;
+
+ Log_print2(Diags_INFO, "Server_exec: Current "
+ "value=%d, read value=%d", *intPtr, num);
+
+ if (*intPtr != num) {
+ Log_print0(Diags_INFO, "Server_exec: mismatch in variable value." \
+ "Test failed.");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* leave Gate */
+ GateMP_leave(Module.slaveGateMPHandle, gateKey);
+ }
+
+leave:
+ if (Module.hostGateMPHandle) {
+ GateMP_close(&Module.hostGateMPHandle);
+ }
+
+ Log_print1(Diags_EXIT, "<-- Server_exec: %d", (IArg)status);
+ return(status);
+}
+
+/*
+ * ======== Server_delete ========
+ */
+Int Server_delete()
+{
+ Int status;
+ GateMPApp_Msg * msg;
+ MessageQ_QueueId queId;
+
+ Log_print0(Diags_ENTRY, "--> Server_delete:");
+
+ /* wait for inbound message */
+ status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ goto leave;
+ }
+ Log_print0(Diags_ENTRY, "--> Server_delete: got msg");
+ if (msg->cmd != GATEMPAPP_CMD_SHUTDOWN) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* close host GateMP */
+ GateMP_close(&Module.hostGateMPHandle);
+ Log_print0(Diags_ENTRY, "Server_delete: host GateMP closed");
+
+ /* send message back to say that GateMP has been cleaned up */
+ queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
+ msg->cmd = GATEMPAPP_CMD_SHUTDOWN_ACK;
+ MessageQ_put(queId, (MessageQ_Msg)msg);
+
+ /* delete the video message queue */
+ status = MessageQ_delete(&Module.slaveQue);
+ if (status < 0) {
+ Log_print0(Diags_ENTRY, "Server_delete: MessageQ_delete failed");
+ goto leave;
+ }
+
+ Log_print0(Diags_ENTRY, "Server_delete: MessageQ deleted");
+
+ /* delete slave GateMP */
+ status = GateMP_delete(&Module.slaveGateMPHandle);
+ if (status < 0) {
+ Log_print0(Diags_ENTRY, "Server_delete: GateMP_delete failed");
+ goto leave;
+ }
+
+ Log_print0(Diags_ENTRY, "Server_delete: slave GateMP deleted");
+
+leave:
+ if (status < 0) {
+ Log_error1("Server_delete: error=0x%x", (IArg)status);
+ }
+
+ /* disable log events */
+ Log_print1(Diags_EXIT, "<-- Server_delete: %d", (IArg)status);
+ Diags_setMask(MODULE_NAME"-EXF");
+
+ return(status);
+}
+
+/*
+ * ======== Server_exit ========
+ */
+
+Void Server_exit(Void)
+{
+ /*
+ * Note that there isn't a Registry_removeModule() yet:
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=315448
+ *
+ * ... but this is where we'd call it.
+ */
+}
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Error_Block eb;
+ Task_Params taskParams;
+
+ Log_print0(Diags_ENTRY, "--> main:");
+
+ /* must initialize the error block before using it */
+ Error_init(&eb);
+
+ /* create main thread (interrupts not enabled in main on BIOS) */
+ Task_Params_init(&taskParams);
+ taskParams.instance->name = "smain";
+ taskParams.stackSize = 0x1000;
+ Task_create(smain, &taskParams, &eb);
+
+ if (Error_check(&eb)) {
+ System_abort("main: failed to create application startup thread");
+ }
+
+ /* start scheduler, this never returns */
+ BIOS_start();
+
+ /* should never get here */
+ Log_print0(Diags_EXIT, "<-- main:");
+ return (0);
+}
+
+
+/*
+ * ======== smain ========
+ */
+Void smain(UArg arg0, UArg arg1)
+{
+ Int status = 0;
+
+ Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");
+
+ /* initialize modules */
+ Server_init();
+
+ /* turn on Diags_INFO trace */
+ Diags_setMask("Server+F");
+
+ /* server setup phase */
+ status = Server_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server execute phase */
+ status = Server_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* server shutdown phase */
+ status = Server_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* finalize modules */
+ Server_exit();
+
+leave:
+ Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
+ return;
+}
diff --git a/packages/ti/ipc/tests/gatempapp.cfg b/packages/ti/ipc/tests/gatempapp.cfg
--- /dev/null
@@ -0,0 +1,194 @@
+/* root of the configuration object model */
+var Program = xdc.useModule('xdc.cfg.Program');
+
+/* application uses the following modules and packages */
+xdc.useModule('xdc.runtime.Assert');
+xdc.useModule('xdc.runtime.Diags');
+xdc.useModule('xdc.runtime.Error');
+xdc.useModule('xdc.runtime.Log');
+xdc.useModule('xdc.runtime.Registry');
+
+xdc.useModule('ti.sysbios.knl.Semaphore');
+xdc.useModule('ti.sysbios.knl.Task');
+
+
+xdc.loadPackage('ti.sdo.ipc.family.vayu');
+xdc.useModule('ti.sdo.ipc.family.vayu.InterruptDsp');
+xdc.loadPackage('ti.ipc.rpmsg');
+xdc.loadPackage('ti.ipc.family.vayu');
+
+
+/*
+ * ======== IPC Configuration ========
+ */
+xdc.loadPackage('ti.ipc.ipcmgr');
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+BIOS.addUserStartupFunction('&IpcMgr_callIpcStart');
+
+/* describe the processors in the system */
+var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+MultiProc.setConfig("DSP1", ["HOST", "IPU2", "IPU1", "DSP2", "DSP1"]);
+
+/* GateMP host support */
+var GateMP = xdc.useModule('ti.sdo.ipc.GateMP');
+GateMP.hostSupport = true;
+
+/* shared region configuration */
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+
+/* configure SharedRegion #0 (IPC) */
+var SR0Mem = Program.cpu.memoryMap["SR_0"];
+
+SharedRegion.setEntryMeta(0,
+ new SharedRegion.Entry({
+ name: "SR0",
+ base: SR0Mem.base,
+ len: SR0Mem.len,
+ ownerProcId: MultiProc.getIdMeta("DSP1"),
+ cacheEnable: true,
+ isValid: true
+ })
+);
+
+/* Override the default resource table with my own to add SR0 */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.customTable = true;
+
+var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+Cache.setMarMeta(0xa0000000, 0x02000000, Cache.Mar_DISABLE);
+var L1cache = new Cache.Size();
+L1cache.l1dSize = Cache.L1Size_0K;
+
+/*
+ * ======== SYS/BIOS Configuration ========
+ */
+if (Program.build.profile == "debug") {
+ BIOS.libType = BIOS.LibType_Debug;
+} else {
+ BIOS.libType = BIOS.LibType_Custom;
+}
+
+
+/* no rts heap */
+Program.argSize = 100; /* minimum size */
+Program.stack = 0x1000;
+
+xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
+var GateSwi = xdc.useModule('ti.sysbios.gates.GateSwi');
+
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+Task.common$.namedInstance = true;
+
+/* default memory heap */
+var Memory = xdc.useModule('xdc.runtime.Memory');
+Memory.defaultHeapSize = 0x20000;
+
+/* create a heap for MessageQ messages */
+var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
+var params = new HeapBuf.Params;
+params.align = 8;
+params.blockSize = 512;
+params.numBlocks = 256;
+var msgHeap = HeapBuf.create(params);
+
+var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
+MessageQ.registerHeapMeta(msgHeap, 0);
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+//MessageQ.SetupTransportProxy = VirtioSetup;
+
+/* Setup NameServer remote proxy */
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+/* Enable Memory Translation module that operates on the BIOS Resource Table */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.loadSegment = "EXT_CODE"
+
+
+/* Use SysMin because trace buffer address is required for Linux/QNX
+ * trace debug driver, plus provides better performance.
+ */
+var System = xdc.useModule('xdc.runtime.System');
+var SysMin = xdc.useModule('ti.trace.SysMin');
+System.SupportProxy = SysMin;
+SysMin.bufSize = 0x10000;
+
+Program.sectMap[".tracebuf"] = "TRACE_BUF";
+Program.sectMap[".errorbuf"] = "EXC_DATA";
+
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+Clock.tickSource = Clock.TickSource_NULL;
+
+var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
+
+/* Skip the Timer frequency verification check. Need to remove this later */
+Timer.checkFrequency = false;
+
+/* Match this to the SYS_CLK frequency sourcing the dmTimers.
+ * Not needed once the SYS/BIOS family settings is updated. */
+Timer.intFreq.hi = 0;
+Timer.intFreq.lo = 19200000;
+
+
+/*
+ * ======== Power Management Configuration ========
+ */
+/* Modules used in Power Management */
+xdc.loadPackage('ti.pm');
+
+/* Idle function that periodically flushes the unicache */
+var Idle = xdc.useModule('ti.sysbios.knl.Idle');
+Idle.addFunc('&VirtQueue_cacheWb');
+
+
+/*
+ * ======== Instrumentation Configuration ========
+ */
+
+/* system logger */
+var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
+var LoggerSysParams = new LoggerSys.Params();
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+
+/* Enable Logger: */
+Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
+
+/* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
+var Text = xdc.useModule('xdc.runtime.Text');
+Text.isLoaded = true;
+
+/* enable runtime Diags_setMask() for non-XDC spec'd modules */
+var Diags = xdc.useModule('xdc.runtime.Diags');
+Diags.setMaskEnabled = true;
+
+/* override diags mask for selected modules */
+xdc.useModule('xdc.runtime.Main');
+Diags.setMaskMeta("xdc.runtime.Main",
+ Diags.ENTRY | Diags.EXIT | Diags.INFO, Diags.RUNTIME_ON);
+Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+ Diags.INFO|Diags.USER1|Diags.STATUS, Diags.ALWAYS_ON);
+Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg",
+ Diags.INFO, Diags.ALWAYS_ON);
+
+var Registry = xdc.useModule('xdc.runtime.Registry');
+Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
+Registry.common$.diags_EXIT = Diags.RUNTIME_OFF;
+Registry.common$.diags_INFO = Diags.ALWAYS_ON;
+Registry.common$.diags_USER1 = Diags.ALWAYS_ON;
+Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
+Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
+
+VirtioSetup.common$.diags_INFO = Diags.ALWAYS_ON;
+
+var Main = xdc.useModule('xdc.runtime.Main');
+Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
+Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;
+
+/* enable exception callstack backtrace */
+var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+if (Program.build.profile == "debug") {
+ Hwi.enableException = true;
+}
diff --git a/packages/ti/ipc/tests/gatempapp_rsc_table_vayu_dsp.h b/packages/ti/ipc/tests/gatempapp_rsc_table_vayu_dsp.h
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== gatempapp_rsc_table_vayu_dsp.h ========
+ *
+ * Define the resource table entries for all DSP cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_DSP_H_
+#define _RSC_TABLE_DSP_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* DSP Memory Map */
+#define L4_44XX_BASE 0x4A000000
+
+#define L4_PERIPHERAL_L4CFG (L4_44XX_BASE)
+#define DSP_PERIPHERAL_L4CFG 0x4A000000
+
+#define L4_PERIPHERAL_L4PER 0x48000000
+#define DSP_PERIPHERAL_L4PER 0x48000000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define DSP_PERIPHERAL_L4EMU 0x54000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define DSP_PERIPHERAL_DMM 0x4E000000
+
+#define L3_PERIPHERAL_ISS 0x52000000
+#define DSP_PERIPHERAL_ISS 0x52000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define DSP_TILER_MODE_0_1 0x60000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define DSP_TILER_MODE_2 0x70000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define DSP_TILER_MODE_3 0x78000000
+
+#define DSP_MEM_TEXT 0x95000000
+/* Co-locate alongside TILER region for easier flushing */
+#define DSP_MEM_IOBUFS 0x80000000
+#define DSP_MEM_DATA 0x95100000
+#define DSP_MEM_HEAP 0x95200000
+
+//0x85900000
+#define DSP_SR0_VIRT 0xBFC00000
+#define DSP_SR0 0xBFC00000
+
+#define DSP_MEM_IPC_DATA 0x9F000000
+#define DSP_MEM_IPC_VRING 0xA0000000
+#define DSP_MEM_RPMSG_VRING0 0xA0000000
+#define DSP_MEM_RPMSG_VRING1 0xA0004000
+#define DSP_MEM_VRING_BUFS0 0xA0040000
+#define DSP_MEM_VRING_BUFS1 0xA0080000
+
+#define DSP_MEM_IPC_VRING_SIZE SZ_1M
+#define DSP_MEM_IPC_DATA_SIZE SZ_1M
+#define DSP_MEM_TEXT_SIZE SZ_1M
+#define DSP_MEM_DATA_SIZE SZ_1M
+#define DSP_MEM_HEAP_SIZE (SZ_1M * 3)
+#define DSP_MEM_IOBUFS_SIZE (SZ_1M * 89)
+#define DSP_SR0_SIZE (SZ_1M * 1)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ */
+/* This address is derived from current IPU & ION carveouts */
+#ifdef OMAP5
+#define PHYS_MEM_IPC_VRING 0x95000000
+#else
+#define PHYS_MEM_IPC_VRING 0x98800000
+#endif
+
+/* Need to be identical to that of IPU */
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define DSP_RPMSG_VQ0_SIZE 256
+#define DSP_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_DSP_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[17]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* heap carveout entry */
+ struct fw_rsc_carveout heap_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 17, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, heap_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_DSP_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { DSP_MEM_RPMSG_VRING0, 4096, DSP_RPMSG_VQ0_SIZE, 1, 0 },
+ { DSP_MEM_RPMSG_VRING1, 4096, DSP_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_TEXT, 0,
+ DSP_MEM_TEXT_SIZE, 0, 0, "DSP_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_DATA, 0,
+ DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_HEAP, 0,
+ DSP_MEM_HEAP_SIZE, 0, 0, "DSP_MEM_HEAP",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_IPC_DATA, 0,
+ DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:dsp",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ DSP_MEM_IPC_VRING_SIZE, 0, 0, "DSP_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ DSP_MEM_IOBUFS_SIZE, 0, 0, "DSP_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "DSP_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER, L4_PERIPHERAL_L4PER,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4PER",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "DSP_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_ISS, L3_PERIPHERAL_ISS,
+ SZ_256K, 0, 0, "DSP_PERIPHERAL_ISS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_SR0_VIRT, DSP_SR0,
+ DSP_SR0_SIZE, 0, 0, "DSP_SR0",
+ },
+
+};
+
+#endif /* _RSC_TABLE_DSP_H_ */
index 685e3dbf174d44dfcba11358dbde68cc8f5ba311..576c8594c8f4471572c1431827a6f552ef38b244 100644 (file)
stackMemory: "EXT_DATA",
};
+/* Shared region definition used in GateMP app */
+var evmDRA7XX_SR_0 = {
+ name: "SR_0", space: "data", access: "RWX",
+ base: 0xBFC00000, len: 0x100000,
+ comment: "SR#0 Memory (1 MB)"
+};
+
/* Memory Map for ti.platforms.evmDRA7XX:dsp1 and ti.platforms.evmDRA7XX:dsp2
*
* --- External Memory ---
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"
}
};
[ "EXT_HEAP", evmDRA7XX_ExtMemMapDsp.EXT_HEAP ],
[ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp.TRACE_BUF ],
[ "EXC_DATA", evmDRA7XX_ExtMemMapDsp.EXC_DATA ],
- [ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ]
+ [ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ],
+ [ evmDRA7XX_SR_0.name, evmDRA7XX_ExtMemMapDsp.SR_0 ],
],
codeMemory: "EXT_CODE",
dataMemory: "EXT_DATA",
defs: extraDefs
}).addObjects(["ping_rpmsg.c"]);
+ /* gatempapp */
+ if (platform.match(/^ti\.platform\.vayu\.dsp1/) ||
+ platform.match(/^ti\.platforms\.evmDRA7XX:dsp1$/)) {
+ Pkg.addExecutable(name + "/gatempapp", targ, platform, {
+ cfgScript: "gatempapp",
+ }).addObjects(["gatempapp.c"]);
+ }
+
/* messageq_multicore - only for our homogeneous multicore platforms */
if (platform.match(/^ti\.platforms\.simKepler/) ||
(platform.match(/^ti.platforms.evmTCI6638K2K/)) ||
diff --git a/qnx/src/tests/GateMPApp/GateMPApp.c b/qnx/src/tests/GateMPApp/GateMPApp.c
--- /dev/null
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== GateMPApp.c ========
+ *
+ */
+
+/* host header files */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/MessageQ.h>
+#include <ti/ipc/GateMP.h>
+
+/* local header files */
+#include "GateMPApp.h"
+
+#include <ti/shmemallocator/SharedMemoryAllocatorUsr.h>
+#include <ti/ipc/tests/GateMPAppCommon.h>
+
+/* module structure */
+typedef struct {
+ MessageQ_Handle hostQue; /* created locally */
+ MessageQ_QueueId slaveQue; /* opened remotely */
+ UInt16 heapId; /* MessageQ heapId */
+ UInt32 msgSize; /* Size of messages */
+ volatile UInt32 * intPtr; /* Integer pointer */
+ UInt32 physAddr; /* Physical address of shared memory */
+ GateMP_Handle hostGateMPHandle; /* handle to host-created gate */
+ GateMP_Handle slaveGateMPHandle; /* handle to slave-created gate */
+ shm_buf buf; /* shared memory buffer */
+} GateMPApp_Module;
+
+/* private data */
+static GateMPApp_Module Module;
+
+
+/*
+ * ======== GateMPApp_create ========
+ */
+
+Int GateMPApp_create()
+{
+ Int status =0;
+ MessageQ_Params msgqParams;
+ GateMP_Params gateParams;
+
+ printf("--> GateMPApp_create:\n");
+
+ /* setting default values */
+ Module.hostQue = NULL;
+ Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
+ Module.heapId = GateMPApp_MsgHeapId;
+ Module.intPtr = NULL;
+ Module.physAddr = 0;
+ Module.hostGateMPHandle = NULL;
+ Module.slaveGateMPHandle = NULL;
+ Module.msgSize = sizeof(GateMPApp_Msg);
+
+ /* create local message queue (inbound messages) */
+ MessageQ_Params_init(&msgqParams);
+
+ Module.hostQue = MessageQ_create(GateMPApp_HostMsgQueName, &msgqParams);
+
+ if (Module.hostQue == NULL) {
+ printf("GateMPApp_create: Failed creating MessageQ\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* open the remote message queue */
+ do {
+ status = MessageQ_open(GateMPApp_SlaveMsgQueName, &Module.slaveQue);
+ sleep(1);
+ } while (status == MessageQ_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("GateMPApp_create: Failed opening MessageQ\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* allocate space from shared memory for an integer */
+ status = SHM_alloc_aligned(sizeof(UInt32), sizeof(UInt32), &Module.buf);
+ if (status < 0) {
+ printf("GateMPApp_create: Could not allocate shared memory\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+ Module.intPtr = (UInt32 *)Module.buf.vir_addr;
+ Module.physAddr = (UInt32)Module.buf.phy_addr;
+
+ if ((Module.intPtr == NULL) || (Module.physAddr == NULL)) {
+ printf("GateMPApp_create: Failed to get buffer address\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* create GateMP */
+ GateMP_Params_init(&gateParams);
+
+ gateParams.name = GATEMP_HOST_NAME;
+ gateParams.localProtect = GateMP_LocalProtect_PROCESS;
+ gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+
+ Module.hostGateMPHandle = GateMP_create (&gateParams);
+
+ if (Module.hostGateMPHandle == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ printf("GateMPApp_create: Failed to create GateMP\n");
+ goto leave;
+ }
+ printf("GateMPApp_create: Host is ready\n");
+
+leave:
+ printf("<-- GateMPApp_create:\n");
+ return(status);
+}
+
+
+/*
+ * ======== GateMPApp_delete ========
+ */
+Int GateMPApp_delete(Void)
+{
+ Int status;
+ GateMPApp_Msg * msg;
+
+ printf("--> GateMPApp_delete:\n");
+
+ /* allocate message */
+ msg = (GateMPApp_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+
+ if (msg == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* sending shutdown command */
+ msg->cmd = GATEMPAPP_CMD_SHUTDOWN;
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+
+ /* wait for acknowledgement message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+
+ if (status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SHUTDOWN_ACK) {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ /* delete GateMP */
+ GateMP_delete(&Module.hostGateMPHandle);
+
+ /* free shared memory buffer */
+ status = SHM_release(&Module.buf);
+ if(status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* close remote resources */
+ status = MessageQ_close(&Module.slaveQue);
+
+ if (status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* delete the host message queue */
+ status = MessageQ_delete(&Module.hostQue);
+
+ if (status < 0) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+leave:
+ printf("<-- GateMPApp_delete:\n");
+ return(status);
+}
+
+
+/*
+ * ======== GateMPApp_exec ========
+ */
+Int GateMPApp_exec(Void)
+{
+ Int status;
+ Int i;
+ GateMPApp_Msg * msg;
+ IArg gateKey = 0;
+ UInt32 num;
+
+ printf("--> GateMPApp_exec:\n");
+
+ /* set shared variable initial value */
+ *Module.intPtr = 500;
+
+ /* allocate message */
+ msg = (GateMPApp_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+ if (msg == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = GATEMPAPP_CMD_SPTR_ADDR;
+ msg->payload = Module.physAddr;
+
+ /* send message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+
+ /* wait for return message */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SPTR_ADDR_ACK)
+ {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ /* open slave-created GateMP */
+ do {
+ status = GateMP_open(GATEMP_SLAVE_NAME, &Module.slaveGateMPHandle);
+ } while (status == GateMP_E_NOTFOUND);
+
+ if (status < 0) {
+ printf("GateMPApp_exec: Failed to open slave-created GateMP");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ printf("GateMPApp_exec: Using host-created gate\n");
+ for (i = 0; i < LOOP_ITR; i++) {
+ /* read the shared variable as long as no one is currently modifying
+ * it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.hostGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if (rand() % 2) {
+ *Module.intPtr -= 1;
+ }
+ else {
+ *Module.intPtr += 1;
+ }
+
+ /* read shared variable value */
+ num = *Module.intPtr;
+ printf("GateMPApp_exec: Current value: %d, " \
+ "previously read=%d\n", *Module.intPtr, num);
+
+ if (*Module.intPtr != num) {
+ printf("GateMPApp_exec: mismatch in variable value." \
+ "Test failed.\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* exit GateMP */
+ GateMP_leave(Module.hostGateMPHandle, gateKey);
+ }
+
+ /* allocate message */
+ msg = (GateMPApp_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+ if (msg == NULL) {
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* set the return address in the message header */
+ MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
+
+ /* fill in message payload */
+ msg->cmd = GATEMPAPP_CMD_SYNC;
+
+ /* send sync message */
+ MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
+
+ /* wait for return sync message before we switch gates */
+ status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
+ MessageQ_FOREVER);
+ if (status < 0) {
+ goto leave;
+ }
+
+ if (msg->cmd != GATEMPAPP_CMD_SYNC)
+ {
+ status = GATEMPAPP_E_UNEXPECTEDMSG;
+ goto leave;
+ }
+
+ /* free the message */
+ MessageQ_free((MessageQ_Msg)msg);
+
+ printf("GateMPApp_exec: Using slave-created gate\n");
+ for (i = 0; i < LOOP_ITR; i++) {
+ /* read the shared variable as long as no one is currently modifying
+ * it
+ */
+
+ /* enter GateMP */
+ gateKey = GateMP_enter(Module.slaveGateMPHandle);
+
+ /* randomly modify the shared variable */
+ if (rand() % 2) {
+ *Module.intPtr -= 1;
+ }
+ else {
+ *Module.intPtr += 1;
+ }
+
+ /* read shared variable value */
+ num = *Module.intPtr;
+ printf("GateMPApp_exec: Current value: %d, " \
+ "previously read=%d\n", *Module.intPtr, num);
+
+ if (*Module.intPtr != num) {
+ printf("GateMPApp_exec: mismatch in variable value." \
+ "Test failed.\n");
+ status = GATEMPAPP_E_FAILURE;
+ goto leave;
+ }
+
+ /* exit GateMP */
+ GateMP_leave(Module.slaveGateMPHandle, gateKey);
+ }
+
+leave:
+ if (Module.slaveGateMPHandle) {
+ GateMP_close(&Module.slaveGateMPHandle);
+ }
+
+ printf("<-- GateMPApp_exec: %d\n", status);
+ return(status);
+}
diff --git a/qnx/src/tests/GateMPApp/GateMPApp.h b/qnx/src/tests/GateMPApp/GateMPApp.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.
+ */
+
+/*
+ * ======== GateMPApp.h ========
+ *
+ */
+
+#ifndef GateMPApp__include
+#define GateMPApp__include
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+Int GateMPApp_create();
+Int GateMPApp_delete();
+Int GateMPApp_exec();
+
+
+#if defined (__cplusplus)
+}
+#endif /* defined (__cplusplus) */
+#endif /* GateMPApp__include */
diff --git a/qnx/src/tests/GateMPApp/GateMPApp.use b/qnx/src/tests/GateMPApp/GateMPApp.use
--- /dev/null
@@ -0,0 +1,7 @@
+GateMPApp Test
+
+Syntax:
+ GateMPApp
+
+Examples:
+ GateMPApp Run the app with the slave processor that has been loaded
diff --git a/qnx/src/tests/GateMPApp/Makefile b/qnx/src/tests/GateMPApp/Makefile
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+LIST=CPU
+include recurse.mk
diff --git a/qnx/src/tests/GateMPApp/arm/Makefile b/qnx/src/tests/GateMPApp/arm/Makefile
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+LIST=VARIANT
+ifndef QRECURSE
+QRECURSE=recurse.mk
+ifdef QCONFIG
+QRDIR=$(dir $(QCONFIG))
+endif
+endif
+include $(QRDIR)$(QRECURSE)
diff --git a/qnx/src/tests/GateMPApp/arm/o.g.le.v7/Makefile b/qnx/src/tests/GateMPApp/arm/o.g.le.v7/Makefile
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+include ../../common.mk
+
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/api/arm/a.g.le.v7/libipc_g.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/utils/arm/a.g.le.v7/libutils_g.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+$(PROJECT_ROOT)/arm/o.g.le.v7/GateMPApp_g: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7/libsharedmemallocator.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc_g = -Bstatic
+LIBPOST_ipc_g = -Bdynamic
+LIBPREF_utils_g = -Bstatic
+LIBPOST_utils_g = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+LIBPREF_sharedmemallocator = -Bstatic
+LIBPOST_sharedmemallocator = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/api/arm/a.g.le.v7
+LIBS += ipc_g
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/utils/arm/a.g.le.v7
+LIBS += utils_g
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7
+LIBS += sharedmemallocator
diff --git a/qnx/src/tests/GateMPApp/arm/o.le.v7/Makefile b/qnx/src/tests/GateMPApp/arm/o.le.v7/Makefile
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+include ../../common.mk
+
+CCFLAGS += -O3
+
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/api/arm/a.le.v7/libipc.a
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/utils/arm/a.le.v7/libutils.a
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7/libipc_clientS.a
+$(PROJECT_ROOT)/arm/o.le.v7/GateMPApp: $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7/libsharedmemallocator.a
+
+# link with syslink static library, dynamic for others
+LIBPREF_ipc = -Bstatic
+LIBPOST_ipc = -Bdynamic
+LIBPREF_utils = -Bstatic
+LIBPOST_utils = -Bdynamic
+LIBPREF_ipc_client = -Bstatic
+LIBPOST_ipc_client = -Bdynamic
+LIBPREF_sharedmemallocator = -Bstatic
+LIBPOST_sharedmemallocator = -Bdynamic
+
+# add libpath and libs
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/api/arm/a.le.v7
+LIBS += ipc
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/utils/arm/a.le.v7
+LIBS += utils
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/ti/syslink/build/Qnx/lib/arm/so.le.v7
+LIBS += ipc_clientS
+EXTRA_LIBVPATH += $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/arm/a.le.v7
+LIBS += sharedmemallocator
diff --git a/qnx/src/tests/GateMPApp/common.mk b/qnx/src/tests/GateMPApp/common.mk
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2013, Texas Instruments Incorporated
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Texas Instruments Incorporated nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+ifndef QCONFIG
+QCONFIG=qconfig.mk
+endif
+include $(QCONFIG)
+
+NAME = GateMPApp
+
+define PINFO
+PINFO DESCRIPTION=IPC QNX GATEMP SAMPLE
+endef
+
+ifeq ("$(SYSLINK_PLATFORM)", "vayu")
+INSTALLDIR = bin/tests
+else
+INSTALLDIR = /dev/null
+endif
+
+CCOPTS += -DSYSLINK_BUILDOS_QNX
+
+# source path
+EXTRA_SRCVPATH += \
+ $(IPC_REPO)/qnx/src/tests/GateMPApp \
+
+EXCLUDE_OBJS =
+
+# include path
+EXTRA_INCVPATH += \
+ $(IPC_REPO)/packages \
+ $(IPC_REPO)/qnx/include \
+ $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/usr/public \
+ $(IPC_REPO)/qnx/src/ipc3x_dev/sharedmemallocator/resmgr/public
+
+include $(MKFILES_ROOT)/qtargets.mk
+
+LDFLAGS += -M
diff --git a/qnx/src/tests/GateMPApp/main_host.c b/qnx/src/tests/GateMPApp/main_host.c
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2013 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ======== main_host.c ========
+ *
+ */
+
+/* cstdlib header files */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* package header files */
+#include <ti/ipc/Std.h>
+#include <ti/ipc/Ipc.h>
+
+#include <ti/ipc/MultiProc.h>
+
+/* local header files */
+#include "GateMPApp.h"
+
+/* private functions */
+static Int Main_main(Void);
+static Int Main_parseArgs(Int argc, Char *argv[]);
+
+
+#define Main_USAGE "\
+Usage:\n\
+ GateMPApp [options]\n\
+\n\
+Options:\n\
+ h : print this help message\n\
+\n\
+Examples:\n\
+ GateMPApp\n\
+ GateMPApp -h\n\
+\n"
+
+
+/*
+ * ======== main ========
+ */
+Int main(Int argc, Char* argv[])
+{
+ Int status;
+
+ printf("--> main:\n");
+
+ /* parse command line */
+ status = Main_parseArgs(argc, argv);
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* Ipc initialization */
+ status = Ipc_start();
+
+ if (status >= 0) {
+ /* application create, exec, delete */
+ status = Main_main();
+
+ /* Ipc finalization */
+ Ipc_stop();
+ }
+ else {
+ printf("Ipc_start failed: status = %d\n", status);
+ goto leave;
+ }
+
+leave:
+ printf("<-- main:\n");
+ status = (status >= 0 ? 0 : status);
+
+ return (status);
+}
+
+
+/*
+ * ======== Main_main ========
+ */
+Int Main_main(Void)
+{
+ Int status = 0;
+
+ printf("--> Main_main:\n");
+
+ /* BEGIN application phase */
+
+ /* application create phase */
+ status = GateMPApp_create();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application execute phase */
+ status = GateMPApp_exec();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+ /* application delete phase */
+ status = GateMPApp_delete();
+
+ if (status < 0) {
+ goto leave;
+ }
+
+leave:
+ printf("<-- Main_main:\n");
+
+ status = (status >= 0 ? 0 : status);
+ return (status);
+}
+
+
+/*
+ * ======== Main_parseArgs ========
+ */
+Int Main_parseArgs(Int argc, Char *argv[])
+{
+ Int x, cp, opt;
+ Int status = 0;
+
+
+ /* parse the command line options */
+ for (opt = 1; (opt < argc) && (argv[opt][0] == '-'); opt++) {
+ for (x = 0, cp = 1; argv[opt][cp] != '\0'; cp++) {
+ x = (x << 8) | (int)argv[opt][cp];
+ }
+
+ switch (x) {
+ case 'h': /* -h */
+ printf("%s", Main_USAGE);
+ exit(0);
+ break;
+
+ default:
+ printf(
+ "Error: %s, line %d: invalid option, %c\n",
+ __FILE__, __LINE__, (Char)x);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+ }
+
+ /* parse the command line arguments */
+ if (opt < argc) {
+ printf(
+ "Error: %s, line %d: too many arguments\n",
+ __FILE__, __LINE__);
+ printf("%s", Main_USAGE);
+ status = -1;
+ goto leave;
+ }
+
+leave:
+ return(status);
+}