QNX: Tests: Add NameServer and GateMP to Fault Test
authorAngela Stegmaier <angelabaker@ti.com>
Mon, 5 Jun 2017 19:42:25 +0000 (14:42 -0500)
committerAngela Stegmaier <angelabaker@ti.com>
Fri, 30 Jun 2017 15:42:36 +0000 (10:42 -0500)
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>
packages/ti/ipc/tests/gatempapp.cfg
packages/ti/ipc/tests/messageq_fault.c
packages/ti/ipc/tests/package.bld
qnx/src/tests/Fault/Fault.c
qnx/src/tests/Fault/common.mk

index 1a90a8653597e02a074e827208ea097aafd1e452..dedb54ff3cc1bc3157ee60f7ea00ce35661513d5 100644 (file)
@@ -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 ========
index b4e92caf58dcdd4209537c0e6c31b8960b116a14..35f2c9be83f24a71823e39d0536a533d6e606463 100644 (file)
 
 #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)))
index 9287d0a9a2db764ae5f189ebd186839ca6255fd0..6b2a9decc53465685cb57ce45a305d2df5d8c3d6 100644 (file)
@@ -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, {
index 436a570053944292d5e5c66639bb7b9dc616bdfa..530a0ddcd2fd5a7617afecfb339f38d8ffad6bf7 100644 (file)
@@ -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:
index 99655ceb056b5a9b5b568173ae6b19da44792fe6..6b5932bff5b8d3c94147fc2da706dda0e8e6e32a 100644 (file)
@@ -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