summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2017-06-05 14:42:25 -0500
committerAngela Stegmaier <angelabaker@ti.com>2017-06-30 10:42:36 -0500
commitfb4b287ba9c40cb50cb0eb3f9e3fd565dea075bb (patch)
treecf82672c8164a4eec435e99467b81ab50a34e444
parent4102e9c35951b5ab5e1bbc0b65e2e501a77a1104 (diff)
downloadipc-fb4b287ba9c40cb50cb0eb3f9e3fd565dea075bb.tar.gz
QNX: Tests: Add NameServer and GateMP to Fault Test
Add NameServer and GatemP to fault recovery test in order to test error recovery of these modules. Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r--packages/ti/ipc/tests/gatempapp.cfg3
-rw-r--r--packages/ti/ipc/tests/messageq_fault.c4
-rw-r--r--packages/ti/ipc/tests/package.bld16
-rw-r--r--qnx/src/tests/Fault/Fault.c76
-rw-r--r--qnx/src/tests/Fault/common.mk3
5 files changed, 97 insertions, 5 deletions
diff --git a/packages/ti/ipc/tests/gatempapp.cfg b/packages/ti/ipc/tests/gatempapp.cfg
index 1a90a86..dedb54f 100644
--- a/packages/ti/ipc/tests/gatempapp.cfg
+++ b/packages/ti/ipc/tests/gatempapp.cfg
@@ -177,6 +177,9 @@ Power.loadSegment = "PM_DATA";
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
Idle.addFunc('&VirtQueue_cacheWb');
+var Deh = xdc.useModule('ti.deh.Deh');
+
+Idle.addFunc('&ti_deh_Deh_idleBegin'); /* Must be placed before pwr mgmt */
/*
* ======== Instrumentation Configuration ========
diff --git a/packages/ti/ipc/tests/messageq_fault.c b/packages/ti/ipc/tests/messageq_fault.c
index b4e92ca..35f2c9b 100644
--- a/packages/ti/ipc/tests/messageq_fault.c
+++ b/packages/ti/ipc/tests/messageq_fault.c
@@ -48,6 +48,10 @@
#include <ti/ipc/MessageQ.h>
+#if defined (DSP_1)
+#include "gatempapp_rsc_table_vayu_dsp.h"
+#endif
+
#define SLAVE_MESSAGEQNAME "SLAVE"
#define MessageQ_payload(m) ((void *)((char *)(m) + sizeof(MessageQ_MsgHeader)))
diff --git a/packages/ti/ipc/tests/package.bld b/packages/ti/ipc/tests/package.bld
index 9287d0a..6b2a9de 100644
--- a/packages/ti/ipc/tests/package.bld
+++ b/packages/ti/ipc/tests/package.bld
@@ -531,10 +531,18 @@ for (var i = 0; i < Build.targets.length; i++) {
}
/* messageq_fault */
- Pkg.addExecutable(name + "/messageq_fault", targ, platform, {
- cfgScript: "rpmsg_transport",
- defs: extraDefs
- }).addObjects(["messageq_fault.c"]);
+ if (platform.match(/^ti\.platform\.vayu\.dsp1/) ||
+ platform.match(/^ti\.platforms\.evmDRA7XX:dsp1$/)) {
+ Pkg.addExecutable(name + "/messageq_fault", targ, platform, {
+ cfgScript: "gatempapp",
+ defs: "-D DSP_1" + extraDefs
+ }).addObjects(["messageq_fault.c"]);
+ } else {
+ Pkg.addExecutable(name + "/messageq_fault", targ, platform, {
+ cfgScript: "rpmsg_transport",
+ defs: extraDefs
+ }).addObjects(["messageq_fault.c"]);
+ }
/* ping_rpmsg */
Pkg.addExecutable(name + "/ping_rpmsg", targ, platform, {
diff --git a/qnx/src/tests/Fault/Fault.c b/qnx/src/tests/Fault/Fault.c
index 436a570..530a0dd 100644
--- a/qnx/src/tests/Fault/Fault.c
+++ b/qnx/src/tests/Fault/Fault.c
@@ -46,6 +46,9 @@
#include <ti/ipc/Std.h>
#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
+#include <_NameServer.h>
+#include <ti/ipc/NameServer.h>
+#include <ti/ipc/GateMP.h>
/* App defines: Must match on remote proc side: */
#define HEAPID 0u
@@ -55,6 +58,9 @@
#define PROC_ID_DFLT 1 /* Host is zero, remote cores start at 1 */
#define NUM_LOOPS_DFLT 100
+#define NSNAME "MyNS"
+#define GATEMP_HOST_NAME "GATE_MP1"
+
typedef struct SyncMsg {
MessageQ_MsgHeader header;
UInt32 numLoops; /* also used for msgId */
@@ -72,6 +78,11 @@ Int MessageQApp_execute(UInt32 numLoops, UInt16 procId, UInt32 faultId)
MessageQ_Handle msgqHandle;
char remoteQueueName[64];
UInt32 msgId;
+ NameServer_Params nsParams;
+ NameServer_Handle nsHandle;
+ Ptr ptr;
+ GateMP_Params gateParams;
+ GateMP_Handle hostGateMPHandle;
printf("Entered MessageQApp_execute\n");
@@ -89,6 +100,47 @@ Int MessageQApp_execute(UInt32 numLoops, UInt16 procId, UInt32 faultId)
sprintf(remoteQueueName, "%s_%s", SLAVE_MESSAGEQNAME,
MultiProc_getName(procId));
+ if (MultiProc_getId("DSP1") == procId) {
+ NameServer_Params_init(&nsParams);
+
+ nsParams.maxValueLen = sizeof(UInt32);
+ nsParams.maxNameLen = 32;
+
+ nsHandle = NameServer_create(NSNAME, &nsParams);
+ if (nsHandle == NULL) {
+ printf("Failed to create NameServer '%s'\n", NSNAME);
+ return -1;
+ }
+ else {
+ printf("Created NameServer '%s'\n", NSNAME);
+ }
+
+ ptr = NameServer_addUInt32(nsHandle, "TestNS", 0xdeadbeef);
+ if (ptr == NULL) {
+ printf("Failed to NameServer_addUInt32()\n");
+ return -1;
+ }
+ else {
+ printf("NameServer_addUInt32() returned %p\n", ptr);
+ }
+
+ /* create GateMP */
+ GateMP_Params_init(&gateParams);
+
+ gateParams.name = GATEMP_HOST_NAME;
+ gateParams.localProtect = GateMP_LocalProtect_PROCESS;
+ gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
+
+ hostGateMPHandle = GateMP_create (&gateParams);
+
+ if (hostGateMPHandle == NULL) {
+ status = -1;
+ printf("Failed to create GateMP\n");
+ NameServer_delete(&nsHandle);
+ goto cleanup;
+ }
+ }
+
/* Poll until remote side has it's messageQ created before we send: */
do {
status = MessageQ_open(remoteQueueName, &queueId);
@@ -97,6 +149,9 @@ Int MessageQApp_execute(UInt32 numLoops, UInt16 procId, UInt32 faultId)
if (status < 0) {
printf("Error in MessageQ_open [%d]\n", status);
+ if (MultiProc_getId("DSP1") == procId) {
+ NameServer_delete(&nsHandle);
+ }
goto cleanup;
}
else {
@@ -106,6 +161,10 @@ Int MessageQApp_execute(UInt32 numLoops, UInt16 procId, UInt32 faultId)
msg = MessageQ_alloc(HEAPID, sizeof(SyncMsg));
if (msg == NULL) {
printf("Error in MessageQ_alloc\n");
+ if (MultiProc_getId("DSP1") == procId) {
+ GateMP_delete(&hostGateMPHandle);
+ NameServer_delete(&nsHandle);
+ }
MessageQ_close(&queueId);
goto cleanup;
}
@@ -180,6 +239,13 @@ Int MessageQApp_execute(UInt32 numLoops, UInt16 procId, UInt32 faultId)
MessageQ_free(msg);
}
+ if (MultiProc_getId("DSP1") == procId) {
+ /* delete GateMP */
+ GateMP_delete(&hostGateMPHandle);
+
+ NameServer_delete(&nsHandle);
+ }
+
MessageQ_close(&queueId);
cleanup:
@@ -255,6 +321,11 @@ int main (int argc, char ** argv)
}
printf("Using numLoops: %d; procId : %d\n", numLoops, procId);
+ if (MultiProc_getId("DSP1") == procId) {
+ printf("Calling NameServer_setup()...\n");
+ NameServer_setup();
+ }
+
if (MessageQApp_execute(numLoops, procId, faultId) < 0) {
int nAttachAttempts = 1;
@@ -272,6 +343,11 @@ int main (int argc, char ** argv)
MessageQApp_execute(numLoops, procId, 0);
}
+ if (MultiProc_getId("DSP1") == procId) {
+ printf("Calling NameServer_destroy()...\n");
+ NameServer_destroy();
+ }
+
Ipc_stop();
exit:
diff --git a/qnx/src/tests/Fault/common.mk b/qnx/src/tests/Fault/common.mk
index 99655ce..6b5932b 100644
--- a/qnx/src/tests/Fault/common.mk
+++ b/qnx/src/tests/Fault/common.mk
@@ -51,7 +51,8 @@ EXCLUDE_OBJS =
# include path
EXTRA_INCVPATH += \
$(IPC_REPO)/packages \
- $(IPC_REPO)/qnx/include
+ $(IPC_REPO)/qnx/include \
+ $(IPC_REPO)/hlos_common/include
include $(MKFILES_ROOT)/qtargets.mk